mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th02] HUD: Full rendering
Part of P0242, funded by Yanga.
This commit is contained in:
parent
b38db78441
commit
fefeb1859d
|
@ -10,4 +10,20 @@ gb_6_ = GB_DIGITS + 6
|
|||
gb_7_ = GB_DIGITS + 7
|
||||
gb_8_ = GB_DIGITS + 8
|
||||
gb_9_ = GB_DIGITS + 9
|
||||
gb_A_ = 0AAh
|
||||
gb_C_ = 0ACh
|
||||
gb_D_ = 0ADh
|
||||
gb_E_ = 0AEh
|
||||
gb_G_ = 0B0h
|
||||
gb_H_ = 0B1h
|
||||
gb_I_ = 0B2h
|
||||
gb_L_ = 0B5h
|
||||
gb_N_ = 0B6h ; gb_MN_BUG
|
||||
gb_M_ = 0B7h ; gb_MN_BUG
|
||||
gb_O_ = 0B8h
|
||||
gb_R_ = 0BBh
|
||||
gb_S_ = 0BCh
|
||||
gb_T_ = 0BDh
|
||||
gb_U_ = 0BEh
|
||||
gb_X_ = 0C1h
|
||||
gb_Y_ = 0C2h
|
||||
|
|
|
@ -20,7 +20,18 @@ typedef enum {
|
|||
|
||||
gaiji_boldfont(0xA0),
|
||||
|
||||
gb_SP = 0xCF,
|
||||
gs_Sc,
|
||||
gs_cor,
|
||||
gs_e,
|
||||
gs_REIRYOKU_REI,
|
||||
gs_REIRYOKU_RYOKU,
|
||||
gs_REIMU_REI,
|
||||
gs_REIMU_MU,
|
||||
gs_BLANK,
|
||||
gs_REIGEKI_REI,
|
||||
gs_REIGEKI_GEKI,
|
||||
gs_Hi,
|
||||
gb_SP,
|
||||
gs_NOTES = 0xD8, // ♫
|
||||
gs_BULLET = 0xDA, // •
|
||||
gs_PERIOD, // .
|
||||
|
|
|
@ -9,6 +9,17 @@ g_BAR_MAX_2 = 042h
|
|||
g_BAR_MAX_3 = 043h
|
||||
g_BAR_MAX_4 = 044h
|
||||
|
||||
gs_NOTES = 0D8h
|
||||
gs_Sc = 0C4h
|
||||
gs_cor = 0C5h
|
||||
gs_e = 0C6h
|
||||
gs_REIRYOKU_REI = 0C7h
|
||||
gs_REIRYOKU_RYOKU = 0C8h
|
||||
gs_REIMU_REI = 0C9h
|
||||
gs_REIMU_MU = 0CAh
|
||||
gs_BLANK = 0CBh
|
||||
gs_REIGEKI_REI = 0CCh
|
||||
gs_REIGEKI_GEKI = 0CDh
|
||||
gs_Hi = 0CEh
|
||||
gb_SP = 0CFh
|
||||
gs_NOTES = 0D8h
|
||||
gs_ALL = 0F0h
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
glEASY db 0AEh, 0AAh, 0BCh, 0C2h, 0CFh, 0CFh, 0CFh, 0
|
||||
glNORMAL db 0B6h, 0B8h, 0BBh, 0B7h, 0AAh, 0B5h, 0CFh, 0
|
||||
glHARD db 0B1h, 0AAh, 0BBh, 0ADh, 0CFh, 0CFh, 0CFh, 0
|
||||
glLUNATIC db 0B5h, 0BEh, 0B6h, 0AAh, 0BDh, 0B2h, 0ACh, 0
|
||||
glEXTRA db 0AEh, 0C1h, 0BDh, 0BBh, 0AAh, 0CFh, 0CFh, 0
|
|
@ -4,6 +4,7 @@
|
|||
#include "pc98.h"
|
||||
#include "master.hpp"
|
||||
#include "shiftjis.hpp"
|
||||
#include "th01/rank.h"
|
||||
#include "th02/score.h"
|
||||
#include "th02/resident.hpp"
|
||||
#include "th02/gaiji/gaiji.h"
|
||||
|
@ -14,12 +15,32 @@ extern "C" {
|
|||
#include "th02/main/player/player.hpp"
|
||||
#include "th02/main/hud/hud.hpp"
|
||||
|
||||
// Gaiji strings
|
||||
// -------------
|
||||
// ZUN bloat: Needlessly using a consistent length ruins any chance of
|
||||
// calculating lengths at compile time. (At least in ancient C++.)
|
||||
|
||||
extern const gaiji_th02_t gsSCORE[5];
|
||||
extern const gaiji_th02_t gsHISCORE[5];
|
||||
extern const gaiji_th02_t gsREIMU[5];
|
||||
extern const gaiji_th02_t gsREIGEKI[5];
|
||||
extern const gaiji_th02_t gsREIRYOKU[5];
|
||||
|
||||
static const tram_cell_amount_t gsSCORE_W = (3 * GAIJI_TRAM_W);
|
||||
static const tram_cell_amount_t gsHISCORE_W = (4 * GAIJI_TRAM_W);
|
||||
|
||||
extern const gaiji_th02_t gRANKS[RANK_COUNT][8];
|
||||
// -------------
|
||||
|
||||
// Coordinates
|
||||
// -----------
|
||||
|
||||
static const tram_x_t HUD_CONTINUES_LEFT = (
|
||||
HUD_LEFT + ((SCORE_DIGITS - 1) * GAIJI_TRAM_W)
|
||||
);
|
||||
static const tram_x_t HUD_LABELED_LABEL_LEFT = (HUD_LEFT + HUD_LABEL_PADDING);
|
||||
|
||||
static const tram_x_t HUD_CENTER_X = (HUD_LEFT + (HUD_TRAM_W / 2));
|
||||
|
||||
static const shiftjis_kanji_amount_t HUD_LABELED_GAIJI_W = (
|
||||
HUD_LABELED_W / GAIJI_TRAM_W
|
||||
|
@ -127,3 +148,41 @@ void near hud_bombs_put(void)
|
|||
static_assert(BOMBS_MAX <= HUD_LABELED_GAIJI_W);
|
||||
hud_gaiji_tally_put(HUD_BOMBS_Y, bombs, gs_BOMB);
|
||||
}
|
||||
|
||||
inline void hud_label_put(utram_x_t left, utram_y_t y, const gaiji_th02_t* s) {
|
||||
gaiji_putsa(left, y, reinterpret_cast<const char *>(s), TX_YELLOW);
|
||||
}
|
||||
|
||||
void near hud_put(void)
|
||||
{
|
||||
hud_label_put((HUD_CENTER_X - (gsSCORE_W / 2)), (HUD_SCORE_Y - 1), gsSCORE);
|
||||
hud_score_put(HUD_SCORE_Y, score);
|
||||
hud_continues_put(HUD_SCORE_Y, resident->continues_used);
|
||||
|
||||
hud_label_put(
|
||||
(HUD_CENTER_X - (gsHISCORE_W / 2)), (HUD_HISCORE_Y - 1), gsHISCORE
|
||||
);
|
||||
hud_score_put(HUD_HISCORE_Y, hiscore);
|
||||
hud_continues_put(HUD_HISCORE_Y, hiscore_continues);
|
||||
|
||||
hud_label_put(HUD_LABELED_LABEL_LEFT, HUD_LIVES_Y, gsREIMU);
|
||||
hud_lives_put();
|
||||
|
||||
hud_label_put(HUD_LABELED_LABEL_LEFT, HUD_BOMBS_Y, gsREIGEKI);
|
||||
hud_bombs_put();
|
||||
|
||||
hud_label_put(HUD_LABELED_LABEL_LEFT, HUD_POWER_Y, gsREIRYOKU);
|
||||
player_shot_level_update_and_hud_power_put();
|
||||
|
||||
gaiji_putsa(
|
||||
HUD_LABELED_LABEL_LEFT,
|
||||
HUD_RANK_Y,
|
||||
reinterpret_cast<const char near *>(gRANKS[rank]),
|
||||
(
|
||||
(rank == RANK_EASY) ? TX_GREEN :
|
||||
(rank == RANK_NORMAL) ? TX_CYAN :
|
||||
(rank == RANK_HARD) ? TX_MAGENTA :
|
||||
/* RANK_LUNATIC */ TX_RED
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ static const tram_y_t HUD_SCORE_Y = 6;
|
|||
static const tram_y_t HUD_BOMBS_Y = 15;
|
||||
static const tram_y_t HUD_LIVES_Y = 17;
|
||||
static const tram_y_t HUD_POWER_Y = 20;
|
||||
static const tram_y_t HUD_RANK_Y = 22;
|
||||
|
||||
static const tram_cell_amount_t HUD_LABEL_PADDING = 1;
|
||||
static const tram_cell_amount_t HUD_LABEL_W = (2 * GAIJI_TRAM_W);
|
||||
|
@ -28,3 +29,6 @@ void near player_shot_level_update_and_hud_power_put(void);
|
|||
|
||||
void near hud_lives_put(void);
|
||||
void near hud_bombs_put(void);
|
||||
|
||||
// Renders the entire HUD, reflecting all current values.
|
||||
void near hud_put(void);
|
||||
|
|
|
@ -10,6 +10,7 @@ extern const int32_t EXTEND_SCORES[];
|
|||
extern unsigned int extends_gained;
|
||||
extern int32_t score_delta;
|
||||
extern int32_t hiscore;
|
||||
extern uint8_t hiscore_continues;
|
||||
|
||||
// Sets [extends_gained] based on the current [score].
|
||||
void near score_extend_init(void);
|
||||
|
|
104
th02_main.asm
104
th02_main.asm
|
@ -1254,7 +1254,7 @@ var_C = byte ptr -0Ch
|
|||
graph_accesspage 0
|
||||
call graph_clear
|
||||
graph_showpage 0
|
||||
call hud_put
|
||||
call @hud_put$qv
|
||||
call @overlay_wipe$qv
|
||||
call _pi_palette_apply stdcall, 0
|
||||
call _pi_palette_apply stdcall, 0
|
||||
|
@ -1573,7 +1573,7 @@ off_B982 dw offset loc_B63C
|
|||
sub_B98E proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
call hud_put
|
||||
call @hud_put$qv
|
||||
nopcall sub_E162
|
||||
mov ax, 0D0h
|
||||
mov word_205E8, ax
|
||||
|
@ -5346,9 +5346,6 @@ include th02/gaiji/loadfree.asm
|
|||
main_01__TEXT ends
|
||||
|
||||
HUD_TEXT segment byte public 'CODE' use16
|
||||
@HUD_SCORE_PUT$QUIL procdesc pascal near \
|
||||
y:word, value:dword
|
||||
@HUD_CONTINUES_PUT$QUII procdesc near
|
||||
@score_extend_init$qv procdesc near
|
||||
extern @score_delta_commit$qv:proc
|
||||
@score_reset$qv procdesc near
|
||||
|
@ -5357,78 +5354,10 @@ HUD_TEXT segment byte public 'CODE' use16
|
|||
@player_shot_level_update_and_hud$qv procdesc near
|
||||
@hud_lives_put$qv procdesc near
|
||||
@hud_bombs_put$qv procdesc near
|
||||
@hud_put$qv procdesc near
|
||||
HUD_TEXT ends
|
||||
|
||||
main_01___TEXT segment word public 'CODE' use16
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
public HUD_PUT
|
||||
hud_put proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
call gaiji_putsa pascal, (61 shl 16) + 5, ds, offset gsSCORE, TX_YELLOW
|
||||
call @hud_score_put$quil pascal, 6, large [_score]
|
||||
push 6
|
||||
les bx, _resident
|
||||
assume es:nothing
|
||||
push es:[bx+mikoconfig_t.continues_used]
|
||||
call @hud_continues_put$quii
|
||||
call gaiji_putsa pascal, (60 shl 16) + 3, ds, offset gsHISCORE, TX_YELLOW
|
||||
call @hud_score_put$quil pascal, 4, large [_hiscore]
|
||||
push 4
|
||||
mov al, byte_252FC
|
||||
mov ah, 0
|
||||
push ax
|
||||
call @hud_continues_put$quii
|
||||
call gaiji_putsa pascal, (57 shl 16) + 17, ds, offset gsREIMU, TX_YELLOW
|
||||
call @hud_lives_put$qv
|
||||
call gaiji_putsa pascal, (57 shl 16) + 15, ds, offset gsREIGEKI, TX_YELLOW
|
||||
call @hud_bombs_put$qv
|
||||
call gaiji_putsa pascal, (57 shl 16) + 20, ds, offset gsREIRYOKU, TX_YELLOW
|
||||
call @player_shot_level_update_and_hud$qv
|
||||
push (57 shl 16) + 22
|
||||
push ds
|
||||
mov al, _rank
|
||||
cbw
|
||||
shl ax, 3
|
||||
add ax, offset glEASY
|
||||
push ax
|
||||
cmp _rank, RANK_EASY
|
||||
jnz short loc_E0C2
|
||||
mov ax, TX_GREEN
|
||||
jmp short loc_E0E1
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_E0C2:
|
||||
mov al, _rank
|
||||
cbw
|
||||
cmp ax, RANK_NORMAL
|
||||
jnz short loc_E0D0
|
||||
mov ax, TX_CYAN
|
||||
jmp short loc_E0E1
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_E0D0:
|
||||
mov al, _rank
|
||||
cbw
|
||||
cmp ax, RANK_HARD
|
||||
jnz short loc_E0DE
|
||||
mov ax, TX_MAGENTA
|
||||
jmp short loc_E0E1
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_E0DE:
|
||||
mov ax, TX_RED
|
||||
|
||||
loc_E0E1:
|
||||
push ax
|
||||
call gaiji_putsa
|
||||
pop bp
|
||||
retn
|
||||
hud_put endp
|
||||
|
||||
main_01___TEXT segment byte public 'CODE' use16
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
@ -31372,7 +31301,7 @@ loc_1CD75:
|
|||
mov ebx, 0Ah
|
||||
cdq
|
||||
idiv ebx
|
||||
mov byte_252FC, dl
|
||||
mov _hiscore_continues, dl
|
||||
pop bp
|
||||
retf
|
||||
sub_1CD36 endp
|
||||
|
@ -31698,12 +31627,19 @@ include th02/main/hud/power[data].asm
|
|||
|
||||
_gHUD_BAR_BLANK db gb_SP, gb_SP, gb_SP, gb_SP, gb_SP, 0
|
||||
|
||||
include th02/gaiji/ranks_left[data].asm
|
||||
gsSCORE db 0C4h, 0C5h, 0C6h, 0, 0
|
||||
gsHISCORE db 0CEh, 0C4h, 0C5h, 0C6h, 0
|
||||
gsREIMU db 0C9h, 0CAh, 0, 0, 0
|
||||
gsREIGEKI db 0CCh, 0CDh, 0, 0, 0
|
||||
gsREIRYOKU db 0C7h, 0C8h, 0, 0, 0
|
||||
public _gRANKS, _gsSCORE, _gsHISCORE, _gsREIMU, _gsREIGEKI, _gsREIRYOKU
|
||||
_gRANKS label byte
|
||||
_gEASY db gb_E_, gb_A_, gb_S_, gb_Y_, gb_SP, gb_SP, gb_SP, 0
|
||||
_gNORMAL db gb_N_, gb_O_, gb_R_, gb_M_, gb_A_, gb_L_, gb_SP, 0
|
||||
_gHARD db gb_H_, gb_A_, gb_R_, gb_D_, gb_SP, gb_SP, gb_SP, 0
|
||||
_gLUNATIC db gb_L_, gb_U_, gb_N_, gb_A_, gb_T_, gb_I_, gb_C_, 0
|
||||
_gEXTRA db gb_E_, gb_X_, gb_T_, gb_R_, gb_A_, gb_SP, gb_SP, 0
|
||||
|
||||
_gsSCORE db gs_Sc, gs_cor, gs_e, 0, 0
|
||||
_gsHISCORE db gs_Hi, gs_Sc, gs_cor, gs_e, 0
|
||||
_gsREIMU db gs_REIMU_REI, gs_REIMU_MU, 0, 0, 0
|
||||
_gsREIGEKI db gs_REIGEKI_REI, gs_REIGEKI_GEKI, 0, 0, 0
|
||||
_gsREIRYOKU db gs_REIRYOKU_REI, gs_REIRYOKU_RYOKU, 0, 0, 0
|
||||
aMikoft_bft db 'MIKOFT.bft',0
|
||||
public _POWER_TO_SHOT_LEVEL
|
||||
_POWER_TO_SHOT_LEVEL db 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9
|
||||
|
@ -32844,9 +32780,9 @@ word_252F2 dw ?
|
|||
word_252F4 dw ?
|
||||
byte_252F6 db ?
|
||||
byte_252F7 db ?
|
||||
public _hiscore
|
||||
public _hiscore, _hiscore_continues
|
||||
_hiscore dd ?
|
||||
byte_252FC db ?
|
||||
_hiscore_continues db ?
|
||||
db ?
|
||||
word_252FE dw ?
|
||||
dword_25300 dd ?
|
||||
|
|
Loading…
Reference in New Issue