mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th04] Bonus popup point display
Part of P0148, funded by [Anonymous].
This commit is contained in:
parent
3a41604314
commit
a6ace813e4
|
@ -1,63 +0,0 @@
|
|||
if GAME eq 4
|
||||
; Yes, specific to the bonus popup, due to the hardcoded position.
|
||||
public POPUP_PUT_POINTS_TH04
|
||||
popup_put_points_th04 proc pascal near
|
||||
arg @@points:dword
|
||||
local @@digit:dword, @@divisor:dword, @@buf:byte:SCORE_DIGITS + 2 ; padding...
|
||||
|
||||
push si
|
||||
push di
|
||||
mov @@divisor, 1000000
|
||||
xor si, si
|
||||
xor di, di
|
||||
jmp short @@more_digits?
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
@@digit_loop:
|
||||
mov eax, @@points
|
||||
xor edx, edx
|
||||
div @@divisor
|
||||
mov @@digit, eax
|
||||
mov eax, @@points
|
||||
xor edx, edx
|
||||
div @@divisor
|
||||
mov @@points, edx
|
||||
or di, word ptr @@digit
|
||||
or di, di
|
||||
jz short @@omit_leading_zeroes
|
||||
mov al, byte ptr @@digit
|
||||
add al, GB_DIGITS
|
||||
mov @@buf[si], al
|
||||
jmp short @@divisor_next
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
@@omit_leading_zeroes:
|
||||
mov @@buf[si], g_EMPTY
|
||||
|
||||
@@divisor_next:
|
||||
mov ebx, 10
|
||||
mov eax, @@divisor
|
||||
xor edx, edx
|
||||
div ebx
|
||||
mov @@divisor, eax
|
||||
inc si
|
||||
|
||||
@@more_digits?:
|
||||
cmp @@divisor, 1
|
||||
ja short @@digit_loop
|
||||
mov al, byte ptr @@points
|
||||
add al, gb_0_
|
||||
mov @@buf[SCORE_DIGITS - 2], al ; (ones)
|
||||
mov @@buf[SCORE_DIGITS - 1], gb_0_ ; ("continues used" digit)
|
||||
mov @@buf[SCORE_DIGITS - 0], 0 ; (null terminator)
|
||||
push ((PLAYFIELD_TRAM_LEFT + (PLAYFIELD_TRAM_W / 2)) shl 16) + POPUP_TRAM_Y
|
||||
push ss
|
||||
lea ax, @@buf
|
||||
push ax
|
||||
push TX_WHITE
|
||||
call gaiji_putsa
|
||||
pop di
|
||||
pop si
|
||||
ret
|
||||
popup_put_points_th04 endp
|
||||
endif
|
|
@ -3,6 +3,7 @@
|
|||
#include "x86real.h"
|
||||
#include "pc98.h"
|
||||
#include "master.hpp"
|
||||
#include "th04/score.h"
|
||||
#include "th01/math/subpixel.hpp"
|
||||
#include "th04/gaiji/gaiji.h"
|
||||
#include "th04/formats/bb.h"
|
||||
|
@ -423,3 +424,35 @@ void pascal near popup_update_and_render(void)
|
|||
#undef gaiji_len
|
||||
#undef frame
|
||||
}
|
||||
|
||||
#if (GAME == 4)
|
||||
void pascal near popup_put_points_th04(unsigned long points)
|
||||
{
|
||||
int i;
|
||||
bool16 past_leading_zeroes;
|
||||
gaiji_th04_t buf[SCORE_DIGITS + 1];
|
||||
unsigned long divisor = 1000000; // Must match SCORE_DIGITS!
|
||||
unsigned long digit;
|
||||
|
||||
i = 0;
|
||||
past_leading_zeroes = false;
|
||||
while(divisor > 1) {
|
||||
digit = (points / divisor);
|
||||
points = (points % divisor);
|
||||
past_leading_zeroes |= digit;
|
||||
if(past_leading_zeroes) {
|
||||
buf[i] = static_cast<gaiji_th04_t>(gb_0_ + digit);
|
||||
} else {
|
||||
buf[i] = g_EMPTY;
|
||||
}
|
||||
divisor /= 10;
|
||||
i++;
|
||||
}
|
||||
// (ones)
|
||||
buf[SCORE_DIGITS - 2] = static_cast<gaiji_th04_t>(gb_0_ + points);
|
||||
buf[SCORE_DIGITS - 1] = gb_0_; // ("continues used" digit)
|
||||
buf[SCORE_DIGITS - 0] = g_NULL; // (null terminator)
|
||||
|
||||
popup_put(PLAYFIELD_TRAM_CENTER_X, POPUP_TRAM_Y, buf);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -9781,7 +9781,6 @@ main_0_TEXT ends
|
|||
POPUP_UPDATE_AND_RENDER procdesc near
|
||||
|
||||
main_01_TEXT segment byte public 'CODE' use16
|
||||
include th04/main/hud/popup.asm
|
||||
include th04/formats/bb_txt_load.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
|
Loading…
Reference in New Issue