diff --git a/th04/boss/reset.cpp b/th04/boss/reset.cpp new file mode 100644 index 00000000..7b02617d --- /dev/null +++ b/th04/boss/reset.cpp @@ -0,0 +1,18 @@ +char boss_phase_timed_out = 0; + +void pascal near boss_reset(void) +{ + boss_update = nullsub_1; + boss_fg_render = nullfunc_near; +#if GAME == 5 + boss_custombullets_render = nullfunc_near; +#endif + boss.phase = 0; + boss.mode = 0; + boss.mode_change = 0; + boss.phase_frame = 0; + boss.pos.velocity.set(0, 0); + boss.damage_this_frame = 0; + explosions_small_reset(); + boss_phase_timed_out = 1; +} diff --git a/th04/shared.hpp b/th04/shared.hpp index 33392b2e..5fce831f 100644 --- a/th04/shared.hpp +++ b/th04/shared.hpp @@ -107,6 +107,8 @@ extern boss_stuff_t boss; extern SPPoint boss_hitbox_radius; // Callbacks +extern farfunc_t_near boss_update; +extern nearfunc_t_near boss_fg_render; extern farfunc_t_near boss_update_func; extern nearfunc_t_near boss_backdrop_colorfill; extern nearfunc_t_near boss_bg_render_func; @@ -116,6 +118,9 @@ extern nearfunc_t_near boss_fg_render_func; void pascal far name##_update(void); \ void pascal near name##_bg_render(void); \ void pascal near name##_fg_render(void); + +// Explosions +void pascal far explosions_small_reset(void); // ------ /// Score diff --git a/th05/main_01.cpp b/th05/main_01.cpp index 006e8a99..2660f782 100644 --- a/th05/main_01.cpp +++ b/th05/main_01.cpp @@ -16,10 +16,7 @@ void pascal near playfield_fillm_64_56_256_256(void); void pascal near playfield_fillm_0_0_384_192__1(void); void pascal near playfield_fillm_0_104_384_192(void); -char boss_phase_timed_out = 0; - -void pascal near boss_reset(void); - +#include "th04/boss/reset.cpp" #include "th04/formats/bb_stage.c" #include "th05/stage/setup.cpp" diff --git a/th05/th05.hpp b/th05/th05.hpp index 09b97411..0916a1ee 100644 --- a/th05/th05.hpp +++ b/th05/th05.hpp @@ -29,6 +29,9 @@ MIDBOSS_DEC(x); /// Bosses /// ------ +// Callbacks +extern nearfunc_t_near boss_custombullets_render; + extern unsigned int boss_sprite_left; extern unsigned int boss_sprite_right; extern unsigned int boss_sprite_stay; diff --git a/th05_main.asm b/th05_main.asm index 65d91d6a..6341e7b8 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -17862,30 +17862,7 @@ loc_144C4: jmp loc_14435 score_update_and_render endp - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame -public BOSS_RESET -boss_reset proc near - push bp - mov bp, sp - setfarfp _boss_update, nullsub_1 - mov _boss_fg_render, offset nullfunc_near - mov _boss_custombullets_render, offset nullfunc_near - mov _boss_phase, 0 - mov _boss_mode, 0 - mov _boss_mode_change, 0 - mov _boss_phase_frame, 0 - mov _boss_pos.velocity.x, 0 - mov _boss_pos.velocity.y, 0 - mov _boss_damage_this_frame, 0 - call explosions_small_reset - mov _boss_phase_timed_out, 1 - pop bp - retn -boss_reset endp - + BOSS_RESET procdesc near BB_STAGE_LOAD procdesc near BB_STAGE_FREE procdesc near STAGE1_SETUP procdesc near