diff --git a/th04/player/player.inc b/th04/player/player.inc index 56041918..b5609e60 100644 --- a/th04/player/player.inc +++ b/th04/player/player.inc @@ -3,6 +3,15 @@ PLAYER_OPTION_W = 16 PLAYER_OPTION_H = 16 PLAYER_OPTION_DISTANCE = (PLAYER_W / 2) + (PLAYER_OPTION_W / 2) +; Shots +; ----- +; Shots are always fired for multiples of this number of frames, even if +; INPUT_SHOT is held for a shorter amount of time. +SHOT_CYCLE_FRAMES = 18 +; Set shot_time to this value to block shots from being fired this frame. +SHOT_BLOCKED_FOR_THIS_FRAME = 0FFh +; ----- + MISS_ANIM_FRAMES = 32 MISS_ANIM_FLASH_AT = 28 MISS_ANIM_EXPLODE_UNTIL = 31 diff --git a/th04_main.asm b/th04_main.asm index 3ae658c9..2a44c984 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -8386,7 +8386,7 @@ shot_reimu_a_l2 proc near push si push di mov di, 1 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_F3D7 mov byte_256A2, 0 @@ -8470,7 +8470,7 @@ shot_reimu_a_l3 proc near push si push di mov di, 2 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_F467 mov byte_256A2, 0 @@ -8557,7 +8557,7 @@ shot_reimu_a_l4 proc near push si push di mov di, 3 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_F4FE mov byte_256A2, 0 @@ -8642,7 +8642,7 @@ shot_reimu_a_l5 proc near push si push di mov di, 3 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_F59A mov byte_256A2, 0 @@ -8727,7 +8727,7 @@ shot_reimu_a_l6 proc near push si push di mov di, 3 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_F636 mov byte_256A2, 0 @@ -8817,7 +8817,7 @@ var_2 = word ptr -2 push si push di mov di, 5 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_F6D2 mov byte_256A2, 0 @@ -9037,7 +9037,7 @@ var_2 = word ptr -2 push di mov di, 5 add di, 2 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_F85A mov byte_256A2, 0 @@ -9188,7 +9188,7 @@ var_1 = byte ptr -1 push si push di mov di, 1 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_F96C mov byte_256A2, 0 @@ -9267,7 +9267,7 @@ shot_reimu_b_l3 proc near push si push di mov di, 2 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_F9FB mov byte_256A2, 0 @@ -9351,7 +9351,7 @@ shot_reimu_b_l4 proc near push si push di mov di, 3 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_FA92 mov byte_256A2, 0 @@ -9435,7 +9435,7 @@ shot_reimu_b_l5 proc near push si push di mov di, 3 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_FB37 mov byte_256A2, 0 @@ -9548,7 +9548,7 @@ shot_reimu_b_l6 proc near push si push di mov di, 3 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_FC05 mov byte_256A2, 0 @@ -9661,7 +9661,7 @@ shot_reimu_b_l7 proc near push si push di mov di, 3 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_FCD3 mov byte_256A2, 0 @@ -9774,7 +9774,7 @@ shot_reimu_b_l8 proc near push si push di mov di, 5 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_FDA1 mov byte_256A2, 0 @@ -9887,7 +9887,7 @@ shot_reimu_b_l9 proc near push si push di mov di, 7 - cmp byte_259A6, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jnz short loc_FE6F mov byte_256A2, 0 @@ -10553,7 +10553,7 @@ sub_1042A proc near mov bp, sp mov word_25608, 0 mov byte_2560A, 0 - mov byte_259A6, 0 + mov _shot_time, 0 mov _player_is_hit, 0 pop bp retn @@ -11253,19 +11253,19 @@ loc_10B75: loc_10B82: test _input.lo, low INPUT_SHOT jz short loc_10B97 - cmp byte_259A6, 1 + cmp _shot_time, 1 ja short loc_10B97 - mov byte_259A6, 12h + mov _shot_time, SHOT_CYCLE_FRAMES jmp short loc_10BB0 ; --------------------------------------------------------------------------- loc_10B97: - cmp byte_259A6, 0 + cmp _shot_time, 0 jz short loc_10BC7 - dec byte_259A6 - cmp byte_259A6, 6 + dec _shot_time + cmp _shot_time, (SHOT_CYCLE_FRAMES / 3) * 1 jz short loc_10BB0 - cmp byte_259A6, 0Ch + cmp _shot_time, (SHOT_CYCLE_FRAMES / 3) * 2 jnz short loc_10BC7 loc_10BB0: @@ -41144,7 +41144,8 @@ _player_invincibility_time db ? byte_259A3 db ? power db ? shot_level db ? -byte_259A6 db ? +public _SHOT_TIME +_shot_time db ? include th01/player_is_hit[bss].asm db ? ; byte_259A9 db ? diff --git a/th05_main.asm b/th05_main.asm index 0ac9152c..31d58748 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -1104,7 +1104,7 @@ sub_B55A proc near mov _player_is_hit, 0 mov _player_invincibility_time, STAGE_START_INVINCIBILITY_FRAMES mov _point_items_collected, 0 - mov byte_2CEC0, 0 + mov _shot_time, 0 mov fp_2C92E, offset sub_EE58 mov _scroll_active, 1 nopcall sub_E4FC @@ -3222,7 +3222,7 @@ sub_C99E proc near loc_C9D0: call sub_C84F - mov byte_2CEC0, 0FFh + mov _shot_time, SHOT_BLOCKED_FOR_THIS_FRAME pop bp retn sub_C99E endp @@ -12941,20 +12941,20 @@ loc_121E7: loc_121F4: test _input.lo, low INPUT_SHOT jz short loc_12207 - cmp byte_2CEC0, 0 + cmp _shot_time, 0 jnz short loc_12207 - mov byte_2CEC0, 12h + mov _shot_time, SHOT_CYCLE_FRAMES loc_12207: - cmp byte_2CEC0, 12h + cmp _shot_time, SHOT_CYCLE_FRAMES jbe short loc_12213 - mov byte_2CEC0, 0 + mov _shot_time, 0 loc_12213: - cmp byte_2CEC0, 0 + cmp _shot_time, 0 jz short loc_1222E call playchar_shot_func - dec byte_2CEC0 + dec _shot_time jmp short loc_1222E ; --------------------------------------------------------------------------- @@ -13651,7 +13651,7 @@ var_1 = byte ptr -1 enter 2, 0 mov [bp+var_1], 0 - mov al, byte_2CEC0 + mov al, _shot_time mov ah, 0 sub ax, 3 mov bx, ax @@ -44766,7 +44766,8 @@ _player_invincibility_time db ? byte_2CEBD db ? power db ? shot_level db ? -byte_2CEC0 db ? +public _SHOT_TIME +_shot_time db ? include th01/player_is_hit[bss].asm public _MISS_TIME _miss_time db ?