[Decompilation] [th01] Sariel: 50-frame screen shake

Could technically be interpreted as a subpattern as well.

Part of P0177, funded by Yanga.
This commit is contained in:
nmlgc 2022-01-04 20:03:14 +01:00
parent e4a304febe
commit 7250fe6e0f
2 changed files with 19 additions and 60 deletions

View File

@ -1723,3 +1723,20 @@ void near pattern_four_aimed_lasers(void)
#undef ORIGIN_Y_1
#undef ORIGIN_DISTANCE_X_1
}
void near shake_for_50_frames(void)
{
if(boss_phase_frame < 50) {
if((boss_phase_frame % 8) == 0) {
z_vsync_wait_and_scrollup(RES_Y - 4);
} else if((boss_phase_frame % 8) == 4) {
z_vsync_wait_and_scrollup(RES_Y + 4);
}
if((boss_phase_frame % 4) == 0) {
mdrv2_se_play(7);
}
} else if(boss_phase_frame == 50) {
z_vsync_wait_and_scrollup(0);
boss_phase_frame = 0;
}
}

View File

@ -22445,6 +22445,7 @@ main_36_TEXT segment byte public 'CODE' use16
@pattern_aimed_sling_clusters$qv procdesc near
@particles2x2_wavy_unput_update_r$qv procdesc near
@pattern_four_aimed_lasers$qv procdesc near
@shake_for_50_frames$qv procdesc near
main_36_TEXT ends
main_36__TEXT segment byte public 'CODE' use16
@ -22456,65 +22457,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_2A896 proc near
push bp
mov bp, sp
cmp _boss_phase_frame, 50
jge short loc_2A8E0
mov ax, _boss_phase_frame
mov bx, 8
cwd
idiv bx
or dx, dx
jnz short loc_2A8B2
push (RES_Y - 4)
jmp short loc_2A8C3
; ---------------------------------------------------------------------------
loc_2A8B2:
mov ax, _boss_phase_frame
mov bx, 8
cwd
idiv bx
cmp dx, 4
jnz short loc_2A8C9
push (RES_Y + 4)
loc_2A8C3:
call _z_vsync_wait_and_scrollup
pop cx
loc_2A8C9:
mov ax, _boss_phase_frame
mov bx, 4
cwd
idiv bx
or dx, dx
jnz short loc_2A8F5
push 7
call _mdrv2_se_play
pop cx
pop bp
retn
; ---------------------------------------------------------------------------
loc_2A8E0:
cmp _boss_phase_frame, 50
jnz short loc_2A8F5
call _z_vsync_wait_and_scrollup stdcall, 0
pop cx
mov _boss_phase_frame, 0
loc_2A8F5:
pop bp
retn
sub_2A896 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
@ -25361,7 +25303,7 @@ loc_2C618:
jnz short loc_2C624
loc_2C61F:
call sub_2A896
call @shake_for_50_frames$qv
jmp short loc_2C631
; ---------------------------------------------------------------------------