ref: be93ab33a752fe0360c3b23dd4f33e1b0a05bf0e
parent: 8019db3ea98ee60d3e6675431e07819b83daf04c
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Wed Jun 17 07:29:00 EDT 2020
Harmonize engine/{phone, pokedex, pokegear, printer, rtc, tilesets} with pokegold To do: engine/{menus, movie, overworld, pokemon}
--- a/engine/pokedex/pokedex.asm
+++ b/engine/pokedex/pokedex.asm
@@ -1055,8 +1055,8 @@
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 @@
jp FillBoxWithByte
Pokedex_BlackOutBG:
-; Make BG palettes black so that the BG becomes all black.
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
--- a/engine/pokedex/pokedex_3.asm
+++ b/engine/pokedex/pokedex_3.asm
@@ -52,7 +52,7 @@
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 @@
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 @@
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 @@
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,7 +134,7 @@
hlcoord 19, 1
ld a, $67
ld b, 15
- call Bank77_FillColumn
+ call Pokedex_FillColumn2
ld [hl], $68
hlcoord 19, 17
ld [hl], $3c
@@ -141,7 +141,7 @@
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 @@
ldh [hBGMapAddress + 1], a
ret
-Bank77_FillColumn:
+Pokedex_FillColumn2:
+; A local duplicate of Pokedex_FillColumn.
push de
ld de, SCREEN_WIDTH
.loop
--- a/engine/pokegear/radio.asm
+++ b/engine/pokegear/radio.asm
@@ -29,47 +29,47 @@
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 @@
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 @@
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
--- a/engine/printer/printer.asm
+++ b/engine/printer/printer.asm
@@ -71,7 +71,7 @@
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_PlaceEmptyBoxSlotString:
hlcoord 2, 0
- ld c, $6
+ ld c, 6
.loop
push bc
push hl
--- a/engine/rtc/reset_password.asm
+++ b/engine/rtc/reset_password.asm
@@ -13,7 +13,7 @@
call VerticalMenu
ret c
ld a, [wMenuCursorY]
- cp $1
+ cp 1
ret z
call ClockResetPassword
jr c, .wrongpassword
@@ -62,7 +62,7 @@
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 @@
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 @@
.right
ld a, [wStringBuffer2 + 5]
- cp $4
+ cp 4
ret z
inc a
ld [wStringBuffer2 + 5], a
@@ -166,7 +166,7 @@
ret
.wraparound_up
- ld [hl], $0
+ ld [hl], 0
ret
.down
@@ -219,13 +219,13 @@
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 @@
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 @@
ret z
add e
ld e, a
- ld a, $0
+ ld a, 0
adc d
ld d, a
dec c
--- a/engine/rtc/rtc.asm
+++ b/engine/rtc/rtc.asm
@@ -74,11 +74,11 @@
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)
--- a/engine/tilesets/tileset_anims.asm
+++ b/engine/tilesets/tileset_anims.asm
@@ -2,7 +2,7 @@
; 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 @@
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 @@
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 @@
jp WriteTile
LavaBubbleAnim2:
-; Splash in the top-left corner of the fountain.
ld hl, sp+0
ld b, h
ld c, l
--- a/engine/tilesets/timeofday_pals.asm
+++ b/engine/tilesets/timeofday_pals.asm
@@ -188,12 +188,12 @@
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]
@@ -200,7 +200,7 @@
ld [wTimeOfDayPalset], a
ret
-.DarkCave:
+.NeedsFlash:
ld a, [wStatusFlags]
bit STATUSFLAGS_FLASH_F, a
jr nz, .UsedFlash
@@ -319,7 +319,7 @@
; 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 @@
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