[Decompilation] [th05] Sara: Background rendering

Using the .BB entrance animation as a transition between stage tiles
and the backdrop image. Also implemented in a much better way.

Part of P0189, funded by Arandui and Lmocinemod.
This commit is contained in:
nmlgc 2022-04-03 21:23:51 +02:00
parent 5655b53f10
commit 0d703fb2e1
4 changed files with 38 additions and 58 deletions

View File

@ -44,3 +44,24 @@
tiles_render_after_custom(boss.phase_frame); \
} \
}
// 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 \
) { \
if(boss.phase == PHASE_BOSS_HP_FILL) { \
on_hp_fill; \
} else if(boss.phase == PHASE_BOSS_ENTRANCE_BB) { \
boss_backdrop_render(backdrop_left, backdrop_top, backdrop_col); \
tiles_bb_invalidate(bb_boss_seg, (boss.phase_frame / 2)); \
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); \
} \
}

View File

@ -6,6 +6,12 @@
// Image coordinates
// -----------------
static const pixel_t SARA_BACKDROP_W = 320;
static const screen_x_t SARA_BACKDROP_LEFT = (
PLAYFIELD_LEFT + (PLAYFIELD_W / 2) - (SARA_BACKDROP_W / 2)
);
static const screen_y_t SARA_BACKDROP_TOP = PLAYFIELD_TOP;
static const screen_x_t LOUISE_BACKDROP_LEFT = PLAYFIELD_LEFT;
static const screen_y_t LOUISE_BACKDROP_TOP = PLAYFIELD_TOP;

View File

@ -66,6 +66,16 @@ extern boss_particle_t boss_particles[BOSS_PARTICLE_COUNT];
extern lineset_t linesets[LINESET_COUNT];
/// ----------
void pascal near sara_bg_render(void)
{
boss_bg_render_entrance_bb_transition_and_backdrop(
tiles_render_after_custom(boss.phase_frame),
SARA_BACKDROP_LEFT,
SARA_BACKDROP_TOP,
0
);
}
void pascal near louise_bg_render(void)
{
boss_bg_render_entrance_bb_opaque_and_backdrop(

View File

@ -2810,64 +2810,7 @@ loc_D060:
sub_D032 endp
include th04/main/boss/backdrop.asm
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
public @SARA_BG_RENDER$QV
@sara_bg_render$qv proc near
push bp
mov bp, sp
cmp _boss_phase, PHASE_BOSS_HP_FILL
jnz short loc_D09F
cmp _boss_phase_frame, 2
jg short loc_D0EF
jmp short loc_D0EA
; ---------------------------------------------------------------------------
loc_D09F:
cmp _boss_phase, PHASE_BOSS_ENTRANCE_BB
jnz short loc_D0C8
call @boss_backdrop_render$qiic pascal, (64 shl 16) or 16, 0
mov ax, _bb_boss_seg
mov _tiles_bb_seg, ax
mov ax, _boss_phase_frame
cwd
sub ax, dx
sar ax, 1
call @tiles_bb_invalidate_raw$qi pascal, ax
call tiles_redraw_invalidated
pop bp
retn
; ---------------------------------------------------------------------------
loc_D0C8:
cmp _boss_phase, PHASE_BOSS_EXPLODE_BIG
jnb short loc_D0DC
call @boss_backdrop_render$qiic pascal, (64 shl 16) or 16, 0
pop bp
retn
; ---------------------------------------------------------------------------
loc_D0DC:
cmp _boss_phase, PHASE_BOSS_EXPLODE_BIG
jz short loc_D0EA
cmp _boss_phase_frame, 2
jg short loc_D0EF
loc_D0EA:
call tiles_render_all
pop bp
retn
; ---------------------------------------------------------------------------
loc_D0EF:
call tiles_render
pop bp
retn
@sara_bg_render$qv endp
@SARA_BG_RENDER$QV procdesc pascal near
@LOUISE_BG_RENDER$QV procdesc pascal near
@ALICE_BG_RENDER$QV procdesc pascal near
@MAI_YUKI_BG_RENDER$QV procdesc pascal near