From be93ab33a752fe0360c3b23dd4f33e1b0a05bf0e Mon Sep 17 00:00:00 2001 From: Rangi Date: Wed, 17 Jun 2020 11:29:00 -0400 Subject: [PATCH] Harmonize engine/{phone, pokedex, pokegear, printer, rtc, tilesets} with pokegold To do: engine/{menus, movie, overworld, pokemon} --- engine/pokedex/pokedex.asm | 5 +- engine/pokedex/pokedex_3.asm | 15 +-- engine/pokegear/radio.asm | 166 ++++++++++++++--------------- engine/printer/printer.asm | 4 +- engine/rtc/reset_password.asm | 18 ++-- engine/rtc/rtc.asm | 4 +- engine/tilesets/tileset_anims.asm | 22 ++-- engine/tilesets/timeofday_pals.asm | 14 +-- 8 files changed, 123 insertions(+), 125 deletions(-) diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index e60ba1450..a98871828 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -1055,8 +1055,8 @@ Pokedex_ListingPosChanged: ret Pokedex_FillColumn: -; Fills a column starting at HL, going downwards. -; B is the height of the column and A is the tile it's filled with. +; Fills a column starting at hl, going downwards. +; b is the height of the column, and a is the tile it's filled with. push de ld de, SCREEN_WIDTH .loop @@ -2305,7 +2305,6 @@ Pokedex_FillBox: jp FillBoxWithByte Pokedex_BlackOutBG: -; Make BG palettes black so that the BG becomes all black. ldh a, [rSVBK] push af ld a, BANK(wBGPals1) diff --git a/engine/pokedex/pokedex_3.asm b/engine/pokedex/pokedex_3.asm index f546c79f1..b59fd1df2 100644 --- a/engine/pokedex/pokedex_3.asm +++ b/engine/pokedex/pokedex_3.asm @@ -52,7 +52,7 @@ DrawPokedexListWindow: ld a, $51 hlcoord 11, 1 ld b, SCREEN_HEIGHT - 3 - call Bank77_FillColumn + call Pokedex_FillColumn2 ld [hl], $52 jr .Done @@ -63,7 +63,7 @@ DrawPokedexListWindow: ld a, $67 hlcoord 11, 1 ld b, SCREEN_HEIGHT - 3 - call Bank77_FillColumn + call Pokedex_FillColumn2 ld [hl], $68 .Done: ret @@ -86,7 +86,7 @@ DrawPokedexSearchResultsWindow: ld a, $67 hlcoord 11, 1 ld b, SCREEN_HEIGHT / 2 - call Bank77_FillColumn + call Pokedex_FillColumn2 ld [hl], $68 ld a, $34 hlcoord 0, 11 @@ -101,7 +101,7 @@ DrawPokedexSearchResultsWindow: ld a, $67 hlcoord 11, 12 ld b, 5 - call Bank77_FillColumn + call Pokedex_FillColumn2 ld [hl], $68 hlcoord 0, 12 lb bc, 5, 11 @@ -134,14 +134,14 @@ DrawDexEntryScreenRightEdge: hlcoord 19, 1 ld a, $67 ld b, 15 - call Bank77_FillColumn + call Pokedex_FillColumn2 ld [hl], $68 hlcoord 19, 17 ld [hl], $3c xor a ld b, SCREEN_HEIGHT hlcoord 19, 0, wAttrmap - call Bank77_FillColumn + call Pokedex_FillColumn2 call WaitBGMap2 pop hl ld a, l @@ -150,7 +150,8 @@ DrawDexEntryScreenRightEdge: ldh [hBGMapAddress + 1], a ret -Bank77_FillColumn: +Pokedex_FillColumn2: +; A local duplicate of Pokedex_FillColumn. push de ld de, SCREEN_WIDTH .loop diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm index 3f69e68a9..d92bc02fa 100644 --- a/engine/pokegear/radio.asm +++ b/engine/pokegear/radio.asm @@ -29,47 +29,47 @@ PlayRadioShow: RadioJumptable: ; entries correspond to constants/radio_constants.asm - dw OaksPKMNTalk1 ; $00 - dw PokedexShow1 ; $01 - dw BenMonMusic1 ; $02 - dw LuckyNumberShow1 ; $03 - dw BuenasPassword1 ; $04 - dw PeoplePlaces1 ; $05 - dw FernMonMusic1 ; $06 - dw RocketRadio1 ; $07 - dw PokeFluteRadio ; $08 - dw UnownRadio ; $09 - dw EvolutionRadio ; $0a + dw OaksPKMNTalk1 ; $00 + dw PokedexShow1 ; $01 + dw BenMonMusic1 ; $02 + dw LuckyNumberShow1 ; $03 + dw BuenasPassword1 ; $04 + dw PeoplePlaces1 ; $05 + dw FernMonMusic1 ; $06 + dw RocketRadio1 ; $07 + dw PokeFluteRadio ; $08 + dw UnownRadio ; $09 + dw EvolutionRadio ; $0a ; OaksPKMNTalk - dw OaksPKMNTalk2 ; $0b - dw OaksPKMNTalk3 ; $0c - dw OaksPKMNTalk4 ; $0d - dw OaksPKMNTalk5 ; $0e - dw OaksPKMNTalk6 ; $0f - dw OaksPKMNTalk7 ; $10 - dw OaksPKMNTalk8 ; $11 - dw OaksPKMNTalk9 ; $12 - dw PokedexShow2 ; $13 - dw PokedexShow3 ; $14 - dw PokedexShow4 ; $15 - dw PokedexShow5 ; $16 + dw OaksPKMNTalk2 ; $0b + dw OaksPKMNTalk3 ; $0c + dw OaksPKMNTalk4 ; $0d + dw OaksPKMNTalk5 ; $0e + dw OaksPKMNTalk6 ; $0f + dw OaksPKMNTalk7 ; $10 + dw OaksPKMNTalk8 ; $11 + dw OaksPKMNTalk9 ; $12 + dw PokedexShow2 ; $13 + dw PokedexShow3 ; $14 + dw PokedexShow4 ; $15 + dw PokedexShow5 ; $16 ; Ben Music - dw BenMonMusic2 ; $17 - dw BenMonMusic3 ; $18 - dw BenFernMusic4 ; $19 - dw BenFernMusic5 ; $1a - dw BenFernMusic6 ; $1b - dw BenFernMusic7 ; $1c - dw FernMonMusic2 ; $1d + dw BenMonMusic2 ; $17 + dw BenMonMusic3 ; $18 + dw BenFernMusic4 ; $19 + dw BenFernMusic5 ; $1a + dw BenFernMusic6 ; $1b + dw BenFernMusic7 ; $1c + dw FernMonMusic2 ; $1d ; Lucky Number Show - dw LuckyNumberShow2 ; $1e - dw LuckyNumberShow3 ; $1f - dw LuckyNumberShow4 ; $20 - dw LuckyNumberShow5 ; $21 - dw LuckyNumberShow6 ; $22 - dw LuckyNumberShow7 ; $23 - dw LuckyNumberShow8 ; $24 - dw LuckyNumberShow9 ; $25 + dw LuckyNumberShow2 ; $1e + dw LuckyNumberShow3 ; $1f + dw LuckyNumberShow4 ; $20 + dw LuckyNumberShow5 ; $21 + dw LuckyNumberShow6 ; $22 + dw LuckyNumberShow7 ; $23 + dw LuckyNumberShow8 ; $24 + dw LuckyNumberShow9 ; $25 dw LuckyNumberShow10 ; $26 dw LuckyNumberShow11 ; $27 dw LuckyNumberShow12 ; $28 @@ -77,54 +77,54 @@ RadioJumptable: dw LuckyNumberShow14 ; $2a dw LuckyNumberShow15 ; $2b ; People & Places - dw PeoplePlaces2 ; $2c - dw PeoplePlaces3 ; $2d - dw PeoplePlaces4 ; $2e - dw PeoplePlaces5 ; $2f - dw PeoplePlaces6 ; $30 - dw PeoplePlaces7 ; $31 + dw PeoplePlaces2 ; $2c + dw PeoplePlaces3 ; $2d + dw PeoplePlaces4 ; $2e + dw PeoplePlaces5 ; $2f + dw PeoplePlaces6 ; $30 + dw PeoplePlaces7 ; $31 ; Rocket Radio - dw RocketRadio2 ; $32 - dw RocketRadio3 ; $33 - dw RocketRadio4 ; $34 - dw RocketRadio5 ; $35 - dw RocketRadio6 ; $36 - dw RocketRadio7 ; $37 - dw RocketRadio8 ; $38 - dw RocketRadio9 ; $39 - dw RocketRadio10 ; $3a + dw RocketRadio2 ; $32 + dw RocketRadio3 ; $33 + dw RocketRadio4 ; $34 + dw RocketRadio5 ; $35 + dw RocketRadio6 ; $36 + dw RocketRadio7 ; $37 + dw RocketRadio8 ; $38 + dw RocketRadio9 ; $39 + dw RocketRadio10 ; $3a ; More Pokemon Channel stuff - dw OaksPKMNTalk10 ; $3b - dw OaksPKMNTalk11 ; $3c - dw OaksPKMNTalk12 ; $3d - dw OaksPKMNTalk13 ; $3e - dw OaksPKMNTalk14 ; $3f + dw OaksPKMNTalk10 ; $3b + dw OaksPKMNTalk11 ; $3c + dw OaksPKMNTalk12 ; $3d + dw OaksPKMNTalk13 ; $3e + dw OaksPKMNTalk14 ; $3f ; Buenas Password - dw BuenasPassword2 ; $40 - dw BuenasPassword3 ; $41 - dw BuenasPassword4 ; $42 - dw BuenasPassword5 ; $43 - dw BuenasPassword6 ; $44 - dw BuenasPassword7 ; $45 - dw BuenasPassword8 ; $46 - dw BuenasPassword9 ; $47 - dw BuenasPassword10 ; $48 - dw BuenasPassword11 ; $49 - dw BuenasPassword12 ; $4a - dw BuenasPassword13 ; $4b - dw BuenasPassword14 ; $4c - dw BuenasPassword15 ; $4d - dw BuenasPassword16 ; $4e - dw BuenasPassword17 ; $4f - dw BuenasPassword18 ; $50 - dw BuenasPassword19 ; $51 - dw BuenasPassword20 ; $52 - dw BuenasPassword21 ; $53 - dw RadioScroll ; $54 + dw BuenasPassword2 ; $40 + dw BuenasPassword3 ; $41 + dw BuenasPassword4 ; $42 + dw BuenasPassword5 ; $43 + dw BuenasPassword6 ; $44 + dw BuenasPassword7 ; $45 + dw BuenasPassword8 ; $46 + dw BuenasPassword9 ; $47 + dw BuenasPassword10 ; $48 + dw BuenasPassword11 ; $49 + dw BuenasPassword12 ; $4a + dw BuenasPassword13 ; $4b + dw BuenasPassword14 ; $4c + dw BuenasPassword15 ; $4d + dw BuenasPassword16 ; $4e + dw BuenasPassword17 ; $4f + dw BuenasPassword18 ; $50 + dw BuenasPassword19 ; $51 + dw BuenasPassword20 ; $52 + dw BuenasPassword21 ; $53 + dw RadioScroll ; $54 ; More Pokemon Channel stuff - dw PokedexShow6 ; $55 - dw PokedexShow7 ; $56 - dw PokedexShow8 ; $57 + dw PokedexShow6 ; $55 + dw PokedexShow7 ; $56 + dw PokedexShow8 ; $57 PrintRadioLine: ld [wNextRadioLine], a @@ -1098,7 +1098,7 @@ PeoplePlaces4: ; People call Random maskbits NUM_TRAINER_CLASSES inc a - cp NUM_TRAINER_CLASSES - 1 + cp NUM_TRAINER_CLASSES - 1 ; omit MYSTICALMAN jr nc, PeoplePlaces4 push af ld hl, PnP_HiddenPeople diff --git a/engine/printer/printer.asm b/engine/printer/printer.asm index 607efcca2..2d9495cbd 100644 --- a/engine/printer/printer.asm +++ b/engine/printer/printer.asm @@ -71,7 +71,7 @@ PrintDexEntry: ld hl, hVBlank ld a, [hl] push af - ld [hl], $4 + ld [hl], 4 ld a, 8 ; 16 rows ld [wPrinterQueueLength], a @@ -904,7 +904,7 @@ Printer_PlaceBottomBorders: Printer_PlaceEmptyBoxSlotString: hlcoord 2, 0 - ld c, $6 + ld c, 6 .loop push bc push hl diff --git a/engine/rtc/reset_password.asm b/engine/rtc/reset_password.asm index 6fd7b3e15..b24609a10 100644 --- a/engine/rtc/reset_password.asm +++ b/engine/rtc/reset_password.asm @@ -13,7 +13,7 @@ _ResetClock: call VerticalMenu ret c ld a, [wMenuCursorY] - cp $1 + cp 1 ret z call ClockResetPassword jr c, .wrongpassword @@ -62,7 +62,7 @@ ClockResetPassword: ld bc, 5 xor a call ByteFill - ld a, $4 + ld a, 4 ld [wStringBuffer2 + 5], a ld hl, .PasswordAskEnterText call PrintText @@ -120,7 +120,7 @@ ClockResetPassword: hlcoord 14, 16 ld a, [wStringBuffer2 + 5] ld e, a - ld d, $0 + ld d, 0 add hl, de ld [hl], "▲" ret @@ -150,7 +150,7 @@ ClockResetPassword: .right ld a, [wStringBuffer2 + 5] - cp $4 + cp 4 ret z inc a ld [wStringBuffer2 + 5], a @@ -166,7 +166,7 @@ ClockResetPassword: ret .wraparound_up - ld [hl], $0 + ld [hl], 0 ret .down @@ -219,13 +219,13 @@ ClockResetPassword: call GetSRAMBank ld de, 0 ld hl, sPlayerData + (wPlayerID - wPlayerData) - ld c, $2 + ld c, 2 call .ComponentFromNumber ld hl, sPlayerData + (wPlayerName - wPlayerData) ld c, NAME_LENGTH_JAPANESE - 1 call .ComponentFromString ld hl, sPlayerData + (wMoney - wPlayerData) - ld c, $3 + ld c, 3 call .ComponentFromNumber call CloseSRAM ret @@ -234,7 +234,7 @@ ClockResetPassword: ld a, [hli] add e ld e, a - ld a, $0 + ld a, 0 adc d ld d, a dec c @@ -247,7 +247,7 @@ ClockResetPassword: ret z add e ld e, a - ld a, $0 + ld a, 0 adc d ld d, a dec c diff --git a/engine/rtc/rtc.asm b/engine/rtc/rtc.asm index c7c4fae9e..6577598f3 100644 --- a/engine/rtc/rtc.asm +++ b/engine/rtc/rtc.asm @@ -74,11 +74,11 @@ StageRTCTimeForSave: ret SaveRTC: - ld a, $a + ld a, SRAM_ENABLE ld [MBC3SRamEnable], a call LatchClock ld hl, MBC3RTC - ld a, $c + ld a, RTC_DH ld [MBC3SRamBank], a res 7, [hl] ld a, BANK(sRTCStatusFlags) diff --git a/engine/tilesets/tileset_anims.asm b/engine/tilesets/tileset_anims.asm index f8869b59b..33e956df0 100644 --- a/engine/tilesets/tileset_anims.asm +++ b/engine/tilesets/tileset_anims.asm @@ -2,7 +2,7 @@ _AnimateTileset:: ; Iterate over a given pointer array of ; animation functions (one per frame). -; Typically in wra1, vra0 +; Typically in WRAM bank 1, VRAM bank 0. ld a, [wTilesetAnim] ld e, a @@ -214,16 +214,16 @@ TilesetIcePathAnim: dw NULL, DoneTileAnimation TilesetTowerAnim: - dw TowerPillarTilePointer9, AnimateTowerPillarTile + dw TowerPillarTilePointer9, AnimateTowerPillarTile dw TowerPillarTilePointer10, AnimateTowerPillarTile - dw TowerPillarTilePointer7, AnimateTowerPillarTile - dw TowerPillarTilePointer8, AnimateTowerPillarTile - dw TowerPillarTilePointer5, AnimateTowerPillarTile - dw TowerPillarTilePointer6, AnimateTowerPillarTile - dw TowerPillarTilePointer3, AnimateTowerPillarTile - dw TowerPillarTilePointer4, AnimateTowerPillarTile - dw TowerPillarTilePointer1, AnimateTowerPillarTile - dw TowerPillarTilePointer2, AnimateTowerPillarTile + dw TowerPillarTilePointer7, AnimateTowerPillarTile + dw TowerPillarTilePointer8, AnimateTowerPillarTile + dw TowerPillarTilePointer5, AnimateTowerPillarTile + dw TowerPillarTilePointer6, AnimateTowerPillarTile + dw TowerPillarTilePointer3, AnimateTowerPillarTile + dw TowerPillarTilePointer4, AnimateTowerPillarTile + dw TowerPillarTilePointer1, AnimateTowerPillarTile + dw TowerPillarTilePointer2, AnimateTowerPillarTile dw NULL, StandingTileFrame dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation @@ -658,7 +658,6 @@ FlowerTileFrames: INCBIN "gfx/tilesets/flower/cgb_2.2bpp" LavaBubbleAnim1: -; Splash in the bottom-right corner of the fountain. ld hl, sp+0 ld b, h ld c, l @@ -678,7 +677,6 @@ LavaBubbleAnim1: jp WriteTile LavaBubbleAnim2: -; Splash in the top-left corner of the fountain. ld hl, sp+0 ld b, h ld c, l diff --git a/engine/tilesets/timeofday_pals.asm b/engine/tilesets/timeofday_pals.asm index 814116660..27172a213 100644 --- a/engine/tilesets/timeofday_pals.asm +++ b/engine/tilesets/timeofday_pals.asm @@ -188,19 +188,19 @@ endr ReplaceTimeOfDayPals: ld hl, .BrightnessLevels ld a, [wMapTimeOfDay] - cp $4 ; Dark cave, needs Flash - jr z, .DarkCave + cp PALETTE_DARK + jr z, .NeedsFlash and $7 add l ld l, a - ld a, $0 + ld a, 0 adc h ld h, a ld a, [hl] ld [wTimeOfDayPalset], a ret -.DarkCave: +.NeedsFlash: ld a, [wStatusFlags] bit STATUSFLAGS_FLASH_F, a jr nz, .UsedFlash @@ -319,7 +319,7 @@ GetTimePalFade: ; get fade table push bc ld c, a - ld b, $0 + ld b, 0 ld hl, .dmgfades add hl, bc add hl, bc @@ -329,13 +329,13 @@ GetTimePalFade: pop bc ; get place in fade table - ld b, $0 + ld b, 0 add hl, bc ret .cgb ld hl, .cgbfade - ld b, $0 + ld b, 0 add hl, bc ret