From f9faa7318f2d503ba997f40a02b02a8bda9683c5 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sun, 1 Nov 2026 12:44:08 +0000 Subject: [PATCH] Decompile fn_21317 (CGameMode::NewActor) Batch #9414 by secret: 0 byte-identical, 1 confirmed by peer review. - fn_21317 CGameMode::NewActor: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, gordaoprogramas, Montyla Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Mode/CGameMode.h | 1 + Source/Client/Mode/GameMode.cpp | 21 ++++++- Source/Contents/Actors/GrannyGameActor.h | 74 ++++++++++++++++++++++++ Source/Contents/Actors/RenderObject.cpp | 56 +----------------- 4 files changed, 95 insertions(+), 57 deletions(-) create mode 100644 Source/Contents/Actors/GrannyGameActor.h diff --git a/Source/Client/Mode/CGameMode.h b/Source/Client/Mode/CGameMode.h index 92efa07b..ad99ef85 100644 --- a/Source/Client/Mode/CGameMode.h +++ b/Source/Client/Mode/CGameMode.h @@ -355,6 +355,7 @@ public: std::uint32_t ActorNameColor(int job, std::uint32_t aid); const CActorNameCard& LookupNameCard(std::uint32_t id); std::vector BuildActorEntryPacket(CGameActor* actor, std::uint16_t packetType); + CGameActor* NewActor(int job); const char* DragItemName(); void PushUnknown01A4(int value); bool IsOverWeight(bool notify); diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index d616fe20..caf8988f 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -3,7 +3,7 @@ #include "Client/Replay.h" #include "Client/ReplayPacketRecorder.h" #include "Client/Session.h" -#include "Contents/Actors/GameActor.h" +#include "Contents/Actors/Npc.h" #include "Contents/Actors/Pc.h" #include "Contents/Camera/Camera.h" #include "Contents/Configuration/ServiceConfiguration.h" @@ -33,7 +33,7 @@ #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowDialogs.h" -#include "Utility/Math/Vector3d.h" +#include "Contents/Actors/GrannyGameActor.h" #include "Utility/Text/FormatString.h" #include "Client/Application/Launcher.h" #include "UI/Text/NavigationLink.h" @@ -3906,3 +3906,20 @@ void CGameMode::ReceiveSkillList(int packetType, const std::vector +#include + +class CTexture; +struct RenderCommand; +struct RenderVertex; + +struct GrannyActorLight { + /* 0000 */ vector3d direction; + /* 000C */ int intensity; + /* 0010 */ int red; + /* 0014 */ int green; + /* 0018 */ int blue; +}; + +class C3dGrannyGameActor : public CGameActor { +public: + explicit C3dGrannyGameActor(const char* name); + void SetAction(unsigned animation, int motion, int repeat) override; + void Slot08() override; + void Slot36() override; + int Slot37() override; + void Unused6860(int value); + void Unused7950(int value); + void SetModel(int job, int value, int unused); + void Render(int argument) override; + void RenderLit(int argument, const GrannyActorLight& light); + void RenderShadowed(int argument); + void SpawnCorpseActor(); + bool OnProcess() override; + + /* 0410 */ CTexture* emblemTexture; + /* 0414 */ C3dGrannyModelRes* model; + /* 0418 */ granny_model_instance* instance; + /* 041C */ RenderCommand* commands[30]; + /* 0494 */ RenderVertex* vertices[30]; + /* 050C */ granny_system_clock clock; + /* 051C */ granny_system_clock lastClock; + /* 052C */ float unknown_052C; + /* 0530 */ unsigned char unknown_0530[0x08]; + /* 0538 */ float angle; + /* 053C */ unsigned char alpha; + /* 053D */ unsigned char unknown_053D[0x03]; + /* 0540 */ unsigned brightness; + /* 0544 */ int motion; + /* 0548 */ unsigned char unknown_0548[0x04]; + /* 054C */ char name[0x104]; + /* 0650 */ int unknown_0650; + /* 0654 */ int unknown_0654; + /* 0658 */ granny_control* controls[20]; + /* 06A8 */ unsigned char unknown_06A8; + /* 06A9 */ unsigned char unknown_06A9[0x03]; + /* 06AC */ CTexture* meshTextures[30]; + /* 0724 */ std::uint16_t* meshIndices[30]; + /* 079C */ int meshTriangleCounts[30]; + /* 0814 */ matrix meshTransforms[30]; + /* 0DB4 */ unsigned char unknown_0DB4[0x04]; + /* 0DB8 */ CTexture* texture; + /* 0DBC */ std::vector unknown_0DBC; +}; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(C3dGrannyGameActor) == 0xDC8); +#endif + +#endif diff --git a/Source/Contents/Actors/RenderObject.cpp b/Source/Contents/Actors/RenderObject.cpp index fc7577ab..253b6b6b 100644 --- a/Source/Contents/Actors/RenderObject.cpp +++ b/Source/Contents/Actors/RenderObject.cpp @@ -1,4 +1,5 @@ #include "Contents/Actors/Npc.h" +#include "Contents/Actors/GrannyGameActor.h" #include "Contents/Actors/RenderObject.h" #include "ActorPickNode.h" #include "Contents/Effects/MsgEffect.h" @@ -127,61 +128,6 @@ private: } -struct GrannyActorLight { - /* 0000 */ vector3d direction; - /* 000C */ int intensity; - /* 0010 */ int red; - /* 0014 */ int green; - /* 0018 */ int blue; -}; - -class C3dGrannyGameActor : public CGameActor { -public: - explicit C3dGrannyGameActor(const char* name); - void SetAction(unsigned animation, int motion, int repeat) override; - void Slot08() override; - void Slot36() override; - int Slot37() override; - void Unused6860(int value); - void Unused7950(int value); - void SetModel(int job, int value, int unused); - void Render(int argument) override; - void RenderLit(int argument, const GrannyActorLight& light); - void RenderShadowed(int argument); - void SpawnCorpseActor(); - bool OnProcess() override; - - - /* 0410 */ CTexture* emblemTexture; - /* 0414 */ C3dGrannyModelRes* model; - /* 0418 */ granny_model_instance* instance; - /* 041C */ RenderCommand* commands[30]; - /* 0494 */ RenderVertex* vertices[30]; - /* 050C */ granny_system_clock clock; - /* 051C */ granny_system_clock lastClock; - /* 052C */ float unknown_052C; - /* 0530 */ unsigned char unknown_0530[0x08]; - /* 0538 */ float angle; - /* 053C */ unsigned char alpha; - /* 053D */ unsigned char unknown_053D[0x03]; - /* 0540 */ unsigned brightness; - /* 0544 */ int motion; - /* 0548 */ unsigned char unknown_0548[0x04]; - /* 054C */ char name[0x104]; - /* 0650 */ int unknown_0650; - /* 0654 */ int unknown_0654; - /* 0658 */ granny_control* controls[20]; - /* 06A8 */ unsigned char unknown_06A8; - /* 06A9 */ unsigned char unknown_06A9[0x03]; - /* 06AC */ CTexture* meshTextures[30]; - /* 0724 */ std::uint16_t* meshIndices[30]; - /* 079C */ int meshTriangleCounts[30]; - /* 0814 */ matrix meshTransforms[30]; - /* 0DB4 */ unsigned char unknown_0DB4[0x04]; - /* 0DB8 */ CTexture* texture; - /* 0DBC */ std::vector unknown_0DBC; -}; - class CGrannyCorpse3d : public CGameObject { public: explicit CGrannyCorpse3d(const char* name);