diff --git a/th01/main/boss/b15j.cpp b/th01/main/boss/b15j.cpp index 03f47b74..914dfd74 100644 --- a/th01/main/boss/b15j.cpp +++ b/th01/main/boss/b15j.cpp @@ -8,6 +8,7 @@ #include "th01/v_colors.hpp" extern "C" { #include "th01/hardware/egc.h" +#include "th01/hardware/input.hpp" #include "th01/formats/ptn.hpp" } #include "th01/formats/pf.hpp" @@ -25,6 +26,7 @@ extern "C" { #include "th01/main/boss/boss.hpp" #include "th01/main/boss/entity_a.hpp" #include "th01/main/player/orb.hpp" +#include "th01/main/player/player.hpp" // Coordinates // ----------- @@ -49,6 +51,8 @@ static const screen_y_t HITBOX_BOTTOM = DISC_CENTER_Y; static const pixel_t SOUL_W = 32; static const pixel_t SOUL_H = 32; +static const pixel_t RIPPLE_W = 16; +static const pixel_t RIPPLE_H = 16; static const screen_x_t SOUL_AREA_LEFT = (PLAYFIELD_LEFT + (PLAYFIELD_W / 20)); static const screen_y_t SOUL_AREA_TOP = PLAYFIELD_TOP; @@ -230,3 +234,19 @@ void pascal near tears_add(screen_x_t left, screen_y_t top) } } } + +bool16 pascal near tear_ripple_hittest(screen_x_t left, pixel_t extra_w) +{ + if(player_invincible != true) { + // Translation: 8 pixels in Reimu's center vs. 10 pixels in the ripple + // sprite's center. + if( + (player_left >= (left - ((PLAYER_W / 4) + (RIPPLE_W / 2)))) && + (player_left <= (left + extra_w)) + ) { + done = true; + return true; + } + } + return false; +} diff --git a/th01_reiiden.asm b/th01_reiiden.asm index e0a81d6b..4369f7b1 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -14710,6 +14710,8 @@ main_34_TEXT segment byte public 'CODE' use16 soul:word, delta_x:word, delta_y:word @TEARS_ADD$QII procdesc pascal near \ left:word, top:word + @TEAR_RIPPLE_HITTEST$QII procdesc pascal near \ + left:word, hitbox_w:word main_34_TEXT ends main_34__TEXT segment byte public 'CODE' use16 @@ -14717,41 +14719,6 @@ main_34__TEXT segment byte public 'CODE' use16 ;org 4 assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_236E0 proc near - -arg_0 = word ptr 4 -arg_2 = word ptr 6 - - push bp - mov bp, sp - mov dx, [bp+arg_2] - cmp _player_invincible, 1 - jz short loc_2370F - mov ax, dx - add ax, -16 - cmp ax, _player_left - jg short loc_2370F - mov ax, dx - add ax, [bp+arg_0] - cmp ax, _player_left - jl short loc_2370F - mov _done, 1 - mov ax, 1 - pop bp - retn 4 -; --------------------------------------------------------------------------- - -loc_2370F: - xor ax, ax - pop bp - retn 4 -sub_236E0 endp - - ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame @@ -14860,9 +14827,7 @@ arg_6 = word ptr 0Ah cmp ax, 5 jge short loc_237DA call _ptn_put_quarter_8 stdcall, si, di, large 80h or (0 shl 16) - push si - push 0 - call sub_236E0 + call @tear_ripple_hittest$qii pascal, si, 0 push 7 call _mdrv2_se_play add sp, 0Ah @@ -14876,9 +14841,7 @@ loc_237DA: cmp ax, 10 jge short loc_237FF call _ptn_put_quarter_8 c, si, di, large 80h or (1 shl 16) - push si - push 0 - call sub_236E0 + call @tear_ripple_hittest$qii pascal, si, 0 jmp loc_23C44 ; --------------------------------------------------------------------------- @@ -14889,9 +14852,7 @@ loc_237FF: cmp ax, 15 jge short loc_2383B lea ax, [si-16] - push ax - push 20h ; ' ' - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 32 push 80h or (1 shl 16) lea ax, [di-8] push ax @@ -14914,9 +14875,7 @@ loc_2383B: cmp ax, 20 jge short loc_23881 lea ax, [si-16] - push ax - push 20h ; ' ' - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 32 push 80h or (1 shl 16) lea ax, [di-16] push ax @@ -14945,9 +14904,7 @@ loc_23881: cmp ax, 25 jge short loc_238E7 lea ax, [si-20h] - push ax - push 40h - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 64 push 80h or (1 shl 16) lea ax, [di-24] push ax @@ -14985,9 +14942,7 @@ loc_238E7: cmp ax, 30 jge short loc_2394A lea ax, [si-20h] - push ax - push 40h - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 64 pushd 80h or (0 shl 16) lea ax, [di-32] push ax @@ -15022,9 +14977,7 @@ loc_2394A: cmp ax, 35 jge short loc_239B8 lea ax, [si-20h] - push ax - push 40h - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 64 pushd 80h or (0 shl 16) lea ax, [di-24] push ax @@ -15065,9 +15018,7 @@ loc_239B8: cmp ax, 40 jge short loc_23A25 lea ax, [si-20h] - push ax - push 40h - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 64 pushd 80h or (0 shl 16) lea ax, [di-16] push ax @@ -15108,9 +15059,7 @@ loc_23A25: cmp ax, 45 jge short loc_23AA2 lea ax, [si-20h] - push ax - push 40h - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 64 pushd 80h or (0 shl 16) lea ax, [di-8] push ax @@ -15163,9 +15112,7 @@ loc_23AA2: cmp ax, 50 jge short loc_23B0D lea ax, [si-20h] - push ax - push 40h - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 64 pushd 80h or (0 shl 16) push di push si @@ -15202,9 +15149,7 @@ loc_23B0D: cmp ax, 55 jge short loc_23B70 lea ax, [si-20h] - push ax - push 40h - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 64 call _ptn_put_quarter_8 stdcall, si, di, 80h or (3 shl 16) pushd 80h ; '?' lea ax, [di-8] @@ -15236,9 +15181,7 @@ loc_23B70: cmp ax, 60 jge short loc_23BC0 lea ax, [si-20h] - push ax - push 40h - call sub_236E0 + call @tear_ripple_hittest$qii pascal, ax, 64 pushd 80h or (0 shl 16) push di lea ax, [si-16]