diff --git a/th05/main/boss/b6.cpp b/th05/main/boss/b6.cpp index 9085e687..ff7607a6 100644 --- a/th05/main/boss/b6.cpp +++ b/th05/main/boss/b6.cpp @@ -24,6 +24,7 @@ extern "C" { #include "th05/main/bullet/cheeto.hpp" #include "th05/main/bullet/laser.hpp" #include "th05/main/boss/boss.hpp" +#include "th05/main/player/player.hpp" #include "th05/sprites/main_pat.h" // Constants @@ -381,3 +382,47 @@ bool near pattern_wings_to_purple(void) } return (boss.phase_frame == 200); } + +void near pattern_aimed_b6balls_and_symmetric_spreads(void) +{ + #define b6ball_interval boss_statebyte[15] + + if(boss.phase_frame <= 128) { + return; + } + if(boss.phase_frame == 129) { + b6ball_interval = select_for_rank(96, 32, 28, 24); + } + + int spread_cycle = (boss.phase_frame % (0x40 * 2)); + + if((boss.phase_frame % b6ball_interval) == 0) { + b6ball_template.angle = player_angle_from(b6ball_template.origin); + b6ball_template.speed.set(4.0f); + b6ball_template.patnum_tiny = PAT_B6BALL_PURPLE; + b6balls_add(); + } + if((boss.phase_frame % 4) == 0) { + bullet_template.origin.x -= (SHINKI_WING_W / 2); + bullet_template.group = BG_SPREAD; + bullet_template.special_motion = BSM_EXACT_LINEAR; + bullet_template.set_spread(3, 0x02); + bullet_template.spawn_type = (BST_CLOUD_FORWARDS | BST_NO_SLOWDOWN); + bullet_template.speed.set(2.5f); + bullet_template.patnum = PAT_BULLET16_V_RED; + if(spread_cycle < 0x40) { + bullet_template.angle = (spread_cycle * 3); + } else { + bullet_template.angle = (0x40 - (spread_cycle * 3)); + } + bullets_add_special(); + + bullet_template.angle = (0x80 - bullet_template.angle); + bullet_template.origin.x += SHINKI_WING_W; + bullets_add_special(); + + snd_se_play(15); + } + + #undef b6ball_interval +} diff --git a/th05/main/player/player.hpp b/th05/main/player/player.hpp index b0e008ed..6f6a7fec 100644 --- a/th05/main/player/player.hpp +++ b/th05/main/player/player.hpp @@ -5,3 +5,9 @@ unsigned char pascal near player_angle_from( Subpixel x, Subpixel y, unsigned char plus_angle = 0 ); + +inline unsigned char near player_angle_from( + const PlayfieldPoint &point, unsigned char plus_angle = 0 +) { + return player_angle_from(point.x, point.y, plus_angle); +} diff --git a/th05_main.asm b/th05_main.asm index d3c30209..79dbd0bd 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -19185,93 +19185,11 @@ BOSS_6_TEXT segment byte public 'CODE' use16 @pattern_random_rain_and_spreads_$qv procdesc near @pattern_cheetos_within_spread_wa$qv procdesc near @pattern_wings_to_purple$qv procdesc near + @pattern_aimed_b6balls_and_symmet$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_1DC2F proc near - push bp - mov bp, sp - push si - cmp _boss_phase_frame, 128 - jle loc_1DCFD - cmp _boss_phase_frame, 129 - jnz short loc_1DC59 - push (60h shl 16) or 20h - push (1Ch shl 16) or 18h - call select_for_rank - mov _boss_statebyte[15], al - -loc_1DC59: - mov ax, _boss_phase_frame - mov bx, 128 - cwd - idiv bx - mov si, dx - 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_1DC93 - call @player_angle_from$q20%SubpixelBase$ti$ti%t1uc pascal, b6ball_template.pos.cur.x, b6ball_template.pos.cur.y, 0 - mov b6ball_template.B6B_angle, al - mov b6ball_template.B6B_speed, (4 shl 4) - mov b6ball_template.B6B_patnum_tiny, PAT_B6BALL_PURPLE - call @b6balls_add$qv - -loc_1DC93: - mov ax, _boss_phase_frame - mov bx, 4 - cwd - idiv bx - or dx, dx - jnz short loc_1DCFD - sub _bullet_template.BT_origin.x, (128 shl 4) - mov _bullet_template.BT_group, BG_SPREAD - mov _bullet_template.BT_special_motion, BSM_EXACT_LINEAR - mov word ptr _bullet_template.spread, (2 shl 8) or 3 - mov _bullet_template.spawn_type, BST_CLOUD_FORWARDS or BST_NO_SLOWDOWN - mov _bullet_template.speed, (2 shl 4) + 8 - mov _bullet_template.patnum, PAT_BULLET16_V_RED - cmp si, 64 - jge short loc_1DCD4 - mov ax, si - imul ax, 3 - mov _bullet_template.BT_angle, al - jmp short loc_1DCE1 -; --------------------------------------------------------------------------- - -loc_1DCD4: - mov ax, si - imul ax, 3 - mov dl, 64 - sub dl, al - mov _bullet_template.BT_angle, dl - -loc_1DCE1: - call _bullets_add_special - mov al, 80h - sub al, _bullet_template.BT_angle - mov _bullet_template.BT_angle, al - add _bullet_template.BT_origin.x, (256 shl 4) - call _bullets_add_special - call snd_se_play pascal, 15 - -loc_1DCFD: - pop si - pop bp - retn -sub_1DC2F endp - - ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame @@ -19916,7 +19834,7 @@ loc_1E3E7: jz loc_1E527 inc _boss_phase mov _boss_phase_frame, 0 - mov fp_2CE4A, offset sub_1DC2F + mov fp_2CE4A, offset @pattern_aimed_b6balls_and_symmet$qv jmp loc_1E36F ; ---------------------------------------------------------------------------