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

Batch #1818 by Yommy: 0 byte-identical, 6 confirmed by peer review.

- fn_18772 EffectLists::RetireActor: logic confirmed by peer review
- fn_18777 EffectLists::Retire: logic confirmed by peer review
- fn_18778 EffectLists::Retire: logic confirmed by peer review
- fn_18779 EffectLists::Retire: logic confirmed by peer review
- fn_18780 EffectLists::Clear: logic confirmed by peer review
- fn_18781 EffectLists::Release: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-28 22:37:37 +00:00
commit 6d568f53db
3 changed files with 62 additions and 40 deletions

View file

@ -19,19 +19,23 @@ struct EffectEvent {
class CEffect {
public:
explicit CEffect(int id);
virtual ~CEffect();
virtual void Close();
virtual void Slot00(int argument);
virtual void Slot01();
virtual void Slot02() = 0;
virtual void Slot03() {}
virtual void Slot04();
virtual void Close();
virtual bool Slot06() = 0;
virtual void Slot07();
virtual void Slot08(int argument1, int argument2, int argument3);
virtual void Slot09(int) {}
virtual void Slot10(int argument);
virtual void Slot11(std::string name);
virtual void Slot12();
virtual void Slot13(int argument);
virtual void Slot14(int argument);
virtual void Slot15(int argument);
virtual void Slot16(int) {}
virtual void Slot17(int argument);
virtual void Slot18(int argument);
virtual void Slot19(int argument);
@ -44,7 +48,11 @@ public:
virtual void Slot26(int argument);
virtual void Slot27(int argument);
virtual int Slot28();
virtual void Slot29(int id) = 0;
virtual ~CEffect();
virtual void Slot31() {}
virtual void Slot32();
virtual bool Slot33() = 0;
void AddEvent(int kind, const char* text, int frame, int argument);
void SetEventFrame(int kind, int frame);

View file

@ -33,23 +33,14 @@ CEffect* EffectLists::Find(int actor, int instance, int id) const {
return nullptr;
}
// INLINED
void EffectLists::RemoveActive(CEffect* effect) {
const auto found = this->active.find(static_cast<int>(effect->actor));
if (found != this->active.end()) {
found->second.remove(effect);
}
}
// OFFSET: 0x00B253A0
// FUNCTION: fn_18779
void EffectLists::Retire(CEffect* effect, unsigned char removeActive) {
if (effect) {
this->retirement.effects.push_back(effect);
this->retired.push_back(effect);
if (removeActive == 1) {
this->RemoveActive(effect);
if (removeActive == 1 && this->active.find(static_cast<int>(effect->actor)) != this->active.end()) {
this->active[static_cast<int>(effect->actor)].remove(effect);
}
}
}
@ -58,8 +49,11 @@ void EffectLists::Retire(CEffect* effect, unsigned char removeActive) {
// FUNCTION: fn_18777
void EffectLists::Retire(int actor, int id) {
if (CEffect* effect = this->Find(actor, id)) {
this->retirement.effects.push_back(effect);
this->RemoveActive(effect);
this->retired.push_back(effect);
if (this->active.find(static_cast<int>(effect->actor)) != this->active.end()) {
this->active[static_cast<int>(effect->actor)].remove(effect);
}
}
}
@ -68,8 +62,11 @@ void EffectLists::Retire(int actor, int id) {
void EffectLists::Retire(int actor, int instance, int id) {
if (actor > 0 && instance > 0) {
if (CEffect* effect = this->Find(actor, instance, id)) {
this->retirement.effects.push_back(effect);
this->RemoveActive(effect);
this->retired.push_back(effect);
if (this->active.find(static_cast<int>(effect->actor)) != this->active.end()) {
this->active[static_cast<int>(effect->actor)].remove(effect);
}
}
}
}
@ -79,13 +76,15 @@ void EffectLists::Retire(int actor, int instance, int id) {
void EffectLists::RetireActor(int actor) {
const auto found = this->active.find(actor);
if (found != this->active.end()) {
for (CEffect* effect : found->second) {
this->retirement.effects.push_back(effect);
if (found == this->active.end()) {
return;
}
for (auto effect = found->second.begin(); effect != found->second.end(); ++effect) {
this->retired.push_back(*effect);
}
found->second.clear();
}
}
// OFFSET: 0x00B25830
@ -120,21 +119,27 @@ void EffectLists::Add(int actor, CEffect* effect) {
// OFFSET: 0x00B254C0
// FUNCTION: fn_18780
void EffectLists::Clear() {
for (auto& [actor, effects] : this->active) {
this->RetireActor(actor);
for (auto entry = this->active.begin(); entry != this->active.end(); ++entry) {
this->RetireActor(entry->first);
}
this->active.clear();
this->RetireActor(0);
this->indexed.clear();
this->retirement.Clear();
for (auto effect = this->retired.begin(); effect != this->retired.end(); ++effect) {
(*effect)->Close();
delete *effect;
}
this->retired.clear();
}
// OFFSET: 0x00B255B0
// FUNCTION: fn_18781
void EffectLists::Release() {
for (auto& [id, allocator] : this->allocators) {
delete allocator;
for (auto entry = this->allocators.begin(); entry != this->allocators.end(); ++entry) {
delete entry->second;
}
this->allocators.clear();

View file

@ -3,21 +3,25 @@
#include "Contents/Effects/Effect.h"
#include <cstddef>
#include <list>
#include <map>
#include <vector>
class EffectAllocator {
public:
virtual ~EffectAllocator() = default;
struct CAllocator {
virtual ~CAllocator() = default;
virtual CEffect* Create() = 0;
};
struct EffectLists {
std::map<int, std::list<CEffect*>>& active;
EffectRetirement& retirement;
std::map<int, std::vector<CEffect*>>& indexed;
std::map<int, EffectAllocator*>& allocators;
class EffectLists {
public:
/* 0004 */ bool initialized;
/* 0008 */ std::map<int, CAllocator*> allocators;
/* 0010 */ std::map<int, std::list<CEffect*>> active;
/* 0018 */ std::list<CEffect*> retired;
/* 0020 */ std::map<int, std::vector<CEffect*>> indexed;
~EffectLists();
virtual ~EffectLists();
CEffect* Find(int actor, int id) const;
CEffect* Find(int actor, int instance, int id) const;
@ -29,11 +33,16 @@ struct EffectLists {
void RetireActor(int actor);
void Clear();
void Release();
private:
void RemoveActive(CEffect* effect);
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(EffectLists) == 0x28);
static_assert(offsetof(EffectLists, allocators) == 0x08);
static_assert(offsetof(EffectLists, active) == 0x10);
static_assert(offsetof(EffectLists, retired) == 0x18);
static_assert(offsetof(EffectLists, indexed) == 0x20);
#endif
void DestroyEffectMgr();
extern EffectLists* g_effectMgr;