From 4deff9e985e96ef0f3012bc7964aeabc0604e9f4 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sun, 1 Nov 2026 00:00:02 +0000 Subject: [PATCH] Decompile 2 functions in Source/Contents/Actors/GameActor.h, Source/Contents/Actors/Pc.h, ... Batch #9043 by youko: 0 byte-identical, 2 confirmed by peer review. - fn_22586 CGrannyPc::OnProcess: logic confirmed by peer review - fn_22587 CPc::OnProcess: logic confirmed by peer review Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Contents/Actors/GameActor.h | 2 +- Source/Contents/Actors/Pc.h | 3 +- Source/Contents/Actors/Player.cpp | 151 +++++++++++++++++++++--- Source/Contents/Actors/RenderObject.cpp | 7 +- Source/Contents/Actors/Skill.h | 2 +- Source/Contents/Sound/SoundMaker.cpp | 13 +- 6 files changed, 140 insertions(+), 38 deletions(-) diff --git a/Source/Contents/Actors/GameActor.h b/Source/Contents/Actors/GameActor.h index b1335c92..5120d8b8 100644 --- a/Source/Contents/Actors/GameActor.h +++ b/Source/Contents/Actors/GameActor.h @@ -172,7 +172,7 @@ public: ) = 0; virtual void Slot12(SpriteQuad* quad, const int* box, float shiftX, int first, int second) = 0; virtual std::uint32_t Slot13(); - virtual void Slot14() = 0; + virtual bool Slot14() = 0; virtual void Slot15(int first, int second); virtual void Slot16() = 0; virtual void Slot17(); diff --git a/Source/Contents/Actors/Pc.h b/Source/Contents/Actors/Pc.h index 6faa82bf..8847c851 100644 --- a/Source/Contents/Actors/Pc.h +++ b/Source/Contents/Actors/Pc.h @@ -39,6 +39,7 @@ public: ) override; void Render(int argument) override; + bool Slot14() override; void Slot15(int first, int second) override; void Slot19( int first, int second, int third, int fourth, int fifth, int sixth, int seventh, int eighth, int ninth, int tenth, int eleventh @@ -220,7 +221,6 @@ public: const std::uint32_t* palette, const SpriteRleImage* image, int blend, short hover ) override; void Slot12(SpriteQuad* quad, const int* box, float shiftX, int first, int second) override; - void Slot14() override; void Slot36() override; bool IsSpecialState(int state) const; @@ -276,6 +276,7 @@ public: void Render(int argument) override; void SetAction(unsigned animation, int motion, int repeat) override; void Slot08() override; + bool Slot14() override; void Slot15(int first, int second) override; void Slot19(int first, int second, int third, int fourth, int fifth, int sixth, int seventh, int eighth, int ninth, int tenth, int eleventh) override; void Slot20(int first, int second, int third, int fourth, int fifth, int sixth, int seventh, int eighth, int ninth, int tenth, int eleventh) override; diff --git a/Source/Contents/Actors/Player.cpp b/Source/Contents/Actors/Player.cpp index 440957d8..d9677451 100644 --- a/Source/Contents/Actors/Player.cpp +++ b/Source/Contents/Actors/Player.cpp @@ -2093,12 +2093,8 @@ bool CGrannyPc::OnProcess() { this->ModifyArgb(8, 8, 8, 8); } - union { - void (CGameActor::*asVoid)(); - bool (CGameActor::*asBool)(); - } slot14; - slot14.asVoid = &CGameActor::Slot14; - const bool result = (this->*slot14.asBool)(); + bool (CGameActor::*slot14)() = &CGameActor::Slot14; + const bool result = (this->*slot14)(); this->PlayFrameSounds(); @@ -2169,12 +2165,7 @@ bool CPc::OnProcess() { this->ModifyArgb(8, 8, 8, 8); } - union { - void (CGameActor::*asVoid)(); - bool (CGameActor::*asBool)(); - } slot14; - slot14.asVoid = &CGameActor::Slot14; - const bool result = (this->*slot14.asBool)(); + const bool result = this->Slot14(); this->PlayFrameSounds(); @@ -2806,12 +2797,7 @@ bool CPlayer::OnProcess() { this->UpdatePendingAction(); - union { - void (CGameActor::*asVoid)(); - bool (CGameActor::*asBool)(); - } slot14; - slot14.asVoid = &CGameActor::Slot14; - const bool result = (this->*slot14.asBool)(); + const bool result = this->Slot14(); this->PlayFrameSounds(); @@ -5150,3 +5136,132 @@ void CGrannyPc::SendMsg( break; } } + +// OFFSET: 0x00DAC080 +bool CGrannyPc::Slot14() { + if (this->unknown_0278 != 0 && timeGetTime() > static_cast(this->unknown_0278)) { + this->render.isMotionFreezed = false; + this->unknown_0278 = 0; + } + + if (!this->UpdateFadeOut()) { + return false; + } + + g_modeMgr.GetGameMode(); + switch (this->render.unknown_0070) { + case 2: + this->Slot08(); + this->GetElapsedFrames(); + if (this->render.isMotionFinished) { + this->Slot15(0, 1); + } + return true; + case 3: + this->render.unknown_00C8 = 0; + this->render.unknown_00D8 = 0; + this->render.unknown_00DC = 0; + this->render.isMotionFreezed = false; + case 6: + this->Slot08(); + return true; + case 7: + this->Slot08(); + if (this->render.isMotionFinished) { + this->Slot15(0, 1); + } + return true; + case 8: { + this->Slot08(); + const int frames = static_cast(this->GetElapsedFrames()); + if (this->hitTargetAid != 0 && frames % 34 == 0) { + CRenderObject* target = static_cast(g_modeMgr.GetGameMode())->scene->GetGameActorByAID(this->hitTargetAid); + if (target) { + this->Face(target->render.position.x, target->render.position.z); + } + } + return true; + } + default: + return CGameActor::OnProcess(); + } +} + +// OFFSET: 0x00DAC200 +bool CPc::Slot14() { + if (this->unknown_0278 != 0 && timeGetTime() > static_cast(this->unknown_0278)) { + this->render.isMotionFreezed = false; + this->unknown_0278 = 0; + } + + if (!this->UpdateFadeOut()) { + return false; + } + + g_modeMgr.GetGameMode(); + switch (this->render.unknown_0070) { + case 2: + this->Slot08(); + this->GetElapsedFrames(); + if (this->render.isMotionFinished) { + this->Slot15(0, 1); + } + return true; + case 3: + this->render.unknown_00C8 = 0; + this->render.unknown_00D8 = 0; + this->render.unknown_00DC = 0; + this->render.isMotionFreezed = false; + case 6: + case 60: + case 61: + case 66: + case 81: + this->Slot08(); + return true; + case 7: + case 45: + case 62: + case 63: + case 64: + case 65: + case 67: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + this->Slot08(); + if (this->render.isMotionFinished) { + this->Slot15(0, 1); + } + return true; + case 8: { + this->Slot08(); + const int frames = static_cast(this->GetElapsedFrames()); + if (this->hitTargetAid != 0 && frames % 34 == 0) { + CRenderObject* target = static_cast(g_modeMgr.GetGameMode())->scene->GetGameActorByAID(this->hitTargetAid); + if (target) { + this->Face(target->render.position.x, target->render.position.z); + } + } + return true; + } + case 51: + this->Slot08(); + if (this->render.isMotionFinished == true) { + this->render.unknown_0070 = 2; + } + return true; + default: + return CGameActor::OnProcess(); + } +} diff --git a/Source/Contents/Actors/RenderObject.cpp b/Source/Contents/Actors/RenderObject.cpp index 9b8ed447..39767c24 100644 --- a/Source/Contents/Actors/RenderObject.cpp +++ b/Source/Contents/Actors/RenderObject.cpp @@ -4798,12 +4798,7 @@ bool C3dGrannyGameActor::OnProcess() { this->ProcessActorEffects(); this->UpdateHpGauge(); - union { - void (CGameActor::*asVoid)(); - bool (CGameActor::*asBool)(); - } slot14; - slot14.asVoid = &CGameActor::Slot14; - const bool result = (this->*slot14.asBool)(); + const bool result = this->Slot14(); float facing = this->render.angle; if (facing > 360.0f) { diff --git a/Source/Contents/Actors/Skill.h b/Source/Contents/Actors/Skill.h index e0329ffb..6296f7d1 100644 --- a/Source/Contents/Actors/Skill.h +++ b/Source/Contents/Actors/Skill.h @@ -30,7 +30,7 @@ public: const std::uint32_t* palette, const SpriteRleImage* image, int blend, short hover ) override; void Slot12(SpriteQuad* quad, const int* box, float shiftX, int first, int second) override; - void Slot14() override; + bool Slot14() override; void Slot16() override; void Slot29(int value) override; void Slot32() override; diff --git a/Source/Contents/Sound/SoundMaker.cpp b/Source/Contents/Sound/SoundMaker.cpp index d73f7eb0..939883d1 100644 --- a/Source/Contents/Sound/SoundMaker.cpp +++ b/Source/Contents/Sound/SoundMaker.cpp @@ -46,15 +46,6 @@ std::uint32_t g_groundMarkAltAid; // GLOBAL: gl_25143 std::uint32_t g_groundMarkAltEnabled; -static bool CallSlot14(CGameActor* actor) { - union { - void (CGameActor::*asVoid)(); - bool (CGameActor::*asBool)(); - } slot14; - slot14.asVoid = &CGameActor::Slot14; - return (actor->*slot14.asBool)(); -} - // OFFSET: 0x00DA1190 // FUNCTION: fn_22354 CCorpse::CCorpse() { @@ -1405,7 +1396,7 @@ bool CNpc::OnProcess() { case 111: this->ProcessDamageMessages(); this->UpdateGaugePositions(); - result = CallSlot14(this); + result = this->Slot14(); break; default: this->ProcessBodyState(); @@ -1415,7 +1406,7 @@ bool CNpc::OnProcess() { this->ModifyArgb(8, 8, 8, 8); } this->UpdateGaugePositions(); - result = CallSlot14(this); + result = this->Slot14(); break; }