proper ovl_Obj_Mure2

This commit is contained in:
RevoSucks
2023-10-31 19:16:04 -04:00
3 changed files with 151 additions and 75 deletions
-1
View File
@@ -1547,7 +1547,6 @@ beginseg
name "ovl_Obj_Mure2"
compress
include "build/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.o"
include "build/data/ovl_Obj_Mure2/ovl_Obj_Mure2.data.o"
include "build/data/ovl_Obj_Mure2/ovl_Obj_Mure2.reloc.o"
endseg
+146 -69
View File
@@ -13,110 +13,187 @@
void ObjMure2_Init(Actor* thisx, PlayState* play);
void ObjMure2_Update(Actor* thisx, PlayState* play);
void func_8096104C(ObjMure2* this, PlayState* play);
void func_809613C4(ObjMure2* this, PlayState* play);
void func_809613FC(ObjMure2* this, PlayState* play);
void func_80961490(ObjMure2* this, PlayState* play);
void func_809611BC(ObjMure2* this, PlayState* play);
void func_809613B0(ObjMure2* this);
void func_809613E8(ObjMure2* this);
void func_8096147C(ObjMure2* this);
void func_80961018(s16*, ObjMure2*);
void func_809613B0(ObjMure2*);
void func_809613E8(ObjMure2*);
void func_8096104C(ObjMure2*, PlayState*);
void func_8096147C(ObjMure2*);
void func_809611BC(ObjMure2*, PlayState*);
void func_809612BC(ObjMure2*);
void func_80960CF0(Vec3f pos[12], ObjMure2* this);
void func_80960E0C(Vec3f pos[12], ObjMure2* this);
void func_80960F0C(Vec3f pos[12], ObjMure2* this);
extern f32 D_80961590[];
extern f32 D_8096159C[];
extern s16 D_809615A8[];
#if 0
ActorInit Obj_Mure2_InitVars = {
/**/ ACTOR_OBJ_MURE2,
/**/ ACTORCAT_PROP,
/**/ FLAGS,
/**/ GAMEPLAY_KEEP,
/**/ sizeof(ObjMure2),
/**/ ObjMure2_Init,
/**/ Actor_Noop,
/**/ ObjMure2_Update,
/**/ NULL,
ACTOR_OBJ_MURE2,
ACTORCAT_PROP,
FLAGS,
GAMEPLAY_KEEP,
sizeof(ObjMure2),
(ActorFunc)ObjMure2_Init,
(ActorFunc)Actor_Noop,
(ActorFunc)ObjMure2_Update,
(ActorFunc)NULL,
};
f32 D_80961590[] = {
2560000.0,
2560000.0,
2560000.0,
};
f32 D_8096159C[] = {
2907025.0,
2907025.0,
2907025.0,
};
static s16 sChildCounts[] = {
9,
12,
8,
0,
};
static s16 sActorIds[] = {
ACTOR_EN_KUSA,
ACTOR_EN_KUSA,
ACTOR_EN_ISHI,
};
typedef struct Mure2SpawnInfo {
s16 dist;
s16 angle;
} Mure2SpawnInfo;
Mure2SpawnInfo D_809615B8[] = {
{ 0x0028, 0x0666 }, { 0x0028, 0x2CCC }, { 0x0028, 0x5999 }, { 0x0028, 0x8666 },
{ 0x0014, 0xC000 }, { 0x0050, 0x1333 }, { 0x0050, 0x4000 }, { 0x0050, 0x6CCC },
{ 0x0050, 0x9333 }, { 0x0050, 0xACCC }, { 0x0050, 0xC666 }, { 0x003C, 0xE000 },
};
typedef void (*ObjMure2SpawnPosFunc)(Vec3f[12], ObjMure2*);
static ObjMure2SpawnPosFunc sSpawnPosFuncs[] = {
func_80960CF0,
func_80960E0C,
func_80960F0C,
};
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_809615F4[] = {
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 100, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 2100, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP),
};
#endif
void func_80960CF0(Vec3f pos[12], ObjMure2* this) {
s32 i;
extern InitChainEntry D_809615F4[];
Math_Vec3f_Copy(&pos[0], &this->actor.world.pos);
for (i = 1; i < sChildCounts[this->actor.params & 3]; i++) {
Math_Vec3f_Copy(&pos[i], &this->actor.world.pos);
(pos + i)->x += 80.0f * Math_SinS((i - 1) * 0x2000);
(pos + i)->z += 80.0f * Math_CosS((i - 1) * 0x2000);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure2/func_80960CF0.s")
void func_80960E0C(Vec3f pos[12], ObjMure2* this) {
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure2/func_80960E0C.s")
for (i = 0; i < sChildCounts[this->actor.params & 3]; i++) {
Math_Vec3f_Copy(pos + i, &this->actor.world.pos);
(pos + i)->x += D_809615B8[i].dist * Math_CosS(D_809615B8[i].angle);
(pos + i)->z -= D_809615B8[i].dist * Math_SinS(D_809615B8[i].angle);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure2/func_80960F0C.s")
void func_80960F0C(Vec3f pos[12], ObjMure2* this) {
s32 i;
void func_80961018(s16* arg0, ObjMure2* arg1) {
s32 value = arg1->actor.params & 3;
s32 temp_a2 = (arg1->actor.params >> 8) & 0x1F;
for (i = 0; i < sChildCounts[this->actor.params & 3]; i++) {
Math_Vec3f_Copy(&pos[i], &this->actor.world.pos);
(pos + i)->x += 80.0f * Math_SinS(i * 0x2000);
(pos + i)->z += 80.0f * Math_CosS(i * 0x2000);
}
}
if (value == 2) {
*arg0 = temp_a2 * 0x10;
void func_80961018(s16* arg0, ObjMure2* this) {
s32 temp_v1;
s32 temp_a2;
temp_v1 = this->actor.params & 3;
temp_a2 = (this->actor.params >> 8) & 0x1F;
if (temp_v1 == 2) {
*arg0 = temp_a2 << 4;
return;
}
*arg0 = temp_a2 << 8;
}
void func_8096104C(ObjMure2* this, PlayState* play) {
Vec3f* pos;
s32 temp_s0;
Vec3f spawnPos[12];
s16 sp7E;
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Mure2/func_8096104C.s")
void func_809611BC(ObjMure2* arg0, PlayState* arg1) {
s16 var_v0 = D_809615A8[arg0->actor.params & 3];
s32 var_s2 = 0;
if (var_v0 > 0) {
do {
if (!((arg0->unk_178 >> var_s2) & 1)) {
if (arg0->unk_148[var_s2] != NULL) {
if (Actor_HasParent(arg0->unk_148[var_s2], arg1) != 0) {
arg0->unk_178 |= 1 << var_s2;
} else {
Actor_Kill(arg0->unk_148[var_s2]);
}
arg0->unk_148[var_s2] = NULL;
}
} else {
arg0->unk_148[var_s2] = NULL;
temp_s0 = this->actor.params & 3;
sSpawnPosFuncs[temp_s0](spawnPos, this);
func_80961018(&sp7E, this);
for (i = 0; i < sChildCounts[temp_s0]; i++) {
if (this->actors[i] != NULL) {
continue;
}
if (((this->spawnFlags >> i) & 1) == 0) {
pos = &spawnPos[i];
this->actors[i] = Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, sActorIds[temp_s0], pos->x, pos->y,
pos->z, this->actor.world.rot.x, 0, this->actor.world.rot.z,
sp7E, this->actor.csId, this->actor.halfDaysBits, NULL);
if (this->actors[i] != NULL) {
this->actors[i]->room = this->actor.room;
}
var_v0 = D_809615A8[arg0->actor.params & 3];
} while (++var_s2 < var_v0);
}
}
}
void func_809612BC(ObjMure2* arg0) {
s32 var_v0 = 0;
s16 var_v1 = D_809615A8[arg0->actor.params & 3];
void func_809611BC(ObjMure2* this, PlayState* play) {
s32 i;
if (var_v1 > 0) {
do {
if (arg0->unk_148[var_v0] != NULL) {
if (!(((s32)arg0->unk_178 >> var_v0) & 1) && (arg0->unk_148[var_v0]->update == NULL)) {
arg0->unk_178 = arg0->unk_178 | (1 << var_v0);
arg0->unk_148[var_v0] = NULL;
for (i = 0; i < sChildCounts[this->actor.params & 3]; i++) {
if (((this->spawnFlags >> i) & 1) == 0) {
if (this->actors[i] != NULL) {
if (Actor_HasParent(this->actors[i], play)) {
this->spawnFlags |= 1 << i;
} else {
Actor_Kill(this->actors[i]);
}
this->actors[i] = NULL;
}
} else {
this->actors[i] = NULL;
}
}
}
var_v1 = D_809615A8[arg0->actor.params & 3];
} while (++var_v0 < var_v1);
void ObjMure2_ClearChildrenList(ObjMure2* this) {
s32 i;
for (i = 0; i < sChildCounts[this->actor.params & 3]; i++) {
if (this->actors[i] == NULL) {
continue;
}
if ((((this->spawnFlags >> i) & 1) == 0) && (this->actors[i]->update == NULL)) {
this->spawnFlags |= (1 << i);
this->actors[i] = NULL;
}
}
}
void ObjMure2_Init(Actor* thisx, PlayState* play) {
ObjMure2* this = THIS;
Actor_ProcessInitChain(&this->actor, D_809615F4);
Actor_ProcessInitChain(&this->actor, sInitChain);
if (play->csCtx.state != 0) {
this->actor.uncullZoneForward += 1200.0f;
}
@@ -149,8 +226,7 @@ void func_8096147C(ObjMure2* this) {
}
void func_80961490(ObjMure2* this, PlayState* play) {
func_809612BC(this);
ObjMure2_ClearChildrenList(this);
if ((D_8096159C[this->actor.params & 3] * this->unk_17C) <=
Math3D_XZLengthSquared(this->actor.projectedPos.x, this->actor.projectedPos.z)) {
this->actor.flags &= ~0x10;
@@ -161,10 +237,11 @@ void func_80961490(ObjMure2* this, PlayState* play) {
void ObjMure2_Update(Actor* thisx, PlayState* play) {
ObjMure2* this = THIS;
if (play->csCtx.state == 0) {
this->unk_17C = 1.0f;
} else {
this->unk_17C = 4.0f;
}
this->actionFunc(this, play);
}
}
@@ -10,10 +10,10 @@ typedef void (*ObjMure2ActionFunc)(struct ObjMure2*, PlayState*);
typedef struct ObjMure2 {
/* 0x000 */ Actor actor;
/* 0x144 */ ObjMure2ActionFunc actionFunc;
/* 0x148 */ Actor* unk_148[0xC]; /* inferred */
/* 0x178 */ u16 unk_178; /* inferred */
/* 0x17A */ char pad_17A[2];
/* 0x17C */ f32 unk_17C; /* inferred */
} ObjMure2; /* size = 0x180 */
/* 0x148 */ Actor* actors[12];
/* 0x178*/ u16 spawnFlags;
/* 0x17C */ f32 unk_17C;
} ObjMure2; // size = 0x180
#endif // Z_OBJ_MURE2_H