Batch #10253 by ragnarok-clanker: forced by an admin (2 lower score(s), 8 changed function(s)); checked with 24 compiled unit(s), including every includer of Source/Contents/GuildMgr.h, Source/Contents/Emblems/EmblemCache.h. Deletes: Source/Contents/Emblems/EmblemCache.h
72 lines
1.5 KiB
C++
72 lines
1.5 KiB
C++
#include "Resource/EmblemResource.h"
|
|
|
|
#include "Contents/GuildMgr.h"
|
|
#include "File/File.h"
|
|
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <string>
|
|
#include <zlib.h>
|
|
|
|
// INLINED
|
|
CEmblemRes::~CEmblemRes() = default;
|
|
|
|
// OFFSET: 0x0074C9F0
|
|
// FUNCTION: fn_07880
|
|
CEmblemRes* CEmblemRes::Create() {
|
|
return new CEmblemRes;
|
|
}
|
|
|
|
// OFFSET: 0x0074CA90
|
|
// FUNCTION: fn_07881
|
|
bool CEmblemRes::Load(const char* name) {
|
|
if (g_guildMgr->IsInvalidEmblem(name) == true) {
|
|
this->gif.CreateBlank(24, 24);
|
|
return true;
|
|
}
|
|
|
|
CFile file;
|
|
if (!file.Open(name, 0, true, false)) {
|
|
return false;
|
|
}
|
|
|
|
uLongf size = static_cast<uLongf>(static_cast<std::uint32_t>(g_guildMgr->m_timeout) * 1.2);
|
|
Bytef* buffer = static_cast<Bytef*>(std::malloc(size));
|
|
if (uncompress(buffer, &size, static_cast<const Bytef*>(file.GetData()), file.GetSize()) != Z_OK
|
|
|| this->gif.Decode("_emblem.bmp", buffer, size, true) != true) {
|
|
g_guildMgr->MarkInvalidEmblem(name);
|
|
this->gif.CreateBlank(24, 24);
|
|
}
|
|
|
|
file.Close();
|
|
std::free(buffer);
|
|
return true;
|
|
}
|
|
|
|
// OFFSET: 0x0074CD00
|
|
// FUNCTION: fn_07882
|
|
void CEmblemRes::Unload() {
|
|
this->gif.Unload();
|
|
}
|
|
|
|
// OFFSET: 0x0074CD10
|
|
// FUNCTION: fn_07883
|
|
void CEmblemRes::Slot02() {
|
|
this->gif.Slot02();
|
|
}
|
|
|
|
// OFFSET: 0x0074CD20
|
|
// FUNCTION: fn_07884
|
|
bool CEmblemRes::IsTransient() {
|
|
return this->gif.IsTransient();
|
|
}
|
|
|
|
// OFFSET: 0x0074CD40
|
|
// FUNCTION: fn_07885
|
|
void CEmblemRes::MissingFile(CRenderSystemBase*, const char*) {
|
|
}
|
|
|
|
// OFFSET: 0x0074CDC0
|
|
// FUNCTION: fn_07887
|
|
CEmblemRes::CEmblemRes() : CRes(), gif() {
|
|
}
|