From 4ea60d1155b6f9ff940c48d29a56ad8954415f67 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Fri, 15 Apr 2022 22:05:37 +0200 Subject: [PATCH] [Decompilation] [th05] Shinki: Pattern 6/11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The one where random blue 32×32 bullets rain from near the top of the playfield, together with aimed spreads from random positions on Shinki's wings. First white-wing pattern. Part of P0190, funded by nrook. --- th04/main/pattern.hpp | 4 +++ th05/main/boss/b6.cpp | 37 ++++++++++++++++++++++++ th05_main.asm | 66 ++----------------------------------------- 3 files changed, 43 insertions(+), 64 deletions(-) diff --git a/th04/main/pattern.hpp b/th04/main/pattern.hpp index f52a5dd5..9b287b4a 100644 --- a/th04/main/pattern.hpp +++ b/th04/main/pattern.hpp @@ -1,3 +1,7 @@ +// A danmaku pattern function with no fixed maximum time. Fires projectiles in +// repeating cycles until no longer called. +typedef void (near *near pattern_loop_func_t)(void); + // A danmaku pattern function that runs for a limited amount of time. Should // return `true` when done. typedef bool (near *near pattern_oneshot_func_t)(void); diff --git a/th05/main/boss/b6.cpp b/th05/main/boss/b6.cpp index 0d5300ba..1fca2c97 100644 --- a/th05/main/boss/b6.cpp +++ b/th05/main/boss/b6.cpp @@ -19,6 +19,8 @@ extern "C" { #include "th04/main/bullet/bullet.hpp" #include "th04/main/gather.hpp" } +#include "th05/main/custom.h" +#include "th05/main/bullet/b6ball.hpp" #include "th05/main/bullet/laser.hpp" #include "th05/main/boss/boss.hpp" #include "th05/sprites/main_pat.h" @@ -274,3 +276,38 @@ bool near pattern_wing_preparation(void) #undef wing_frames #undef tone } + +void near pattern_random_rain_and_spreads_from_wings(void) +{ + if(boss.phase_frame <= 128) { + return; + } + if((boss.phase_frame % 8) == 0) { + b6ball_template.origin.x.v = randring2_next16_mod(to_sp(PLAYFIELD_W)); + b6ball_template.origin.y.v = randring2_next16_ge_lt_sp( + ((2 / 23.0f) * PLAYFIELD_H), ((6 / 23.0f) * PLAYFIELD_H) + ); + b6ball_template.angle = 0x40; + b6ball_template.speed.v = randring2_next8_and_ge_lt_sp(3.0f, 5.0f); + b6ball_template.patnum_tiny = PAT_B6BALL_BLUE_1; + b6balls_add(); + snd_se_play(3); + } + if((boss.phase_frame % 24) == 0) { + bullet_template.origin.x.v = shinki_wing_random_x(); + bullet_template.origin.y.v = ( + boss.pos.cur.y.v - randring2_next16_mod(to_sp(BOSS_H)) + ); + bullet_template.spawn_type = (BST_CLOUD_FORWARDS | BST_NO_SLOWDOWN); + bullet_template.patnum = PAT_BULLET16_N_BLUE; + bullet_template.group = BG_SPREAD_AIMED; + bullet_template.spread = 5; + bullet_template.spread_angle_delta = select_for_rank( + 0x10, 0x0C, 0x0A, 0x08 + ); + bullet_template.angle = 0x00; + bullet_template.speed.set(3.0f); + bullet_template_tune(); + bullets_add_regular(); + } +} diff --git a/th05_main.asm b/th05_main.asm index f8ee006d..b8a8d0d7 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -19182,73 +19182,11 @@ BOSS_6_TEXT segment byte public 'CODE' use16 @pattern_random_directional_and_k$qv procdesc near @pattern_dense_blue_stacks$qv procdesc near @pattern_wing_preparation$qv procdesc near + @pattern_random_rain_and_spreads_$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_1DA1C proc near - push bp - mov bp, sp - cmp _boss_phase_frame, 128 - jle loc_1DAD0 - mov ax, _boss_phase_frame - mov bx, 8 - cwd - idiv bx - or dx, dx - jnz short loc_1DA6A - call randring2_next16_mod pascal, (PLAYFIELD_W shl 4) - mov b6ball_template.pos.cur.x, ax - call randring2_next16_mod pascal, (64 shl 4) - add ax, (32 shl 4) - mov b6ball_template.pos.cur.y, ax - mov b6ball_template.B6B_angle, 40h - call randring2_next16_and pascal, 1Fh - add al, (3 shl 4) - mov b6ball_template.B6B_speed, al - mov b6ball_template.B6B_patnum_tiny, PAT_B6BALL_BLUE_1 - call @b6balls_add$qv - call snd_se_play pascal, 3 - -loc_1DA6A: - mov ax, _boss_phase_frame - mov bx, 24 - cwd - idiv bx - or dx, dx - jnz short loc_1DAD0 - call randring2_next16_mod pascal, (256 shl 4) - add ax, _boss_pos.cur.x - sub ax, (128 shl 4) - mov _bullet_template.BT_origin.x, ax - push (64 shl 4) - call randring2_next16_mod - mov dx, _boss_pos.cur.y - sub dx, ax - mov _bullet_template.BT_origin.y, dx - 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_SPREAD_AIMED - mov _bullet_template.spread, 5 - push (16 shl 16) or 12 - push (10 shl 16) or 8 - call select_for_rank - mov _bullet_template.spread_angle_delta, al - mov _bullet_template.BT_angle, 0 - mov _bullet_template.speed, (3 shl 4) - call _bullet_template_tune - call _bullets_add_regular - -loc_1DAD0: - pop bp - retn -sub_1DA1C endp - - ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame @@ -20065,7 +20003,7 @@ loc_1E333: push ((45 shl 4) shl 16) or (50 shl 4) call @select_for_playchar$qiiii mov _boss_hitbox_radius.x, ax - mov fp_2CE4A, offset sub_1DA1C + mov fp_2CE4A, offset @pattern_random_rain_and_spreads_$qv loc_1E36F: mov _boss_statebyte[10], 0