From f57e0467d2b3f6a1b2f0cf7be7fe84a2d1eb0cf2 Mon Sep 17 00:00:00 2001
From: Zelllll <56516451+Zelllll@users.noreply.github.com>
Date: Wed, 17 Feb 2021 13:42:59 -0600
Subject: [PATCH] Decompile object_syokudai and object_ydan_objects (#699)
* add deku and torch objects
* why git?
---
assets/xml/objects/object_syokudai.xml | 12 ++++++++
assets/xml/objects/object_ydan_objects.xml | 19 +++++++++++++
spec | 6 ++--
.../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c | 16 ++++-------
.../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c | 13 ++++-----
.../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c | 28 ++++++++++---------
.../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 3 +-
undefined_syms.txt | 24 ----------------
8 files changed, 63 insertions(+), 58 deletions(-)
create mode 100644 assets/xml/objects/object_syokudai.xml
create mode 100644 assets/xml/objects/object_ydan_objects.xml
diff --git a/assets/xml/objects/object_syokudai.xml b/assets/xml/objects/object_syokudai.xml
new file mode 100644
index 0000000000..77ca102d87
--- /dev/null
+++ b/assets/xml/objects/object_syokudai.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_ydan_objects.xml b/assets/xml/objects/object_ydan_objects.xml
new file mode 100644
index 0000000000..b17915747e
--- /dev/null
+++ b/assets/xml/objects/object_ydan_objects.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spec b/spec
index 69a5071cdd..fb6398ee23 100644
--- a/spec
+++ b/spec
@@ -3783,7 +3783,8 @@ endseg
beginseg
name "object_ydan_objects"
romalign 0x1000
- include "build/baserom/object_ydan_objects.o"
+ include "build/assets/objects/object_ydan_objects/object_ydan_objects.o"
+ number 6
endseg
beginseg
@@ -4369,7 +4370,8 @@ endseg
beginseg
name "object_syokudai"
romalign 0x1000
- include "build/baserom/object_syokudai.o"
+ include "build/assets/objects/object_syokudai/object_syokudai.o"
+ number 6
endseg
beginseg
diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c
index 5b3956e9f6..6a668808bf 100644
--- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c
+++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c
@@ -5,6 +5,7 @@
*/
#include "z_bg_ydan_hasi.h"
+#include "objects/object_ydan_objects/object_ydan_objects.h"
#define FLAGS 0x00000030
@@ -38,12 +39,6 @@ static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
-static Gfx* D_808BEC24[] = { 0x06007508, 0x06005DE0, 0x06005018 };
-
-extern CollisionHeader D_06005780;
-extern CollisionHeader D_06007798;
-extern Gfx* D_06005DE0[];
-
void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad1;
BgYdanHasi* this = THIS;
@@ -66,14 +61,14 @@ void BgYdanHasi_Init(Actor* thisx, GlobalContext* globalCtx) {
} else {
if (thisx->params == 0) {
// Moving platform on the water in B1
- CollisionHeader_GetVirtual(&D_06007798, &colHeader);
+ CollisionHeader_GetVirtual(&gDTSlidingPlatformCol, &colHeader);
thisx->scale.z = 0.15f;
thisx->scale.x = 0.15f;
thisx->world.pos.y = (waterBox->ySurface + 20.0f);
this->actionFunc = BgYdanHasi_UpdateFloatingBlock;
} else {
// 3 platforms on 2F
- CollisionHeader_GetVirtual(&D_06005780, &colHeader);
+ CollisionHeader_GetVirtual(&gDTRisingPlatformsCol, &colHeader);
thisx->draw = NULL;
this->actionFunc = BgYdanHasi_SetupThreeBlocks;
Actor_SetFocus(thisx, 40.0f);
@@ -189,10 +184,11 @@ void BgYdanHasi_Update(Actor* thisx, GlobalContext* globalCtx) {
}
void BgYdanHasi_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ static Gfx* dLists[] = { gDTSlidingPlatformDL, gDTWaterPlaneDL, gDTRisingPlatformsDL };
BgYdanHasi* this = THIS;
if (this->dyna.actor.params == 0 || this->dyna.actor.params == 2) {
- Gfx_DrawDListOpa(globalCtx, D_808BEC24[this->dyna.actor.params]);
+ Gfx_DrawDListOpa(globalCtx, dLists[this->dyna.actor.params]);
return;
}
@@ -205,7 +201,7 @@ void BgYdanHasi_Draw(Actor* thisx, GlobalContext* globalCtx) {
globalCtx->gameplayFrames & 0x7F, 0x20, 0x20));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 592),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, &D_06005DE0);
+ gSPDisplayList(POLY_XLU_DISP++, gDTWaterPlaneDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 597);
}
diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c
index 2a68d64177..9804c3f9f9 100644
--- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c
+++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c
@@ -1,10 +1,11 @@
/*
* File: z_bg_ydan_maruta.c
* Overlay: ovl_Bg_Ydan_Maruta
- * Description: Rotating spike log in Deku Tree
+ * Description: Rotating spike log and falling ladder in Deku Tree
*/
#include "z_bg_ydan_maruta.h"
+#include "objects/object_ydan_objects/object_ydan_objects.h"
#define FLAGS 0x00000000
@@ -75,10 +76,6 @@ static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
-extern CollisionHeader D_060066A8;
-extern Gfx D_06008D88[];
-extern Gfx D_06006570[];
-
void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgYdanMaruta* this = THIS;
@@ -102,7 +99,7 @@ void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) {
} else {
triInit = &sTrisElementsInit[1];
DynaPolyActor_Init(&this->dyna, DPM_UNK);
- CollisionHeader_GetVirtual(&D_060066A8, &colHeader);
+ CollisionHeader_GetVirtual(&gDTFallingLadderCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, thisx, colHeader);
thisx->home.pos.y += -280.0f;
if (Flags_GetSwitch(globalCtx, this->unk_168)) {
@@ -207,8 +204,8 @@ void BgYdanMaruta_Draw(Actor* thisx, GlobalContext* globalCtx) {
BgYdanMaruta* this = THIS;
if (this->dyna.actor.params == 0) {
- Gfx_DrawDListOpa(globalCtx, D_06008D88);
+ Gfx_DrawDListOpa(globalCtx, gDTRollingSpikeTrapDL);
} else {
- Gfx_DrawDListOpa(globalCtx, D_06006570);
+ Gfx_DrawDListOpa(globalCtx, gDTFallingLadderDL);
}
}
diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c
index c4c58532fe..c6d54d6c06 100644
--- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c
+++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c
@@ -1,4 +1,11 @@
+/*
+ * File: z_bg_ydan_sp.c
+ * Overlay: ovl_Bg_Ydan_Sp
+ * Description: Webs
+ */
+
#include "z_bg_ydan_sp.h"
+#include "objects/object_ydan_objects/object_ydan_objects.h"
#define FLAGS 0x00000000
@@ -14,12 +21,7 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx);
void BgYdanSp_BurnWallWeb(BgYdanSp* this, GlobalContext* globalCtx);
void BgYdanSp_WallWebIdle(BgYdanSp* this, GlobalContext* globalCtx);
-extern Gfx D_060061B0[];
-extern Gfx D_06003850[];
-extern Gfx D_06005F40[];
-
-extern CollisionHeader D_06006050;
-extern CollisionHeader D_06006460;
+extern CollisionHeader gDTWebWallCol;
typedef enum {
/* 0 */ WEB_FLOOR,
@@ -100,7 +102,7 @@ void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_InitTris(globalCtx, &this->trisCollider);
Collider_SetTris(globalCtx, &this->trisCollider, &this->dyna.actor, &sTrisInit, this->trisColliderItems);
if (this->dyna.actor.params == WEB_FLOOR) {
- CollisionHeader_GetVirtual(&D_06006460, &colHeader);
+ CollisionHeader_GetVirtual(&gDTWebFloorCol, &colHeader);
this->actionFunc = BgYdanSp_FloorWebIdle;
for (i = 0; i < 3; i++) {
@@ -115,7 +117,7 @@ void BgYdanSp_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_SetTrisVertices(&this->trisCollider, 1, &tri[0], &tri[2], &tri[1]);
this->unk16C = 0.0f;
} else {
- CollisionHeader_GetVirtual(&D_06006050, &colHeader);
+ CollisionHeader_GetVirtual(&gDTWebWallCol, &colHeader);
this->actionFunc = BgYdanSp_WallWebIdle;
Actor_SetFocus(&this->dyna.actor, 30.0f);
sinsY = Math_SinS(this->dyna.actor.shape.rot.y);
@@ -155,7 +157,7 @@ void* BgYdanSp_UpdateFloorWebCollision(BgYdanSp* this) {
s16 newY;
CollisionHeader* colHeader;
- colHeader = SEGMENTED_TO_VIRTUAL(&D_06006460);
+ colHeader = SEGMENTED_TO_VIRTUAL(&gDTWebFloorCol);
colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList);
newY = (this->dyna.actor.home.pos.y - this->dyna.actor.world.pos.y) * 10;
colHeader->vtxList[14].y = newY;
@@ -427,7 +429,7 @@ void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (thisx->params == WEB_WALL) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 787),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, D_06005F40);
+ gSPDisplayList(POLY_XLU_DISP++, gDTWebWallDL);
} else if (this->actionFunc == BgYdanSp_FloorWebBroken) {
Matrix_Get(&mtxF);
if (this->timer == 40) {
@@ -435,7 +437,7 @@ void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) {
Matrix_Scale(1.0f, ((thisx->home.pos.y - thisx->world.pos.y) + 10.0f) * 0.1f, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 808),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, D_060061B0);
+ gSPDisplayList(POLY_XLU_DISP++, gDTWebFloorDL);
}
for (i = 0; i < 8; i++) {
Matrix_Put(&mtxF);
@@ -444,14 +446,14 @@ void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) {
Matrix_Scale(3.5f, 5.0f, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 830),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, D_06003850);
+ gSPDisplayList(POLY_XLU_DISP++, gDTUnknownWebDL);
}
} else {
Matrix_Translate(0.0f, (thisx->home.pos.y - thisx->world.pos.y) * 10.0f, 0.0f, MTXMODE_APPLY);
Matrix_Scale(1.0f, ((thisx->home.pos.y - thisx->world.pos.y) + 10.0f) * 0.1f, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 849),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, D_060061B0);
+ gSPDisplayList(POLY_XLU_DISP++, gDTWebFloorDL);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 856);
diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c
index 490e88579f..141d15a4ce 100644
--- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c
+++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c
@@ -7,6 +7,7 @@
#include "z_obj_syokudai.h"
#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h"
#include "objects/gameplay_keep/gameplay_keep.h"
+#include "objects/object_syokudai/object_syokudai.h"
#define FLAGS 0x00000410
@@ -258,7 +259,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) {
}
void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) {
- static Gfx* displayLists[] = { 0x060003A0, 0x06000B90, 0x06000870 };
+ static Gfx* displayLists[] = { gGoldenTorchDL, gTimedTorchDL, gWoodenTorchDL };
s32 pad;
ObjSyokudai* this = THIS;
s32 timerMax;
diff --git a/undefined_syms.txt b/undefined_syms.txt
index 9c08302fbe..a0c359710a 100644
--- a/undefined_syms.txt
+++ b/undefined_syms.txt
@@ -262,16 +262,6 @@ D_060039D4 = 0x060039D4;
D_06003898 = 0x06003898;
D_0500A880 = 0x0500A880;
-// z_bg_ydan_hasi
-D_06005780 = 0x06005780;
-D_06007798 = 0x06007798;
-D_06005DE0 = 0x06005DE0;
-
-// z_bg_ydan_maruta
-D_060066A8 = 0x060066A8;
-D_06008D88 = 0x06008D88;
-D_06006570 = 0x06006570;
-
// z_en_mag
D_06000000 = 0x06000000;
D_06019A00 = 0x06019A00;
@@ -1705,13 +1695,6 @@ D_06007E20 = 0x06007E20;
D_06007EE0 = 0x06007EE0;
D_06008190 = 0x06008190;
-// z_bg_ydan_sp
-D_06003850 = 0x06003850;
-D_06005F40 = 0x06005F40;
-D_06006050 = 0x06006050;
-D_060061B0 = 0x060061B0;
-D_06006460 = 0x06006460;
-
// z_boss_dodongo
D_030021D8 = 0x030021D8;
D_06001074 = 0x06001074;
@@ -2737,10 +2720,3 @@ D_06000B30 = 0x06000B30;
D_060041A8 = 0x060041A8;
D_060009A0 = 0x060009A0;
D_06004404 = 0x06004404;
-
-// z_bg_ydan_sp
-D_06006050 = 0x06006050;
-D_06006460 = 0x06006460;
-D_060061B0 = 0x060061B0;
-D_06003850 = 0x06003850;
-D_06005F40 = 0x06005F40;