Start decompiling ActorUnkCASE (#124)

* feat: Start decompiling ActorUnkCASE's ctor

* fix: Fix broken member names

* feat: Finish decompiling ActorUnkCASE's ctor (orr mismatch)

* feat: Match ActorUnkCASE_174::vfunc_10

* fix: Update flags arithmetic

* feat: Match ActorUnkCASE_150 ctor

* feat: Match ActorProfileUnkCASE ctor

* feat: Update symbols and vfunc of ActorUnkCASE

* feat: Match ActorUnkCASE::vfunc_24

* feat: Decompile ActorUnkCASE::vfunc_10, update Actor::vfunc_10 to use Cylinder

* fix: Fix broken Actor symbols

* feat: Match ActorUnkCASE::vfunc_18

* feat: Match ActorUnkCASE::vfunc_2C

* feat: Start decompiling ActorUnkCASE::vfunc_20

* feat: Match ActorUnkCASE's ctor

* feat: Almost finish decompiling ActorUnkCASE::vfunc_20

* feat: Decompile func_ov063_0215b054 and func_ov063_0215afa4

* feat: Match func_ov063_0215af60

* feat: Decompile func_ov063_0215afb8

* feat: Match func_ov063_0215b090

* feat: Match func_ov063_0215b2b0

* feat: Match func_ov063_0215b244

* feat: Match func_ov063_0215b1bc

* feat: Match ActorUnkCASE_150::vfunc_00

* feat: Match ActorUnkCASE_150::vfunc_04

* feat: Match ActorUnkCASE_150::vfunc_0C

* feat: Match func_ov063_0215b814

* feat: Decompile func_ov063_0215b854

* feat: Match func_ov063_0215aefc

* feat: Match func_ov063_0215acec

* feat: Update jp symbols

* feat: Some symbols and improved matching

* feat: Match func_ov063_0215b99c

* feat: Start decompiling func_ov063_0215b8e8

* feat: Decompile some funcs

* feat: Rename symbols, improve matching, add some data

* fix: Fix wrong code for JP only

* fix: Fix broken symbols

* feat: Update symbols and extend .data, match sinit

The .data ordering is wrong

* feat: Small changes

* Apply suggestions from code review

Co-authored-by: Yanis <35189056+Yanis002@users.noreply.github.com>

* fix: More code review

* feat: Add small comment for the goto

* feat: Update func_ov063_0215b8e8 and vfunc_0C to use VexFx32

* fix: Missing c/hpp changes for previous commit

* feat: Update func_ov063_0215afb8 to use ActorUnkITWP

---------

Co-authored-by: Yanis <35189056+Yanis002@users.noreply.github.com>
This commit is contained in:
Mityno
2026-08-14 13:14:49 +00:00
committed by GitHub
parent c505bcac20
commit 39288e4605
34 changed files with 804 additions and 204 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
#include "Unknown/UnkStruct_027e09a8.hpp"
#include "Unknown/UnkStruct_027e0cd8.hpp"
#include "Unknown/UnkStruct_027e0ce0.hpp"
#include "nitro/fx.h"
typedef struct {
unk16 mUnk_00;
@@ -451,7 +452,7 @@ bool ActorHeart_C4::vfunc_04() {
return this->Actor_C4::vfunc_04();
}
void ActorHeart_C4::vfunc_0C(unk32 param1) {
void ActorHeart_C4::vfunc_0C(VecFx32 *param1) {
this->GetActorPtr<ActorHeart>()->SetState(ActorHeartState_1);
this->Actor_C4::vfunc_0C(param1);
}
+2 -1
View File
@@ -7,6 +7,7 @@
#include "Unknown/UnkStruct_027e0cd8.hpp"
#include "Unknown/UnkStruct_027e0ce0.hpp"
#include "Unknown/UnkStruct_027e0d34.hpp"
#include "nitro/fx.h"
#include "versions.h"
extern "C" void func_01ffedac(Vec2bCpp *, VecFx32 *);
@@ -547,7 +548,7 @@ bool ActorItemDrop_C4::vfunc_04() {
return Actor_C4::vfunc_04();
}
void ActorItemDrop_C4::vfunc_0C(unk32 param1) {
void ActorItemDrop_C4::vfunc_0C(VecFx32 *param1) {
this->GetActorPtr<ActorItemDrop>()->SetState(ActorItemDropState_1);
Actor_C4::vfunc_0C(param1);
}
+9 -8
View File
@@ -1,5 +1,6 @@
#include "Actor/ActorRollingStone.hpp"
#include "Physics/Cylinder.hpp"
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_027e09a8.hpp"
#include "Unknown/UnkStruct_027e09b4.hpp"
@@ -288,17 +289,17 @@ void ActorRollingStone::func_ov031_020f8bc4() {
sp38.z = MUL_FX32(cosValue, FLOAT_TO_FX32(1.0f));
sp38.y = FLOAT_TO_FX32(0.0f);
VecFx32 sp28;
Cylinder sp28;
this->vfunc_10(&sp28);
sp28.z += FLOAT_TO_FX32(0.05f);
sp28.pos.z += FLOAT_TO_FX32(0.05f);
if (data_027e09c0->func_ov000_0207e458(0x2, 0x1B, &sp28, 0x2, &sp38, this->mRef)) {
if (data_027e09c0->func_ov000_0207e458(0x2, 0x1B, &sp28.pos, 0x2, &sp38, this->mRef)) {
return;
}
this->func_ov000_02098ab4(0x2, 0x5, 0x1, &this->mVel);
this->vfunc_10(&this->mUnk_D4.mUnk_0C.pos);
this->vfunc_10(&this->mUnk_D4.mUnk_0C);
VecFx32 sp14;
VecFx32_Copy(&this->mPos, &sp14);
@@ -625,17 +626,17 @@ void ActorRollingStone::func_ov031_020f9554() {
sp38.y = FLOAT_TO_FX32(0.0f);
sp38.z = MUL_FX32(cosValue, FLOAT_TO_FX32(0.25f));
VecFx32 sp28;
Cylinder sp28;
this->vfunc_10(&sp28);
sp28.z += FLOAT_TO_FX32(0.05f);
sp28.pos.z += FLOAT_TO_FX32(0.05f);
if (data_027e09c0->func_ov000_0207e458(0x2, 0x1B, &sp28, 0x2, &sp38, this->mRef)) {
if (data_027e09c0->func_ov000_0207e458(0x2, 0x1B, &sp28.pos, 0x2, &sp38, this->mRef)) {
return;
}
this->func_ov000_02098ab4(0x2, 0x5, 0x1, 0x0);
this->vfunc_10(&this->mUnk_D4.mUnk_0C.pos);
this->vfunc_10(&this->mUnk_D4.mUnk_0C);
data_027e09c0->func_ov000_0207e58c(this->mRef, 0xB, 0x4, &this->mUnk_D4);
+2 -1
View File
@@ -6,6 +6,7 @@
#include "Unknown/UnkStruct_027e0ce0.hpp"
#include "Unknown/UnkStruct_027e0cec.hpp"
#include "Unknown/UnkStruct_027e0d34.hpp"
#include "nitro/fx.h"
static PTMF<ActorRupee> data_ov031_02113588[0xD] = {
ActorRupee::func_ov031_020e91a8, // ActorRupeeState_0
@@ -863,7 +864,7 @@ bool ActorRupee_C4::vfunc_04() {
return this->Actor_C4::vfunc_04();
}
void ActorRupee_C4::vfunc_0C(unk32 param1) {
void ActorRupee_C4::vfunc_0C(VecFx32 *param1) {
this->GetActorPtr<ActorRupee>()->SetState(ActorRupeeState_1);
this->Actor_C4::vfunc_0C(param1);
}
+7 -8
View File
@@ -4,6 +4,7 @@
#include "Actor/ActorUnkGYAM.hpp"
#include "Actor/ActorUnkIWTS.hpp"
#include "Actor/ActorUnkMRD2.hpp"
#include "Physics/Cylinder.hpp"
#include "System/OverlayManager.hpp"
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_027e09a8.hpp"
@@ -24,8 +25,7 @@ typedef struct UnkResourceStruct2 {
typedef struct {
/* 00 */ VecFx32 mUnk_00;
/* 0C */ VecFx32 mUnk_0C;
/* 18 */ unk32 mUnk_18;
/* 0C */ Cylinder mUnk_0C;
/* 1C */ VecFx32 mUnk_1C;
/* 28 */ VecFx32 mUnk_28;
/* 34 */
@@ -43,8 +43,7 @@ typedef struct {
typedef struct {
/* 00 */ STRUCT_PAD(0x00, 0x04);
/* 04 */ VecFx32 mUnk_04;
/* 10 */ STRUCT_PAD(0x10, 0x14);
/* 04 */ Cylinder mUnk_04;
/* 14 */ VecFx32 mUnk_14;
/* 20 */
} UnkStruct_020f3c38;
@@ -1006,14 +1005,14 @@ void ActorShotArrow_194::func_ov031_020f374c(Actor *actor) {
func_01ffb714(&stack.mUnk_1C, &actor->mVel, &stack.mUnk_1C);
actor->vfunc_10(&stack.mUnk_0C);
stack.mUnk_00 = stack.mUnk_0C;
stack.mUnk_00 = stack.mUnk_0C.pos;
func_01ffb714(&stack.mUnk_00, &stack.mUnk_1C, &stack.mUnk_00);
unk32 temp = func_01ff9258(stack.mUnk_00.x, stack.mUnk_00.z);
//! @bug: stack.mUnk_18 is used uninitialized?
if (temp > stack.mUnk_18 && stack.mUnk_18 > FLOAT_TO_FX32(0.15f)) {
fx32 temp_r5 = (temp - stack.mUnk_18) + FLOAT_TO_FX32(0.15f);
if (temp > stack.mUnk_0C.size && stack.mUnk_0C.size > FLOAT_TO_FX32(0.15f)) {
fx32 temp_r5 = (temp - stack.mUnk_0C.size) + FLOAT_TO_FX32(0.15f);
u16 value = (u32) (s16) (s32) func_01ffbbe0(stack.mUnk_00.x, stack.mUnk_00.z);
fx16 sin = SIN(value);
@@ -1130,7 +1129,7 @@ bool ActorShotArrow_194::vfunc_0C(Actor *actor, VecFx32 *vector) {
func_01ffb714(&actor->mVel, &this->mUnk_2C->mVel, &stack.mUnk_14);
actor->vfunc_10(&stack.mUnk_04);
if (!func_01ffccf4(&this->mUnk_0C, &stack.mUnk_04, &stack.mUnk_14, &this->mUnk_30)) {
if (!func_01ffccf4(&this->mUnk_0C, &stack.mUnk_04.pos, &stack.mUnk_14, &this->mUnk_30)) {
return false;
}
+2 -1
View File
@@ -3,6 +3,7 @@
#include "Actor/ActorManager.hpp"
#include "MapObject/MapObjectUnkSWFS.hpp"
#include "System/SysNew.hpp"
#include "nitro/fx.h"
class ActorUnkNFSP_vfunc_54 : public Actor {
public:
@@ -221,7 +222,7 @@ void ActorUnkNFSP_C0::vfunc_08() {
this->Actor_C4::vfunc_08();
}
void ActorUnkNFSP_C0::vfunc_0C(unk32 param1) {
void ActorUnkNFSP_C0::vfunc_0C(VecFx32 *param1) {
this->mUnk_04 = 0x1;
this->GetActorPtr<ActorUnkNFSP>()->vfunc_54(0x3);
this->Actor_C4::vfunc_0C(param1);
+10 -15
View File
@@ -152,11 +152,6 @@ bool UnkStruct_ov063_02162ea8::vfunc_0C(const UnkStruct_ov031_020e54d4 *param1,
return UnkStruct_027e0ce0_38_Base::vfunc_0C((const UnkStruct_ov031_020e54d4 *) param2Struct->mUnk_04, param2,
param2Struct->mUnk_04);
}
UnkStruct_ov000_020b19f0::UnkStruct_ov000_020b19f0(G3d_Model *pModel) :
ModelRender(pModel) {}
UnkStruct_ov000_020b3268::UnkStruct_ov000_020b3268(G3d_Model *pModel) :
UnkStruct_ov000_020b19f0(pModel) {}
UnkStruct_ov063_02162ee8::UnkStruct_ov063_02162ee8(G3d_Model *pModel) :
UnkStruct_ov000_020b3268(pModel),
@@ -216,8 +211,8 @@ unk32 UnkStruct_ov063_02162e88::vfunc_04(ActorRef param1, unk32 param2, unk32 pa
}
ActorUnkCANS::ActorUnkCANS() :
mUnk_B0(G3d_GetModelPtr(((MapObjectProfile_Derived2_20 *) GET_PROFILE(ActorProfileUnkCANS)->vfunc_04())->mUnk_50)),
mUnk_128(&mUnk_B0, GET_PROFILE(ActorProfileUnkCANS)->vfunc_04()),
mUnk_0B0(G3d_GetModelPtr(((MapObjectProfile_Derived2_20 *) GET_PROFILE(ActorProfileUnkCANS)->vfunc_04())->mUnk_50)),
mUnk_128(&mUnk_0B0, GET_PROFILE(ActorProfileUnkCANS)->vfunc_04()),
mUnk_1F4(),
mUnk_200(this),
mUnk_224(),
@@ -228,12 +223,12 @@ ActorUnkCANS::ActorUnkCANS() :
mUnk_250(mUnk_5C.mInitialPos),
mUnk_274(0),
mUnk_270(0xCD) {
mFlags[0] |= 0x40;
SET_FLAG(mFlags, ActorFlag_6);
Actor_38 *actor_38 = (Actor_38 *) &mUnk_1F4;
mUnk_38 = actor_38;
actor_38->mUnk_08 = 4;
this->func_ov000_0209862c(4);
mUnk_200.mUnk_04 &= 0xFFFFBFFF;
UNSET_FLAG(&mUnk_200.mUnk_04, ActorFlag_14);
mUnk_276 = gRandom.Next32(0) & 0x80000000 ? 1 : -1;
mUnk_48 = 4;
mUnk_270 *= mUnk_276;
@@ -255,8 +250,8 @@ void ActorUnkCANS::vfunc_10(Cylinder *param1) {
// return bool ?
unk32 ActorUnkCANS::vfunc_18(void) {
this->mUnk_B0.func_ov000_02057c38(6, 2);
this->mUnk_B0.func_ov000_0209a7b8(this, (UnkSystem4_UnkCallback) ActorUnkCANS::func_ov063_0215a678);
this->mUnk_0B0.func_ov000_02057c38(6, 2);
this->mUnk_0B0.func_ov000_0209a7b8(this, (UnkSystem4_UnkCallback) ActorUnkCANS::func_ov063_0215a678);
ActorRef var;
ActorManager *actorManager = gpActorManager;
@@ -506,7 +501,7 @@ void ActorUnkCANS::vfunc_2C(unk32 param1) {
return;
}
((UnkSystem6_Derived2 *) &mUnk_B0)->func_01ffc6d4(mAngleStruct, &mPos);
((UnkSystem6_Derived2 *) &mUnk_0B0)->func_01ffc6d4(mAngleStruct, &mPos);
if (mUnk_268 != NULL) {
VecFx32 vec;
@@ -1202,10 +1197,10 @@ void ActorUnkCANS::func_ov063_0215a678(ActorUnkCANS *actor, UnkStruct_func_ov063
} else {
var1 = 0x1F;
}
func_0200eab0(modelRender->mpModel, actor->mUnk_B0.mUnk_6C, var1);
func_0200eab0(modelRender->mpModel, actor->mUnk_0B0.mUnk_6C, var1);
unk32 var2 = param2->mUnk_08 & 0x10 ? param2->mUnk_AE : -1;
if (var2 == actor->mUnk_B0.mUnk_70) {
if (var2 == actor->mUnk_0B0.mUnk_70) {
if (((u8 *) &modelRender->mRenderObj.mUnk_1C)[1] == 2) {
param2->mUnk_92 = 3;
((u8 *) &modelRender->mRenderObj.mUnk_1C)[1] = 3;
@@ -1236,7 +1231,7 @@ void ActorUnkCANS::func_ov063_0215a678(ActorUnkCANS *actor, UnkStruct_func_ov063
}
unk32 var3 = param2->mUnk_08 & 0x10 ? param2->mUnk_AE : -1;
if (var3 == actor->mUnk_B0.mUnk_74) {
if (var3 == actor->mUnk_0B0.mUnk_74) {
if (((u8 *) &modelRender->mRenderObj.mUnk_1C)[1] == 2) {
param2->mUnk_92 = 3;
((u8 *) &modelRender->mRenderObj.mUnk_1C)[1] = 3;
+562 -36
View File
@@ -1,9 +1,76 @@
//! TODO: This file was generated automatically and might contain errors
#define VECFX32_CTORS //! TODO: remove this hack
#include "Actor/ActorUnkCASE.hpp"
#include "Actor/Actor.hpp"
#include "Actor/ActorId.hpp"
#include "Actor/ActorManager.hpp"
#include "Actor/ActorRef.hpp"
#include "System/SysNew.hpp"
#include "Actor/ActorShotArrow.hpp"
#include "Actor/ActorUnkCANS.hpp"
#include "Actor/ActorUnkITWP.hpp"
#include "MapObject/MapObjectProfile_Derived2_20.hpp"
#include "Physics/Cylinder.hpp"
#include "Render/ModelRender.hpp"
#include "Unknown/UnkStruct_027e09a8.hpp"
#include "Unknown/UnkStruct_027e09c0.hpp"
#include "Unknown/UnkStruct_027e0ce0.hpp"
#include "Unknown/UnkStruct_027e0cec.hpp"
#include "Unknown/UnkStruct_027e0d38.hpp"
#include "flags.h"
#include "global.h"
#include "nitro/fx.h"
#include "nitro/math.h"
#include "nns/g3d/g3d.h"
extern const void *data_ov063_02162558;
extern const void *data_ov063_02162568;
extern Mat4x3p data_027e0964;
extern "C" void func_01ffa60c(const Mat3p *, Mat3p *, Mat3p *);
extern "C" void func_01ffa7a0(VecFx32 *, Mat3p *, VecFx32 *);
extern "C" void func_01ffad5c(Mat4x3p *, Mat4x3p *, Mat4x3p *);
extern "C" void func_01ffb714(VecFx32 *, VecFx32 *, VecFx32 *);
extern "C" u16 func_01ffbbe0(fx32 x, fx32 z);
// Overlay 0
extern unk32 data_ov000_020aecf8[0x2]; //! INFO: Unsure about the size and type
extern u16 data_ov000_020aed00;
extern "C" void func_ov000_0207b70c(ActorUnkCASE_174 *param1, Actor *param2);
extern "C" void func_ov000_020990c0(ActorUnkCASE *param1, ActorShotArrow_140 *param2, unk32 param3, unk32 param4);
// Overlay 17
extern "C" unk32 func_ov017_020bef4c(ActorUnkCASE *param1, unk32 param2);
// Other
extern "C" void G3d_GetCurrentMtx(Mat4x3p *mtx1, Mat3p *mtx2);
struct UnkStruct_data_ov063_021630c8 {
/* 00 */ unk32 mUnk_00;
/* 04 */ unk32 mUnk_04;
/* 08 */ unk32 mUnk_08;
/* 0C */ unk32 mUnk_0C;
/* 10 */ unk32 mUnk_10;
/* 14 */ unk32 mUnk_14;
UnkStruct_data_ov063_021630c8(unk32 a, unk32 b, unk32 c, unk32 d, unk32 e, unk32 f) {
mUnk_00 = a;
mUnk_04 = b;
mUnk_08 = c;
mUnk_0C = d;
mUnk_10 = e;
mUnk_14 = f;
}
};
const UnkStruct_data_ov063_021630c8 data_ov063_021630c8(0x5EC, 0x785, 0xFFFFFD48, 0x7AE, 0x112, 0xFFFFECA4);
static PTMF<ActorUnkCASE> data_ov063_021630e0[0x6] = {ActorUnkCASE::func_ov063_0215af58, ActorUnkCASE::func_ov063_0215af60,
ActorUnkCASE::func_ov063_0215afb8, ActorUnkCASE::func_ov063_0215b090,
ActorUnkCASE::func_ov063_0215b244, ActorUnkCASE::func_ov063_0215b2c4};
static PTMF<ActorUnkCASE> data_ov063_02163110[0x6] = {ActorUnkCASE::func_ov063_0215af54, ActorUnkCASE::func_ov063_0215af5c,
ActorUnkCASE::func_ov063_0215afa4, ActorUnkCASE::func_ov063_0215b054,
ActorUnkCASE::func_ov063_0215b1bc, ActorUnkCASE::func_ov063_0215b2b0};
DECL_PROFILE(ActorProfileUnkCASE);
@@ -12,46 +79,505 @@ Actor *ActorProfileUnkCASE::Create() {
}
ActorProfileUnkCASE::ActorProfileUnkCASE() :
ActorProfile_Derived1(ActorId_CASE) {}
ActorProfile_Derived1(ActorId_CASE) {
VecFx32_Init(0, 0x666, 0, &mUnk_04.pos);
mUnk_04.size = 0x800;
}
ActorUnkCASE::ActorUnkCASE() {}
UnkStruct_ov063_021631a0::UnkStruct_ov063_021631a0(G3d_Model *pModel) :
UnkStruct_ov000_020b3268(pModel),
mUnk_6C(ModelRender::func_ov000_02057f18(&data_ov063_02162568)) {}
void ActorUnkCASE::func_ov063_0215ab70(void) {}
void ActorUnkCASE::func_ov063_0215aba4(void) {}
void ActorUnkCASE::func_ov063_0215abd8(void) {}
void ActorUnkCASE::func_ov063_0215ac4c(void) {}
void ActorUnkCASE::func_ov063_0215ac68(void) {}
void ActorUnkCASE::func_ov063_0215ac8c(void) {}
void ActorUnkCASE::func_ov063_0215acc8(void) {}
void ActorUnkCASE::func_ov063_0215acec(ActorRef *ref1, ActorRef ref2) {};
void ActorUnkCASE::func_ov063_0215ae6c(void) {}
void ActorUnkCASE::func_ov063_0215ae80(void) {}
void ActorUnkCASE::func_ov063_0215ae94(void) {}
void ActorUnkCASE::func_ov063_0215aefc(void) {}
ActorUnkCASE_150::ActorUnkCASE_150(Actor *param1) :
Actor_C4(param1, 1) {
mUnk_20 = param1;
mUnk_04 = 1;
}
bool ActorUnkCASE_150::vfunc_00(ActorRef ref, unk32 param2) {
ActorUnkCASE *actor = (ActorUnkCASE *) mUnk_20;
if (actor->mUnk_1F4 == 0) {
bool cond = true;
if ((u32) actor->mState != 5 && actor->mState != 4) {
cond = false;
}
if (!cond) {
return false;
}
}
if (param2 != 0) {
actor->func_ov063_0215b814(ref);
}
return Actor_C4::vfunc_00(ref, param2);
}
bool ActorUnkCASE_150::vfunc_04() {
((ActorUnkCASE *) mUnk_20)->func_ov063_0215b854();
return Actor_C4::vfunc_04();
}
void ActorUnkCASE_150::vfunc_0C(VecFx32 *param1) {
((ActorUnkCASE *) mUnk_20)->func_ov063_0215b8e8(param1);
Actor_C4::vfunc_0C(param1);
}
ActorUnkCASE_174::ActorUnkCASE_174(Actor *param1) {
mUnk_04 = 0;
mUnk_2C = param1;
}
void ActorUnkCASE_174::vfunc_10(Actor *actor) {
((ActorUnkCASE *) mUnk_2C)->func_ov063_0215b724();
func_ov000_0207b70c(this, actor);
}
ActorUnkCASE::ActorUnkCASE() :
mUnk_0B0(G3d_GetModelPtr(((MapObjectProfile_Derived2_20 *) GET_PROFILE(ActorProfileUnkCASE)->vfunc_04())->mUnk_50)),
mUnk_120(0),
mUnk_124(this),
mUnk_14C(NULL),
mUnk_150(this),
mUnk_174(this),
mUnk_1C8(0),
mUnk_1CC(0, 0, 0),
mUnk_1D8(0),
mUnk_1DC(0),
mUnk_1E0(0),
mUnk_1E4(0),
mUnk_1F4(0) {
UNSET_FLAG(mFlags, ActorFlag_6);
mUnk_40 = &mUnk_150;
mUnk_124.mUnk_04 = 0;
SET_FLAG2(mUnk_124.mUnk_04, ActorFlag_13);
mUnk_124.mUnk_24 = 1;
mUnk_38 = (Actor_38 *) &mUnk_1E8;
mUnk_38->mUnk_08 = 4;
mUnk_A8 = &data_ov063_02162558;
}
void ActorUnkCASE::vfunc_10(Cylinder *param1) {
if (mUnk_14C != NULL) {
((ActorUnkCASE *) mUnk_14C)->vfunc_10(param1);
return;
}
VecFx32_Copy(&mPos, &param1->pos); // doesn't match
param1->size = 0x800;
}
bool ActorUnkCASE::vfunc_18(unk32 param1) {
mUnk_14C = gpActorManager->func_01fff3b4(mUnk_5C.mUnk_28);
mUnk_0B0.func_ov000_02057c38(6, 2);
mUnk_0B0.func_ov000_0209a7b8(this, (UnkSystem4_UnkCallback) ActorUnkCASE::func_ov063_0215b99c);
this->func_ov063_0215aefc(0);
VecFx32_Init(0, 0, 0, &mVel);
return true;
}
void ActorUnkCASE::vfunc_20() {
mUnk_150.mUnk_1C = 1;
if (!func_ov017_020bef4c(this, 0x4000) && mUnk_48 != 0) {
bool cond = true;
if (mState != 1 && mState != 2) {
cond = false;
}
if (!cond) {
return;
}
if (mState == 3) {
this->func_ov063_0215b724();
return;
}
}
mUnk_3C = &mUnk_124;
CALL_PTMF(PTMF<ActorUnkCASE>, data_ov063_021630e0[mState]);
VecFx32 *vec_base, *vec2;
u16 ret1;
fx16 x, y, z;
fx32 x_pos, x_neg, z_pos, z_neg;
if (mUnk_14C != NULL) {
VecFx32 vec1;
VecFx32 *mUnk_14C_vec = (VecFx32 *) (((u8 *) mUnk_14C) + 0x25C);
vec1 = *mUnk_14C_vec;
func_01ffb714(&vec1, &mPos, &vec1);
z = vec1.z;
y = vec1.y;
x = vec1.x;
((VecFx16 *) &mUnk_150.mUnk_0E)->x = x;
((VecFx16 *) &mUnk_150.mUnk_0E)->y = y;
((VecFx16 *) &mUnk_150.mUnk_0E)->z = z;
vec2 = data_027e0ce0->func_01fff148(0);
vec_base = (VecFx32 *) (((u8 *) mUnk_14C) + 0x25C);
z_neg = vec2->z;
z_pos = vec_base->z;
x_pos = vec_base->x;
x_neg = vec2->x;
} else if (mState == 5) {
VecFx32 vec1;
vec1 = mUnk_1CC;
func_01ffb714(&vec1, &mPos, &vec1);
z = vec1.z;
y = vec1.y;
x = vec1.x;
((VecFx16 *) &mUnk_150.mUnk_0E)->x = x;
((VecFx16 *) &mUnk_150.mUnk_0E)->y = y;
((VecFx16 *) &mUnk_150.mUnk_0E)->z = z;
vec2 = data_027e0ce0->func_01fff148(0);
vec_base = &mUnk_1CC;
z_pos = vec_base->z;
z_neg = vec2->z;
x_pos = vec_base->x;
x_neg = vec2->x;
} else {
goto post;
}
// Unsuccessful tries to remove the goto: duplicating raw code, duplicating an inline of the code, wrapping the code in an
// "if (cond1 || cond2) { code }"
ret1 = func_01ffbbe0(x_pos - x_neg, z_pos - z_neg);
s16 sin_val = SIN((u16) (s16) ret1);
s16 cos_val = COS((u16) (s16) ret1);
((VecFx16 *) &mUnk_150.mUnk_08)->y = y;
// ((VecFx16 *) &mUnk_150.mUnk_08)->x = x + (((1 - sin_val) * 0x8000) >> 0x10);
// ((VecFx16 *) &mUnk_150.mUnk_08)->z = z + (((1 - cos_val) * 0x8000) >> 0x10);
((VecFx16 *) &mUnk_150.mUnk_08)->x = x + (s16) ((1 - sin_val) >> 1);
((VecFx16 *) &mUnk_150.mUnk_08)->z = z + (s16) ((1 - cos_val) >> 1);
post:
this->func_ov000_020989e0();
if (((u32) mState == 5 || mState == 4) && (mUnk_124.mUnk_08 & 0x3FFFF) != 0) {
switch (mUnk_124.mUnk_1C) {
case 4:
data_027e0d38->func_ov031_020d9c44(data_ov000_020aed00);
break;
case 11:
if (gpActorManager->func_01fff3b4(mUnk_124.mUnk_0C)->GetActorId() == ActorId_RollingStone) {
this->func_ov063_0215b724();
}
break;
case 13:
break;
default:
func_ov000_020990c0(this, &mUnk_124, 1, 0);
break;
}
}
if (GET_FLAG(mFlags, ActorFlag_Alive)) {
if (mState == 5) {
UnkStruct_ov000_0207de98 param2;
VecFx32_Copy(&mPos, &param2.vec);
param2.param1 = 0x548;
param2.param2 = 0x1000;
data_027e09c0->func_ov000_0207de98(mRef, &param2, mUnk_38);
}
}
}
void ActorUnkCASE::vfunc_24() {
if (mState != 1 && mState != 2) {
return;
}
this->vfunc_20();
}
void ActorUnkCASE::vfunc_2C(unk32 param1) {
if (!this->func_01fff5d0(param1, 0)) {
return;
}
if (mUnk_14C == NULL || ((u32 *) mUnk_14C)[0x268 >> 2] == NULL) {
fx32 sin_val = SIN((u16) mUnk_1C8);
fx32 cos_val = COS((u16) mUnk_1C8);
Mat3p mat2;
Mat3p mat1;
Mat3p_InitZRotation(&mat1, sin_val, cos_val);
func_01ffa60c(&mat1, &mUnk_1A4, &mat2);
mUnk_0B0.vfunc_14(&mat2, &mPos);
}
}
// Static
void ActorUnkCASE::func_ov063_0215acec(ActorRef *ref1, ActorRef ref2) {
ActorParams params;
params.mUnk_28 = 0;
params.func_ov000_020975f8();
params.mUnk_28 = ref2;
Actor::func_ov000_020973f4(ref1, &data_ov000_020b539c_eur, ActorId_CASE, &params, 0);
}
void ActorUnkCASE::func_ov063_0215aefc(ActorState param1) {
mState = param1;
mUnk_2C = data_ov000_020aecf8[0];
mUnk_120 = 0;
CALL_PTMF(PTMF<ActorUnkCASE>, data_ov063_02163110[mState]);
}
// Matched
void ActorUnkCASE::func_ov063_0215af54(void) {}
// Matched
void ActorUnkCASE::func_ov063_0215af58(void) {}
// Matched
void ActorUnkCASE::func_ov063_0215af5c(void) {}
void ActorUnkCASE::func_ov063_0215af60(void) {}
void ActorUnkCASE::func_ov063_0215afa4(void) {}
void ActorUnkCASE::func_ov063_0215afb8(void) {}
void ActorUnkCASE::func_ov063_0215b054(void) {}
void ActorUnkCASE::func_ov063_0215b090(void) {}
void ActorUnkCASE::func_ov063_0215b1bc(void) {}
void ActorUnkCASE::func_ov063_0215b244(void) {}
void ActorUnkCASE::func_ov063_0215b2b0(void) {}
void ActorUnkCASE::func_ov063_0215af60(void) {
if (gpActorManager->func_01fff3b4(mUnk_1E4)) {
return;
}
if (mUnk_14C != NULL) {
((ActorUnkCANS *) mUnk_14C)->func_ov063_0215a428();
}
this->func_ov063_0215aefc(0);
}
void ActorUnkCASE::func_ov063_0215afa4(void) {
mUnk_2C = 0;
mVel.x = 0;
mVel.z = 0;
}
void ActorUnkCASE::func_ov063_0215afb8(void) {
ActorUnkITWP *otherActor = (ActorUnkITWP *) gpActorManager->func_01fff3b4(mUnk_1E4);
if (otherActor == NULL) {
this->func_ov063_0215aefc(4);
return;
}
//! INFO: Actually a Mat3p, this is only used to allow a "batched" copy (all 9 elements at a time, not 3 by 3)
struct Fx32Array9 {
fx32 array[9];
};
*(Fx32Array9 *) &mUnk_1A4 = *(Fx32Array9 *) &otherActor->mUnk_154;
VecFx32 vec = otherActor->mUnk_0E8;
mPos.x = vec.x;
mPos.y = vec.y;
mPos.z = vec.z;
mPrevPos.x = vec.x;
mPrevPos.y = vec.y;
mPrevPos.z = vec.z;
}
void ActorUnkCASE::func_ov063_0215b054(void) {
mVel.x = mUnk_1D8;
mVel.y = 0;
mVel.z = mUnk_1E0;
UNSET_FLAG2(*(s16 *) &mUnk_44, ActorFlag_5);
mUnk_52 = -1;
mUnk_50 = 0;
}
void ActorUnkCASE::func_ov063_0215b090(void) {
if (mUnk_50 < 4) {
this->func_ov063_0215afb8();
if (mUnk_50 < mUnk_52) {
mUnk_50++;
}
this->vfunc_10(&mUnk_174.mUnk_0C);
data_027e09c0->func_ov000_0207e58c(mRef, 3, 4, &mUnk_174);
return;
}
mUnk_1C8 += DEG_TO_ANG(45);
VecFx32_Copy(&mPos, &mPrevPos);
VecFx32_Add(&mPos, &mVel, &mPos);
if (mVel.x == 0 && mVel.z == 0) {
mVel.y -= mUnk_2C;
}
this->func_ov000_02098910(NULL, 16);
this->vfunc_10(&mUnk_174.mUnk_0C);
data_027e09c0->func_ov000_0207e58c(mRef, 3, 4, &mUnk_174);
if (mUnk_46) {
this->func_ov063_0215b724();
}
}
void ActorUnkCASE::func_ov063_0215b1bc(void) {
mVel.x = 0;
mVel.z = 0;
VecFx32 vec;
VecFx32_Init(0, 0, FLOAT_TO_FX32(1.0f), &vec);
func_01ffa7a0(&vec, &mUnk_1A4, &vec);
s16 angle = func_01ffbbe0(vec.x, vec.z);
Mat3p_InitYRotation(&mUnk_1A4, SIN((u16) angle), COS((u16) angle));
}
void ActorUnkCASE::func_ov063_0215b244(void) {
mVel.y -= mUnk_2C;
VecFx32_Copy(&mPos, &mPrevPos);
VecFx32_Add(&mPos, &mVel, &mPos);
this->func_ov000_02098b8c(1, NULL);
if ((mUnk_46 & 3) != 0) {
this->func_ov063_0215aefc(5);
}
}
void ActorUnkCASE::func_ov063_0215b2b0(void) {
mVel.x = 0;
mVel.z = 0;
mUnk_2C = 0;
}
// Matched
void ActorUnkCASE::func_ov063_0215b2c4(void) {}
void ActorUnkCASE::func_ov063_0215b2c8(void) {}
void ActorUnkCASE::func_ov063_0215b2ec(void) {}
void ActorUnkCASE::func_ov063_0215b624(void) {}
void ActorUnkCASE::func_ov063_0215b6c8(VecFx32 *param1, UnkAngleStruct angle) {}
void ActorUnkCASE::func_ov063_0215b724(void) {}
void ActorUnkCASE::func_ov063_0215b7cc(void) {}
void ActorUnkCASE::func_ov063_0215b814(void) {}
void ActorUnkCASE::func_ov063_0215b854(void) {}
void ActorUnkCASE::func_ov063_0215b8e8(void) {}
void ActorUnkCASE::func_ov063_0215b99c(void) {}
void ActorUnkCASE::func_ov063_0215ba64(void) {}
void ActorUnkCASE::func_ov063_0215bab0(void) {}
void ActorUnkCASE::func_ov063_0215b6c8(VecFx32 *param1, UnkAngleStruct angle) {
VecFx32 vec = *param1;
VecFx32_Copy(&vec, &mPos);
VecFx32_Copy(&vec, &mPrevPos);
mAngle = *(s16 *) &angle.angle;
}
void ActorUnkCASE::func_ov063_0215b724(void) {
this->func_ov000_020984d0();
data_027e0cec->func_ov000_0209feac(0xCC06, &mPos, 2, 0, 0);
data_027e0cec->func_ov000_0209feac(0xCC07, &mPos, 2, 0, 0);
data_027e0cec->func_ov000_0209feac(0x823, &mPos, 2, 0, 0);
data_027e09a8->func_ov000_02071b30(0x9865, &mPos, 0);
}
void ActorUnkCASE::func_ov063_0215b814(ActorRef ref) {
mUnk_1E4 = ref;
if (mUnk_14C != NULL) {
((ActorUnkCANS *) mUnk_14C)->func_ov063_02158448(9);
}
this->func_ov063_0215aefc(1);
}
void ActorUnkCASE::func_ov063_0215b854(void) {
if (mUnk_14C != NULL) {
ActorUnkCANS *actorCans = (ActorUnkCANS *) mUnk_14C;
VecFx32 vec = actorCans->mPos;
VecFx32_Copy(&vec, &mPos);
VecFx32_Copy(&vec, &mPrevPos);
actorCans->mUnk_236 = 20;
actorCans->mUnk_234 = 0;
actorCans = (ActorUnkCANS *) mUnk_14C;
actorCans->func_ov063_02158b0c();
actorCans = (ActorUnkCANS *) mUnk_14C;
actorCans->func_ov063_0215a428();
mUnk_124.mUnk_04 = ~0x38000;
mUnk_14C = NULL;
}
this->func_ov063_0215aefc(2);
}
static inline bool VecFx32_IsZero(VecFx32 *vec) {
return vec->x == 0 && vec->y == 0 && vec->z == 0;
}
void ActorUnkCASE::func_ov063_0215b8e8(VecFx32 *param1) {
if (mUnk_14C != NULL) {
((ActorUnkCANS *) mUnk_14C)->func_ov063_0215a428();
if (param1->x == 0 && param1->y == 0 && param1->z == 0) {
this->func_ov063_0215aefc(0);
return;
}
((ActorUnkCANS *) mUnk_14C)->func_ov063_02158b0c();
mUnk_14C = NULL;
}
if (VecFx32_IsZero((VecFx32 *) param1)) {
this->func_ov063_0215aefc(4);
} else {
unk32 x = param1->x;
unk32 y = param1->y;
unk32 z = param1->z;
#if !IS_JP
mUnk_150.mUnk_04 = 0;
#endif
VecFx32_Init(x, y, z, (VecFx32 *) &mUnk_1D8);
this->func_ov063_0215aefc(3);
}
}
void ActorUnkCASE::func_ov063_0215b99c(ActorUnkCASE *param1, UnkStruct_func_ov063_0215a678 *param2) {
unk32 var1;
if ((param2->mUnk_08 & 0x10) != 0) {
var1 = param2->mUnk_AE;
} else {
var1 = -1;
}
u8 *var2 = ((u8 *) param2->mUnk_04);
// Can probably use a ternary instead of var1
if (var1 != param1->mUnk_0B0.mUnk_6C) {
return;
}
if (var2[0x25] == 2) {
param2->mUnk_92 = 3;
var2[0x25] = 3;
return;
}
if (var2[0x25] != 3) {
return;
}
Mat4x3p matx1, matx2;
G3d_GetCurrentMtx(&matx1, NULL);
func_01ffad5c(&matx1, &data_027e0964, &matx2);
// VecFx32_Copy(&matx2.wColumn, &param1->mUnk_1CC);
fx32 x = matx2.wColumn.x;
fx32 z = matx2.wColumn.z;
fx32 y = matx2.wColumn.y;
param1->mUnk_1CC.x = x;
param1->mUnk_1CC.y = y;
param1->mUnk_1CC.z = z;
param2->mUnk_92 = 2;
var2[0x25] = 2;
}
ActorUnkCASE::~ActorUnkCASE() {}
ActorProfileUnkCASE::~ActorProfileUnkCASE() {}
+2 -1
View File
@@ -10,6 +10,7 @@
#include "Unknown/UnkStruct_027e0cec.hpp"
#include "Unknown/UnkStruct_027e0d34.hpp"
#include "Unknown/UnkStruct_027e0d38.hpp"
#include "nitro/fx.h"
class UnkStruct_ov071_0215f92c : public UnkStruct_ov031_Items_00 {
public:
@@ -453,7 +454,7 @@ bool ActorTearLight_194::vfunc_04() {
return this->Actor_C4::vfunc_04();
}
void ActorTearLight_194::vfunc_0C(unk32 param1) {
void ActorTearLight_194::vfunc_0C(VecFx32 *param1) {
this->GetActorPtr<ActorTearLight>()->func_ov071_0215fca4();
return this->Actor_C4::vfunc_0C(param1);
}