1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

Obj_Mure3 OK (#720)

* matched

* format

* review

Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
petrie911 2021-03-27 14:50:26 -05:00 committed by GitHub
parent 8b57f36d32
commit cf78de2b11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 166 additions and 555 deletions

View file

@ -14,7 +14,13 @@ void ObjMure3_Init(Actor* thisx, GlobalContext* globalCtx);
void ObjMure3_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjMure3_Update(Actor* thisx, GlobalContext* globalCtx);
/*
void func_80B9AF24(ObjMure3* this);
void func_80B9AF34(ObjMure3* this, GlobalContext* globalCtx);
void func_80B9AF54(ObjMure3* this);
void func_80B9AF64(ObjMure3* this, GlobalContext* globalCtx);
void func_80B9AFEC(ObjMure3* this);
void func_80B9AFFC(ObjMure3* this, GlobalContext* globalCtx);
const ActorInit Obj_Mure3_InitVars = {
ACTOR_OBJ_MURE3,
ACTORCAT_BG,
@ -26,31 +32,168 @@ const ActorInit Obj_Mure3_InitVars = {
(ActorFunc)ObjMure3_Update,
NULL,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9A9D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9AA90.s")
static s16 sRupeeCounts[] = { 5, 5, 7, 0 };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9ABA0.s")
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 100, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 1800, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9ACE4.s")
void func_80B9A9D0(ObjMure3* this, GlobalContext* globalCtx) {
s32 i;
Vec3f spawnPos;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9ADCC.s")
Math_Vec3f_Copy(&spawnPos, &this->actor.world.pos);
for (i = 0; i < 5; i++, spawnPos.y += 20.0f) {
if (!((this->unk_16C >> i) & 1)) {
this->unk_150[i] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_BLUE);
if (this->unk_150[i] != NULL) {
this->unk_150[i]->actor.room = this->actor.room;
}
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/ObjMure3_Init.s")
void func_80B9AA90(ObjMure3* this, GlobalContext* globalCtx) {
s32 i;
Vec3f spawnPos;
f32 sn = Math_SinS(this->actor.world.rot.y);
f32 cos = Math_CosS(this->actor.world.rot.y);
f32 radius;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/ObjMure3_Destroy.s")
spawnPos.y = this->actor.world.pos.y;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9AF24.s")
for (i = 0, radius = -40.0f; i < 5; i++, radius += 20.0f) {
if (!((this->unk_16C >> i) & 1)) {
spawnPos.x = this->actor.world.pos.x + (sn * radius);
spawnPos.z = this->actor.world.pos.z + (cos * radius);
this->unk_150[i] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN);
if (this->unk_150[i] != NULL) {
this->unk_150[i]->actor.room = this->actor.room;
}
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9AF34.s")
void func_80B9ABA0(ObjMure3* this, GlobalContext* globalCtx) {
s32 i;
Vec3f spawnPos;
s16 yRot;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9AF54.s")
spawnPos.y = this->actor.world.pos.y;
yRot = this->actor.world.rot.y;
for (i = 0; i < 6; i++) {
if (!((this->unk_16C >> i) & 1)) {
spawnPos.x = (Math_SinS(yRot) * 40.0f) + this->actor.world.pos.x;
spawnPos.z = (Math_CosS(yRot) * 40.0f) + this->actor.world.pos.z;
this->unk_150[i] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_GREEN);
if (this->unk_150[i] != NULL) {
this->unk_150[i]->actor.room = this->actor.room;
}
}
yRot += 0x2AAA;
}
if (!((this->unk_16C >> 6) & 1)) {
spawnPos.x = this->actor.world.pos.x;
spawnPos.z = this->actor.world.pos.z;
this->unk_150[6] = Item_DropCollectible2(globalCtx, &spawnPos, 0x4000 | ITEM00_RUPEE_RED);
if (this->unk_150[6] != NULL) {
this->unk_150[6]->actor.room = this->actor.room;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9AF64.s")
void func_80B9ACE4(ObjMure3* this, GlobalContext* globalCtx) {
s16 count = sRupeeCounts[(this->actor.params >> 13) & 7];
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9AFEC.s")
for (i = 0; i < count; i++) {
EnItem00** collectible = &this->unk_150[i];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/func_80B9AFFC.s")
if (!((this->unk_16C >> i) & 1) && (*collectible != NULL)) {
if (Actor_HasParent(&(*collectible)->actor, globalCtx) || ((*collectible)->actor.update == NULL)) {
this->unk_16C |= (1 << i);
} else {
Actor_Kill(&(*collectible)->actor);
}
}
*collectible = NULL;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Mure3/ObjMure3_Update.s")
void func_80B9ADCC(ObjMure3* this, GlobalContext* globalCtx) {
s16 count = sRupeeCounts[(this->actor.params >> 13) & 7];
s32 i;
for (i = 0; i < count; i++) {
EnItem00** collectible = &this->unk_150[i];
if ((*collectible != NULL) && !((this->unk_16C >> i) & 1)) {
if (Actor_HasParent(&(*collectible)->actor, globalCtx)) {
Flags_SetSwitch(globalCtx, this->actor.params & 0x3F);
}
if ((*collectible)->actor.update == NULL) {
this->unk_16C |= (1 << i);
this->unk_150[i] = NULL;
}
}
}
}
void ObjMure3_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
ObjMure3* this = THIS;
if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) {
Actor_Kill(&this->actor);
return;
}
Actor_ProcessInitChain(&this->actor, sInitChain);
func_80B9AF24(this);
}
void ObjMure3_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void func_80B9AF24(ObjMure3* this) {
this->actionFunc = func_80B9AF34;
}
void func_80B9AF34(ObjMure3* this, GlobalContext* globalCtx) {
func_80B9AF54(this);
}
void func_80B9AF54(ObjMure3* this) {
this->actionFunc = func_80B9AF64;
}
void func_80B9AF64(ObjMure3* this, GlobalContext* globalCtx) {
static ObjMure3SpawnFunc spawnFuncs[] = { func_80B9A9D0, func_80B9AA90, func_80B9ABA0 };
if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) < SQ(1150.0f)) {
this->actor.flags |= 0x10;
spawnFuncs[(this->actor.params >> 13) & 7](this, globalCtx);
func_80B9AFEC(this);
}
}
void func_80B9AFEC(ObjMure3* this) {
this->actionFunc = func_80B9AFFC;
}
void func_80B9AFFC(ObjMure3* this, GlobalContext* globalCtx) {
func_80B9ADCC(this, globalCtx);
if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) >= SQ(1450.0f)) {
this->actor.flags &= ~0x10;
func_80B9ACE4(this, globalCtx);
func_80B9AF54(this);
}
}
void ObjMure3_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjMure3* this = THIS;
this->actionFunc(this, globalCtx);
}

View file

@ -6,9 +6,14 @@
struct ObjMure3;
typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, GlobalContext*);
typedef void (*ObjMure3SpawnFunc)(struct ObjMure3*, GlobalContext*);
typedef struct ObjMure3 {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x24];
/* 0x014C */ ObjMure3ActionFunc actionFunc;
/* 0x0150 */ EnItem00* unk_150[7];
/* 0x016C */ u16 unk_16C;
} ObjMure3; // size = 0x0170
extern const ActorInit Obj_Mure3_InitVars;