[Decompilation] [th04/th05] EMS: Rendering the eyecatch image

Copied in from EMS memory if available.

Completes P0168, funded by Blue Bolt and rosenrose.
This commit is contained in:
nmlgc 2021-11-17 22:29:48 +01:00
parent bd77463f59
commit 8b046dad0f
5 changed files with 38 additions and 85 deletions

View File

@ -136,3 +136,24 @@ void near bomb_bg_load__ems_preload_playchar_cdgs(void)
);
}
#endif
void near eyecatch_animate(void)
{
if(Ems) {
allocate_and_load_from_ems(
cdg_slots[CDG_EYECATCH].seg_colors(),
EMS_EYECATCH_OFFSET,
(cdg_slots[CDG_EYECATCH].bitplane_size * PLANE_COUNT)
);
} else {
cdg_load_single_noalpha(CDG_EYECATCH, eyename, 0);
}
palette_black();
cdg_put_noalpha_8(
(PLAYFIELD_LEFT + (PLAYFIELD_W / 2) - (EYECATCH_W / 2)),
(PLAYFIELD_TOP + (PLAYFIELD_H / 2) - (EYECATCH_H / 2)),
CDG_EYECATCH
);
cdg_free(CDG_EYECATCH);
palette_black_in(1);
}

View File

@ -68,4 +68,15 @@ void near bomb_bg_load__ems_preload_playchar_cdgs(void);
#if (GAME == 5)
void pascal near ems_preload_boss_faceset(const char *fn);
#endif
void near eyecatch_animate(void);
// Helper functions
// ----------------
#define allocate_and_load_from_ems(dst_seg, src_off, size) { \
reinterpret_cast<void __seg *>(dst_seg) = hmem_allocbyte(size); \
ems_read(Ems, src_off, dst_seg, size); \
}
// ----------------
/// --------------

View File

@ -3,7 +3,8 @@
#define FACESET_BOSS_COUNT 6
#define EYECATCH_W 288
#define EYECATCH_H 130
// 130 in the file, and therefore shifted towards the top of the playfield.
#define EYECATCH_H 176
#define BOMB_BG_W_MAX ((PLAYFIELD_W / 6) * 5)
#define BOMB_BG_H_MAX PLAYFIELD_H

View File

@ -710,7 +710,7 @@ loc_AF4A:
call main_01:_playfield_tram_wipe
call main_01:sub_B1D0
nopcall main_01:hud_put
call main_01:sub_B616
call @eyecatch_animate$qv
call sub_19EBC
cmp word_213DE, 0
jz short loc_AFD5
@ -1055,51 +1055,11 @@ mai_TEXT ends
EMS_TEXT segment byte public 'CODE' use16
@ems_allocate_and_preload_eyecatc$qv procdesc near
@bomb_bg_load__ems_preload_playch$qv procdesc near
@eyecatch_animate$qv procdesc near
EMS_TEXT ends
main_TEXT segment word public 'CODE' use16
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B616 proc near
push bp
mov bp, sp
cmp _Ems, 0
jz short loc_B64C
mov ax, _cdg_slots.CDG_plane_size + (size cdg_t * CDG_EYE)
shl ax, 2
push ax
call hmem_allocbyte
mov _cdg_slots.seg_colors + (size cdg_t * CDG_EYE), ax
push _Ems
pushd 0
push ax
push 0
mov ax, _cdg_slots.CDG_plane_size + (size cdg_t * CDG_EYE)
shl ax, 2
movzx eax, ax
push eax
call ems_read
jmp short loc_B65A
; ---------------------------------------------------------------------------
loc_B64C:
call cdg_load_single_noalpha pascal, CDG_EYE, [_eyename], 0
loc_B65A:
mov PaletteTone, 0
call far ptr palette_show
call cdg_put_noalpha_8 pascal, large (32 shl 16) or 112, CDG_EYE
call cdg_free pascal, CDG_EYE
push 1
call palette_black_in
pop bp
retn
sub_B616 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame

View File

@ -797,7 +797,7 @@ loc_B2DD:
call _playfield_tram_wipe
call sub_B55A
nopcall hud_put
call sub_BA66
call @eyecatch_animate$qv
call sub_172FF
cmp word_20A84, 0
jz loc_B3CA
@ -1221,50 +1221,10 @@ EMS_TEXT segment byte public 'CODE' use16
@bomb_bg_load__ems_preload_playch$qv procdesc near
@EMS_PRELOAD_BOSS_FACESET$QNXC procdesc pascal near \
fn_seg:word, fn_off:word
@eyecatch_animate$qv procdesc near
EMS_TEXT ends
CFG_LRES_TEXT segment byte public 'CODE' use16
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_BA66 proc near
push bp
mov bp, sp
cmp _Ems, 0
jz short loc_BA9C
mov ax, _cdg_slots.CDG_plane_size + (size cdg_t * CDG_EYE)
shl ax, 2
push ax
call hmem_allocbyte
mov _cdg_slots.seg_colors + (size cdg_t * CDG_EYE), ax
push _Ems
pushd 0
push ax
push 0
mov ax, _cdg_slots.CDG_plane_size + (size cdg_t * CDG_EYE)
shl ax, 2
movzx eax, ax
push eax
call ems_read
jmp short loc_BAAA
; ---------------------------------------------------------------------------
loc_BA9C:
call cdg_load_single_noalpha pascal, CDG_EYE, [_eyename], 0
loc_BAAA:
mov PaletteTone, 0
call far ptr palette_show
call cdg_put_noalpha_8 pascal, large (80 shl 16) or 112, CDG_EYE
call cdg_free pascal, CDG_EYE
push 1
call palette_black_in
pop bp
retn
sub_BA66 endp
_cfg_load_resident_ptr procdesc near
CFG_LRES_TEXT ends