diff --git a/constants/text_constants.asm b/constants/text_constants.asm index ee5589561..f1c3a0bf7 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -33,12 +33,12 @@ TEXTBOX_INNERY EQU TEXTBOX_Y + 2 ; PrintNum bit flags const_def 5 const PRINTNUM_MONEY_F ; 5 - const PRINTNUM_RIGHTALIGN_F ; 6 + const PRINTNUM_LEFTALIGN_F ; 6 const PRINTNUM_LEADINGZEROS_F ; 7 ; PrintNum arguments (see engine/math/print_num.asm) PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_F -PRINTNUM_RIGHTALIGN EQU 1 << PRINTNUM_RIGHTALIGN_F +PRINTNUM_LEFTALIGN EQU 1 << PRINTNUM_LEFTALIGN_F PRINTNUM_LEADINGZEROS EQU 1 << PRINTNUM_LEADINGZEROS_F ; character sets (see charmap.asm) diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index 2450e8d02..3b71ee594 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -89,12 +89,12 @@ PrintMagikarpLength: call Magikarp_LoadFeetInchesChars ld hl, wStringBuffer1 ld de, wMagikarpLength - lb bc, PRINTNUM_RIGHTALIGN | 1, 2 + lb bc, PRINTNUM_LEFTALIGN | 1, 2 call PrintNum ld [hl], "′" inc hl ld de, wMagikarpLength + 1 - lb bc, PRINTNUM_RIGHTALIGN | 1, 2 + lb bc, PRINTNUM_LEFTALIGN | 1, 2 call PrintNum ld [hl], "″" inc hl diff --git a/engine/events/poke_seer.asm b/engine/events/poke_seer.asm index 80d055111..9bca9d169 100644 --- a/engine/events/poke_seer.asm +++ b/engine/events/poke_seer.asm @@ -164,7 +164,7 @@ GetCaughtLevel: ld [wSeerCaughtLevel], a ld hl, wSeerCaughtLevelString ld de, wSeerCaughtLevel - lb bc, PRINTNUM_RIGHTALIGN | 1, 3 + lb bc, PRINTNUM_LEFTALIGN | 1, 3 call PrintNum ret diff --git a/engine/events/prof_oaks_pc.asm b/engine/events/prof_oaks_pc.asm index 7954963e6..1be775a4c 100644 --- a/engine/events/prof_oaks_pc.asm +++ b/engine/events/prof_oaks_pc.asm @@ -70,7 +70,7 @@ Rate: ld bc, ITEM_NAME_LENGTH call ByteFill pop hl - lb bc, PRINTNUM_RIGHTALIGN | 1, 3 + lb bc, PRINTNUM_LEFTALIGN | 1, 3 call PrintNum ret diff --git a/engine/items/tmhm.asm b/engine/items/tmhm.asm index 1ff7aab21..736f00cdb 100644 --- a/engine/items/tmhm.asm +++ b/engine/items/tmhm.asm @@ -371,7 +371,7 @@ TMHM_DisplayPocketItems: ld [hl], "H" inc hl ld de, wTempTMHM - lb bc, PRINTNUM_RIGHTALIGN | 1, 2 + lb bc, PRINTNUM_LEFTALIGN | 1, 2 call PrintNum pop af ld [wTempTMHM], a diff --git a/engine/menus/menu_2.asm b/engine/menus/menu_2.asm index 0a398d259..67a93c74f 100644 --- a/engine/menus/menu_2.asm +++ b/engine/menus/menu_2.asm @@ -161,7 +161,7 @@ StartMenu_PrintBugContestStatus: call PlaceString hlcoord 8, 5 ld de, wParkBallsRemaining - lb bc, PRINTNUM_RIGHTALIGN | 1, 2 + lb bc, PRINTNUM_LEFTALIGN | 1, 2 call PrintNum hlcoord 1, 1 ld de, .CAUGHT @@ -187,7 +187,7 @@ StartMenu_PrintBugContestStatus: ld l, c inc hl ld c, 3 - call Print8BitNumRightAlign + call Print8BitNumLeftAlign .skip_level pop af diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index 415d29d6d..245d8e763 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -1952,7 +1952,7 @@ Script_getmoney: call ResetStringBuffer1 call GetMoneyAccount ld hl, wStringBuffer1 - lb bc, PRINTNUM_RIGHTALIGN | 3, 6 + lb bc, PRINTNUM_LEFTALIGN | 3, 6 call PrintNum ld de, wStringBuffer1 jp GetStringBuffer @@ -1964,7 +1964,7 @@ Script_getcoins: call ResetStringBuffer1 ld hl, wStringBuffer1 ld de, wCoins - lb bc, PRINTNUM_RIGHTALIGN | 2, 6 + lb bc, PRINTNUM_LEFTALIGN | 2, 6 call PrintNum ld de, wStringBuffer1 jp GetStringBuffer @@ -1976,7 +1976,7 @@ Script_getnum: call ResetStringBuffer1 ld de, wScriptVar ld hl, wStringBuffer1 - lb bc, PRINTNUM_RIGHTALIGN | 1, 3 + lb bc, PRINTNUM_LEFTALIGN | 1, 3 call PrintNum ld de, wStringBuffer1 jp GetStringBuffer diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index 49c2c4713..12036497d 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -246,10 +246,10 @@ PlacePartyMonLevel: jr nc, .ThreeDigits ld a, "" ld [hli], a - lb bc, PRINTNUM_RIGHTALIGN | 1, 2 + lb bc, PRINTNUM_LEFTALIGN | 1, 2 ; jr .okay .ThreeDigits: - lb bc, PRINTNUM_RIGHTALIGN | 1, 3 + lb bc, PRINTNUM_LEFTALIGN | 1, 3 ; .okay call PrintNum diff --git a/engine/rtc/timeset.asm b/engine/rtc/timeset.asm index ab47c5e56..da1012ff8 100644 --- a/engine/rtc/timeset.asm +++ b/engine/rtc/timeset.asm @@ -273,19 +273,19 @@ SetMinutes: DisplayMinutesWithMinString: ld de, wInitMinuteBuffer - call PrintTwoDigitNumberRightAlign + call PrintTwoDigitNumberLeftAlign inc hl ld de, String_min call PlaceString ret -PrintTwoDigitNumberRightAlign: +PrintTwoDigitNumberLeftAlign: push hl ld a, " " ld [hli], a ld [hl], a pop hl - lb bc, PRINTNUM_RIGHTALIGN | 1, 2 + lb bc, PRINTNUM_LEFTALIGN | 1, 2 call PrintNum ret @@ -684,7 +684,7 @@ PrintHour: call AdjustHourForAMorPM ld [wDeciramBuffer], a ld de, wDeciramBuffer - call PrintTwoDigitNumberRightAlign + call PrintTwoDigitNumberLeftAlign ret GetTimeOfDayString: diff --git a/home/print_bcd.asm b/home/print_bcd.asm index 4f93c866f..74e2d1619 100644 --- a/home/print_bcd.asm +++ b/home/print_bcd.asm @@ -13,12 +13,12 @@ PrintBCDNumber:: ; Note that bits 5 and 7 are modified during execution. The above reflects ; their meaning at the beginning of the functions's execution. ld b, c ; save flags in b - res 7, c - res 6, c - res 5, c ; c now holds the length - bit 5, b + res PRINTNUM_LEADINGZEROS_F, c + res PRINTNUM_LEFTALIGN_F, c + res PRINTNUM_MONEY_F, c ; c now holds the length + bit PRINTNUM_MONEY_F, b jr z, .loop - bit 7, b + bit PRINTNUM_LEADINGZEROS_F, b jr nz, .loop ; skip currency symbol ld [hl], "¥" inc hl @@ -31,14 +31,14 @@ PrintBCDNumber:: inc de dec c jr nz, .loop - bit 7, b ; were any non-zero digits printed? + bit PRINTNUM_LEADINGZEROS_F, b jr z, .done ; if so, we are done .numberEqualsZero ; if every digit of the BCD number is zero - bit 6, b ; left or right alignment? - jr nz, .skipRightAlignmentAdjustment - dec hl ; if the string is right-aligned, it needs to be moved back one space -.skipRightAlignmentAdjustment - bit 5, b + bit PRINTNUM_LEFTALIGN_F, b + jr nz, .skipLeftAlignmentAdjustment + dec hl ; if the string is left-aligned, it needs to be moved back one space +.skipLeftAlignmentAdjustment + bit PRINTNUM_MONEY_F, b jr z, .skipCurrencySymbol ld [hl], "¥" ; currency symbol inc hl @@ -54,25 +54,25 @@ PrintBCDDigit:: and a jr z, .zeroDigit .nonzeroDigit - bit 7, b ; have any non-space characters been printed? + bit PRINTNUM_LEADINGZEROS_F, b ; have any non-space characters been printed? jr z, .outputDigit ; if bit 7 is set, then no numbers have been printed yet - bit 5, b ; print the currency symbol? + bit PRINTNUM_MONEY_F, b jr z, .skipCurrencySymbol ld [hl], "¥" inc hl - res 5, b + res PRINTNUM_MONEY_F, b .skipCurrencySymbol - res 7, b ; unset 7 to indicate that a nonzero digit has been reached + res PRINTNUM_LEADINGZEROS_F, b ; unset 7 to indicate that a nonzero digit has been reached .outputDigit add "0" ld [hli], a jp PrintLetterDelay .zeroDigit - bit 7, b ; either printing leading zeroes or already reached a nonzero digit? + bit PRINTNUM_LEADINGZEROS_F, b ; either printing leading zeroes or already reached a nonzero digit? jr z, .outputDigit ; if so, print a zero digit - bit 6, b ; left or right alignment? + bit PRINTNUM_LEFTALIGN_F, b ret nz ld a, " " ld [hli], a ; if right-aligned, "print" a space by advancing the pointer diff --git a/home/print_level.asm b/home/print_level.asm index d10b8f8a1..bdd11aabb 100644 --- a/home/print_level.asm +++ b/home/print_level.asm @@ -8,12 +8,12 @@ PrintLevel:: ; How many digits? ld c, 2 cp 100 ; This is distinct from MAX_LEVEL. - jr c, Print8BitNumRightAlign + jr c, Print8BitNumLeftAlign ; 3-digit numbers overwrite the :L. dec hl inc c - jr Print8BitNumRightAlign + jr Print8BitNumLeftAlign PrintLevel_Force3Digits:: ; Print :L and all 3 digits @@ -21,8 +21,8 @@ PrintLevel_Force3Digits:: inc hl ld c, 3 -Print8BitNumRightAlign:: +Print8BitNumLeftAlign:: ld [wDeciramBuffer], a ld de, wDeciramBuffer - ld b, PRINTNUM_RIGHTALIGN | 1 + ld b, PRINTNUM_LEFTALIGN | 1 jp PrintNum diff --git a/home/text.asm b/home/text.asm index 9ac34c7d3..f8142939e 100644 --- a/home/text.asm +++ b/home/text.asm @@ -896,7 +896,7 @@ TextCommand_NUM:: ld a, b and $f0 swap a - set PRINTNUM_RIGHTALIGN_F, a + set PRINTNUM_LEFTALIGN_F, a ld b, a call PrintNum ld b, h