Decompile 4 functions in Source/Contents/Effects/EffectLists.cpp, Source/Contents/Effects/EffectLists.h

Batch #8088 by eAthena: 0 byte-identical, 4 confirmed by peer review.

- fn_18790 HasEffectScript: logic confirmed by peer review
- fn_18792 EffectLists::LoadMapEffectScript: logic confirmed by peer review
- fn_18795 ReadEffectScriptV1: logic confirmed by peer review
- fn_18796 ReadEffectScriptV2: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, Yommy, secret
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-31 14:09:42 +00:00
commit 6209917662
2 changed files with 65 additions and 0 deletions

View file

@ -73,6 +73,8 @@
#include "Render/Renderer.h"
#include "Utility/Cipher/XorBytes.h"
#include "Utility/Math/AffineMatrix.h"
#include "Contents/Effects/Particle.h"
#include "Script/LuaScript.h"
#include <cmath>
#include <cstdint>
@ -1501,3 +1503,62 @@ void EffectLists::Update() {
}
}
}
// OFFSET: 0x00B3A9C0
// FUNCTION: fn_18790
bool HasEffectScript(std::string path, std::string name) {
bool exists = false;
std::string versionKey = EmitterKey(name.substr(), "effect_version");
g_luaScript->Call("IsExistValue", "s>b", versionKey.c_str(), &exists);
if (exists) {
return true;
}
std::string emitterKey = EmitterKey(name.substr(), "emitterInfo");
g_luaScript->Call("IsExistValue", "s>b", emitterKey.c_str(), &exists);
return exists;
}
// OFFSET: 0x00B3B0A0
// FUNCTION: fn_18795
void ReadEffectScriptV1(std::string name) {
g_luaScript->Call("ReadEmitterInfoz_ver_1_0", "s", EmitterInfoKey(name.substr()).c_str());
g_luaScript->Call("ReadEffectInfoz", "s", EffectFunctionName(name.substr()).c_str());
}
// OFFSET: 0x00B3B240
// FUNCTION: fn_18796
void ReadEffectScriptV2(std::string name) {
g_luaScript->Call("ReadEmitterInfoz", "s", EmitterKey(name.substr(), "emitterInfo").c_str());
g_luaScript->Call("ReadMagicFloorInfoz", "s", EmitterKey(name.substr(), "magicfloorInfo").c_str());
g_luaScript->Call("ReadEvilsPawInfoz", "s", EmitterKey(name.substr(), "evilsPawInfo").c_str());
g_luaScript->Call("ReadAnimatedEmitterInfoz", "s", EmitterKey(name.substr(), "animatedEmitterInfo").c_str());
g_luaScript->Call("ReadEZ2STRInfoz", "s", EmitterKey(name.substr(), "ez2strInfo").c_str());
g_luaScript->Call("ReadWindEffectInfoz", "s", EmitterKey(name.substr(), "windEffectInfo").c_str());
}
// OFFSET: 0x00B3AC30
// FUNCTION: fn_18792
void EffectLists::LoadMapEffectScript(bool reload) {
if (this->indexed.empty()) {
return;
}
std::string directory = "Lua Files\\EffectTool\\";
std::string name = CurrentMapScriptName();
std::string path = directory + name;
if (HasEffectScript(path.c_str(), name.substr()) || g_luaScript->Load(path.c_str(), true, false)) {
int version = 0;
std::string versionKey = EmitterKey(name.substr(), "effect_version");
g_luaScript->Call("GetValue", "s>d", versionKey.c_str(), &version);
switch (version) {
case 0:
case 1:
ReadEffectScriptV1(name.substr());
break;
case 2:
ReadEffectScriptV2(name.substr());
break;
}
}
}

View file

@ -47,6 +47,7 @@ public:
bool RegisterAllocators();
bool RegisterAllocator(int id, CAllocator* allocator);
void Update();
void LoadMapEffectScript(bool reload);
};
#if defined(_WIN32) && !defined(_WIN64)
@ -63,6 +64,9 @@ float DirectionAngle(float x, float z);
double ScreenAngle(vector3d from, vector3d to);
std::string CurrentMapScriptName();
std::string EffectFunctionName(std::string name);
bool HasEffectScript(std::string path, std::string name);
void ReadEffectScriptV1(std::string name);
void ReadEffectScriptV2(std::string name);
extern EffectLists* g_effectMgr;