[Decompilation] [th05] Resetting boss-related variables

Part of P0031, funded by zorg.
This commit is contained in:
nmlgc 2019-09-16 14:07:37 +02:00
parent b0c2122eec
commit 3383a4558b
5 changed files with 28 additions and 28 deletions

18
th04/boss/reset.cpp Normal file
View File

@ -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;
}

View File

@ -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

View File

@ -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"

View File

@ -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;

View File

@ -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