[Reverse-engineering] [th04/th05] Graze counter

Part of P0065, funded by Touhou Patch Center.
This commit is contained in:
nmlgc 2019-12-30 18:01:00 +01:00
parent 5a7fb6879f
commit 658c0291d3
4 changed files with 22 additions and 16 deletions

View File

@ -8,6 +8,8 @@
#define PLAYER_OPTION_H 16
#define PLAYER_OPTION_DISTANCE ((PLAYER_W / 2) + (PLAYER_OPTION_W / 2))
// Reset to 0 when moving to a new stage.
extern unsigned int stage_graze;
extern motion_t player_pos;
void pascal near player_pos_update_and_clamp(void);

View File

@ -7,6 +7,8 @@ PLAYER_OPTION_W = 16
PLAYER_OPTION_H = 16
PLAYER_OPTION_DISTANCE = (PLAYER_W / 2) + (PLAYER_OPTION_W / 2)
GRAZE_MAX = 999
; Shots
; -----
SHOT_W = 16

View File

@ -7685,7 +7685,7 @@ hud_graze_put proc far
push bp
mov bp, sp
push 3E0013h
push word_2CFFC
push _stage_graze
call sub_1D519
pop bp
retf
@ -12510,7 +12510,7 @@ sub_11ECB proc near
mov byte_266D2, 0
mov _palette_changed, 0
mov _bullet_clear_trigger, 0
mov word_2CFFC, 0
mov _stage_graze, 0
mov _circles_color, GC_R
call grc_setclip pascal, large (PLAYFIELD_X shl 16) or PLAYFIELD_Y, large ((PLAYFIELD_RIGHT - 1) shl 16) or (PLAYFIELD_BOTTOM - 1)
push offset _shots
@ -31431,9 +31431,9 @@ loc_1CA82:
push large (((2 shl 4) shl 16) or 2)
nopcall sparks_add_random
mov byte ptr [si+12h], 1
cmp word_2CFFC, 3E7h
cmp _stage_graze, GRAZE_MAX
jnb short loc_1CAC5
inc word_2CFFC
inc _stage_graze
call hud_graze_put
movzx eax, score_2CFFE
add _score_delta, eax
@ -33250,7 +33250,7 @@ var_4 = dword ptr -4
push 0Bh
push eax
call sub_1D48E
mov ax, word_2CFFC
mov ax, _stage_graze
imul ax, 5
mov si, ax
movzx eax, si
@ -33401,7 +33401,7 @@ loc_1D922:
push 0Ah
push eax
call sub_1D48E
mov ax, word_2CFFC
mov ax, _stage_graze
imul ax, 5
mov si, ax
movzx eax, si
@ -34643,7 +34643,7 @@ loc_1E7B5:
cmp _boss_phase_frame, 0
jnz loc_1E8B3
les bx, _resident
mov ax, word_2CFFC
mov ax, _stage_graze
add es:[bx+38h], ax
cmp stage_id, 5
jz loc_1E8AE
@ -45885,7 +45885,8 @@ byte_2CFF7 db ?
byte_2CFF8 db ?
include th04/bullet_clear[bss].asm
db ?
word_2CFFC dw ?
public _stage_graze
_stage_graze dw ?
score_2CFFE dw ?
fp_2D000 dw ?
fp_2D002 dw ?

View File

@ -6846,7 +6846,7 @@ sub_EACE proc near
mov byte_25FE8, 0
mov _palette_changed, 0
mov _bullet_clear_trigger, 0
mov word_2C97A, 0
mov _stage_graze, 0
mov _circles_color, GC_R
call grc_setclip pascal, large (PLAYFIELD_X shl 16) or PLAYFIELD_Y, large ((PLAYFIELD_RIGHT - 1) shl 16) or (PLAYFIELD_BOTTOM - 1)
push offset _hitshots
@ -9286,7 +9286,7 @@ public HUD_GRAZE_PUT
hud_graze_put proc far
push bp
mov bp, sp
call hud_int_put pascal, (62 shl 16) + 18, word_2C97A, TX_WHITE
call hud_int_put pascal, (62 shl 16) + 18, _stage_graze, TX_WHITE
pop bp
retf
hud_graze_put endp
@ -15571,7 +15571,7 @@ loc_165F8:
push (34 shl 16) + 10
push eax
nopcall hud_points_put
mov ax, word_2C97A
mov ax, _stage_graze
imul ax, 5
mov si, ax
movzx eax, si
@ -15746,7 +15746,7 @@ loc_1683E:
push (34 shl 16) + 8
push eax
nopcall hud_points_put
mov ax, word_2C97A
mov ax, _stage_graze
imul ax, 5
mov si, ax
movzx eax, si
@ -18229,9 +18229,9 @@ loc_17DFE:
push large (((2 shl 4) shl 16) or 2)
nopcall sparks_add_random
mov byte ptr [si+12h], 1
cmp word_2C97A, 3E7h
cmp _stage_graze, GRAZE_MAX
jnb short loc_17E41
inc word_2C97A
inc _stage_graze
call hud_graze_put
movzx eax, score_2C97C
add _score_delta, eax
@ -32206,7 +32206,7 @@ loc_1FC95:
jnz short loc_1FCD6
les bx, _resident
assume es:nothing
mov ax, word_2C97A
mov ax, _stage_graze
add es:[bx+3Ah], ax
cmp stage_id, 5
jz short loc_1FCD1
@ -39621,7 +39621,8 @@ byte_2C974 db ?
byte_2C976 db ?
byte_2C977 db ?
include th04/bullet_clear[bss].asm
word_2C97A dw ?
public _stage_graze
_stage_graze dw ?
score_2C97C dw ?
word_2C97E dw ?
dd ? ;