[Decompilation] [th01] Stage timer: Move all data to C land

Part of P0211, funded by Lmocinemod and Arandui.
This commit is contained in:
nmlgc 2022-08-06 02:40:31 +02:00
parent d29b128915
commit a2200fef28
2 changed files with 21 additions and 19 deletions

View File

@ -28,10 +28,15 @@ extern "C" {
#include "th01/main/stage/stages.hpp"
#include "th01/main/stage/timer.hpp"
extern unsigned int frames_since_harryup;
unsigned int stage_timer;
static unsigned int frames_since_harryup;
// Function ordering fails
// -----------------------
void harryup_animate(void);
void pattern_harryup(void);
// -----------------------
/// Constants
/// ---------
@ -66,9 +71,20 @@ inline void unput(void) {
void timer_init_for(int stage_id, int route)
{
extern unsigned int STAGE_TIMES[
static unsigned int STAGE_TIMES[
STAGES_OUTSIDE_ROUTE + (STAGES_ON_ROUTE * ROUTE_COUNT)
];
] = {
1000, 1000, 1000, 1000, 2000, // Shrine
// Makai
1200, 1200, 1200, 1200, 3000, // (06 - 10)
1400, 1400, 1400, 1400, 4000, // (11 - 15)
1600, 1600, 1600, 600, 6000, // (16 - 20)
// Jigoku
1200, 1200, 1200, 1200, 2000, // (06 - 10)
1400, 1400, 1400, 1400, 4000, // (11 - 15)
1600, 1800, 1800, 1600, 8000, // (16 - 20)
};
if(stage_id < STAGES_OUTSIDE_ROUTE) {
stage_timer = STAGE_TIMES[stage_id];
} else {
@ -184,7 +200,7 @@ void harryup_animate(void)
void pattern_harryup(void)
{
extern unsigned char harryup_cycle;
static unsigned char harryup_cycle;
frames_since_harryup++;
harryup_cycle++;

View File

@ -4893,17 +4893,6 @@ include th01/hardware/grppfnfx_ptrs[data].asm
public _score_prev
_score_prev dd 0
include th01/hardware/grppfnfx[data].asm
public _STAGE_TIMES
_STAGE_TIMES label word
dw 1000, 1000, 1000, 1000, 2000 ; Shrine
; Makai
dw 1200, 1200, 1200, 1200, 3000 ; (06 - 10)
dw 1400, 1400, 1400, 1400, 4000 ; (11 - 15)
dw 1600, 1600, 1600, 600, 6000 ; (16 - 20)
; Jigoku
dw 1200, 1200, 1200, 1200, 2000 ; (06 - 10)
dw 1400, 1400, 1400, 1400, 4000 ; (11 - 15)
dw 1600, 1800, 1800, 1600, 8000 ; (16 - 20)
extern _ptn_sloppy_unput_before_alpha_pu:byte
extern _card_flip_cycle:byte
@ -5044,10 +5033,6 @@ _items_bomb item_t ITEM_BOMB_COUNT dup(<?>)
_items_point item_t ITEM_POINT_COUNT dup(<?>)
include th01/main/hud/hud[bss].asm
public _stage_timer, _frames_since_harryup, _harryup_cycle
_stage_timer dw ?
_frames_since_harryup dw ?
_harryup_cycle db ?
CCards struc
C_left dd ?
@ -5066,6 +5051,7 @@ CObstacles struc
O_count dw ?
CObstacles ends
extern _stage_timer:word
extern _stageobj_bgs:dword
extern _stageobj_bgs_size:dword
extern _cards:CCards