Decompile fn_17682 (CWorld::LoadMapEffects)

Batch #8482 by youko: 0 byte-identical, 1 confirmed by peer review.

- fn_17682 CWorld::LoadMapEffects: logic confirmed by peer review

Peer-reviewed-by: KWDev, Romain, SapitoSucio
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
Adds to the build: Source/Contents/World/WorldEffects.cpp
This commit is contained in:
ragnarok-clanker 2026-10-31 18:20:17 +00:00
commit da85cd2f6d
3 changed files with 48 additions and 0 deletions

View file

@ -28,6 +28,7 @@ public:
virtual ~CWorld();
CWorld(const CWorld&) = delete;
CWorld& operator=(const CWorld&) = delete;
void LoadMapEffects();
void Clear();
void OnExitFrame();
void OnProcess();

View file

@ -0,0 +1,46 @@
#include "Contents/World/World.h"
#include "Client/Mode/CGameMode.h"
#include "Contents/Effects/EffectLists.h"
#include "Contents/Effects/EffectMaker.h"
#include "Contents/Sound/SoundConfiguration.h"
#include "Contents/Sound/SoundMaker.h"
#include "Resource/ResourceMgr.h"
#include "Resource/World/WorldResource.h"
#include <string>
// GLOBAL: gl_25108
SoundConfiguration g_soundConfiguration;
// OFFSET: 0x00AC9040
// FUNCTION: fn_17682
void CWorld::LoadMapEffects() {
std::string name = reinterpret_cast<const char*>(this->gameMode->SendMsg(9, 0, 0, 0, 0));
C3dWorldRes* resource = static_cast<C3dWorldRes*>(ResourceMgr::Instance().Load(name.c_str()));
for (auto it = resource->effects.begin(); it != resource->effects.end(); ++it) {
WorldEffectRecord* record = *it;
if (g_effectMgr->HasAllocator(record->id)) {
g_effectMgr->Spawn(0, record->id, record->position[0], record->position[1], record->position[2], 0, -1, 0, 0);
} else {
CEffectMaker* effect = new CEffectMaker;
const int address = reinterpret_cast<int>(record);
effect->SendMsg(nullptr, 14, 0, address, address >> 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
this->objects.push_back(effect);
}
}
g_effectMgr->LoadMapEffectScript(true);
if (g_soundConfiguration.mode != 0) {
for (auto it = resource->sounds.begin(); it != resource->sounds.end(); ++it) {
WorldSoundRecord* record = *it;
CSoundMaker* sound = new CSoundMaker;
const int address = reinterpret_cast<int>(record);
sound->SendMsg(nullptr, 14, 0, address, address >> 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
this->objects.push_back(sound);
}
}
}

View file

@ -653,6 +653,7 @@
"Source/Contents/UserData/NormalItemSlots.cpp": 4,
"Source/Contents/World/SkyBox.cpp": 3,
"Source/Contents/World/WorldActors.cpp": 4,
"Source/Contents/World/WorldEffects.cpp": 3,
"Source/Contents/World/WorldModelLoading.cpp": 3,
"Source/Contents/World/WorldModelView.cpp": 3,
"Source/Contents/World/WorldObjects.cpp": 4,