[Decompilation] [th05] Sara: Pattern 1/9 + 2/9

The ones where Sara fires a counter-clockwise (1) or clockwise (2)
curve of blue ball bullets, with one new group every two frames.

Part of P0227, funded by nrook.
This commit is contained in:
nmlgc 2022-12-07 12:29:41 +01:00
parent 6dd29fe5ba
commit b535f33461
2 changed files with 28 additions and 64 deletions

View File

@ -15,6 +15,7 @@ extern "C" {
#include "th04/main/bullet/bullet.hpp" #include "th04/main/bullet/bullet.hpp"
} }
#include "th04/main/gather.hpp" #include "th04/main/gather.hpp"
#include "th05/sprites/main_pat.h"
#include "th05/main/boss/boss.hpp" #include "th05/main/boss/boss.hpp"
// Constants // Constants
@ -88,3 +89,26 @@ void near phase_2_with_pattern(void)
} }
phase_2_3_pattern(); phase_2_3_pattern();
} }
#define pattern_blue(pattern_angle, angle_delta) { \
if((boss.phase_frame % 2) == 0) { \
bullet_template.spawn_type = BST_CLOUD_FORWARDS; \
bullet_template.patnum = PAT_BULLET16_N_BALL_BLUE; \
bullet_template.group = BG_SINGLE; \
bullet_template.angle = pattern_angle; \
bullet_template.speed.set(1.5f); \
bullet_template_tune(); \
bullets_add_regular(); \
pattern_angle = (pattern_angle + angle_delta); \
} \
}
void near pattern_blue_curve_counterclockwise(void)
{
pattern_blue(state->phase_2.angle_counterclockwise, -0x0A);
}
void near pattern_blue_curve_clockwise(void)
{
pattern_blue(state->phase_2.angle_clockwise, +0x0A);
}

View File

@ -10255,72 +10255,12 @@ MIDBOSS1_TEXT ends
B1_UPDATE_TEXT segment byte public 'CODE' use16 B1_UPDATE_TEXT segment byte public 'CODE' use16
@phase_2_with_pattern$qv procdesc near @phase_2_with_pattern$qv procdesc near
@pattern_blue_curve_counterclockw$qv procdesc near
@pattern_blue_curve_clockwise$qv procdesc near
B1_UPDATE_TEXT ends B1_UPDATE_TEXT ends
B4_UPDATE_TEXT segment byte public 'CODE' use16 B4_UPDATE_TEXT segment byte public 'CODE' use16
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_1823B proc near
push bp
mov bp, sp
mov ax, _boss_phase_frame
mov bx, 2
cwd
idiv bx
or dx, dx
jnz short loc_18274
mov _bullet_template.spawn_type, BST_CLOUD_FORWARDS
mov _bullet_template.patnum, PAT_BULLET16_N_BLUE
mov _bullet_template.BT_group, BG_SINGLE
mov al, _boss_statebyte[15]
mov _bullet_template.BT_angle, al
mov _bullet_template.speed, (1 shl 4) + 8
call _bullet_template_tune
call _bullets_add_regular
mov al, _boss_statebyte[15]
add al, -0Ah
mov _boss_statebyte[15], al
loc_18274:
pop bp
retn
sub_1823B endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_18276 proc near
push bp
mov bp, sp
mov ax, _boss_phase_frame
mov bx, 2
cwd
idiv bx
or dx, dx
jnz short loc_182AF
mov _bullet_template.spawn_type, BST_CLOUD_FORWARDS
mov _bullet_template.patnum, PAT_BULLET16_N_BLUE
mov _bullet_template.BT_group, BG_SINGLE
mov al, _boss_statebyte[14]
mov _bullet_template.BT_angle, al
mov _bullet_template.speed, (1 shl 4) + 8
call _bullet_template_tune
call _bullets_add_regular
mov al, _boss_statebyte[14]
add al, 0Ah
mov _boss_statebyte[14], al
loc_182AF:
pop bp
retn
sub_18276 endp
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame ; Attributes: bp-based frame
@ -21238,8 +21178,8 @@ include th04/main/hud/power[data].asm
include th04/main/hud/hp[data].asm include th04/main/hud/hp[data].asm
aB@b@bB@b@ db '  ×  ',0 aB@b@bB@b@ db '  ×  ',0
aB@b@bB@b@_0 db '  ×  ',0 aB@b@bB@b@_0 db '  ×  ',0
off_22758 dw offset sub_1823B off_22758 dw offset @pattern_blue_curve_counterclockw$qv
dw offset sub_18276 dw offset @pattern_blue_curve_clockwise$qv
dw offset sub_182B1 dw offset sub_182B1
off_2275E dw offset sub_182ED off_2275E dw offset sub_182ED
dw offset sub_183F5 dw offset sub_183F5