From 708d9fc8ac2ff2de641fa54e26aed0c08c9e0d59 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Wed, 29 Apr 2020 22:09:31 +0200 Subject: [PATCH] [Maintenance] [th02/th04/th05] Declare more stage and player symbols in C land Part of P0089, funded by [Anonymous] and Blue Bolt. --- th02/main/stage/stage.hpp | 1 + th02_main.asm | 59 +++++++-------- th04/chars.h | 2 + th04/main/play[bss].asm | 11 +++ th04/main/playperf.asm | 12 +-- th04/main/playperf.hpp | 7 ++ th04/main/playperf[bss].asm | 4 - th04/main/rank.hpp | 8 ++ th04/main/stage/stage.hpp | 1 + th04/shared.hpp | 8 -- th04_main.asm | 92 +++++++++++------------ th05/chars.h | 2 + th05/formats/std.asm | 2 +- th05/main/playperf.hpp | 3 + th05/main/playperf_adjust_speed.asm | 1 - th05/main012.cpp | 1 + th05_main.asm | 110 ++++++++++++++-------------- 17 files changed, 170 insertions(+), 154 deletions(-) create mode 100644 th02/main/stage/stage.hpp create mode 100644 th04/main/play[bss].asm create mode 100644 th04/main/playperf.hpp delete mode 100644 th04/main/playperf[bss].asm create mode 100644 th04/main/rank.hpp create mode 100644 th04/main/stage/stage.hpp create mode 100644 th05/main/playperf.hpp diff --git a/th02/main/stage/stage.hpp b/th02/main/stage/stage.hpp new file mode 100644 index 00000000..f61c3510 --- /dev/null +++ b/th02/main/stage/stage.hpp @@ -0,0 +1 @@ +extern char stage_id; diff --git a/th02_main.asm b/th02_main.asm index a6654722..62a27def 100644 --- a/th02_main.asm +++ b/th02_main.asm @@ -1887,7 +1887,7 @@ loc_B1CD: les bx, _resident cmp es:[bx+mikoconfig_t.demo_num], 0 jnz short loc_B237 - mov al, stage_id + mov al, _stage_id cbw cmp ax, 5 jnz short loc_B202 @@ -1946,7 +1946,7 @@ loc_B263: loc_B27A: les bx, _resident - mov al, stage_id + mov al, _stage_id mov es:[bx+mikoconfig_t.stage], al jmp short loc_B290 ; --------------------------------------------------------------------------- @@ -2015,7 +2015,7 @@ loc_B32B: loc_B333: movzx eax, ax mov _score, eax - mov al, stage_id + mov al, _stage_id cbw mov bx, 5 cwd @@ -2088,7 +2088,7 @@ arg_0 = dword ptr 4 mov byte ptr es:[bx+2], 'a' mov byte ptr es:[bx+3], 'g' mov byte ptr es:[bx+4], 'e' - mov al, stage_id + mov al, _stage_id add al, '0' mov es:[bx+5], al mov byte ptr es:[bx+6], '.' @@ -2154,10 +2154,10 @@ var_C = byte ptr -0Ch cmp es:[bx+mikoconfig_t.demo_num], 0 jnz short loc_B4BB mov bgm_show_timer, 1 - mov al, stage_id + mov al, _stage_id add al, al mov _bgm_title_id, al - mov al, stage_id + mov al, _stage_id add al, al inc al mov byte_1F46E, al @@ -2186,20 +2186,20 @@ loc_B4D7: cmp si, 80h jge short loc_B4C5 mov stage1_gaiji_halflen, 6 - mov al, stage_id + mov al, _stage_id cbw mov bx, 5 cwd idiv bx add dl, 0A1h mov gStage1+5, dl - mov al, stage_id + mov al, _stage_id cbw add ax, ax mov bx, ax mov ax, _STAGE_TITLES[bx] mov _stage_title, ax - mov al, stage_id + mov al, _stage_id cbw mov bx, ax mov al, _STAGE_TITLE_HALFLENGTHS[bx] @@ -2273,7 +2273,7 @@ loc_B4D7: call sub_C5B0 mov byte_20342, 1 mov byte_1E500, 4 - mov al, stage_id + mov al, _stage_id cbw mov bx, ax cmp bx, 5 @@ -3016,7 +3016,7 @@ sub_BF9C proc far mov bp, sp cmp byte_1F466, 2 jnz short loc_BFCC - mov al, stage_id + mov al, _stage_id cbw cmp ax, 2 jnz short loc_BFC3 @@ -3049,7 +3049,7 @@ sub_BFD0 proc far cmp byte_1E501, 1 jnz loc_C05B mov byte_1F466, 1 - mov al, stage_id + mov al, _stage_id cbw cmp ax, 3 jnz short loc_BFF8 @@ -3058,7 +3058,7 @@ sub_BFD0 proc far ; --------------------------------------------------------------------------- loc_BFF8: - mov al, stage_id + mov al, _stage_id cbw cmp ax, 2 jnz short loc_C015 @@ -3164,7 +3164,7 @@ demo_load proc far mov es:[bx+mikoconfig_t.frame], 12h cmp es:[bx+mikoconfig_t.demo_num], 1 jnz short loc_C18A - mov stage_id, 3 + mov _stage_id, 3 push ds push offset aDemo1_rec ; "DEMO1.REC" call file_ropen @@ -3177,7 +3177,7 @@ loc_C18A: les bx, _resident cmp es:[bx+mikoconfig_t.demo_num], 2 jnz short loc_C1AE - mov stage_id, 2 + mov _stage_id, 2 push ds push offset aDemo2_rec ; "DEMO2.REC" call file_ropen @@ -3190,7 +3190,7 @@ loc_C1AE: les bx, _resident cmp es:[bx+mikoconfig_t.demo_num], 3 jnz short loc_C1D0 - mov stage_id, 1 + mov _stage_id, 1 push ds push offset aDemo3_rec ; "DEMO3.REC" call file_ropen @@ -3267,7 +3267,7 @@ cfg_load proc near mov word ptr _resident, 0 les bx, _resident mov al, es:[bx+mikoconfig_t.stage] - mov stage_id, al + mov _stage_id, al mov al, es:[bx+mikoconfig_t.start_lives] mov lives, al mov al, es:[bx+mikoconfig_t.start_bombs] @@ -3494,7 +3494,7 @@ loc_C516: mov power, 1 inc es:[bx+mikoconfig_t.continues_used] call sub_DD1B - mov al, stage_id + mov al, _stage_id cbw mov bx, 5 cwd @@ -14654,7 +14654,7 @@ stones_end proc far call sub_1310B call sub_FC53 call sub_E162 - inc stage_id + inc _stage_id pop bp retf stones_end endp @@ -15343,7 +15343,7 @@ var_4 = dword ptr -4 mov word ptr [bp+var_4+2], ds mov word ptr [bp+var_4], 12FBh les bx, [bp+var_4] - mov al, stage_id + mov al, _stage_id add al, 30h ; '0' mov es:[bx+5], al push word ptr [bp+var_4+2] @@ -15899,7 +15899,7 @@ arg_0 = word ptr 4 push si push di mov di, [bp+arg_0] - mov al, stage_id + mov al, _stage_id cbw add ax, ax add ax, di @@ -15918,7 +15918,7 @@ loc_13123: inc si loc_13134: - mov al, stage_id + mov al, _stage_id cbw add ax, ax mov bx, ax @@ -17221,7 +17221,7 @@ rika_end proc far call sub_FC53 call _key_delay call sub_E162 - inc stage_id + inc _stage_id mov word_1EB0A, 0 mov word_1EDA4, 0 pop bp @@ -19830,7 +19830,7 @@ meira_end proc far call sub_FC53 call _key_delay call sub_E162 - inc stage_id + inc _stage_id mov word_1EB0A, 0 pop bp retf @@ -32087,7 +32087,7 @@ marisa_end proc far loc_1C27C: call sub_E162 - inc stage_id + inc _stage_id pop bp locret_1C286: @@ -32302,8 +32302,8 @@ var_2 = word ptr -2 mov word ptr [bp-0Ch], ds mov word ptr [bp+dest+2], 111Ah les bx, [bp+dest+2] - mov al, stage_id - add al, 30h ; '0' + mov al, _stage_id + add al, '0' mov es:[bx+5], al push word ptr [bp-0Ch] push bx @@ -33189,7 +33189,7 @@ loc_1CB0C: mov eax, _score mov [bx+7890h], eax mov bx, [bp+var_2] - mov al, stage_id + mov al, _stage_id inc al mov [bx+7903h], al mov ax, [bp+var_2] @@ -33699,8 +33699,9 @@ include th02/snd/se[data].asm db 0E0h db 0F0h db 0F8h +public _rank, _stage_id _rank db RANK_NORMAL -stage_id db 0 +_stage_id db 0 aHuuma_cfg db 'huuma.cfg',0 include th02/sprites/pellet.asm gBONUS db 0ABh, 0B8h, 0B6h, 0BEh, 0BCh, 0 diff --git a/th04/chars.h b/th04/chars.h index dea130af..ee7ec94f 100644 --- a/th04/chars.h +++ b/th04/chars.h @@ -9,3 +9,5 @@ typedef enum { SHOTTYPE_B = 1, SHOTTYPE_COUNT, } shottype_t; + +extern playchars_t playchar; diff --git a/th04/main/play[bss].asm b/th04/main/play[bss].asm new file mode 100644 index 00000000..eb2e3798 --- /dev/null +++ b/th04/main/play[bss].asm @@ -0,0 +1,11 @@ +public _stage_id, _playperf, _playperf_max, _playperf_min, _playchar +_stage_id db ? +if GAME eq 5 + public _rank + _rank db ? +endif +_playperf db ? +_playperf_max db ? +_playperf_min db ? +_playchar db ? + evendata diff --git a/th04/main/playperf.asm b/th04/main/playperf.asm index 4ba983e5..2b176d40 100644 --- a/th04/main/playperf.asm +++ b/th04/main/playperf.asm @@ -1,5 +1,5 @@ -; void playperf_raise(char delta); -_playperf_raise proc far +public PLAYPERF_RAISE +playperf_raise proc far delta = byte ptr 4 mov bx, sp @@ -12,12 +12,12 @@ delta = byte ptr 4 @@ret: mov _playperf, al retf 2 -_playperf_raise endp +playperf_raise endp even -; void playperf_lower(char delta); -_playperf_lower proc far +public PLAYPERF_LOWER +playperf_lower proc far delta = byte ptr 4 mov bx, sp @@ -30,4 +30,4 @@ delta = byte ptr 4 @@ret: mov _playperf, al retf 2 -_playperf_lower endp +playperf_lower endp diff --git a/th04/main/playperf.hpp b/th04/main/playperf.hpp new file mode 100644 index 00000000..3e377a24 --- /dev/null +++ b/th04/main/playperf.hpp @@ -0,0 +1,7 @@ +// Player performance ("rank") +extern unsigned char playperf; +extern unsigned char playperf_max; +extern char playperf_min; + +void pascal playperf_raise(char delta); +void pascal playperf_lower(char delta); diff --git a/th04/main/playperf[bss].asm b/th04/main/playperf[bss].asm deleted file mode 100644 index d27bcdfc..00000000 --- a/th04/main/playperf[bss].asm +++ /dev/null @@ -1,4 +0,0 @@ -; Player performance ("rank") -_playperf db ? -_playperf_max db ? -_playperf_min db ? diff --git a/th04/main/rank.hpp b/th04/main/rank.hpp new file mode 100644 index 00000000..0903af90 --- /dev/null +++ b/th04/main/rank.hpp @@ -0,0 +1,8 @@ +#include "th01/ranks.h" + +extern unsigned char rank; + +int pascal far select_for_rank( + int for_easy, int for_normal, + int for_hard, int for_lunatic +); diff --git a/th04/main/stage/stage.hpp b/th04/main/stage/stage.hpp new file mode 100644 index 00000000..d808e3d7 --- /dev/null +++ b/th04/main/stage/stage.hpp @@ -0,0 +1 @@ +extern unsigned char stage_id; diff --git a/th04/shared.hpp b/th04/shared.hpp index 3f0892c9..f8742cd9 100644 --- a/th04/shared.hpp +++ b/th04/shared.hpp @@ -12,14 +12,6 @@ #include "th03/math/randring.h" /// ---- -/// Rank -/// ---- -int pascal far select_for_rank( - int for_easy, int for_normal, - int for_hard, int for_lunatic -); -/// ---- - /// Formats /// ------- #include "th03/formats/cdg.h" diff --git a/th04_main.asm b/th04_main.asm index 51efa5ea..52f5a4a5 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -472,7 +472,7 @@ loc_ACDE: or dx, dx jnz short loc_ACF4 push 1 - nopcall _playperf_raise + nopcall playperf_raise jmp short $+2 loc_ACF4: @@ -576,7 +576,7 @@ loc_ADD0: loc_ADD7: mov _playperf, 16 - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_ADEA mov _rank, RANK_EXTRA jmp short loc_ADD0 @@ -675,10 +675,10 @@ sub_AED0 proc near mov vsync_Count2, 0 les bx, _resident mov al, es:[bx+resident_t.stage] - mov stage_id, al - cmp stage_id, 0 + mov _stage_id, al + cmp _stage_id, 0 jz short loc_AEF9 - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_AF4A loc_AEF9: @@ -693,7 +693,7 @@ loc_AEF9: les bx, _resident mov al, es:[bx+resident_t.demo_stage] mov es:[bx+resident_t.stage], al - mov stage_id, al + mov _stage_id, al mov _power, 128 add al, '0' mov es:[bx+resident_t.stage_ascii], al @@ -755,7 +755,7 @@ loc_AFD5: mov al, es:[bx+resident_t.stage_ascii] les bx, off_213E0 mov es:[bx+3], al - mov al, stage_id + mov al, _stage_id mov ah, 0 mov bx, ax cmp bx, 6 @@ -1067,8 +1067,8 @@ EmsSetup proc near ; ZUN symbol [MAGNet2010] mov bp, sp les bx, _resident mov al, es:[bx+resident_t.stage] - mov stage_id, al - cmp stage_id, 6 + mov _stage_id, al + cmp _stage_id, 6 jnz short @@game_is_not_extra mov _rank, RANK_EXTRA jmp short loc_B4AF @@ -2822,9 +2822,9 @@ sub_CF44 proc near jnz short loc_CFB6 cmp _page_back, 1 jnz short loc_CFB6 - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_CF63 - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_CF70 loc_CF63: @@ -2841,11 +2841,11 @@ loc_CF70: mov _boss_update, eax mov ax, _boss_fg_render_func mov _boss_fg_render, ax - mov al, stage_id + mov al, _stage_id add al, al add al, 2 mov _bgm_title_id, al - cmp stage_id, 3 + cmp _stage_id, 3 jnz short loc_CFAC cmp _playchar, PLAYCHAR_REIMU jz short loc_CFAC @@ -3823,7 +3823,7 @@ loc_D7F8: loc_D7FF: cmp si, 8 jl short loc_D7F8 - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_D83A mov si, 8 jmp short loc_D817 @@ -5485,7 +5485,7 @@ sub_E541 proc near var_2 = word ptr -2 enter 2, 0 - cmp stage_id, 5 + cmp _stage_id, 5 jnz short loc_E551 nopcall main_01:end_game_bad @@ -5610,7 +5610,7 @@ var_1 = byte ptr -1 enter 2, 0 push si push di - cmp stage_id, 6 + cmp _stage_id, 6 jz loc_E7D8 xor di, di mov si, 1 @@ -6562,7 +6562,7 @@ loc_EE60: cmp [bp+var_1], 0 jz short locret_EEA3 push 4 - nopcall _playperf_raise + nopcall playperf_raise inc _extends_gained les bx, _resident assume es:nothing @@ -9734,7 +9734,7 @@ loc_109E9: loc_10A16: push 4 - nopcall _playperf_lower + nopcall playperf_lower les bx, _resident assume es:nothing inc es:[bx+resident_t.miss_count] @@ -10211,7 +10211,7 @@ loc_10F80: call _grcg_setmode_rmw_seg1 mov ah, GC_G call _grcg_setcolor_direct_seg1_raw - cmp stage_id, 5 + cmp _stage_id, 5 jnb short loc_10F99 push 150A80h push 0Eh @@ -10255,14 +10255,14 @@ loc_10FED: cmp _popup_byte_unknown, 0 jnz short loc_11057 mov byte_22EF6, 10h - mov al, stage_id + mov al, _stage_id inc al mov _stage_title_id, al - mov al, stage_id + mov al, _stage_id add al, al inc al mov _bgm_title_id, al - cmp stage_id, 0 + cmp _stage_id, 0 jnz short loc_11023 cmp _playchar, PLAYCHAR_REIMU jnz short loc_11023 @@ -10288,10 +10288,10 @@ loc_11057: jb loc_1118F cmp byte_22EF6, 16h jnz loc_11107 - mov al, stage_id + mov al, _stage_id add al, 0A1h mov gStage_1+6, al - cmp stage_id, 5 + cmp _stage_id, 5 jnz short loc_11084 push (17 shl 16) + 11 push ds @@ -10300,7 +10300,7 @@ loc_11057: ; --------------------------------------------------------------------------- loc_11084: - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_11097 push (17 shl 16) + 11 push ds @@ -10350,7 +10350,7 @@ loc_11107: call _grcg_setmode_rmw_seg1 mov ah, GC_G call _grcg_setcolor_direct_seg1_raw - cmp stage_id, 5 + cmp _stage_id, 5 jnb short loc_11120 push 150A80h push 0Eh @@ -13100,11 +13100,11 @@ loc_12C6E: loc_12C84: or si, si jge short loc_12C6E - cmp stage_id, 6 + cmp _stage_id, 6 jz short loc_12CA3 mov al, byte_2CFF2 mov ah, 0 - mov dl, stage_id + mov dl, _stage_id add dl, gb_1_ mov bx, ax mov _hi.score.g_stage[bx], dl @@ -30990,7 +30990,7 @@ loc_1D822: push 1 loc_1D82E: - call _playperf_raise + call playperf_raise jmp short loc_1D854 ; --------------------------------------------------------------------------- @@ -31007,7 +31007,7 @@ loc_1D843: push 1 loc_1D84F: - call _playperf_lower + call playperf_lower loc_1D854: les bx, _resident @@ -31015,20 +31015,20 @@ loc_1D854: call sub_EFA1 les bx, _resident mov al, es:[bx+resident_t.miss_count] - cmp al, stage_id + cmp al, _stage_id ja short loc_1D876 - call _playperf_raise pascal, 2 + call playperf_raise pascal, 2 loc_1D876: les bx, _resident mov al, es:[bx+resident_t.bombs_used] mov ah, 0 - mov dl, stage_id + mov dl, _stage_id mov dh, 0 add dx, dx cmp ax, dx jg short loc_1D893 - call _playperf_raise pascal, 2 + call playperf_raise pascal, 2 loc_1D893: pop si @@ -31420,7 +31420,7 @@ loc_1DD35: ; --------------------------------------------------------------------------- loc_1DD47: - call _playperf_raise pascal, 3 + call playperf_raise pascal, 3 les bx, _resident inc es:[bx+resident_t.rem_lives] call sub_EEE8 @@ -31473,7 +31473,7 @@ loc_1DDC9: mov al, byte_23660 add al, 0E0h mov byte_23660, al - call _playperf_raise pascal, 1 + call playperf_raise pascal, 1 loc_1DDDF: inc _items_collected @@ -31540,7 +31540,7 @@ loc_1DE2F: push 4 loc_1DE31: - call _playperf_lower + call playperf_lower loc_1DE36: cmp byte_23661, 40h @@ -31548,7 +31548,7 @@ loc_1DE36: mov al, byte_23661 add al, 0D0h mov byte_23661, al - call _playperf_lower pascal, 1 + call playperf_lower pascal, 1 loc_1DE4C: pop si @@ -32227,9 +32227,9 @@ loc_1E7B5: les bx, _resident mov ax, _stage_graze add es:[bx+resident_t.graze], ax - cmp stage_id, 5 + cmp _stage_id, 5 jz loc_1E8AE - cmp stage_id, 4 + cmp _stage_id, 4 jnz short loc_1E801 cmp _continues_used, 0 jnz short loc_1E7F2 @@ -32242,7 +32242,7 @@ loc_1E7F2: call end_game_bad loc_1E801: - cmp stage_id, 6 + cmp _stage_id, 6 jnz loc_1E8A4 call super_clean pascal, (128 shl 16) or 256 call sub_D6EB @@ -32292,14 +32292,14 @@ loc_1E8AE: loc_1E8B3: cmp _boss_phase_frame, 416 jnz short loc_1E8E5 - cmp stage_id, 5 + cmp _stage_id, 5 jnz short loc_1E8C9 call end_game_good jmp short loc_1E8D5 ; --------------------------------------------------------------------------- loc_1E8C9: - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_1E8D5 call end_extra @@ -36760,11 +36760,7 @@ include th04/main/frames[bss].asm word_266D0 dw ? byte_266D2 db ? include th03/hardware/palette_changed[bss].asm -stage_id db ? -include th04/main/playperf[bss].asm -public _playchar -_playchar db ? - db ? +include th04/main/play[bss].asm include th04/main/drawpoint[bss].asm include th04/main/ems[bss].asm _turbo_mode db ? diff --git a/th05/chars.h b/th05/chars.h index da27ba54..d02df4c6 100644 --- a/th05/chars.h +++ b/th05/chars.h @@ -5,3 +5,5 @@ typedef enum { PLAYCHAR_YUUKA = 3, PLAYCHAR_COUNT = 4 } playchars_t; + +extern playchars_t playchar; diff --git a/th05/formats/std.asm b/th05/formats/std.asm index 07bacbac..c1d5715c 100644 --- a/th05/formats/std.asm +++ b/th05/formats/std.asm @@ -8,7 +8,7 @@ std_load proc near push di push ds call std_free - mov al, stage_id + mov al, _stage_id add al, '0' mov byte ptr _std_fn+3, al mov dx, offset _std_fn diff --git a/th05/main/playperf.hpp b/th05/main/playperf.hpp new file mode 100644 index 00000000..c42d8bc5 --- /dev/null +++ b/th05/main/playperf.hpp @@ -0,0 +1,3 @@ +#include "th04/main/playperf.hpp" + +unsigned char __fastcall playperf_adjust_speed(unsigned char speed); diff --git a/th05/main/playperf_adjust_speed.asm b/th05/main/playperf_adjust_speed.asm index bdeb93c9..84f5f7db 100644 --- a/th05/main/playperf_adjust_speed.asm +++ b/th05/main/playperf_adjust_speed.asm @@ -1,4 +1,3 @@ -; unsigned char __fastcall playperf_adjust_speed(unsigned char speed) public @playperf_adjust_speed @playperf_adjust_speed proc near shr al, 1 diff --git a/th05/main012.cpp b/th05/main012.cpp index 4300cb94..1c2d8e17 100644 --- a/th05/main012.cpp +++ b/th05/main012.cpp @@ -7,6 +7,7 @@ extern "C" { #include "th05/th05.hpp" +#include "th04/main/rank.hpp" #include "th04/main/item/items.hpp" void pascal far nullsub_1(void); diff --git a/th05_main.asm b/th05_main.asm index 6055855e..f26d773c 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -544,7 +544,7 @@ loc_B003: test _stage_frame, 0FFFh jnz short loc_B055 push 1 - nopcall _playperf_raise + nopcall playperf_raise jmp short $+2 loc_B055: @@ -646,7 +646,7 @@ loc_B13E: loc_B145: mov _playperf, 32 - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_B15D loc_B151: @@ -750,10 +750,10 @@ sub_B237 proc near mov vsync_Count2, 0 les bx, _resident mov al, es:[bx+resident_t.stage] - mov stage_id, al - cmp stage_id, 0 + mov _stage_id, al + cmp _stage_id, 0 jz short loc_B260 - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_B2DD loc_B260: @@ -767,7 +767,7 @@ loc_B260: mov al, es:[bx+resident_t.debug_stage] mov es:[bx+resident_t.stage], al mov al, es:[bx+resident_t.stage] - mov stage_id, al + mov _stage_id, al mov al, es:[bx+resident_t.debug_power] mov _power, al mov es:[bx+resident_t.debug_mode], 0 @@ -781,7 +781,7 @@ loc_B2A5: les bx, _resident mov al, es:[bx+resident_t.demo_stage] mov es:[bx+resident_t.stage], al - mov stage_id, al + mov _stage_id, al cmp es:[bx+resident_t.demo_num], 5 jz short loc_B2CE mov _power, 128 @@ -910,7 +910,7 @@ loc_B3C5: loc_B3CA: nopcall sub_BF27 mov _pellet_bottom_col, GC_RG - mov al, stage_id + mov al, _stage_id mov ah, 0 mov bx, ax cmp bx, 6 @@ -1027,7 +1027,7 @@ loc_B4BB: loc_B506: les bx, off_20A86 mov byte ptr es:[bx+2], 30h ; '0' - mov al, stage_id + mov al, _stage_id add al, 30h ; '0' mov es:[bx+3], al push word ptr off_20A86+2 @@ -1246,8 +1246,8 @@ EmsSetup proc near ; ZUN symbol [MAGNet2010] mov bp, sp les bx, _resident mov al, es:[bx+resident_t.stage] - mov stage_id, al - cmp stage_id, 6 + mov _stage_id, al + cmp _stage_id, 6 jnz short @@game_is_not_extra mov _rank, RANK_EXTRA jmp short loc_B84E @@ -1580,7 +1580,7 @@ mptn_load endp map_load proc near push si call map_free - mov al, stage_id + mov al, _stage_id add al, 30h ; '0' mov aSt00_map+3, al mov ax, 3D00h @@ -1849,7 +1849,7 @@ loc_BDB7: mov byte_23F04, al mov al, [bp+var_1] add byte_23EFC, al - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_BD81 cmp _scroll_active, 0 jz short loc_BD81 @@ -2068,7 +2068,7 @@ loc_C4BC: assume es:nothing inc es:[bx+resident_t.bombs_used] push 1 - nopcall _playperf_lower + nopcall playperf_lower loc_C518: pop bp @@ -2418,7 +2418,7 @@ loc_C7D8: cmp byte_2429B, 80h jnz short loc_C7F9 call snd_se_play pascal, 15 - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_C7F2 mov _scroll_active, 1 @@ -2444,7 +2444,7 @@ loc_C800: mov _palette_changed, 1 cmp byte_2429B, 82h jnz short loc_C849 - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_C849 call graph_scrollup pascal, _scroll_line jmp loc_C7AB @@ -2667,7 +2667,7 @@ loc_CA05: cmp byte_2429B, 50h ; 'P' jnz short loc_CA26 call snd_se_play pascal, 15 - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_CA1F mov _scroll_active, 1 @@ -2693,7 +2693,7 @@ loc_CA2D: mov _palette_changed, 1 cmp byte_2429B, 52h ; 'R' jnz short loc_CA75 - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_CA75 call graph_scrollup pascal, _scroll_line jmp short loc_CA75 @@ -2878,7 +2878,7 @@ loc_CC28: cmp byte_2429B, 40h jnz short loc_CC49 call snd_se_play pascal, 15 - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_CC42 mov _scroll_active, 1 @@ -2904,7 +2904,7 @@ loc_CC50: mov _palette_changed, 1 cmp byte_2429B, 42h ; 'B' jnz short loc_CC98 - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_CC98 call graph_scrollup pascal, _scroll_line jmp short loc_CC98 @@ -3080,7 +3080,7 @@ loc_CDDE: cmp byte_2429B, 0A0h jnz short loc_CDFF call snd_se_play pascal, 15 - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_CDF8 mov _scroll_active, 1 @@ -3106,7 +3106,7 @@ loc_CE06: mov _palette_changed, 1 cmp byte_2429B, 0A1h jnz short loc_CE4F - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_CE4F call graph_scrollup pascal, _scroll_line jmp loc_CDB1 @@ -5653,7 +5653,7 @@ loc_E8D5: add byte ptr [di], gb_0_ inc di loop loc_E8D5 - mov al, stage_id + mov al, _stage_id cmp al, 6 jnz short loc_E8E4 xor al, al @@ -5906,7 +5906,7 @@ sub_EE17 proc near mov bp, sp les bx, off_221D0 assume es:nothing - mov al, stage_id + mov al, _stage_id add al, 30h ; '0' mov es:[bx+4], al push word ptr off_221D0+2 @@ -6188,7 +6188,7 @@ loc_F068: ; --------------------------------------------------------------------------- loc_F07C: - cmp stage_id, 6 + cmp _stage_id, 6 jz short loc_F091 call super_clean pascal, (180 shl 16) or 320 jmp loc_F181 @@ -6561,7 +6561,7 @@ loc_F3A4: loc_F40F: cmp word_2C938, 0 jz short loc_F41B - mov al, stage_id + mov al, _stage_id jmp short loc_F421 ; --------------------------------------------------------------------------- @@ -7166,7 +7166,7 @@ var_1 = byte ptr -1 enter 2, 0 push si push di - cmp stage_id, 6 + cmp _stage_id, 6 jz loc_FBF5 xor di, di mov si, 1 @@ -7463,7 +7463,7 @@ sub_100C6 endp sub_10214 proc near push bp mov bp, sp - cmp stage_id, 5 + cmp _stage_id, 5 jnz short loc_10223 mov _scroll_active, 0 @@ -7478,7 +7478,7 @@ loc_10223: jz short loc_1024F cmp _scroll_active, 0 jz short loc_1024F - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_1024F call graph_scrollup pascal, dx @@ -10340,7 +10340,7 @@ loc_11AF8: call _grcg_setmode_rmw_seg1 mov ah, GC_G call _grcg_setcolor_direct_seg1_raw - cmp stage_id, 5 + cmp _stage_id, 5 jnb short loc_11B11 push 150A80h push 0Eh @@ -10394,10 +10394,10 @@ loc_11B91: jb loc_11CB5 cmp byte_228EC, 16h jnz loc_11C2D - mov al, stage_id + mov al, _stage_id add al, 0A1h mov gStage_1+6, al - cmp stage_id, 5 + cmp _stage_id, 5 jnz short loc_11BBE push (17 shl 16) + 11 push ds @@ -10406,7 +10406,7 @@ loc_11B91: ; --------------------------------------------------------------------------- loc_11BBE: - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_11BD1 push (17 shl 16) + 11 push ds @@ -10440,7 +10440,7 @@ loc_11C2D: call _grcg_setmode_rmw_seg1 mov ah, GC_G call _grcg_setcolor_direct_seg1_raw - cmp stage_id, 5 + cmp _stage_id, 5 jnb short loc_11C46 push 150A80h push 0Eh @@ -10644,7 +10644,7 @@ loc_12064: loc_12083: push 4 - nopcall _playperf_lower + nopcall playperf_lower les bx, _resident inc es:[bx+resident_t.miss_count] @@ -11329,7 +11329,7 @@ loc_127BD: jb short loc_12821 loc_127D2: - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_127E7 mov ax, 5 imul si @@ -11350,7 +11350,7 @@ loc_127E7: ; --------------------------------------------------------------------------- loc_127FA: - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_1281A cmp _playchar, PLAYCHAR_REIMU jnz short loc_1281A @@ -13478,7 +13478,7 @@ loc_1626C: mov [bp+var_2], dl loc_16279: - mov al, stage_id + mov al, _stage_id shl al, 4 mov dl, [bp+var_2] sub dl, al @@ -13761,7 +13761,7 @@ loc_165DF: loc_165F8: call text_putsa pascal, (6 shl 16) + 21, ds, BONUS_TOTAL, TX_WHITE - mov al, stage_id + mov al, _stage_id mov ah, 0 imul ax, 64h add ax, 64h ; 'd' @@ -13796,7 +13796,7 @@ loc_165F8: push si push TX_WHITE nopcall hud_int_put - mov al, stage_id + mov al, _stage_id mov ah, 0 imul ax, 5000 add ax, 10000 @@ -13838,7 +13838,7 @@ loc_166E9: push 1 loc_166F5: - call _playperf_raise + call playperf_raise jmp short loc_1671B ; --------------------------------------------------------------------------- @@ -13855,7 +13855,7 @@ loc_1670A: push 1 loc_16716: - call _playperf_lower + call playperf_lower loc_1671B: push ss @@ -14486,7 +14486,7 @@ sub_16F05 proc near add ax, 100 cmp ax, _extend_point_items_collected ja short loc_16F52 - call _playperf_raise pascal, 4 + call playperf_raise pascal, 4 inc _extends_gained cmp _lives, 99 jnb short loc_16F52 @@ -14707,7 +14707,7 @@ loc_1711E: loc_1712C: push 3 - call _playperf_raise + call playperf_raise inc _lives call sub_10407 call snd_se_play pascal, 7 @@ -14748,7 +14748,7 @@ loc_17199: mov al, byte_225CC add al, 0E0h mov byte_225CC, al - call _playperf_raise pascal, 1 + call playperf_raise pascal, 1 loc_171AF: inc _items_collected @@ -14809,7 +14809,7 @@ loc_171FD: push 4 loc_171FF: - call _playperf_lower + call playperf_lower loc_17204: call hud_dream_put @@ -29138,10 +29138,10 @@ loc_1FC95: assume es:nothing mov ax, _stage_graze add es:[bx+resident_t.graze], ax - cmp stage_id, 5 + cmp _stage_id, 5 jz short loc_1FCD1 call sub_F2B4 - cmp stage_id, 6 + cmp _stage_id, 6 jz short loc_1FCCB call sub_16510 jmp loc_1FD51 @@ -29161,7 +29161,7 @@ loc_1FCD6: cmp _boss_phase_frame, 416;stuck at frame 416 until all score has been added jnz short loc_1FD35 call score_delta_commit - cmp stage_id, 6 + cmp _stage_id, 6 jnb short loc_1FD0B xor si, si jmp short loc_1FD06 @@ -29169,7 +29169,7 @@ loc_1FCD6: loc_1FCEE: mov al, _score_lebcd[si] - mov dl, stage_id + mov dl, _stage_id mov dh, 0 shl dx, 3 les bx, _resident @@ -29182,14 +29182,14 @@ loc_1FD06: jl short loc_1FCEE loc_1FD0B: - cmp stage_id, 5 + cmp _stage_id, 5 jnz short loc_1FD19 call end_game jmp short loc_1FD25 ; --------------------------------------------------------------------------- loc_1FD19: - cmp stage_id, 6 + cmp _stage_id, 6 jnz short loc_1FD25 call end_extra @@ -29855,11 +29855,7 @@ include th04/main/frames[bss].asm word_25FE6 dw ? byte_25FE8 db ? include th03/hardware/palette_changed[bss].asm -stage_id db ? -_rank db ? -include th04/main/playperf[bss].asm -public _playchar -_playchar db ? +include th04/main/play[bss].asm include th04/main/ems[bss].asm _turbo_mode db ? db ?