summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2023-01-14 07:18:13 -0800
committerGitHub <noreply@github.com>2023-01-14 12:18:13 -0300
commitab8d34b8dc2ccd28ae4224d8500decff0fa25a1c (patch)
tree6cc53d451407b073e7c53349a2564a8062887312 /src
parente2b61f88e46efc994db334ac5f03e1174de67058 (diff)
Play (2 NON_MATCHINGS) (#1109)
* Bring over progress from another branch Co-authored-by: Maide <34639600+Kelebek1@users.noreply.github.com> * cleanup, fake match Play_Init * small fixes * Some small cleanup * Match func_80165460 (from debug) * Match func_80165658 * Match func_80165DB8, func_80165DCC, func_80165DF0, func_80165E04 * Match func_80167DE4 (from debug) * Match func_80167F0C * Match func_80168DAC * Matched func_80169100 * Matched func_801691F0 * import D_801DFA18 * match Play_Main thanks to debug * cleanup * synray does it again * add docs from debug * fix func_801656A4 * more docs and cleanup * Match func_80166B30 and diff fake match in Init * import transition docs from OoT * Play Update, sort of * cleanup Play_Update * more cleanup * slightly more docs * small docs * Play_Draw WIP Thanks @petrie911 * progress? * two more matches * format * misc play docs * transitions cleanup * Motion Blur * Transitions * Fog * Bombers notebook + small cleanup * bss * Camera Functions * Picto functions * Init * MotionBlur Clean up * Floor Surface * Pictographs some more * regs * fix circular dependency problem * Cleanup PR commits outside play * namefixer * PR picto * PR audio * PR small clean ups * debug strings * Picto defines * bss * enums * remove void * typedefs * Hireso -> BombersNotebook * bss comments * bss and I8/I5 functions * Smaller PR comments * Transitions * Combine enums * Revert "Combine enums" This reverts commit 0da1ebcaed69a3ce0fbd5942460b67f80f0e15e7. * Fix Transition defines * RGBA16 macros * Unname * worldCoverAlpha * Rename Update and Draw * PR review, plus annotate bug * Clean up nonmatchings with a closer DrawGame * Format * New macros * UpdateMain and DrawMain * Fix merge * Small cleanups from PR * zFar * Intensity macros * Format * Remove bss comments * Compression/decompression * Small cleanup * Format * More PR cleanup * Cleanup picto stuff * format * Fix compression comments * Play processes state enums DONE -> READY * cutscene comment * fix bss Co-authored-by: Maide <34639600+Kelebek1@users.noreply.github.com> Co-authored-by: engineer124 <engineer124engineer124@gmail.com> Co-authored-by: petrie911 <pmontag@PHYS-S129.iowa.uiowa.edu> Co-authored-by: angie <angheloalf95@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/boot_O2_g3/boot_main.c1
-rw-r--r--src/boot_O2_g3/idle.c1
-rw-r--r--src/code/graph.c10
-rw-r--r--src/code/z_actor.c14
-rw-r--r--src/code/z_construct.c3
-rw-r--r--src/code/z_demo.c50
-rw-r--r--src/code/z_draw.c2
-rw-r--r--src/code/z_eff_ss_dead.c4
-rw-r--r--src/code/z_en_item00.c2
-rw-r--r--src/code/z_fbdemo.c6
-rw-r--r--src/code/z_game_over.c2
-rw-r--r--src/code/z_kaleido_scope_call.c4
-rw-r--r--src/code/z_kankyo.c16
-rw-r--r--src/code/z_lights.c14
-rw-r--r--src/code/z_message.c4
-rw-r--r--src/code/z_parameter.c2
-rw-r--r--src/code/z_play.c1863
-rw-r--r--src/code/z_play_hireso.c8
-rw-r--r--src/code/z_player_lib.c2
-rw-r--r--src/code/z_quake.c6
-rw-r--r--src/code/z_rcp.c12
-rw-r--r--src/code/z_scene.c6
-rw-r--r--src/code/z_scene_proc.c2
-rw-r--r--src/code/z_scene_table.c4
-rw-r--r--src/code/z_snap.c28
-rw-r--r--src/code/z_vr_box.c4
-rw-r--r--src/code/z_vr_box_draw.c2
-rw-r--r--src/libultra/flash/osFlash.c1
-rw-r--r--src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c2
-rw-r--r--src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c1
-rw-r--r--src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c2
-rw-r--r--src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c4
-rw-r--r--src/overlays/actors/ovl_Boss_02/z_boss_02.c14
-rw-r--r--src/overlays/actors/ovl_Boss_03/z_boss_03.c19
-rw-r--r--src/overlays/actors/ovl_Boss_04/z_boss_04.c6
-rw-r--r--src/overlays/actors/ovl_Boss_06/z_boss_06.c4
-rw-r--r--src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c14
-rw-r--r--src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c8
-rw-r--r--src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c36
-rw-r--r--src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c2
-rw-r--r--src/overlays/actors/ovl_En_Az/z_en_az.c10
-rw-r--r--src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c2
-rw-r--r--src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c2
-rw-r--r--src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c2
-rw-r--r--src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c2
-rw-r--r--src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c4
-rw-r--r--src/overlays/actors/ovl_En_Dnq/z_en_dnq.c2
-rw-r--r--src/overlays/actors/ovl_En_Dns/z_en_dns.c4
-rw-r--r--src/overlays/actors/ovl_En_Egol/z_en_egol.c2
-rw-r--r--src/overlays/actors/ovl_En_Fall/z_en_fall.c6
-rw-r--r--src/overlays/actors/ovl_En_Fishing/z_en_fishing.c5
-rw-r--r--src/overlays/actors/ovl_En_Fu/z_en_fu.c2
-rw-r--r--src/overlays/actors/ovl_En_Ge1/z_en_ge1.c4
-rw-r--r--src/overlays/actors/ovl_En_Gk/z_en_gk.c4
-rw-r--r--src/overlays/actors/ovl_En_Gs/z_en_gs.c10
-rw-r--r--src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c8
-rw-r--r--src/overlays/actors/ovl_En_In/z_en_in.c4
-rw-r--r--src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c2
-rw-r--r--src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c2
-rw-r--r--src/overlays/actors/ovl_En_Js/z_en_js.c4
-rw-r--r--src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c4
-rw-r--r--src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c4
-rw-r--r--src/overlays/actors/ovl_En_Kusa/z_en_kusa.c1
-rw-r--r--src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c1
-rw-r--r--src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c8
-rw-r--r--src/overlays/actors/ovl_En_Ma4/z_en_ma4.c8
-rw-r--r--src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c2
-rw-r--r--src/overlays/actors/ovl_En_Mag/z_en_mag.c2
-rw-r--r--src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c12
-rw-r--r--src/overlays/actors/ovl_En_Nb/z_en_nb.c28
-rw-r--r--src/overlays/actors/ovl_En_Ot/z_en_ot.c2
-rw-r--r--src/overlays/actors/ovl_En_Pamera/z_en_pamera.c2
-rw-r--r--src/overlays/actors/ovl_En_Shn/z_en_shn.c8
-rw-r--r--src/overlays/actors/ovl_En_Ssh/z_en_ssh.c2
-rw-r--r--src/overlays/actors/ovl_En_Sw/z_en_sw.c2
-rw-r--r--src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c2
-rw-r--r--src/overlays/actors/ovl_En_Test3/z_en_test3.c2
-rw-r--r--src/overlays/actors/ovl_En_Test4/z_en_test4.c8
-rw-r--r--src/overlays/actors/ovl_En_Test6/z_en_test6.c56
-rw-r--r--src/overlays/actors/ovl_En_Test7/z_en_test7.c10
-rw-r--r--src/overlays/actors/ovl_En_Tg/z_en_tg.c2
-rw-r--r--src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c4
-rw-r--r--src/overlays/actors/ovl_En_Tsn/z_en_tsn.c4
-rw-r--r--src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c12
-rw-r--r--src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c2
-rw-r--r--src/overlays/actors/ovl_En_Zob/z_en_zob.c2
-rw-r--r--src/overlays/actors/ovl_En_Zod/z_en_zod.c4
-rw-r--r--src/overlays/actors/ovl_En_Zos/z_en_zos.c2
-rw-r--r--src/overlays/actors/ovl_En_Zot/z_en_zot.c4
-rw-r--r--src/overlays/actors/ovl_En_Zov/z_en_zov.c8
-rw-r--r--src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c6
-rw-r--r--src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c2
-rw-r--r--src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c6
-rw-r--r--src/overlays/actors/ovl_Obj_Um/z_obj_um.c12
-rw-r--r--src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c6
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c2
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c1
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h3
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c1
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h5
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c1
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h5
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c1
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h5
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c1
-rw-r--r--src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h3
-rw-r--r--src/overlays/gamestates/ovl_select/z_select.c2
-rw-r--r--src/overlays/gamestates/ovl_title/z_title.c2
-rw-r--r--src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h2
-rw-r--r--src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c4
110 files changed, 2166 insertions, 378 deletions
diff --git a/src/boot_O2_g3/boot_main.c b/src/boot_O2_g3/boot_main.c
index 04bb9a33a..87bee5da4 100644
--- a/src/boot_O2_g3/boot_main.c
+++ b/src/boot_O2_g3/boot_main.c
@@ -1,3 +1,4 @@
+#include "prevent_bss_reordering.h"
#include "global.h"
StackEntry sBootThreadInfo;
diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c
index 942435fa7..da93f13fd 100644
--- a/src/boot_O2_g3/idle.c
+++ b/src/boot_O2_g3/idle.c
@@ -1,3 +1,4 @@
+#include "prevent_bss_reordering.h"
#include "global.h"
u8 D_80096B20 = 1;
diff --git a/src/code/graph.c b/src/code/graph.c
index 8edc979d4..1c29029b0 100644
--- a/src/code/graph.c
+++ b/src/code/graph.c
@@ -50,7 +50,7 @@ void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
gfxCtx->workBuffer = pool->workBuffer;
gfxCtx->debugBuffer = pool->debugBuffer;
- gfxCtx->curFrameBuffer = (u16*)SysCfb_GetFbPtr(gfxCtx->framebufferIdx % 2);
+ gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->framebufferIndex % 2);
gSegments[0x0F] = gfxCtx->curFrameBuffer;
gfxCtx->zbuffer = SysCfb_GetZBuffer();
@@ -116,7 +116,7 @@ void* Graph_FaultAddrConvFunc(void* address, void* param) {
void Graph_Init(GraphicsContext* gfxCtx) {
bzero(gfxCtx, sizeof(GraphicsContext));
gfxCtx->gfxPoolIdx = 0;
- gfxCtx->framebufferIdx = 0;
+ gfxCtx->framebufferIndex = 0;
gfxCtx->viMode = NULL;
gfxCtx->viConfigFeatures = gViConfigFeatures;
gfxCtx->xScale = gViConfigXScale;
@@ -165,7 +165,7 @@ retry:
gfxCtx->masterList = gGfxMasterDL;
if (gfxCtx->callback != NULL) {
- gfxCtx->callback(gfxCtx, gfxCtx->callbackParam);
+ gfxCtx->callback(gfxCtx, gfxCtx->callbackArg);
}
task->type = M_GFXTASK;
@@ -191,7 +191,7 @@ retry:
if (SREG(33) & 1) {
SREG(33) &= ~1;
scTask->flags &= ~OS_SC_SWAPBUFFER;
- gfxCtx->framebufferIdx--;
+ gfxCtx->framebufferIndex--;
}
scTask->msgQ = &gfxCtx->queue;
@@ -305,7 +305,7 @@ void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
if (!problem) {
Graph_TaskSet00(gfxCtx, gameState);
gfxCtx->gfxPoolIdx++;
- gfxCtx->framebufferIdx++;
+ gfxCtx->framebufferIndex++;
}
{
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 919752d74..dcc5c0219 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -224,7 +224,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) {
for (i = 0; i < ARRAY_COUNT(floorHeight); i++, spB8 >>= 1) {
feetPosPtr->y += 50.0f;
- *floorHeightPtr = func_80169100(play, &sp13C, &spF8, &bgId, feetPosPtr);
+ *floorHeightPtr = Play_GetFloorSurfaceImpl(play, &sp13C, &spF8, &bgId, feetPosPtr);
feetPosPtr->y -= 50.0f;
distToFloor = feetPosPtr->y - *floorHeightPtr;
@@ -2442,7 +2442,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
params.player = player;
params.play = play;
- if (play->unk_18844 != 0) {
+ if (play->unk_18844) {
params.unk_18 = ACTOR_FLAG_200000;
} else {
params.unk_18 = ACTOR_FLAG_200000 | ACTOR_FLAG_40 | ACTOR_FLAG_10;
@@ -2698,7 +2698,7 @@ void Actor_DrawLensActors(PlayState* play, s32 numInvisibleActors, Actor** invis
spAC = tmp;
Actor_DrawLensOverlay(&spAC, play->actorCtx.lensMaskSize);
- tmp = func_801660B8(play, spAC);
+ tmp = Play_SetFog(play, spAC);
for (spB4 = 0, invisibleActor = invisibleActors; spB4 < numInvisibleActors; spB4++, invisibleActor++) {
POLY_XLU_DISP = tmp;
@@ -2779,9 +2779,9 @@ s32 func_800BA2FC(PlayState* play, Actor* actor, Vec3f* projectedPos, f32 projec
f32 phi_f16;
if (play->view.fovy != 60.0f) {
- phi_f12 = actor->uncullZoneScale * play->unk_187F0.x * 0.76980036f; // sqrt(16/27)
+ phi_f12 = actor->uncullZoneScale * play->projectionMtxFDiagonal.x * 0.76980036f; // sqrt(16/27)
- phi_f14 = play->unk_187F0.y * 0.57735026f; // 1 / sqrt(3)
+ phi_f14 = play->projectionMtxFDiagonal.y * 0.57735026f; // 1 / sqrt(3)
phi_f16 = actor->uncullZoneScale * phi_f14;
phi_f14 *= actor->uncullZoneDownward;
} else {
@@ -2809,7 +2809,7 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) {
s32 actorFlags;
s32 i;
- if (play->unk_18844 != 0) {
+ if (play->unk_18844) {
actorFlags = ACTOR_FLAG_200000;
} else {
actorFlags = ACTOR_FLAG_200000 | ACTOR_FLAG_40 | ACTOR_FLAG_20;
@@ -2880,7 +2880,7 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) {
gSPBranchList(ref2, &tmp2[1]);
POLY_XLU_DISP = &tmp2[1];
- if (play->unk_18844 == 0) {
+ if (!play->unk_18844) {
Lights_DrawGlow(play);
}
diff --git a/src/code/z_construct.c b/src/code/z_construct.c
index 5e92d4958..3d2621c9c 100644
--- a/src/code/z_construct.c
+++ b/src/code/z_construct.c
@@ -1,4 +1,5 @@
#include "global.h"
-void func_801AAAA0(PlayState* play) {
+// Remnant from OoT
+void Regs_InitData(PlayState* play) {
}
diff --git a/src/code/z_demo.c b/src/code/z_demo.c
index 7d665e208..7d0c1ade3 100644
--- a/src/code/z_demo.c
+++ b/src/code/z_demo.c
@@ -161,8 +161,8 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
}
break;
case 0x3:
- if (play->envCtx.lightSettings.fogFar < 12800) {
- play->envCtx.lightSettings.fogFar += 35;
+ if (play->envCtx.lightSettings.zFar < 12800) {
+ play->envCtx.lightSettings.zFar += 35;
}
break;
case 0x4:
@@ -206,16 +206,16 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
}
break;
case 0xA:
- D_801F6D30.r = 255;
- D_801F6D30.g = 255;
- D_801F6D30.b = 255;
- D_801F6D30.a = 255 * progress;
+ gVisMonoColor.r = 255;
+ gVisMonoColor.g = 255;
+ gVisMonoColor.b = 255;
+ gVisMonoColor.a = 255 * progress;
break;
case 0xB:
- D_801F6D30.r = 255;
- D_801F6D30.g = 180;
- D_801F6D30.b = 100;
- D_801F6D30.a = 255 * progress;
+ gVisMonoColor.r = 255;
+ gVisMonoColor.g = 180;
+ gVisMonoColor.b = 100;
+ gVisMonoColor.a = 255 * progress;
break;
case 0xC:
play->roomCtx.curRoom.segment = NULL;
@@ -236,10 +236,10 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
}
break;
case 0xE:
- play->unk_18845 = 1;
+ play->haltAllActors = true;
break;
case 0xF:
- play->unk_18845 = 0;
+ play->haltAllActors = false;
break;
case 0x10:
if (isStartFrame) {
@@ -295,7 +295,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
play->nextEntrance = ENTRANCE(CUTSCENE, 0);
gSaveContext.nextCutsceneIndex = 0xFFF8;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
}
break;
case 0x1C:
@@ -555,7 +555,7 @@ void Cutscene_Command_SetTime(PlayState* play, CutsceneContext* csCtx, CsCmdDayT
void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
csCtx->state = CS_STATE_4;
- func_80165690();
+ Play_DisableMotionBlur();
Audio_SetCutsceneFlag(false);
gSaveContext.cutsceneTransitionControl = 1;
@@ -575,7 +575,7 @@ void Cutscene_TerminatorImpl(PlayState* play, CutsceneContext* csCtx, CsCmdBase*
if (D_801BB12C >= 2) {
D_801BB12C = 0;
}
- play->transitionType = TRANS_TYPE_04;
+ play->transitionType = TRANS_TYPE_FADE_BLACK_FAST;
}
if ((play->nextEntrance & 0xF) > 0) {
@@ -594,19 +594,19 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
}
} else if (cmd->base == 2) {
if (csCtx->frames == cmd->startFrame) {
- func_80165690();
+ Play_DisableMotionBlur();
switch (D_801F4DE2) {
case 0x1F:
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) {
play->nextEntrance = ENTRANCE(WOODFALL_TEMPLE, 1);
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
} else {
play->nextEntrance = ENTRANCE(WOODFALL, 0);
gSaveContext.nextCutsceneIndex = 0xFFF0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
}
break;
@@ -614,12 +614,12 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) {
play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 7);
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
} else {
play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 0);
gSaveContext.nextCutsceneIndex = 0xFFF0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
}
break;
@@ -628,7 +628,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
play->nextEntrance = ENTRANCE(ZORA_CAPE, 8);
gSaveContext.nextCutsceneIndex = 0xFFF0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
break;
case 0x36:
@@ -636,7 +636,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
play->nextEntrance = ENTRANCE(IKANA_CANYON, 0);
gSaveContext.nextCutsceneIndex = 0xFFF1;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
break;
}
}
@@ -764,16 +764,16 @@ void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCt
void Cutscene_Command_MotionBlur(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) {
if ((csCtx->frames == cmd->startFrame) && (cmd->base == 1)) {
- func_8016566C(180);
+ Play_EnableMotionBlur(180);
}
if (cmd->base == 2) {
f32 progress = Environment_LerpWeight(cmd->endFrame, cmd->startFrame, csCtx->frames);
if (progress >= 0.9f) {
- func_80165690();
+ Play_DisableMotionBlur();
} else {
- func_80165658((1.0f - progress) * 180.0f);
+ Play_SetMotionBlurAlpha((1.0f - progress) * 180.0f);
}
}
}
diff --git a/src/code/z_draw.c b/src/code/z_draw.c
index 4167b4cea..a2686be8e 100644
--- a/src/code/z_draw.c
+++ b/src/code/z_draw.c
@@ -837,7 +837,7 @@ void GetItem_DrawRemains(PlayState* play, s16 drawId) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].drawResources[0]);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c
index b7c6af97e..6c416e3c8 100644
--- a/src/code/z_eff_ss_dead.c
+++ b/src/code/z_eff_ss_dead.c
@@ -50,7 +50,7 @@ void func_800AE5A0(PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -105,7 +105,7 @@ void func_800AE8EC(PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
gDPPipeSync(POLY_XLU_DISP++);
- POLY_XLU_DISP = func_801660B8(play, POLY_XLU_DISP);
+ POLY_XLU_DISP = Play_SetFog(play, POLY_XLU_DISP);
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c
index 944e650a0..f450db014 100644
--- a/src/code/z_en_item00.c
+++ b/src/code/z_en_item00.c
@@ -819,7 +819,7 @@ void EnItem00_DrawSprite(EnItem00* this, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
if (this->actor.params == ITEM00_NUTS_10) {
texIndex = 6;
diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c
index 3d33399e5..c145087a2 100644
--- a/src/code/z_fbdemo.c
+++ b/src/code/z_fbdemo.c
@@ -5,13 +5,13 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_8016418C.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_8016424C.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/TransitionUnk_Destroy.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_801642D8.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/TransitionUnk_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_80164438.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_8016454C.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/TransitionUnk_Draw.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_80164678.s")
diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c
index 5609a4727..1e87a6a17 100644
--- a/src/code/z_game_over.c
+++ b/src/code/z_game_over.c
@@ -73,7 +73,7 @@ void GameOver_Update(PlayState* play) {
if (gSaveContext.respawnFlag != -7) {
gSaveContext.respawnFlag = -6;
}
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
gSaveContext.save.playerData.health = 0x30;
gameOverCtx->state++;
if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) {
diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c
index 5ab466ddc..59fde2f2d 100644
--- a/src/code/z_kaleido_scope_call.c
+++ b/src/code/z_kaleido_scope_call.c
@@ -50,7 +50,7 @@ void KaleidoScopeCall_Update(PlayState* play) {
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
} else if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_GAMEOVER_1) ||
(pauseCtx->state == PAUSE_STATE_OWLWARP_1)) {
- if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_DONE) {
+ if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) {
pauseCtx->state++;
}
} else if (pauseCtx->state != PAUSE_STATE_OFF) {
@@ -77,7 +77,7 @@ void KaleidoScopeCall_Update(PlayState* play) {
void KaleidoScopeCall_Draw(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
- if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_DONE) {
+ if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) {
if (((play->pauseCtx.state >= PAUSE_STATE_OPENING_3) && (play->pauseCtx.state <= PAUSE_STATE_SAVEPROMPT)) ||
((play->pauseCtx.state >= PAUSE_STATE_GAMEOVER_3) && (play->pauseCtx.state <= PAUSE_STATE_UNPAUSE_SETUP))) {
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c
index 919abbb1d..d6d38f9d6 100644
--- a/src/code/z_kankyo.c
+++ b/src/code/z_kankyo.c
@@ -4,7 +4,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F50D4.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_Init.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F5954.s")
@@ -12,7 +12,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F5B10.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F5CD0.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_UpdateSkybox.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F6834.s")
@@ -42,11 +42,11 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F8A9C.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F8CD4.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_Update.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F8D84.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F9728.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_DrawSunLensFlare.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800F9824.s")
@@ -54,7 +54,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FA3C4.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FA9FC.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_DrawRain.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FAAB4.s")
@@ -72,7 +72,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FB9B4.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FBCBC.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_DrawCustomLensFlare.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Kankyo_InitGameOverLights.s")
@@ -82,9 +82,9 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC3DC.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC444.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_FillScreen.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FC64C.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/Environment_DrawSandstorm.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800FD2B4.s")
diff --git a/src/code/z_lights.c b/src/code/z_lights.c
index e3e732eb3..6a31c7e94 100644
--- a/src/code/z_lights.c
+++ b/src/code/z_lights.c
@@ -251,7 +251,7 @@ void Lights_FreeNode(LightNode* light) {
void LightContext_Init(PlayState* play, LightContext* lightCtx) {
LightContext_InitList(play, lightCtx);
LightContext_SetAmbientColor(lightCtx, 80, 80, 80);
- func_80102544(lightCtx, 0, 0, 0, 0x3E4, 0x3200);
+ LightContext_SetFog(lightCtx, 0, 0, 0, 996, 12800);
bzero(&sLightsBuffer, sizeof(LightsBuffer));
}
@@ -261,12 +261,12 @@ void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b) {
lightCtx->ambient.b = b;
}
-void func_80102544(LightContext* lightCtx, u8 a1, u8 a2, u8 a3, s16 numLights, s16 sp16) {
- lightCtx->unk7 = a1;
- lightCtx->unk8 = a2;
- lightCtx->unk9 = a3;
- lightCtx->unkA = numLights;
- lightCtx->unkC = sp16;
+void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 near, s16 far) {
+ lightCtx->fogColor.r = r;
+ lightCtx->fogColor.g = g;
+ lightCtx->fogColor.b = b;
+ lightCtx->fogNear = near;
+ lightCtx->zFar = far;
}
/**
diff --git a/src/code/z_message.c b/src/code/z_message.c
index e3eb9839d..97db5e72d 100644
--- a/src/code/z_message.c
+++ b/src/code/z_message.c
@@ -531,7 +531,7 @@ void func_80153E7C(PlayState* play, void* arg1) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_801541D4.s")
-void func_80156758(PlayState* play) {
+void Message_Draw(PlayState* play) {
Gfx* nextDisplayList;
Gfx* polyOpa;
GraphicsContext* gfxCtx = play->state.gfxCtx;
@@ -551,7 +551,7 @@ void func_80156758(PlayState* play) {
CLOSE_DISPS(gfxCtx);
}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_8015680C.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/Message_Update.s")
void func_801586A4(PlayState* play) {
play->msgCtx.messageEntryTableNes = D_801C6B98;
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index cd4ffa67f..f3bfb530f 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -4333,7 +4333,7 @@ void Interface_StartMoonCrash(PlayState* play) {
play->nextEntrance = ENTRANCE(TERMINA_FIELD, 12);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
}
void Interface_GetTimerDigits(u64 timer, s16* timerArr) {
diff --git a/src/code/z_play.c b/src/code/z_play.c
index 7b3a875c2..b33b449d2 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -1,81 +1,1590 @@
#include "global.h"
#include "z64quake.h"
+#include "z64rumble.h"
#include "z64shrink_window.h"
#include "z64view.h"
+#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
+#include "overlays/gamestates/ovl_opening/z_opening.h"
+#include "overlays/gamestates/ovl_file_choose/z_file_choose.h"
+#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
+
+s32 gDbgCamEnabled = false;
+u8 D_801D0D54 = false;
+
+s16 sTransitionFillTimer;
+Input D_801F6C18;
+FbDemoStruct sTrnsnUnk;
+u16* D_801F6D0C;
+s32 gTrnsnUnkState;
+VisMono sVisMono;
+Color_RGBA8_u32 gVisMonoColor;
+Struct_80140E80 D_801F6D38;
+Struct_80140E80* D_801F6D4C;
+BombersNotebook sBombersNotebook;
+u8 sBombersNotebookOpen;
+u8 sMotionBlurStatus;
+
+typedef enum {
+ /* 0 */ MOTION_BLUR_OFF,
+ /* 1 */ MOTION_BLUR_SETUP,
+ /* 2 */ MOTION_BLUR_PROCESS
+} MotionBlurStatus;
+
+void Play_DrawMotionBlur(PlayState* this) {
+ GraphicsContext* gfxCtx = this->state.gfxCtx;
+ s32 alpha;
+ Gfx* gfx;
+ Gfx* gfxHead;
+
+ if (R_MOTION_BLUR_PRIORITY_ENABLED) {
+ alpha = R_MOTION_BLUR_PRIORITY_ALPHA;
+
+ if (sMotionBlurStatus == MOTION_BLUR_OFF) {
+ sMotionBlurStatus = MOTION_BLUR_SETUP;
+ }
+ } else if (R_MOTION_BLUR_ENABLED) {
+ alpha = R_MOTION_BLUR_ALPHA;
+
+ if (sMotionBlurStatus == MOTION_BLUR_OFF) {
+ sMotionBlurStatus = MOTION_BLUR_SETUP;
+ }
+ } else {
+ alpha = 0;
+ sMotionBlurStatus = MOTION_BLUR_OFF;
+ }
+
+ if (sMotionBlurStatus != MOTION_BLUR_OFF) {
+ OPEN_DISPS(gfxCtx);
+
+ gfxHead = POLY_OPA_DISP;
+ gfx = Graph_GfxPlusOne(gfxHead);
+
+ gSPDisplayList(OVERLAY_DISP++, gfx);
+
+ this->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer;
+ this->pauseBgPreRender.fbufSave = this->unk_18E64;
+
+ if (sMotionBlurStatus == MOTION_BLUR_PROCESS) {
+ func_80170AE0(&this->pauseBgPreRender, &gfx, alpha);
+ } else {
+ sMotionBlurStatus = MOTION_BLUR_PROCESS;
+ }
+
+ func_801705B4(&this->pauseBgPreRender, &gfx);
+
+ gSPEndDisplayList(gfx++);
+
+ Graph_BranchDlist(gfxHead, gfx);
+
+ POLY_OPA_DISP = gfx;
+
+ CLOSE_DISPS(gfxCtx);
+ }
+}
+
+void Play_InitMotionBlur(void) {
+ R_MOTION_BLUR_ENABLED = false;
+ R_MOTION_BLUR_PRIORITY_ENABLED = false;
+ sMotionBlurStatus = MOTION_BLUR_OFF;
+}
+
+void Play_DestroyMotionBlur(void) {
+ R_MOTION_BLUR_ENABLED = false;
+ R_MOTION_BLUR_PRIORITY_ENABLED = false;
+ sMotionBlurStatus = MOTION_BLUR_OFF;
+}
+
+void Play_SetMotionBlurAlpha(u32 alpha) {
+ R_MOTION_BLUR_ALPHA = alpha;
+}
+
+void Play_EnableMotionBlur(u32 alpha) {
+ R_MOTION_BLUR_ALPHA = alpha;
+ R_MOTION_BLUR_ENABLED = true;
+}
+
+void Play_DisableMotionBlur(void) {
+ R_MOTION_BLUR_ENABLED = false;
+}
+
+// How much each color component contributes to the intensity image.
+// These coefficients are close to what the YUV color space defines Y (luminance) as:
+// https://en.wikipedia.org/wiki/YUV#Conversion_to/from_RGB
+#define PLAY_INTENSITY_RED 2
+#define PLAY_INTENSITY_GREEN 4
+#define PLAY_INTENSITY_BLUE 1
+#define PLAY_INTENSITY_NORM (0x1F * PLAY_INTENSITY_RED + 0x1F * PLAY_INTENSITY_GREEN + 0x1F * PLAY_INTENSITY_BLUE)
+#define PLAY_INTENSITY_MIX(r, g, b, m) \
+ ((((r)*PLAY_INTENSITY_RED + (g)*PLAY_INTENSITY_GREEN + (b)*PLAY_INTENSITY_BLUE) * (m)) / PLAY_INTENSITY_NORM)
+
+/**
+ * Converts an RGBA16 buffer to an Intensity Image
+ *
+ * @param[out] destI destination buffer
+ * @param[in] srcRgba16 source buffer
+ * @param[in] rgba16Width width of a full row for the RGBA16
+ * @param[in] pixelLeft X coordinate of the top-left RGBA16 pixel to start with
+ * @param[in] pixelTop Y coordinate of the top-left RGBA16 pixel to start with
+ * @param[in] pixelRight X coordinate of the bottom-right RGBA16 pixel to end with
+ * @param[in] pixelBottom Y coordinate of the bottom-right RGBA16 pixel to end with
+ * @param[in] bitDepth bit depth for the intensity image
+ */
+void Play_ConvertRgba16ToIntensityImage(void* destI, u16* srcRgba16, s32 rgba16Width, s32 pixelLeft, s32 pixelTop,
+ s32 pixelRight, s32 pixelBottom, s32 bitDepth) {
+ s32 i;
+ s32 j;
+ u32 pixel;
+ u32 r;
+ u32 g;
+ u32 b;
+
+ switch (bitDepth) {
+ case 4: {
+ u8* destI4 = destI;
+ u32 upper;
+ u32 lower;
+
+ for (i = pixelTop; i <= pixelBottom; i++) {
+ for (j = pixelLeft; j <= pixelRight; j += 2) {
+ pixel = srcRgba16[i * rgba16Width + j];
+ r = RGBA16_GET_R(pixel);
+ g = RGBA16_GET_G(pixel);
+ b = RGBA16_GET_B(pixel);
+ upper = PLAY_INTENSITY_MIX(r, g, b, 15);
+
+ pixel = srcRgba16[i * rgba16Width + j + 1];
+ r = RGBA16_GET_R(pixel);
+ g = RGBA16_GET_G(pixel);
+ b = RGBA16_GET_B(pixel);
+ lower = PLAY_INTENSITY_MIX(r, g, b, 15);
+
+ *(destI4++) = (upper << 4) | lower;
+ }
+ }
+ break;
+ }
+
+ case 5: {
+ u8* destI5 = destI;
+
+ for (i = pixelTop; i <= pixelBottom; i++) {
+ for (j = pixelLeft; j <= pixelRight; j++) {
+ pixel = srcRgba16[i * rgba16Width + j];
+ r = RGBA16_GET_R(pixel);
+ g = RGBA16_GET_G(pixel);
+ b = RGBA16_GET_B(pixel);
+
+ pixel = 0;
+
+ *(destI5++) = PLAY_INTENSITY_MIX(r, g, b, 255) & 0xF8;
+ }
+ }
+ break;
+ }
+
+ case 8: {
+ u8* destI8 = destI;
+
+ for (i = pixelTop; i <= pixelBottom; i++) {
+ for (j = pixelLeft; j <= pixelRight; j++) {
+ pixel = srcRgba16[i * rgba16Width + j];
+
+ r = RGBA16_GET_R(pixel);
+ g = RGBA16_GET_G(pixel);
+ b = RGBA16_GET_B(pixel);
+
+ *(destI8++) = PLAY_INTENSITY_MIX(r, g, b, 255);
+ }
+ }
+ break;
+ }
+
+ case 16: {
+ u16* destI16 = destI;
+
+ for (i = pixelTop; i <= pixelBottom; i++) {
+ for (j = pixelLeft; j <= pixelRight; j++) {
+ *(destI16++) = srcRgba16[i * rgba16Width + j];
+ }
+ }
+ break;
+ }
+ }
+}
+
+void Play_SetMotionBlurPriorityAlpha(u32 alpha) {
+ R_MOTION_BLUR_PRIORITY_ALPHA = alpha;
+}
+
+void Play_EnableMotionBlurPriority(u32 alpha) {
+ R_MOTION_BLUR_PRIORITY_ALPHA = alpha;
+ R_MOTION_BLUR_PRIORITY_ENABLED = true;
+}
+
+void Play_DisableMotionBlurPriority(void) {
+ R_MOTION_BLUR_PRIORITY_ENABLED = false;
+}
+
+// Will take the photograph, but doesn't compress and save it
+void Play_TriggerPictoPhoto(void) {
+ R_PICTO_PHOTO_STATE = PICTO_PHOTO_STATE_SETUP;
+}
+
+void Play_TakePictoPhoto(PreRender* prerender) {
+ PreRender_ApplyFilters(prerender);
+ Play_ConvertRgba16ToIntensityImage(gPictoPhotoI8, prerender->fbufSave, SCREEN_WIDTH, PICTO_PHOTO_TOPLEFT_X,
+ PICTO_PHOTO_TOPLEFT_Y, (PICTO_PHOTO_TOPLEFT_X + PICTO_PHOTO_WIDTH) - 1,
+ (PICTO_PHOTO_TOPLEFT_Y + PICTO_PHOTO_HEIGHT) - 1, 8);
+}
+
+s32 Play_ChooseDynamicTransition(PlayState* this, s32 transitionType) {
+ s32 nextTransitionType = transitionType;
+
+ if (transitionType == TRANS_TYPE_FADE_DYNAMIC) {
+ if (!gSaveContext.save.isNight) {
+ nextTransitionType = TRANS_TYPE_FADE_WHITE;
+ } else {
+ nextTransitionType = TRANS_TYPE_FADE_BLACK;
+ }
+ }
+ if (nextTransitionType != transitionType) {
+ this->transitionType = nextTransitionType;
+ }
+ return nextTransitionType;
+}
+
+void Play_SetupTransition(PlayState* this, s32 transitionType) {
+ TransitionContext* transitionCtx = &this->transitionCtx;
+ s32 fbdemoType;
+
+ bzero(transitionCtx, sizeof(TransitionContext));
+
+ fbdemoType = -1;
+ if (transitionType & TRANS_TYPE_WIPE3) {
+ fbdemoType = FBDEMO_WIPE3;
+ } else if ((transitionType & 0x78) == TRANS_TYPE_WIPE4) { // Checks not only type, but also a max value of 39
+ fbdemoType = FBDEMO_WIPE4;
+ } else if (!(transitionType & (TRANS_TYPE_WIPE3 | TRANS_TYPE_WIPE4))) {
+ switch (transitionType) {
+ case TRANS_TYPE_TRIFORCE:
+ fbdemoType = FBDEMO_TRIFORCE;
+ break;
+
+ case TRANS_TYPE_WIPE:
+ case TRANS_TYPE_WIPE_FAST:
+ fbdemoType = FBDEMO_WIPE1;
+ break;
+
+ case TRANS_TYPE_FADE_BLACK:
+ case TRANS_TYPE_FADE_WHITE:
+ case TRANS_TYPE_FADE_BLACK_FAST:
+ case TRANS_TYPE_FADE_WHITE_FAST:
+ case TRANS_TYPE_FADE_BLACK_SLOW:
+ case TRANS_TYPE_FADE_WHITE_SLOW:
+ case TRANS_TYPE_FADE_WHITE_CS_DELAYED:
+ case TRANS_TYPE_FADE_WHITE_INSTANT:
+ case TRANS_TYPE_FADE_GREEN:
+ case TRANS_TYPE_FADE_BLUE:
+ fbdemoType = FBDEMO_FADE;
+ break;
+
+ case TRANS_TYPE_FILL_WHITE_FAST:
+ case TRANS_TYPE_FILL_WHITE:
+ this->transitionMode = TRANS_MODE_FILL_WHITE_INIT;
+ break;
+
+ case TRANS_TYPE_INSTANT:
+ this->transitionMode = TRANS_MODE_INSTANT;
+ break;
+
+ case TRANS_TYPE_FILL_BROWN:
+ this->transitionMode = TRANS_MODE_FILL_BROWN_INIT;
+ break;
+
+ case TRANS_TYPE_SANDSTORM_PERSIST:
+ this->transitionMode = TRANS_MODE_SANDSTORM_INIT;
+ break;
+
+ case TRANS_TYPE_SANDSTORM_END:
+ this->transitionMode = TRANS_MODE_SANDSTORM_END_INIT;
+ break;
+
+ case TRANS_TYPE_CS_BLACK_FILL:
+ this->transitionMode = TRANS_MODE_CS_BLACK_FILL_INIT;
+ break;
+
+ case TRANS_TYPE_CIRCLE:
+ fbdemoType = FBDEMO_CIRCLE;
+ break;
+
+ case TRANS_TYPE_WIPE5:
+ fbdemoType = FBDEMO_WIPE5;
+ break;
+
+ default:
+ fbdemoType = -1;
+ __assert("../z_play.c", 1420);
+ }
+ } else {
+ fbdemoType = -1;
+ __assert("../z_play.c", 1423);
+ }
+
+ transitionCtx->transitionType = transitionType;
+ transitionCtx->fbdemoType = fbdemoType;
+ if (fbdemoType != -1) {
+ Transition_Init(transitionCtx);
+ }
+}
+
+void Play_ClearTransition(PlayState* this) {
+ if (this->transitionCtx.fbdemoType != -1) {
+ Transition_Destroy(&this->transitionCtx);
+ }
+ this->transitionCtx.transitionType = -1;
+}
+
+Gfx* Play_SetFog(PlayState* this, Gfx* gfx) {
+ s32 fogFar = this->lightCtx.zFar * (5.0f / 64.0f);
+
+ return Gfx_SetFogWithSync(gfx, this->lightCtx.fogColor.r, this->lightCtx.fogColor.g, this->lightCtx.fogColor.b, 0,
+ this->lightCtx.fogNear, ((fogFar <= 1000) ? 1000 : fogFar));
+}
+
+void Play_Destroy(GameState* thisx) {
+ PlayState* this = (PlayState*)thisx;
+ GraphicsContext* gfxCtx = this->state.gfxCtx;
+
+ if (sBombersNotebookOpen) {
+ MsgEvent_SendNullTask();
+ func_80178750();
+ gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->framebufferIndex % 2);
+ gfxCtx->zbuffer = SysCfb_GetZBuffer();
+ gfxCtx->viMode = D_801FBB88;
+ gfxCtx->viConfigFeatures = gViConfigFeatures;
+ gfxCtx->xScale = gViConfigXScale;
+ gfxCtx->yScale = gViConfigYScale;
+ gfxCtx->updateViMode = true;
+ sBombersNotebookOpen = false;
+ }
+
+ BombersNotebook_Destroy(&sBombersNotebook);
+ this->state.gfxCtx->callback = NULL;
+ this->state.gfxCtx->callbackArg = 0;
+ Play_DestroyMotionBlur();
+
+ if (R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_OFF) {
+ PreRender_ApplyFiltersSlowlyDestroy(&this->pauseBgPreRender);
+ R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF;
+ }
+
+ R_PICTO_PHOTO_STATE = PICTO_PHOTO_STATE_OFF;
+ PreRender_Destroy(&this->pauseBgPreRender);
+ this->unk_18E58 = NULL;
+ this->pictoPhotoI8 = NULL;
+ this->unk_18E60 = NULL;
+ this->unk_18E64 = NULL;
+ this->unk_18E68 = NULL;
+ Effect_DestroyAll(this);
+ EffectSS_Clear(this);
+ CollisionCheck_DestroyContext(this, &this->colChkCtx);
+
+ if (gTrnsnUnkState == 3) {
+ TransitionUnk_Destroy(&sTrnsnUnk);
+ gTrnsnUnkState = 0;
+ }
+
+ if ((this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) || D_801D0D54) {
+ this->transitionCtx.destroy(&this->transitionCtx.instanceData);
+ Play_ClearTransition(this);
+ this->transitionMode = TRANS_MODE_OFF;
+ }
+
+ ShrinkWindow_Destroy();
+ TransitionFade_Destroy(&this->unk_18E48);
+ VisMono_Destroy(&sVisMono);
+ func_80140EA0(D_801F6D4C);
+ D_801F6D4C = NULL;
+
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_92_80)) {
+ Actor_CleanupContext(&this->actorCtx, this);
+ }
+ CLEAR_WEEKEVENTREG(WEEKEVENTREG_92_80);
+
+ Interface_Destroy(this);
+ KaleidoScopeCall_Destroy(this);
+ KaleidoManager_Destroy();
+ ZeldaArena_Cleanup();
+}
+
+#define PLAY_COMPRESS_BITS 5
+#define PLAY_DECOMPRESS_BITS 8
+
+void Play_CompressI8ToI5(void* srcI8, void* destI5, size_t size) {
+ u32 i;
+ u8* src = srcI8;
+ s8* dest = destI5;
+ s32 bitsLeft = PLAY_DECOMPRESS_BITS; // Bits left in the current dest pixel left to compress into
+ u32 destPixel = 0;
+ s32 shift;
+ u32 srcPixel;
+
+ for (i = 0; i < size; i++) {
+ srcPixel = *src++;
+ srcPixel = (srcPixel * 0x1F + 0x80) / 0xFF;
+ shift = bitsLeft - PLAY_COMPRESS_BITS;
+ if (shift > 0) {
+ destPixel |= srcPixel << shift;
+ } else {
+ destPixel |= srcPixel >> -shift;
+ *dest++ = destPixel;
+ shift += PLAY_DECOMPRESS_BITS;
+ destPixel = srcPixel << shift;
+ }
+ bitsLeft = shift;
+ }
+
+ if (bitsLeft < PLAY_DECOMPRESS_BITS) {
+ *dest = destPixel;
+ }
+}
+
+void Play_DecompressI5ToI8(void* srcI5, void* destI8, size_t size) {
+ u32 i;
+ u8* src = srcI5;
+ s8* dest = destI8;
+ s32 bitsLeft = PLAY_DECOMPRESS_BITS; // Bits left in the current src pixel left to decompress
+ u32 destPixel;
+ s32 shift;
+ u32 srcPixel = *src++;
+
+ for (i = 0; i < size; i++) {
+ shift = bitsLeft - PLAY_COMPRESS_BITS;
+ if (shift > 0) {
+ destPixel = 0;
+ destPixel |= srcPixel >> shift;
+ } else {
+ destPixel = 0;
+ destPixel |= srcPixel << -shift;
+ srcPixel = *src++;
+ shift += PLAY_DECOMPRESS_BITS;
+ destPixel |= srcPixel >> shift;
+ }
+ destPixel = (destPixel & 0x1F) * 0xFF / 0x1F;
+ *dest++ = destPixel;
+ bitsLeft = shift;
+ }
+}
+
+f32 Play_GetWaterSurface(PlayState* this, Vec3f* pos, s32* lightIndex) {
+ Player* player = GET_PLAYER(this);
+ f32 waterSurfaceY = player->actor.world.pos.y;
+ WaterBox* waterBox;
+ s32 bgId;
+
+ if (!WaterBox_GetSurfaceImpl(this, &this->colCtx, pos->x, pos->z, &waterSurfaceY, &waterBox, &bgId)) {
+ return BGCHECK_Y_MIN;
+ }
+
+ if (waterSurfaceY < pos->y) {
+ return BGCHECK_Y_MIN;
+ }
+
+ *lightIndex = WaterBox_GetLightSettingIndex(&this->colCtx, waterBox);
+ return waterSurfaceY;
+}
+
+void Play_UpdateWaterCamera(PlayState* this, Camera* camera) {
+ static s16 sQuakeIndex = -1;
+ static s16 sIsCameraUnderwater = false;
+ s32 pad;
+ s32 lightIndex;
+ Player* player = GET_PLAYER(this);
+
+ sIsCameraUnderwater = camera->stateFlags & CAM_STATE_UNDERWATER;
+ if (Play_GetWaterSurface(this, &camera->eye, &lightIndex) != BGCHECK_Y_MIN) {
+ if (!sIsCameraUnderwater) {
+ Camera_SetFlags(camera, CAM_STATE_UNDERWATER);
+ sQuakeIndex = -1;
+ Distortion_SetType(DISTORTION_TYPE_UNDERWATER_ENTRY);
+ Distortion_SetCountdown(80);
+ }
+
+ func_801A3EC0(0x20);
+ func_800F6834(this, lightIndex);
+
+ if ((sQuakeIndex == -1) || (Quake_GetCountdown(sQuakeIndex) == 10)) {
+ s16 quakeIndex = Quake_Add(camera, QUAKE_TYPE_5);
+
+ sQuakeIndex = quakeIndex;
+ if (quakeIndex != 0) {
+ Quake_SetSpeed(sQuakeIndex, 550);
+ Quake_SetQuakeValues(sQuakeIndex, 1, 1, 180, 0);
+ Quake_SetCountdown(sQuakeIndex, 1000);
+ }
+ }
+ if (player->stateFlags3 & PLAYER_STATE3_8000) {
+ Distortion_SetType(DISTORTION_TYPE_ZORA_SWIMMING);
+ Distortion_ClearType(DISTORTION_TYPE_NON_ZORA_SWIMMING);
+ } else {
+ Distortion_SetType(DISTORTION_TYPE_NON_ZORA_SWIMMING);
+ Distortion_ClearType(DISTORTION_TYPE_ZORA_SWIMMING);
+ }
+ } else {
+ if (sIsCameraUnderwater) {
+ Camera_ClearFlags(camera, CAM_STATE_UNDERWATER);
+ }
+ Distortion_ClearType(DISTORTION_TYPE_NON_ZORA_SWIMMING);
+ Distortion_ClearType(DISTORTION_TYPE_UNDERWATER_ENTRY);
+ Distortion_ClearType(DISTORTION_TYPE_ZORA_SWIMMING);
+ if (sQuakeIndex != 0) {
+ Quake_Remove(sQuakeIndex);
+ }
+ func_800F694C(this);
+ func_801A3EC0(0);
+ }
+}
+
+void Play_UpdateTransition(PlayState* this) {
+ s32 pad;
+
+ if (this->transitionMode == TRANS_MODE_OFF) {
+ return;
+ }
+
+ switch (this->transitionMode) {
+ case TRANS_MODE_SETUP:
+ if (this->transitionTrigger != TRANS_TRIGGER_END) {
+ s16 sceneLayer = 0;
+
+ Interface_SetHudVisibility(HUD_VISIBILITY_NONE);
+
+ if (gSaveContext.nextCutsceneIndex >= 0xFFF0) {
+ sceneLayer = (gSaveContext.nextCutsceneIndex & 0xF) + 1;
+ }
+
+ if ((!(Entrance_GetTransitionFlags(this->nextEntrance + sceneLayer) & 0x8000) ||
+ ((this->nextEntrance == ENTRANCE(PATH_TO_MOUNTAIN_VILLAGE, 1)) &&
+ !CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) ||
+ ((this->nextEntrance == ENTRANCE(ROAD_TO_SOUTHERN_SWAMP, 1)) &&
+ !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) ||
+ ((this->nextEntrance == ENTRANCE(TERMINA_FIELD, 2)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80)) ||
+ ((this->nextEntrance == ENTRANCE(ROAD_TO_IKANA, 1)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20))) &&
+ (!func_800FE590(this) || (Entrance_GetSceneId(this->nextEntrance + sceneLayer) < 0) ||
+ (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS))) {
+ func_801A4058(20);
+ gSaveContext.seqId = (u8)NA_BGM_DISABLED;
+ gSaveContext.ambienceId = AMBIENCE_ID_DISABLED;
+ }
+
+ if (func_800FD768()) {
+ func_801A4058(20);
+ gSaveContext.seqId = (u8)NA_BGM_DISABLED;
+ gSaveContext.ambienceId = AMBIENCE_ID_DISABLED;
+ }
+
+ if (func_800FE590(this) && (Entrance_GetSceneId(this->nextEntrance + sceneLayer) >= 0) &&
+ (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS)) {
+ func_801A41C8(20);
+ }
+ }
+
+ if (!D_801D0D54) {
+ Play_SetupTransition(this, Play_ChooseDynamicTransition(this, this->transitionType));
+ }
+
+ if (this->transitionMode >= TRANS_MODE_FILL_WHITE_INIT) {
+ // non-instance modes break out of this switch
+ break;
+ }
+ // fallthrough
+ case TRANS_MODE_INSTANCE_INIT: {
+ s32 transWipeSpeed;
+ s32 transFadeDuration;
+ u32 color;
+
+ this->transitionCtx.init(&this->transitionCtx.instanceData);
+
+ if (this->transitionCtx.transitionType & (TRANS_TYPE_WIPE3 | TRANS_TYPE_WIPE4)) {
+ this->transitionCtx.setType(&this->transitionCtx.instanceData,
+ this->transitionCtx.transitionType | TRANS_TYPE_SET_PARAMS);
+ }
+
+ if ((this->transitionCtx.transitionType == TRANS_TYPE_WIPE_FAST) ||
+ (this->transitionCtx.transitionType == TRANS_TYPE_FILL_WHITE_FAST)) {
+ //! @bug TRANS_TYPE_FILL_WHITE_FAST will never reach this code.
+ //! It is a non-instance type transition which doesn't run this case.
+ transWipeSpeed = 28;
+ } else {
+ transWipeSpeed = 14;
+ }
+ gSaveContext.transWipeSpeed = transWipeSpeed;
+
+ switch (this->transitionCtx.transitionType) {
+ case TRANS_TYPE_FADE_BLACK_FAST:
+ case TRANS_TYPE_FADE_WHITE_FAST:
+ transFadeDuration = 20;
+ break;
+
+ case TRANS_TYPE_FADE_BLACK_SLOW:
+ case TRANS_TYPE_FADE_WHITE_SLOW:
+ transFadeDuration = 150;
+ break;
+
+ case TRANS_TYPE_FADE_WHITE_INSTANT:
+ transFadeDuration = 2;
+ break;
+
+ default:
+ transFadeDuration = 60;
+ break;
+ }
+ gSaveContext.transFadeDuration = transFadeDuration;
+
+ switch (this->transitionCtx.transitionType) {
+ case TRANS_TYPE_FADE_WHITE:
+ case TRANS_TYPE_FADE_WHITE_FAST:
+ case TRANS_TYPE_FADE_WHITE_SLOW:
+ case TRANS_TYPE_FADE_WHITE_CS_DELAYED:
+ case TRANS_TYPE_FADE_WHITE_INSTANT:
+ color = RGBA8(160, 160, 160, 255);
+ break;
+
+ case TRANS_TYPE_FADE_GREEN:
+ color = RGBA8(140, 140, 100, 255);
+ break;
+
+ case TRANS_TYPE_FADE_BLUE:
+ color = RGBA8(70, 100, 110, 255);
+ break;
+
+ default:
+ color = RGBA8(0, 0, 0, 255);
+ break;
+ }
+
+ this->transitionCtx.setColor(&this->transitionCtx.instanceData, color);
+ if (this->transitionCtx.setEnvColor != NULL) {
+ this->transitionCtx.setEnvColor(&this->transitionCtx.instanceData, color);
+ }
+
+ this->transitionCtx.setType(&this->transitionCtx.instanceData,
+ (this->transitionTrigger == TRANS_TRIGGER_END) ? 1 : 2);
+ this->transitionCtx.start(&this->transitionCtx.instanceData);
+
+ if (this->transitionCtx.transitionType == TRANS_TYPE_FADE_WHITE_CS_DELAYED) {
+ this->transitionMode = TRANS_MODE_INSTANCE_WAIT;
+ } else {
+ this->transitionMode = TRANS_MODE_INSTANCE_RUNNING;
+ }
+ break;
+ }
+
+ case TRANS_MODE_INSTANCE_RUNNING:
+ if (this->transitionCtx.isDone(&this->transitionCtx.instanceData)) {
+ if (this->transitionTrigger != TRANS_TRIGGER_END) {
+ if (this->transitionCtx.transitionType == TRANS_TYPE_CIRCLE) {
+ D_801D0D54 = false;
+ }
+
+ if (gSaveContext.gameMode == 4) {
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState));
+ } else if (gSaveContext.gameMode != 2) {
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
+ gSaveContext.save.entrance = this->nextEntrance;
+
+ if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) {
+ gSaveContext.minigameStatus = MINIGAME_STATUS_END;
+ }
+ } else { // 2
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, FileSelect_Init, sizeof(FileSelectState));
+ }
+ } else {
+ if (this->transitionCtx.transitionType == TRANS_TYPE_CIRCLE) {
+ D_801D0D54 = true;
+ } else {
+ this->transitionCtx.destroy(&this->transitionCtx.instanceData);
+ Play_ClearTransition(this);
+ }
+ this->transitionMode = TRANS_MODE_OFF;
+ if (gTrnsnUnkState == 3) {
+ TransitionUnk_Destroy(&sTrnsnUnk);
+ gTrnsnUnkState = 0;
+ Game_SetFramerateDivisor(&this->state, 3);
+ }
+ }
+ this->transitionTrigger = TRANS_TRIGGER_OFF;
+ } else {
+ this->transitionCtx.update(&this->transitionCtx.instanceData, this->state.framerateDivisor);
+ }
+ break;
+ }
+
+ // update non-instance transitions
+ switch (this->transitionMode) {
+ case TRANS_MODE_FILL_WHITE_INIT:
+ sTransitionFillTimer = 0;
+ this->envCtx.fillScreen = true;
+ this->envCtx.screenFillColor[0] = 160;
+ this->envCtx.screenFillColor[1] = 160;
+ this->envCtx.screenFillColor[2] = 160;
+
+ if (this->transitionTrigger != TRANS_TRIGGER_END) {
+ this->envCtx.screenFillColor[3] = 0;
+ this->transitionMode = TRANS_MODE_FILL_IN;
+ } else {
+ this->envCtx.screenFillColor[3] = 255;
+ this->transitionMode = TRANS_MODE_FILL_OUT;
+ }
+ break;
+
+ case TRANS_MODE_FILL_IN:
+ this->envCtx.screenFillColor[3] = (sTransitionFillTimer / 20.0f) * 255.0f;
+
+ if (sTransitionFillTimer >= 20) {
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
+ gSaveContext.save.entrance = this->nextEntrance;
+ this->transitionTrigger = TRANS_TRIGGER_OFF;
+ this->transitionMode = TRANS_MODE_OFF;
+ } else {
+ sTransitionFillTimer++;
+ }
+ break;
+
+ case TRANS_MODE_FILL_OUT:
+ this->envCtx.screenFillColor[3] = (1.0f - (sTransitionFillTimer / 20.0f)) * 255.0f;
+
+ if (sTransitionFillTimer >= 20) {
+ gTrnsnUnkState = 0;
+ Game_SetFramerateDivisor(&this->state, 3);
+ this->transitionTrigger = TRANS_TRIGGER_OFF;
+ this->transitionMode = TRANS_MODE_OFF;
+ this->envCtx.fillScreen = false;
+ } else {
+ sTransitionFillTimer++;
+ }
+ break;
+
+ case TRANS_MODE_FILL_BROWN_INIT:
+ sTransitionFillTimer = 0;
+ this->envCtx.fillScreen = true;
+ this->envCtx.screenFillColor[0] = 170;
+ this->envCtx.screenFillColor[1] = 160;
+ this->envCtx.screenFillColor[2] = 150;
+
+ if (this->transitionTrigger != TRANS_TRIGGER_END) {
+ this->envCtx.screenFillColor[3] = 0;
+ this->transitionMode = TRANS_MODE_FILL_IN;
+ } else {
+ this->envCtx.screenFillColor[3] = 255;
+ this->transitionMode = TRANS_MODE_FILL_OUT;
+ }
+ break;
+
+ case TRANS_MODE_INSTANT:
+ if (this->transitionTrigger != TRANS_TRIGGER_END) {
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
+ gSaveContext.save.entrance = this->nextEntrance;
+ this->transitionTrigger = TRANS_TRIGGER_OFF;
+ this->transitionMode = TRANS_MODE_OFF;
+ } else {
+ gTrnsnUnkState = 0;
+ Game_SetFramerateDivisor(&this->state, 3);
+ this->transitionTrigger = TRANS_TRIGGER_OFF;
+ this->transitionMode = TRANS_MODE_OFF;
+ }
+ break;
+
+ case TRANS_MODE_INSTANCE_WAIT:
+ if (gSaveContext.cutsceneTransitionControl != 0) {
+ this->transitionMode = TRANS_MODE_INSTANCE_RUNNING;
+ }
+ break;
+
+ case TRANS_MODE_SANDSTORM_INIT:
+ if (this->transitionTrigger != TRANS_TRIGGER_END) {
+ this->envCtx.sandstormState = 1;
+ this->transitionMode = TRANS_MODE_SANDSTORM;
+ } else {
+ this->envCtx.sandstormState = 2;
+ this->envCtx.sandstormPrimA = 255;
+ this->envCtx.sandstormEnvA = 255;
+ this->transitionMode = TRANS_MODE_SANDSTORM;
+ }
+ break;
+
+ case TRANS_MODE_SANDSTORM:
+ func_8019F128(NA_SE_EV_SAND_STORM - SFX_FLAG);
+ if (this->transitionTrigger == TRANS_TRIGGER_END) {
+ if (this->envCtx.sandstormPrimA < 110) {
+ gTrnsnUnkState = 0;
+ Game_SetFramerateDivisor(&this->state, 3);
+ this->transitionTrigger = TRANS_TRIGGER_OFF;
+ this->transitionMode = TRANS_MODE_OFF;
+ }
+ } else {
+ if (this->envCtx.sandstormEnvA == 255) {
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
+ gSaveContext.save.entrance = this->nextEntrance;
+ this->transitionTrigger = TRANS_TRIGGER_OFF;
+ this->transitionMode = TRANS_MODE_OFF;
+ }
+ }
+ break;
+
+ case TRANS_MODE_SANDSTORM_END_INIT:
+ if (this->transitionTrigger == TRANS_TRIGGER_END) {
+ this->envCtx.sandstormState = 4;
+ this->envCtx.sandstormPrimA = 255;
+ this->envCtx.sandstormEnvA = 255;
+
+ // "It's here!!!!!!!!!"
+ (void)"来た!!!!!!!!!!!!!!!!!!!!!";
+
+ this->transitionMode = TRANS_MODE_SANDSTORM_END;
+ } else {
+ this->transitionMode = TRANS_MODE_SANDSTORM_INIT;
+ }
+ break;
+
+ case TRANS_MODE_SANDSTORM_END:
+ func_8019F128(NA_SE_EV_SAND_STORM - SFX_FLAG);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165460.s")
+ if (this->transitionTrigger == TRANS_TRIGGER_END) {
+ if (this->envCtx.sandstormPrimA <= 0) {
+ gTrnsnUnkState = 0;
+ Game_SetFramerateDivisor(&this->state, 3);
+ this->transitionTrigger = TRANS_TRIGGER_OFF;
+ this->transitionMode = TRANS_MODE_OFF;
+ }
+ }
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165608.s")
+ case TRANS_MODE_CS_BLACK_FILL_INIT:
+ sTransitionFillTimer = 0;
+ this->envCtx.fillScreen = true;
+ this->envCtx.screenFillColor[0] = 0;
+ this->envCtx.screenFillColor[1] = 0;
+ this->envCtx.screenFillColor[2] = 0;
+ this->envCtx.screenFillColor[3] = 255;
+ this->transitionMode = TRANS_MODE_CS_BLACK_FILL;
+ break;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165630.s")
+ case TRANS_MODE_CS_BLACK_FILL:
+ if (gSaveContext.cutsceneTransitionControl != 0) {
+ this->envCtx.screenFillColor[3] = gSaveContext.cutsceneTransitionControl;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165658.s")
+ if (gSaveContext.cutsceneTransitionControl <= 100) {
+ gTrnsnUnkState = 0;
+ Game_SetFramerateDivisor(&this->state, 3);
+ this->transitionTrigger = TRANS_TRIGGER_OFF;
+ this->transitionMode = TRANS_MODE_OFF;
+ }
+ }
+ break;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_8016566C.s")
+const char D_801DFA34[][4] = {
+ "all", "a", "a", "b", "b", "c", "c", "d", "d", "e", "e", "f", "fa", "fa", "fb", "fb",
+ "fc", "fc", "fd", "fd", "fe", "fe", "fg", "fg", "fh", "fh", "fi", "fi", "fj", "fj", "fk", "fk",
+ "f", "g", "g", "h", "h", "i", "i", "all", "all", "a", "b", "c", "d", "e", "f", "g",
+ "h", "i", "f", "fa", "fb", "fc", "fd", "fe", "ff", "fg", "fh", "fi", "fj", "fk",
+};
+
+#ifdef NON_MATCHING
+// Stack issues
+void Play_UpdateMain(PlayState* this) {
+ Input* input = this->state.input;
+ u8 freezeFlashTimer;
+ s32 sp5C = false;
+
+ gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
+ gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
+ gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
+
+ if (R_PICTO_PHOTO_STATE == PICTO_PHOTO_STATE_PROCESS) {
+ R_PICTO_PHOTO_STATE = PICTO_PHOTO_STATE_READY;
+ MsgEvent_SendNullTask();
+ Play_TakePictoPhoto(&this->pauseBgPreRender);
+ R_PICTO_PHOTO_STATE = PICTO_PHOTO_STATE_OFF;
+ }
+ Actor_SetMovementScale(this->state.framerateDivisor);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165690.s")
+ if (FrameAdvance_Update(&this->frameAdvCtx, &input[1])) {
+ if ((this->transitionMode == TRANS_MODE_OFF) && (this->transitionTrigger != TRANS_TRIGGER_OFF)) {
+ this->transitionMode = TRANS_MODE_SETUP;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801656A4.s")
+ if (gTrnsnUnkState != 0) {
+ switch (gTrnsnUnkState) {
+ case 2:
+ if (TransitionUnk_Init(&sTrnsnUnk, 10, 7) == NULL) {
+ gTrnsnUnkState = 0;
+ } else {
+ D_801F6D0C = gZBufferPtr;
+ gTrnsnUnkState = 3;
+ Game_SetFramerateDivisor(&this->state, 1);
+ }
+ break;
+
+ case 3:
+ func_801647AC(&sTrnsnUnk);
+ break;
+ }
+ }
+ Play_UpdateTransition(this);
+ if (gTrnsnUnkState != 3) {
+ if ((gSaveContext.gameMode == 0) &&
+ (((this->msgCtx.msgMode == 0)) ||
+ ((this->msgCtx.currentTextId == 0xFF) && (this->msgCtx.msgMode == 0x42) &&
+ (this->msgCtx.unk12020 == 0x41)) ||
+ ((this->msgCtx.currentTextId >= 0x100) && (this->msgCtx.currentTextId <= 0x200))) &&
+ (this->gameOverCtx.state == GAMEOVER_INACTIVE)) {
+ KaleidoSetup_Update(this);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165DB8.s")
+ sp5C = (this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE);
+
+ AnimationContext_Reset(&this->animationCtx);
+ Object_UpdateBank(&this->objectCtx);
+
+ if (!sp5C && (IREG(72) == 0)) {
+ this->gameplayFrames++;
+ Rumble_SetUpdateEnabled(true);
+ if ((this->actorCtx.freezeFlashTimer != 0) && (this->actorCtx.freezeFlashTimer-- < 5)) {
+ freezeFlashTimer = this->actorCtx.freezeFlashTimer;
+ if ((freezeFlashTimer > 0) && ((freezeFlashTimer % 2) != 0)) {
+ this->envCtx.fillScreen = true;
+ this->envCtx.screenFillColor[0] = this->envCtx.screenFillColor[1] =
+ this->envCtx.screenFillColor[2] = 150;
+ this->envCtx.screenFillColor[3] = 80;
+ } else {
+ this->envCtx.fillScreen = false;
+ }
+ } else {
+ Room_HandleLoadCallbacks(this, &this->roomCtx);
+ CollisionCheck_AT(this, &this->colChkCtx);
+ CollisionCheck_OC(this, &this->colChkCtx);
+ CollisionCheck_Damage(this, &this->colChkCtx);
+ CollisionCheck_ClearContext(this, &this->colChkCtx);
+ if (!this->haltAllActors) {
+ Actor_UpdateAll(this, &this->actorCtx);
+ }
+ Cutscene_Update1(this, &this->csCtx);
+ Cutscene_Update2(this, &this->csCtx);
+ Effect_UpdateAll(this);
+ EffectSS_UpdateAllParticles(this);
+ EffFootmark_Update(this);
+ }
+ } else {
+ Rumble_SetUpdateEnabled(false);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165DCC.s")
+ Room_nop8012D510(this, &this->roomCtx.curRoom, &input[1], 0);
+ Room_nop8012D510(this, &this->roomCtx.prevRoom, &input[1], 1);
+ SkyboxDraw_Update(&this->skyboxCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165DF0.s")
+ if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) {
+ KaleidoScopeCall_Update(this);
+ } else if (this->gameOverCtx.state != GAMEOVER_INACTIVE) {
+ GameOver_Update(this);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165E04.s")
+ Message_Update(this);
+ Interface_Update(this);
+ AnimationContext_Update(this, &this->animationCtx);
+ SoundSource_UpdateAll(this);
+ ShrinkWindow_Update(this->state.framerateDivisor);
+ TransitionFade_Update(&this->unk_18E48, this->state.framerateDivisor);
+ }
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165E1C.s")
+ if (!sp5C || gDbgCamEnabled) {
+ s32 sp54; // camId
+ Vec3s sp48; // InputDir
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165E7C.s")
+ this->nextCamera = this->activeCamId;
+ for (sp54 = 0; sp54 < 4; sp54++) {
+ if ((sp54 != this->nextCamera) && (this->cameraPtrs[sp54] != NULL)) {
+ Camera_Update(&sp48, this->cameraPtrs[sp54]);
+ }
+ }
+ Camera_Update(&sp48, this->cameraPtrs[this->nextCamera]);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165EC0.s")
+ if (!sp5C) {
+ Play_UpdateWaterCamera(this, this->cameraPtrs[this->nextCamera]);
+ Distortion_Update();
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/D_801DFA18.s")
+ Environment_Update(this, &this->envCtx, &this->lightCtx, &this->pauseCtx, &this->msgCtx, &this->gameOverCtx,
+ this->state.gfxCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80166060.s")
+ if (this->sramCtx.status != 0) {
+ if (gSaveContext.save.isOwlSave) {
+ func_80147198(&this->sramCtx);
+ } else {
+ func_80147068(&this->sramCtx);
+ }
+ }
+}
+#else
+void Play_UpdateMain(PlayState* this);
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_UpdateMain.s")
+#endif
+
+void Play_Update(PlayState* this) {
+ if (!sBombersNotebookOpen) {
+ if (this->pauseCtx.bombersNotebookOpen) {
+ sBombersNotebookOpen = true;
+ sBombersNotebook.unk_00 = 0;
+ }
+ } else if (CHECK_BTN_ALL(CONTROLLER1(&this->state)->press.button, BTN_L) ||
+ CHECK_BTN_ALL(CONTROLLER1(&this->state)->press.button, BTN_B) ||
+ CHECK_BTN_ALL(CONTROLLER1(&this->state)->press.button, BTN_START) || (gIrqMgrResetStatus != 0)) {
+ sBombersNotebookOpen = false;
+ this->pauseCtx.bombersNotebookOpen = false;
+ sBombersNotebook.unk_00 = 0;
+ this->msgCtx.msgLength = 0;
+ this->msgCtx.msgMode = 0;
+ this->msgCtx.currentTextId = 0;
+ this->msgCtx.stateTimer = 0;
+ play_sound(NA_SE_SY_CANCEL);
+ }
+ if (sBombersNotebookOpen) {
+ BombersNotebook_Update(this, &sBombersNotebook, this->state.input);
+ Message_Update(this);
+ } else {
+ Play_UpdateMain(this);
+ }
+}
+
+void Play_PostWorldDraw(PlayState* this) {
+ if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) {
+ KaleidoScopeCall_Draw(this);
+ }
+
+ if (gSaveContext.gameMode == 0) {
+ Interface_Draw(this);
+ }
+
+ if (((this->pauseCtx.state == 0) && (this->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) ||
+ (this->msgCtx.currentTextId != 0xFF)) {
+ Message_Draw(this);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801660B8.s")
+ if (this->gameOverCtx.state != GAMEOVER_INACTIVE) {
+ GameOver_FadeLights(this);
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Destroy.s")
+ // Shrink the whole screen display (at the end of First and Second Day by default)
+ if (gSaveContext.screenScaleFlag) {
+ Gfx* nextOpa;
+ Gfx* opa;
+ GraphicsContext* gfxCtx = this->state.gfxCtx;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CompressI8ToI5.s")
+ D_801F6D4C->scale = gSaveContext.screenScale / 1000.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_DecompressI5ToI8.s")
+ OPEN_DISPS(gfxCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801668B4.s")
+ opa = POLY_OPA_DISP;
+ nextOpa = Graph_GfxPlusOne(opa);
+ gSPDisplayList(OVERLAY_DISP++, nextOpa);
+
+ func_80141778(D_801F6D4C, &nextOpa, this->unk_18E60, gfxCtx);
+
+ gSPEndDisplayList(nextOpa++);
+ Graph_BranchDlist(opa, nextOpa);
+ POLY_OPA_DISP = nextOpa;
+
+ CLOSE_DISPS(gfxCtx);
+ }
+}
+
+#ifdef NON_MATCHING
+// Stack issues and 1 small issue around Play_PostWorldDraw
+void Play_DrawMain(PlayState* this) {
+ GraphicsContext* gfxCtx = this->state.gfxCtx;
+ Lights* sp268;
+ Vec3f sp25C;
+ u8 sp25B = false;
+
+ if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_UNK4) {
+ PreRender_ApplyFiltersSlowlyDestroy(&this->pauseBgPreRender);
+ R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF;
+ }
+
+ if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTrnsnUnkState < 2)) {
+ if (this->skyboxCtx.skyboxShouldDraw || (this->roomCtx.curRoom.mesh->type0.type == 1)) {
+ func_8012CF0C(gfxCtx, false, true, 0, 0, 0);
+ } else {
+ func_8012CF0C(gfxCtx, true, true, this->lightCtx.fogColor.r, this->lightCtx.fogColor.g,
+ this->lightCtx.fogColor.b);
+ }
+ } else {
+ func_8012CF0C(gfxCtx, false, false, 0, 0, 0);
+ }
+
+ OPEN_DISPS(gfxCtx);
+
+ gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
+ gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
+ gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
+
+ gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
+ gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
+ gSPSegment(OVERLAY_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
+
+ gSPSegment(POLY_OPA_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
+ gSPSegment(POLY_XLU_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
+ gSPSegment(OVERLAY_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
+
+ gSPSegment(POLY_OPA_DISP++, 0x02, this->sceneSegment);
+ gSPSegment(POLY_XLU_DISP++, 0x02, this->sceneSegment);
+ gSPSegment(OVERLAY_DISP++, 0x02, this->sceneSegment);
+
+ if (1) {
+ f32 var_fv0; // zFar
+
+ ShrinkWindow_Draw(gfxCtx);
+
+ POLY_OPA_DISP = Play_SetFog(this, POLY_OPA_DISP);
+ POLY_XLU_DISP = Play_SetFog(this, POLY_XLU_DISP);
+
+ // zFar
+ var_fv0 = this->lightCtx.zFar;
+ if (var_fv0 > 12800.0f) {
+ var_fv0 = 12800.0f;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80166968.s")
+ View_SetPerspective(&this->view, this->view.fovy, this->view.zNear, var_fv0);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80166B30.s")
+ View_Apply(&this->view, 0xF);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Update.s")
+ // The billboard matrix temporarily stores the viewing matrix
+ Matrix_MtxToMtxF(&this->view.viewing, &this->billboardMtxF);
+ Matrix_MtxToMtxF(&this->view.projection, &this->viewProjectionMtxF);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80167DE4.s")
+ this->projectionMtxFDiagonal.x = this->viewProjectionMtxF.xx;
+ this->projectionMtxFDiagonal.y = this->viewProjectionMtxF.yy;
+ this->projectionMtxFDiagonal.z = -this->viewProjectionMtxF.zz;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80167F0C.s")
+ SkinMatrix_MtxFMtxFMult(&this->viewProjectionMtxF, &this->billboardMtxF, &this->viewProjectionMtxF);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Draw.s")
+ this->billboardMtxF.mf[3][2] = this->billboardMtxF.mf[3][1] = this->billboardMtxF.mf[3][0] =
+ this->billboardMtxF.mf[2][3] = this->billboardMtxF.mf[1][3] = this->billboardMtxF.mf[0][3] = 0.0f;
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80168DAC.s")
+ Matrix_Transpose(&this->billboardMtxF);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Main.s")
+ this->billboardMtx = GRAPH_ALLOC(this->state.gfxCtx, 2 * sizeof(Mtx));
+
+ Matrix_MtxFToMtx(&this->billboardMtxF, this->billboardMtx);
+ Matrix_RotateYF(BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(this)) + 0x8000)), MTXMODE_NEW);
+ Matrix_ToMtx(this->billboardMtx + 1);
+
+ gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx);
+ gSPSegment(POLY_XLU_DISP++, 0x01, this->billboardMtx);
+ gSPSegment(OVERLAY_DISP++, 0x01, this->billboardMtx);
+
+ if (1) {
+ Gfx* sp218;
+ Gfx* sp214 = POLY_OPA_DISP;
+
+ sp218 = Graph_GfxPlusOne(sp214);
+ gSPDisplayList(OVERLAY_DISP++, sp218);
+
+ if (((this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) ||
+ (this->transitionMode == TRANS_TYPE_INSTANT)) ||
+ D_801D0D54) {
+ View spA8;
+
+ View_Init(&spA8, gfxCtx);
+ spA8.flags = 0xA;
+
+ SET_FULLSCREEN_VIEWPORT(&spA8);
+
+ View_ApplyTo(&spA8, &sp218);
+ this->transitionCtx.draw(&this->transitionCtx.instanceData, &sp218);
+ }
+
+ TransitionFade_Draw(&this->unk_18E48, &sp218);
+
+ if (gVisMonoColor.a != 0) {
+ sVisMono.primColor.rgba = gVisMonoColor.rgba;
+ VisMono_Draw(&sVisMono, &sp218);
+ }
+
+ gSPEndDisplayList(sp218++);
+ Graph_BranchDlist(sp214, sp218);
+ POLY_OPA_DISP = sp218;
+ }
+
+ if (gTrnsnUnkState == 3) {
+ Gfx* sp90 = POLY_OPA_DISP;
+
+ TransitionUnk_Draw(&sTrnsnUnk, &sp90);
+ POLY_OPA_DISP = sp90;
+ sp25B = true;
+ goto PostWorldDraw;
+ }
+
+ PreRender_SetValues(&this->pauseBgPreRender, D_801FBBCC, D_801FBBCE, gfxCtx->curFrameBuffer, gfxCtx->zbuffer);
+
+ if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_PROCESS) {
+ MsgEvent_SendNullTask();
+ if (!gSaveContext.screenScaleFlag) {
+ PreRender_ApplyFiltersSlowlyInit(&this->pauseBgPreRender);
+ }
+ R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_READY;
+ SREG(33) |= 1;
+ } else {
+ if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) {
+ Gfx* sp8C = POLY_OPA_DISP;
+
+ if (this->pauseBgPreRender.unk_4D == 2) {
+ func_80170B28(&this->pauseBgPreRender, &sp8C);
+ } else {
+ func_80170798(&this->pauseBgPreRender, &sp8C);
+ }
+
+ gSPDisplayList(sp8C++, D_0E000000.syncSegments);
+ POLY_OPA_DISP = sp8C;
+ sp25B = true;
+ goto PostWorldDraw;
+ }
+
+ if (this->unk_18844 == 0) {
+ if (1) {
+ if (this->skyboxId && !this->envCtx.skyboxDisabled) {
+ if ((this->skyboxId == 1) || (this->skyboxId == 3)) {
+ Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx);
+ SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, this->envCtx.unk_13,
+ this->view.eye.x, this->view.eye.y, this->view.eye.z);
+ } else if (!this->skyboxCtx.skyboxShouldDraw) {
+ SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x,
+ this->view.eye.y, this->view.eye.z);
+ }
+ }
+
+ func_800FE390(this);
+ }
+
+ sp268 = LightContext_NewLights(&this->lightCtx, gfxCtx);
+
+ if (this->roomCtx.curRoom.enablePosLights || (MREG(93) != 0)) {
+ sp268->enablePosLights = true;
+ }
+
+ Lights_BindAll(sp268, this->lightCtx.listHead, NULL, this);
+ Lights_Draw(sp268, gfxCtx);
+
+ if (1) {
+ u32 roomDrawFlags = ((1) ? 1 : 0) | (((void)0, 1) ? 2 : 0); // FAKE:
+
+ Scene_Draw(this);
+ if (this->roomCtx.unk78) {
+ Room_Draw(this, &this->roomCtx.curRoom, roomDrawFlags & 3);
+ Room_Draw(this, &this->roomCtx.prevRoom, roomDrawFlags & 3);
+ }
+ }
+
+ if (this->skyboxCtx.skyboxShouldDraw) {
+ Vec3f sp78;
+
+ if (1) {}
+ Camera_GetQuakeOffset(&sp78, GET_ACTIVE_CAM(this));
+ SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + sp78.x,
+ this->view.eye.y + sp78.y, this->view.eye.z + sp78.z);
+ }
+
+ // envCtx.precipitation[PRECIP_RAIN_CUR]
+ if (this->envCtx.unk_F2[1] != 0) {
+ Environment_DrawRain(this, &this->view, gfxCtx);
+ }
+ }
+
+ if (1) {
+ Environment_FillScreen(gfxCtx, 0, 0, 0, this->bgCoverAlpha, 1);
+ }
+
+ if (1) {
+ Actor_DrawAll(this, &this->actorCtx);
+ }
+
+ if (1) {
+ if (!this->envCtx.sunMoonDisabled) {
+ sp25C.x = this->view.eye.x + this->envCtx.sunPos.x;
+ sp25C.y = this->view.eye.y + this->envCtx.sunPos.y;
+ sp25C.z = this->view.eye.z + this->envCtx.sunPos.z;
+ Environment_DrawSunLensFlare(this, &this->envCtx, &this->view, gfxCtx, sp25C);
+ }
+
+ Environment_DrawCustomLensFlare(this);
+ }
+
+ if (1) {
+ if (R_PLAY_FILL_SCREEN_ON) {
+ Environment_FillScreen(gfxCtx, R_PLAY_FILL_SCREEN_R, R_PLAY_FILL_SCREEN_G, R_PLAY_FILL_SCREEN_B,
+ R_PLAY_FILL_SCREEN_ALPHA, 3);
+ }
+
+ switch (this->envCtx.fillScreen) {
+ case 1:
+ Environment_FillScreen(gfxCtx, this->envCtx.screenFillColor[0], this->envCtx.screenFillColor[1],
+ this->envCtx.screenFillColor[2], this->envCtx.screenFillColor[3], 3);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ if (1) {
+ if (this->envCtx.sandstormState != 0) {
+ Environment_DrawSandstorm(this, this->envCtx.sandstormState);
+ }
+ }
+
+ if (this->worldCoverAlpha != 0) {
+ Environment_FillScreen(gfxCtx, 0, 0, 0, this->worldCoverAlpha, 3);
+ }
+
+ if (1) {
+ DebugDisplay_DrawObjects(this);
+ }
+
+ Play_DrawMotionBlur(this);
+
+ if (((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_SETUP) || (gTrnsnUnkState == 1)) ||
+ (R_PICTO_PHOTO_STATE == PICTO_PHOTO_STATE_SETUP)) {
+ Gfx* sp74;
+ Gfx* sp70 = POLY_OPA_DISP;
+
+ sp74 = Graph_GfxPlusOne(sp70);
+ gSPDisplayList(OVERLAY_DISP++, sp74);
+ this->pauseBgPreRender.fbuf = gfxCtx->curFrameBuffer;
+
+ if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_SETUP) {
+ R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_PROCESS;
+ this->pauseBgPreRender.fbufSave = gfxCtx->zbuffer;
+ this->pauseBgPreRender.cvgSave = this->unk_18E58;
+ } else if (R_PICTO_PHOTO_STATE == PICTO_PHOTO_STATE_SETUP) {
+ R_PICTO_PHOTO_STATE = PICTO_PHOTO_STATE_PROCESS;
+ this->pauseBgPreRender.fbufSave = gfxCtx->zbuffer;
+ this->pauseBgPreRender.cvgSave = this->unk_18E58;
+ } else {
+ gTrnsnUnkState = 2;
+ this->pauseBgPreRender.fbufSave = gfxCtx->zbuffer;
+ this->pauseBgPreRender.cvgSave = NULL;
+ }
+
+ func_801705B4(&this->pauseBgPreRender, &sp74);
+
+ if (this->pauseBgPreRender.cvgSave != NULL) {
+ func_80170730(&this->pauseBgPreRender, &sp74);
+ }
+
+ gSPEndDisplayList(sp74++);
+ Graph_BranchDlist(sp70, sp74);
+ POLY_OPA_DISP = sp74;
+ this->unk_18B49 = 2;
+ SREG(33) |= 1;
+ } else {
+ PostWorldDraw:
+ if (1) {
+ Play_PostWorldDraw(this);
+ }
+ }
+ }
+ }
+
+ if ((this->view.unk164 != 0) && !gDbgCamEnabled) {
+ Vec3s sp4C;
+
+ Camera_Update(&sp4C, GET_ACTIVE_CAM(this));
+ View_UpdateViewingMatrix(&this->view);
+ this->view.unk164 = 0;
+ if ((this->skyboxId != 0) && !this->envCtx.skyboxDisabled) {
+ SkyboxDraw_UpdateMatrix(&this->skyboxCtx, this->view.eye.x, this->view.eye.y, this->view.eye.z);
+ }
+ }
+
+ if (!sp25B) {
+ func_800FE3E0(this);
+ }
+
+ CLOSE_DISPS(this->state.gfxCtx);
+}
+#else
+void Play_DrawMain(PlayState* this);
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_DrawMain.s")
+#endif
+
+void Play_Draw(PlayState* this) {
+ GraphicsContext* gfxCtx = this->state.gfxCtx;
+
+ {
+ GraphicsContext* gfxCtx2 = this->state.gfxCtx;
+
+ if (sBombersNotebookOpen) {
+ if (D_801FBBD4 != 1) {
+ MsgEvent_SendNullTask();
+ func_80178818();
+ gfxCtx2->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx2->framebufferIndex % 2);
+ gfxCtx2->zbuffer = SysCfb_GetZBuffer();
+ gfxCtx2->viMode = D_801FBB88;
+ gfxCtx2->viConfigFeatures = gViConfigFeatures;
+ gfxCtx2->xScale = gViConfigXScale;
+ gfxCtx2->yScale = gViConfigYScale;
+ gfxCtx2->updateViMode = true;
+ }
+ } else {
+ if (D_801FBBD4 != 0) {
+ MsgEvent_SendNullTask();
+ func_80178750();
+ gfxCtx2->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx2->framebufferIndex % 2);
+ gfxCtx2->zbuffer = SysCfb_GetZBuffer();
+ gfxCtx2->viMode = D_801FBB88;
+ gfxCtx2->viConfigFeatures = gViConfigFeatures;
+ gfxCtx2->xScale = gViConfigXScale;
+ gfxCtx2->yScale = gViConfigYScale;
+ gfxCtx2->updateViMode = true;
+ }
+ }
+ }
+
+ if (sBombersNotebookOpen && ((SREG(2) != 2) || (gZBufferPtr == NULL))) {
+ BombersNotebook_Draw(&sBombersNotebook, gfxCtx);
+ Message_Draw(this);
+ } else {
+ Play_DrawMain(this);
+ }
+}
+
+void Play_Main(GameState* thisx) {
+ static Input* prevInput = NULL;
+ PlayState* this = (PlayState*)thisx;
+
+ prevInput = CONTROLLER1(&this->state);
+ DebugDisplay_Init();
+
+ {
+ GraphicsContext* gfxCtx = this->state.gfxCtx;
+
+ if (1) {
+ this->state.gfxCtx = NULL;
+ }
+ Play_Update(this);
+ this->state.gfxCtx = gfxCtx;
+ }
+
+ {
+ Input input = *CONTROLLER1(&this->state);
+
+ if (1) {
+ *CONTROLLER1(&this->state) = D_801F6C18;
+ }
+ Play_Draw(this);
+ *CONTROLLER1(&this->state) = input;
+ }
+
+ ActorCutscene_Update();
+ ActorCutscene_ClearWaiting();
+}
s32 Play_InCsMode(PlayState* this) {
return (this->csCtx.state != 0) || Player_InCsMode(this);
}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169100.s")
+f32 Play_GetFloorSurfaceImpl(PlayState* this, MtxF* mtx, CollisionPoly** poly, s32* bgId, Vec3f* pos) {
+ f32 floorHeight = BgCheck_EntityRaycastFloor3(&this->colCtx, poly, bgId, pos);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801691F0.s")
+ if (floorHeight > BGCHECK_Y_MIN) {
+ func_800C0094(*poly, pos->x, floorHeight, pos->z, mtx);
+ } else {
+ mtx->xy = 0.0f;
+ mtx->zx = 0.0f;
+ mtx->yx = 0.0f;
+ mtx->xx = 0.0f;
+ mtx->wz = 0.0f;
+ mtx->xz = 0.0f;
+ mtx->wy = 0.0f;
+ mtx->wx = 0.0f;
+ mtx->zz = 0.0f;
+ mtx->yz = 0.0f;
+ mtx->zy = 0.0f;
+ mtx->yy = 1.0f;
+ mtx->xw = pos->x;
+ mtx->yw = pos->y;
+ mtx->zw = pos->z;
+ mtx->ww = 1.0f;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_LoadScene.s")
+ return floorHeight;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_8016927C.s")
+void Play_GetFloorSurface(PlayState* this, MtxF* mtx, Vec3f* pos) {
+ CollisionPoly* poly;
+ s32 bgId;
+
+ Play_GetFloorSurfaceImpl(this, mtx, &poly, &bgId, pos);
+}
+
+void* Play_LoadFile(PlayState* this, RomFile* entry) {
+ size_t size = entry->vromEnd - entry->vromStart;
+ void* allocp = THA_AllocEndAlign16(&this->state.heap, size);
+
+ DmaMgr_SendRequest0(allocp, entry->vromStart, size);
+
+ return allocp;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801692C4.s")
+void Play_InitEnvironment(PlayState* this, s16 skyboxId) {
+ Skybox_Init(&this->state, &this->skyboxCtx, skyboxId);
+ Environment_Init(this, &this->envCtx, 0);
+}
+
+void Play_InitScene(PlayState* this, s32 spawn) {
+ this->curSpawn = spawn;
+ this->linkActorEntry = NULL;
+ this->actorCsCamList = NULL;
+ this->setupEntranceList = NULL;
+ this->setupExitList = NULL;
+ this->naviQuestHints = NULL;
+ this->setupPathList = NULL;
+ this->sceneMaterialAnims = NULL;
+ this->roomCtx.unk74 = NULL;
+ this->numSetupActors = 0;
+ Object_InitBank(&this->state, &this->objectCtx);
+ LightContext_Init(this, &this->lightCtx);
+ Door_InitContext(&this->state, &this->doorCtx);
+ Room_Init(this, &this->roomCtx);
+ gSaveContext.worldMapArea = 0;
+ Scene_ProcessHeader(this, this->sceneSegment);
+ Play_InitEnvironment(this, this->skyboxId);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_SceneInit.s")
+void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) {
+ s32 pad;
+ SceneTableEntry* scene = &gSceneTable[sceneId];
+
+ scene->unk_D = 0;
+ this->loadedScene = scene;
+ this->sceneId = sceneId;
+ this->sceneConfig = scene->drawConfig;
+ this->sceneSegment = Play_LoadFile(this, &scene->segment);
+ scene->unk_D = 0;
+ gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
+ Play_InitScene(this, spawn);
+ Room_AllocateAndLoad(this, &this->roomCtx);
+}
void Play_GetScreenPos(PlayState* this, Vec3f* worldPos, Vec3f* screenPos) {
f32 invW;
@@ -379,9 +1888,8 @@ void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams)
Player* player = GET_PLAYER(this);
if (this->sceneId != SCENE_KAKUSIANA) { // Grottos
- Play_SetRespawnData(&this->state, respawnMode, (u16)((void)0, gSaveContext.save.entrance),
- this->roomCtx.curRoom.num, playerParams, &player->actor.world.pos,
- player->actor.shape.rot.y);
+ Play_SetRespawnData(&this->state, respawnMode, ((void)0, gSaveContext.save.entrance), this->roomCtx.curRoom.num,
+ playerParams, &player->actor.world.pos, player->actor.shape.rot.y);
}
}
@@ -405,7 +1913,7 @@ void func_80169EFC(GameState* thisx) {
gSaveContext.respawnFlag = 1;
func_80169ECC(this);
this->transitionTrigger = TRANS_TRIGGER_START;
- this->transitionType = TRANS_TYPE_02;
+ this->transitionType = TRANS_TYPE_FADE_BLACK;
}
// Gameplay_LoadToLastEntrance ?
@@ -417,7 +1925,7 @@ void func_80169F78(GameState* thisx) {
gSaveContext.respawnFlag = -1;
func_80169ECC(this);
this->transitionTrigger = TRANS_TRIGGER_START;
- this->transitionType = TRANS_TYPE_02;
+ this->transitionType = TRANS_TYPE_FADE_BLACK;
}
// Gameplay_TriggerRespawn ?
@@ -476,7 +1984,7 @@ s32 func_8016A02C(GameState* thisx, Actor* actor, s16* yaw) {
/**
* @brief Tests if \p pos is underwater.
*
- * @param[in] play PlayState
+ * @param[in] this PlayState
* @param[in] pos position to test
* @return true if inside a waterbox and not above a void.
*/
@@ -503,8 +2011,7 @@ s32 Play_IsDebugCamEnabled(void) {
}
// A mapping from playerActorCsIds to sGlobalCamDataSettings indices.
-extern s16 D_801D0D64[];
-// s16 D_801D0D64[] = { -3, -2, -4, -5, -7, -11, -8, -9, -6, -16 };
+s16 D_801D0D64[] = { -3, -2, -4, -5, -7, -11, -8, -9, -6, -16 };
// Used by Player
/**
@@ -549,4 +2056,272 @@ void Play_FillScreen(GameState* thisx, s16 fillScreenOn, u8 red, u8 green, u8 bl
R_PLAY_FILL_SCREEN_ALPHA = alpha;
}
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_Init.s")
+void Play_Init(GameState* thisx) {
+ PlayState* this = (PlayState*)thisx;
+ GraphicsContext* gfxCtx = this->state.gfxCtx;
+ s32 pad;
+ uintptr_t zAlloc;
+ s32 zAllocSize;
+ Player* player;
+ s32 i;
+ s32 spawn;
+ u8 sceneLayer;
+ s32 scene;
+
+ if ((gSaveContext.respawnFlag == -4) || (gSaveContext.respawnFlag == -0x63)) {
+ if (CHECK_EVENTINF(EVENTINF_27)) {
+ CLEAR_EVENTINF(EVENTINF_27);
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, DayTelop_Init, sizeof(DayTelopState));
+ return;
+ }
+
+ gSaveContext.unk_3CA7 = 1;
+ if (gSaveContext.respawnFlag == -0x63) {
+ gSaveContext.respawnFlag = 2;
+ }
+ } else {
+ gSaveContext.unk_3CA7 = 0;
+ }
+
+ if (gSaveContext.save.entrance == -1) {
+ gSaveContext.save.entrance = 0;
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState));
+ return;
+ }
+
+ if ((gSaveContext.nextCutsceneIndex == 0xFFEF) || (gSaveContext.nextCutsceneIndex == 0xFFF0)) {
+ scene = ((void)0, gSaveContext.save.entrance) >> 9;
+ spawn = (((void)0, gSaveContext.save.entrance) >> 4) & 0x1F;
+
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_33_80)) {
+ if (scene == ENTR_SCENE_MOUNTAIN_VILLAGE_WINTER) {
+ scene = ENTR_SCENE_MOUNTAIN_VILLAGE_SPRING;
+ } else if (scene == ENTR_SCENE_GORON_VILLAGE_WINTER) {
+ scene = ENTR_SCENE_GORON_VILLAGE_SPRING;
+ } else if (scene == ENTR_SCENE_PATH_TO_GORON_VILLAGE_WINTER) {
+ scene = ENTR_SCENE_PATH_TO_GORON_VILLAGE_SPRING;
+ } else if ((scene == ENTR_SCENE_SNOWHEAD) || (scene == ENTR_SCENE_PATH_TO_SNOWHEAD) ||
+ (scene == ENTR_SCENE_PATH_TO_MOUNTAIN_VILLAGE) || (scene == ENTR_SCENE_GORON_SHRINE) ||
+ (scene == ENTR_SCENE_GORON_RACETRACK)) {
+ gSaveContext.nextCutsceneIndex = 0xFFF0;
+ }
+ }
+
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_02)) {
+ if (scene == ENTR_SCENE_SOUTHERN_SWAMP_POISONED) {
+ scene = ENTR_SCENE_SOUTHERN_SWAMP_CLEARED;
+ } else if (scene == ENTR_SCENE_WOODFALL) {
+ gSaveContext.nextCutsceneIndex = 0xFFF1;
+ }
+ }
+
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_52_20) && (scene == ENTR_SCENE_IKANA_CANYON)) {
+ gSaveContext.nextCutsceneIndex = 0xFFF2;
+ }
+
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_55_80) &&
+ ((scene == ENTR_SCENE_GREAT_BAY_COAST) || (scene == ENTR_SCENE_ZORA_CAPE))) {
+ gSaveContext.nextCutsceneIndex = 0xFFF0;
+ }
+
+ // "First cycle" Termina Field
+ if (INV_CONTENT(ITEM_OCARINA) != ITEM_OCARINA) {
+ if ((scene == ENTR_SCENE_TERMINA_FIELD) &&
+ (((void)0, gSaveContext.save.entrance) != ENTRANCE(TERMINA_FIELD, 10))) {
+ gSaveContext.nextCutsceneIndex = 0xFFF4;
+ }
+ }
+ //! FAKE:
+ gSaveContext.save.entrance =
+ Entrance_Create(((void)0, scene), spawn, ((void)0, gSaveContext.save.entrance) & 0xF);
+ }
+
+ GameState_Realloc(&this->state, 0);
+ KaleidoManager_Init(this);
+ ShrinkWindow_Init();
+ View_Init(&this->view, gfxCtx);
+ func_801A3EC0(0);
+ Quake_Init();
+ Distortion_Init(this);
+
+ for (i = 0; i < ARRAY_COUNT(this->cameraPtrs); i++) {
+ this->cameraPtrs[i] = NULL;
+ }
+
+ Camera_Init(&this->mainCamera, &this->view, &this->colCtx, this);
+ Camera_ChangeStatus(&this->mainCamera, CAM_STATUS_ACTIVE);
+
+ for (i = 0; i < ARRAY_COUNT(this->subCameras); i++) {
+ Camera_Init(&this->subCameras[i], &this->view, &this->colCtx, this);
+ Camera_ChangeStatus(&this->subCameras[i], CAM_STATUS_INACTIVE);
+ }
+
+ this->cameraPtrs[CAM_ID_MAIN] = &this->mainCamera;
+ this->cameraPtrs[CAM_ID_MAIN]->uid = CAM_ID_MAIN;
+ this->activeCamId = CAM_ID_MAIN;
+
+ func_800DFF18(&this->mainCamera, 0x7F);
+ Sram_Alloc(&this->state, &this->sramCtx);
+ Regs_InitData(this);
+ Message_Init(this);
+ GameOver_Init(this);
+ SoundSource_InitAll(this);
+ EffFootmark_Init(this);
+ Effect_Init(this);
+ EffectSS_Init(this, 100);
+ CollisionCheck_InitContext(this, &this->colChkCtx);
+ AnimationContext_Reset(&this->animationCtx);
+ Cutscene_Init(this, &this->csCtx);
+
+ if (gSaveContext.nextCutsceneIndex != 0xFFEF) {
+ gSaveContext.save.cutscene = gSaveContext.nextCutsceneIndex;
+ gSaveContext.nextCutsceneIndex = 0xFFEF;
+ }
+
+ if (gSaveContext.save.cutscene == 0xFFFD) {
+ gSaveContext.save.cutscene = 0;
+ }
+
+ if (gSaveContext.nextDayTime != 0xFFFF) {
+ gSaveContext.save.time = gSaveContext.nextDayTime;
+ gSaveContext.skyboxTime = gSaveContext.nextDayTime;
+ }
+
+ if ((gSaveContext.save.time >= CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 30))) {
+ gSaveContext.save.isNight = true;
+ } else {
+ gSaveContext.save.isNight = false;
+ }
+
+ func_800EDDB0(this);
+
+ if (((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 1)) || (gSaveContext.save.cutscene >= 0xFFF0)) {
+ gSaveContext.unk_3DC0 = 0;
+ Magic_Reset(this);
+ gSaveContext.sceneLayer = (gSaveContext.save.cutscene & 0xF) + 1;
+
+ // Set saved cutscene to 0 so it doesn't immediately play, but instead let the `CutsceneManager` handle it.
+ gSaveContext.save.cutscene = 0;
+ } else {
+ gSaveContext.sceneLayer = 0;
+ }
+
+ sceneLayer = gSaveContext.sceneLayer;
+
+ Play_SpawnScene(
+ this, Entrance_GetSceneIdAbsolute(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneLayer)),
+ Entrance_GetSpawnNum(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneLayer)));
+ KaleidoScopeCall_Init(this);
+ Interface_Init(this);
+
+ if (gSaveContext.nextDayTime != 0xFFFF) {
+ if (gSaveContext.nextDayTime == 0x8000) {
+ gSaveContext.save.day++;
+ gSaveContext.save.daysElapsed++;
+ gSaveContext.dogIsLost = true;
+ gSaveContext.nextDayTime = -2;
+ } else {
+ gSaveContext.nextDayTime = -3;
+ }
+ }
+
+ Play_InitMotionBlur();
+
+ R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF;
+ R_PICTO_PHOTO_STATE = PICTO_PHOTO_STATE_OFF;
+
+ PreRender_Init(&this->pauseBgPreRender);
+ PreRender_SetValuesSave(&this->pauseBgPreRender, D_801FBBCC, D_801FBBCE, NULL, NULL, NULL);
+ PreRender_SetValues(&this->pauseBgPreRender, D_801FBBCC, D_801FBBCE, NULL, NULL);
+
+ this->unk_18E64 = D_801FBB90;
+ this->pictoPhotoI8 = gPictoPhotoI8;
+ this->unk_18E68 = D_80784600;
+ this->unk_18E58 = D_80784600;
+ this->unk_18E60 = D_80784600;
+ gTrnsnUnkState = 0;
+ this->transitionMode = TRANS_MODE_OFF;
+ D_801D0D54 = false;
+
+ FrameAdvance_Init(&this->frameAdvCtx);
+ Rand_Seed(osGetTime());
+ Matrix_Init(&this->state);
+
+ this->state.main = Play_Main;
+ this->state.destroy = Play_Destroy;
+
+ this->transitionTrigger = TRANS_TRIGGER_END;
+ this->worldCoverAlpha = 0;
+ this->bgCoverAlpha = 0;
+ this->haltAllActors = false;
+ this->unk_18844 = false;
+
+ if (gSaveContext.gameMode != 1) {
+ if (gSaveContext.nextTransitionType == TRANS_NEXT_TYPE_DEFAULT) {
+ this->transitionType =
+ (Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entrance) + sceneLayer) >> 7) & 0x7F;
+ } else {
+ this->transitionType = gSaveContext.nextTransitionType;
+ gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT;
+ }
+ } else {
+ this->transitionType = TRANS_TYPE_FADE_BLACK;
+ }
+
+ TransitionFade_Init(&this->unk_18E48);
+ TransitionFade_SetType(&this->unk_18E48, 3);
+ TransitionFade_SetColor(&this->unk_18E48, RGBA8(160, 160, 160, 255));
+ TransitionFade_Start(&this->unk_18E48);
+ VisMono_Init(&sVisMono);
+
+ gVisMonoColor.a = 0;
+ D_801F6D4C = &D_801F6D38;
+ func_80140E80(D_801F6D4C);
+ D_801F6D4C->lodProportion = 0.0f;
+ D_801F6D4C->mode = 1;
+ D_801F6D4C->primColor.r = 0;
+ D_801F6D4C->primColor.g = 0;
+ D_801F6D4C->primColor.b = 0;
+ D_801F6D4C->primColor.a = 0;
+ D_801F6D4C->envColor.r = 0;
+ D_801F6D4C->envColor.g = 0;
+ D_801F6D4C->envColor.b = 0;
+ D_801F6D4C->envColor.a = 0;
+ EnvFlags_UnsetAll(this);
+ THA_GetSize(&this->state.heap);
+ zAllocSize = THA_GetSize(&this->state.heap);
+ zAlloc = (uintptr_t)THA_AllocEndAlign16(&this->state.heap, zAllocSize);
+ ZeldaArena_Init(((zAlloc + 8) & ~0xF), (zAllocSize - ((zAlloc + 8) & ~0xF)) + zAlloc); //! @bug: Incorrect ALIGN16s
+ Actor_InitContext(this, &this->actorCtx, this->linkActorEntry);
+
+ while (!Room_HandleLoadCallbacks(this, &this->roomCtx)) {}
+
+ if ((CURRENT_DAY != 0) && ((this->roomCtx.curRoom.unk3 == 1) || (this->roomCtx.curRoom.unk3 == 5))) {
+ Actor_Spawn(&this->actorCtx, this, ACTOR_EN_TEST4, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0);
+ }
+
+ player = GET_PLAYER(this);
+
+ Camera_InitPlayerSettings(&this->mainCamera, player);
+ gDbgCamEnabled = false;
+
+ if ((player->actor.params & 0xFF) != 0xFF) {
+ Camera_ChangeDataIdx(&this->mainCamera, player->actor.params & 0xFF);
+ }
+
+ func_800F15D8(&this->mainCamera);
+ Interface_SetSceneRestrictions(this);
+ func_800FB758(this);
+ gSaveContext.seqId = this->sequenceCtx.seqId;
+ gSaveContext.ambienceId = this->sequenceCtx.ambienceId;
+ AnimationContext_Update(this, &this->animationCtx);
+ func_800EDBE0(this);
+ gSaveContext.respawnFlag = 0;
+ sBombersNotebookOpen = false;
+ BombersNotebook_Init(&sBombersNotebook);
+}
+
+//! TODO: fake symbol, remove when BombersNotebook_Update is matching
+u16 D_801D0D78[] = { 0, 0, 0, 0 };
diff --git a/src/code/z_play_hireso.c b/src/code/z_play_hireso.c
index e429051c8..829fe71f2 100644
--- a/src/code/z_play_hireso.c
+++ b/src/code/z_play_hireso.c
@@ -16,12 +16,12 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/func_8016EA90.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/func_8016F1A8.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/BombersNotebook_Draw.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/func_8016F4EC.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/func_8016F5A8.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/BombersNotebook_Update.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/func_8016FC78.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/BombersNotebook_Init.s")
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/func_8016FC98.s")
+#pragma GLOBAL_ASM("asm/non_matchings/code/z_play_hireso/BombersNotebook_Destroy.s")
diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c
index d00325224..51b25268b 100644
--- a/src/code/z_player_lib.c
+++ b/src/code/z_player_lib.c
@@ -141,7 +141,7 @@ void func_801229A0(PlayState* play, Player* player) {
OPEN_DISPS(play->state.gfxCtx);
if ((gSaveContext.jinxTimer != 0) || (player->invincibilityTimer > 0)) {
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
}
CLOSE_DISPS(play->state.gfxCtx);
diff --git a/src/code/z_quake.c b/src/code/z_quake.c
index b57012ce1..8a6b9d73a 100644
--- a/src/code/z_quake.c
+++ b/src/code/z_quake.c
@@ -668,7 +668,7 @@ void Distortion_Update(void) {
zScaleFactor = 1.0f;
xyScaleFactor = 1.0f;
speedScaleFactor = 1.0f;
- } else if (sDistortionRequest.type & DISTORTION_TYPE_4) {
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_UNDERWATER_ENTRY) {
if (sDistortionRequest.state == DISTORTION_SETUP) {
countdownMax = sDistortionRequest.countdown;
depthPhase = 0x760;
@@ -690,7 +690,7 @@ void Distortion_Update(void) {
countdownRatio = sDistortionRequest.countdown / (f32)countdownMax;
zScaleFactor = xyScaleFactor = countdownRatio;
speedScaleFactor = 1.0f;
- } else if (sDistortionRequest.type & DISTORTION_TYPE_3) {
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_ZORA_SWIMMING) {
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
@@ -745,7 +745,7 @@ void Distortion_Update(void) {
}
zScaleFactor = -xyScaleFactor;
speedScaleFactor = 1.0f;
- } else if (sDistortionRequest.type & DISTORTION_TYPE_2) {
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_NON_ZORA_SWIMMING) {
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c
index 39f09f1d4..7e15a9bde 100644
--- a/src/code/z_rcp.c
+++ b/src/code/z_rcp.c
@@ -778,19 +778,19 @@ Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f) {
if (n >= 997) {
if (n >= 1000) {
- gSPFogFactor(gfx + 1, 0, 0); // gSPFogPosition(gfx++, ?, ?)
+ gSPFogFactor(&gfx[1], 0, 0); // gSPFogPosition(gfx++, ?, ?)
} else {
- gSPFogFactor(gfx + 1, 0x7FFF, 0x8100); // gSPFogPosition(gfx++, ?, ?)
+ gSPFogFactor(&gfx[1], 0x7FFF, 0x8100); // gSPFogPosition(gfx++, ?, ?)
}
} else {
if (n < 0) {
- gSPFogFactor(gfx + 1, 0, 255); // gSPFogPosition(gfx++, ?, ?)
+ gSPFogFactor(&gfx[1], 0, 255); // gSPFogPosition(gfx++, ?, ?)
} else {
- gSPFogPosition(gfx + 1, n, f);
+ gSPFogPosition(&gfx[1], n, f);
}
}
- return gfx + 2;
+ return &gfx[2];
}
Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f) {
@@ -1299,7 +1299,7 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g
}
void func_8012D374(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
- if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (D_801F6D10 < 2)) {
+ if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTrnsnUnkState < 2)) {
func_8012CF0C(gfxCtx, true, true, r, g, b);
} else {
func_8012CF0C(gfxCtx, false, false, r, g, b);
diff --git a/src/code/z_scene.c b/src/code/z_scene.c
index b70dfb1f5..48c360107 100644
--- a/src/code/z_scene.c
+++ b/src/code/z_scene.c
@@ -149,7 +149,7 @@ void Scene_HeaderCmdSpawnList(PlayState* play, SceneCmd* cmd) {
play->linkActorEntry =
(ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) + play->setupEntranceList[play->curSpawn].spawn;
if ((PLAYER_GET_INITMODE(play->linkActorEntry) == PLAYER_INITMODE_TELESCOPE) ||
- ((gSaveContext.respawnFlag == 0x02) &&
+ ((gSaveContext.respawnFlag == 2) &&
(gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams == PLAYER_PARAMS(0xFF, PLAYER_INITMODE_TELESCOPE)))) {
// Skull Kid Object
Object_Spawn(&play->objectCtx, OBJECT_STK);
@@ -231,7 +231,7 @@ void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) {
}
if (cmd->specialFiles.naviQuestHintFileId != NAVI_QUEST_HINTS_NONE) {
- play->naviQuestHints = Play_LoadScene(play, &naviQuestHintFiles[cmd->specialFiles.naviQuestHintFileId - 1]);
+ play->naviQuestHints = Play_LoadFile(play, &naviQuestHintFiles[cmd->specialFiles.naviQuestHintFileId - 1]);
}
}
@@ -603,5 +603,5 @@ u16 Entrance_Create(s32 scene, s32 spawn, s32 layer) {
* Creates an layer 0 entranace from the current entrance and the given spawn.
*/
u16 Entrance_CreateFromSpawn(s32 spawn) {
- return Entrance_Create(gSaveContext.save.entrance >> 9, spawn, 0);
+ return Entrance_Create((u32)gSaveContext.save.entrance >> 9, spawn, 0);
}
diff --git a/src/code/z_scene_proc.c b/src/code/z_scene_proc.c
index 67f503e58..c899b4d83 100644
--- a/src/code/z_scene_proc.c
+++ b/src/code/z_scene_proc.c
@@ -22,7 +22,7 @@ static Gfx sSceneDrawDefaultDL[] = {
/**
* Executes the current scene draw config handler.
*/
-void Scene_ExecuteDrawConfig(PlayState* play) {
+void Scene_Draw(PlayState* play) {
static void (*sceneDrawConfigHandlers[])(PlayState*) = {
Scene_DrawConfigDefault,
Scene_DrawConfigMatAnim,
diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c
index ed4549966..f80ad551d 100644
--- a/src/code/z_scene_table.c
+++ b/src/code/z_scene_table.c
@@ -1,10 +1,10 @@
#include "global.h"
#define SCENE_ENTRY(name, textId, config) \
- { { SEGMENT_ROM_START(name), SEGMENT_ROM_END(name) }, textId, 0, config, 0 }
+ { { SEGMENT_ROM_START(name), SEGMENT_ROM_END(name) }, textId, 0, config, 0, 0 }
#define SCENE_ENTRY_NONE() \
- { { 0, 0 }, 0, 0, 0, 0 }
+ { { 0, 0 }, 0, 0, 0, 0, 0 }
SceneTableEntry gSceneTable[] = {
/* 0x00 */ SCENE_ENTRY(Z2_20SICHITAI2, 0x0116, SCENE_DRAW_CFG_MAT_ANIM),
diff --git a/src/code/z_snap.c b/src/code/z_snap.c
index 5d37e3eac..d64cfbe6e 100644
--- a/src/code/z_snap.c
+++ b/src/code/z_snap.c
@@ -22,7 +22,7 @@ s32 Snap_RecordPictographedActors(PlayState* play) {
gSaveContext.save.pictoFlags1 = 0;
if (play->sceneId == SCENE_20SICHITAI) {
- Snap_SetFlag(PICTOGRAPH_IN_SWAMP);
+ Snap_SetFlag(PICTO_VALID_IN_SWAMP);
}
for (; category < ACTORCAT_MAX; category++) {
@@ -155,43 +155,43 @@ s32 Snap_ValidatePictograph(PlayState* play, Actor* actor, s32 flag, Vec3f* pos,
// Check distance
distance = OLib_Vec3fDist(pos, &camera->eye);
if ((distance < distanceMin) || (distanceMax < distance)) {
- Snap_SetFlag(PICTOGRAPH_BAD_DISTANCE);
- ret = PICTOGRAPH_BAD_DISTANCE;
+ Snap_SetFlag(PICTO_VALID_BAD_DISTANCE);
+ ret = PICTO_VALID_BAD_DISTANCE;
}
// Check rot is facing camera?
x = Snap_AbsS(Camera_GetCamDirPitch(camera) + rot->x);
y = Snap_AbsS(Camera_GetCamDirYaw(camera) - BINANG_SUB(rot->y, 0x7FFF));
if ((0 < angleRange) && ((angleRange < x) || (angleRange < y))) {
- Snap_SetFlag(PICTOGRAPH_BAD_ANGLE);
- ret |= PICTOGRAPH_BAD_ANGLE;
+ Snap_SetFlag(PICTO_VALID_BAD_ANGLE);
+ ret |= PICTO_VALID_BAD_ANGLE;
}
// Check in capture region
Actor_GetProjectedPos(play, pos, &projectedPos, &distance);
// Convert to projected position to device coordinates, shift to be relative to the capture region's top-left corner
- x = (s16)PROJECTED_TO_SCREEN_X(projectedPos, distance) - PICTO_CAPTURE_REGION_TOPLEFT_X;
- y = (s16)PROJECTED_TO_SCREEN_Y(projectedPos, distance) - PICTO_CAPTURE_REGION_TOPLEFT_Y;
+ x = (s16)PROJECTED_TO_SCREEN_X(projectedPos, distance) - PICTO_VALID_TOPLEFT_X;
+ y = (s16)PROJECTED_TO_SCREEN_Y(projectedPos, distance) - PICTO_VALID_TOPLEFT_Y;
// checks if the coordinates are within the capture region
- if ((x < 0) || (x > PICTO_RESOLUTION_HORIZONTAL) || (y < 0) || (y > PICTO_RESOLUTION_VERTICAL)) {
- Snap_SetFlag(PICTOGRAPH_NOT_IN_VIEW);
- ret |= PICTOGRAPH_NOT_IN_VIEW;
+ if ((x < 0) || (x > PICTO_VALID_WIDTH) || (y < 0) || (y > PICTO_VALID_HEIGHT)) {
+ Snap_SetFlag(PICTO_VALID_NOT_IN_VIEW);
+ ret |= PICTO_VALID_NOT_IN_VIEW;
}
// Check not obscured by bg collision
if (BgCheck_ProjectileLineTest(&play->colCtx, pos, &camera->eye, &projectedPos, &poly, true, true, true, true,
&bgId)) {
- Snap_SetFlag(PICTOGRAPH_BEHIND_BG);
- ret |= PICTOGRAPH_BEHIND_BG;
+ Snap_SetFlag(PICTO_VALID_BEHIND_BG);
+ ret |= PICTO_VALID_BEHIND_BG;
}
// Check not obscured by actor collision
actors[0] = actor;
actors[1] = &GET_PLAYER(play)->actor;
if (CollisionCheck_LineOCCheck(play, &play->colChkCtx, pos, &camera->eye, actors, 2)) {
- Snap_SetFlag(PICTOGRAPH_BEHIND_COLLISION);
- ret |= PICTOGRAPH_BEHIND_COLLISION;
+ Snap_SetFlag(PICTO_VALID_BEHIND_COLLISION);
+ ret |= PICTO_VALID_BEHIND_COLLISION;
}
// If all of the above checks pass, set the flag
diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c
index 907004a7a..f42e66a25 100644
--- a/src/code/z_vr_box.c
+++ b/src/code/z_vr_box.c
@@ -220,7 +220,7 @@ void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId)
// Inverted Stone Tower Temple and Inverted Stone Tower
if ((play->sceneId == SCENE_F41) || (play->sceneId == SCENE_INISIE_R)) {
- skyboxCtx->rotZ = 3.15000009537f;
+ skyboxCtx->rotZ = 3.15f;
}
break;
@@ -288,7 +288,7 @@ void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
}
void Skybox_Init(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) {
- skyboxCtx->skyboxShouldDraw = 0;
+ skyboxCtx->skyboxShouldDraw = false;
skyboxCtx->rotX = skyboxCtx->rotY = skyboxCtx->rotZ = 0.0f;
Skybox_Setup(gameState, skyboxCtx, skyboxId);
diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c
index 88da288f0..e0884e270 100644
--- a/src/code/z_vr_box_draw.c
+++ b/src/code/z_vr_box_draw.c
@@ -63,5 +63,5 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb
CLOSE_DISPS(gfxCtx);
}
-void SkyboxDraw_Noop(SkyboxContext* skyboxCtx) {
+void SkyboxDraw_Update(SkyboxContext* skyboxCtx) {
}
diff --git a/src/libultra/flash/osFlash.c b/src/libultra/flash/osFlash.c
index cd4420c4a..3ed33f45d 100644
--- a/src/libultra/flash/osFlash.c
+++ b/src/libultra/flash/osFlash.c
@@ -1,3 +1,4 @@
+#include "prevent_bss_reordering.h"
#include "ultra64.h"
#include "global.h"
diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c
index 19cafc2bd..032091293 100644
--- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c
+++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c
@@ -328,7 +328,7 @@ void BgCraceMovebg_ClosingDoor_Close(BgCraceMovebg* this, PlayState* play) {
if (Math_StepToF(&this->doorHeight, 0.0f, 1.0f)) {
if (!(this->stateFlags & BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR) &&
!Flags_GetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1)) {
- play->unk_18845 = 1;
+ play->haltAllActors = true;
func_80169FDC(&play->state);
play_sound(NA_SE_OC_ABYSS);
}
diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c
index d6819aa00..45b42942b 100644
--- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c
+++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c
@@ -4,7 +4,6 @@
* Description: Great Bay Temple - Waterwheels, push switches, gear shafts, and whirlpools
*/
-#include "prevent_bss_reordering.h"
#include "z_bg_dblue_movebg.h"
#include "objects/object_dblue_object/object_dblue_object.h"
#include "overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h"
diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c
index 27cecd05a..4561d4049 100644
--- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c
+++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c
@@ -651,7 +651,7 @@ void func_80B814B8(BgIkanaRotaryroom* this, PlayState* play) {
func_800B8E58(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->voiceSfxIdOffset);
func_80169EFC(&play->state);
func_800B8E58(player, NA_SE_VO_LI_TAKEN_AWAY + player->ageProperties->voiceSfxIdOffset);
- play->unk_18845 = 1;
+ play->haltAllActors = true;
play_sound(NA_SE_OC_ABYSS);
this->actionFunc = NULL;
}
diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c
index 4ed78d458..4bfa17c1c 100644
--- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c
+++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c
@@ -251,8 +251,8 @@ void func_809542A0(BgIngate* this, PlayState* play) {
}
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
this->actionFunc = func_80953F8C;
CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40);
Environment_StartTime();
diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c
index f28c3cd34..e5505e92a 100644
--- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c
+++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c
@@ -751,9 +751,9 @@ void func_809DAB78(Boss02* this, PlayState* play) {
this->unk_01BC[this->unk_014E].y = this->actor.world.pos.y;
this->unk_01BC[this->unk_014E].z = this->actor.world.pos.z;
- this->unk_0B1C[this->unk_014E].x = BINANG_TO_RAD(this->actor.world.rot.x);
- this->unk_0B1C[this->unk_014E].y = BINANG_TO_RAD(this->actor.world.rot.y);
- this->unk_0B1C[this->unk_014E].z = BINANG_TO_RAD(this->actor.world.rot.z);
+ this->unk_0B1C[this->unk_014E].x = BINANG_TO_RAD_ALT(this->actor.world.rot.x);
+ this->unk_0B1C[this->unk_014E].y = BINANG_TO_RAD_ALT(this->actor.world.rot.y);
+ this->unk_0B1C[this->unk_014E].z = BINANG_TO_RAD_ALT(this->actor.world.rot.z);
}
if ((this->unk_0144 < 10) && (otherTwinmold->unk_0144 >= 20)) {
@@ -1391,7 +1391,7 @@ void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play2) {
}
SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
spA4 = 0.0f;
spA0 = 0.0f;
@@ -1426,7 +1426,7 @@ void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play2) {
if (sp98 < this->unk_01BC[phi_v0].y) {
gSPDisplayList(POLY_OPA_DISP++, D_809DFA9C[i]);
}
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
}
if (i == 21) {
@@ -1636,7 +1636,7 @@ void func_809DD934(Boss02* this, PlayState* play) {
this->subCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STATUS_WAIT);
Play_ChangeCameraStatus(play, this->subCamId, CAM_STATUS_ACTIVE);
- func_8016566C(150);
+ Play_EnableMotionBlur(150);
this->unk_1D14 = 0;
this->subCamAtVel = 0.0f;
this->unk_1D58 = 0.0f;
@@ -1756,7 +1756,7 @@ void func_809DD934(Boss02* this, PlayState* play) {
this->actor.flags |= ACTOR_FLAG_1;
player->stateFlags1 &= ~PLAYER_STATE1_100;
this->unk_1D70 = 0.01f;
- func_80165690();
+ Play_DisableMotionBlur();
break;
}
diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c
index 4c3b34fbb..f51c94458 100644
--- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c
+++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c
@@ -48,7 +48,6 @@
* - Effect Update/Draw
* - Seaweed
*/
-#include "prevent_bss_reordering.h"
#include "z_boss_03.h"
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
#include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h"
@@ -780,7 +779,7 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) {
player->unk_AE8 = 101;
player->actor.parent = NULL;
player->csMode = PLAYER_CSMODE_0;
- func_80165690();
+ Play_DisableMotionBlur();
}
func_809E344C(this, play);
@@ -852,7 +851,7 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) {
this->unk_25C = 15;
if (this->workTimer[WORK_TIMER_CURRENT_ACTION] == 90) {
- func_8016566C(0x96);
+ Play_EnableMotionBlur(150);
}
SkelAnime_Update(&this->skelAnime);
@@ -908,7 +907,7 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) {
player->unk_AE8 = 101;
player->actor.parent = NULL;
player->csMode = PLAYER_CSMODE_0;
- func_80165690();
+ Play_DisableMotionBlur();
func_800B8D50(play, NULL, 10.0f, this->actor.shape.rot.y, 0.0f, 0x20);
}
@@ -1187,7 +1186,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) {
this->csState = 2;
this->csTimer = 0;
this->unk_240 = 0;
- func_8016566C(0x96);
+ Play_EnableMotionBlur(150);
this->subCamFov = 80.0f;
case 2:
@@ -1280,7 +1279,7 @@ void Boss03_IntroCutscene(Boss03* this, PlayState* play) {
this->actor.speedXZ = -200.0f;
Actor_MoveWithoutGravityReverse(&this->actor);
this->actor.world.pos.y = this->waterHeight - 150.0f;
- func_80165690();
+ Play_DisableMotionBlur();
case 5:
SkelAnime_Update(&this->skelAnime);
@@ -1627,7 +1626,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
Cutscene_End(play, &play->csCtx);
func_800B7298(play, &this->actor, PLAYER_CSMODE_6);
this->csState = 3;
- func_80165690();
+ Play_DisableMotionBlur();
Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_INIT_OLD);
Boss03_PlayUnderwaterSfx(&D_809E9848, NA_SE_EN_KONB_INIT_OLD);
}
@@ -1751,7 +1750,7 @@ void Boss03_SetupStunned(Boss03* this, PlayState* play) {
player->unk_AE8 = 101;
player->actor.parent = NULL;
player->csMode = PLAYER_CSMODE_0;
- func_80165690();
+ Play_DisableMotionBlur();
}
this->unk_240 = 0;
@@ -1903,7 +1902,7 @@ void Boss03_UpdateCollision(Boss03* this, PlayState* play) {
player->unk_AE8 = 101;
player->actor.parent = NULL;
player->csMode = PLAYER_CSMODE_0;
- func_80165690();
+ Play_DisableMotionBlur();
}
continue;
@@ -2270,7 +2269,7 @@ void Boss03_Draw(Actor* thisx, PlayState* play) {
Matrix_Translate(0.0f, -600.0f, 0.0f, MTXMODE_APPLY);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
Boss03_OverrideLimbDraw, Boss03_PostLimbDraw, &this->actor);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
}
this->unk_2BC = 0;
diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c
index 0b59ff9ed..00892063c 100644
--- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c
+++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c
@@ -271,7 +271,7 @@ void func_809EC568(Boss04* this, PlayState* play) {
Math_Vec3f_Copy(&this->subCamEye, &player->actor.world.pos);
this->subCamEye.y += 100.0f;
Math_Vec3f_Copy(&this->subCamAt, &this->actor.world.pos);
- func_8016566C(150);
+ Play_EnableMotionBlur(150);
this->subCamFov = 60.0f;
boss = play->actorCtx.actorLists[ACTORCAT_BOSS].first;
@@ -391,7 +391,7 @@ void func_809EC568(Boss04* this, PlayState* play) {
this->subCamId = SUB_CAM_ID_DONE;
Cutscene_End(play, &play->csCtx);
func_800B7298(play, &this->actor, PLAYER_CSMODE_6);
- func_80165690();
+ Play_DisableMotionBlur();
SET_EVENTINF(EVENTINF_60);
}
break;
@@ -828,7 +828,7 @@ void Boss04_Draw(Actor* thisx, PlayState* play) {
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
Boss04_OverrideLimbDraw, Boss04_PostLimbDraw, &this->actor);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
if (this->actionFunc != func_809EC568) {
func_8012C448(play->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c
index 5dce58c4e..83a920b50 100644
--- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c
+++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c
@@ -220,7 +220,7 @@ void func_809F24C8(Boss06* this, PlayState* play) {
case 1:
if (this->unk_1CA >= 10) {
Math_ApproachF(&this->unk_1E4, 30.0f, 0.2f, 1.0f);
- play->envCtx.fillScreen = 1;
+ play->envCtx.fillScreen = true;
play->envCtx.screenFillColor[2] = 0;
play->envCtx.screenFillColor[1] = 0;
play->envCtx.screenFillColor[0] = 0;
@@ -233,7 +233,7 @@ void func_809F24C8(Boss06* this, PlayState* play) {
}
if (this->unk_1CA >= 60) {
- play->envCtx.fillScreen = 0;
+ play->envCtx.fillScreen = false;
this->unk_1C8 = 0;
this->unk_1DC = 0.0f;
this->unk_1D8 = 0.0f;
diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c
index 4f9d7d702..8233bb0cb 100644
--- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c
+++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c
@@ -1024,9 +1024,9 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
this->deflectCount = 0;
this->maskType = SK_MASK_TYPE_NORMAL;
this->animIndex = SK_ANIM_IDLE;
- this->fogR = play->lightCtx.unk7;
- this->fogG = play->lightCtx.unk8;
- this->fogB = play->lightCtx.unk9;
+ this->fogR = play->lightCtx.fogColor.r;
+ this->fogG = play->lightCtx.fogColor.g;
+ this->fogB = play->lightCtx.fogColor.b;
if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneLayer == 1)) {
this->alpha = 0;
@@ -1594,9 +1594,9 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) {
this->fadeInState++;
}
- this->fogR = play->lightCtx.unk7 * this->fogScale;
- this->fogG = play->lightCtx.unk8 * this->fogScale;
- this->fogB = play->lightCtx.unk9 * this->fogScale;
+ this->fogR = play->lightCtx.fogColor.r * this->fogScale;
+ this->fogG = play->lightCtx.fogColor.g * this->fogScale;
+ this->fogB = play->lightCtx.fogColor.b * this->fogScale;
} else if (this->fadeInState == SK_FADE_IN_STATE_INCREASE_FOG) {
if (this->fogN < 996) {
this->fogN += 10;
@@ -1895,7 +1895,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, this->fogR, this->fogG, this->fogB, this->fogA,
this->fogN, this->fogF);
gSPDisplayList(POLY_OPA_DISP++, gSkullKidMajorasMask1DL);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
} else {
gSPDisplayList(POLY_OPA_DISP++, gSkullKidMajorasMask1DL);
}
diff --git a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c
index ce1cc98f3..13a7e264f 100644
--- a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c
+++ b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c
@@ -158,8 +158,8 @@ s32 func_80C224D8(DmTag* this, PlayState* play) {
play->nextEntrance = ENTRANCE(STOCK_POT_INN, 5);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_02;
- gSaveContext.nextTransitionType = TRANS_TYPE_06;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK_SLOW;
this->unk_1A4++;
break;
}
@@ -172,8 +172,8 @@ s32 func_80C227E8(DmTag* this, PlayState* play) {
play->nextEntrance = ENTRANCE(STOCK_POT_INN, 4);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_02;
- gSaveContext.nextTransitionType = TRANS_TYPE_06;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK_SLOW;
this->unk_1A4++;
}
return false;
diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c
index bc168d534..7ec2245d7 100644
--- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c
+++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c
@@ -410,8 +410,8 @@ void func_808B958C(DoorWarp1* this, PlayState* play) {
this->unk_1D0++;
if ((this->unk_1D0 > 120) && (gSaveContext.nextCutsceneIndex == 0xFFEF)) {
func_808BA10C(this, play);
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
}
Math_SmoothStepToF(&this->unk_1A8, 6.0f, 0.2f, 0.02f, 0.01f);
@@ -705,8 +705,8 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) {
}
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
} else {
switch (phi_v0_2) {
case 0:
@@ -714,14 +714,14 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) {
SET_WEEKEVENTREG(WEEKEVENTREG_07_80);
play->nextEntrance = ENTRANCE(WOODFALL_TEMPLE, 1);
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
} else {
play->nextEntrance = ENTRANCE(WOODFALL, 0);
gSaveContext.nextCutsceneIndex = 0xFFF0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
}
break;
@@ -729,8 +729,8 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) {
SET_WEEKEVENTREG(WEEKEVENTREG_33_80);
play->nextEntrance = ENTRANCE(MOUNTAIN_VILLAGE_SPRING, 7);
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
break;
case 3:
@@ -738,15 +738,15 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) {
play->nextEntrance = ENTRANCE(ZORA_CAPE, 9);
gSaveContext.nextCutsceneIndex = 0xFFF0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
} else {
SET_WEEKEVENTREG(WEEKEVENTREG_55_80);
play->nextEntrance = ENTRANCE(ZORA_CAPE, 8);
gSaveContext.nextCutsceneIndex = 0xFFF0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
}
break;
@@ -755,14 +755,14 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) {
play->nextEntrance = ENTRANCE(IKANA_CANYON, 15);
gSaveContext.nextCutsceneIndex = 0xFFF2;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
break;
}
}
} else if (DOORWARP1_GET_FF00_1(&this->dyna.actor) != 0xFF) {
if (DOORWARP1_GET_FF(&this->dyna.actor) == ENDOORWARP1_FF_6) {
- gSaveContext.respawnFlag = ~1;
+ gSaveContext.respawnFlag = -2;
}
play->nextEntrance = play->setupExitList[DOORWARP1_GET_FF00_3(&this->dyna.actor)];
Scene_SetExitFade(play);
@@ -833,7 +833,7 @@ void func_808BA550(DoorWarp1* this, PlayState* play) {
}
if (this->unk_1D0 > 140) {
- play->envCtx.fillScreen = 1;
+ play->envCtx.fillScreen = true;
temp_f0 = (this->unk_1D0 - 140) / 20.0f;
if (temp_f0 > 1.0f) {
temp_f0 = 1.0f;
diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c
index a6624dc38..84feccbd8 100644
--- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c
+++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c
@@ -677,7 +677,7 @@ void func_809C2788(EnAob01* this, PlayState* play) {
play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1);
gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 3;
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
play->transitionTrigger = TRANS_TRIGGER_START;
}
}
diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c
index bfefb5a85..e87bf9d62 100644
--- a/src/overlays/actors/ovl_En_Az/z_en_az.c
+++ b/src/overlays/actors/ovl_En_Az/z_en_az.c
@@ -151,8 +151,8 @@ void func_80A94AB8(EnAz* this, PlayState* play, s32 spawnIndex) {
play->nextEntrance = Entrance_CreateFromSpawn(spawnIndex);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
}
void func_80A94B20(PlayState* play) {
@@ -1471,7 +1471,7 @@ void func_80A97C4C(EnAz* this, PlayState* play) {
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_80;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
func_80A979DC(this, play);
} else {
Actor_MoveWithGravity(&this->actor);
@@ -1552,8 +1552,8 @@ void func_80A97F9C(EnAz* this, PlayState* play) {
play->nextEntrance = Entrance_CreateFromSpawn(2);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
this->actor.speedXZ = 0.0f;
func_80A979DC(this, play);
} else {
diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
index b995d77ea..1f037a8a8 100644
--- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
+++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
@@ -179,7 +179,7 @@ void EnBigokuta_ShootPlayer(EnBigokuta* this, PlayState* play) {
}
s32 EnBigokuta_ValidatePictograph(PlayState* play, Actor* thisx) {
- return Snap_ValidatePictograph(play, thisx, PICTOGRAPH_BIG_OCTO, &thisx->focus.pos, &thisx->shape.rot, 280.0f,
+ return Snap_ValidatePictograph(play, thisx, PICTO_VALID_BIG_OCTO, &thisx->focus.pos, &thisx->shape.rot, 280.0f,
1800.0f, -1);
}
diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c
index 4a9876c79..da6e8d6d0 100644
--- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c
+++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c
@@ -336,7 +336,7 @@ void func_809C51B4(EnBomBowlMan* this, PlayState* play) {
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_86;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
CLEAR_WEEKEVENTREG(WEEKEVENTREG_75_40);
if (player->transformation == PLAYER_FORM_HUMAN) {
SET_WEEKEVENTREG(WEEKEVENTREG_84_80);
diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c
index 126c293c3..b17079b6e 100644
--- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c
+++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c
@@ -773,7 +773,7 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) {
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_86;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
ActorCutscene_Stop(this->cutscenes[1]);
}
}
diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c
index c0033b103..7e07ed9d6 100644
--- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c
+++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c
@@ -799,7 +799,7 @@ void func_80C02CA4(EnBomjimb* this, PlayState* play) {
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_86;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
}
SET_WEEKEVENTREG(WEEKEVENTREG_75_40);
SET_WEEKEVENTREG(WEEKEVENTREG_83_04);
diff --git a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c
index 63c83f0ea..b3038dd60 100644
--- a/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c
+++ b/src/overlays/actors/ovl_En_Col_Man/z_en_col_man.c
@@ -244,7 +244,7 @@ void func_80AFE4AC(Actor* thisx, PlayState* play) {
func_8012C2DC(play->state.gfxCtx);
func_8012C28C(play->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropRecoveryHeartTex));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -266,7 +266,7 @@ void func_80AFE584(Actor* thisx, PlayState* play) {
void func_80AFE650(Actor* thisx, PlayState* play) {
func_8012C28C(play->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropBombTex));
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c
index 021b94476..4b1087311 100644
--- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c
+++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c
@@ -83,7 +83,7 @@ static AnimationInfoS sAnimationInfo[] = {
};
s32 EnDnq_ValidatePictograph(PlayState* play, Actor* thisx) {
- return Snap_ValidatePictograph(play, thisx, PICTOGRAPH_DEKU_KING, &thisx->focus.pos, &thisx->world.rot, 120.0f,
+ return Snap_ValidatePictograph(play, thisx, PICTO_VALID_DEKU_KING, &thisx->focus.pos, &thisx->world.rot, 120.0f,
480.0f, 0x38E3);
}
diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c
index 714235b17..a8a94d9a4 100644
--- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c
+++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c
@@ -440,8 +440,8 @@ void func_8092D330(EnDns* this, PlayState* play) {
play->nextEntrance = ENTRANCE(DEKU_PALACE, 1);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
}
}
diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c
index 731497436..f115ada7c 100644
--- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c
+++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c
@@ -1453,7 +1453,7 @@ void EnEgol_Draw(Actor* thisx, PlayState* play2) {
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gEyegoreEyeLaserTexAnim));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnEgol_OverrideLimbDraw, EnEgol_PostLimbDraw, &this->actor);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
}
if (this->dmgEffectTimer != 0) {
f32 drawDmgEffAlpha = 0.05f * this->dmgEffectTimer;
diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c
index 32a4b7c82..ea76ef074 100644
--- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c
+++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c
@@ -344,8 +344,8 @@ void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) {
play->nextEntrance = ENTRANCE(CLOCK_TOWER_ROOFTOP, 0);
gSaveContext.nextCutsceneIndex = 0xFFF2;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_02;
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
sGiantsCutsceneState = 9;
}
break;
@@ -784,7 +784,7 @@ void EnFall_LodMoon_Draw(Actor* thisx, PlayState* play) {
gSPDisplayList(POLY_OPA_DISP++, gLodmoonEyesDL);
gSPLoadGeometryMode(POLY_OPA_DISP++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH);
gSPDisplayList(POLY_OPA_DISP++, gLodmoonMoonDL);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
index 6d75abddb..a64e8a947 100644
--- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
+++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c
@@ -3,7 +3,6 @@
* Overlay: ovl_En_Fishing
* Description: Fishing Pond Elements (Owner, Fish, Props, Effects...)
*/
-
#include "prevent_bss_reordering.h"
#include "z_en_fishing.h"
#include "z64rumble.h"
@@ -2169,7 +2168,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) {
if (D_80917204 == 18) {
D_8090CD14 = 1;
sLurePos = sRodTipPos;
- Matrix_RotateYF(BINANG_TO_RAD(player->actor.shape.rot.y), MTXMODE_NEW);
+ Matrix_RotateYF(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW);
sp90.x = 0.0f;
sp90.y = 0.0f;
sp90.z = 25.0f;
@@ -5362,7 +5361,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) {
D_8090CD54 = 1;
Math_ApproachF(&D_80911F64, 71.0f, 0.5f, 3.0f);
- Matrix_RotateYF(BINANG_TO_RAD(player->actor.shape.rot.y), MTXMODE_NEW);
+ Matrix_RotateYF(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW);
sp114.x = Math_SinS(play->gameplayFrames * 0x1000);
sp114.y = D_80911F64;
diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c
index 041cadaa7..f43d24432 100644
--- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c
+++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c
@@ -1448,7 +1448,7 @@ void func_80964950(PlayState* play, EnFuUnkStruct* ptr, s32 len) {
OPEN_DISPS(play->state.gfxCtx);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
for (i = 0; i < len; i++, ptr++) {
diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c
index cbc8511b7..3d4f4bd3d 100644
--- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c
+++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c
@@ -384,10 +384,10 @@ void EnGe1_Update(Actor* thisx, PlayState* play) {
}
s32 EnGe1_ValidatePictograph(PlayState* play, Actor* thisx) {
- s32 ret = Snap_ValidatePictograph(play, thisx, PICTOGRAPH_PIRATE_GOOD, &thisx->focus.pos, &thisx->shape.rot, 10.0f,
+ s32 ret = Snap_ValidatePictograph(play, thisx, PICTO_VALID_PIRATE_GOOD, &thisx->focus.pos, &thisx->shape.rot, 10.0f,
400.0f, -1);
- ret |= Snap_ValidatePictograph(play, thisx, PICTOGRAPH_PIRATE_TOO_FAR, &thisx->focus.pos, &thisx->shape.rot, 10.0f,
+ ret |= Snap_ValidatePictograph(play, thisx, PICTO_VALID_PIRATE_TOO_FAR, &thisx->focus.pos, &thisx->shape.rot, 10.0f,
1200.0f, -1);
return ret;
diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c
index 6f2f3c09c..9704d6204 100644
--- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c
+++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c
@@ -722,8 +722,8 @@ void func_80B51B40(EnGk* this, PlayState* play) {
if (this->unk_31C == 0xE8F) {
play->nextEntrance = ENTRANCE(GORON_RACETRACK, 1);
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
Magic_Add(play, MAGIC_FILL_TO_CAPACITY);
} else {
this->actionFunc = func_80B51760;
diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c
index 93d7e3f88..08133cc63 100644
--- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c
+++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c
@@ -170,7 +170,7 @@ void EnGs_Destroy(Actor* thisx, PlayState* play) {
EnGs* this = THIS;
Collider_DestroyCylinder(play, &this->collider);
- func_80165690();
+ Play_DisableMotionBlur();
}
void func_80997D14(EnGs* this, PlayState* play) {
@@ -902,16 +902,16 @@ void func_80999AC0(EnGs* this) {
void func_80999B34(EnGs* this) {
if (this->unk_216 > 0) {
if (this->unk_218 == 0) {
- func_8016566C(this->unk_216);
+ Play_EnableMotionBlur(this->unk_216);
this->unk_218 = this->unk_216;
} else {
- func_80165658(this->unk_218);
+ Play_SetMotionBlurAlpha(this->unk_218);
}
} else if (this->unk_218 > 0) {
Math_StepToS(&this->unk_218, this->unk_216, 20);
- func_80165658(this->unk_218);
+ Play_SetMotionBlurAlpha(this->unk_218);
if (this->unk_218 <= 0) {
- func_80165690();
+ Play_DisableMotionBlur();
}
}
}
diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c
index e97deee04..e650ef6d3 100644
--- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c
+++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c
@@ -158,14 +158,14 @@ s32 func_808F8EB0(EnHorseGameCheck* this, PlayState* play) {
if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_3) {
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
} else if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_2) {
play->transitionType = TRANS_TYPE_80;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
} else if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_4) {
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_3);
- play->transitionType = TRANS_TYPE_02;
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
}
D_801BDA9C = 0;
diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c
index a51cae556..3a83564e5 100644
--- a/src/overlays/actors/ovl_En_In/z_en_in.c
+++ b/src/overlays/actors/ovl_En_In/z_en_in.c
@@ -820,7 +820,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) {
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_START);
func_800FD750(NA_BGM_HORSE);
play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5);
- play->transitionType = TRANS_TYPE_05;
+ play->transitionType = TRANS_TYPE_FADE_WHITE_FAST;
play->transitionTrigger = TRANS_TRIGGER_START;
SET_WEEKEVENTREG(WEEKEVENTREG_57_01);
break;
@@ -1067,7 +1067,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) {
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_START);
func_800FD750(NA_BGM_HORSE);
play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5);
- play->transitionType = TRANS_TYPE_05;
+ play->transitionType = TRANS_TYPE_FADE_WHITE_FAST;
play->transitionTrigger = TRANS_TRIGGER_START;
SET_WEEKEVENTREG(WEEKEVENTREG_57_01);
break;
diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
index 2c6a15737..f1ebe1bb2 100644
--- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
+++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
@@ -3,7 +3,7 @@
* Overlay: ovl_En_Invadepoh
* Description: Ranch nighttime actors
*/
-
+#include "prevent_bss_reordering.h"
#include "z_en_invadepoh.h"
#include "overlays/actors/ovl_En_Door/z_en_door.h"
#include "objects/gameplay_keep/gameplay_keep.h"
diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c
index 92e918c5d..2db753d01 100644
--- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c
+++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c
@@ -370,7 +370,7 @@ void func_80C144F8(EnJgameTsn* this, PlayState* play) {
play->nextEntrance = ENTRANCE(GREAT_BAY_COAST, 13);
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_80;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
}
void func_80C14540(EnJgameTsn* this) {
diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c
index d36bbb6c3..ecfaa6b8b 100644
--- a/src/overlays/actors/ovl_En_Js/z_en_js.c
+++ b/src/overlays/actors/ovl_En_Js/z_en_js.c
@@ -110,7 +110,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) {
this->actionFunc = func_8096A6F4;
Animation_PlayLoop(&this->skelAnime, &gMoonChildSittingAnim);
- func_8016566C(0x3C);
+ Play_EnableMotionBlur(60);
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_84_20)) {
Inventory_DeleteItem(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY));
@@ -151,7 +151,7 @@ void EnJs_Destroy(Actor* thisx, PlayState* play) {
paramsF = ENJS_GET_TYPE(&this->actor);
switch (paramsF) {
case 0:
- func_80165690();
+ Play_DisableMotionBlur();
break;
case 5:
case 6:
diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c
index da327642b..70ca7313a 100644
--- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c
+++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c
@@ -446,10 +446,10 @@ void EnKaizoku_ChangeAnim(EnKaizoku* this, EnKaizokuAnimation animIndex) {
}
s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor) {
- s32 ret = Snap_ValidatePictograph(play, actor, PICTOGRAPH_PIRATE_GOOD, &actor->focus.pos, &actor->shape.rot, 10.0f,
+ s32 ret = Snap_ValidatePictograph(play, actor, PICTO_VALID_PIRATE_GOOD, &actor->focus.pos, &actor->shape.rot, 10.0f,
400.0f, -1);
- ret |= Snap_ValidatePictograph(play, actor, PICTOGRAPH_PIRATE_TOO_FAR, &actor->focus.pos, &actor->shape.rot, 10.0f,
+ ret |= Snap_ValidatePictograph(play, actor, PICTO_VALID_PIRATE_TOO_FAR, &actor->focus.pos, &actor->shape.rot, 10.0f,
1200.0f, -1);
return ret;
}
diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c
index 0346749a9..3ef617aec 100644
--- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c
+++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c
@@ -813,7 +813,7 @@ void EnKakasi_SetupDanceNightAway(EnKakasi* this) {
this->subCamFovNext = 60.0f;
EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL);
Math_Vec3f_Copy(&this->unk22C, &this->picto.actor.home.pos);
- func_8016566C(0xB4);
+ Play_EnableMotionBlur(180);
this->actionFunc = EnKakasi_DancingNightAway;
}
@@ -917,7 +917,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) {
this->unk204 = 0xA;
if (this->unk190 == 0xE) {
func_800B7298(play, &this->picto.actor, PLAYER_CSMODE_73);
- func_80165690();
+ Play_DisableMotionBlur();
this->unk204 = 0x14;
}
}
diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c
index eaf5ea96a..39d55f7f8 100644
--- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c
+++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c
@@ -4,6 +4,7 @@
* Description: Grass / Bush
*/
+#include "prevent_bss_reordering.h"
#include "z_en_kusa.h"
#include "objects/object_kusa/object_kusa.h"
#include "objects/gameplay_keep/gameplay_keep.h"
diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c
index 626ab3f3b..0f95122d4 100644
--- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c
+++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c
@@ -4,6 +4,7 @@
* Description: Keaton grass
*/
+#include "prevent_bss_reordering.h"
#include "z_en_kusa2.h"
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
#include "objects/gameplay_keep/gameplay_keep.h"
diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c
index f6647cc0b..aafc12b51 100644
--- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c
+++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c
@@ -740,7 +740,7 @@ void func_80AEB148(EnLiftNuts* this, PlayState* play) {
if (player->stateFlags3 & PLAYER_STATE3_200) {
this->actor.speedXZ = 2.0f;
- gSaveContext.eventInf[3] |= 0x10;
+ SET_EVENTINF(EVENTINF_34);
Interface_StartTimer(4, 0);
func_80AE9B4C(1, 2);
Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_FOUND);
@@ -750,7 +750,7 @@ void func_80AEB148(EnLiftNuts* this, PlayState* play) {
void func_80AEB1C8(EnLiftNuts* this) {
this->actor.speedXZ = 2.0f;
- gSaveContext.eventInf[3] |= 0x10;
+ SET_EVENTINF(EVENTINF_34);
Interface_StartTimer(4, 0);
func_80AE9B4C(1, 2);
this->actionFunc = func_80AEB230;
@@ -815,13 +815,13 @@ void func_80AEB428(EnLiftNuts* this, PlayState* play) {
this->textId = 0x27EC;
}
} else if (this->unk_354 == 30) {
- gSaveContext.eventInf[3] &= (u8)~0x10;
+ CLEAR_EVENTINF(EVENTINF_34);
gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance = ENTRANCE(DEKU_SCRUB_PLAYGROUND, 1);
gSaveContext.nextCutsceneIndex = 0;
func_80169EFC(&play->state);
gSaveContext.respawnFlag = -2;
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
}
this->unk_354++;
}
diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c
index 93f33cfed..973e91553 100644
--- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c
+++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c
@@ -666,7 +666,7 @@ void EnMa4_BeginHorsebackGame(EnMa4* this, PlayState* play) {
gSaveContext.nextCutsceneIndex = 0xFFF0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_80;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
}
void EnMa4_HorsebackGameCheckPlayerInteractions(EnMa4* this, PlayState* play) {
@@ -760,10 +760,10 @@ void EnMa4_HorsebackGameEnd(EnMa4* this, PlayState* play) {
if (this->poppedBalloonCounter == 10) {
play->transitionType = TRANS_TYPE_80;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
} else {
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
}
this->poppedBalloonCounter = 0;
@@ -863,7 +863,7 @@ void EnMa4_BeginDescribeThemCs(EnMa4* this, PlayState* play) {
gSaveContext.nextCutsceneIndex = 0xFFF5;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
}
void EnMa4_StartDialogue(EnMa4* this, PlayState* play) {
diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
index c9ba0f34d..fb10d9311 100644
--- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
+++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
@@ -1091,7 +1091,7 @@ void EnMaYto_PostMilkRunEnd(EnMaYto* this, PlayState* play) {
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_80;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
}
void EnMaYto_DefaultStartDialogue(EnMaYto* this, PlayState* play) {
diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c
index 3a72258cc..4a8ce8731 100644
--- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c
+++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c
@@ -390,7 +390,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) {
play_sound(NA_SE_SY_PIECE_OF_HEART);
gSaveContext.gameMode = 2; // Go to FileChoose
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_02;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
play->nextEntrance = ENTRANCE(CUTSCENE, 0);
gSaveContext.save.cutscene = 0;
gSaveContext.sceneLayer = 0;
diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c
index a077ee1bf..7b2dc9db6 100644
--- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c
+++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c
@@ -398,10 +398,10 @@ void EnMttag_RaceFinish(EnMttag* this, PlayState* play) {
if (DECR(this->timer) == 0) {
if (CHECK_EVENTINF(EVENTINF_11)) {
// Player won
- EnMttag_ExitRace(play, TRANS_TYPE_03, TRANS_TYPE_03);
+ EnMttag_ExitRace(play, TRANS_TYPE_FADE_WHITE, TRANS_TYPE_FADE_WHITE);
} else {
// A non-player Goron won
- EnMttag_ExitRace(play, TRANS_TYPE_02, TRANS_TYPE_02);
+ EnMttag_ExitRace(play, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK);
}
Actor_Kill(&this->actor);
@@ -429,8 +429,8 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) {
}
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_02;
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
func_801477B4(play);
func_800B7298(play, &this->actor, PLAYER_CSMODE_7);
Magic_Add(play, MAGIC_FILL_TO_CAPACITY);
@@ -441,7 +441,7 @@ void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) {
CLEAR_EVENTINF(EVENTINF_13);
gSaveContext.eventInf[2] = ((gSaveContext.eventInf[2] & 0xF) + 1) | (gSaveContext.eventInf[2] & 0xF0);
} else {
- EnMttag_ExitRace(play, TRANS_TYPE_02, TRANS_TYPE_02);
+ EnMttag_ExitRace(play, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK);
}
Actor_Kill(&this->actor);
}
@@ -457,7 +457,7 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) {
// Exit the race
func_8019F230();
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF;
- EnMttag_ExitRace(play, TRANS_TYPE_02, TRANS_TYPE_02);
+ EnMttag_ExitRace(play, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK);
CLEAR_EVENTINF(EVENTINF_13);
SET_EVENTINF(EVENTINF_12);
Actor_Kill(&this->actor);
diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c
index 385325080..b5d558a71 100644
--- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c
+++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c
@@ -335,7 +335,7 @@ s32 func_80BC01DC(Actor* thisx, PlayState* play) {
R_PLAY_FILL_SCREEN_ALPHA = (s16)(s32)(255.0f - (((f32)ABS_ALT(20 - this->storyTimer) / 20.0f) * 255.0f));
if (this->storyTimer == 20) {
- if (gSaveContext.eventInf[4] & 4) {
+ if (CHECK_EVENTINF(EVENTINF_42)) {
// play->interfaceCtx.storyType = STORY_TYPE_MASK_FESTIVAL;
play->interfaceCtx.storyType = 0;
} else {
@@ -365,7 +365,7 @@ s32 func_80BC01DC(Actor* thisx, PlayState* play) {
this->behaviour++;
// fallthrough
case ENNB_BEHAVIOUR_5:
- if (!(gSaveContext.eventInf[4] & 4)) {
+ if (!CHECK_EVENTINF(EVENTINF_42)) {
gSaveContext.save.time = CLOCK_TIME(8, 0);
Sram_IncrementDay();
} else {
@@ -376,9 +376,9 @@ s32 func_80BC01DC(Actor* thisx, PlayState* play) {
play->nextEntrance = ENTRANCE(STOCK_POT_INN, 2);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_02;
- gSaveContext.nextTransitionType = TRANS_TYPE_06;
- gSaveContext.eventInf[4] |= 8;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK_SLOW;
+ SET_EVENTINF(EVENTINF_43);
break;
}
@@ -386,7 +386,7 @@ s32 func_80BC01DC(Actor* thisx, PlayState* play) {
}
u8* func_80BC045C(EnNb* this, PlayState* play) {
- if (gSaveContext.eventInf[4] & 8) {
+ if (CHECK_EVENTINF(EVENTINF_43)) {
this->msgEventCallback = func_80BC01DC;
return D_80BC1464;
} else if (this->scheduleResult == EN_NB_SCH_2) {
@@ -586,7 +586,7 @@ s32 func_80BC0B98(EnNb* this, PlayState* play, ScheduleOutput* scheduleOutput) {
}
s32 func_80BC0C0C(EnNb* this, PlayState* play, ScheduleOutput* scheduleOutput) {
- if (!(gSaveContext.eventInf[4] & 8)) {
+ if (!CHECK_EVENTINF(EVENTINF_43)) {
SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_1 | EN_NB_FLAG_2, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4);
} else {
SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_4, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4);
@@ -640,7 +640,7 @@ void EnNb_FollowSchedule(EnNb* this, PlayState* play) {
this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset);
- if (gSaveContext.eventInf[4] & 8) {
+ if (CHECK_EVENTINF(EVENTINF_43)) {
scheduleOutput.result = EN_NB_SCH_1;
EnNb_ProcessScheduleOutput(this, play, &scheduleOutput);
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
@@ -663,9 +663,9 @@ void EnNb_FollowSchedule(EnNb* this, PlayState* play) {
void func_80BC0EAC(EnNb* this, PlayState* play) {
if (func_8010BF58(&this->actor, play, this->msgEventScript, this->msgEventCallback, &this->msgEventArg4)) {
- if (gSaveContext.eventInf[4] & 8) {
- gSaveContext.eventInf[4] &= (u8)~4;
- gSaveContext.eventInf[4] &= (u8)~8;
+ if (CHECK_EVENTINF(EVENTINF_43)) {
+ CLEAR_EVENTINF(EVENTINF_42);
+ CLEAR_EVENTINF(EVENTINF_43);
}
SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_1 | EN_NB_FLAG_2, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4);
@@ -695,11 +695,11 @@ void EnNb_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
this->stateFlags = EN_NB_FLAG_NONE;
- if (gSaveContext.eventInf[4] & 8) {
+ if (CHECK_EVENTINF(EVENTINF_43)) {
SubS_UpdateFlags(&this->stateFlags, EN_NB_FLAG_4, EN_NB_FLAG_1 | EN_NB_FLAG_2 | EN_NB_FLAG_4);
} else {
- gSaveContext.eventInf[4] &= (u8)~4;
- gSaveContext.eventInf[4] &= (u8)~8;
+ CLEAR_EVENTINF(EVENTINF_42);
+ CLEAR_EVENTINF(EVENTINF_43);
}
this->actionFunc = EnNb_FollowSchedule;
diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c
index e2490bb8d..5fa27e026 100644
--- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c
+++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c
@@ -1137,7 +1137,7 @@ void func_80B5E1D8(PlayState* play, EnOtUnkStruct* arg1, s32 arg2) {
OPEN_DISPS(play->state.gfxCtx);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
for (i = 0; i < arg2; i++, arg1++) {
diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c
index 2b0aae48a..bcbb78716 100644
--- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c
+++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c
@@ -691,7 +691,7 @@ void func_80BD9C70(EnPamera* this, PlayState* play) {
play->nextEntrance = ENTRANCE(IKANA_CANYON, 2);
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_70;
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
}
s32 func_80BD9CB8(EnPamera* this, PlayState* play) {
diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c
index d606e17f4..0e1b182e6 100644
--- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c
+++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c
@@ -227,8 +227,8 @@ s32 func_80AE65F4(EnShn* this, PlayState* play) {
s32 func_80AE6704(Actor* thisx, PlayState* play) {
static s32 sPictographFlags[] = {
- PICTOGRAPH_0, PICTOGRAPH_MONKEY, PICTOGRAPH_BIG_OCTO,
- PICTOGRAPH_TINGLE, PICTOGRAPH_DEKU_KING, PICTOGRAPH_IN_SWAMP,
+ PICTO_VALID_0, PICTO_VALID_MONKEY, PICTO_VALID_BIG_OCTO,
+ PICTO_VALID_TINGLE, PICTO_VALID_DEKU_KING, PICTO_VALID_IN_SWAMP,
};
EnShn* this = THIS;
s32 ret = 0;
@@ -263,8 +263,8 @@ s32 func_80AE6704(Actor* thisx, PlayState* play) {
play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 6);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_07;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE_SLOW;
this->unk_2C6++;
break;
}
diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
index 7494695fa..233c6c811 100644
--- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
+++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
@@ -595,7 +595,7 @@ s32 EnSsh_SetCylinderOC(EnSsh* this, PlayState* play) {
Matrix_Push();
Matrix_Translate(colliderPos.x, colliderPos.y, colliderPos.z, MTXMODE_NEW);
- Matrix_RotateYF(BINANG_TO_RAD(this->initialYaw), MTXMODE_APPLY);
+ Matrix_RotateYF(BINANG_TO_RAD_ALT(this->initialYaw), MTXMODE_APPLY);
Matrix_MultVec3f(&colliderOffsets[i], &colliderPos);
Matrix_Pop();
diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c
index d8dd72923..bbc010a2a 100644
--- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c
+++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c
@@ -277,7 +277,7 @@ void func_808D90F0(EnSw* this, s32 arg1, s16 arg2) {
temp = arg2;
}
- Matrix_RotateAxisF(BINANG_TO_RAD(temp), &this->unk_368, MTXMODE_NEW);
+ Matrix_RotateAxisF(BINANG_TO_RAD_ALT(temp), &this->unk_368, MTXMODE_NEW);
Matrix_MultVec3f(&this->unk_350, &sp2C);
Math_Vec3f_Copy(&this->unk_350, &sp2C);
Math3D_CrossProduct(&this->unk_368, &this->unk_350, &this->unk_35C);
diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c
index d991ab323..0e7be15f3 100644
--- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c
+++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c
@@ -458,7 +458,7 @@ void EnTanron3_Draw(Actor* thisx, PlayState* play) {
}
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnTanron3_OverrideLimbDraw, NULL, &this->actor);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
CLOSE_DISPS(play->state.gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c
index dade95ee3..22883d53d 100644
--- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c
+++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c
@@ -1294,7 +1294,7 @@ void EnTest3_Draw(Actor* thisx, PlayState* play2) {
this->player.skelAnime.dListCount, EnTest3_OverrideLimbDraw, EnTest3_PostLimbDraw,
&this->player.actor, 0);
if (this->player.invincibilityTimer > 0) {
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
}
if ((this->player.getItemDrawId - 1) != GID_NONE) {
Player_DrawGetItem(play, &this->player);
diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c
index 1dcb6ccb4..5a6c4573f 100644
--- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c
+++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c
@@ -283,7 +283,7 @@ void func_80A425E4(EnTest4* this, PlayState* play) {
gSaveContext.screenScale = 1000.0f;
}
if (gSaveContext.screenScale != 1000.0f) {
- gSaveContext.screenScaleFlag = 1;
+ gSaveContext.screenScaleFlag = true;
}
}
}
@@ -310,7 +310,7 @@ void EnTest4_Init(Actor* thisx, PlayState* play) {
} else {
sIsLoaded = true;
this->actor.room = -1;
- gSaveContext.screenScaleFlag = 0;
+ gSaveContext.screenScaleFlag = false;
gSaveContext.screenScale = 1000.0f;
if (CURRENT_DAY == 0) {
if (gSaveContext.save.time < CLOCK_TIME(6, 1)) {
@@ -355,7 +355,7 @@ void EnTest4_Init(Actor* thisx, PlayState* play) {
this->lastBellTime = gSaveContext.save.time;
if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) {
- gSaveContext.screenScaleFlag = 0;
+ gSaveContext.screenScaleFlag = false;
gSaveContext.screenScale = 1000.0f;
}
}
@@ -456,7 +456,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
}
gSaveContext.nextCutsceneIndex = 0xFFF1;
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_02;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
player->stateFlags1 |= PLAYER_STATE1_200;
Actor_Kill(&this->actor);
}
diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c
index c0915fce6..6f1c5ac54 100644
--- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c
+++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c
@@ -183,16 +183,16 @@ void func_80A90730(EnTest6* this, PlayState* play) {
}
}
-void func_80A90C08(s16 arg0) {
- func_8016566C(arg0);
+void EnTest6_EnableMotionBlur(s16 alpha) {
+ Play_EnableMotionBlur(alpha);
}
-void func_80A90C34(void) {
- func_80165690();
+void EnTest6_DisableMotionBlur(void) {
+ Play_DisableMotionBlur();
}
void func_80A90C54(PlayState* play, f32 arg1) {
- play->envCtx.fillScreen = 1;
+ play->envCtx.fillScreen = true;
play->envCtx.screenFillColor[0] = 250;
play->envCtx.screenFillColor[1] = 250;
play->envCtx.screenFillColor[2] = 250;
@@ -200,7 +200,7 @@ void func_80A90C54(PlayState* play, f32 arg1) {
}
void func_80A90D20(PlayState* play) {
- play->envCtx.fillScreen = 0;
+ play->envCtx.fillScreen = false;
}
void func_80A90D34(EnTest6* this, PlayState* play, EnTest6Struct* ptr) {
@@ -211,7 +211,7 @@ void func_80A90D34(EnTest6* this, PlayState* play, EnTest6Struct* ptr) {
if (ptr->unk_00 != 0) {
Matrix_Translate(ptr->unk_08 * ptr->unk_04, ptr->unk_0C, ptr->unk_10 * ptr->unk_04, MTXMODE_NEW);
Matrix_Scale(ptr->unk_04 * 0.02f, ptr->unk_04 * 0.02f, ptr->unk_04 * 0.02f, MTXMODE_APPLY);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A9402C[ptr->unk_00]));
@@ -338,8 +338,8 @@ void EnTest6_Destroy(Actor* thisx, PlayState* play2) {
play->envCtx.lightSettings.fogColor[1] = 0;
play->envCtx.lightSettings.fogColor[2] = 0;
play->envCtx.lightSettings.fogNear = 0;
- play->envCtx.lightSettings.fogFar = 0;
- play->envCtx.fillScreen = 0;
+ play->envCtx.lightSettings.zFar = 0;
+ play->envCtx.fillScreen = false;
for (i = 0; i < ARRAY_COUNT(this->lights); i++) {
LightContext_RemoveLight(play, &play->lightCtx, this->lights[i].node);
@@ -393,10 +393,10 @@ void func_80A916F0(EnTest6* this, PlayState* play) {
Player* player = GET_PLAYER(play);
player->actor.freezeTimer = 0;
- play->unk_18844 = 0;
+ play->unk_18844 = false;
ActorCutscene_Stop(play->playerActorCsIds[8]);
func_800B7298(play, NULL, PLAYER_CSMODE_6);
- func_80A90C34();
+ EnTest6_DisableMotionBlur();
Distortion_ClearType(DISTORTION_TYPE_5);
Actor_Kill(&this->actor);
}
@@ -462,10 +462,10 @@ void func_80A91760(EnTest6* this, PlayState* play) {
((subCam->at.z - subCam->eye.z) * 0.2f);
}
}
- func_80A90C08(0x78);
+ EnTest6_EnableMotionBlur(120);
Distortion_SetType(DISTORTION_TYPE_5);
Distortion_SetCountdown(80);
- play->unk_18844 = 1;
+ play->unk_18844 = true;
this->unk_274 = 95;
}
break;
@@ -517,9 +517,9 @@ void func_80A91760(EnTest6* this, PlayState* play) {
if (this->unk_27A == 10) {
this->unk_14C = 0.1f;
- func_80A90C34();
+ EnTest6_DisableMotionBlur();
Distortion_ClearType(DISTORTION_TYPE_5);
- play->unk_18844 = 0;
+ play->unk_18844 = false;
if (this->unk_254 != NULL) {
ZeldaArena_Free(this->unk_254);
}
@@ -614,10 +614,10 @@ void func_80A92118(EnTest6* this, PlayState* play) {
Player* player = GET_PLAYER(play);
player->actor.freezeTimer = 0;
- play->unk_18844 = 0;
+ play->unk_18844 = false;
ActorCutscene_Stop(play->playerActorCsIds[8]);
func_800B7298(play, NULL, PLAYER_CSMODE_6);
- func_80A90C34();
+ EnTest6_DisableMotionBlur();
Distortion_ClearType(DISTORTION_TYPE_5);
Actor_Kill(&this->actor);
}
@@ -657,7 +657,7 @@ void func_80A92188(EnTest6* this, PlayState* play) {
func_800FD5E0(play, &D_80A94070, 1.0f);
func_800FD654(play, &D_80A94068, 1.0f);
func_800FD698(play, D_80A94074, D_80A94078, 1.0f);
- play->unk_18844 = 1;
+ play->unk_18844 = true;
}
if (this->unk_27A == 15) {
@@ -665,7 +665,7 @@ void func_80A92188(EnTest6* this, PlayState* play) {
func_800FD5E0(play, &D_80A94070, 0.0f);
func_800FD654(play, &D_80A94068, 0.0f);
func_800FD698(play, D_80A94074, D_80A94078, 0.0f);
- play->unk_18844 = 0;
+ play->unk_18844 = false;
}
if (this->unk_286 >= 20) {
@@ -673,18 +673,18 @@ void func_80A92188(EnTest6* this, PlayState* play) {
func_800FD5E0(play, &D_80A94070, this->unk_160);
func_800FD654(play, &D_80A94068, this->unk_160);
func_800FD698(play, D_80A94074, D_80A94078, this->unk_160);
- play->unk_18844 = 0;
+ play->unk_18844 = false;
}
func_800B8F98(&player->actor, NA_SE_PL_FLYING_AIR - SFX_FLAG);
switch (this->unk_27A) {
case 119:
- func_80A90C08(0x32);
+ EnTest6_EnableMotionBlur(50);
break;
case 115:
- func_80A90C08(0x14);
+ EnTest6_EnableMotionBlur(20);
Distortion_SetType(DISTORTION_TYPE_5);
Distortion_SetCountdown(90);
this->unk_274 = 2;
@@ -704,24 +704,24 @@ void func_80A92188(EnTest6* this, PlayState* play) {
break;
case 61:
- func_80A90C08(0x96);
+ EnTest6_EnableMotionBlur(150);
this->unk_274 = 4;
break;
case 51:
- func_80A90C08(0xB4);
+ EnTest6_EnableMotionBlur(180);
this->unk_274 = 5;
break;
case 14:
case 15:
- func_80A90C08(0x32);
+ EnTest6_EnableMotionBlur(50);
Distortion_ClearType(DISTORTION_TYPE_5);
this->unk_274 = 0;
break;
case 1:
- func_80A90C34();
+ EnTest6_DisableMotionBlur();
if (CHECK_EVENTINF(EVENTINF_52)) {
this->unk_274 = 9;
}
@@ -976,7 +976,7 @@ void func_80A92950(EnTest6* this, PlayState* play) {
this->unk_276 = 99;
play->transitionTrigger = TRANS_TRIGGER_START;
play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance;
- play->transitionType = TRANS_TYPE_02;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) {
gSaveContext.respawnFlag = -0x63;
SET_EVENTINF(EVENTINF_27);
@@ -1058,7 +1058,7 @@ void func_80A92950(EnTest6* this, PlayState* play) {
this->unk_276 = 99;
play->transitionTrigger = TRANS_TRIGGER_START;
play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance;
- play->transitionType = TRANS_TYPE_02;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
gSaveContext.respawnFlag = 2;
play->msgCtx.ocarinaMode = 4;
}
diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c
index 43facd831..bf0dc785b 100644
--- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c
+++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c
@@ -438,7 +438,7 @@ void func_80AF19A8(EnTest7* this, PlayState* play) {
} else {
ActorCutscene_Start(play->playerActorCsIds[8], NULL);
func_80AF082C(this, func_80AF1A2C);
- play->unk_18844 = 1;
+ play->unk_18844 = true;
}
}
@@ -461,7 +461,7 @@ void func_80AF1A2C(EnTest7* this, PlayState* play) {
func_80AF082C(this, func_80AF1CA0);
this->unk_144 |= 0x20;
Audio_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_PL_WARP_WING_OPEN);
- func_8016566C(0x78);
+ Play_EnableMotionBlur(120);
}
}
@@ -599,10 +599,10 @@ void func_80AF2030(EnTest7* this, PlayState* play) {
R_PLAY_FILL_SCREEN_G = 255;
R_PLAY_FILL_SCREEN_B = 255;
R_PLAY_FILL_SCREEN_ALPHA = 255;
- play->unk_18844 = 0;
+ play->unk_18844 = false;
this->unk_144 &= ~4;
func_80AF082C(this, func_80AF21E8);
- func_80165690();
+ Play_DisableMotionBlur();
}
}
@@ -676,7 +676,7 @@ void func_80AF2350(EnTest7* this, PlayState* play) {
}
play->transitionTrigger = TRANS_TRIGGER_START;
- play->transitionType = TRANS_TYPE_02;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.ambienceId = AMBIENCE_ID_DISABLED;
}
diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c
index 947f97b62..0b7a5c3f3 100644
--- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c
+++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c
@@ -259,7 +259,7 @@ void EnTg_DrawHearts(PlayState* play, EnTgHeartEffect* effect, s32 numEffects) {
OPEN_DISPS(play->state.gfxCtx);
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
for (i = 0; i < numEffects; i++, effect++) {
diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c
index e51af14ae..e5ff4350f 100644
--- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c
+++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c
@@ -394,8 +394,8 @@ void func_80B76BB8(EnTruMt* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) {
if (Message_ShouldAdvance(play)) {
play->nextEntrance = ENTRANCE(TOURIST_INFORMATION, 1);
- play->transitionType = TRANS_TYPE_03;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ play->transitionType = TRANS_TYPE_FADE_WHITE;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
play->transitionTrigger = TRANS_TRIGGER_START;
}
}
diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c
index a9631d96b..5b6f7b978 100644
--- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c
+++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c
@@ -326,12 +326,12 @@ void func_80AE04FC(EnTsn* this, PlayState* play) {
this->actionFunc = func_80AE0704;
if (itemAction == PLAYER_IA_PICTO_BOX) {
if (CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) {
- if (Snap_CheckFlag(PICTOGRAPH_PIRATE_GOOD)) {
+ if (Snap_CheckFlag(PICTO_VALID_PIRATE_GOOD)) {
player->actor.textId = 0x107B;
return;
}
- if (Snap_CheckFlag(PICTOGRAPH_PIRATE_TOO_FAR)) {
+ if (Snap_CheckFlag(PICTO_VALID_PIRATE_TOO_FAR)) {
player->actor.textId = 0x10A9;
return;
}
diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c
index 77b857c14..ef1ae15bc 100644
--- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c
+++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c
@@ -157,7 +157,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) {
} else {
ActorCutscene_StartAndSetUnkLinkFields(play->playerActorCsIds[4], &this->dyna.actor);
func_800B8E58(player, NA_SE_PL_WARP_PLATE);
- func_8016566C(0);
+ Play_EnableMotionBlur(0);
}
} else {
@@ -209,13 +209,13 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) {
// why are we getting player home rotation from the room data? doesnt player have home.rot.y?
// especially because we are converting from deg to binang, but isnt home.rot.y already in binang??
Play_SetRespawnData(
- &play->state, 0, entrance, // parameter 3 is called "sceneSetup"
- play->setupEntranceList[playerSpawnIndex].room, playerParams, &newRespawnPos,
+ &play->state, 0, entrance, play->setupEntranceList[playerSpawnIndex].room, playerParams,
+ &newRespawnPos,
((((playerActorEntry->rot.y >> 7) & 0x1FF) / 180.0f) * 32768.0f)); // DEG_TO_BINANG ?
func_80169EFC(&play->state);
- gSaveContext.respawnFlag = ~0x4;
- func_80165690();
+ gSaveContext.respawnFlag = -5;
+ Play_DisableMotionBlur();
}
}
@@ -224,7 +224,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) {
if (new15E < 0) {
new15E = 0;
}
- func_80165658(new15E * 0.04f); // unknown Play_ function
+ Play_SetMotionBlurAlpha(new15E * (1 / 25.0f));
}
}
diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c
index 94890bd39..983104001 100644
--- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c
+++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c
@@ -570,7 +570,7 @@ void func_80A5A184(Actor* thisx, PlayState* play2) {
}
}
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
CLOSE_DISPS(gfxCtx);
}
diff --git a/src/overlays/actors/ovl_En_Zob/z_en_zob.c b/src/overlays/actors/ovl_En_Zob/z_en_zob.c
index 58dd246d8..fdc6e4789 100644
--- a/src/overlays/actors/ovl_En_Zob/z_en_zob.c
+++ b/src/overlays/actors/ovl_En_Zob/z_en_zob.c
@@ -769,7 +769,7 @@ void EnZob_Draw(Actor* thisx, PlayState* play) {
func_80BA0F64, func_80BA0FAC, &this->actor);
if (this->unk_2F4 & 0x20) {
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
}
CLOSE_DISPS(play->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Zod/z_en_zod.c b/src/overlays/actors/ovl_En_Zod/z_en_zod.c
index 9c7e7e6b5..8d8065ff6 100644
--- a/src/overlays/actors/ovl_En_Zod/z_en_zod.c
+++ b/src/overlays/actors/ovl_En_Zod/z_en_zod.c
@@ -451,7 +451,7 @@ void EnZod_Rehearse(EnZod* this, PlayState* play) {
if (this->actor.cutscene == -1) {
this->actionFunc = EnZod_DoNothing;
play->nextEntrance = play->setupExitList[ENZOD_GET_ENTRANCE_INDEX(&this->actor)];
- play->transitionType = TRANS_TYPE_05;
+ play->transitionType = TRANS_TYPE_FADE_WHITE_FAST;
play->transitionTrigger = TRANS_TRIGGER_START;
gSaveContext.save.weekEventReg[78] &= (u8)~1;
} else {
@@ -645,7 +645,7 @@ void EnZod_Draw(Actor* thisx, PlayState* play) {
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnZod_OverrideLimbDraw, EnZod_PostLimbDraw, &this->actor);
if (this->stateFlags & TIJO_STATE_2) {
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
}
CLOSE_DISPS(play->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c
index ba37c3ffe..72de2024f 100644
--- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c
+++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c
@@ -762,7 +762,7 @@ void EnZos_Draw(Actor* thisx, PlayState* play) {
func_80BBC4E4, func_80BBC500, &this->actor);
if (this->unk_2B6 & 0x40) {
- POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
+ POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP);
}
CLOSE_DISPS(play->state.gfxCtx);
diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c
index 417a6388e..331a153df 100644
--- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c
+++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c
@@ -958,8 +958,8 @@ void func_80B985EC(EnZot* this, PlayState* play) {
if (itemAction > PLAYER_IA_NONE) {
func_801477B4(play);
if ((itemAction == PLAYER_IA_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_PICTOGRAPH) &&
- Snap_CheckFlag(PICTOGRAPH_LULU_HEAD)) {
- if (Snap_CheckFlag(PICTOGRAPH_LULU_RIGHT_ARM) && Snap_CheckFlag(PICTOGRAPH_LULU_LEFT_ARM)) {
+ Snap_CheckFlag(PICTO_VALID_LULU_HEAD)) {
+ if (Snap_CheckFlag(PICTO_VALID_LULU_RIGHT_ARM) && Snap_CheckFlag(PICTO_VALID_LULU_LEFT_ARM)) {
player->actor.textId = 0x12AE;
} else {
player->actor.textId = 0x12AC;
diff --git a/src/overlays/actors/ovl_En_Zov/z_en_zov.c b/src/overlays/actors/ovl_En_Zov/z_en_zov.c
index 851214b5d..27d4e04b1 100644
--- a/src/overlays/actors/ovl_En_Zov/z_en_zov.c
+++ b/src/overlays/actors/ovl_En_Zov/z_en_zov.c
@@ -424,7 +424,7 @@ void func_80BD1DB8(EnZov* this, PlayState* play) {
case 0x1039:
play->nextEntrance = play->setupExitList[ENZOV_GET_FE00(&this->picto.actor)];
- play->transitionType = TRANS_TYPE_05;
+ play->transitionType = TRANS_TYPE_FADE_WHITE_FAST;
play->transitionTrigger = TRANS_TRIGGER_START;
SET_WEEKEVENTREG(WEEKEVENTREG_78_01);
this->actionFunc = func_80BD1D94;
@@ -460,11 +460,11 @@ s32 EnZov_ValidatePictograph(PlayState* play, Actor* thisx) {
s32 ret;
EnZov* this = THIS;
- ret = Snap_ValidatePictograph(play, &this->picto.actor, PICTOGRAPH_LULU_HEAD, &this->picto.actor.focus.pos,
+ ret = Snap_ValidatePictograph(play, &this->picto.actor, PICTO_VALID_LULU_HEAD, &this->picto.actor.focus.pos,
&this->picto.actor.shape.rot, 10.0f, 300.0f, -1);
- ret |= Snap_ValidatePictograph(play, &this->picto.actor, PICTOGRAPH_LULU_RIGHT_ARM, &this->unk_308,
+ ret |= Snap_ValidatePictograph(play, &this->picto.actor, PICTO_VALID_LULU_RIGHT_ARM, &this->unk_308,
&this->picto.actor.shape.rot, 50.0f, 160.0f, 0x3000);
- ret |= Snap_ValidatePictograph(play, &this->picto.actor, PICTOGRAPH_LULU_LEFT_ARM, &this->unk_314,
+ ret |= Snap_ValidatePictograph(play, &this->picto.actor, PICTO_VALID_LULU_LEFT_ARM, &this->unk_314,
&this->picto.actor.shape.rot, 50.0f, 160.0f, 0x3000);
return ret;
}
diff --git a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c
index 3414aaafa..501fb2ee4 100644
--- a/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c
+++ b/src/overlays/actors/ovl_Obj_Grass/z_obj_grass.c
@@ -73,13 +73,13 @@ s32 func_809A9110(PlayState* play, Vec3f* arg1) {
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg1, &sp20, &sp2C);
- if ((play->unk_187F0.z * -130.13191f) < sp20.z) {
+ if ((play->projectionMtxFDiagonal.z * -130.13191f) < sp20.z) {
if (sp2C < 1.0f) {
sp2C = 1.0f;
}
- if (((fabsf(sp20.x) - (130.13191f * play->unk_187F0.x)) < sp2C) &&
- ((fabsf(sp20.y) - (130.13191f * play->unk_187F0.y)) < sp2C)) {
+ if (((fabsf(sp20.x) - (130.13191f * play->projectionMtxFDiagonal.x)) < sp2C) &&
+ ((fabsf(sp20.y) - (130.13191f * play->projectionMtxFDiagonal.y)) < sp2C)) {
return true;
}
}
diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c
index f35d270a0..a861e9e63 100644
--- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c
+++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c
@@ -3,7 +3,7 @@
* Overlay: ovl_Obj_Hunsui
* Description: Switch-Activated Geyser
*/
-
+#include "prevent_bss_reordering.h"
#include "z_obj_hunsui.h"
#include "objects/object_hunsui/object_hunsui.h"
diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c
index 704bc58c3..7d2ed1999 100644
--- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c
+++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c
@@ -452,12 +452,12 @@ void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) {
gSaveContext.respawnFlag = 2;
play->transitionTrigger = TRANS_TRIGGER_START;
play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance;
- play->transitionType = TRANS_TYPE_02;
+ play->transitionType = TRANS_TYPE_FADE_BLACK;
if (gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams ==
PLAYER_PARAMS(0xFF, PLAYER_INITMODE_TELESCOPE)) {
- gSaveContext.nextTransitionType = TRANS_TYPE_21;
+ gSaveContext.nextTransitionType = TRANS_TYPE_CIRCLE;
} else {
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
}
}
this->actionFunc = ObjTokeidai_DoNothing;
diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c
index 2a819b791..c9ac4899c 100644
--- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c
+++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c
@@ -838,7 +838,7 @@ s32 func_80B795A0(PlayState* play, ObjUm* this, s32 arg2) {
D_801BDAA0 = 1;
}
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
play->transitionTrigger = TRANS_TRIGGER_START;
phi_v1 = true;
} else {
@@ -1142,7 +1142,7 @@ void ObjUm_RanchWaitPathFinished(ObjUm* this, PlayState* play) {
ActorCutscene_Stop(this->dyna.actor.cutscene);
play->nextEntrance = ENTRANCE(MILK_ROAD, 5);
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
play->transitionTrigger = TRANS_TRIGGER_START;
} else {
func_80B79524(this);
@@ -1245,7 +1245,7 @@ void func_80B7A2AC(ObjUm* this, PlayState* play) {
case OBJUM_PATH_STATE_FINISH:
play->nextEntrance = ENTRANCE(GORMAN_TRACK, 4);
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
play->transitionTrigger = TRANS_TRIGGER_START;
break;
@@ -1303,14 +1303,14 @@ void ObjUm_RunMinigame(ObjUm* this, PlayState* play) {
if (!this->areAllPotsBroken) {
play->nextEntrance = ENTRANCE(MILK_ROAD, 6);
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
play->transitionTrigger = TRANS_TRIGGER_START;
SET_WEEKEVENTREG(WEEKEVENTREG_52_01);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_02);
} else {
play->nextEntrance = ENTRANCE(ROMANI_RANCH, 8);
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
play->transitionTrigger = TRANS_TRIGGER_START;
SET_WEEKEVENTREG(WEEKEVENTREG_52_02);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_52_01);
@@ -1552,7 +1552,7 @@ void ObjUm_PostMilkRunWaitPathFinished(ObjUm* this, PlayState* play) {
gSaveContext.nextCutsceneIndex = 0xFFF3;
play->nextEntrance = ENTRANCE(TERMINA_FIELD, 0);
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
play->transitionTrigger = TRANS_TRIGGER_START;
gSaveContext.save.time += CLOCK_TIME(1, 0) + 2;
}
diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c
index 184fed3d6..067618491 100644
--- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c
+++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c
@@ -70,7 +70,7 @@ void func_808A7AAC(ObjWturn* this, PlayState* play) {
Vec3f subCamAt;
ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor);
- func_8016566C(140);
+ Play_EnableMotionBlur(140);
this->subCamId = ActorCutscene_GetCurrentSubCamId(this->actor.cutscene);
func_800B7298(play, &this->actor, PLAYER_CSMODE_21);
subCamAt.x = player->actor.focus.pos.x;
@@ -99,7 +99,7 @@ void func_808A7C04(ObjWturn* this, PlayState* play) {
func_800B7298(play, &this->actor, PLAYER_CSMODE_84);
func_800B8E58(player, NA_SE_VO_NAVY_ENEMY);
this->unk_14A = 0;
- func_80165690();
+ Play_DisableMotionBlur();
this->actionFunc = func_808A7C78;
}
@@ -113,7 +113,7 @@ void func_808A7C78(ObjWturn* this, PlayState* play) {
Play_SetCameraAtEyeUp(play, this->subCamId, &player->actor.focus.pos, &subCam->eye, &sSubCamUp);
if (this->unk_14A == 1) {
play->transitionType = TRANS_TYPE_64;
- gSaveContext.nextTransitionType = TRANS_TYPE_03;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
gSaveContext.nextCutsceneIndex = 0;
if (play->sceneId == SCENE_F40) {
play->nextEntrance = ENTRANCE(STONE_TOWER_INVERTED, 0);
diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c
index 93353f28c..c903bac6d 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c
@@ -70,7 +70,7 @@ void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this) {
func_8012C2DC(play->state.gfxCtx);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA);
- func_801691F0(play, &mf, &this->pos);
+ Play_GetFloorSurface(play, &mf, &this->pos);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA);
Matrix_Put(&mf);
Matrix_Scale(radius, radius, radius, MTXMODE_APPLY);
diff --git a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c
index 00e7cfabd..f4f68d230 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c
+++ b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.c
@@ -4,6 +4,7 @@
* Description:
*/
+#include "global.h"
#include "z_fbdemo_triforce.h"
#include "assets/objects/object_fbdemo_triforce/ovl_fbdemo_triforce.c"
diff --git a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h
index 06d807a08..cd7f4563e 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h
+++ b/src/overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h
@@ -1,7 +1,8 @@
#ifndef Z_FBDEMO_TRIFORCE_H
#define Z_FBDEMO_TRIFORCE_H
-#include "global.h"
+#include "ultra64.h"
+#include "color.h"
typedef enum {
/* 0 */ STATE_NONE,
diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c b/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c
index ed12d400e..1ce5f0d59 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c
+++ b/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.c
@@ -4,6 +4,7 @@
* Description:
*/
+#include "global.h"
#include "z_fbdemo_wipe1.h"
void* TransitionWipe1_Init(void* thisx);
diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h b/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h
index 971940bb2..39f881b39 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h
+++ b/src/overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h
@@ -1,10 +1,11 @@
#ifndef Z_FBDEMO_WIPE1_H
#define Z_FBDEMO_WIPE1_H
-#include "global.h"
+#include "ultra64.h"
+#include "color.h"
typedef struct {
- /* 0x0000 */ char unk_0[0x218];
+ /* 0x000 */ char unk_0[0x218];
} TransitionWipe1; // size = 0x218
#endif
diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c
index c33f3c8c7..759e1511c 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c
+++ b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.c
@@ -4,6 +4,7 @@
* Description:
*/
+#include "global.h"
#include "z_fbdemo_wipe3.h"
void* TransitionWipe3_Init(void* thisx);
diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h
index 8fed0dcfe..b023ecb8b 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h
+++ b/src/overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h
@@ -1,10 +1,11 @@
#ifndef Z_FBDEMO_WIPE3_H
#define Z_FBDEMO_WIPE3_H
-#include "global.h"
+#include "ultra64.h"
+#include "color.h"
typedef struct {
- /* 0x0000 */ char unk_0[0x120];
+ /* 0x000 */ char unk_0[0x120];
} TransitionWipe3; // size = 0x120
#endif
diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c
index e91d8ab5e..1acb8c07a 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c
+++ b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.c
@@ -4,6 +4,7 @@
* Description:
*/
+#include "global.h"
#include "z_fbdemo_wipe4.h"
void* TransitionWipe4_Init(void* thisx);
diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h
index 8a677c2a4..b0aec44be 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h
+++ b/src/overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h
@@ -1,10 +1,11 @@
#ifndef Z_FBDEMO_WIPE4_H
#define Z_FBDEMO_WIPE4_H
-#include "global.h"
+#include "ultra64.h"
+#include "color.h"
typedef struct {
- /* 0x0000 */ char unk_0[0x28];
+ /* 0x00 */ char unk_0[0x28];
} TransitionWipe4; // size = 0x28
#endif
diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c
index a4b0cfa74..0c20dba93 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c
+++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.c
@@ -4,6 +4,7 @@
* Description:
*/
+#include "global.h"
#include "z_fbdemo_wipe5.h"
#define THIS ((TransitionWipe5*)thisx)
diff --git a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h
index d5cd9137d..c40c4450a 100644
--- a/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h
+++ b/src/overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h
@@ -1,7 +1,8 @@
#ifndef Z_FBDEMO_WIPE5_H
#define Z_FBDEMO_WIPE5_H
-#include "global.h"
+#include "ultra64.h"
+#include "color.h"
typedef struct {
/* 0x00 */ Color_RGBA8_u32 primColor;
diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c
index 461192d48..183f6b069 100644
--- a/src/overlays/gamestates/ovl_select/z_select.c
+++ b/src/overlays/gamestates/ovl_select/z_select.c
@@ -35,7 +35,7 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) {
if (spawn != 0) {
gSaveContext.save.entrance =
- Entrance_Create((s32)gSaveContext.save.entrance >> 9, spawn, gSaveContext.save.entrance & 0xF);
+ Entrance_Create(gSaveContext.save.entrance >> 9, spawn, gSaveContext.save.entrance & 0xF);
}
if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 0)) {
gSaveContext.save.day = 0;
diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c
index 2b23bf565..e31e31c7d 100644
--- a/src/overlays/gamestates/ovl_title/z_title.c
+++ b/src/overlays/gamestates/ovl_title/z_title.c
@@ -111,7 +111,7 @@ void ConsoleLogo_Draw(GameState* thisx) {
1 << 10, 1 << 10);
}
- func_800FC444(this->state.gfxCtx, 0, 0, 0, this->coverAlpha, 2);
+ Environment_FillScreen(this->state.gfxCtx, 0, 0, 0, this->coverAlpha, 2);
sTitleRotation += 300;
diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h
index 7349db241..849c7020e 100644
--- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h
+++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h
@@ -120,7 +120,7 @@ typedef enum {
/* 0 */ PAUSE_BG_PRERENDER_OFF,
/* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background.
/* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_DRAW, now apply prerender filters.
- /* 3 */ PAUSE_BG_PRERENDER_DONE, // The pause background is ready to be used.
+ /* 3 */ PAUSE_BG_PRERENDER_READY, // The pause background is ready to be used.
/* 4 */ PAUSE_BG_PRERENDER_UNK4,
/* 5 */ PAUSE_BG_PRERENDER_MAX
} PauseBgPreRenderState;
diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c
index 5a47289af..d1c42dd73 100644
--- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c
+++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c
@@ -1144,7 +1144,7 @@ void KaleidoScope_Update(PlayState* play) {
if (pauseCtx->promptChoice == PAUSE_PROMPT_YES) {
func_80169FDC(&play->state);
gSaveContext.respawnFlag = -2;
- gSaveContext.nextTransitionType = TRANS_TYPE_02;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
gSaveContext.save.playerData.health = 0x30;
Audio_SetSpec(0xA);
gSaveContext.healthAccumulator = 0;
@@ -1432,7 +1432,7 @@ void KaleidoScope_Update(PlayState* play) {
}
// Process the Cursor input
- if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_DONE) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) &&
+ if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) &&
!IS_PAUSE_STATE_OWLWARP &&
(((pauseCtx->state >= PAUSE_STATE_OPENING_3) && (pauseCtx->state <= PAUSE_STATE_SAVEPROMPT)) ||
((pauseCtx->state >= PAUSE_STATE_GAMEOVER_2) && (pauseCtx->state <= PAUSE_STATE_UNPAUSE_SETUP)))) {