From e51133debe181588e7f21aed0c2e60ed18a2dc32 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 13:14:54 +0000 Subject: [PATCH] Decompile 2 functions in Source/Contents/Camera/CameraShake.cpp, Source/Contents/Camera/CameraFrame.cpp, ... Batch #16042 by Yommy: 0 byte-identical, 2 confirmed by peer review. - fn_17931 CView::Apply: logic confirmed by peer review - fn_17927 CView::Update: logic confirmed by peer review Peer-reviewed-by: eAthena, alisonrag Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Camera/Camera.h | 2 +- Source/Contents/Camera/CameraFrame.cpp | 2 +- Source/Contents/Camera/CameraShake.cpp | 33 ++++++++++---------------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/Source/Contents/Camera/Camera.h b/Source/Contents/Camera/Camera.h index 8f4f16126..400dfed48 100644 --- a/Source/Contents/Camera/Camera.h +++ b/Source/Contents/Camera/Camera.h @@ -33,7 +33,7 @@ public: matrix AlternateView(float yaw) const; void Refresh(); - void Apply(CameraState& camera, int& frameLatch); + void Apply(); void Start(int enabled, unsigned duration, float horizontal, float distance, float pitch); void SetAmplitudes(float horizontal, float distance, float pitch); diff --git a/Source/Contents/Camera/CameraFrame.cpp b/Source/Contents/Camera/CameraFrame.cpp index cfdaa32ba..35135889f 100644 --- a/Source/Contents/Camera/CameraFrame.cpp +++ b/Source/Contents/Camera/CameraFrame.cpp @@ -39,6 +39,6 @@ void CView::Update() { this->camera.desiredTarget[1] = position.y; this->camera.desiredTarget[2] = position.z; this->camera.Smooth(); - this->Apply(this->camera, g_worldViewDrawn); + this->Apply(); this->Refresh(); } diff --git a/Source/Contents/Camera/CameraShake.cpp b/Source/Contents/Camera/CameraShake.cpp index 9186fdc0f..55620f909 100644 --- a/Source/Contents/Camera/CameraShake.cpp +++ b/Source/Contents/Camera/CameraShake.cpp @@ -1,7 +1,6 @@ #include "Contents/Camera/Camera.h" #include "Contents/Camera/CameraState.h" #include "Utility/Math/AffineMatrix.h" -#include "Utility/Math/ScalarConversion.h" #include #include @@ -48,48 +47,42 @@ void CView::SetAmplitudes(float horizontal, float distance, float pitch) { // OFFSET: 0x00ADC7A0 // FUNCTION: fn_17931 -void CView::Apply(CameraState& camera, int& frameLatch) { +void CView::Apply() { if (!this->shake.enabled) { return; } if (timeGetTime() >= this->shake.start + this->shake.duration) { - camera.target[0] = camera.desiredTarget[0]; - camera.target[1] = camera.desiredTarget[1]; - camera.target[2] = camera.desiredTarget[2]; - camera.distance = camera.desiredDistance; + this->camera.target[0] = this->camera.desiredTarget[0]; + this->camera.target[1] = this->camera.desiredTarget[1]; + this->camera.target[2] = this->camera.desiredTarget[2]; + this->camera.distance = this->camera.desiredDistance; this->shake.enabled = 0; - camera.pitch = camera.desiredPitch; + this->camera.pitch = this->camera.desiredPitch; return; } - if (!frameLatch) { + if (!g_worldViewDrawn) { return; } - frameLatch = 0; + g_worldViewDrawn = 0; // GLOBAL: gl_24565 static float horizontal = this->shake.horizontal; - const float horizontalX = Jitter(10.0f) + horizontal; - const int yawX = TruncateToInt(camera.yaw); - const float x = static_cast(static_cast(ClientCosine(yawX)) * horizontalX); - camera.target[0] = x + camera.target[0]; - const float horizontalZ = Jitter(10.0f) + horizontal; - const int yawZ = TruncateToInt(camera.yaw); - const float sine = -ClientSine(yawZ); - + this->camera.target[0] += (Jitter(10.0f) + horizontal) * ClientCosine(static_cast(this->camera.yaw)); + const float offsetZ = (Jitter(10.0f) + horizontal) * -ClientSine(static_cast(this->camera.yaw)); horizontal = -horizontal; - camera.target[2] = horizontalZ * sine + camera.target[2]; + this->camera.target[2] += offsetZ; // GLOBAL: gl_24566 static float distance = this->shake.distance; const float distanceDelta = Jitter(10.0f) + distance; distance = -distance; - camera.distance = distanceDelta + camera.distance; + this->camera.distance = distanceDelta + this->camera.distance; // GLOBAL: gl_24567 static float pitch = this->shake.pitch; const float pitchDelta = Jitter(15.0f) + pitch; pitch = -pitch; - camera.pitch = pitchDelta + camera.pitch; + this->camera.pitch = pitchDelta + this->camera.pitch; }