[Decompilation] [th05] Shinki: Pattern 2/11

The one where Shinki fires two simultaneous rings of blue bullets, with
the second one moving twice as fast.

Part of P0190, funded by nrook.
This commit is contained in:
nmlgc 2022-03-30 16:29:49 +02:00
parent 4ca195b6cb
commit 3fc58928ec
2 changed files with 38 additions and 66 deletions

View File

@ -9,7 +9,9 @@
#include "th04/math/motion.hpp"
extern "C" {
#include "th04/math/randring.hpp"
#include "th04/math/vector.hpp"
#include "th04/snd/snd.h"
#include "th04/main/rank.hpp"
#include "th04/main/playfld.hpp"
#include "th04/main/bullet/bullet.hpp"
}
@ -47,3 +49,37 @@ bool near pattern_curved_rings(void)
#undef delta_angle
}
bool near pattern_dualspeed_rings(void)
{
#define interval boss_statebyte[15]
if(boss.phase_frame == PHASE_2_3_PATTERN_START_FRAME) {
bullet_template.spawn_type = (BST_CLOUD_FORWARDS | BST_NO_SLOWDOWN);
bullet_template.patnum = PAT_BULLET16_N_BLUE;
bullet_template.group = BG_RING;
bullet_template.angle = randring2_next16();
bullet_template.spread = 16;
interval = select_for_rank(16, 12, 8, 4);
}
if((boss.phase_frame % interval) == 0) {
vector2_at(
bullet_template.origin,
boss.pos.cur.x,
boss.pos.cur.y,
randring2_next16_mod(to_sp(32.0f)),
bullet_template.angle
);
bullet_template.speed.set(2.0f);
bullets_add_regular();
bullet_template.speed.set(4.0f);
bullet_template.angle += 0x08;
bullets_add_regular();
snd_se_play(3);
}
return (boss.phase_frame == (PHASE_2_3_PATTERN_START_FRAME + 64));
#undef interval
}

View File

@ -19177,75 +19177,11 @@ BOSS_6_TEXT segment byte public 'CODE' use16
@b6balls_add$qv procdesc near
@b6balls_update$qv procdesc near
@pattern_curved_rings$qv procdesc near
@pattern_dualspeed_rings$qv procdesc near
BOSS_6_TEXT ends
BOSS_X_TEXT segment byte public 'CODE' use16
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_1D6E1 proc near
push bp
mov bp, sp
cmp _boss_phase_frame, 32
jnz short loc_1D719
mov _bullet_template.spawn_type, BST_CLOUD_FORWARDS or BST_NO_SLOWDOWN
mov _bullet_template.patnum, PAT_BULLET16_N_BLUE
mov _bullet_template.BT_group, BG_RING
call randring2_next16
mov _bullet_template.BT_angle, al
mov _bullet_template.spread, 16
push (10h shl 16) or 0Ch
push ( 8h shl 16) or 4h
call select_for_rank
mov _boss_statebyte[15], al
loc_1D719:
mov al, _boss_statebyte[15]
mov ah, 0
push ax
mov ax, _boss_phase_frame
cwd
pop bx
idiv bx
or dx, dx
jnz short loc_1D766
push offset _bullet_template.BT_origin
push _boss_pos.cur.x
push _boss_pos.cur.y
push (32 shl 4)
call randring2_next16_mod
push ax
mov al, _bullet_template.BT_angle
mov ah, 0
push ax
call vector2_at
mov _bullet_template.speed, (2 shl 4)
call _bullets_add_regular
mov _bullet_template.speed, (4 shl 4)
mov al, _bullet_template.BT_angle
add al, 8
mov _bullet_template.BT_angle, al
call _bullets_add_regular
call snd_se_play pascal, 3
loc_1D766:
cmp _boss_phase_frame, 96
jnz short loc_1D772
mov ax, 1
jmp short loc_1D774
; ---------------------------------------------------------------------------
loc_1D772:
xor ax, ax
loc_1D774:
pop bp
retn
sub_1D6E1 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
@ -23119,7 +23055,7 @@ off_22832 dw offset sub_1CCD3
dw 0
dw 0
off_2284A dw offset @pattern_curved_rings$qv
dw offset sub_1D6E1
dw offset @pattern_dualspeed_rings$qv
dw offset sub_1D7DC
dw offset sub_1D83A
word_22852 dw 0