summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/bank01.asm42
-rw-r--r--src/engine/bank04.asm2
-rw-r--r--src/engine/bank06.asm6
-rw-r--r--src/engine/home.asm65
4 files changed, 61 insertions, 54 deletions
diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm
index 2113a87..c1b6542 100644
--- a/src/engine/bank01.asm
+++ b/src/engine/bank01.asm
@@ -1858,22 +1858,22 @@ DrawDuelHUD: ; 5093 (1:5093)
push de
pop bc
- ; print the Pkmn icon along with the no. of play area Pokemon
- ld a, LOW("<PKMN_ICON>")
+ ; print the Pokemon icon along with the no. of play area Pokemon
+ ld a, SYM_POKEMON
call WriteByteToBGMap0
inc b
ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
call GetTurnDuelistVariable
- add LOW("<0>") - 1
+ add SYM_0 - 1
call WriteByteToBGMap0
inc b
; print the Prize icon along with the no. of prizes yet to draw
- ld a, LOW("<PRIZE_ICON>")
+ ld a, SYM_PRIZE
call WriteByteToBGMap0
inc b
call CountPrizes
- add LOW("<0>")
+ add SYM_0
call WriteByteToBGMap0
; print the arena Pokemon card name and level text
@@ -1956,11 +1956,11 @@ DrawDuelHUD: ; 5093 (1:5093)
call GetTurnDuelistVariable
or a
jr z, .check_defender
- ld a, LOW("<PLUSPOWER>")
+ ld a, SYM_PLUSPOWER
call WriteByteToBGMap0
inc b
ld a, [hl] ; number of attached Pluspower
- add LOW("<0>")
+ add SYM_0
call WriteByteToBGMap0
dec b
.check_defender
@@ -1969,11 +1969,11 @@ DrawDuelHUD: ; 5093 (1:5093)
or a
jr z, .done
inc c
- ld a, LOW("<DEFENDER>")
+ ld a, SYM_DEFENDER
call WriteByteToBGMap0
inc b
ld a, [hl] ; number of attached Defender
- add LOW("<0>")
+ add SYM_0
call WriteByteToBGMap0
.done
ret
@@ -1996,10 +1996,10 @@ DrawDuelHorizontalSeparator: ; 516f (1:516f)
DuelEAndHPTileData: ; 5188 (1:5188)
; x, y, tiles[], 0
- db 1, 1, LOW("<E>"), 0
- db 1, 2, LOW("<HP>"), 0
- db 9, 8, LOW("<E>"), 0
- db 9, 9, LOW("<HP>"), 0
+ db 1, 1, SYM_E, 0
+ db 1, 2, SYM_HP, 0
+ db 9, 8, SYM_E, 0
+ db 9, 9, SYM_HP, 0
db $ff
; 0x5199
@@ -3190,7 +3190,7 @@ CheckPrintPoisoned: ; 63bb (1:63bb)
and POISONED
jr z, .print
.poison
- ld a, LOW("<POISONED>")
+ ld a, SYM_POISONED
.print
call WriteByteToBGMap0
pop af
@@ -3224,8 +3224,8 @@ CheckPrintCnfSlpPrz: ; 63ce (1:63ce)
ret
.status_symbols
- ; NO_STATUS, CONFUSED, ASLEEP, PARALYZED
- db LOW("< >"), LOW("<CONFUSED>"), LOW("<ASLEEP>"), LOW("<PARALYZED>")
+ ; NO_STATUS, CONFUSED, ASLEEP, PARALYZED
+ db SYM_SPACE, SYM_CONFUSED, SYM_ASLEEP, SYM_PARALYZED
; 0x63e6
; print the symbols of the attached energies of a turn holder's play area card
@@ -3246,7 +3246,7 @@ PrintPlayAreaCardAttachedEnergies: ; 63e6 (1:63e6)
jr nz, .empty_loop
pop hl
ld de, wAttachedEnergies
- lb bc, LOW("<FIRE>"), NUM_TYPES - 1
+ lb bc, SYM_FIRE, NUM_TYPES - 1
.next_color
ld a, [de] ; energy count of current color
inc de
@@ -3264,7 +3264,7 @@ PrintPlayAreaCardAttachedEnergies: ; 63e6 (1:63e6)
ld a, [wTotalAttachedEnergies]
cp 9
jr c, .place_tiles
- ld a, LOW("<+>")
+ ld a, SYM_PLUS
ld [wDefaultText + 7], a
.place_tiles
pop bc
@@ -3280,14 +3280,14 @@ PrintPlayAreaCardAttachedEnergies: ; 63e6 (1:63e6)
; input d, e: max. HP, current HP
DrawHPBar: ; 6614 (1:6614)
ld a, MAX_HP
- ld c, LOW("< >")
+ ld c, SYM_SPACE
call .fill_hp_bar ; empty bar
ld a, d
- ld c, LOW("<🌕>")
+ ld c, SYM_HP_OK
call .fill_hp_bar ; fill (max. HP) with HP counters
ld a, d
sub e
- ld c, LOW("<🌑>")
+ ld c, SYM_HP_NOK
; fill (max. HP - current HP) with damaged HP counters
.fill_hp_bar
or a
diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm
index 9bf84f3..3656e52 100644
--- a/src/engine/bank04.asm
+++ b/src/engine/bank04.asm
@@ -10,7 +10,7 @@ Func_10000: ; 10000 (4:4000)
ldh [hSCX], a
ldh [hSCY], a
ld a, [wLCDC]
- bit 7, a
+ bit LCDC_ON, a
jr nz, .asm_10025
xor a
ld [rSCX], a
diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm
index 1a85a24..7c19b74 100644
--- a/src/engine/bank06.asm
+++ b/src/engine/bank06.asm
@@ -58,14 +58,14 @@ _CopyCardNameAndLevel: ; 18000 (6:4000)
jr z, .done
ld a, TX_SYMBOL
ld [hli], a
- ld [hl], LOW("<Lv>")
+ ld [hl], SYM_Lv
inc hl
ld a, [wLoadedCard1Level]
cp 10
jr c, .one_digit
ld [hl], TX_SYMBOL
inc hl
- ld b, LOW("<0>") - 1
+ ld b, SYM_0 - 1
.first_digit_loop
inc b
sub 10
@@ -76,7 +76,7 @@ _CopyCardNameAndLevel: ; 18000 (6:4000)
.one_digit
ld [hl], TX_SYMBOL
inc hl
- add LOW("<0>")
+ add SYM_0
ld [hl], a ; last (or only) digit
inc hl
.done
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 00684cf..87dc7a3 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -191,7 +191,7 @@ SetupTimer: ; 0241 (0:0241)
.set_timer
ld a, b
ld [rTMA], a
- ld a, rTAC_16384_HZ
+ ld a, TAC_16384_HZ
ld [rTAC], a
ld a, $7
ld [rTAC], a
@@ -209,7 +209,7 @@ CheckForCGB: ; 025c (0:025c)
WaitForVBlank: ; 0264 (0:0264)
push hl
ld a, [wLCDC]
- bit rLCDC_ENABLE, a
+ bit LCDC_ON, a
jr z, .asm_275
ld hl, wVBlankCtr
ld a, [hl]
@@ -224,12 +224,12 @@ WaitForVBlank: ; 0264 (0:0264)
; turn LCD on
EnableLCD: ; 0277 (0:0277)
- ld a, [wLCDC] ;
- bit rLCDC_ENABLE, a ;
- ret nz ; assert that LCD is off
- or rLCDC_ENABLE_MASK ;
- ld [wLCDC], a ;
- ld [rLCDC], a ; turn LCD on
+ ld a, [wLCDC] ;
+ bit LCDC_ON, a ;
+ ret nz ; assert that LCD is off
+ or 1 << LCDC_ON ;
+ ld [wLCDC], a ;
+ ld [rLCDC], a ; turn LCD on
ld a, FLUSH_ALL
ld [wFlushPaletteFlags], a
ret
@@ -237,7 +237,7 @@ EnableLCD: ; 0277 (0:0277)
; wait for vblank, then turn LCD off
DisableLCD: ; 028a (0:028a)
ld a, [rLCDC] ;
- bit rLCDC_ENABLE, a ;
+ bit LCDC_ON, a ;
ret z ; assert that LCD is on
ld a, [rIE]
ld [wIE], a
@@ -903,8 +903,9 @@ Func_05f4: ; 5f4 (0:5f4)
ret
; 0x614
-; given two numbers in the two nybbles of register a, write them
-; in text format to hl (most significant nybble first)
+; given two one-digit numbers in the two nybbles of register a,
+; write them in text (ascii) format to hl (most significant nybble first).
+; numbers above 9 are converted to VWF tiles.
WriteNumbersInTextFormat: ; 614 (0:614)
push af
swap a
@@ -912,7 +913,9 @@ WriteNumbersInTextFormat: ; 614 (0:614)
pop af
; fallthrough
-; given a number in the (bottom nybble) of register a, write it in text format to hl
+; given a one-digit number in the (bottom nybble) of register a,
+; write it in text (ascii) format to hl.
+; numbers above 9 are converted to VWF tiles.
WriteNumberInTextFormat:
and $0f
add "0"
@@ -5309,7 +5312,7 @@ GetCardAlbumProgress: ; 1da4 (0:1da4)
; if LCD on, copy during h-blank only
SafeCopyDataDEtoHL: ; 1dca (0:1dca)
ld a, [wLCDC] ;
- bit rLCDC_ENABLE, a ;
+ bit LCDC_ON, a ;
jr nz, .lcd_on ; assert that LCD is on
.lcd_off_loop
ld a, [de]
@@ -5386,7 +5389,7 @@ DrawLabeledTextBox: ; 1e00 (0:1e00)
ld hl, wc000
ld a, TX_SYMBOL
ld [hli], a
- ld a, LOW("<╔>")
+ ld a, SYM_BOX_TOP_L
ld [hli], a
; white tile before the text
ld a, $70
@@ -5415,7 +5418,7 @@ DrawLabeledTextBox: ; 1e00 (0:1e00)
.draw_top_border_line_loop
ld a, TX_SYMBOL
ld [hli], a
- ld a, LOW("<TOP ═>")
+ ld a, SYM_BOX_TOP
ld [hli], a
dec b
jr nz, .draw_top_border_line_loop
@@ -5423,7 +5426,7 @@ DrawLabeledTextBox: ; 1e00 (0:1e00)
.draw_top_border_right_tile
ld a, TX_SYMBOL
ld [hli], a
- ld a, LOW("<╗>")
+ ld a, SYM_BOX_TOP_R
ld [hli], a
ld [hl], $0
pop bc
@@ -6140,7 +6143,7 @@ Func_2325: ; 2325 (0:2325)
ret
; search linked-list for letters e/d (regisers), if found hoist the result to
-; head of list and return it. carry flag denotes success.
+; head of list and return it. carry flag denotes success.
Func_235e: ; 235e (0:235e)
ld a, [wcd0a] ;
or a ;
@@ -6171,7 +6174,7 @@ Func_235e: ; 235e (0:235e)
ld a, [hl] ; if key1[l] == e and ;
cp d ; key2[l] == d: ;
jr z, .asm_238f ; break ;
-.asm_238a ;
+.asm_238a
ld h, $c8 ; ;
ld l, [hl] ; l ← next[l] ;
jr .asm_237d
@@ -6269,7 +6272,7 @@ Func_23d3: ; 23d3 (0:23d3)
; convert the number at hl to TX_SYMBOL text format and write it to wcaa0
; replace leading zeros with $00
-TwoByteNumberToLargeText_TrimLeadingZeros: ; 245d (0:245d)
+TwoByteNumberToTxSymbol_TrimLeadingZeros: ; 245d (0:245d)
push de
push bc
ld de, wcaa0
@@ -6291,14 +6294,14 @@ TwoByteNumberToLargeText_TrimLeadingZeros: ; 245d (0:245d)
.digit_loop
inc hl
ld a, [hl]
- cp LOW("<0>")
+ cp SYM_0
jr nz, .done ; jump if not zero
- ld [hl], LOW("< >") ; trim leading zero
+ ld [hl], SYM_SPACE ; trim leading zero
inc hl
dec e
jr nz, .digit_loop
dec hl
- ld [hl], LOW("<0>")
+ ld [hl], SYM_0
.done
dec hl
pop bc
@@ -6309,7 +6312,7 @@ TwoByteNumberToLargeText_TrimLeadingZeros: ; 245d (0:245d)
ld a, TX_SYMBOL
ld [de], a
inc de
- ld a, LOW("<0>") - 1
+ ld a, SYM_0 - 1
.substract_loop
inc a
add hl, bc
@@ -7648,12 +7651,16 @@ ReadTextOffset: ; 2ded (0:2ded)
pop de
ret
-; convert the number at hl to text (ascii) format and write it to wcaa0
-; return c = 4 - leading_zeros
+; if [wcd0a] != 0:
+; convert the number at hl to text (ascii) format and write it to wcaa0
+; return c = 4 - leading_zeros
+; if [wcd0a] == 0:
+; convert the number at hl to TX_SYMBOL text format and write it to wcaa0
+; replace leading zeros with $00
TwoByteNumberToText_CountLeadingZeros: ; 2e12 (0:2e12)
ld a, [wcd0a]
or a
- jp z, TwoByteNumberToLargeText_TrimLeadingZeros
+ jp z, TwoByteNumberToTxSymbol_TrimLeadingZeros
ld de, wcaa0
push de
call TwoByteNumberToText
@@ -7683,7 +7690,7 @@ CopyTurnDuelistName: ; 2e2c (0:2e2c)
pop hl
ret
-; prints text with id at hl with letter delay in a textbox area
+; prints text with id at hl, with letter delay, in a textbox area
PrintText: ; 2e41 (0:2e41)
ld a, l
or h
@@ -7721,7 +7728,7 @@ PrintText: ; 2e41 (0:2e41)
jr nc, .next_tile_loop
ret
-; prints text with id at hl without letter delay in a textbox area
+; prints text with id at hl, without letter delay, in a textbox area
PrintTextNoDelay: ; 2e76 (0:2e76)
ldh a, [hBankROM]
push af
@@ -10085,7 +10092,7 @@ Func_3c46: ; 3c46 (0:3c46)
DoFrameIfLCDEnabled: ; 3c48 (0:3c48)
push af
ld a, [rLCDC]
- bit rLCDC_ENABLE, a
+ bit LCDC_ON, a
jr z, .done
push bc
push de