Decompile overlay 1 (Part 5) (#100)

* start PlayerActorBase_70_001

* PlayerActorBase_70_001 OK

* PlayerActor -> PlayerLinkActor

* Player_001 35%

* fix regressions

* organise files better

* PlayerLinkActor_001 40%

* PlayerLinkActor_001 OK

* tiny self-review
This commit is contained in:
Yanis
2026-07-05 13:44:41 +02:00
committed by GitHub
parent 9987fee73a
commit bf559e183d
42 changed files with 1224 additions and 428 deletions
@@ -0,0 +1,85 @@
#define VECFX32_CTORS //! TODO: remove this hack
#include "Player/PlayerActorBase.hpp"
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_027e09a4.hpp"
extern const char data_ov001_020c264c[][16];
extern const char data_ov001_020c26bc[][16];
extern "C" u16 *func_ov021_020ea868(int);
extern "C" void func_ov000_0205c584(void *, int, int);
ModelRender_Derived4::ModelRender_Derived4(PlayerCharacter character, unk32 param2, G3d_Model *pModel,
G3d_BoneMtxStruct *pCacheJntAnm) :
ModelRender_Derived3(character, pModel),
mUnk_78(param2),
mUnk_BC(0) {
if (pCacheJntAnm == NULL) {
this->func_ov000_02057d20(this->func_ov000_02057ee0()->numBones);
} else {
this->func_ov000_02057d3c(pCacheJntAnm);
}
for (u32 i = 0; i < ARRAY_LEN(this->mUnk_7C); i++) {
this->mUnk_7C[i] = this->func_ov000_02057f18(&data_ov001_020c26bc[i]);
}
for (u32 i = 0; i < ARRAY_LEN(this->mUnk_A0); i++) {
this->mUnk_A0[i] = this->func_ov000_02057f40(&data_ov001_020c264c[i]);
}
this->func_ov000_0208c058(this->mUnk_7C[1]);
}
PlayerActorBase::PlayerActorBase(PlayerCharacter character, unk32 param2, unk32 param3, UnkStruct_027e0ce0_40 *param4) :
mPos(0, 0, 0),
mPrevPos(0, 0, 0),
mVel(0, 0, 0),
mAccel(0, 0, 0),
mAngle(0),
mInvincibilityTimer(0),
mInvincibilityIconTimer(0),
mGrabActor(0),
mUnk_38(&this->mGrabActor),
mUnk_44(PlayerCharacter_IsNotLink(character)),
mCharacter(character),
mUnk_4C(param2),
mUnk_50(param2, this->mUnk_44),
mUnk_54(param3),
mUnk_58(param4) {
this->mUnk_5C.mUnk_04 = 0;
this->mUnk_5C.mUnk_10 = &this->mUnk_5C.mUnk_08;
this->mUnk_5C.func_ov000_02089dc4();
this->mUnk_70 = new(HeapIndex_1) PlayerActorBase_70(character, param2);
this->mUnk_74 = data_027e09a4->IsLand() ? new(HeapIndex_1) PlayerActorBase_74() : NULL;
const UnkStruct_ov000_020ab4dc *ptr = &data_ov000_020ab4dc[(u32) this->mCharacter];
s32 sVar1 = ptr->mUnk_74;
const UnkStruct_ov000_020ab4dc *new_var5 = &data_ov000_020ab4dc[this->mCharacter];
func_ov000_0205c584(&this->mUnk_78, sVar1, new_var5->mUnk_66 / 2);
this->mUnk_84.Init();
this->mUnk_90 = 0;
if (this->mUnk_4C == -1) {
this->func_ov000_0208c914();
} else {
u16 temp = func_ov021_020ea868(this->mUnk_4C)[8];
this->mUnk_84.func_ov000_0205fc20(0x78, temp, NULL, NULL);
}
}
PlayerActorBase::~PlayerActorBase() {
delete this->mUnk_74;
delete this->mUnk_70;
}
void PlayerActorBase::func_ov001_020bc96c() {
STACK_PAD(0x04);
this->mUnk_38.Reset();
this->mUnk_5C.func_ov000_02089dc4();
new(this->mUnk_74) PlayerActorBase_74();
this->mGrabActor.Reset();
}
@@ -0,0 +1,80 @@
#include "Player/PlayerActorBase.hpp"
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_027e09a4.hpp"
extern "C" void *func_ov000_0208ea70(PlayerCharacter, unk32, bool); // returns pointer to .NSBTX
extern unk16 data_ov000_020ab314;
ModelRender_UnkSystem1 *func_ov001_020bbac4(BOOL isNotLink, G3d_Model *pModel, unk32 param3, bool param4) {
if (param4 && data_027e09a4->mUnk_60 == 1) {
return NULL;
}
return isNotLink == true ? new(HeapIndex_1) ModelRender_UnkSystem1(pModel, 0x3C)
: new(HeapIndex_1) ModelRender_UnkSystem1_Derived1(pModel, 0);
}
PlayerActorBase_70::PlayerActorBase_70(PlayerCharacter character, unk32 param2) :
mIsNotLink(PlayerCharacter_IsNotLink(character)),
mCharacter(character),
mUnk_008(param2),
mUnk_00C(character, param2),
mUnk_01C(new(HeapIndex_1) PlayerActorBase_70_1C(this)),
mUnk_020(func_ov001_020bbac4(this->mIsNotLink, this->mUnk_00C.GetModel1(), 0x01, false)),
mUnk_024(func_ov001_020bbac4(this->mIsNotLink, this->mUnk_00C.GetModel1(), 0x01, true)),
mUnk_028(func_ov001_020bbac4(this->mIsNotLink, this->mUnk_00C.GetModel1(), 0x00, false)),
mUnk_02C(func_ov001_020bbac4(this->mIsNotLink, this->mUnk_00C.GetModel1(), 0x00, true)),
mUnk_030(character, this->mUnk_020, this->mUnk_024),
mUnk_04C(character, this->mUnk_028, this->mUnk_02C),
mUnk_068(0x400),
mUnk_06A(0x400),
mUnk_06C(character, func_ov000_0208ea70(character, param2, true), this->mUnk_00C.GetUnk08()->mpModel),
mUnk_0DC(this->mIsNotLink == true ? new(HeapIndex_1) PlayerActorBase_70_DC(character, this->mUnk_00C.GetUnk08()->mpModel)
: NULL),
mUnk_0E0(this->mUnk_00C.GetUnk08(), character),
mUnk_114(param2 == -1 && character == PlayerCharacter_Link ? new(HeapIndex_1) Mat4x3p[PlayerCharacter_Max] : NULL),
mUnk_118(false),
mUnk_11C(false),
mUnk_120(false),
mUnk_124(false),
mUnk_126(false),
mUnk_127(false),
mUnk_128(false),
mUnk_129(true),
mUnk_12A(true),
mUnk_12B(false),
mUnk_12C(false),
mUnk_12D(false),
mUnk_131(false),
mUnk_132(data_ov000_020ab314),
mUnk_15C(0x20000) {
if (this->mUnk_114 != NULL) {
for (u32 i = 0; i < PlayerCharacter_Max; i++) {
Mat4x3p_InitIdentity(&this->mUnk_114[i]);
}
}
}
PlayerActorBase_70::~PlayerActorBase_70() {
delete[] this->mUnk_114;
delete this->mUnk_0DC;
delete this->mUnk_02C;
delete this->mUnk_028;
delete this->mUnk_024;
delete this->mUnk_020;
delete this->mUnk_01C;
delete this->mUnk_00C.GetUnk0C();
delete this->mUnk_00C.GetUnk08();
}
void PlayerActorBase_70::func_ov001_020bbe18(unk32 param1, UnkStruct_func_ov001_020bbe18 param2, u32 param3, u8 param4) {
this->mUnk_129 = true;
this->mUnk_12A = true;
if (this->mIsNotLink == true) {
this->func_ov000_02082e78(0x00, param1, 0x01, 0x00);
}
this->func_ov000_020830d4(param2, param3, param4, 0x00);
}
@@ -0,0 +1,107 @@
#include "Player/PlayerActorBase.hpp"
#include "Player/PlayerLink.hpp"
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_027e09a4.hpp"
#include "Unknown/UnkStruct_027e0cd8.hpp"
#include "Unknown/UnkStruct_027e0d34.hpp"
PlayerLinkActor::PlayerLinkActor(unk32 param1, unk32 param2, UnkStruct_027e0ce0_40 *param3, bool *param4) :
PlayerActorBase(PlayerCharacter_Link, param1, param2, param3),
mUnk_094(param4),
mUnk_098(0),
mUnk_09C(new(HeapIndex_1) PlayerLinkActor_9C(param3, *(u32 *) &this->mUnk_50, this->mCharacter)),
mUnk_0A0(new(HeapIndex_1) PlayerLinkActor_A0(param2, param3, this, this->mUnk_09C)),
mUnk_0A4(this, this->mUnk_0A0),
mUnk_0B0(-1),
mUnk_0B4(false),
mUnk_0B5(false),
mUnk_0B6(false),
mUnk_0B7(false),
mUnk_0B8(false),
mUnk_0B9(false),
mUnk_0BA(false),
mUnk_0BB(false),
mUnk_134(param1 == -1 ? new(HeapIndex_1) PlayerLinkActor_134() : NULL) {
this->mUnk_90 = this->mUnk_09C;
//! TODO: dark magic
PlayerLinkActor *new_var = this;
PlayerLinkActor **new_var3 = &new_var;
if ((*new_var3)->mUnk_4C == -1) {
(*new_var3)->func_ov031_020d96a4(this->mUnk_0A0, this->mUnk_58);
this->func_ov031_020dccf0();
} else {
this->func_ov021_020ebda0();
}
}
PlayerLinkActor::~PlayerLinkActor() {
if (data_027e09a4->mUnk_60 == 0) {
UnkStruct_027e0d34::Destroy();
}
delete this->mUnk_134;
delete this->mUnk_0A0;
delete this->mUnk_09C;
}
void PlayerLinkActor::func_ov001_020bcb60(unk32 param1) {
this->mUnk_098 = param1;
this->mUnk_09C->mUnk_0F4 = param1;
}
void PlayerLinkActor::func_ov001_020bcb70() {
this->func_ov001_020bc96c();
this->mUnk_0B4 = false;
this->mUnk_0B5 = false;
this->mUnk_0B8 = false;
this->mUnk_0A0->func_ov001_020bd2e0();
this->mUnk_0A4.mUnk_08 = false;
this->func_ov000_0208d7f0(false);
}
void PlayerLinkActor::func_ov001_020bcba8() {
if (this->mUnk_134 != NULL) {
this->mUnk_134->func_ov031_020db0fc();
}
if (!this->mUnk_0B6) {
this->mUnk_0A0->func_ov001_020bd358();
}
}
void PlayerLinkActor::func_ov001_020bcbd0(VecFx32 *pVec) {
this->func_ov000_0208c8f8(pVec);
this->mUnk_90->mUnk_34.func_ov000_0208efd0(pVec);
PlayerActorBase_70 *unk_70 = this->mUnk_70;
unk_70->func_ov001_020bbe18(0, this->mAngleStruct, this->mUnk_0A0->func_ov000_02093718(),
this->mUnk_0A0->func_ov000_0209378c());
bool uVar1 = false;
if (this->mUnk_094 != 0) {
uVar1 = *this->mUnk_094;
}
this->mUnk_0A0->func_ov001_020bd388(uVar1, this->mUnk_0B6);
this->mUnk_0B6 = false;
this->mUnk_0B9 = data_027e0cd8->func_ov000_02082124();
this->mUnk_0BA = false;
this->mUnk_0BB = false;
this->func_ov000_0208d3fc();
}
void UnkStruct_027e0d34::Destroy() {
if (data_027e0d34 != NULL) {
delete data_027e0d34;
}
}
PlayerLinkActor_1B0::PlayerLinkActor_1B0() :
UnkSystem7(NULL),
mUnk_04(-1),
mUnk_08(0) {}
DECL_INSTANCE_DTOR(UnkStruct_027e0d34, data_027e0d34);
@@ -0,0 +1,9 @@
#include "Unknown/UnkStruct_027e0cdc.hpp"
void UnkStruct_027e0cdc::Destroy() {
if (data_027e0cdc != NULL) {
delete data_027e0cdc;
}
}
DECL_INSTANCE_DTOR(UnkStruct_027e0cdc, data_027e0cdc);
@@ -1,4 +1,4 @@
#include "Player/Player.hpp"
#include "Player/PlayerLink.hpp"
extern "C" void func_ov000_0205be34(void *thisx, unk16 param1);
extern "C" void func_ov000_0205be44(void *thisx, Vec2s *param1, Vec2s *param2, bool param3, bool param4);
@@ -16,7 +16,7 @@ static const Vec2s data_ov024_020d822c(0x20, 0x10);
static const Vec2s data_ov024_020d8228(0x20, 0x40);
static const Vec2s data_ov024_020d8224(0x40, 0x40);
void PlayerActor_A0_38_04::vfunc_00() {
void PlayerLinkActor_A0_38_04::vfunc_00() {
UnkStruct_auStack_14 spC;
Vec2s sp8;
Vec2s sp4;
@@ -46,7 +46,7 @@ void PlayerActor_A0_38_04::vfunc_00() {
func_ov000_0205be44(&spC, &sp8, &sp4, var_r3, var_r4);
}
void PlayerActor_A0_38_18::vfunc_00() {
void PlayerLinkActor_A0_38_18::vfunc_00() {
UnkStruct_auStack_14 sp3C;
UnkStruct_auStack_14 sp38;
UnkStruct_auStack_14 sp34;
@@ -119,7 +119,7 @@ void PlayerActor_A0_38_18::vfunc_00() {
THUMB_BEGIN
PlayerActor_A0_38::PlayerActor_A0_38() :
PlayerLinkActor_A0_38::PlayerLinkActor_A0_38() :
mUnk_00(0xC0),
mUnk_02(0x80),
mUnk_04(this),
@@ -127,9 +127,9 @@ PlayerActor_A0_38::PlayerActor_A0_38() :
this->func_ov024_020d19d8();
}
PlayerActor_A0_38::~PlayerActor_A0_38() {}
PlayerLinkActor_A0_38::~PlayerLinkActor_A0_38() {}
void PlayerActor_A0_38::func_ov024_020d19d8() {
void PlayerLinkActor_A0_38::func_ov024_020d19d8() {
this->mUnk_2C.x = 0x8000;
this->mUnk_2C.y = 0x8000;
this->mUnk_30 = 0;
@@ -424,7 +424,9 @@ void UnkStruct_027e0cf8_0C_00::func_ov024_020cff1c() {
this->mUnk_1B = false;
}
UnkStruct_027e0cf8_0C::UnkStruct_027e0cf8_0C() {
UnkStruct_027e0cf8_0C::UnkStruct_027e0cf8_0C() :
mUnk_150(NULL, 0),
mUnk_15C(NULL, 0) {
this->mUnk_168.x = 0;
this->mUnk_168.y = 0;
this->mUnk_16C = 0;