From be6bff6e1200f49508a439763b24e7c506f4ffbd Mon Sep 17 00:00:00 2001 From: MysterD Date: Sun, 27 Sep 2020 23:57:52 -0700 Subject: [PATCH] Reset transition timers when forced to warp (fixes screen flashing) Fixes #50 --- src/game/level_update.c | 4 +++- src/game/screen_transition.c | 5 +++++ src/game/screen_transition.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/game/level_update.c b/src/game/level_update.c index e34dd78f..5336c5a7 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -36,6 +36,8 @@ #include "pc/configfile.h" #include "pc/network/network.h" +#include "game/screen_transition.h" + #define WARP_NODE_F0 0xF0 #define WARP_NODE_DEATH 0xF1 #define WARP_NODE_F2 0xF2 @@ -1006,7 +1008,7 @@ static void check_received_warp(void) { extern s16 gMenuMode; gMenuMode = -1; reset_dialog_render_state(); - gWarpTransition.isActive = FALSE; + reset_screen_transition_timers(); } set_play_mode((sWarpDest.type == WARP_TYPE_CHANGE_LEVEL) diff --git a/src/game/screen_transition.c b/src/game/screen_transition.c index d6656af2..8d464ed8 100644 --- a/src/game/screen_transition.c +++ b/src/game/screen_transition.c @@ -19,6 +19,11 @@ u16 sTransitionTextureFadeCount[2] = { 0 }; static Gfx *sScreenTransitionVerticesPos[2]; static Vtx *sScreenTransitionVertices; +void reset_screen_transition_timers(void) { + memset(sTransitionColorFadeCount, 0, sizeof(u8) * 4); + memset(sTransitionTextureFadeCount, 0, sizeof(u16) * 2); +} + void patch_screen_transition_interpolated(void) { if (sScreenTransitionVerticesPos[0] != NULL) { gSPVertex(sScreenTransitionVerticesPos[0], VIRTUAL_TO_PHYSICAL(sScreenTransitionVertices), 8, 0); diff --git a/src/game/screen_transition.h b/src/game/screen_transition.h index aeee7fc8..e3e9adde 100644 --- a/src/game/screen_transition.h +++ b/src/game/screen_transition.h @@ -21,6 +21,7 @@ enum TextureTransitionType TRANS_TYPE_CLAMP }; +void reset_screen_transition_timers(void); int render_screen_transition(s8 fadeTimer, s8 transType, u8 transTime, struct WarpTransitionData *transData); Gfx *geo_cannon_circle_base(s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx);