[Maintenance] [th04/th05] Move midboss declarations to their own header file

Part of P0147, funded by -Tom- and Ember2528.
This commit is contained in:
nmlgc 2021-06-13 12:52:58 +02:00
parent 456b621c3a
commit 11b5febc5a
4 changed files with 33 additions and 35 deletions

View File

@ -0,0 +1,31 @@
typedef struct {
motion_t pos;
unsigned int frames_until;
int hp;
unsigned char sprite;
unsigned char phase;
int phase_frame;
// Treated as a bool in TH04
unsigned char damage_this_frame;
unsigned char angle;
} midboss_stuff_t;
extern midboss_stuff_t midboss;
// Callbacks
extern farfunc_t_near midboss_update_func;
extern nearfunc_t_near midboss_render_func;
#define MIDBOSS_DEC(stage) \
void pascal far midboss##stage##_update(void); \
void pascal near midboss##stage##_render(void);
// "midbosses" unfortunately has 9 characters and therefore won't work as a
// 8.3 filename. However, since these have no names anyway, we can just
// declare all of them here.
MIDBOSS_DEC(1);
MIDBOSS_DEC(2);
MIDBOSS_DEC(3);
MIDBOSS_DEC(4);
MIDBOSS_DEC(5);
MIDBOSS_DEC(x);

View File

@ -32,31 +32,6 @@ extern nearfunc_t_near stage_invalidate;
extern nearfunc_t_near stage_render;
/// ------
/// Midbosses
/// ---------
typedef struct {
motion_t pos;
unsigned int frames_until;
int hp;
unsigned char sprite;
unsigned char phase;
int phase_frame;
// Treated as a bool in TH04
unsigned char damage_this_frame;
unsigned char angle;
} midboss_stuff_t;
extern midboss_stuff_t midboss;
// Callbacks
extern farfunc_t_near midboss_update_func;
extern nearfunc_t_near midboss_render_func;
#define MIDBOSS_DEC(stage) \
void pascal far midboss##stage##_update(void); \
void pascal near midboss##stage##_render(void);
/// ---------
/// Score
/// -----
extern unsigned long score_delta;

View File

@ -3,6 +3,8 @@
* TH05 stage initialization
*/
#include "th04/main/midboss/midboss.hpp"
void pascal near stage1_setup(void)
{
midboss_update_func = midboss1_update;

View File

@ -19,16 +19,6 @@ void pascal near stage2_update(void);
void pascal near stage2_invalidate(void);
/// ------
/// Midbosses
/// ---------
MIDBOSS_DEC(1);
MIDBOSS_DEC(2);
MIDBOSS_DEC(3);
MIDBOSS_DEC(4);
MIDBOSS_DEC(5);
MIDBOSS_DEC(x);
/// ---------
/// Bosses
/// ------
#include "th05/main/boss/boss.hpp"