From 0270e6dd1844fedc62e2cf3223afe851cbd8b0fd Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 28 Oct 2026 20:20:53 +0000 Subject: [PATCH] Decompile 2 functions in Source/Contents/ModelKeyframes.cpp Batch #1676 by ragnarok-clanker: 0 byte-identical, 2 confirmed by peer review. - fn_01716 ModelRotationKeys::Add: logic confirmed by peer review - fn_01717 ModelScaleKeys::Add: logic confirmed by peer review Peer-reviewed-by: eAthena Reviewed-by: ragnarok-clanker Adds to the build: Source/Contents/ModelKeyframes.cpp --- Source/Contents/ModelKeyframes.cpp | 43 ++++++++++++++++++++++++++++++ data/compile.json | 1 + 2 files changed, 44 insertions(+) create mode 100644 Source/Contents/ModelKeyframes.cpp diff --git a/Source/Contents/ModelKeyframes.cpp b/Source/Contents/ModelKeyframes.cpp new file mode 100644 index 0000000..6ead53d --- /dev/null +++ b/Source/Contents/ModelKeyframes.cpp @@ -0,0 +1,43 @@ +#include "Resource/Models/ModelResource.h" +#include "Utility/Math/AffineMatrix.h" + +#include + +struct ModelRotationKeys : std::vector { + void Add(int frame, float x, float y, float z, float angle); +}; + +struct ModelScaleKeys : std::vector { + void Add(int frame, float scaleX, float scaleY, float scaleZ, float x, float y, float z, float angle); +}; + +// OFFSET: 0x0053FFE0 +// FUNCTION: fn_01716 +void ModelRotationKeys::Add(int frame, float x, float y, float z, float angle) { + angle *= 0.5f; + const float sine = ClientSin(angle); + ModelRotationKey key; + key.frame = frame; + key.rotation[0] = sine * x; + key.rotation[1] = sine * y; + key.rotation[2] = sine * z; + key.rotation[3] = ClientCos(angle); + this->push_back(key); +} + +// OFFSET: 0x00540120 +// FUNCTION: fn_01717 +void ModelScaleKeys::Add(int frame, float scaleX, float scaleY, float scaleZ, float x, float y, float z, float angle) { + angle *= 0.5f; + const float sine = ClientSin(angle); + ModelScaleKey key; + key.frame = frame; + key.scale[0] = scaleX; + key.scale[1] = scaleY; + key.scale[2] = scaleZ; + key.rotation[0] = sine * x; + key.rotation[1] = sine * y; + key.rotation[2] = sine * z; + key.rotation[3] = ClientCos(angle); + this->push_back(key); +} diff --git a/data/compile.json b/data/compile.json index 7d478af..c4093d9 100644 --- a/data/compile.json +++ b/data/compile.json @@ -359,6 +359,7 @@ "Source/Contents/Messenger/ClientMessenger.cpp": 4, "Source/Contents/Messenger/MessengerMember.cpp": 4, "Source/Contents/Messenger/WhisperBlockMgr.cpp": 4, + "Source/Contents/ModelKeyframes.cpp": 4, "Source/Contents/Models/ModelActor.cpp": 3, "Source/Contents/Models/ModelActorBounds.cpp": 3, "Source/Contents/Models/ModelAnimation.cpp": 3,