2022-04-02 18:38:00 +00:00
|
|
|
// Shared boss implementation macros.
|
|
|
|
|
2024-05-17 12:15:24 +00:00
|
|
|
#include "th01/hardware/grcg.hpp"
|
|
|
|
|
2022-04-02 18:38:00 +00:00
|
|
|
// Common implementation of [boss_bg_render]:
|
|
|
|
// 1) Stage tiles before and after the fight
|
|
|
|
// 2) A static backdrop image during the fight
|
|
|
|
// 3) An opaque .BB tile animation as the transition between 1) and 2),
|
|
|
|
// rendered on top of 1) during its first half, and on top of 2) during its
|
|
|
|
// second half.
|
|
|
|
#define boss_bg_render_entrance_bb_opaque_and_backdrop( \
|
|
|
|
on_hp_fill, \
|
|
|
|
entrance_bb_cel_type, /* MODDERS: Pick one, and remove this parameter */ \
|
|
|
|
entrance_bb_frames_per_cel, \
|
|
|
|
backdrop_left, \
|
|
|
|
backdrop_top, \
|
|
|
|
backdrop_col, \
|
|
|
|
backdrop_colorfill, /* MODDERS: Remove, and call boss_backdrop_render() */ \
|
|
|
|
bb_col \
|
|
|
|
) { \
|
2022-04-23 22:38:31 +00:00
|
|
|
if(boss.phase == PHASE_HP_FILL) { \
|
2022-04-02 18:38:00 +00:00
|
|
|
on_hp_fill; \
|
|
|
|
} else if(boss.phase == PHASE_BOSS_ENTRANCE_BB) { \
|
|
|
|
entrance_bb_cel_type entrance_cel = ( \
|
|
|
|
boss.phase_frame / entrance_bb_frames_per_cel \
|
|
|
|
); \
|
|
|
|
if(entrance_cel < (TILES_BB_CELS / 2)) { \
|
|
|
|
tiles_render_all(); \
|
|
|
|
} else { \
|
|
|
|
/* A copy of boss_backdrop_render()… */ \
|
|
|
|
grcg_setmode_tdw(); \
|
2022-04-24 18:01:47 +00:00
|
|
|
grcg_setcolor_direct(backdrop_col); \
|
2022-04-02 18:38:00 +00:00
|
|
|
/* … that probably predated [boss_backdrop_colorfill]? */ \
|
|
|
|
backdrop_colorfill(); \
|
|
|
|
grcg_off(); \
|
|
|
|
\
|
|
|
|
cdg_put_noalpha_8(backdrop_left, backdrop_top, CDG_BG_BOSS); \
|
|
|
|
} \
|
|
|
|
tiles_bb_col = bb_col; \
|
|
|
|
tiles_bb_put(bb_boss_seg, entrance_cel); \
|
|
|
|
} else if(boss.phase < PHASE_BOSS_EXPLODE_BIG) { \
|
|
|
|
boss_backdrop_render(backdrop_left, backdrop_top, backdrop_col); \
|
|
|
|
} else if(boss.phase == PHASE_BOSS_EXPLODE_BIG) { \
|
|
|
|
tiles_render_all(); \
|
|
|
|
} else /* if(boss.phase == PHASE_NONE) */ { \
|
|
|
|
tiles_render_after_custom(boss.phase_frame); \
|
|
|
|
} \
|
|
|
|
}
|
2022-04-03 19:23:51 +00:00
|
|
|
|
|
|
|
// Like boss_bg_render_entrance_bb_opaque_and_backdrop(), but rendering 3) as
|
|
|
|
// a transition between stage tiles (where the entrance .BB bit is 0) and the
|
|
|
|
// backdrop image (where the entrance .BB bit is 1).
|
|
|
|
#define boss_bg_render_entrance_bb_transition_and_backdrop( \
|
|
|
|
on_hp_fill, backdrop_left, backdrop_top, backdrop_col \
|
|
|
|
) { \
|
2022-04-23 22:38:31 +00:00
|
|
|
if(boss.phase == PHASE_HP_FILL) { \
|
2022-04-03 19:23:51 +00:00
|
|
|
on_hp_fill; \
|
|
|
|
} else if(boss.phase == PHASE_BOSS_ENTRANCE_BB) { \
|
|
|
|
boss_backdrop_render(backdrop_left, backdrop_top, backdrop_col); \
|
2022-12-18 18:29:27 +00:00
|
|
|
tiles_bb_invalidate( \
|
|
|
|
bb_boss_seg, \
|
|
|
|
(boss.phase_frame / ENTRANCE_BB_TRANSITION_FRAMES_PER_CEL) \
|
|
|
|
); \
|
2022-04-03 19:23:51 +00:00
|
|
|
tiles_redraw_invalidated(); \
|
|
|
|
} else if(boss.phase < PHASE_BOSS_EXPLODE_BIG) { \
|
|
|
|
boss_backdrop_render(backdrop_left, backdrop_top, backdrop_col); \
|
|
|
|
} else if(boss.phase == PHASE_BOSS_EXPLODE_BIG) { \
|
|
|
|
tiles_render_all(); \
|
|
|
|
} else /* if(boss.phase == PHASE_NONE) */ { \
|
|
|
|
tiles_render_after_custom(boss.phase_frame); \
|
|
|
|
} \
|
|
|
|
}
|