2020-12-13 19:57:49 +00:00
|
|
|
/// Generic state variables
|
|
|
|
/// -----------------------
|
|
|
|
/// Really just freely usable memory shared between all bosses.
|
|
|
|
|
2020-12-10 18:55:36 +00:00
|
|
|
extern int boss_hp;
|
2020-12-13 19:57:49 +00:00
|
|
|
extern int boss_phase_frame;
|
2021-05-24 15:06:28 +00:00
|
|
|
extern int8_t boss_phase;
|
2020-12-13 19:57:49 +00:00
|
|
|
/// -----------------------
|
2020-12-07 20:09:42 +00:00
|
|
|
|
|
|
|
// No-op function for callbacks.
|
2021-08-15 17:42:44 +00:00
|
|
|
void pascal boss_nop(void);
|
2020-12-17 20:28:17 +00:00
|
|
|
|
|
|
|
static const int BOSS_HIT_INVINCIBILITY_FRAMES = 40;
|
|
|
|
|
|
|
|
// Processes collisions between the Orb and a boss, and the resulting
|
|
|
|
// invincibility of the latter… yeah, that's about the best summary for this
|
2022-07-17 10:42:36 +00:00
|
|
|
// function that does way too many things on the one hand, yet still leaves the
|
2022-07-17 10:48:48 +00:00
|
|
|
// caller to do way too much itself:
|
2022-07-17 10:42:36 +00:00
|
|
|
//
|
2022-06-09 18:59:27 +00:00
|
|
|
// • If a player shot hitbox is given, it also handles collisions between
|
2022-07-15 02:37:08 +00:00
|
|
|
// player shots, regardless of invincibility. At the right and bottom edges,
|
|
|
|
// the coordinates of that hitbox correspond to the top-left edge of the shot
|
|
|
|
// sprite; use the shot_hitbox_t() macro to express their width and height in
|
|
|
|
// a more visually correct way.
|
2022-07-17 10:42:36 +00:00
|
|
|
//
|
2020-12-17 20:28:17 +00:00
|
|
|
// • The hit testing against the Orb must be done before, with the result
|
|
|
|
// being passed in [colliding_with_orb]. That parameter is what mainly
|
|
|
|
// triggers the collision response of adding the [hit_score], decrementing
|
|
|
|
// [hp], bouncing off the Orb in the opposite direction, calling
|
|
|
|
// [hit_callback], and rendering the invincibility flashing effect.
|
2022-07-17 10:42:36 +00:00
|
|
|
//
|
2020-12-17 20:28:17 +00:00
|
|
|
// • The caller is still responsible to increment [invincibility_frame]. This
|
2022-07-17 10:42:36 +00:00
|
|
|
// function only reads from it or resets it to 0 once it reaches
|
|
|
|
// BOSS_HIT_INVINCIBILITY_FRAMES.
|
|
|
|
//
|
2020-12-17 20:28:17 +00:00
|
|
|
// • [is_invincible] is always updated from this function, though.
|
2022-07-17 10:42:36 +00:00
|
|
|
//
|
2020-12-17 20:28:17 +00:00
|
|
|
// • Therefore, it only indirectly returns whether the boss was hit this
|
|
|
|
// frame, via ([is_invincible] == true) && ([invincibility_frame] == 0).
|
|
|
|
// (That fact makes [is_invincible] not quite as redundant as it might seem.)
|
2022-07-17 10:42:36 +00:00
|
|
|
//
|
|
|
|
// • Once [invincibility_frame] reaches BOSS_HIT_INVINCIBILITY_FRAMES, this
|
|
|
|
// function resets the hardware palette to the [boss_palette] to end the
|
|
|
|
// flash effect, as you would expect. However, this final reset actually
|
|
|
|
// happens *regardless* of whether [is_invincible] is `true`, which can
|
|
|
|
// definitely be classified as a bug. Refer to the bug explanation in the
|
|
|
|
// function definition for more detail.
|
2020-12-17 20:28:17 +00:00
|
|
|
void boss_hit_update_and_render(
|
|
|
|
int &invincibility_frame,
|
|
|
|
bool16 &is_invincible,
|
|
|
|
int &hp,
|
2021-08-15 17:42:44 +00:00
|
|
|
const unsigned char invincibility_flash_colors[],
|
2020-12-17 20:28:17 +00:00
|
|
|
unsigned char invincibility_flash_colors_count,
|
|
|
|
int hit_score,
|
|
|
|
farfunc_t_far hit_callback,
|
|
|
|
bool colliding_with_orb,
|
2022-06-09 18:59:27 +00:00
|
|
|
screen_x_t shot_hitbox_left = 0,
|
|
|
|
screen_y_t shot_hitbox_top = 0,
|
2022-07-15 02:37:08 +00:00
|
|
|
pixel_t shot_hitbox_w_minus_shot_w = 0,
|
|
|
|
pixel_t shot_hitbox_h_minus_shot_h = 0
|
2020-12-17 20:28:17 +00:00
|
|
|
);
|
2021-05-16 22:07:03 +00:00
|
|
|
|
2021-10-30 19:59:14 +00:00
|
|
|
// Palette to fade to after the white boss defeat flash.
|
|
|
|
extern Palette4 boss_post_defeat_palette;
|
|
|
|
|
2021-05-16 22:07:03 +00:00
|
|
|
// Individual bosses
|
|
|
|
// -----------------
|
|
|
|
|
2022-08-13 00:59:53 +00:00
|
|
|
enum boss_id_t {
|
|
|
|
BID_NONE,
|
|
|
|
BID_SINGYOKU,
|
|
|
|
BID_YUUGENMAGAN,
|
|
|
|
BID_MIMA,
|
|
|
|
BID_KIKURI,
|
|
|
|
BID_ELIS,
|
|
|
|
BID_SARIEL,
|
|
|
|
BID_KONNGARA,
|
|
|
|
|
|
|
|
_boss_id_t_FORCE_INT16 = 0x7FFF
|
|
|
|
};
|
|
|
|
|
2021-11-05 19:45:34 +00:00
|
|
|
static const pixel_t SINGYOKU_W = 96;
|
|
|
|
// Actually required publically, as singyoku_defeat_animate_and_select_route()
|
|
|
|
// is part of the regular boss defeat translation unit.
|
|
|
|
static const pixel_t SINGYOKU_H = 96;
|
|
|
|
|
2022-06-17 22:24:25 +00:00
|
|
|
void singyoku_load(void);
|
2022-06-19 00:46:12 +00:00
|
|
|
void singyoku_main(void);
|
2022-06-17 22:06:07 +00:00
|
|
|
void singyoku_free(void);
|
|
|
|
|
2021-08-18 18:27:18 +00:00
|
|
|
// Makai
|
2022-06-21 17:39:02 +00:00
|
|
|
void yuugenmagan_load(void);
|
2022-07-27 20:19:30 +00:00
|
|
|
void yuugenmagan_main(void);
|
2022-07-18 18:56:01 +00:00
|
|
|
void yuugenmagan_free(void);
|
2022-06-21 17:39:02 +00:00
|
|
|
|
2021-10-30 20:45:31 +00:00
|
|
|
void elis_load(void);
|
2022-05-25 00:26:01 +00:00
|
|
|
void elis_main(void);
|
2021-10-30 19:44:58 +00:00
|
|
|
void elis_free(void);
|
|
|
|
|
2021-08-19 19:08:47 +00:00
|
|
|
void sariel_entrance(int8_t unused);
|
|
|
|
void sariel_load_and_init(void);
|
2022-08-14 06:00:51 +00:00
|
|
|
void sariel_main(void);
|
2022-08-13 00:59:53 +00:00
|
|
|
void sariel_free(void);
|
2021-08-18 18:27:18 +00:00
|
|
|
|
|
|
|
// Jigoku
|
2021-10-30 23:51:55 +00:00
|
|
|
void mima_load(void);
|
2022-07-14 02:45:45 +00:00
|
|
|
void mima_main(void);
|
2021-10-24 20:24:42 +00:00
|
|
|
void mima_free(void);
|
|
|
|
|
2022-06-05 18:03:48 +00:00
|
|
|
void kikuri_load(void);
|
2022-08-14 06:00:51 +00:00
|
|
|
void kikuri_main(void);
|
2022-06-05 18:09:30 +00:00
|
|
|
void kikuri_free(void);
|
2022-06-05 18:03:48 +00:00
|
|
|
|
2021-05-16 22:07:03 +00:00
|
|
|
void konngara_load_and_entrance(int8_t unused);
|
2021-05-24 15:18:30 +00:00
|
|
|
void konngara_init(void);
|
2021-08-16 20:18:59 +00:00
|
|
|
void konngara_main(void);
|
2021-05-24 15:22:45 +00:00
|
|
|
void konngara_free(void);
|
2021-05-16 22:07:03 +00:00
|
|
|
// -----------------
|