Decompile fn_17685 (CWorld::OnExitFrame)

Batch #7520 by eAthena: 0 byte-identical, 1 confirmed by peer review.

- fn_17685 CWorld::OnExitFrame: logic confirmed by peer review

Peer-reviewed-by: secret, Romain, Toshiro
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 09:49:38 +00:00
commit 95101552fb
3 changed files with 38 additions and 0 deletions

View file

@ -29,6 +29,7 @@ public:
CWorld(const CWorld&) = delete;
CWorld& operator=(const CWorld&) = delete;
void Clear();
void OnExitFrame();
bool FindActorInCell(const float* position, std::function<bool(std::uint32_t)> predicate) const;
CRenderObject* GetGameActorByAID(std::uint32_t aid) const;
CRenderObject* GetGameActorByAidIncludeMe(std::uint32_t aid) const;

View file

@ -23,6 +23,9 @@ static_assert(sizeof(DeferredWorldModel) == 8);
static_assert(offsetof(DeferredWorldModel, placement) == 4);
#endif
extern HANDLE hObject;
extern std::vector<DeferredWorldModel> g_deferredWorldModels;
struct WorldModelLoading {
ResourceMgr& resources;
BinkMovies& movies;

View file

@ -22,12 +22,21 @@
#include "UI/Window/UIWindowMgr.h"
#include "Utility/Text/FormatString.h"
#include "Utility/Text/HexString.h"
#include "Contents/World/WorldModelLoading.h"
#include "Contents/Ground/GroundGeometry.h"
#include "Contents/Models/ModelActor.h"
#include "Render/Textures/TextureCache.h"
#include <cstdlib>
#include <new>
#include <string>
#include <vector>
// GLOBAL: gl_24371
HANDLE hObject;
// GLOBAL: gl_24757
std::vector<DeferredWorldModel> g_deferredWorldModels;
// OFFSET: 0x00AC8220
// FUNCTION: fn_17667
CRenderObject* CWorld::GetGameActorByAidIncludeMe(std::uint32_t aid) const {
@ -63,6 +72,31 @@ std::uint32_t g_worldOverlayColor;
// GLOBAL: gl_24695
float g_fogDensity;
// OFFSET: 0x00AC9CA0
// FUNCTION: fn_17685
void CWorld::OnExitFrame() {
if (hObject) {
WaitForSingleObject(hObject, INFINITE);
CloseHandle(hObject);
hObject = nullptr;
}
g_deferredWorldModels.clear();
this->pending = 0;
this->spatial.ClearChildren();
this->Clear();
for (C3dActor* model : this->models) {
delete model;
}
this->models.clear();
delete this->ground;
this->ground = nullptr;
ResourceMgr::Instance().ClearExpired();
g_texMgr.ClearUnused();
}
// OFFSET: 0x00ACA320
// FUNCTION: fn_17691
void CWorld::Clear() {