From 31b735ca34e93cf355aa80d76f5ddca1d2ca4b10 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 06:48:26 +0000 Subject: [PATCH] Decompile fn_19767 (CEffectPrim::Initialize) Batch #14269 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_19767 CEffectPrim::Initialize: logic confirmed by peer review Peer-reviewed-by: Yommy, secret, aDw Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Effects/EffectPrim.cpp | 5 +++- Source/Contents/Effects/EffectPrim.h | 2 ++ .../Contents/Effects/EffectPrimitiveState.cpp | 26 +++++++++---------- .../Contents/Effects/EffectPrimitiveState.h | 1 - 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Source/Contents/Effects/EffectPrim.cpp b/Source/Contents/Effects/EffectPrim.cpp index 2d2901f58..dd1634e3e 100644 --- a/Source/Contents/Effects/EffectPrim.cpp +++ b/Source/Contents/Effects/EffectPrim.cpp @@ -153,8 +153,11 @@ CEffectPrim* CreateEffectParticle( std::list& worldObjects ) { auto* particle = new CEffectPrim(); + if (!particle) { + return nullptr; + } - particle->state.Initialize(particle->render, master, masterRender, type, x, y, z); + particle->Initialize(master, type, x, y, z); master.state.primList.push_back(&particle->state); worldObjects.push_back(particle); diff --git a/Source/Contents/Effects/EffectPrim.h b/Source/Contents/Effects/EffectPrim.h index c5e97b939..27b388b12 100644 --- a/Source/Contents/Effects/EffectPrim.h +++ b/Source/Contents/Effects/EffectPrim.h @@ -250,6 +250,8 @@ struct CEffectPrim : CRenderObject { void RenderGroundSprite(matrix& wtm); void RenderSegmentSpriteTrail(matrix& wtm); + void Initialize(CRagEffect& master, int type, float x, float y, float z); + /* 0138 */ EffectPrimitiveState state; }; diff --git a/Source/Contents/Effects/EffectPrimitiveState.cpp b/Source/Contents/Effects/EffectPrimitiveState.cpp index 82cc293ae..a17a975e5 100644 --- a/Source/Contents/Effects/EffectPrimitiveState.cpp +++ b/Source/Contents/Effects/EffectPrimitiveState.cpp @@ -1,4 +1,5 @@ #include "Contents/Effects/EffectPrimitiveState.h" +#include "Contents/Effects/EffectPrim.h" #include "Contents/Effects/RagEffect.h" #include "Contents/Actors/RenderObjectState.h" #include "Utility/Math/AffineMatrix.h" @@ -65,18 +66,15 @@ void __stdcall Get_Angle(float x, float y, std::int16_t* angle) { // OFFSET: 0x00BAE5D0 // FUNCTION: fn_19767 -void EffectPrimitiveState::Initialize( - RenderObjectState& render, CRagEffect& master, const RenderObjectState& masterRender, int type, float x, float y, float z -) { - const float first = x + this->deltaPos.x; - this->master = &master; - this->count = type; - this->deltaPos.x = first; - this->deltaPos.y = y + this->deltaPos.y; - this->deltaPos.z = z + this->deltaPos.z; - this->orgPos = {masterRender.position.x, masterRender.position.y, masterRender.position.z}; - render.position.x = this->orgPos.x; - render.position.y = this->orgPos.y; - render.position.z = this->orgPos.z; - this->isChangeProcessed = 0; +void CEffectPrim::Initialize(CRagEffect& master, int type, float x, float y, float z) { + this->state.master = &master; + this->state.count = type; + this->state.deltaPos.x = x + this->state.deltaPos.x; + this->state.deltaPos.y = y + this->state.deltaPos.y; + this->state.deltaPos.z = z + this->state.deltaPos.z; + this->state.orgPos = {master.render.position.x, master.render.position.y, master.render.position.z}; + this->render.position.x = this->state.orgPos.x; + this->render.position.y = this->state.orgPos.y; + this->render.position.z = this->state.orgPos.z; + this->state.isChangeProcessed = 0; } diff --git a/Source/Contents/Effects/EffectPrimitiveState.h b/Source/Contents/Effects/EffectPrimitiveState.h index 618bfec07..94d28c593 100644 --- a/Source/Contents/Effects/EffectPrimitiveState.h +++ b/Source/Contents/Effects/EffectPrimitiveState.h @@ -56,7 +56,6 @@ struct EffectPrimitiveSlot { struct EffectPrimitiveState { explicit EffectPrimitiveState(RenderObjectState& render); ~EffectPrimitiveState(); - void Initialize(RenderObjectState& render, CRagEffect& master, const RenderObjectState& masterRender, int type, float x, float y, float z); void ProcessAlpha(); void GetColorOverride(unsigned char* red, unsigned char* green, unsigned char* blue);