mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th01] Kikuri: Orb hitbox
ZUN *did* want a hitbox in the disc's horizontally centered upper half,
but then confused < and >, accidentally ending up with a hitbox from
the top of the playfield to the upper part of Kikuri's face instead… 🎺
Part of P0198, funded by Lmocinemod and Ember2528.
This commit is contained in:
parent
0b3077a0c7
commit
d0d36b5840
|
@ -12,6 +12,7 @@ extern "C" {
|
|||
}
|
||||
#include "th01/formats/pf.hpp"
|
||||
#include "th01/math/area.hpp"
|
||||
#include "th01/math/overlap.hpp"
|
||||
#include "th01/math/subpixel.hpp"
|
||||
#include "th01/sprites/pellet.h"
|
||||
#include "th01/main/particle.hpp"
|
||||
|
@ -23,10 +24,29 @@ extern "C" {
|
|||
#include "th01/main/bullet/pellet.hpp"
|
||||
#include "th01/main/boss/boss.hpp"
|
||||
#include "th01/main/boss/entity_a.hpp"
|
||||
#include "th01/main/player/orb.hpp"
|
||||
|
||||
// Coordinates
|
||||
// -----------
|
||||
|
||||
static const screen_x_t DISC_CENTER_X = 320;
|
||||
static const screen_y_t DISC_CENTER_Y = 180;
|
||||
|
||||
static const pixel_t HITBOX_W = 96;
|
||||
static const pixel_t HITBOX_H = 48;
|
||||
|
||||
static const screen_x_t HITBOX_LEFT = (
|
||||
DISC_CENTER_X - (HITBOX_W / 2) - (ORB_W / 2)
|
||||
);
|
||||
static const screen_x_t HITBOX_RIGHT = (
|
||||
DISC_CENTER_X + (HITBOX_W / 2) - (ORB_W / 2)
|
||||
);
|
||||
|
||||
// Not the actual Y coordinates of the original hitbox, due to a sign confusion
|
||||
// bug in kikuri_hittest_orb()!
|
||||
static const screen_y_t HITBOX_TOP = (DISC_CENTER_Y - HITBOX_H);
|
||||
static const screen_y_t HITBOX_BOTTOM = DISC_CENTER_Y;
|
||||
|
||||
static const pixel_t SOUL_W = 32;
|
||||
static const pixel_t SOUL_H = 32;
|
||||
|
||||
|
@ -169,3 +189,16 @@ void kikuri_free(void)
|
|||
kikuri_ent_free();
|
||||
kikuri_ptn_free();
|
||||
}
|
||||
|
||||
bool16 near kikuri_hittest_orb(void)
|
||||
{
|
||||
// Did you mean: > HITBOX_TOP? Using < describes a hitbox from the top of
|
||||
// the playfield *until* that point instead...
|
||||
if(
|
||||
(orb_cur_left > HITBOX_LEFT) && (orb_cur_left < HITBOX_RIGHT) &&
|
||||
(orb_cur_top < HITBOX_TOP) && (orb_cur_top < HITBOX_BOTTOM)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -14705,6 +14705,7 @@ main_34_TEXT segment byte public 'CODE' use16
|
|||
extern @kikuri_select_for_rank$qmiiiii:proc
|
||||
extern @kikuri_load$qv:proc
|
||||
extern @kikuri_free$qv:proc
|
||||
@kikuri_hittest_orb$qv procdesc near
|
||||
main_34_TEXT ends
|
||||
|
||||
main_34__TEXT segment byte public 'CODE' use16
|
||||
|
@ -14712,33 +14713,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_235FD proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
cmp _orb_cur_left, 256
|
||||
jle short loc_23625
|
||||
cmp _orb_cur_left, 352
|
||||
jge short loc_23625
|
||||
cmp _orb_cur_top, 132
|
||||
jge short loc_23625
|
||||
cmp _orb_cur_top, 180
|
||||
jge short loc_23625
|
||||
mov ax, 1
|
||||
pop bp
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_23625:
|
||||
xor ax, ax
|
||||
pop bp
|
||||
retn
|
||||
sub_235FD endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
@ -16929,7 +16903,7 @@ loc_24B3E:
|
|||
call sub_23D19
|
||||
pushd 0 or (0 shl 16) ; (hitbox_w) or (hitbox_h)
|
||||
pushd 0 or (0 shl 16) ; (hitbox_left) or (hitbox_top)
|
||||
call sub_235FD
|
||||
call @kikuri_hittest_orb$qv
|
||||
push ax ; colliding_with_orb
|
||||
push seg main_32_TEXT ; hit_callback (segment)
|
||||
push offset @boss_nop$qv ; hit_callback (offset)
|
||||
|
@ -17013,7 +16987,7 @@ loc_24C2A:
|
|||
mov word_35D14, ax
|
||||
pushd 0 or (0 shl 16) ; (hitbox_w) or (hitbox_h)
|
||||
pushd 0 or (0 shl 16) ; (hitbox_left) or (hitbox_top)
|
||||
call sub_235FD
|
||||
call @kikuri_hittest_orb$qv
|
||||
push ax ; colliding_with_orb
|
||||
push seg main_32_TEXT ; hit_callback (segment)
|
||||
push offset @boss_nop$qv ; hit_callback (offset)
|
||||
|
@ -17051,7 +17025,7 @@ loc_24C81:
|
|||
call sub_240DE
|
||||
pushd 0 or (0 shl 16)
|
||||
pushd 0 or (0 shl 16) ; (hitbox_left) or (hitbox_top)
|
||||
call sub_235FD
|
||||
call @kikuri_hittest_orb$qv
|
||||
push ax ; colliding_with_orb
|
||||
push seg main_32_TEXT ; hit_callback (segment)
|
||||
push offset @boss_nop$qv ; hit_callback (offset)
|
||||
|
@ -17134,7 +17108,7 @@ loc_24D4C:
|
|||
loc_24D59:
|
||||
pushd 0 or (0 shl 16) ; (hitbox_w) or (hitbox_h)
|
||||
pushd 0 or (0 shl 16) ; (hitbox_left) or (hitbox_top)
|
||||
call sub_235FD
|
||||
call @kikuri_hittest_orb$qv
|
||||
push ax ; colliding_with_orb
|
||||
push seg main_32_TEXT ; hit_callback (segment)
|
||||
push offset @boss_nop$qv ; hit_callback (offset)
|
||||
|
|
Loading…
Reference in New Issue