Batch #2457 by ragnarok-clanker: 0 byte-identical, 48 confirmed by peer review. - fn_00152 TextureCache::TextureCache: logic confirmed by peer review - fn_01952 DrawAlphaRectangle: logic confirmed by peer review - fn_01953 DrawBlendedRectangle: logic confirmed by peer review - fn_01954 DrawTexturedRectangle: logic confirmed by peer review - fn_01955 DrawTextureRegion: logic confirmed by peer review - fn_02237 CRendererDX9::SaveLogo: logic confirmed by peer review - fn_02353 CRenderSystemDX9::CRenderSystemDX9: logic confirmed by peer review - fn_02447 TextureCache::~TextureCache: logic confirmed by peer review (already on main) - fn_02449 TextureCache::Upload: logic confirmed by peer review - fn_02451 TextureCache::Clear: logic confirmed by peer review (already on main) - fn_02452 TextureCache::Remove: logic confirmed by peer review (already on main) - fn_02453 TextureCache::Default: logic confirmed by peer review - fn_02454 TextureCache::Load: logic confirmed by peer review (already on main) - fn_02455 TextureCache::Create: logic confirmed by peer review - fn_02456 TextureCache::Reload: logic confirmed by peer review - fn_02457 TextureCache::ClearUnused: logic confirmed by peer review - fn_07897 EZeffectClip::Texture: logic confirmed by peer review - fn_07898 EZeffectClip::Texture: logic confirmed by peer review - fn_07958 C3dAnimModelRes::Load: logic confirmed by peer review - fn_07996 ModelNode::~ModelNode: logic confirmed by peer review - fn_08010 C3dGrannyModelRes::CreateTexture: logic confirmed by peer review - fn_08020 C3dModelResV2::ReadVersion1: logic confirmed by peer review - fn_08021 C3dModelResV2::ReadVersion2: logic confirmed by peer review - fn_08022 C3dModelResV2::ReadVersion3: logic confirmed by peer review - fn_09166 BinkMovies::Update: logic confirmed by peer review - fn_10122 UIRPData::DrawNamed: logic confirmed by peer review - fn_12091 UIWhisperWnd::Slot43: logic confirmed by peer review - fn_17556 GroundGeometry::Build: logic confirmed by peer review - fn_17565 GroundGeometry::BuildLightmaps: logic confirmed by peer review - fn_17581 GroundWaterState::Update: logic confirmed by peer review - fn_17587 GroundGeometry::DrawGrid: logic confirmed by peer review - fn_17599 GroundWaterState::Import: logic confirmed by peer review - fn_17842 ModeFade::Draw: logic confirmed by peer review - fn_17847 FadeOutMode: logic confirmed by peer review - fn_20019 CRagEffect::Blessing: logic confirmed by peer review - fn_20023 CRagEffect::Bottom: logic confirmed by peer review - fn_20024 CRagEffect::BowlingBash: logic confirmed by peer review - fn_20025 CRagEffect::CartRevolution: logic confirmed by peer review - fn_20042 CRagEffect::Entry: logic confirmed by peer review - fn_20054 CRagEffect::FrostDiver: logic confirmed by peer review - fn_20058 CRagEffect::GrimTooth: logic confirmed by peer review - fn_20066 CRagEffect::Hit4: logic confirmed by peer review - fn_20088 UpdatePartyEffect: logic confirmed by peer review - fn_20105 CRagEffect::SonicBlowHit: logic confirmed by peer review - fn_20109 CRagEffect::SprayPond: logic confirmed by peer review - fn_20124 CRagEffect::Yufitel: logic confirmed by peer review - fn_20132 CRagEffect::AirTexture: logic confirmed by peer review - fn_20133 CRagEffect::AttackEnergy2: logic confirmed by peer review Reviewed-by: ragnarok-clanker
142 lines
3.5 KiB
C++
142 lines
3.5 KiB
C++
#include "Client/Application/ErrorDialog.h"
|
|
#include "Render/Textures/Texture.h"
|
|
#include "Render/DeviceContext/DCSurface.h"
|
|
#include "Resource/EZeffectResource.h"
|
|
#include "Render/Textures/TextureCache.h"
|
|
|
|
#include <string>
|
|
|
|
// OFFSET: 0x0074D640
|
|
// FUNCTION: fn_07894
|
|
EZeffectClip::EZeffectClip() : textureCount(0), unknown_0004(0), frameCount(0), frames(nullptr), textures{} {
|
|
for (const char*& name : this->names) {
|
|
name = "1.bmp";
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x0074D790
|
|
// FUNCTION: fn_07896
|
|
EZeffectClip::~EZeffectClip() {
|
|
for (CTexture* texture : this->textures) {
|
|
if (texture) {
|
|
texture->Release();
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x0074CEE0
|
|
// OFFSET: 0x0074D570
|
|
// FUNCTION: fn_07893
|
|
CEZeffectRes::CEZeffectRes() : unknown_D320(0) {
|
|
}
|
|
|
|
// OFFSET: 0x0074D6F0
|
|
// OFFSET: 0x0074D330
|
|
// FUNCTION: fn_07895
|
|
CEZeffectRes::~CEZeffectRes() = default;
|
|
|
|
// OFFSET: 0x0074CEE0
|
|
// FUNCTION: fn_07889
|
|
CEZeffectRes* CEZeffectRes::Create() {
|
|
return new CEZeffectRes;
|
|
}
|
|
|
|
// OFFSET: 0x0074CFF0
|
|
// FUNCTION: fn_07890
|
|
bool CEZeffectRes::Load(const char* name) {
|
|
auto& file = this->m_file;
|
|
|
|
if (!file.Open(name, 0, true, false)) {
|
|
const std::string message = std::string("Str::Cannot find File : ") + name;
|
|
ShowErrorDialog(GetRenderSystemHolder()->system, message.c_str(), 0);
|
|
this->Unload();
|
|
|
|
return false;
|
|
}
|
|
|
|
unsigned char magic[4];
|
|
int version;
|
|
file.Read(magic, sizeof(magic));
|
|
file.Read(&version, sizeof(version));
|
|
file.Read(&this->fps, sizeof(this->fps));
|
|
file.Read(&this->maximumFrame, sizeof(this->maximumFrame));
|
|
file.Read(&this->clipCount, sizeof(this->clipCount));
|
|
file.Seek(16, FILE_CURRENT);
|
|
|
|
if (version != 148) {
|
|
ShowErrorDialog(GetRenderSystemHolder()->system, "LoadAniClip: Version is incorrect", 0);
|
|
this->Unload();
|
|
return false;
|
|
}
|
|
|
|
for (int index = 0; index < this->clipCount; ++index) {
|
|
EZeffectClip& clip = this->clips[index];
|
|
file.Read(&clip.textureCount, sizeof(clip.textureCount));
|
|
|
|
for (int texture = 0; texture < clip.textureCount; ++texture) {
|
|
clip.names[texture] = static_cast<const char*>(file.ReadPtr(128));
|
|
}
|
|
|
|
file.Read(&clip.frameCount, sizeof(clip.frameCount));
|
|
|
|
if (clip.frameCount > 0) {
|
|
clip.frames = static_cast<const EZeffectKeyFrame*>(file.ReadPtr(124u * static_cast<unsigned>(clip.frameCount)));
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
// OFFSET: 0x0074D320
|
|
// FUNCTION: fn_07891
|
|
void CEZeffectRes::Unload() {
|
|
this->m_file.Close();
|
|
}
|
|
|
|
// OFFSET: 0x0074D850
|
|
// FUNCTION: fn_07897
|
|
CTexture* EZeffectClip::Texture(int index) {
|
|
if (index >= this->textureCount) {
|
|
return g_texMgr.Default();
|
|
}
|
|
|
|
if (!this->textures[index]) {
|
|
std::string path = std::string("effect\\") + this->names[index];
|
|
|
|
if (path.find_last_of('.') == std::string::npos) {
|
|
path.append(".bmp", 4);
|
|
}
|
|
|
|
this->textures[index] = g_texMgr.Load(path.c_str(), 1, false, true, false);
|
|
|
|
if (this->textures[index]) {
|
|
this->textures[index]->Retain();
|
|
}
|
|
}
|
|
|
|
return this->textures[index];
|
|
}
|
|
|
|
// OFFSET: 0x0074D9A0
|
|
// FUNCTION: fn_07898
|
|
CTexture* EZeffectClip::Texture(int index, const char* prefix) {
|
|
if (index >= this->textureCount) {
|
|
return g_texMgr.Default();
|
|
}
|
|
|
|
if (!this->textures[index]) {
|
|
std::string path = std::string("effect\\") + prefix + this->names[index];
|
|
|
|
if (path.find_last_of('.') == std::string::npos) {
|
|
path.append(".bmp", 4);
|
|
}
|
|
|
|
this->textures[index] = g_texMgr.Load(path.c_str(), 1, false, true, false);
|
|
|
|
if (this->textures[index]) {
|
|
this->textures[index]->Retain();
|
|
}
|
|
}
|
|
|
|
return this->textures[index];
|
|
}
|