From f0cd1e9d1378c01163d0bfa8032bcdd096910053 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 5 Nov 2026 12:00:08 +0000 Subject: [PATCH] Decompile 2 functions in Source/Contents/Models/ModelActorBounds.cpp Batch #12165 by Yommy: 0 byte-identical, 2 confirmed by peer review. - fn_17512 C3dActorV1::UpdateBounds: logic confirmed by peer review - fn_17513 C3dActorV2::UpdateBounds: logic confirmed by peer review Peer-reviewed-by: Tanke, cremane, raiken Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Models/ModelActorBounds.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Source/Contents/Models/ModelActorBounds.cpp b/Source/Contents/Models/ModelActorBounds.cpp index 6595bc48..c2a7f1fa 100644 --- a/Source/Contents/Models/ModelActorBounds.cpp +++ b/Source/Contents/Models/ModelActorBounds.cpp @@ -1,6 +1,7 @@ #include "Contents/Models/ModelActor.h" #include "Utility/Math/AffineMatrix.h" +#include #include #include @@ -121,7 +122,8 @@ __forceinline void C3dActor::FinishBounds(const float* bounds, bool modern) { SetAxis(this->oriented.axes[1], axes.values + 3); SetAxis(this->oriented.axes[2], axes.values + 6); - for (ModelVolume* volume : this->volumes) { + for (std::list::iterator it = this->volumes.begin(); it != this->volumes.end(); ++it) { + ModelVolume* volume = *it; volume->transform.MakeXRotation(Radians(volume->rotation[0])); volume->transform.AppendYRotation(Radians(volume->rotation[1])); volume->transform.AppendZRotation(Radians(volume->rotation[2])); @@ -147,10 +149,10 @@ __forceinline void C3dActor::FinishBounds(const float* bounds, bool modern) { // OFFSET: 0x00AB9660 // FUNCTION: fn_17512 void C3dActorV1::UpdateBounds() { - float bounds[6] = {100000, 100000, 100000, -100000, -100000, -100000}; + std::array bounds = {100000, 100000, 100000, -100000, -100000, -100000}; matrix identity; std::memcpy(identity.values, g_identityMatrix, sizeof(identity.values)); - this->root->AccumulateBounds(bounds, identity.values); + this->root->AccumulateBounds(bounds.data(), identity.values); this->offset[0] = -(bounds[3] + bounds[0]) * 0.5f; this->offset[1] = -bounds[4]; this->offset[2] = -(bounds[5] + bounds[2]) * 0.5f; @@ -160,20 +162,20 @@ void C3dActorV1::UpdateBounds() { this->transform.AppendXRotation(Radians(this->rotation[0])); this->transform.AppendZRotation(Radians(this->rotation[2])); this->transform.AppendTranslate(this->position); - this->FinishBounds(bounds, false); + this->FinishBounds(bounds.data(), false); } // OFFSET: 0x00ABA520 // FUNCTION: fn_17513 void C3dActorV2::UpdateBounds() { - float bounds[6] = {100000, 100000, 100000, -100000, -100000, -100000}; + std::array bounds = {100000, 100000, 100000, -100000, -100000, -100000}; matrix identity; std::memcpy(identity.values, g_identityMatrix, sizeof(identity.values)); - for (C3dNodeV2* root : this->roots) { - root->AccumulateBounds(bounds, identity.values); + for (std::list::iterator it = this->roots.begin(); it != this->roots.end(); ++it) { + (*it)->AccumulateBounds(bounds.data(), identity.values); } this->UpdateMatrix(); - this->FinishBounds(bounds, true); + this->FinishBounds(bounds.data(), true); }