From 45cee7d8af09395d8ab19461454b079748e2abae Mon Sep 17 00:00:00 2001 From: Maide <34639600+Kelebek1@users.noreply.github.com> Date: Mon, 14 Feb 2022 00:58:19 +0000 Subject: [PATCH] Obj_Dhouse (#648) * Obj_Dhouse * PR * PR --- spec | 3 +- .../actors/ovl_Obj_Dhouse/z_obj_dhouse.c | 517 +++++++++++++++++- .../actors/ovl_Obj_Dhouse/z_obj_dhouse.h | 37 +- undefined_syms.txt | 7 - 4 files changed, 522 insertions(+), 42 deletions(-) diff --git a/spec b/spec index c4de1495c0..3302e9d415 100644 --- a/spec +++ b/spec @@ -3891,8 +3891,7 @@ beginseg name "ovl_Obj_Dhouse" compress include "build/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.o" - include "build/data/ovl_Obj_Dhouse/ovl_Obj_Dhouse.data.o" - include "build/data/ovl_Obj_Dhouse/ovl_Obj_Dhouse.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Dhouse/ovl_Obj_Dhouse_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c index 1177a68559..bec773c2f9 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c @@ -1,12 +1,13 @@ /* * File: z_obj_dhouse.c * Overlay: ovl_Obj_Dhouse - * Description: Dinner plate Prop + * Description: Stone bridge that Keeta sleeps under */ #include "z_obj_dhouse.h" +#include "objects/object_dhouse/object_dhouse.h" -#define FLAGS 0x00400010 +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_400000) #define THIS ((ObjDhouse*)thisx) @@ -15,7 +16,17 @@ void ObjDhouse_Destroy(Actor* thisx, GlobalContext* globalCtx); void ObjDhouse_Update(Actor* thisx, GlobalContext* globalCtx); void ObjDhouse_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80B12E7C(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3); +void func_80B13170(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3); +void func_80B13908(ObjDhouse* this); +void func_80B1391C(ObjDhouse* this, GlobalContext* globalCtx); +void func_80B1392C(ObjDhouse* this); +void func_80B13940(ObjDhouse* this, GlobalContext* globalCtx); +void func_80B139D8(ObjDhouse* this); +void func_80B139F4(ObjDhouse* this, GlobalContext* globalCtx); +void func_80B13C08(Actor* thisx, GlobalContext* globalCtx); +void func_80B13E40(Actor* thisx, GlobalContext* globalCtx); + const ActorInit Obj_Dhouse_InitVars = { ACTOR_OBJ_DHOUSE, ACTORCAT_BG, @@ -28,58 +39,504 @@ const ActorInit Obj_Dhouse_InitVars = { (ActorFunc)ObjDhouse_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B13FB4[] = { +ObjDhouseStruct3 D_80B13E90[] = { + { + object_dhouse_DL_006E28, + object_dhouse_DL_006CE0, + { 84.2f, 30.480001f, 109.68001f }, + { 3.0f, 21.0f, 11.0f }, + 5500, + 500, + -500, + 7, + }, + { + object_dhouse_DL_0070A8, + object_dhouse_DL_006EF8, + { 40.8f, -38.72f, 62.12f }, + { -5.0f, 22.0f, 8.0f }, + 600, + -300, + 2000, + 4, + }, + { + object_dhouse_DL_007348, + object_dhouse_DL_007190, + { 125.31999f, -34.52f, 62.12f }, + { 8.0f, 13.0f, 6.0f }, + -2400, + 200, + -300, + 4, + }, + { + object_dhouse_DL_007568, + object_dhouse_DL_007438, + { 150.56f, -80.520004f, 62.12f }, + { -4.0f, 7.0f, 3.0f }, + 100, + 50, + 850, + 8, + }, + { + object_dhouse_DL_007780, + object_dhouse_DL_007638, + { 82.08f, 21.32f, -99.64f }, + { -7.0f, 34.0f, -1.0f }, + -2400, + -100, + 1000, + 5, + }, + { + object_dhouse_DL_007A00, + object_dhouse_DL_007850, + { 45.64f, -38.16f, -56.24f }, + { -1.0f, 20.0f, -16.0f }, + -2000, + 700, + 500, + 6, + }, + { + object_dhouse_DL_007C98, + object_dhouse_DL_007AE8, + { 140.4f, -60.84f, -56.24f }, + { 2.0f, 27.0f, -10.0f }, + -1000, + -500, + -500, + 9, + }, +}; + +Vec3f D_80B13FA8 = { 0.0f, 0.3f, 0.0f }; + +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 8000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 1000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +Vec3f D_80B13FC4 = { 160.0f, 0.0f, 240.0f }; -extern InitChainEntry D_80B13FB4[]; +void ObjDhouse_Init(Actor* thisx, GlobalContext* globalCtx) { + ObjDhouse* this = THIS; -extern UNK_TYPE D_06004928; -extern UNK_TYPE D_06005A78; -extern UNK_TYPE D_06008040; + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/ObjDhouse_Init.s") + DynaPolyActor_Init(&this->dyna, 0); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/ObjDhouse_Destroy.s") + if (Flags_GetSwitch(globalCtx, OBJDHOUSE_GET_7F(&this->dyna.actor))) { + this->dyna.actor.draw = func_80B13E40; + func_80B13908(this); + } else { + DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_dhouse_Colheader_008040); + this->dyna.actor.flags |= ACTOR_FLAG_10; + func_80B1392C(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B12A50.s") +void ObjDhouse_Destroy(Actor* thisx, GlobalContext* globalCtx) { + ObjDhouse* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B12A88.s") + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B12B38.s") +void func_80B12A50(ObjDhouseStruct1* this, ObjDhouseStruct3* ptr3, Vec3f* arg2) { + arg2->x = this->unk_00.x + ptr3->unk_08.x; + arg2->y = this->unk_00.y + ptr3->unk_08.y; + arg2->z = this->unk_00.z + ptr3->unk_08.z; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B12D78.s") +void func_80B12A88(Actor* thisx) { + ObjDhouse* this = THIS; + s32 i; + ObjDhouseStruct1* ptr; + ObjDhouseStruct3* ptr3; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B12E7C.s") + for (i = 0, ptr = &this->unk_160[0], ptr3 = &D_80B13E90[0]; i < ARRAY_COUNT(this->unk_160); i++, ptr3++, ptr++) { + Math_Vec3f_Copy(&ptr->unk_00, &this->dyna.actor.world.pos); + Math_Vec3f_Copy(&ptr->unk_0C, &ptr3->unk_14); + ptr->unk_18 = this->dyna.actor.shape.rot; + ptr->unk_1E = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B13170.s") +void func_80B12B38(ObjDhouse* this2, GlobalContext* globalCtx) { + ObjDhouse* this = this2; + s32 i; + f32 temp_f0; + CollisionPoly* sp90; + s32 phi_s3; + Vec3f sp80; + s32 sp7C; + ObjDhouseStruct1* ptr; + ObjDhouseStruct3* ptr3; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B13474.s") + for (i = 0, ptr = &this->unk_160[0], ptr3 = &D_80B13E90[0]; i < ARRAY_COUNT(this->unk_160); i++, ptr3++, ptr++) { + if (ptr->unk_1E >= 0) { + if (ptr->unk_1E >= ptr3->unk_26) { + ptr->unk_0C.y -= 2.5f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B13724.s") + Math_Vec3f_Scale(&ptr->unk_0C, 0.96f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B13908.s") + ptr->unk_00.x += ptr->unk_0C.x; + ptr->unk_00.y += ptr->unk_0C.y; + ptr->unk_00.z += ptr->unk_0C.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B1391C.s") + ptr->unk_18.x += ptr3->unk_20.x; + ptr->unk_18.y += ptr3->unk_20.y; + ptr->unk_18.z += ptr3->unk_20.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B1392C.s") + if (ptr->unk_1E == ptr3->unk_26) { + func_80B12E7C(this, globalCtx, ptr, ptr3); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B13940.s") + phi_s3 = false; + if (ptr->unk_0C.y < 0.0f) { + func_80B12A50(ptr, ptr3, &sp80); + temp_f0 = BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &sp90, &sp7C, &this->dyna.actor, &sp80); + if (((sp80.y - 35.0f) < temp_f0) && (temp_f0 > (BGCHECK_Y_MIN + 1.0f))) { + phi_s3 = true; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B139D8.s") + if (phi_s3) { + ptr->unk_1E = -1; + func_80B13170(this, globalCtx, ptr, ptr3); + } else if (ptr->unk_1E > 60) { + ptr->unk_1E = -1; + } else { + ptr->unk_1E++; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B139F4.s") +s32 func_80B12D78(ObjDhouse* this) { + s32 i; + ObjDhouseStruct2* ptr2 = &this->unk_240[0]; + s32 count = 0; + ObjDhouseStruct2* ptr22 = &this->unk_240[1]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/ObjDhouse_Update.s") + for (i = 1; i < ARRAY_COUNT(this->unk_240); i++, ptr22++) { + if (ptr22->unk_28 < ptr2->unk_28) { + ptr2 = ptr22; + count = i; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/ObjDhouse_Draw.s") + return count; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B13C08.s") +void func_80B12E7C(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3) { + s32 i; + Vec3f spA0; + Vec3f sp94; + Vec3f sp88; + ObjDhouseStruct2* ptr2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Dhouse/func_80B13E40.s") + Matrix_RotateY(this->dyna.actor.shape.rot.y, MTXMODE_NEW); + Matrix_MultiplyVector3fXZByCurrentState(&D_80B13FC4, &sp94); + sp94.y = 100.0f; + func_80B12A50(ptr, ptr3, &spA0); + + for (i = 0; i < 15; i++) { + ptr2 = &this->unk_240[func_80B12D78(this)]; + + ptr2->unk_00.x = Rand_ZeroOne() - 0.5f; + ptr2->unk_00.y = Rand_ZeroOne(); + ptr2->unk_00.z = Rand_ZeroOne() - 0.5f; + + ptr2->unk_0C.x = ptr2->unk_00.x * 24.0f; + ptr2->unk_0C.y = ptr2->unk_00.y * 34.0f; + ptr2->unk_0C.z = ptr2->unk_00.z * 24.0f; + + ptr2->unk_00.x = (ptr2->unk_00.x * 140.0f) + spA0.x; + ptr2->unk_00.y = ((ptr2->unk_00.y - 0.2f) * 50.0f) + spA0.y; + ptr2->unk_00.z = (ptr2->unk_00.z * 140.0f) + spA0.z; + + ptr2->unk_18 = (Rand_ZeroOne() * 0.057f) + 0.003f; + + ptr2->unk_1C.x = (u32)Rand_Next() >> 0x10; + ptr2->unk_1C.y = (u32)Rand_Next() >> 0x10; + ptr2->unk_1C.z = (u32)Rand_Next() >> 0x10; + + ptr2->unk_22 = ((u32)Rand_Next() >> 0x11) - 0x3FFF; + ptr2->unk_24 = ((u32)Rand_Next() >> 0x13) - 0xFFF; + ptr2->unk_26 = ((u32)Rand_Next() >> 0x12) - 0x1FFF; + ptr2->unk_29 = 0; + ptr2->unk_28 = 40; + + if ((i % 2) != 0) { + sp88.x = ((Rand_ZeroOne() - 0.5f) * sp94.x) + ptr2->unk_00.x; + sp88.y = ((Rand_ZeroOne() - 0.3f) * sp94.y) + ptr2->unk_00.y; + sp88.z = ((Rand_ZeroOne() - 0.5f) * sp94.z) + ptr2->unk_00.z; + + func_800B1210(globalCtx, &sp88, &gZeroVec3f, &D_80B13FA8, (s32)(Rand_ZeroOne() * 130.0f) + 20, + (s32)(Rand_ZeroOne() * 140.0f) + 60); + } + } +} + +void func_80B13170(ObjDhouse* this, GlobalContext* globalCtx, ObjDhouseStruct1* ptr, ObjDhouseStruct3* ptr3) { + s32 i; + Vec3f sp98; + Vec3f sp8C; + ObjDhouseStruct2* ptr2; + + func_80B12A50(ptr, ptr3, &sp98); + + for (i = 0; i < 11; i++) { + ptr2 = &this->unk_240[func_80B12D78(this)]; + + ptr2->unk_00.x = Rand_ZeroOne() - 0.5f; + ptr2->unk_00.y = Rand_ZeroOne(); + ptr2->unk_00.z = Rand_ZeroOne() - 0.5f; + + ptr2->unk_0C.x = ptr2->unk_00.x * 23.0f; + ptr2->unk_0C.y = (ptr2->unk_00.y * 19.0f) + 5.0f; + ptr2->unk_0C.z = ptr2->unk_00.z * 23.0f; + + ptr2->unk_00.x = (ptr2->unk_00.x * 80.0f) + sp98.x; + ptr2->unk_00.y = (ptr2->unk_00.y * 23.0f) + sp98.y + 15.0f; + ptr2->unk_00.z = (ptr2->unk_00.z * 80.0f) + sp98.z; + + ptr2->unk_1C.x = (u32)Rand_Next() >> 0x10; + ptr2->unk_1C.y = (u32)Rand_Next() >> 0x10; + ptr2->unk_1C.z = (u32)Rand_Next() >> 0x10; + + ptr2->unk_22 = ((u32)Rand_Next() >> 0x12) - 0x1FFF; + ptr2->unk_24 = ((u32)Rand_Next() >> 0x13) - 0xFFF; + ptr2->unk_26 = ((u32)Rand_Next() >> 0x12) - 0x1FFF; + + ptr2->unk_28 = 40; + + if (i < 3) { + ptr2->unk_18 = (Rand_ZeroOne() * 0.06f) + 0.12f; + ptr2->unk_29 = 1; + } else { + ptr2->unk_18 = (Rand_ZeroOne() * 0.05f) + 0.003f; + ptr2->unk_29 = 0; + } + + if ((i % 2) != 0) { + sp8C.x = ((Rand_ZeroOne() - 0.5f) * 160.0f) + ptr2->unk_00.x; + sp8C.y = (Rand_ZeroOne() * 120.0f) + ptr2->unk_00.y; + sp8C.z = ((Rand_ZeroOne() - 0.5f) * 160.0f) + ptr2->unk_00.z; + + func_800B1210(globalCtx, &sp8C, &gZeroVec3f, &D_80B13FA8, (s32)(Rand_ZeroOne() * 140.0f) + 20, + (s32)(Rand_ZeroOne() * 140.0f) + 40); + } + } +} + +void func_80B13474(ObjDhouse* this, GlobalContext* globalCtx, Vec3f* arg2) { + s32 i; + Vec3f sp88; + ObjDhouseStruct2* ptr2; + + for (i = 0; i < 5; i++) { + ptr2 = &this->unk_240[func_80B12D78(this)]; + + ptr2->unk_00.x = Rand_ZeroOne() - 0.5f; + ptr2->unk_00.y = Rand_ZeroOne(); + ptr2->unk_00.z = Rand_ZeroOne() - 0.5f; + + ptr2->unk_0C.x = ptr2->unk_00.x * 18.0f; + ptr2->unk_0C.y = ptr2->unk_00.y * 23.0f; + ptr2->unk_0C.z = ptr2->unk_00.z * 18.0f; + + ptr2->unk_00.x = (ptr2->unk_00.x * 40.0f) + arg2->x; + ptr2->unk_00.y = ((ptr2->unk_00.y - 0.4f) * 20.0f) + arg2->y; + ptr2->unk_00.z = (ptr2->unk_00.z * 40.0f) + arg2->z; + + ptr2->unk_1C.x = (u32)Rand_Next() >> 0x10; + ptr2->unk_1C.y = (u32)Rand_Next() >> 0x10; + ptr2->unk_1C.z = (u32)Rand_Next() >> 0x10; + + ptr2->unk_22 = ((u32)Rand_Next() >> 0x12) - 0x1FFF; + ptr2->unk_24 = ((u32)Rand_Next() >> 0x13) - 0xFFF; + ptr2->unk_26 = ((u32)Rand_Next() >> 0x12) - 0x1FFF; + + ptr2->unk_28 = 40; + ptr2->unk_18 = (Rand_ZeroOne() * 0.07f) + 0.003f; + ptr2->unk_29 = 0; + + sp88.x = ((Rand_ZeroOne() * 70.0f) - 35.0f) + ptr2->unk_00.x; + sp88.y = (Rand_ZeroOne() * 60.0f) + ptr2->unk_00.y; + sp88.z = ((Rand_ZeroOne() * 70.0f) - 35.0f) + ptr2->unk_00.z; + + func_800B1210(globalCtx, &sp88, &gZeroVec3f, &D_80B13FA8, (s32)(Rand_ZeroOne() * 80.0f) + 20, + (s32)(Rand_ZeroOne() * 90.0f) + 40); + } +} + +void func_80B13724(ObjDhouse* this, GlobalContext* globalCtx) { + f32 temp_f0; + f32 temp_f20 = this->dyna.actor.home.pos.y - 300.0f; + s32 i; + CollisionPoly* sp80; + ObjDhouseStruct2* ptr2; + Vec3f sp70; + s32 sp6C; + + for (i = 0, ptr2 = &this->unk_240[0]; i < ARRAY_COUNT(this->unk_240); i++, ptr2++) { + if (ptr2->unk_28 > 0) { + ptr2->unk_0C.y -= 2.2f; + + Math_Vec3f_Scale(&ptr2->unk_0C, 0.95f); + + ptr2->unk_00.x += ptr2->unk_0C.x; + ptr2->unk_00.y += ptr2->unk_0C.y; + ptr2->unk_00.z += ptr2->unk_0C.z; + + if (ptr2->unk_00.y < temp_f20) { + ptr2->unk_28 = 0; + } else { + ptr2->unk_1C.x += ptr2->unk_22; + ptr2->unk_1C.y += ptr2->unk_24; + ptr2->unk_1C.z += ptr2->unk_26; + ptr2->unk_28--; + + if (ptr2->unk_29 & 1) { + temp_f0 = + BgCheck_EntityRaycastFloor5(&globalCtx->colCtx, &sp80, &sp6C, &this->dyna.actor, &ptr2->unk_00); + if (((ptr2->unk_00.y - 20.0f) < temp_f0) && (temp_f0 > BGCHECK_Y_MIN + 1.0f)) { + Math_Vec3f_Copy(&sp70, &ptr2->unk_00); + ptr2->unk_28 = 0; + func_80B13474(this, globalCtx, &sp70); + } + } + } + } + } +} + +void func_80B13908(ObjDhouse* this) { + this->actionFunc = func_80B1391C; +} + +void func_80B1391C(ObjDhouse* this, GlobalContext* globalCtx) { +} + +void func_80B1392C(ObjDhouse* this) { + this->actionFunc = func_80B13940; +} + +void func_80B13940(ObjDhouse* this, GlobalContext* globalCtx2) { + GlobalContext* globalCtx = globalCtx2; + s32 sp20 = false; + + if (Flags_GetSwitch(globalCtx, OBJDHOUSE_GET_7F(&this->dyna.actor))) { + sp20 = true; + Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_EXPLSION_LONG); + } + + if (sp20) { + func_80B12A88(&this->dyna.actor); + func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); + this->dyna.actor.draw = func_80B13C08; + this->dyna.actor.flags |= ACTOR_FLAG_20; + func_80B139D8(this); + } +} + +void func_80B139D8(ObjDhouse* this) { + this->unk_1370 = 120; + this->actionFunc = func_80B139F4; +} + +void func_80B139F4(ObjDhouse* this, GlobalContext* globalCtx) { + Camera* camera = GET_ACTIVE_CAM(globalCtx); + s16 quake; + + if (this->unk_1370 == 117) { + quake = Quake_Add(camera, 3); + Quake_SetSpeed(quake, 20000); + Quake_SetQuakeValues(quake, 8, 0, 0, 0); + Quake_SetCountdown(quake, 17); + } else if (this->unk_1370 == 105) { + quake = Quake_Add(camera, 3); + Quake_SetSpeed(quake, 20000); + Quake_SetQuakeValues(quake, 7, 0, 0, 0); + Quake_SetCountdown(quake, 20); + } else if (this->unk_1370 == 90) { + quake = Quake_Add(camera, 3); + Quake_SetSpeed(quake, 20000); + Quake_SetQuakeValues(quake, 5, 0, 0, 0); + Quake_SetCountdown(quake, 62); + } + + this->unk_1370--; + if (this->unk_1370 <= 0) { + this->dyna.actor.draw = func_80B13E40; + this->dyna.actor.flags &= ~ACTOR_FLAG_20; + this->dyna.actor.flags &= ~ACTOR_FLAG_10; + func_80B13908(this); + } else { + func_80B12B38(this, globalCtx); + func_80B13724(this, globalCtx); + } +} + +void ObjDhouse_Update(Actor* thisx, GlobalContext* globalCtx) { + ObjDhouse* this = THIS; + + this->actionFunc(this, globalCtx); +} + +void ObjDhouse_Draw(Actor* thisx, GlobalContext* globalCtx) { + Gfx_DrawDListOpa(globalCtx, object_dhouse_DL_005A78); +} + +void func_80B13C08(Actor* thisx, GlobalContext* globalCtx) { + ObjDhouse* this = THIS; + ObjDhouseStruct1* ptr; + ObjDhouseStruct2* ptr2; + ObjDhouseStruct3* ptr3; + s32 i; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_dhouse_DL_004928); + + for (i = 0, ptr = &this->unk_160[0], ptr3 = &D_80B13E90[0]; i < ARRAY_COUNT(this->unk_160); i++, ptr3++, ptr++) { + if (ptr->unk_1E >= 0) { + Matrix_SetStateRotationAndTranslation(ptr->unk_00.x + ptr3->unk_08.x, ptr->unk_00.y + ptr3->unk_08.y, + ptr->unk_00.z + ptr3->unk_08.z, &ptr->unk_18); + Matrix_InsertTranslation(-ptr3->unk_08.x, -ptr3->unk_08.y, -ptr3->unk_08.z, MTXMODE_APPLY); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, ptr3->unk_00); + gSPDisplayList(POLY_OPA_DISP++, ptr3->unk_04); + } + } + + for (i = 0, ptr2 = &this->unk_240[0]; i < ARRAY_COUNT(this->unk_240); i++, ptr2++) { + if (ptr2->unk_28 > 0) { + Matrix_SetStateRotationAndTranslation(ptr2->unk_00.x, ptr2->unk_00.y, ptr2->unk_00.z, &ptr2->unk_1C); + Matrix_Scale(ptr2->unk_18, ptr2->unk_18, ptr2->unk_18, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, object_dhouse_DL_0081D8); + } + } + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void func_80B13E40(Actor* thisx, GlobalContext* globalCtx) { + Gfx_DrawDListOpa(globalCtx, object_dhouse_DL_004928); +} diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h index 793aabfac1..053928c1c3 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.h @@ -7,11 +7,42 @@ struct ObjDhouse; typedef void (*ObjDhouseActionFunc)(struct ObjDhouse*, GlobalContext*); +#define OBJDHOUSE_GET_7F(thisx) ((thisx)->params & 0x7F) + +typedef struct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ Vec3f unk_0C; + /* 0x18 */ Vec3s unk_18; + /* 0x1E */ s8 unk_1E; +} ObjDhouseStruct1; // size = 0x20 + +typedef struct { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ Vec3f unk_0C; + /* 0x18 */ f32 unk_18; + /* 0x1C */ Vec3s unk_1C; + /* 0x22 */ s16 unk_22; + /* 0x24 */ s16 unk_24; + /* 0x26 */ s16 unk_26; + /* 0x28 */ s8 unk_28; + /* 0x29 */ u8 unk_29; +} ObjDhouseStruct2; // size = 0x2C + +typedef struct { + /* 0x00 */ Gfx* unk_00; + /* 0x04 */ Gfx* unk_04; + /* 0x08 */ Vec3f unk_08; + /* 0x14 */ Vec3f unk_14; + /* 0x20 */ Vec3s unk_20; + /* 0x26 */ s8 unk_26; +} ObjDhouseStruct3; // size = 0x28 + typedef struct ObjDhouse { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x18]; + /* 0x0000 */ DynaPolyActor dyna; /* 0x015C */ ObjDhouseActionFunc actionFunc; - /* 0x0160 */ char unk_160[0x1214]; + /* 0x0160 */ ObjDhouseStruct1 unk_160[7]; + /* 0x0240 */ ObjDhouseStruct2 unk_240[100]; + /* 0x1370 */ s16 unk_1370; } ObjDhouse; // size = 0x1374 extern const ActorInit Obj_Dhouse_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index d99d255b5c..72d74dc400 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -2160,13 +2160,6 @@ D_06001040 = 0x06001040; D_06000180 = 0x06000180; D_06000BA0 = 0x06000BA0; -// ovl_Obj_Dhouse - -D_06004928 = 0x06004928; -D_06005A78 = 0x06005A78; -D_06008040 = 0x06008040; -D_060081D8 = 0x060081D8; - // ovl_Obj_Dora D_06003FD0 = 0x06003FD0;