[Decompilation] [th01] Kikuri: Pattern 2/10

The one where Kikuri fires small spinning 8-pellet circles from her
ball of light, aimed to the player. The only pattern in the entire game
that uses the "spin pellet" type, forcing two additional parameters
onto every other single-pellet spawn call. (Luckily, C++ has default
arguments!)

Part of P0199, funded by Lmocinemod.
This commit is contained in:
nmlgc 2022-06-08 21:08:59 +02:00
parent 985c4af2ff
commit 2cae284a05
2 changed files with 43 additions and 69 deletions

View File

@ -40,6 +40,10 @@ static const screen_x_t DISC_CENTER_X = 320;
static const screen_y_t DISC_CENTER_Y = 180;
static const pixel_t DISC_RADIUS = 90;
// That's… not quite where the light ball is?
static const screen_x_t LIGHTBALL_CENTER_X = 320;
static const screen_y_t LIGHTBALL_CENTER_Y = 224;
static const pixel_t HITBOX_W = 96;
static const pixel_t HITBOX_H = 48;
@ -508,3 +512,40 @@ void near pattern_symmetric_spiral_from_disc(void)
#undef drift
#undef angle
}
void near pattern_spinning_aimed_rings(void)
{
enum {
RING = 8,
};
screen_x_t left;
screen_y_t top;
int interval;
select_for_rank(interval, 80, 60, 55, 50);
if((boss_phase_frame % interval) != 0) {
return;
}
for(int i = 0; i < RING; i++) {
left = polar_x(
(LIGHTBALL_CENTER_X - (PELLET_W / 2)), 16, (i * (0x100 / RING))
);
top = polar_y(LIGHTBALL_CENTER_Y, 16, (i * (0x100 / RING)));
unsigned char angle = iatan2(
((player_center_y() + (PELLET_H / 2)) - LIGHTBALL_CENTER_Y),
((player_center_x() + (PELLET_W / 2)) - LIGHTBALL_CENTER_X)
);
Pellets.add_single(
left,
top,
angle,
to_sp(3.0f),
PM_SPIN,
to_sp(2.0f),
(LIGHTBALL_CENTER_X - PELLET_W),
LIGHTBALL_CENTER_Y
);
}
}

View File

@ -14714,6 +14714,7 @@ main_34_TEXT segment byte public 'CODE' use16
@GRAPH_COPY_LINE_1_TO_0_MASKED$QIUI procdesc pascal near \
y:word, mask:word
@pattern_symmetric_spiral_from_di$qv procdesc near
@pattern_spinning_aimed_rings$qv procdesc near
main_34_TEXT ends
main_34__TEXT segment byte public 'CODE' use16
@ -14721,74 +14722,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_23E6E proc near
@@angle = byte ptr -7
var_6 = word ptr -6
@@top = word ptr -4
@@left = word ptr -2
enter 8, 0
push si
push 55 or (50 shl 16) ; (for_hard) or (for_lunatic)
push 80 or (60 shl 16) ; (for_easy) or (for_normal)
push ss ; ret (segment)
lea ax, [bp+var_6]
push ax ; ret (offset)
call @kikuri_select_for_rank$qmiiiii
add sp, 0Ch
mov ax, _boss_phase_frame
cwd
idiv [bp+var_6]
or dx, dx
jnz short loc_23F13
xor si, si
jmp short loc_23F0E
; ---------------------------------------------------------------------------
loc_23E9A:
mov bx, si
shl bx, 5
and bx, 255
add bx, bx
movsx eax, _CosTable8[bx]
shl eax, 4
sar eax, 8
add ax, 316
mov [bp+@@left], ax
mov bx, si
shl bx, 5
and bx, 255
add bx, bx
movsx eax, _SinTable8[bx]
shl eax, 4
sar eax, 8
add ax, 224
mov [bp+@@top], ax
push 164
mov ax, _player_left
add ax, -300
push ax
call iatan2
mov [bp+@@angle], al
call @CPellets@add_single$qiiuci15pellet_motion_tiii c, offset _Pellets, ds, [bp+@@left], [bp+@@top], word ptr [bp+@@angle], (3 shl 4), large PM_SPIN or ((2 shl 4) shl 16), large 312 or (224 shl 16)
inc si
loc_23F0E:
cmp si, 8
jl short loc_23E9A
loc_23F13:
pop si
leave
retn
sub_23E6E endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
@ -16055,7 +15988,7 @@ loc_24C07:
jnz short loc_24C81
inc _boss_phase_frame
inc _kikuri_invincibility_frame
call sub_23E6E
call @pattern_spinning_aimed_rings$qv
cmp word_35D14, 0
jnz short loc_24C27
call sub_23F16