[Debloating] [th01] Stage timer: Make initialization less convoluted

Part of P0229, funded by Ember2528.
This commit is contained in:
nmlgc 2023-01-27 23:56:15 +01:00
parent a24b9deab8
commit 6271e32996
3 changed files with 2 additions and 10 deletions

View File

@ -474,9 +474,6 @@ void hud_bg_snap_and_put(void)
graph_accesspage_func(1); hud_bg_put();
graph_accesspage_func(0); hud_bg_put();
if(!timer_initialized) {
timer_init_for((stage_num - 1), route);
}
if(first_stage_in_scene == true) {
lives_bg_snap_and_put();
bombs_bg_snap_and_put();

View File

@ -5,11 +5,7 @@ void hud_score_and_cardcombo_render(void);
// Saves the current VRAM contents for all modified HUD elements if
// [first_stage_in_scene] is true, then redraws the entire HUD.
//
// Also calls timer_init_for() for the current stage and route if
// [timer_initialized] is false. Will not actually set that variable though...
void hud_bg_snap_and_put(void);
extern bool timer_initialized;
// Must be called after every background change. Left as a macro to avoid a
// general dependency on [first_stage_in_scene].

View File

@ -76,7 +76,6 @@ int8_t credit_lives_extra = CFG_CREDIT_LIVES_EXTRA_DEFAULT;
int8_t stage_num = 0;
const shiftjis_t* RANKS[RANK_COUNT] = RANKS_CAPS;
bool timer_initialized = false;
bool first_stage_in_scene = true;
#include "th01/hardware/input_mf.cpp"
@ -694,6 +693,8 @@ int main(void)
} else if(boss_id == BID_SARIEL) {
sariel_entrance(0);
}
timer_init_for((stage_num - 1), route);
hud_bg_snap_and_put();
cardcombo_max = 0;
@ -785,7 +786,6 @@ int main(void)
stage_wait_for_shot_to_begin = false;
input_shot = false;
timer_initialized = true;
srand(frame_rand);
bomb_doubletap_frames = BOMB_DOUBLETAP_WINDOW;
first_stage_in_scene = false;
@ -895,7 +895,6 @@ int main(void)
}
// At this point, the player either lost a life or cleared a
// non-final stage.
timer_initialized = false;
z_vsync_wait_and_scrollup(0);
resident->rand = frame_rand;
test_damage = false;