Batch #14681 by ragnarok-clanker: forced by an admin (6 lower score(s), 70 changed function(s)); checked with 555 compiled unit(s), including every includer of Source/Client/Mode/CLoginMode.h, Source/Client/Session.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/GrannyGameActor.h, Source/Contents/Actors/Pc.h, Source/Contents/Actors/RenderObject.h, Source/Contents/EffectResourceSwitcher.h, Source/Contents/Effects/CartCannon.h, Source/Contents/Effects/EZ2STREffectEx.h, Source/Contents/Effects/EffectActor.h, Source/Contents/Effects/MonsterSkillEffects.h, Source/Contents/Effects/RagEffect.h, Source/Contents/Effects/RectUpEffect.h, Source/Contents/Ground/GroundGeometry.h, Source/Network/Connection/Connection.h, Source/Resource/Audio/WaveResource.h, Source/Resource/Bitmap/BitmapResource.h, Source/Resource/EZeffectResource.h, Source/Resource/EmblemResource.h, Source/Resource/GifResource.h, Source/Resource/ImfResource.h, Source/Resource/Models/AnimatedModelResource.h, Source/Resource/Models/GrannyModelResource.h, Source/Resource/Models/ModelResource.h, Source/Resource/PaletteResource.h, Source/Resource/RmaResource.h, Source/Resource/Sprites/ActionResource.h, Source/Resource/Sprites/SpriteResource.h, Source/Resource/World/GroundResource.h, Source/Resource/World/TerrainResource.h, Source/Resource/World/WorldResource.h, Source/UI/Buttons/UIBmpRadioBtn.h, Source/UI/Buttons/UITextButton.h, Source/UI/Item/UIItemPurchaseWnd.h, Source/UI/Item/UIItemSellWnd.h, Source/UI/Item/UIItemSellWnd2.h, Source/UI/Item/UIItemStoreWnd.h, Source/UI/Item/UIItemWnd.h, Source/UI/Item/UIParaItemShopWnd.h, Source/UI/Items/UIItemRepairWnd.h, Source/UI/Items/UIMakeTargetListWnd.h, Source/UI/Items/UIMakeTargetProcessWnd.h, Source/UI/Items/UIWeaponRefineWnd.h, Source/UI/Rodex/UIRodexInboxWnd.h, Source/UI/Shop/UIMerchantItemShopWnd.h, Source/UI/Shop/UIMerchantMirrorItemWnd.h, Source/UI/Shop/UIMerchantShopMakeWnd.h, Source/UI/StylingShop/UIStylingShopWnd.h, Source/UI/UIChangeMaterialWnd.h, Source/UI/UIIngredientInfoWnd.h, Source/UI/UIItemReformWnd.h, Source/UI/UILapineScrollBar.h, Source/UI/Window/UIHotKeyWnd.h, Source/UI/Window/UINewSelectCharWnd.h.
86 lines
1.9 KiB
C++
86 lines
1.9 KiB
C++
#include "Client/Application/ErrorDialog.h"
|
|
#include "File/File.h"
|
|
#include "Render/DeviceContext/DCSurface.h"
|
|
#include "Resource/Bitmap/BitmapResource.h"
|
|
#include "Resource/ResourceMgr.h"
|
|
|
|
#include <cstring>
|
|
#include <windows.h>
|
|
|
|
// INLINED
|
|
CBitmapRes::~CBitmapRes() = default;
|
|
|
|
// OFFSET: 0x00749580
|
|
// FUNCTION: fn_07847
|
|
CBitmapRes* CBitmapRes::Create() {
|
|
return new CBitmapRes;
|
|
}
|
|
|
|
// OFFSET: 0x00749630
|
|
// FUNCTION: fn_07848
|
|
bool CBitmapRes::Load(const char* name) {
|
|
CFile file;
|
|
bool result = false;
|
|
if (name && file.Open(name, 0, true, false)) {
|
|
if (this->Decode(name, file.GetData(), file.GetSize(), false)) {
|
|
file.Close();
|
|
result = true;
|
|
} else {
|
|
file.Close();
|
|
}
|
|
}
|
|
|
|
file.Close();
|
|
return result;
|
|
}
|
|
|
|
// OFFSET: 0x00749850
|
|
// FUNCTION: fn_07850
|
|
void CBitmapRes::Unload() {
|
|
this->image.Clear();
|
|
}
|
|
|
|
// OFFSET: 0x00749780
|
|
// FUNCTION: fn_07849
|
|
bool CBitmapRes::Decode(const char* name, const void* data, int bytes, bool iconOnly) {
|
|
const char* extension = std::strrchr(name, '.');
|
|
if (!extension) {
|
|
return false;
|
|
}
|
|
|
|
if (lstrcmpiA(extension, ".bmp") == 0) {
|
|
return this->image.DecodeBitmap(data, bytes, iconOnly);
|
|
}
|
|
|
|
if (lstrcmpiA(extension, ".tga") == 0) {
|
|
return this->image.DecodeTga(data, bytes);
|
|
}
|
|
|
|
if (lstrcmpiA(extension, ".jpg") == 0) {
|
|
return this->image.DecodeJpeg(data, bytes);
|
|
}
|
|
|
|
if (lstrcmpiA(extension, ".png") == 0) {
|
|
return this->image.DecodePng(data, bytes, name);
|
|
}
|
|
|
|
ShowErrorDialog("Unsupport fileformat!", 0);
|
|
return false;
|
|
}
|
|
|
|
// INLINED
|
|
CBitmapRes::CBitmapRes(const char* extension, const char* prefix) {
|
|
ResourceMgr::Instance().Register(extension, prefix, this);
|
|
}
|
|
|
|
// GLOBAL: gl_25549
|
|
CBitmapRes g_tgaPrototype("tga", "texture\\");
|
|
|
|
// GLOBAL: gl_25550
|
|
CBitmapRes g_jpgPrototype("jpg", "texture\\");
|
|
|
|
// GLOBAL: gl_25551
|
|
CBitmapRes g_pngPrototype("png", "texture\\");
|
|
|
|
// GLOBAL: gl_25552
|
|
CBitmapRes g_bmpPrototype("bmp", "texture\\");
|