2018-01-11 19:43:18 +00:00
|
|
|
; TrainerCard.Jumptable indexes
|
|
|
|
const_def
|
|
|
|
const TRAINERCARDSTATE_PAGE1_LOADGFX ; 0
|
|
|
|
const TRAINERCARDSTATE_PAGE1_JOYPAD ; 1
|
|
|
|
const TRAINERCARDSTATE_PAGE2_LOADGFX ; 2
|
|
|
|
const TRAINERCARDSTATE_PAGE2_JOYPAD ; 3
|
|
|
|
const TRAINERCARDSTATE_PAGE3_LOADGFX ; 4
|
|
|
|
const TRAINERCARDSTATE_PAGE3_JOYPAD ; 5
|
|
|
|
const TRAINERCARDSTATE_QUIT ; 6
|
|
|
|
|
2015-11-17 22:56:49 +00:00
|
|
|
TrainerCard: ; 25105
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [VramState]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [VramState], a
|
|
|
|
ld hl, Options
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
2018-01-11 19:43:18 +00:00
|
|
|
set NO_TEXT_SCROLL, [hl]
|
2015-12-28 15:57:04 +00:00
|
|
|
call .InitRAM
|
|
|
|
.loop
|
2015-11-17 20:54:03 +00:00
|
|
|
call UpdateTime
|
|
|
|
call JoyTextDelay
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .quit
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [hJoyLast]
|
|
|
|
and B_BUTTON
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .quit
|
|
|
|
call .RunJumptable
|
2015-11-17 20:54:03 +00:00
|
|
|
call DelayFrame
|
2015-12-28 15:57:04 +00:00
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.quit
|
2015-11-17 20:54:03 +00:00
|
|
|
pop af
|
|
|
|
ld [Options], a
|
|
|
|
pop af
|
|
|
|
ld [VramState], a
|
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
.InitRAM: ; 2513b (9:513b)
|
2015-11-17 20:54:03 +00:00
|
|
|
call ClearBGPalettes
|
|
|
|
call ClearSprites
|
|
|
|
call ClearTileMap
|
|
|
|
call DisableLCD
|
|
|
|
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetCardPic
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
ld hl, CardRightCornerGFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles2 tile $1c
|
2015-11-17 20:54:03 +00:00
|
|
|
ld bc, 1 tiles
|
|
|
|
ld a, BANK(CardRightCornerGFX)
|
|
|
|
call FarCopyBytes
|
|
|
|
|
|
|
|
ld hl, CardStatusGFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles2 tile $29
|
2015-12-28 15:57:04 +00:00
|
|
|
ld bc, 86 tiles
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, BANK(CardStatusGFX)
|
|
|
|
call FarCopyBytes
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
call TrainerCard_PrintTopHalfOfCard
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
hlcoord 0, 8
|
2015-12-28 15:57:04 +00:00
|
|
|
ld d, 6
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
call EnableLCD
|
|
|
|
call WaitBGMap
|
2015-12-28 15:57:04 +00:00
|
|
|
ld b, SCGB_TRAINER_CARD
|
2015-11-17 20:54:03 +00:00
|
|
|
call GetSGBLayout
|
|
|
|
call SetPalettes
|
|
|
|
call WaitBGMap
|
|
|
|
ld hl, wJumptableIndex
|
2018-01-11 19:43:18 +00:00
|
|
|
xor a ; TRAINERCARDSTATE_PAGE1_LOADGFX
|
|
|
|
ld [hli], a ; wJumptableIndex
|
|
|
|
ld [hli], a ; wTrainerCardBadgeFrameCounter
|
|
|
|
ld [hli], a ; wTrainerCardBadgeTileID
|
|
|
|
ld [hl], a ; wTrainerCardBadgeAttributes
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
.RunJumptable: ; 2518e (9:518e)
|
|
|
|
jumptable .Jumptable, wJumptableIndex
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
.Jumptable: ; 2519d (9:519d)
|
2018-01-11 19:43:18 +00:00
|
|
|
; entries correspond to TRAINERCARDSTATE_* constants
|
2015-12-28 15:57:04 +00:00
|
|
|
dw TrainerCard_Page1_LoadGFX
|
|
|
|
dw TrainerCard_Page1_Joypad
|
|
|
|
dw TrainerCard_Page2_LoadGFX
|
|
|
|
dw TrainerCard_Page2_Joypad
|
|
|
|
dw TrainerCard_Page3_LoadGFX
|
|
|
|
dw TrainerCard_Page3_Joypad
|
|
|
|
dw TrainerCard_Quit
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_IncrementJumptable: ; 251ab (9:51ab)
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Quit: ; 251b0 (9:51b0)
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page1_LoadGFX: ; 251b6 (9:51b6)
|
2015-11-17 20:54:03 +00:00
|
|
|
call ClearSprites
|
|
|
|
hlcoord 0, 8
|
2015-12-28 15:57:04 +00:00
|
|
|
ld d, 6
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 20:54:03 +00:00
|
|
|
call WaitBGMap
|
|
|
|
ld de, CardStatusGFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles2 tile $29
|
2015-12-28 15:57:04 +00:00
|
|
|
lb bc, BANK(CardStatusGFX), 86
|
2015-11-17 20:54:03 +00:00
|
|
|
call Request2bpp
|
2015-12-28 15:57:04 +00:00
|
|
|
call TrainerCard_Page1_PrintDexCaught_GameTime
|
|
|
|
call TrainerCard_IncrementJumptable
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page1_Joypad: ; 251d7 (9:51d7)
|
|
|
|
call TrainerCard_Page1_PrintGameTime
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_RIGHT | A_BUTTON
|
|
|
|
jr nz, .pressed_right_a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.pressed_right_a
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE2_LOADGFX
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2018-01-02 15:04:21 +00:00
|
|
|
.Unreferenced_KantoCheck:
|
2017-12-28 12:15:46 +00:00
|
|
|
ld a, [wKantoBadges]
|
2015-11-17 20:54:03 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE3_LOADGFX
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
2015-12-28 15:57:04 +00:00
|
|
|
|
2015-11-17 20:54:03 +00:00
|
|
|
; 251f4
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page2_LoadGFX: ; 251f4 (9:51f4)
|
2015-11-17 20:54:03 +00:00
|
|
|
call ClearSprites
|
|
|
|
hlcoord 0, 8
|
2015-12-28 15:57:04 +00:00
|
|
|
ld d, 6
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 20:54:03 +00:00
|
|
|
call WaitBGMap
|
|
|
|
ld de, LeaderGFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles2 tile $29
|
2018-01-15 00:43:35 +00:00
|
|
|
lb bc, BANK(LeaderGFX), 86
|
2015-11-17 20:54:03 +00:00
|
|
|
call Request2bpp
|
|
|
|
ld de, BadgeGFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles0 tile $00
|
2018-01-15 00:43:35 +00:00
|
|
|
lb bc, BANK(BadgeGFX), 44
|
2015-11-17 20:54:03 +00:00
|
|
|
call Request2bpp
|
2015-12-28 15:57:04 +00:00
|
|
|
call TrainerCard_Page2_3_InitObjectsAndStrings
|
|
|
|
call TrainerCard_IncrementJumptable
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page2_Joypad: ; 25221 (9:5221)
|
|
|
|
ld hl, TrainerCard_JohtoBadgesOAM
|
|
|
|
call TrainerCard_Page2_3_AnimateBadges
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .Quit
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_LEFT
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .d_left
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
2015-12-28 15:57:04 +00:00
|
|
|
|
|
|
|
.d_left
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE1_LOADGFX
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2018-01-02 15:04:21 +00:00
|
|
|
.Unreferenced_KantoCheck:
|
2017-12-28 12:15:46 +00:00
|
|
|
ld a, [wKantoBadges]
|
2015-11-17 20:54:03 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE3_LOADGFX
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Quit:
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, TRAINERCARDSTATE_QUIT
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page3_LoadGFX: ; 2524c (9:524c)
|
2015-11-17 20:54:03 +00:00
|
|
|
call ClearSprites
|
|
|
|
hlcoord 0, 8
|
2015-12-28 15:57:04 +00:00
|
|
|
ld d, 6
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 20:54:03 +00:00
|
|
|
call WaitBGMap
|
|
|
|
ld de, LeaderGFX2
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles2 tile $29
|
2018-01-15 00:43:35 +00:00
|
|
|
lb bc, BANK(LeaderGFX2), 86
|
2015-11-17 20:54:03 +00:00
|
|
|
call Request2bpp
|
|
|
|
ld de, BadgeGFX2
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles0 tile $00
|
2018-01-15 00:43:35 +00:00
|
|
|
lb bc, BANK(BadgeGFX2), 44
|
2015-11-17 20:54:03 +00:00
|
|
|
call Request2bpp
|
2015-12-28 15:57:04 +00:00
|
|
|
call TrainerCard_Page2_3_InitObjectsAndStrings
|
|
|
|
call TrainerCard_IncrementJumptable
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page3_Joypad: ; 25279 (9:5279)
|
|
|
|
ld hl, TrainerCard_JohtoBadgesOAM
|
|
|
|
call TrainerCard_Page2_3_AnimateBadges
|
2015-11-17 20:54:03 +00:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_LEFT
|
2015-11-17 22:56:49 +00:00
|
|
|
jr nz, .left
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and D_RIGHT
|
2015-11-17 22:56:49 +00:00
|
|
|
jr nz, .right
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
2015-11-17 22:56:49 +00:00
|
|
|
|
|
|
|
.left
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE2_LOADGFX
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
2015-11-17 22:56:49 +00:00
|
|
|
|
|
|
|
.right
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE1_LOADGFX
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_PrintTopHalfOfCard: ; 25299 (9:5299)
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 0, 0
|
2015-12-28 15:57:04 +00:00
|
|
|
ld d, 5
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 2, 2
|
2015-12-28 15:57:04 +00:00
|
|
|
ld de, .Name_Money
|
2015-11-17 20:54:03 +00:00
|
|
|
call PlaceString
|
|
|
|
hlcoord 2, 4
|
2015-12-28 15:57:04 +00:00
|
|
|
ld de, .ID_No
|
|
|
|
call TrainerCardSetup_PlaceTilemapString
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 7, 2
|
|
|
|
ld de, PlayerName
|
|
|
|
call PlaceString
|
|
|
|
hlcoord 5, 4
|
|
|
|
ld de, PlayerID
|
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 2, 5
|
|
|
|
call PrintNum
|
|
|
|
hlcoord 7, 6
|
|
|
|
ld de, Money
|
|
|
|
lb bc, PRINTNUM_MONEY | 3, 6
|
|
|
|
call PrintNum
|
|
|
|
hlcoord 1, 3
|
2015-12-28 15:57:04 +00:00
|
|
|
ld de, .HorizontalDivider
|
|
|
|
call TrainerCardSetup_PlaceTilemapString
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 14, 1
|
|
|
|
lb bc, 5, 7
|
|
|
|
xor a
|
2016-01-12 17:46:18 +00:00
|
|
|
ld [hGraphicStartTile], a
|
2018-01-16 19:30:10 +00:00
|
|
|
predef PlaceGraphic
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
2015-12-28 15:57:04 +00:00
|
|
|
|
2015-11-17 20:54:03 +00:00
|
|
|
; 252ec (9:52ec)
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
.Name_Money: ; 252ec
|
2015-11-17 20:54:03 +00:00
|
|
|
db "NAME/"
|
|
|
|
next ""
|
|
|
|
next "MONEY@"
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
.ID_No: ; 252f9
|
2018-01-11 19:43:18 +00:00
|
|
|
db $27, $28, -1 ; ID NO
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
.HorizontalDivider: ; 252fc
|
2018-01-11 19:43:18 +00:00
|
|
|
db $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $26, -1 ; ____________>
|
2015-11-17 20:54:03 +00:00
|
|
|
; 2530a
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a)
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 2, 10
|
2015-12-28 15:57:04 +00:00
|
|
|
ld de, .Dex_PlayTime
|
2015-11-17 20:54:03 +00:00
|
|
|
call PlaceString
|
|
|
|
hlcoord 10, 15
|
2015-12-28 15:57:04 +00:00
|
|
|
ld de, .Badges
|
2015-11-17 20:54:03 +00:00
|
|
|
call PlaceString
|
|
|
|
ld hl, PokedexCaught
|
2015-12-28 15:57:04 +00:00
|
|
|
ld b, EndPokedexCaught - PokedexCaught
|
2015-11-17 20:54:03 +00:00
|
|
|
call CountSetBits
|
|
|
|
ld de, wd265
|
|
|
|
hlcoord 15, 10
|
|
|
|
lb bc, 1, 3
|
|
|
|
call PrintNum
|
2015-12-28 15:57:04 +00:00
|
|
|
call TrainerCard_Page1_PrintGameTime
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 2, 8
|
2015-12-28 15:57:04 +00:00
|
|
|
ld de, .StatusTilemap
|
|
|
|
call TrainerCardSetup_PlaceTilemapString
|
2017-12-28 12:15:46 +00:00
|
|
|
ld a, [wStatusFlags]
|
2018-01-22 20:40:43 +00:00
|
|
|
bit STATUSFLAGS_POKEDEX_F, a
|
2015-11-17 20:54:03 +00:00
|
|
|
ret nz
|
|
|
|
hlcoord 1, 9
|
|
|
|
lb bc, 2, 17
|
|
|
|
call ClearBox
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Dex_PlayTime:
|
2015-11-17 20:54:03 +00:00
|
|
|
db "#DEX"
|
2015-12-28 15:57:04 +00:00
|
|
|
next "PLAY TIME@@"
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Badges:
|
2015-11-17 20:54:03 +00:00
|
|
|
db " BADGES▶@"
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
.StatusTilemap: ; 25366
|
2018-01-11 19:43:18 +00:00
|
|
|
db $29, $2a, $2b, $2c, $2d, -1
|
2015-11-17 20:54:03 +00:00
|
|
|
; 2536c
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page2_3_InitObjectsAndStrings: ; 2536c (9:536c)
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 2, 8
|
2015-12-28 15:57:04 +00:00
|
|
|
ld de, .BadgesTilemap
|
|
|
|
call TrainerCardSetup_PlaceTilemapString
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 2, 10
|
|
|
|
ld a, $29
|
2015-12-28 15:57:04 +00:00
|
|
|
ld c, 4
|
|
|
|
.loop
|
|
|
|
call TrainerCard_Page2_3_PlaceLeadersFaces
|
2015-11-17 20:54:03 +00:00
|
|
|
rept 4
|
|
|
|
inc hl
|
|
|
|
endr
|
|
|
|
dec c
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .loop
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 2, 13
|
|
|
|
ld a, $51
|
2015-12-28 15:57:04 +00:00
|
|
|
ld c, 4
|
|
|
|
.loop2
|
|
|
|
call TrainerCard_Page2_3_PlaceLeadersFaces
|
2015-11-17 20:54:03 +00:00
|
|
|
rept 4
|
|
|
|
inc hl
|
|
|
|
endr
|
|
|
|
dec c
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .loop2
|
2015-11-17 20:54:03 +00:00
|
|
|
xor a
|
2018-01-11 19:43:18 +00:00
|
|
|
ld [wTrainerCardBadgeFrameCounter], a
|
2015-12-28 15:57:04 +00:00
|
|
|
ld hl, TrainerCard_JohtoBadgesOAM
|
|
|
|
call TrainerCard_Page2_3_OAMUpdate
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
2015-12-28 15:57:04 +00:00
|
|
|
|
2015-11-17 20:54:03 +00:00
|
|
|
; 253a2 (9:53a2)
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
.BadgesTilemap: ; 253a2
|
2018-01-11 19:43:18 +00:00
|
|
|
db $79, $7a, $7b, $7c, $7d, -1 ; "BADGES"
|
2015-11-17 20:54:03 +00:00
|
|
|
; 253a8
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCardSetup_PlaceTilemapString: ; 253a8 (9:53a8)
|
|
|
|
.loop
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [de]
|
2018-01-11 19:43:18 +00:00
|
|
|
cp -1
|
2015-11-17 20:54:03 +00:00
|
|
|
ret z
|
|
|
|
ld [hli], a
|
|
|
|
inc de
|
2015-12-28 15:57:04 +00:00
|
|
|
jr .loop
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_InitBorder: ; 253b0 (9:53b0)
|
2018-01-11 19:43:18 +00:00
|
|
|
ld e, SCREEN_WIDTH
|
2015-12-28 15:57:04 +00:00
|
|
|
.loop1
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .loop1
|
|
|
|
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
2018-01-11 19:43:18 +00:00
|
|
|
ld e, SCREEN_HEIGHT - 1
|
2015-12-28 15:57:04 +00:00
|
|
|
ld a, " "
|
|
|
|
.loop2
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .loop2
|
|
|
|
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, $1c
|
|
|
|
ld [hli], a
|
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
2015-12-28 15:57:04 +00:00
|
|
|
.loop3
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
2015-12-28 15:57:04 +00:00
|
|
|
|
2018-01-11 19:43:18 +00:00
|
|
|
ld e, SCREEN_HEIGHT
|
2015-12-28 15:57:04 +00:00
|
|
|
ld a, " "
|
|
|
|
.loop4
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .loop4
|
|
|
|
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
|
|
|
dec d
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .loop3
|
|
|
|
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
|
|
|
ld a, $24
|
|
|
|
ld [hli], a
|
2015-12-28 15:57:04 +00:00
|
|
|
|
2018-01-11 19:43:18 +00:00
|
|
|
ld e, SCREEN_HEIGHT - 1
|
2015-12-28 15:57:04 +00:00
|
|
|
ld a, " "
|
|
|
|
.loop5
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .loop5
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
2018-01-11 19:43:18 +00:00
|
|
|
ld e, SCREEN_WIDTH
|
2015-12-28 15:57:04 +00:00
|
|
|
.loop6
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 15:57:04 +00:00
|
|
|
jr nz, .loop6
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page2_3_PlaceLeadersFaces: ; 253f4 (9:53f4)
|
2015-11-17 20:54:03 +00:00
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
2015-12-28 15:57:04 +00:00
|
|
|
ld de, SCREEN_WIDTH - 3
|
2015-11-17 20:54:03 +00:00
|
|
|
add hl, de
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
2015-12-28 15:57:04 +00:00
|
|
|
ld de, SCREEN_WIDTH - 3
|
2015-11-17 20:54:03 +00:00
|
|
|
add hl, de
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
pop hl
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page1_PrintGameTime: ; 25415 (9:5415)
|
2015-11-17 20:54:03 +00:00
|
|
|
hlcoord 11, 12
|
|
|
|
ld de, GameTimeHours
|
|
|
|
lb bc, 2, 4
|
|
|
|
call PrintNum
|
|
|
|
inc hl
|
|
|
|
ld de, GameTimeMinutes
|
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
|
|
|
|
call PrintNum
|
|
|
|
ld a, [hVBlankCounter]
|
|
|
|
and $1f
|
|
|
|
ret nz
|
|
|
|
hlcoord 15, 12
|
|
|
|
ld a, [hl]
|
2017-12-13 05:28:48 +00:00
|
|
|
xor " " ^ $2e ; alternate between space and small colon ($2e) tiles
|
2015-11-17 20:54:03 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page2_3_AnimateBadges: ; 25438 (9:5438)
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [hVBlankCounter]
|
2018-01-11 19:43:18 +00:00
|
|
|
and %111
|
2015-11-17 20:54:03 +00:00
|
|
|
ret nz
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, [wTrainerCardBadgeFrameCounter]
|
2015-11-17 20:54:03 +00:00
|
|
|
inc a
|
2018-01-11 19:43:18 +00:00
|
|
|
and %111
|
|
|
|
ld [wTrainerCardBadgeFrameCounter], a
|
2015-12-28 15:57:04 +00:00
|
|
|
jr TrainerCard_Page2_3_OAMUpdate
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_Page2_3_OAMUpdate: ; 25448 (9:5448)
|
2015-11-17 22:56:49 +00:00
|
|
|
; copy flag array pointer
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
2015-11-17 22:56:49 +00:00
|
|
|
; get flag array
|
2015-11-17 20:54:03 +00:00
|
|
|
ld d, a
|
|
|
|
ld a, [de]
|
|
|
|
ld c, a
|
2018-01-10 18:47:57 +00:00
|
|
|
ld de, Sprite01
|
|
|
|
ld b, NUM_JOHTO_BADGES
|
2015-11-17 22:56:49 +00:00
|
|
|
.loop
|
2015-11-17 20:54:03 +00:00
|
|
|
srl c
|
|
|
|
push bc
|
2015-11-17 22:56:49 +00:00
|
|
|
jr nc, .skip_badge
|
2015-11-17 20:54:03 +00:00
|
|
|
push hl
|
2015-11-17 22:56:49 +00:00
|
|
|
ld a, [hli] ; y
|
2015-11-17 20:54:03 +00:00
|
|
|
ld b, a
|
2015-11-17 22:56:49 +00:00
|
|
|
ld a, [hli] ; x
|
2015-11-17 20:54:03 +00:00
|
|
|
ld c, a
|
2015-11-17 22:56:49 +00:00
|
|
|
ld a, [hli] ; pal
|
2018-01-11 19:43:18 +00:00
|
|
|
ld [wTrainerCardBadgeAttributes], a
|
|
|
|
ld a, [wTrainerCardBadgeFrameCounter]
|
2015-11-17 20:54:03 +00:00
|
|
|
add l
|
|
|
|
ld l, a
|
|
|
|
ld a, 0
|
|
|
|
adc h
|
|
|
|
ld h, a
|
|
|
|
ld a, [hl]
|
2018-01-11 19:43:18 +00:00
|
|
|
ld [wTrainerCardBadgeTileID], a
|
2015-12-28 15:57:04 +00:00
|
|
|
call .PrepOAM
|
2015-11-17 20:54:03 +00:00
|
|
|
pop hl
|
2015-11-17 22:56:49 +00:00
|
|
|
.skip_badge
|
|
|
|
ld bc, $b ; 3 + 2 * 4
|
2015-11-17 20:54:03 +00:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-11-17 22:56:49 +00:00
|
|
|
jr nz, .loop
|
2015-11-17 20:54:03 +00:00
|
|
|
ret
|
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
.PrepOAM: ; 2547b (9:547b)
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, [wTrainerCardBadgeTileID]
|
|
|
|
and 1 << 7
|
2015-11-17 22:56:49 +00:00
|
|
|
jr nz, .xflip
|
|
|
|
ld hl, .facing1
|
2015-12-28 15:57:04 +00:00
|
|
|
jr .loop2
|
|
|
|
|
2015-11-17 22:56:49 +00:00
|
|
|
.xflip
|
|
|
|
ld hl, .facing2
|
2015-12-28 15:57:04 +00:00
|
|
|
.loop2
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [hli]
|
2018-01-10 18:47:57 +00:00
|
|
|
cp -1
|
2015-11-17 20:54:03 +00:00
|
|
|
ret z
|
|
|
|
add b
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [de], a ; y
|
2015-11-17 20:54:03 +00:00
|
|
|
inc de
|
2015-11-17 22:56:49 +00:00
|
|
|
|
2015-11-17 20:54:03 +00:00
|
|
|
ld a, [hli]
|
|
|
|
add c
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [de], a ; x
|
2015-11-17 20:54:03 +00:00
|
|
|
inc de
|
2015-11-17 22:56:49 +00:00
|
|
|
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, [wTrainerCardBadgeTileID]
|
|
|
|
and $ff ^ (1 << 7)
|
2015-11-17 20:54:03 +00:00
|
|
|
add [hl]
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [de], a ; tile id
|
2015-11-17 20:54:03 +00:00
|
|
|
inc hl
|
|
|
|
inc de
|
2015-11-17 22:56:49 +00:00
|
|
|
|
2018-01-11 19:43:18 +00:00
|
|
|
ld a, [wTrainerCardBadgeAttributes]
|
2015-11-17 20:54:03 +00:00
|
|
|
add [hl]
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [de], a ; attributes
|
2015-11-17 20:54:03 +00:00
|
|
|
inc hl
|
|
|
|
inc de
|
2015-12-28 15:57:04 +00:00
|
|
|
jr .loop2
|
|
|
|
|
2015-11-17 20:54:03 +00:00
|
|
|
; 254a7 (9:54a7)
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.facing1 ; 254a7
|
2018-01-10 18:47:57 +00:00
|
|
|
dsprite 0, 0, 0, 0, $00, 0
|
|
|
|
dsprite 0, 0, 1, 0, $01, 0
|
|
|
|
dsprite 1, 0, 0, 0, $02, 0
|
|
|
|
dsprite 1, 0, 1, 0, $03, 0
|
2015-11-17 22:56:49 +00:00
|
|
|
db -1
|
|
|
|
|
2016-04-10 19:01:49 +00:00
|
|
|
.facing2 ; 254b8
|
2018-01-10 18:47:57 +00:00
|
|
|
dsprite 0, 0, 0, 0, $01, 0 | X_FLIP
|
|
|
|
dsprite 0, 0, 1, 0, $00, 0 | X_FLIP
|
|
|
|
dsprite 1, 0, 0, 0, $03, 0 | X_FLIP
|
|
|
|
dsprite 1, 0, 1, 0, $02, 0 | X_FLIP
|
2015-11-17 22:56:49 +00:00
|
|
|
db -1
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2015-12-28 15:57:04 +00:00
|
|
|
TrainerCard_JohtoBadgesOAM: ; 254c9
|
2015-11-17 20:54:03 +00:00
|
|
|
; Template OAM data for each badge on the trainer card.
|
|
|
|
; Format:
|
|
|
|
; y, x, palette
|
|
|
|
; cycle 1: face tile, in1 tile, in2 tile, in3 tile
|
|
|
|
; cycle 2: face tile, in1 tile, in2 tile, in3 tile
|
|
|
|
|
2017-12-28 12:15:46 +00:00
|
|
|
dw wJohtoBadges
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
; Zephyrbadge
|
2015-11-17 22:56:49 +00:00
|
|
|
db $68, $18, 0
|
2018-01-11 19:43:18 +00:00
|
|
|
db $00, $20, $24, $20 | (1 << 7)
|
|
|
|
db $00, $20, $24, $20 | (1 << 7)
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
; Hivebadge
|
2015-11-17 22:56:49 +00:00
|
|
|
db $68, $38, 0
|
2018-01-11 19:43:18 +00:00
|
|
|
db $04, $20, $24, $20 | (1 << 7)
|
|
|
|
db $04, $20, $24, $20 | (1 << 7)
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
; Plainbadge
|
2015-11-17 22:56:49 +00:00
|
|
|
db $68, $58, 0
|
2018-01-11 19:43:18 +00:00
|
|
|
db $08, $20, $24, $20 | (1 << 7)
|
|
|
|
db $08, $20, $24, $20 | (1 << 7)
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
; Fogbadge
|
2015-11-17 22:56:49 +00:00
|
|
|
db $68, $78, 0
|
2018-01-11 19:43:18 +00:00
|
|
|
db $0c, $20, $24, $20 | (1 << 7)
|
|
|
|
db $0c, $20, $24, $20 | (1 << 7)
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
; Mineralbadge
|
2015-11-17 22:56:49 +00:00
|
|
|
db $80, $38, 0
|
2018-01-11 19:43:18 +00:00
|
|
|
db $10, $20, $24, $20 | (1 << 7)
|
|
|
|
db $10, $20, $24, $20 | (1 << 7)
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
; Stormbadge
|
2015-11-17 22:56:49 +00:00
|
|
|
db $80, $18, 0
|
2018-01-11 19:43:18 +00:00
|
|
|
db $14, $20, $24, $20 | (1 << 7)
|
|
|
|
db $14, $20, $24, $20 | (1 << 7)
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
; Glacierbadge
|
2015-11-17 22:56:49 +00:00
|
|
|
db $80, $58, 0
|
2018-01-11 19:43:18 +00:00
|
|
|
db $18, $20, $24, $20 | (1 << 7)
|
|
|
|
db $18, $20, $24, $20 | (1 << 7)
|
2015-11-17 20:54:03 +00:00
|
|
|
|
|
|
|
; Risingbadge
|
|
|
|
; X-flips on alternate cycles.
|
2015-11-17 22:56:49 +00:00
|
|
|
db $80, $78, 0
|
2018-01-11 19:43:18 +00:00
|
|
|
db $1c, $20, $24, $20 | (1 << 7)
|
|
|
|
db $1c | (1 << 7), $20, $24, $20 | (1 << 7)
|
2015-11-17 20:54:03 +00:00
|
|
|
; 25523
|
|
|
|
|
2017-12-10 03:57:41 +00:00
|
|
|
CardStatusGFX: INCBIN "gfx/trainer_card/card_status.2bpp"
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2017-12-10 03:57:41 +00:00
|
|
|
LeaderGFX: INCBIN "gfx/trainer_card/leaders.2bpp"
|
|
|
|
LeaderGFX2: INCBIN "gfx/trainer_card/leaders.2bpp"
|
|
|
|
BadgeGFX: INCBIN "gfx/trainer_card/badges.2bpp"
|
|
|
|
BadgeGFX2: INCBIN "gfx/trainer_card/badges.2bpp"
|
2015-11-17 20:54:03 +00:00
|
|
|
|
2017-12-10 03:57:41 +00:00
|
|
|
CardRightCornerGFX: INCBIN "gfx/trainer_card/card_right_corner.2bpp"
|