[Decompilation] [th01] Kikuri: Soul activation

Part of P0199, funded by Lmocinemod.
This commit is contained in:
nmlgc 2022-06-09 10:42:36 +02:00
parent 2cae284a05
commit 6a710cd7a0
2 changed files with 36 additions and 45 deletions

View File

@ -159,6 +159,13 @@ inline void kikuri_ptn_free(void) {
// Patterns
// --------
enum kikuri_phase_4_subphase_t {
P4_SOUL_ACTIVATION = 0,
P4_PATTERN = 1,
_kikuri_phase_4_subphase_t_FORCE_INT16 = 0x7FFF
};
#define pattern_state kikuri_pattern_state
extern union {
int interval;
@ -201,6 +208,8 @@ void kikuri_setup(void)
hud_hp_first_white = PHASE_2_END_HP;
hud_hp_first_redwhite = PHASE_5_END_HP;
// Redundant already called before the sprites are first rendered, and
// (0, 0) isn't used to indicate "soul is not alive".
souls[0].pos_set(0, 0, 50,
SOUL_AREA_LEFT, SOUL_AREA_RIGHT, SOUL_AREA_TOP, SOUL_AREA_BOTTOM
);
@ -549,3 +558,28 @@ void near pattern_spinning_aimed_rings(void)
);
}
}
kikuri_phase_4_subphase_t near phase_4_souls_activate(void)
{
if(boss_phase_frame == 200) {
souls[0].pos_set(
(LIGHTBALL_CENTER_X - (SOUL_W / 2)),
(LIGHTBALL_CENTER_Y - (SOUL_H / 2)), 50,
SOUL_AREA_LEFT, SOUL_AREA_RIGHT, SOUL_AREA_TOP, SOUL_AREA_BOTTOM
);
souls[1].pos_set(
(LIGHTBALL_CENTER_X - (SOUL_W / 2)),
(LIGHTBALL_CENTER_Y - (SOUL_H / 2)), 50,
SOUL_AREA_LEFT, SOUL_AREA_RIGHT, SOUL_AREA_TOP, SOUL_AREA_BOTTOM
);
} else if((boss_phase_frame > 200) && ((boss_phase_frame % 2) == 0)) {
soul_move_and_render(0, -4, -3);
soul_move_and_render(1, +4, -3);
if(souls[0].cur_top < (
SOUL_AREA_TOP + playfield_fraction_y(2 / 21.0f)
)) {
return P4_PATTERN;
}
}
return P4_SOUL_ACTIVATION;
}

View File

@ -14715,6 +14715,7 @@ main_34_TEXT segment byte public 'CODE' use16
y:word, mask:word
@pattern_symmetric_spiral_from_di$qv procdesc near
@pattern_spinning_aimed_rings$qv procdesc near
@phase_4_souls_activate$qv procdesc near
main_34_TEXT ends
main_34__TEXT segment byte public 'CODE' use16
@ -14722,50 +14723,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_23F16 proc near
push bp
mov bp, sp
cmp _boss_phase_frame, 200
jnz short loc_23F62
call @CBossEntity@pos_set$qiiiiiii stdcall, offset kikuri_soul_0, ds, 304, large 208 or (50 shl 16), large 32 or (576 shl 16), large 64 or (400 shl 16)
call @CBossEntity@pos_set$qiiiiiii stdcall, offset kikuri_soul_1, ds, 304, large 208 or (50 shl 16), large 32 or (576 shl 16), large 64 or (400 shl 16)
add sp, 24h
jmp short loc_23F99
; ---------------------------------------------------------------------------
loc_23F62:
cmp _boss_phase_frame, 200
jle short loc_23F99
mov ax, _boss_phase_frame
mov bx, 2
cwd
idiv bx
or dx, dx
jnz short loc_23F99
push large (0 shl 16) or (-4 and 0FFFFh)
push -3
call @soul_move_and_render$qiii
push large (1 shl 16) or (+4 and 0FFFFh)
push -3
call @soul_move_and_render$qiii
cmp kikuri_soul_0.BE_cur_top, 96
jge short loc_23F99
mov ax, 1
pop bp
retn
; ---------------------------------------------------------------------------
loc_23F99:
xor ax, ax
pop bp
retn
sub_23F16 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
@ -15991,7 +15948,7 @@ loc_24C07:
call @pattern_spinning_aimed_rings$qv
cmp word_35D14, 0
jnz short loc_24C27
call sub_23F16
call @phase_4_souls_activate$qv
jmp short loc_24C2A
; ---------------------------------------------------------------------------