mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th02] HUD: Score rendering
Part of P0242, funded by Yanga.
This commit is contained in:
parent
ef7162195a
commit
b38db78441
|
@ -4,6 +4,7 @@
|
|||
#include "pc98.h"
|
||||
#include "master.hpp"
|
||||
#include "shiftjis.hpp"
|
||||
#include "th02/score.h"
|
||||
#include "th02/resident.hpp"
|
||||
#include "th02/gaiji/gaiji.h"
|
||||
#include "th02/core/globals.hpp"
|
||||
|
@ -16,6 +17,10 @@ extern "C" {
|
|||
// Coordinates
|
||||
// -----------
|
||||
|
||||
static const tram_x_t HUD_CONTINUES_LEFT = (
|
||||
HUD_LEFT + ((SCORE_DIGITS - 1) * GAIJI_TRAM_W)
|
||||
);
|
||||
|
||||
static const shiftjis_kanji_amount_t HUD_LABELED_GAIJI_W = (
|
||||
HUD_LABELED_W / GAIJI_TRAM_W
|
||||
);
|
||||
|
@ -25,8 +30,30 @@ static const uint8_t SHOT_LEVEL_INTERVAL_BITS = 2;
|
|||
|
||||
extern uint8_t POWER_TO_SHOT_LEVEL[POWER_MAX >> SHOT_LEVEL_INTERVAL_BITS];
|
||||
|
||||
void pascal near hud_score_put(utram_y_t y, long value)
|
||||
;
|
||||
// Only prints the seven score digits, in contrast to the TH04/TH05 version!
|
||||
void pascal near hud_score_put(utram_y_t y, int32_t value)
|
||||
{
|
||||
extern int32_t SEVEN_DIGIT_POWERS_OF_10[SCORE_DIGITS - 1];
|
||||
|
||||
int32_t near* po10_p = SEVEN_DIGIT_POWERS_OF_10;
|
||||
int c;
|
||||
for(tram_x_t x = HUD_LEFT; x < HUD_CONTINUES_LEFT; x += GAIJI_TRAM_W) {
|
||||
int numeral = (value / *po10_p);
|
||||
value -= (numeral * (*po10_p));
|
||||
po10_p++;
|
||||
c = (gb_0_ + numeral);
|
||||
gaiji_putca(x, y, c, TX_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
void pascal near hud_continues_put(utram_y_t y, int continues_used)
|
||||
{
|
||||
if(continues_used >= 10) {
|
||||
continues_used = 9;
|
||||
}
|
||||
int c = (gb_0_ + continues_used);
|
||||
gaiji_putca(HUD_CONTINUES_LEFT, y, c, TX_WHITE);
|
||||
}
|
||||
|
||||
#include "th02/main/score.cpp"
|
||||
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
HUD_CONTINUES_LEFT = HUD_LEFT + ((SCORE_DIGITS - 1) * 2)
|
||||
|
||||
; Only prints the seven score digits, in contrast to the TH04/TH05 version!
|
||||
|
||||
public @HUD_SCORE_PUT$QUIL
|
||||
@hud_score_put$quil proc near
|
||||
@@result = word ptr [bp-4]
|
||||
@@digit = word ptr [bp-2]
|
||||
@@value = dword ptr [bp+4]
|
||||
@@y = word ptr [bp+8]
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 4
|
||||
push si
|
||||
push di
|
||||
mov si, offset _SEVEN_DIGIT_POWERS_OF_10
|
||||
mov di, HUD_LEFT
|
||||
jmp short @@more_digits?
|
||||
|
||||
@@put:
|
||||
mov eax, @@value
|
||||
cdq
|
||||
idiv dword ptr [si]
|
||||
mov @@result, ax
|
||||
movsx eax, @@result
|
||||
imul eax, [si]
|
||||
sub @@value, eax
|
||||
add si, 4
|
||||
mov ax, @@result
|
||||
add ax, GB_DIGITS
|
||||
mov @@digit, ax
|
||||
call gaiji_putca pascal, di, @@y, ax, TX_WHITE
|
||||
add di, 2
|
||||
|
||||
@@more_digits?:
|
||||
cmp di, HUD_CONTINUES_LEFT
|
||||
jl short @@put
|
||||
pop di
|
||||
pop si
|
||||
leave
|
||||
retn 6
|
||||
@hud_score_put$quil endp
|
||||
|
||||
|
||||
; void pascal near hud_continues_put(utram_y_t y, int continues_used);
|
||||
public HUD_CONTINUES_PUT
|
||||
hud_continues_put proc near
|
||||
|
||||
@@continues_displayed = word ptr [bp-2]
|
||||
@@continues_used = word ptr [bp+4]
|
||||
@@y = word ptr [bp+6]
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
sub sp, 2
|
||||
push si
|
||||
mov si, @@continues_used
|
||||
cmp si, 10
|
||||
jl short @@put
|
||||
mov si, 9
|
||||
|
||||
@@put:
|
||||
lea ax, [si+GB_DIGITS]
|
||||
mov @@continues_displayed, ax
|
||||
call gaiji_putca pascal, HUD_CONTINUES_LEFT, @@y, ax, TX_WHITE
|
||||
pop si
|
||||
leave
|
||||
retn 4
|
||||
hud_continues_put endp
|
|
@ -5343,10 +5343,12 @@ loc_DC31:
|
|||
sub_DAF0 endp
|
||||
|
||||
include th02/gaiji/loadfree.asm
|
||||
include th02/main/hud/score_put.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
|
||||
|
@ -5372,14 +5374,14 @@ hud_put proc near
|
|||
les bx, _resident
|
||||
assume es:nothing
|
||||
push es:[bx+mikoconfig_t.continues_used]
|
||||
call hud_continues_put
|
||||
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
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue