summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormzxrules <mzxrules@gmail.com>2021-04-25 19:36:43 -0400
committerGitHub <noreply@github.com>2021-04-25 19:36:43 -0400
commit1ac9479caeccca1b4f03436a0cd7c91ee58cd505 (patch)
tree2480749361341571c6b4ecbea637acfab39dc598 /src
parentb7849976cf90a79152f23ff897c3032ffcafa8de (diff)
z_bg_mizu_movebg and object_mizu_objects (#747)
* OK a few functions * BgMizuMovebg_Draw OK, make tweaks to bg_mizu_bwall * migrate data * create mizu_objects, defines for water temple water level * clean up some code * implement most suggestions * review * review2 * formatting Co-authored-by: Fig02 <fig02srl@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c2
-rw-r--r--src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c36
-rw-r--r--src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c372
-rw-r--r--src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h14
-rw-r--r--src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c11
-rw-r--r--src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c5
-rw-r--r--src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c60
-rw-r--r--src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h9
-rw-r--r--src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c5
-rw-r--r--src/overlays/actors/ovl_En_Door/z_en_door.c7
-rw-r--r--src/overlays/actors/ovl_En_Tp/z_en_tp.c2
11 files changed, 457 insertions, 66 deletions
diff --git a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c
index 81a806d74..9b3ca174e 100644
--- a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c
+++ b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c
@@ -39,7 +39,7 @@ const ActorInit Bg_Ice_Objects_InitVars = {
(ActorFunc)BgIceObjects_Draw,
};
-InitChainEntry sInitChain[] = {
+static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c
index cebddb99a..f13eb6877 100644
--- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c
+++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c
@@ -5,6 +5,8 @@
*/
#include "z_bg_mizu_bwall.h"
+#include "overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h"
+#include "objects/object_mizu_objects/object_mizu_objects.h"
#define FLAGS 0x00000010
@@ -148,10 +150,12 @@ static ColliderTrisInit sTrisInitStingerWall = {
};
static Gfx* sDLists[] = {
- 0x06001A30, 0x06002390, 0x06001CD0, 0x06002090, 0x06001770,
+ gObjectMizuObjectsBwallDL_001A30, gObjectMizuObjectsBwallDL_002390, gObjectMizuObjectsBwallDL_001CD0,
+ gObjectMizuObjectsBwallDL_002090, gObjectMizuObjectsBwallDL_001770,
};
static CollisionHeader* sColHeaders[] = {
- 0x06001C58, 0x060025A4, 0x06001DE8, 0x06001DE8, 0x06001DE8,
+ &gObjectMizuObjectsBwallCol_001C58, &gObjectMizuObjectsBwallCol_0025A4, &gObjectMizuObjectsBwallCol_001DE8,
+ &gObjectMizuObjectsBwallCol_001DE8, &gObjectMizuObjectsBwallCol_001DE8,
};
static InitChainEntry D_8089D854[] = {
@@ -378,34 +382,36 @@ void BgMizuBwall_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgMizuBwall_SetAlpha(BgMizuBwall* this, GlobalContext* globalCtx) {
f32 waterLevel = globalCtx->colCtx.colHeader->waterBoxes[2].ySurface;
- s32 alphaMod;
if (globalCtx->colCtx.colHeader->waterBoxes) {}
- if (waterLevel < -15.0f) {
+ if (waterLevel < WATER_TEMPLE_WATER_F1_Y) {
this->scrollAlpha1 = 255;
- } else if (waterLevel < 445.0f) {
- alphaMod = ((waterLevel - -15.0f) / (445.0f - -15.0f)) * 95.0f;
- this->scrollAlpha1 = 255 - alphaMod;
+ } else if (waterLevel < WATER_TEMPLE_WATER_F2_Y) {
+ this->scrollAlpha1 = 255 - (s32)((waterLevel - WATER_TEMPLE_WATER_F1_Y) /
+ (WATER_TEMPLE_WATER_F2_Y - WATER_TEMPLE_WATER_F1_Y) * (255 - 160));
} else {
this->scrollAlpha1 = 160;
}
- if (waterLevel < 445.0f) {
+
+ if (waterLevel < WATER_TEMPLE_WATER_F2_Y) {
this->scrollAlpha2 = 255;
- } else if (waterLevel < 765.0f) {
- alphaMod = ((waterLevel - 445.0f) / (765.0f - 445.0f)) * 95.0f;
- this->scrollAlpha2 = 255 - alphaMod;
+ } else if (waterLevel < WATER_TEMPLE_WATER_F3_Y) {
+ this->scrollAlpha2 = 255 - (s32)((waterLevel - WATER_TEMPLE_WATER_F2_Y) /
+ (WATER_TEMPLE_WATER_F3_Y - WATER_TEMPLE_WATER_F2_Y) * (255 - 160));
} else {
this->scrollAlpha2 = 160;
}
- if (waterLevel < -835.0f) {
+
+ if (waterLevel < WATER_TEMPLE_WATER_B1_Y) {
this->scrollAlpha3 = 255;
- } else if (waterLevel < -15.0f) {
- alphaMod = ((waterLevel - -835.0f) / (-15.0f - -835.0f)) * 95.0f;
- this->scrollAlpha3 = 255 - alphaMod;
+ } else if (waterLevel < WATER_TEMPLE_WATER_F1_Y) {
+ this->scrollAlpha3 = 255 - (s32)((waterLevel - WATER_TEMPLE_WATER_B1_Y) /
+ (WATER_TEMPLE_WATER_F1_Y - WATER_TEMPLE_WATER_B1_Y) * (255 - 160));
} else {
this->scrollAlpha3 = 160;
}
+
this->scrollAlpha4 = this->scrollAlpha3;
}
diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c
index d0dfd3355..c7cd5ec3f 100644
--- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c
+++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c
@@ -1,15 +1,32 @@
+/*
+ * File: z_bg_mizu_movebg.c
+ * Overlay: ovl_Bg_Mizu_Movebg
+ * Description: Kakariko Village Well Water
+ */
+
#include "z_bg_mizu_movebg.h"
+#include "overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h"
+#include "objects/object_mizu_objects/object_mizu_objects.h"
#define FLAGS 0x00000010
#define THIS ((BgMizuMovebg*)thisx)
+#define MOVEBG_TYPE(params) (((u16)(params) >> 0xC) & 0xF)
+#define MOVEBG_FLAGS(params) ((u16)(params)&0x3F)
+#define MOVEBG_PATH_ID(params) (((u16)(params) >> 0x8) & 0xF)
+#define MOVEBG_POINT_ID(params) ((u16)(params)&0xF)
+#define MOVEBG_SPEED(params) (((u16)(params) >> 0x4) & 0xF)
+
void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx);
void BgMizuMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgMizuMovebg_Update(Actor* thisx, GlobalContext* globalCtx);
void BgMizuMovebg_Draw(Actor* thisx, GlobalContext* globalCtx);
-/*
+void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx);
+void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx);
+s32 func_8089E108(Path* pathList, Vec3f* pos, s32 pathId, s32 pointId);
+
const ActorInit Bg_Mizu_Movebg_InitVars = {
ACTOR_BG_MIZU_MOVEBG,
ACTORCAT_BG,
@@ -21,21 +38,358 @@ const ActorInit Bg_Mizu_Movebg_InitVars = {
(ActorFunc)BgMizuMovebg_Update,
(ActorFunc)BgMizuMovebg_Draw,
};
-*/
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/func_8089DC30.s")
+static f32 D_8089EB40[] = { -115.200005f, -115.200005f, -115.200005f, 0.0f };
+
+static Gfx* D_8089EB50[] = {
+ gObjectMizuObjectsMovebgDL_000190, gObjectMizuObjectsMovebgDL_000680, gObjectMizuObjectsMovebgDL_000C20,
+ gObjectMizuObjectsMovebgDL_002E10, gObjectMizuObjectsMovebgDL_002E10, gObjectMizuObjectsMovebgDL_002E10,
+ gObjectMizuObjectsMovebgDL_002E10, gObjectMizuObjectsMovebgDL_0011F0,
+};
+
+static CollisionHeader* D_8089EB70[] = {
+ &gObjectMizuObjectsMovebgCol_0003F0, &gObjectMizuObjectsMovebgCol_000998, &gObjectMizuObjectsMovebgCol_000ED0,
+ &gObjectMizuObjectsMovebgCol_003590, &gObjectMizuObjectsMovebgCol_003590, &gObjectMizuObjectsMovebgCol_003590,
+ &gObjectMizuObjectsMovebgCol_003590, &gObjectMizuObjectsMovebgCol_0015F8,
+};
+
+static InitChainEntry D_8089EB90[] = {
+ ICHAIN_F32(uncullZoneScale, 1500, ICHAIN_CONTINUE),
+ ICHAIN_F32(uncullZoneDownward, 1100, ICHAIN_CONTINUE),
+ ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE),
+ ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
+};
+
+static Vec3f D_8089EBA0 = { 0.0f, 80.0f, 23.0f };
+static Vec3f D_8089EBAC = { 0.0f, 80.0f, 23.0f };
+
+static u8 D_8089EE40;
+
+s32 func_8089DC30(GlobalContext* globalCtx) {
+ s32 result;
+
+ if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG)) {
+ result = 1;
+ } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG)) {
+ result = 2;
+ } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG)) {
+ result = 3;
+ } else {
+ result = 1;
+ }
+ return result;
+}
+
+#ifdef NON_MATCHING
+// Codegen OK, Stack Issues
+void BgMizuMovebg_Init(Actor* thisx, GlobalContext* globalCtx) {
+ BgMizuMovebg* this = THIS;
+ WaterBox* waterBoxes;
+ CollisionHeader* colHeader;
+
+ waterBoxes = globalCtx->colCtx.colHeader->waterBoxes;
+ colHeader = NULL;
+
+ Actor_ProcessInitChain(&this->dyna.actor, D_8089EB90);
+ this->homeY = this->dyna.actor.world.pos.y;
+ this->dlist = D_8089EB50[MOVEBG_TYPE(this->dyna.actor.params)];
+ DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
+ CollisionHeader_GetVirtual(D_8089EB70[MOVEBG_TYPE(this->dyna.actor.params)], &colHeader);
+ this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
+
+ switch (MOVEBG_TYPE(this->dyna.actor.params)) {
+ case 0:
+ if (waterBoxes[2].ySurface + 15.0f < this->homeY - 700.0f) {
+ this->dyna.actor.world.pos.y = this->homeY - 700.0f;
+ } else {
+ this->dyna.actor.world.pos.y = waterBoxes[2].ySurface + 15.0f;
+ }
+ this->actionFunc = func_8089E318;
+ break;
+ case 1:
+ if (waterBoxes[2].ySurface + 15.0f < this->homeY - 710.0f) {
+ this->dyna.actor.world.pos.y = this->homeY - 710.0f;
+ } else {
+ this->dyna.actor.world.pos.y = waterBoxes[2].ySurface + 15.0f;
+ }
+ this->actionFunc = func_8089E318;
+ break;
+ case 2:
+ if (waterBoxes[2].ySurface + 15.0f < this->homeY - 700.0f) {
+ this->dyna.actor.world.pos.y = this->homeY - 700.0f;
+ } else {
+ this->dyna.actor.world.pos.y = waterBoxes[2].ySurface + 15.0f;
+ }
+ this->actionFunc = func_8089E318;
+ break;
+ case 3:
+ this->dyna.actor.world.pos.y = this->homeY + D_8089EB40[func_8089DC30(globalCtx)];
+ this->actionFunc = func_8089E318;
+ break;
+ case 4:
+ case 5:
+ case 6:
+ if (Flags_GetSwitch(globalCtx, MOVEBG_FLAGS(this->dyna.actor.params))) {
+ this->dyna.actor.world.pos.y = this->homeY + 115.2;
+ } else {
+ this->dyna.actor.world.pos.y = this->homeY;
+ }
+ this->actionFunc = func_8089E318;
+ break;
+ case 7:
+ this->scrollAlpha1 = 160;
+ this->scrollAlpha2 = 160;
+ this->scrollAlpha3 = 160;
+ this->scrollAlpha4 = 160;
+ this->waypointId = MOVEBG_POINT_ID(this->dyna.actor.params);
+ func_8089E108(globalCtx->setupPathList, &this->dyna.actor.world.pos,
+ MOVEBG_PATH_ID(this->dyna.actor.params), this->waypointId);
+ this->actionFunc = func_8089E650;
+ break;
+ }
+ switch (MOVEBG_TYPE(this->dyna.actor.params)) {
+ case 3:
+ case 4:
+ case 5:
+ case 6: {
+ Actor* actor;
+ Vec3f sp48;
+ Matrix_RotateY(this->dyna.actor.world.rot.y * (M_PI / 32768), MTXMODE_NEW);
+ Matrix_MultVec3f(&D_8089EBA0, &sp48);
+ actor = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_HSBLOCK,
+ this->dyna.actor.world.pos.x + sp48.x, this->dyna.actor.world.pos.y + sp48.y,
+ this->dyna.actor.world.pos.z + sp48.z, this->dyna.actor.world.rot.x,
+ this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, 2);
+ if (actor == NULL) {
+ Actor_Kill(&this->dyna.actor);
+ }
+ }
+ }
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/BgMizuMovebg_Init.s")
+#endif
+
+void BgMizuMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ BgMizuMovebg* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/BgMizuMovebg_Destroy.s")
+ DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
+ switch (MOVEBG_TYPE(thisx->params)) {
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ if (this->sfxFlags & 2) {
+ D_8089EE40 &= ~2;
+ }
+ break;
+ case 7:
+ if (this->sfxFlags & 1) {
+ D_8089EE40 &= ~1;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/func_8089E108.s")
+s32 func_8089E108(Path* pathList, Vec3f* pos, s32 pathId, s32 pointId) {
+ Path* path = pathList;
+ Vec3s* point;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/func_8089E198.s")
+ path += pathId;
+ point = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[pointId];
+ pos->x = point->x;
+ pos->y = point->y;
+ pos->z = point->z;
+
+ return 0;
+}
+
+void func_8089E198(BgMizuMovebg* this, GlobalContext* globalCtx) {
+ f32 waterLevel = globalCtx->colCtx.colHeader->waterBoxes[2].ySurface;
+
+ if (waterLevel < WATER_TEMPLE_WATER_F1_Y) {
+ this->scrollAlpha1 = 255;
+ } else if (waterLevel < WATER_TEMPLE_WATER_F2_Y) {
+ this->scrollAlpha1 = 255 - (s32)((waterLevel - WATER_TEMPLE_WATER_F1_Y) /
+ (WATER_TEMPLE_WATER_F2_Y - WATER_TEMPLE_WATER_F1_Y) * (255 - 160));
+ } else {
+ this->scrollAlpha1 = 160;
+ }
+
+ if (waterLevel < WATER_TEMPLE_WATER_F2_Y) {
+ this->scrollAlpha2 = 255;
+ } else if (waterLevel < WATER_TEMPLE_WATER_F3_Y) {
+ this->scrollAlpha2 = 255 - (s32)((waterLevel - WATER_TEMPLE_WATER_F2_Y) /
+ (WATER_TEMPLE_WATER_F3_Y - WATER_TEMPLE_WATER_F2_Y) * (255 - 160));
+ } else {
+ this->scrollAlpha2 = 160;
+ }
+
+ if (waterLevel < WATER_TEMPLE_WATER_B1_Y) {
+ this->scrollAlpha3 = 255;
+ } else if (waterLevel < WATER_TEMPLE_WATER_F1_Y) {
+ this->scrollAlpha3 = 255 - (s32)((waterLevel - WATER_TEMPLE_WATER_B1_Y) /
+ (WATER_TEMPLE_WATER_F1_Y - WATER_TEMPLE_WATER_B1_Y) * (255 - 160));
+ } else {
+ this->scrollAlpha3 = 160;
+ }
+
+ this->scrollAlpha4 = this->scrollAlpha3;
+}
+
+#ifdef NON_MATCHING
+void func_8089E318(BgMizuMovebg* this, GlobalContext* globalCtx) {
+ WaterBox* waterBoxes;
+ f32 phi_f0;
+ Vec3f sp28;
+
+ waterBoxes = globalCtx->colCtx.colHeader->waterBoxes;
+ func_8089E198(this, globalCtx);
+ switch (MOVEBG_TYPE(this->dyna.actor.params)) {
+ case 0:
+ case 2:
+ if (waterBoxes[2].ySurface + 15.0f < this->homeY - 700.0f) {
+ this->dyna.actor.world.pos.y = this->homeY - 700.0f;
+ } else {
+ this->dyna.actor.world.pos.y = waterBoxes[2].ySurface + 15.0f;
+ }
+ break;
+ case 1:
+ if (waterBoxes[2].ySurface + 15.0f < this->homeY - 710.0f) {
+ this->dyna.actor.world.pos.y = this->homeY - 710.0f;
+ } else {
+ this->dyna.actor.world.pos.y = waterBoxes[2].ySurface + 15.0f;
+ }
+ break;
+ case 3:
+ phi_f0 = this->homeY + D_8089EB40[func_8089DC30(globalCtx)];
+ if (!Math_StepToF(&this->dyna.actor.world.pos.y, phi_f0, 1.0f)) {
+ if (!(D_8089EE40 & 2) && MOVEBG_SPEED(this->dyna.actor.params) != 0) {
+ D_8089EE40 |= 2;
+ this->sfxFlags |= 2;
+ }
+ if (this->sfxFlags & 2) {
+ if (this->dyna.actor.room == 0) {
+ func_8002F974(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
+ } else {
+ func_8002F948(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
+ }
+ }
+ }
+ break;
+ case 4:
+ case 5:
+ case 6:
+ if (Flags_GetSwitch(globalCtx, MOVEBG_FLAGS(this->dyna.actor.params))) {
+ phi_f0 = this->homeY + 115.200005f;
+ } else {
+ phi_f0 = this->homeY;
+ }
+ if (!Math_StepToF(&this->dyna.actor.world.pos.y, phi_f0, 1.0f)) {
+ if (!(D_8089EE40 & 2) && MOVEBG_SPEED(this->dyna.actor.params) != 0) {
+ D_8089EE40 |= 2;
+ this->sfxFlags |= 2;
+ }
+ if (this->sfxFlags & 2) {
+ func_8002F948(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE - SFX_FLAG);
+ }
+ }
+ break;
+ }
+ switch (MOVEBG_TYPE(this->dyna.actor.params)) {
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ if (globalCtx->roomCtx.curRoom.num == this->dyna.actor.room) {
+ Matrix_RotateY(this->dyna.actor.world.rot.y * (M_PI / 32768), MTXMODE_NEW);
+ Matrix_MultVec3f(&D_8089EBAC, &sp28);
+ this->dyna.actor.child->world.pos.x = this->dyna.actor.world.pos.x + sp28.x;
+ this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + sp28.y;
+ this->dyna.actor.child->world.pos.z = this->dyna.actor.world.pos.z + sp28.z;
+ this->dyna.actor.child->flags &= ~1;
+ }
+ }
+}
+#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/func_8089E318.s")
+#endif
+
+void func_8089E650(BgMizuMovebg* this, GlobalContext* globalCtx) {
+ Vec3f waypoint;
+ f32 dist;
+ f32 dx;
+ f32 dy;
+ f32 dz;
+
+ this->dyna.actor.speedXZ = MOVEBG_SPEED(this->dyna.actor.params) * 0.1f;
+ func_8089E108(globalCtx->setupPathList, &waypoint, MOVEBG_PATH_ID(this->dyna.actor.params), this->waypointId);
+ dist = Actor_WorldDistXYZToPoint(&this->dyna.actor, &waypoint);
+ if (dist < this->dyna.actor.speedXZ) {
+ this->dyna.actor.speedXZ = dist;
+ }
+ func_80035844(&this->dyna.actor.world.pos, &waypoint, &this->dyna.actor.world.rot, 1);
+ func_8002D97C(&this->dyna.actor);
+ dx = waypoint.x - this->dyna.actor.world.pos.x;
+ dy = waypoint.y - this->dyna.actor.world.pos.y;
+ dz = waypoint.z - this->dyna.actor.world.pos.z;
+ if (fabsf(dx) < 2.0f && fabsf(dy) < 2.0f && fabsf(dz) < 2.0f) {
+ this->waypointId++;
+ if (this->waypointId >= globalCtx->setupPathList[MOVEBG_PATH_ID(this->dyna.actor.params)].count) {
+ this->waypointId = 0;
+ func_8089E108(globalCtx->setupPathList, &this->dyna.actor.world.pos,
+ MOVEBG_PATH_ID(this->dyna.actor.params), 0);
+ }
+ }
+ if (!(D_8089EE40 & 1) && MOVEBG_SPEED(this->dyna.actor.params) != 0) {
+ D_8089EE40 |= 1;
+ this->sfxFlags |= 1;
+ }
+ if (this->sfxFlags & 1) {
+ func_8002F948(&this->dyna.actor, NA_SE_EV_ROLL_STAND_2 - SFX_FLAG);
+ }
+}
+
+void BgMizuMovebg_Update(Actor* thisx, GlobalContext* globalCtx) {
+ BgMizuMovebg* this = THIS;
+
+ this->actionFunc(this, globalCtx);
+}
+
+void BgMizuMovebg_Draw(Actor* thisx, GlobalContext* globalCtx2) {
+ BgMizuMovebg* this = THIS;
+ GlobalContext* globalCtx = globalCtx2;
+ u32 frames;
+
+ if (1) {}
+
+ OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_movebg.c", 754);
+
+ frames = globalCtx->gameplayFrames;
+ func_80093D18(globalCtx->state.gfxCtx);
+
+ gSPSegment(POLY_OPA_DISP++, 0x08,
+ Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0,
+ this->scrollAlpha1));
+
+ gSPSegment(POLY_OPA_DISP++, 0x09,
+ Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0,
+ this->scrollAlpha2));
+
+ gSPSegment(POLY_OPA_DISP++, 0x0A,
+ Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0,
+ this->scrollAlpha3));
+
+ gSPSegment(POLY_OPA_DISP++, 0x0B,
+ Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, frames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0,
+ this->scrollAlpha4));
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/func_8089E650.s")
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mizu_movebg.c", 788),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/BgMizuMovebg_Update.s")
+ if (this->dlist != NULL) {
+ gSPDisplayList(POLY_OPA_DISP++, this->dlist);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/BgMizuMovebg_Draw.s")
+ CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_movebg.c", 795);
+}
diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h
index 319d21b97..73da59926 100644
--- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h
+++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h
@@ -6,9 +6,19 @@
struct BgMizuMovebg;
+typedef void (*BgMizuMovebgActionFunc)(struct BgMizuMovebg*, GlobalContext*);
+
typedef struct BgMizuMovebg {
- /* 0x0000 */ Actor actor;
- /* 0x014C */ char unk_14C[0x3C];
+ /* 0x0000 */ DynaPolyActor dyna;
+ /* 0x0164 */ BgMizuMovebgActionFunc actionFunc;
+ /* 0x0168 */ f32 homeY;
+ /* 0x016C */ s32 scrollAlpha1;
+ /* 0x0170 */ s32 scrollAlpha2;
+ /* 0x0174 */ s32 scrollAlpha3;
+ /* 0x0178 */ s32 scrollAlpha4;
+ /* 0x017C */ u8 sfxFlags;
+ /* 0x0180 */ Gfx* dlist;
+ /* 0x0184 */ s32 waypointId;
} BgMizuMovebg; // size = 0x0188
extern const ActorInit Bg_Mizu_Movebg_InitVars;
diff --git a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c
index 13b73eb51..ca51a07e5 100644
--- a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c
+++ b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c
@@ -1,4 +1,5 @@
#include "z_bg_mizu_shutter.h"
+#include "objects/object_mizu_objects/object_mizu_objects.h"
#define FLAGS 0x00000010
@@ -29,12 +30,18 @@ const ActorInit Bg_Mizu_Shutter_InitVars = {
(ActorFunc)BgMizuShutter_Draw,
};
-static Gfx* sDisplayLists[] = { 0x06007130, 0x060072D0 };
-static CollisionHeader* sCollisionHeaders[] = { 0x06007250, 0x060073F0 };
+static Gfx* sDisplayLists[] = { gObjectMizuObjectsShutterDL_007130, gObjectMizuObjectsShutterDL_0072D0 };
+
+static CollisionHeader* sCollisionHeaders[] = {
+ &gObjectMizuObjectsShutterCol_007250,
+ &gObjectMizuObjectsShutterCol_0073F0,
+};
+
static Vec3f sDisplacements[] = {
{ 0.0f, 100.0f, 0.0f },
{ 0.0f, 140.0f, 0.0f },
};
+
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneScale, 1500, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 1100, ICHAIN_CONTINUE),
diff --git a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c
index 685722bbf..dd9854222 100644
--- a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c
+++ b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c
@@ -5,6 +5,7 @@
*/
#include "z_bg_mizu_uzu.h"
+#include "objects/object_mizu_objects/object_mizu_objects.h"
#define FLAGS 0x00000000
@@ -35,8 +36,6 @@ static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
-extern CollisionHeader D_060074EC;
-
void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgMizuUzu* this = THIS;
@@ -45,7 +44,7 @@ void BgMizuUzu_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK);
- CollisionHeader_GetVirtual(&D_060074EC, &colHeader);
+ CollisionHeader_GetVirtual(&gObjectMizuObjectsUzuCol_0074EC, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->actionFunc = func_8089F788;
}
diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c
index 367ddfd28..cae79ecb0 100644
--- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c
+++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c
@@ -5,6 +5,7 @@
*/
#include "z_bg_mizu_water.h"
+#include "objects/object_mizu_objects/object_mizu_objects.h"
#define FLAGS 0x00000030
@@ -18,8 +19,6 @@ void BgMizuWater_Draw(Actor* thisx, GlobalContext* globalCtx);
void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx);
void BgMizuWater_ChangeWaterLevel(BgMizuWater* this, GlobalContext* globalCtx);
-extern Gfx D_06004B20[];
-
typedef struct {
s32 switchFlag;
s32 yDiff;
@@ -27,9 +26,9 @@ typedef struct {
static WaterLevel sWaterLevels[] = {
{ 0x00, 0 },
- { 0x1E, 0 },
- { 0x1D, -320 },
- { 0x1C, -780 },
+ { WATER_TEMPLE_WATER_F3_FLAG, 0 },
+ { WATER_TEMPLE_WATER_F2_FLAG, WATER_TEMPLE_WATER_F2_Y - WATER_TEMPLE_WATER_F3_Y },
+ { WATER_TEMPLE_WATER_F1_FLAG, WATER_TEMPLE_WATER_F1_Y - WATER_TEMPLE_WATER_F3_Y },
};
const ActorInit Bg_Mizu_Water_InitVars = {
@@ -59,22 +58,22 @@ u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, GlobalContext* globalCt
if (bREG(0) != 0) {
switch (bREG(1)) {
case 0:
- Flags_SetSwitch(globalCtx, 0x1C);
+ Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG);
break;
case 1:
- Flags_SetSwitch(globalCtx, 0x1D);
+ Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG);
break;
case 2:
- Flags_SetSwitch(globalCtx, 0x1E);
+ Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG);
break;
}
bREG(0) = 0;
}
- if (Flags_GetSwitch(globalCtx, 0x1C) && (switchFlag != 0x1C)) {
+ if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F1_FLAG)) {
ret = 3;
- } else if (Flags_GetSwitch(globalCtx, 0x1D) && (switchFlag != 0x1D)) {
+ } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F2_FLAG)) {
ret = 2;
- } else if (Flags_GetSwitch(globalCtx, 0x1E) && (switchFlag != 0x1E)) {
+ } else if (Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F3_FLAG)) {
ret = 1;
} else {
ret = 0;
@@ -108,27 +107,28 @@ void BgMizuWater_Init(Actor* thisx, GlobalContext* globalCtx) {
switch (this->type) {
case 0:
if (bREG(15) == 0) {
- osSyncPrintf("<コンストラクト>%x %x %x\n", Flags_GetSwitch(globalCtx, 0x1C),
- Flags_GetSwitch(globalCtx, 0x1D), Flags_GetSwitch(globalCtx, 0x1E));
+ osSyncPrintf("<コンストラクト>%x %x %x\n", Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG),
+ Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG),
+ Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG));
}
waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(-1, globalCtx);
this->actor.world.pos.y = sWaterLevels[waterLevelActionIndex].yDiff + this->baseY;
BgMizuWater_SetWaterBoxesHeight(waterBoxes, this->actor.world.pos.y);
this->actor.params = sWaterLevels[waterLevelActionIndex].switchFlag;
- Flags_UnsetSwitch(globalCtx, 0x1C);
- Flags_UnsetSwitch(globalCtx, 0x1D);
- Flags_UnsetSwitch(globalCtx, 0x1E);
+ Flags_UnsetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG);
+ Flags_UnsetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG);
+ Flags_UnsetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG);
switch (this->actor.params) {
case 0x1E:
- Flags_SetSwitch(globalCtx, 0x1E);
+ Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG);
break;
case 0x1D:
- Flags_SetSwitch(globalCtx, 0x1D);
+ Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG);
break;
case 0x1C:
default:
- Flags_SetSwitch(globalCtx, 0x1C);
+ Flags_SetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG);
break;
}
this->targetY = this->actor.world.pos.y;
@@ -300,23 +300,25 @@ void BgMizuWater_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
if (bREG(15) == 0) {
- osSyncPrintf("%x %x %x\n", Flags_GetSwitch(globalCtx, 0x1C), Flags_GetSwitch(globalCtx, 0x1D),
- Flags_GetSwitch(globalCtx, 0x1E));
+ osSyncPrintf("%x %x %x\n", Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F1_FLAG),
+ Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F2_FLAG),
+ Flags_GetSwitch(globalCtx, WATER_TEMPLE_WATER_F3_FLAG));
}
-
if (this->type == 0) {
posY = this->actor.world.pos.y;
unk0 = 0;
unk1 = 0;
- if (posY < -15.0f) {
+ if (posY < WATER_TEMPLE_WATER_F1_Y) {
unk0 = 0;
- unk1 = ((posY - -835.0f) / 820.0f) * 200.0f;
- } else if (posY < 445.0f) {
+ unk1 = (posY - WATER_TEMPLE_WATER_B1_Y) / (WATER_TEMPLE_WATER_F1_Y - WATER_TEMPLE_WATER_B1_Y) * 200;
+ } else if (posY < WATER_TEMPLE_WATER_F2_Y) {
unk0 = 1;
- unk1 = 0xFF - (s32)(((posY - -15.0f) / 460.0f) * 95.0f);
- } else if (posY <= 765.0f) {
+ unk1 = 255 - (s32)((posY - WATER_TEMPLE_WATER_F1_Y) / (WATER_TEMPLE_WATER_F2_Y - WATER_TEMPLE_WATER_F1_Y) *
+ (255 - 160));
+ } else if (posY <= WATER_TEMPLE_WATER_F3_Y) {
unk0 = 2;
- unk1 = 0xFF - (s32)(((posY - 445.0f) / 320.0f) * 95.0f);
+ unk1 = 255 - (s32)((posY - WATER_TEMPLE_WATER_F2_Y) / (WATER_TEMPLE_WATER_F3_Y - WATER_TEMPLE_WATER_F2_Y) *
+ (255 - 160));
}
globalCtx->unk_11D30[1] = ((u8)unk0 << 8) | (unk1 & 0xFF);
}
@@ -343,7 +345,7 @@ void BgMizuWater_Draw(Actor* thisx, GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 102);
- gSPDisplayList(POLY_XLU_DISP++, D_06004B20);
+ gSPDisplayList(POLY_XLU_DISP++, gObjectMizuObjectsWaterDL_004B20);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mizu_water.c", 756);
}
diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h
index 628dd9ace..44c0edb4e 100644
--- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h
+++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h
@@ -19,4 +19,13 @@ typedef struct BgMizuWater {
extern const ActorInit Bg_Mizu_Water_InitVars;
+#define WATER_TEMPLE_WATER_F3_Y 765.0f
+#define WATER_TEMPLE_WATER_F2_Y 445.0f
+#define WATER_TEMPLE_WATER_F1_Y -15.0f
+#define WATER_TEMPLE_WATER_B1_Y -835.0f
+
+#define WATER_TEMPLE_WATER_F3_FLAG 0x1E
+#define WATER_TEMPLE_WATER_F2_FLAG 0x1D
+#define WATER_TEMPLE_WATER_F1_FLAG 0x1C
+
#endif
diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
index 249969537..4e1278825 100644
--- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
+++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
@@ -11,6 +11,7 @@
#include "objects/object_goma/object_goma.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_hidan_objects/object_hidan_objects.h"
+#include "objects/object_mizu_objects/object_mizu_objects.h"
#define FLAGS 0x00000010
@@ -97,8 +98,8 @@ static ShutterInfo D_80998134[] = {
{ gFireTempleDoorFrontDL, gDoorMetalBarsDL, 130, 12, 20, 15 },
{ gFireTempleDoorBackDL, gDoorMetalBarsDL, 130, 12, 20, 15 },
{ 0x060000C0, gDoorMetalBarsDL, 130, 12, 20, 15 },
- { 0x06005D90, gDoorMetalBarsDL, 130, 12, 20, 15 },
- { 0x06007000, gDoorMetalBarsDL, 130, 12, 20, 15 },
+ { gObjectMizuObjectsDoorShutterDL_005D90, gDoorMetalBarsDL, 130, 12, 20, 15 },
+ { gObjectMizuObjectsDoorShutterDL_007000, gDoorMetalBarsDL, 130, 12, 20, 15 },
{ 0x06002620, gDoorMetalBarsDL, 130, 12, 20, 15 },
{ 0x06003890, gDoorMetalBarsDL, 130, 12, 20, 15 },
{ 0x06001D10, gDoorMetalBarsDL, 130, 12, 20, 15 },
diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c
index 426d9d8d1..1bd7aa119 100644
--- a/src/overlays/actors/ovl_En_Door/z_en_door.c
+++ b/src/overlays/actors/ovl_En_Door/z_en_door.c
@@ -7,6 +7,7 @@
#include "z_en_door.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_hidan_objects/object_hidan_objects.h"
+#include "objects/object_mizu_objects/object_mizu_objects.h"
#define FLAGS 0x00000010
@@ -68,8 +69,10 @@ static u8 sDoorAnimOpenFrames[] = { 25, 25, 25, 25 };
static u8 sDoorAnimCloseFrames[] = { 60, 70, 60, 70 };
static Gfx* D_809FCEE4[5][2] = {
- { gDoorLeftDL, gDoorRightDL }, { gFireTempleDoorWithHandleFrontDL, gFireTempleDoorWithHandleBackDL },
- { 0x06004958, 0x06004A10 }, { 0x060013B8, 0x06001420 },
+ { gDoorLeftDL, gDoorRightDL },
+ { gFireTempleDoorWithHandleFrontDL, gFireTempleDoorWithHandleBackDL },
+ { gWaterTempleDoorLeftDL, gWaterTempleDoorRightDL },
+ { 0x060013B8, 0x06001420 },
{ 0x050047A0, 0x05004978 },
};
diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c
index a5973b83f..bcc9652ca 100644
--- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c
+++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c
@@ -164,7 +164,7 @@ void EnTp_Init(Actor* thisx, GlobalContext* globalCtx2) {
for (i = 0; i <= 6; i++) {
temp_s4 = 0;
-
+
next = (EnTp*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TP, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, temp_s4);