[Decompilation] [th01] Sariel: Pattern 7/16

The one with four aimed lasers spawned from fixed positions on Sariel's
face (?) and shield.

Part of P0177, funded by Yanga.
This commit is contained in:
nmlgc 2022-01-03 03:28:07 +01:00
parent 3a751d59d4
commit e4a304febe
3 changed files with 144 additions and 150 deletions

View File

@ -63,11 +63,19 @@ static const screen_y_t SHIELD_CENTER_Y = 164;
static const screen_x_t SEAL_CENTER_X = 320;
static const screen_x_t SEAL_CENTER_Y = 185;
static const pixel_t SEAL_RADIUS = 140;
// That's… not quite where the sphere is?
static const screen_x_t WAND_EMIT_LEFT = 340;
static const screen_y_t WAND_EMIT_TOP = 64;
// That's… not quite where the face is?
static const screen_x_t FACE_LEFT = 314;
static const screen_y_t FACE_TOP = 104;
static const pixel_t FACE_W = 32;
static const pixel_t FACE_H = 32;
static const screen_y_t FACE_CENTER_Y = (FACE_TOP + (FACE_H / 2));
// MODDERS: That's 32 more than BOSS6_2.BOS is wide? Reducing it to 96 works
// fine as well.
static const pixel_t WAND_W = 128;
@ -392,6 +400,10 @@ void pascal near spawnray_unput_and_put(
#undef target_prev_y
}
inline void spawnray_reset(void) {
spawnray_unput_and_put(0, 0, 0, 0, SPAWNRAY_RESET);
}
enum bird_pellet_group_t {
BPG_AIMED = 0,
BPG_6_RING = 1,
@ -1594,3 +1606,120 @@ void near particles2x2_wavy_unput_update_render()
#undef left
#undef col
}
void near pattern_four_aimed_lasers(void)
{
#define ORIGIN_DISTANCE_X_1 (SEAL_CENTER_X - SEAL_RADIUS)
#define ORIGIN_Y_1 FACE_CENTER_Y
#define ORIGIN_Y_2 SHIELD_CENTER_Y
#define origin_x pattern6_origin_x
#define origin_y pattern6_origin_y
#define spawnray pattern6_spawnray
#define target_first pattern6_target_first
extern screen_x_t origin_x;
extern screen_y_t origin_y;
extern struct {
pixel_t velocity_y;
pixel_t velocity_x;
void unput_update_render(void) {
spawnray_unput_and_put(
PLAYFIELD_CENTER_X, ORIGIN_Y_1, origin_x, origin_y, V_WHITE
);
origin_x += velocity_x;
origin_y += velocity_y;
}
} spawnray;
extern screen_x_t target_first;
#define spawnray_init(origin_x_, origin_y_, target_left) { \
origin_x = origin_x_; \
origin_y = origin_y_; \
vector2_between( \
origin_x, \
origin_y, \
target_left, \
PLAYFIELD_BOTTOM, \
spawnray.velocity_x, \
spawnray.velocity_y, \
16 \
); \
}
#define fire(laser_id, origin_left, origin_top, target_left) { \
shootout_lasers[laser_id].spawn( \
origin_left, origin_top, target_left, PLAYFIELD_BOTTOM, \
pattern_state.speed_multiplied_by_8, V_WHITE, 50, 8 \
); \
mdrv2_se_play(6); \
}
if(boss_phase_frame < 5) {
spawnray_reset();
}
if(boss_phase_frame < 50) {
return;
} else if(boss_phase_frame == 50) {
spawnray_init(
(PLAYFIELD_RIGHT - ORIGIN_DISTANCE_X_1), ORIGIN_Y_1, player_left
);
target_first = player_left;
select_for_rank(pattern_state.speed_multiplied_by_8,
(to_sp(7.5f) / 2),
(to_sp(8.0f) / 2),
(to_sp(8.5f) / 2),
(to_sp(9.0f) / 2)
);
fire(0,
(PLAYFIELD_RIGHT - ORIGIN_DISTANCE_X_1), ORIGIN_Y_1, player_left
);
} else if(boss_phase_frame < 100) {
spawnray.unput_update_render();
} else if(boss_phase_frame == 100) {
spawnray_init(
(PLAYFIELD_LEFT + ORIGIN_DISTANCE_X_1),
ORIGIN_Y_1,
((PLAYFIELD_RIGHT - 1) - target_first)
);
fire(1, origin_x, origin_y, ((PLAYFIELD_RIGHT - 1) - target_first));
} else if(boss_phase_frame < 150) {
spawnray.unput_update_render();
} else if(boss_phase_frame == 150) {
spawnray_init(
(PLAYFIELD_RIGHT - playfield_fraction_x(4 / 80.0f)),
ORIGIN_Y_2,
player_left
);
fire(2, origin_x, origin_y, player_left);
} else if(boss_phase_frame < 200) {
spawnray.unput_update_render();
} else if(boss_phase_frame == 200) {
spawnray_init(
(PLAYFIELD_LEFT + playfield_fraction_x(3 / 80.0f)),
ORIGIN_Y_2,
player_left
);
fire(3, origin_x, origin_y, player_left);
} else if(boss_phase_frame < 250) {
spawnray.unput_update_render();
} else if(boss_phase_frame > 300) {
boss_phase_frame = 0;
}
#undef fire
#undef spawnray_init
#undef target_first
#undef spawnray
#undef origin_y
#undef origin_x
#undef ORIGIN_Y_2
#undef ORIGIN_Y_1
#undef ORIGIN_DISTANCE_X_1
}

View File

@ -1,8 +1,10 @@
static const int SPAWNRAY_RESET = 99;
#define spawnray_unput_and_put_func( \
target_prev_x, target_prev_y, \
origin_x, origin_y, target_x, target_y, col, unblit_always \
) { \
if(col == 99) { \
if(col == SPAWNRAY_RESET) { \
target_prev_x = -PIXEL_NONE; \
target_prev_y = -PIXEL_NONE; \
/* Umm, shouldn't we unblit in this case? */ \

View File

@ -22444,6 +22444,7 @@ main_36_TEXT segment byte public 'CODE' use16
@pattern_2_rings_from_a2_orbs$qv procdesc near
@pattern_aimed_sling_clusters$qv procdesc near
@particles2x2_wavy_unput_update_r$qv procdesc near
@pattern_four_aimed_lasers$qv procdesc near
main_36_TEXT ends
main_36__TEXT segment byte public 'CODE' use16
@ -22455,149 +22456,6 @@ include th01/main/boss/anim.inc
sariel_shield equ <boss_entity_0>
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_2A69B proc near
push bp
mov bp, sp
cmp _boss_phase_frame, 5
jge short loc_2A6B0
push large 0
push large 0
push 99
call @spawnray_unput_and_put$qiiiii
loc_2A6B0:
cmp _boss_phase_frame, 50
jl loc_2A894
cmp _boss_phase_frame, 50
jnz short loc_2A735
mov point_3B037.x, 460
mov point_3B037.y, 120
call _vector2_between stdcall, point_3B037.x, point_3B037.y, _player_left, RES_Y, offset x_3B03D, ds, offset y_3B03B, ds, 16
mov ax, _player_left
mov word_3B03F, ax
call @sariel_select_for_rank$qmiiiii stdcall, offset _sariel_pattern_state, ds, large 60 or (64 shl 16), large 68 or (72 shl 16)
add sp, 1Eh
push 50 or (8 shl 16) ; (moveout_at_age) or (w shl 16)
push 7 ; col
push _sariel_pattern_state ; speed_multiplied_by_8
push PLAYFIELD_BOTTOM ; target_y
push _player_left ; target_left
push 460 or (120 shl 16) ; (origin_left) or (origin_y shl 16)
push ds ; this (segment)
push offset shootout_laser_0 ; this (offset)
loc_2A724:
call @CShootoutLaser@spawn$qiiiiiiii
push 6
call _mdrv2_se_play
add sp, 16h
pop bp
retn
; ---------------------------------------------------------------------------
loc_2A735:
cmp _boss_phase_frame, 100
jl loc_2A863
cmp _boss_phase_frame, 100
jnz short loc_2A79B
mov point_3B037.x, 180
mov point_3B037.y, 120
push 16
push ds
push offset y_3B03B
push ds
push offset x_3B03D
push RES_Y
mov ax, RES_X - 1
sub ax, word_3B03F
push ax
push point_3B037.y
push point_3B037.x
call _vector2_between
add sp, 12h
push 50 or (8 shl 16) ; (moveout_at_age) or (w shl 16)
push 7 ; col
push _sariel_pattern_state ; speed_multiplied_by_8
push PLAYFIELD_BOTTOM ; target_y
mov ax, (PLAYFIELD_RIGHT - 1)
sub ax, word_3B03F
push ax ; target_left
push point_3B037.y ; origin_y
push point_3B037.x ; origin_left
push ds ; this (segment)
push offset shootout_laser_1 ; this (offset)
jmp short loc_2A724
; ---------------------------------------------------------------------------
loc_2A79B:
cmp _boss_phase_frame, 150
jl loc_2A863
cmp _boss_phase_frame, 150
jnz short loc_2A7FC
mov point_3B037.x, 608
mov point_3B037.y, 164
call _vector2_between c, point_3B037.x, point_3B037.y, _player_left, RES_Y, offset x_3B03D, ds, offset y_3B03B, ds, 16
push 50 or (8 shl 16) ; (moveout_at_age) or (w shl 16)
push 7 ; col
push _sariel_pattern_state ; speed_multiplied_by_8
push PLAYFIELD_BOTTOM ; target_y
push _player_left ; target_left
push point_3B037.y ; origin_y
push point_3B037.x ; origin_left
push ds ; this (segment)
push offset shootout_laser_2 ; this (offset)
jmp loc_2A724
; ---------------------------------------------------------------------------
loc_2A7FC:
cmp _boss_phase_frame, 200
jl short loc_2A863
cmp _boss_phase_frame, 200
jnz short loc_2A85B
mov point_3B037.x, 24
mov point_3B037.y, 164
call _vector2_between c, point_3B037.x, point_3B037.y, _player_left, RES_Y, offset x_3B03D, ds, offset y_3B03B, ds, 16
push 50 or (8 shl 16) ; (moveout_at_age) or (w shl 16)
push 7 ; col
push _sariel_pattern_state ; speed_multiplied_by_8
push PLAYFIELD_BOTTOM ; target_y
push _player_left ; target_left
push point_3B037.y ; origin_y
push point_3B037.x ; origin_left
push ds ; this (segment)
push offset shootout_laser_3 ; this (offset)
jmp loc_2A724
; ---------------------------------------------------------------------------
loc_2A85B:
cmp _boss_phase_frame, 250
jge short loc_2A886
loc_2A863:
call @spawnray_unput_and_put$qiiiii pascal, ((RES_X / 2) shl 16) or 120, point_3B037.x, point_3B037.y, 7
mov ax, x_3B03D
add point_3B037.x, ax
mov ax, y_3B03B
add point_3B037.y, ax
pop bp
retn
; ---------------------------------------------------------------------------
loc_2A886:
cmp _boss_phase_frame, 300
jle short loc_2A894
mov _boss_phase_frame, 0
loc_2A894:
pop bp
retn
sub_2A69B endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
@ -25483,7 +25341,7 @@ loc_2C5D6:
call @particles2x2_wavy_unput_update_r$qv
cmp word_35E95, 0
jnz short loc_2C5FE
call sub_2A69B
call @pattern_four_aimed_lasers$qv
jmp short loc_2C631
; ---------------------------------------------------------------------------
@ -25512,7 +25370,7 @@ loc_2C624:
jnz short loc_2C631
loc_2C62B:
call sub_2A69B
call @pattern_four_aimed_lasers$qv
call sub_2A8F7
loc_2C631:
@ -27315,10 +27173,15 @@ _particles2x2_wavy_top dw PARTICLE2X2_COUNT dup(?)
_particles2x2_wavy_velocity_y dw PARTICLE2X2_COUNT dup(?)
_particles2x2_wavy_age dw PARTICLE2X2_COUNT dup(?)
point_3B037 Point <?>
y_3B03B dw ?
x_3B03D dw ?
word_3B03F dw ?
public _pattern6_origin_x, _pattern6_origin_y, _pattern6_spawnray
public _pattern6_target_first
_pattern6_origin_x dw ? ; origin_x
_pattern6_origin_y dw ? ; origin_y
_pattern6_spawnray label byte
dw ? ; velocity_y
dw ? ; velocity_x
_pattern6_target_first dw ?
angle_3B041 db ?
byte_3B042 db ?
point_3B043 Point <?>