Populate content of overworld HUD (#18); make wCurTurn 2 bytes (#25)

This commit is contained in:
xCrystal
2023-12-27 17:42:46 +01:00
parent b530cf90f4
commit 80257e4bca
6 changed files with 53 additions and 2 deletions

View File

@@ -29,11 +29,41 @@ _LoadOverworldHUDAttrmap:
jp ByteFill
_ConstructOverworldHUDTilemap::
; layout
ld hl, .Tilemap
ld de, wOverworldHUDTiles
ld bc, .TilemapEnd - .Tilemap ; SCREEN_WIDTH
call CopyBytes
ret
; turn
ld hl, wCurTurn + 1
ld a, [hld]
or [hl]
jr z, .next1 ; skip if turn is 0 (not yet started)
ld d, h
ld e, l
ld hl, wOverworldHUDTiles + 1
lb bc, 2 | 1 << 6, 3 ; 2 bytes, left aligned, no leading zeros, 3 digits
call PrintNum
.next1
; current roll
ld de, wDieRoll
ld a, [de]
and a
jr z, .next2 ; skip if wDieRoll is 0
ld hl, wOverworldHUDTiles + 5
lb bc, 1 | 1 << 6, 2 ; 1 byte, left aligned, no leading zeros, 2 digits
call PrintNum
.next2
; coins
ld de, wCurLevelCoins
ld hl, wOverworldHUDTiles + 8
lb bc, 3 | 1 << 6, MAX_DELTA_COINS_DIGITS ; 3 bytes, left aligned, no leading zeros, 5 digits
call PrintNum
; exp points
ld de, wCurLevelExp
ld hl, wOverworldHUDTiles + 15
lb bc, 3 | 1 << 6, 5 ; 3 bytes, left aligned, no leading zeros, 5 digits
jp PrintNum
.Tilemap:
db "<TURN><N_A> <DIE><N_A> <COIN>0 <XP>0 "