Files
st/src/000_Second/Actor/Actor_Derived1.cpp
T
Mityno 7c266293a7 Decompiling ActorUnkCANS (#103)
* feat: Start decompiling ActorUnkCANS ctor and vfunc_10

* feat: Improve vfunc_10

* feat: Decompile vfunc_18 and 1C

* fix: Remove trailing return

* feat: Progress on vfunc_20

* fix: Rename symbol

* feat: Finish first run over vfunc_20

* feat: Improve vfunc_20

* feat: Improve vfunc_20

* feat: Heavily improve vfunc_20

Almost done

* feat: Keep vfunc_20 going, add UnkAngleStruct to Actor.hpp

* feat: Some polish on vfunc_20

That's about what I can do, there are some tweaks left but I'm unable to
get anywhere.
Kind of proud ngl

* feat: Rename symbols and match vfunc_24

* fix: Fix jp symbol conflict

* feat: Decompile vfunc_2C

* feat: Fix symbols and signatures

* fix: Match switch statement by adding every cases

* feat: Match func_ov063_02157fa4

* feat: Match func_ov063_02158424

* feat: Match func_ov063_02158448

* feat: Match func_ov063_02158490

* feat: Match func_ov063_02158b0c

* feat: Match func_ov063_02158b34

* feat: Decompile most of func_ov063_02158b98 (need regalloc fix)

* feat: Create inner classes of ActorUnkCANS, match some vfuncs

* feat: Update some dtor symbol and match some ctor

* feat: Decompile UnkStruct 02162ee8 ctor

* feat: Rename jp symbols

* feat: Match func_ov063_021590c8

* feat: Match func_ov063_02159dfc

* feat: Decompile some functions

* fix: Fix old accesses

* fix: More merge artifacts

* fix: More merge artifacts

* chore: Move structs around and fix some uses

* feat: Start decompiling func_ov063_02158db0

* feat: Decompile some vfunc

vfunc_0C is really really weird

* fix: Fix use of removed struct

* feat: Match func_ov063_02159258

* feat: Match func_ov063_02159494

* feat: Match func_ov063_021595a4

* feat: Match func_ov063_02159618

* feat: Match func_ov063_02159714

* feat: Match func_ov063_02159784

* fix: Move UnkAngleStruct to math.hpp

* fix: .data of ActorRollingStone & ActorShotArrow

* feat: Match func_ov063_021598fc

* fix: Cleanup code for func_ov063_021598fc

* feat: Match func_ov063_02159ca8

* feat: Match func_ov063_02159d68

* fix: Fix double declaration of func

* feat: Match func_ov063_02159e20

* feat: Decompile most of func_ov063_02159ec0

* feat: Match func_ov063_0215a428

* feat: Match func_ov063_0215a474

* feat: Update lots of symbols (mainly for jp)

* feat: Start decompiling two funcs with fx mul

* fix: Fix broken symbol def after merge

* feat: Match func_ov063_0215a514

* feat: Match func_ov063_0215a56c

* feat: Match func_ov063_0215a5a0

* feat: Match func_ov063_0215a5bc

* feat: Match func_ov063_0215a5d8

* feat: Decompile most of func_ov063_0215a678

* fix: Fix some regalloc order in func_ov063_0215a678

* feat: Update symbols and create unk class

* feat: Update CANS member with the new class

* feat: Update symbols, remove dead variables

* feat: Improve ctor and some local struct layout

* feat: Improve ActorUnkCANS ctor

* fix: Fix ActorUnkCANS members layout

* feat: Improve ActorUnkCANS ctor more

* fix: Fix wrong symbol reloc

* feat: Add intermediate struct and update symbols

* feat: Match some jp only code, symbols

* feat: Decompile part of func_ov063_0215a2c0

* fix: Fix jp only code in func_ov063_0215a2c0

* feat: Update symbols

* feat: Cleanup unused functions

* feat: Cleanup JP ifguards handling

* feat: Remove lot of useless temps, use DEG_TO_ANG where it seems appropriate

* feat: Small code cleanup

* Apply suggestions from code review

Co-authored-by: Alessevan <44125445+Alessevan@users.noreply.github.com>

* fix: Fix style

* feat: Apply suggestions from review

* feat: More code cleanup

* feat: Some more improvements

* fix: Remove auto-generated comment headers

* fix broken matches

* fix broken matches 2

---------

Co-authored-by: Alessevan <44125445+Alessevan@users.noreply.github.com>
Co-authored-by: Yanis002 <35189056+Yanis002@users.noreply.github.com>
2026-08-02 15:27:10 +02:00

261 lines
6.2 KiB
C++

#include "Actor/Actor_Derived1.hpp"
#include "Unknown/UnkStruct_027e09b8.hpp"
#include "Unknown/UnkStruct_027e0cd8.hpp"
#include "flags.h"
#include "global.h"
void Actor_Derived1::func_ov000_020a8ae0(fx32 param1) {
u32 posY = this->mVel.y;
if (posY <= param1) {
posY = param1;
}
this->mVel.y = posY;
}
Actor_Derived1::Actor_Derived1(ModelRender *param1, Actor_Derived1_94_0C *param2) :
mUnk_094(param2),
mUnk_0A4(param1),
mUnk_0B0(0),
mUnk_0B4(-1),
mUnk_0B8(0),
mUnk_0BC(0),
mUnk_0C0(0, 0, 0),
mUnk_0CC(0),
mUnk_0CE(0),
mUnk_0D0(0),
mUnk_0D4(0),
mUnk_0D8(0),
mUnk_0DA(0),
mUnk_0DC(0x2AAB),
mUnk_0DE(0xEAAB),
mUnk_0E0(0x1555),
mUnk_0E4(NULL),
mUnk_0E8(0),
mUnk_0EA(0),
mUnk_104(this->mUnk_34->size),
mUnk_114(-1),
mUnk_118(0x1000),
mUnk_11C(0x019A) {
this->mUnk_30 = &this->mUnk_104;
this->mUnk_4A[0] = 5;
this->mUnk_44 = 0x1F;
this->mUnk_094.mUnk_00.mUnk_08 = 3;
this->mUnk_38 = &this->mUnk_094.mUnk_00;
this->mUnk_0B0 |= 0x08;
}
Actor_Derived1::~Actor_Derived1() {}
bool Actor_Derived1::vfunc_18(unk32 param1) {
if (this->mUnk_5C.mParams[2] == 0 && this->func_ov000_020a8dd0()) {
UNSET_FLAG(this->mFlags, ActorFlag_Alive);
}
if (this->mUnk_0B0 & 8) {
this->mUnk_0A4.mpModelRender->func_ov000_02057c38(6, 2);
this->mUnk_0A4.mpModelRender->func_ov000_0209a7b8(this, Actor_Derived1::func_ov000_020a9804);
}
this->vfunc_54(param1);
return 1;
}
void Actor_Derived1::vfunc_54(unk32 param1) {}
void Actor_Derived1::vfunc_1C() {
this->func_ov031_020e3ca4();
}
bool Actor_Derived1::func_ov000_020a8db0() {
return data_027e0cd8->func_ov000_02081e30(this->mUnk_5C.mUnk_1A[0], this->mUnk_5C.mUnk_18[0]);
}
bool Actor_Derived1::func_ov000_020a8dd0() {
return data_027e0cd8->func_ov000_02081e30(this->mUnk_5C.mUnk_1A[1], this->mUnk_5C.mUnk_18[1]);
}
// non-matching
void Actor_Derived1::func_ov000_020a8df0(ActorRef param1, unk32 param2) {
if (!((u32) (((param2 + 8) - param2) / 2) < 2)) {
this->mUnk_0B0 |= 2;
} else {
this->mUnk_0B0 &= ~2;
}
if (this->mRef != param1) {
this->vfunc_B4();
*(u32 *) &this->mUnk_0BC = param1.Get32();
this->mUnk_0C0.x = 0;
this->mUnk_0C0.y = 0;
this->mUnk_0C0.z = 0;
this->mUnk_0B0 |= 1;
}
}
void Actor_Derived1::vfunc_B4() {
this->vfunc_58(0);
}
// non-matching
void Actor_Derived1::func_ov000_020a8e9c(VecFx32 *param1) {
fx32 z = param1->x;
fx32 y = param1->y;
fx32 x = param1->z;
this->mUnk_0C0.x = x;
this->mUnk_0C0.y = y;
this->mUnk_0C0.z = x;
this->mUnk_0BC.Reset();
}
void Actor_Derived1::vfunc_B0() {
if (data_027e09b8->func_01ffd420() == 0) {
ActorUnk_vfunc_B0 auStack_60;
auStack_60.mpActor = this;
auStack_60.mUnk_0C = this->mUnk_5C.mUnk_20;
auStack_60.mUnk_14 = 0;
auStack_60.mUnk_18 = -1;
auStack_60.mUnk_1C = -1;
auStack_60.mUnk_20 = 0;
auStack_60.mUnk_21 = 0;
auStack_60.mUnk_32 = 1;
this->GetOffsetPos(&auStack_60.mUnk_34);
this->mUnk_0B4 = data_027e09b8->func_ov000_02073470(&auStack_60, 0);
}
}
bool Actor_Derived1::vfunc_88() {
return 1;
}
bool Actor_Derived1::vfunc_8C() {
return 1;
}
unk32 Actor_Derived1::vfunc_90() {
return 0x7B;
}
void Actor_Derived1::vfunc_94() {
this->mUnk_0A4.mUnk_08 = 0xF6;
}
void Actor_Derived1::vfunc_60() {
if (data_027e09b8->func_01ffd420() == 0) {
if (this->vfunc_64()) {
this->vfunc_B0();
this->func_ov000_020a9200();
this->vfunc_58(4);
}
}
}
bool Actor_Derived1::vfunc_64() {
return GET_FLAG(this->mFlags, ActorFlag_Interacting);
}
bool Actor_Derived1::func_ov000_020a8ff4(VecFx32 *param1) {}
void Actor_Derived1::vfunc_6C() {}
void Actor_Derived1::vfunc_68() {
UNSET_FLAG(this->mFlags, ActorFlag_Interacting);
this->func_ov000_020a9200();
this->vfunc_AC();
this->mUnk_0B0 &= ~0x01;
this->mUnk_0B0 &= ~0x10;
}
unk32 Actor_Derived1::vfunc_7C(unk32 param1) {
return 1;
}
unk32 Actor_Derived1::vfunc_80(unk32 param1, unk32 param2) {
return -1;
}
unk32 Actor_Derived1::vfunc_84() {
return 1;
}
void Actor_Derived1::func_ov000_020a91b8(VecFx32 *param1, unk32 param2) {
this->func_ov000_020a8e9c(param1);
if (param2 != 0) {
this->mUnk_0B0 |= 0x20;
} else {
this->mUnk_0B0 &= ~0x20;
}
this->vfunc_58(7);
}
void Actor_Derived1::func_ov000_020a9200() {}
void Actor_Derived1::vfunc_70() {
if (this->mState != 5) {
this->vfunc_58(4);
}
}
void Actor_Derived1::vfunc_74() {}
void Actor_Derived1::vfunc_78() {}
bool Actor_Derived1::func_ov000_020a9248(unk32 param1) {}
void Actor_Derived1::vfunc_5C() {}
void Actor_Derived1::vfunc_98(u32 param1) {}
void Actor_Derived1::func_ov000_020a94b0() {}
void Actor_Derived1::vfunc_9C() {}
unk32 Actor_Derived1::vfunc_A0() {
this->GetActorId();
return 1;
}
void Actor_Derived1::vfunc_AC() {}
void Actor_Derived1::func_ov000_020a95d8() {}
void Actor_Derived1::vfunc_A4() {}
unk32 Actor_Derived1::vfunc_A8() {
return 1;
}
void Actor_Derived1::func_ov000_020a9804(void *param1, unk32 param2) {}
void Actor_Derived1::vfunc_20() {}
// non-matching
void Actor_Derived1::vfunc_24() {
if (!data_027e09b8->func_ov000_020732dc(3) || !(this->mUnk_0B0 & 4)) {
this->vfunc_20();
}
if (!(this->mUnk_0B0 & 0x200)) {
this->mUnk_0B0 &= ~0x100;
} else {
this->mUnk_0B0 &= ~0x200;
}
}
// non-matching
void Actor_Derived1::vfunc_2C(unk32 param1) {
if (this->func_01fff5d0(param1, 0) == 0) {
return;
}
this->vfunc_B8();
this->mUnk_0A4.func_01ffc6d4(this->mAngle, &this->mPos);
}
void Actor_Derived1::vfunc_B8() {
this->func_ov017_020bf5c4(&this->mPos, 0x666, 0x666, 0x1F, 0);
}
void Actor_Derived1::vfunc_14() {}
void Actor_Derived1::func_ov000_020a9a20() {}
void Actor_Derived1::func_ov000_020a9a34() {}
void Actor_Derived1::func_ov000_020a9a50() {}
void Actor_Derived1::func_ov000_020a9a94() {}
void Actor_Derived1::func_ov000_020a9abc() {}