Harmonize engine/{phone, pokedex, pokegear, printer, rtc, tilesets} with pokegold

To do: engine/{menus, movie, overworld, pokemon}
This commit is contained in:
Rangi 2020-06-17 11:29:00 -04:00
parent 8019db3ea9
commit be93ab33a7
8 changed files with 123 additions and 125 deletions

View File

@ -1055,8 +1055,8 @@ Pokedex_ListingPosChanged:
ret ret
Pokedex_FillColumn: Pokedex_FillColumn:
; Fills a column starting at HL, going downwards. ; Fills a column starting at hl, going downwards.
; B is the height of the column and A is the tile it's filled with. ; b is the height of the column, and a is the tile it's filled with.
push de push de
ld de, SCREEN_WIDTH ld de, SCREEN_WIDTH
.loop .loop
@ -2305,7 +2305,6 @@ Pokedex_FillBox:
jp FillBoxWithByte jp FillBoxWithByte
Pokedex_BlackOutBG: Pokedex_BlackOutBG:
; Make BG palettes black so that the BG becomes all black.
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wBGPals1) ld a, BANK(wBGPals1)

View File

@ -52,7 +52,7 @@ DrawPokedexListWindow:
ld a, $51 ld a, $51
hlcoord 11, 1 hlcoord 11, 1
ld b, SCREEN_HEIGHT - 3 ld b, SCREEN_HEIGHT - 3
call Bank77_FillColumn call Pokedex_FillColumn2
ld [hl], $52 ld [hl], $52
jr .Done jr .Done
@ -63,7 +63,7 @@ DrawPokedexListWindow:
ld a, $67 ld a, $67
hlcoord 11, 1 hlcoord 11, 1
ld b, SCREEN_HEIGHT - 3 ld b, SCREEN_HEIGHT - 3
call Bank77_FillColumn call Pokedex_FillColumn2
ld [hl], $68 ld [hl], $68
.Done: .Done:
ret ret
@ -86,7 +86,7 @@ DrawPokedexSearchResultsWindow:
ld a, $67 ld a, $67
hlcoord 11, 1 hlcoord 11, 1
ld b, SCREEN_HEIGHT / 2 ld b, SCREEN_HEIGHT / 2
call Bank77_FillColumn call Pokedex_FillColumn2
ld [hl], $68 ld [hl], $68
ld a, $34 ld a, $34
hlcoord 0, 11 hlcoord 0, 11
@ -101,7 +101,7 @@ DrawPokedexSearchResultsWindow:
ld a, $67 ld a, $67
hlcoord 11, 12 hlcoord 11, 12
ld b, 5 ld b, 5
call Bank77_FillColumn call Pokedex_FillColumn2
ld [hl], $68 ld [hl], $68
hlcoord 0, 12 hlcoord 0, 12
lb bc, 5, 11 lb bc, 5, 11
@ -134,14 +134,14 @@ DrawDexEntryScreenRightEdge:
hlcoord 19, 1 hlcoord 19, 1
ld a, $67 ld a, $67
ld b, 15 ld b, 15
call Bank77_FillColumn call Pokedex_FillColumn2
ld [hl], $68 ld [hl], $68
hlcoord 19, 17 hlcoord 19, 17
ld [hl], $3c ld [hl], $3c
xor a xor a
ld b, SCREEN_HEIGHT ld b, SCREEN_HEIGHT
hlcoord 19, 0, wAttrmap hlcoord 19, 0, wAttrmap
call Bank77_FillColumn call Pokedex_FillColumn2
call WaitBGMap2 call WaitBGMap2
pop hl pop hl
ld a, l ld a, l
@ -150,7 +150,8 @@ DrawDexEntryScreenRightEdge:
ldh [hBGMapAddress + 1], a ldh [hBGMapAddress + 1], a
ret ret
Bank77_FillColumn: Pokedex_FillColumn2:
; A local duplicate of Pokedex_FillColumn.
push de push de
ld de, SCREEN_WIDTH ld de, SCREEN_WIDTH
.loop .loop

View File

@ -29,47 +29,47 @@ PlayRadioShow:
RadioJumptable: RadioJumptable:
; entries correspond to constants/radio_constants.asm ; entries correspond to constants/radio_constants.asm
dw OaksPKMNTalk1 ; $00 dw OaksPKMNTalk1 ; $00
dw PokedexShow1 ; $01 dw PokedexShow1 ; $01
dw BenMonMusic1 ; $02 dw BenMonMusic1 ; $02
dw LuckyNumberShow1 ; $03 dw LuckyNumberShow1 ; $03
dw BuenasPassword1 ; $04 dw BuenasPassword1 ; $04
dw PeoplePlaces1 ; $05 dw PeoplePlaces1 ; $05
dw FernMonMusic1 ; $06 dw FernMonMusic1 ; $06
dw RocketRadio1 ; $07 dw RocketRadio1 ; $07
dw PokeFluteRadio ; $08 dw PokeFluteRadio ; $08
dw UnownRadio ; $09 dw UnownRadio ; $09
dw EvolutionRadio ; $0a dw EvolutionRadio ; $0a
; OaksPKMNTalk ; OaksPKMNTalk
dw OaksPKMNTalk2 ; $0b dw OaksPKMNTalk2 ; $0b
dw OaksPKMNTalk3 ; $0c dw OaksPKMNTalk3 ; $0c
dw OaksPKMNTalk4 ; $0d dw OaksPKMNTalk4 ; $0d
dw OaksPKMNTalk5 ; $0e dw OaksPKMNTalk5 ; $0e
dw OaksPKMNTalk6 ; $0f dw OaksPKMNTalk6 ; $0f
dw OaksPKMNTalk7 ; $10 dw OaksPKMNTalk7 ; $10
dw OaksPKMNTalk8 ; $11 dw OaksPKMNTalk8 ; $11
dw OaksPKMNTalk9 ; $12 dw OaksPKMNTalk9 ; $12
dw PokedexShow2 ; $13 dw PokedexShow2 ; $13
dw PokedexShow3 ; $14 dw PokedexShow3 ; $14
dw PokedexShow4 ; $15 dw PokedexShow4 ; $15
dw PokedexShow5 ; $16 dw PokedexShow5 ; $16
; Ben Music ; Ben Music
dw BenMonMusic2 ; $17 dw BenMonMusic2 ; $17
dw BenMonMusic3 ; $18 dw BenMonMusic3 ; $18
dw BenFernMusic4 ; $19 dw BenFernMusic4 ; $19
dw BenFernMusic5 ; $1a dw BenFernMusic5 ; $1a
dw BenFernMusic6 ; $1b dw BenFernMusic6 ; $1b
dw BenFernMusic7 ; $1c dw BenFernMusic7 ; $1c
dw FernMonMusic2 ; $1d dw FernMonMusic2 ; $1d
; Lucky Number Show ; Lucky Number Show
dw LuckyNumberShow2 ; $1e dw LuckyNumberShow2 ; $1e
dw LuckyNumberShow3 ; $1f dw LuckyNumberShow3 ; $1f
dw LuckyNumberShow4 ; $20 dw LuckyNumberShow4 ; $20
dw LuckyNumberShow5 ; $21 dw LuckyNumberShow5 ; $21
dw LuckyNumberShow6 ; $22 dw LuckyNumberShow6 ; $22
dw LuckyNumberShow7 ; $23 dw LuckyNumberShow7 ; $23
dw LuckyNumberShow8 ; $24 dw LuckyNumberShow8 ; $24
dw LuckyNumberShow9 ; $25 dw LuckyNumberShow9 ; $25
dw LuckyNumberShow10 ; $26 dw LuckyNumberShow10 ; $26
dw LuckyNumberShow11 ; $27 dw LuckyNumberShow11 ; $27
dw LuckyNumberShow12 ; $28 dw LuckyNumberShow12 ; $28
@ -77,54 +77,54 @@ RadioJumptable:
dw LuckyNumberShow14 ; $2a dw LuckyNumberShow14 ; $2a
dw LuckyNumberShow15 ; $2b dw LuckyNumberShow15 ; $2b
; People & Places ; People & Places
dw PeoplePlaces2 ; $2c dw PeoplePlaces2 ; $2c
dw PeoplePlaces3 ; $2d dw PeoplePlaces3 ; $2d
dw PeoplePlaces4 ; $2e dw PeoplePlaces4 ; $2e
dw PeoplePlaces5 ; $2f dw PeoplePlaces5 ; $2f
dw PeoplePlaces6 ; $30 dw PeoplePlaces6 ; $30
dw PeoplePlaces7 ; $31 dw PeoplePlaces7 ; $31
; Rocket Radio ; Rocket Radio
dw RocketRadio2 ; $32 dw RocketRadio2 ; $32
dw RocketRadio3 ; $33 dw RocketRadio3 ; $33
dw RocketRadio4 ; $34 dw RocketRadio4 ; $34
dw RocketRadio5 ; $35 dw RocketRadio5 ; $35
dw RocketRadio6 ; $36 dw RocketRadio6 ; $36
dw RocketRadio7 ; $37 dw RocketRadio7 ; $37
dw RocketRadio8 ; $38 dw RocketRadio8 ; $38
dw RocketRadio9 ; $39 dw RocketRadio9 ; $39
dw RocketRadio10 ; $3a dw RocketRadio10 ; $3a
; More Pokemon Channel stuff ; More Pokemon Channel stuff
dw OaksPKMNTalk10 ; $3b dw OaksPKMNTalk10 ; $3b
dw OaksPKMNTalk11 ; $3c dw OaksPKMNTalk11 ; $3c
dw OaksPKMNTalk12 ; $3d dw OaksPKMNTalk12 ; $3d
dw OaksPKMNTalk13 ; $3e dw OaksPKMNTalk13 ; $3e
dw OaksPKMNTalk14 ; $3f dw OaksPKMNTalk14 ; $3f
; Buenas Password ; Buenas Password
dw BuenasPassword2 ; $40 dw BuenasPassword2 ; $40
dw BuenasPassword3 ; $41 dw BuenasPassword3 ; $41
dw BuenasPassword4 ; $42 dw BuenasPassword4 ; $42
dw BuenasPassword5 ; $43 dw BuenasPassword5 ; $43
dw BuenasPassword6 ; $44 dw BuenasPassword6 ; $44
dw BuenasPassword7 ; $45 dw BuenasPassword7 ; $45
dw BuenasPassword8 ; $46 dw BuenasPassword8 ; $46
dw BuenasPassword9 ; $47 dw BuenasPassword9 ; $47
dw BuenasPassword10 ; $48 dw BuenasPassword10 ; $48
dw BuenasPassword11 ; $49 dw BuenasPassword11 ; $49
dw BuenasPassword12 ; $4a dw BuenasPassword12 ; $4a
dw BuenasPassword13 ; $4b dw BuenasPassword13 ; $4b
dw BuenasPassword14 ; $4c dw BuenasPassword14 ; $4c
dw BuenasPassword15 ; $4d dw BuenasPassword15 ; $4d
dw BuenasPassword16 ; $4e dw BuenasPassword16 ; $4e
dw BuenasPassword17 ; $4f dw BuenasPassword17 ; $4f
dw BuenasPassword18 ; $50 dw BuenasPassword18 ; $50
dw BuenasPassword19 ; $51 dw BuenasPassword19 ; $51
dw BuenasPassword20 ; $52 dw BuenasPassword20 ; $52
dw BuenasPassword21 ; $53 dw BuenasPassword21 ; $53
dw RadioScroll ; $54 dw RadioScroll ; $54
; More Pokemon Channel stuff ; More Pokemon Channel stuff
dw PokedexShow6 ; $55 dw PokedexShow6 ; $55
dw PokedexShow7 ; $56 dw PokedexShow7 ; $56
dw PokedexShow8 ; $57 dw PokedexShow8 ; $57
PrintRadioLine: PrintRadioLine:
ld [wNextRadioLine], a ld [wNextRadioLine], a
@ -1098,7 +1098,7 @@ PeoplePlaces4: ; People
call Random call Random
maskbits NUM_TRAINER_CLASSES maskbits NUM_TRAINER_CLASSES
inc a inc a
cp NUM_TRAINER_CLASSES - 1 cp NUM_TRAINER_CLASSES - 1 ; omit MYSTICALMAN
jr nc, PeoplePlaces4 jr nc, PeoplePlaces4
push af push af
ld hl, PnP_HiddenPeople ld hl, PnP_HiddenPeople

View File

@ -71,7 +71,7 @@ PrintDexEntry:
ld hl, hVBlank ld hl, hVBlank
ld a, [hl] ld a, [hl]
push af push af
ld [hl], $4 ld [hl], 4
ld a, 8 ; 16 rows ld a, 8 ; 16 rows
ld [wPrinterQueueLength], a ld [wPrinterQueueLength], a
@ -904,7 +904,7 @@ Printer_PlaceBottomBorders:
Printer_PlaceEmptyBoxSlotString: Printer_PlaceEmptyBoxSlotString:
hlcoord 2, 0 hlcoord 2, 0
ld c, $6 ld c, 6
.loop .loop
push bc push bc
push hl push hl

View File

@ -13,7 +13,7 @@ _ResetClock:
call VerticalMenu call VerticalMenu
ret c ret c
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
cp $1 cp 1
ret z ret z
call ClockResetPassword call ClockResetPassword
jr c, .wrongpassword jr c, .wrongpassword
@ -62,7 +62,7 @@ ClockResetPassword:
ld bc, 5 ld bc, 5
xor a xor a
call ByteFill call ByteFill
ld a, $4 ld a, 4
ld [wStringBuffer2 + 5], a ld [wStringBuffer2 + 5], a
ld hl, .PasswordAskEnterText ld hl, .PasswordAskEnterText
call PrintText call PrintText
@ -120,7 +120,7 @@ ClockResetPassword:
hlcoord 14, 16 hlcoord 14, 16
ld a, [wStringBuffer2 + 5] ld a, [wStringBuffer2 + 5]
ld e, a ld e, a
ld d, $0 ld d, 0
add hl, de add hl, de
ld [hl], "▲" ld [hl], "▲"
ret ret
@ -150,7 +150,7 @@ ClockResetPassword:
.right .right
ld a, [wStringBuffer2 + 5] ld a, [wStringBuffer2 + 5]
cp $4 cp 4
ret z ret z
inc a inc a
ld [wStringBuffer2 + 5], a ld [wStringBuffer2 + 5], a
@ -166,7 +166,7 @@ ClockResetPassword:
ret ret
.wraparound_up .wraparound_up
ld [hl], $0 ld [hl], 0
ret ret
.down .down
@ -219,13 +219,13 @@ ClockResetPassword:
call GetSRAMBank call GetSRAMBank
ld de, 0 ld de, 0
ld hl, sPlayerData + (wPlayerID - wPlayerData) ld hl, sPlayerData + (wPlayerID - wPlayerData)
ld c, $2 ld c, 2
call .ComponentFromNumber call .ComponentFromNumber
ld hl, sPlayerData + (wPlayerName - wPlayerData) ld hl, sPlayerData + (wPlayerName - wPlayerData)
ld c, NAME_LENGTH_JAPANESE - 1 ld c, NAME_LENGTH_JAPANESE - 1
call .ComponentFromString call .ComponentFromString
ld hl, sPlayerData + (wMoney - wPlayerData) ld hl, sPlayerData + (wMoney - wPlayerData)
ld c, $3 ld c, 3
call .ComponentFromNumber call .ComponentFromNumber
call CloseSRAM call CloseSRAM
ret ret
@ -234,7 +234,7 @@ ClockResetPassword:
ld a, [hli] ld a, [hli]
add e add e
ld e, a ld e, a
ld a, $0 ld a, 0
adc d adc d
ld d, a ld d, a
dec c dec c
@ -247,7 +247,7 @@ ClockResetPassword:
ret z ret z
add e add e
ld e, a ld e, a
ld a, $0 ld a, 0
adc d adc d
ld d, a ld d, a
dec c dec c

View File

@ -74,11 +74,11 @@ StageRTCTimeForSave:
ret ret
SaveRTC: SaveRTC:
ld a, $a ld a, SRAM_ENABLE
ld [MBC3SRamEnable], a ld [MBC3SRamEnable], a
call LatchClock call LatchClock
ld hl, MBC3RTC ld hl, MBC3RTC
ld a, $c ld a, RTC_DH
ld [MBC3SRamBank], a ld [MBC3SRamBank], a
res 7, [hl] res 7, [hl]
ld a, BANK(sRTCStatusFlags) ld a, BANK(sRTCStatusFlags)

View File

@ -2,7 +2,7 @@ _AnimateTileset::
; Iterate over a given pointer array of ; Iterate over a given pointer array of
; animation functions (one per frame). ; animation functions (one per frame).
; Typically in wra1, vra0 ; Typically in WRAM bank 1, VRAM bank 0.
ld a, [wTilesetAnim] ld a, [wTilesetAnim]
ld e, a ld e, a
@ -214,16 +214,16 @@ TilesetIcePathAnim:
dw NULL, DoneTileAnimation dw NULL, DoneTileAnimation
TilesetTowerAnim: TilesetTowerAnim:
dw TowerPillarTilePointer9, AnimateTowerPillarTile dw TowerPillarTilePointer9, AnimateTowerPillarTile
dw TowerPillarTilePointer10, AnimateTowerPillarTile dw TowerPillarTilePointer10, AnimateTowerPillarTile
dw TowerPillarTilePointer7, AnimateTowerPillarTile dw TowerPillarTilePointer7, AnimateTowerPillarTile
dw TowerPillarTilePointer8, AnimateTowerPillarTile dw TowerPillarTilePointer8, AnimateTowerPillarTile
dw TowerPillarTilePointer5, AnimateTowerPillarTile dw TowerPillarTilePointer5, AnimateTowerPillarTile
dw TowerPillarTilePointer6, AnimateTowerPillarTile dw TowerPillarTilePointer6, AnimateTowerPillarTile
dw TowerPillarTilePointer3, AnimateTowerPillarTile dw TowerPillarTilePointer3, AnimateTowerPillarTile
dw TowerPillarTilePointer4, AnimateTowerPillarTile dw TowerPillarTilePointer4, AnimateTowerPillarTile
dw TowerPillarTilePointer1, AnimateTowerPillarTile dw TowerPillarTilePointer1, AnimateTowerPillarTile
dw TowerPillarTilePointer2, AnimateTowerPillarTile dw TowerPillarTilePointer2, AnimateTowerPillarTile
dw NULL, StandingTileFrame dw NULL, StandingTileFrame
dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation
@ -658,7 +658,6 @@ FlowerTileFrames:
INCBIN "gfx/tilesets/flower/cgb_2.2bpp" INCBIN "gfx/tilesets/flower/cgb_2.2bpp"
LavaBubbleAnim1: LavaBubbleAnim1:
; Splash in the bottom-right corner of the fountain.
ld hl, sp+0 ld hl, sp+0
ld b, h ld b, h
ld c, l ld c, l
@ -678,7 +677,6 @@ LavaBubbleAnim1:
jp WriteTile jp WriteTile
LavaBubbleAnim2: LavaBubbleAnim2:
; Splash in the top-left corner of the fountain.
ld hl, sp+0 ld hl, sp+0
ld b, h ld b, h
ld c, l ld c, l

View File

@ -188,19 +188,19 @@ endr
ReplaceTimeOfDayPals: ReplaceTimeOfDayPals:
ld hl, .BrightnessLevels ld hl, .BrightnessLevels
ld a, [wMapTimeOfDay] ld a, [wMapTimeOfDay]
cp $4 ; Dark cave, needs Flash cp PALETTE_DARK
jr z, .DarkCave jr z, .NeedsFlash
and $7 and $7
add l add l
ld l, a ld l, a
ld a, $0 ld a, 0
adc h adc h
ld h, a ld h, a
ld a, [hl] ld a, [hl]
ld [wTimeOfDayPalset], a ld [wTimeOfDayPalset], a
ret ret
.DarkCave: .NeedsFlash:
ld a, [wStatusFlags] ld a, [wStatusFlags]
bit STATUSFLAGS_FLASH_F, a bit STATUSFLAGS_FLASH_F, a
jr nz, .UsedFlash jr nz, .UsedFlash
@ -319,7 +319,7 @@ GetTimePalFade:
; get fade table ; get fade table
push bc push bc
ld c, a ld c, a
ld b, $0 ld b, 0
ld hl, .dmgfades ld hl, .dmgfades
add hl, bc add hl, bc
add hl, bc add hl, bc
@ -329,13 +329,13 @@ GetTimePalFade:
pop bc pop bc
; get place in fade table ; get place in fade table
ld b, $0 ld b, 0
add hl, bc add hl, bc
ret ret
.cgb .cgb
ld hl, .cgbfade ld hl, .cgbfade
ld b, $0 ld b, 0
add hl, bc add hl, bc
ret ret