2018-01-11 11:43:18 -08: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
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wVramState]
|
2015-11-17 12:54:03 -08:00
|
|
|
push af
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wVramState], a
|
|
|
|
ld hl, wOptions
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, [hl]
|
|
|
|
push af
|
2018-01-11 11:43:18 -08:00
|
|
|
set NO_TEXT_SCROLL, [hl]
|
2015-12-28 07:57:04 -08:00
|
|
|
call .InitRAM
|
|
|
|
.loop
|
2015-11-17 12:54:03 -08:00
|
|
|
call JoyTextDelay
|
|
|
|
ld a, [wJumptableIndex]
|
|
|
|
bit 7, a
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .quit
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hJoyLast]
|
2015-11-17 12:54:03 -08:00
|
|
|
and B_BUTTON
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .quit
|
|
|
|
call .RunJumptable
|
2015-11-17 12:54:03 -08:00
|
|
|
call DelayFrame
|
2015-12-28 07:57:04 -08:00
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.quit
|
2015-11-17 12:54:03 -08:00
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wOptions], a
|
2015-11-17 12:54:03 -08:00
|
|
|
pop af
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wVramState], a
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.InitRAM:
|
2015-11-17 12:54:03 -08:00
|
|
|
call ClearBGPalettes
|
|
|
|
call ClearSprites
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-17 12:54:03 -08:00
|
|
|
call DisableLCD
|
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall GetCardPic
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
ld hl, CardRightCornerGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2 tile $1c
|
2015-11-17 12:54:03 -08:00
|
|
|
ld bc, 1 tiles
|
|
|
|
ld a, BANK(CardRightCornerGFX)
|
|
|
|
call FarCopyBytes
|
|
|
|
|
|
|
|
ld hl, CardStatusGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2 tile $29
|
2015-12-28 07:57:04 -08:00
|
|
|
ld bc, 86 tiles
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, BANK(CardStatusGFX)
|
|
|
|
call FarCopyBytes
|
|
|
|
|
2015-12-28 07:57:04 -08:00
|
|
|
call TrainerCard_PrintTopHalfOfCard
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
hlcoord 0, 8
|
2015-12-28 07:57:04 -08:00
|
|
|
ld d, 6
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
call EnableLCD
|
|
|
|
call WaitBGMap
|
2023-07-26 08:01:20 -07:00
|
|
|
ld b, CGB_TRAINER_CARD
|
|
|
|
call GetCGBLayout
|
2015-11-17 12:54:03 -08:00
|
|
|
call SetPalettes
|
|
|
|
call WaitBGMap
|
|
|
|
ld hl, wJumptableIndex
|
2018-01-11 11:43:18 -08: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 12:54:03 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.RunJumptable:
|
2015-12-28 07:57:04 -08:00
|
|
|
jumptable .Jumptable, wJumptableIndex
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Jumptable:
|
2018-01-11 11:43:18 -08:00
|
|
|
; entries correspond to TRAINERCARDSTATE_* constants
|
2015-12-28 07:57:04 -08: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 12:54:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_IncrementJumptable:
|
2015-11-17 12:54:03 -08:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
inc [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Quit:
|
2015-11-17 12:54:03 -08:00
|
|
|
ld hl, wJumptableIndex
|
|
|
|
set 7, [hl]
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page1_LoadGFX:
|
2015-11-17 12:54:03 -08:00
|
|
|
call ClearSprites
|
|
|
|
hlcoord 0, 8
|
2015-12-28 07:57:04 -08:00
|
|
|
ld d, 6
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 12:54:03 -08:00
|
|
|
call WaitBGMap
|
|
|
|
ld de, CardStatusGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $29
|
2015-12-28 07:57:04 -08:00
|
|
|
lb bc, BANK(CardStatusGFX), 86
|
2015-11-17 12:54:03 -08:00
|
|
|
call Request2bpp
|
2015-12-28 07:57:04 -08:00
|
|
|
call TrainerCard_Page1_PrintDexCaught_GameTime
|
|
|
|
call TrainerCard_IncrementJumptable
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page1_Joypad:
|
2015-12-28 07:57:04 -08:00
|
|
|
call TrainerCard_Page1_PrintGameTime
|
2015-11-17 12:54:03 -08:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_RIGHT | A_BUTTON
|
|
|
|
jr nz, .pressed_right_a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.pressed_right_a
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE2_LOADGFX
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
.KantoBadgeCheck: ; unreferenced
|
2017-12-28 04:15:46 -08:00
|
|
|
ld a, [wKantoBadges]
|
2015-11-17 12:54:03 -08:00
|
|
|
and a
|
|
|
|
ret z
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE3_LOADGFX
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
2015-12-28 07:57:04 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page2_LoadGFX:
|
2015-11-17 12:54:03 -08:00
|
|
|
call ClearSprites
|
|
|
|
hlcoord 0, 8
|
2015-12-28 07:57:04 -08:00
|
|
|
ld d, 6
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 12:54:03 -08:00
|
|
|
call WaitBGMap
|
|
|
|
ld de, LeaderGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $29
|
2018-01-14 16:43:35 -08:00
|
|
|
lb bc, BANK(LeaderGFX), 86
|
2015-11-17 12:54:03 -08:00
|
|
|
call Request2bpp
|
|
|
|
ld de, BadgeGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles0 tile $00
|
2018-01-14 16:43:35 -08:00
|
|
|
lb bc, BANK(BadgeGFX), 44
|
2015-11-17 12:54:03 -08:00
|
|
|
call Request2bpp
|
2015-12-28 07:57:04 -08:00
|
|
|
call TrainerCard_Page2_3_InitObjectsAndStrings
|
|
|
|
call TrainerCard_IncrementJumptable
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page2_Joypad:
|
2015-12-28 07:57:04 -08:00
|
|
|
ld hl, TrainerCard_JohtoBadgesOAM
|
|
|
|
call TrainerCard_Page2_3_AnimateBadges
|
2015-11-17 12:54:03 -08:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and A_BUTTON
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .Quit
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and D_LEFT
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .d_left
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
2015-12-28 07:57:04 -08:00
|
|
|
|
|
|
|
.d_left
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE1_LOADGFX
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
.KantoBadgeCheck: ; unreferenced
|
2017-12-28 04:15:46 -08:00
|
|
|
ld a, [wKantoBadges]
|
2015-11-17 12:54:03 -08:00
|
|
|
and a
|
|
|
|
ret z
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE3_LOADGFX
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Quit:
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, TRAINERCARDSTATE_QUIT
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page3_LoadGFX:
|
2015-11-17 12:54:03 -08:00
|
|
|
call ClearSprites
|
|
|
|
hlcoord 0, 8
|
2015-12-28 07:57:04 -08:00
|
|
|
ld d, 6
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 12:54:03 -08:00
|
|
|
call WaitBGMap
|
|
|
|
ld de, LeaderGFX2
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2 tile $29
|
2018-01-14 16:43:35 -08:00
|
|
|
lb bc, BANK(LeaderGFX2), 86
|
2015-11-17 12:54:03 -08:00
|
|
|
call Request2bpp
|
|
|
|
ld de, BadgeGFX2
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles0 tile $00
|
2018-01-14 16:43:35 -08:00
|
|
|
lb bc, BANK(BadgeGFX2), 44
|
2015-11-17 12:54:03 -08:00
|
|
|
call Request2bpp
|
2015-12-28 07:57:04 -08:00
|
|
|
call TrainerCard_Page2_3_InitObjectsAndStrings
|
|
|
|
call TrainerCard_IncrementJumptable
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page3_Joypad:
|
2015-12-28 07:57:04 -08:00
|
|
|
ld hl, TrainerCard_JohtoBadgesOAM
|
|
|
|
call TrainerCard_Page2_3_AnimateBadges
|
2015-11-17 12:54:03 -08:00
|
|
|
ld hl, hJoyLast
|
|
|
|
ld a, [hl]
|
|
|
|
and D_LEFT
|
2015-11-17 14:56:49 -08:00
|
|
|
jr nz, .left
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and D_RIGHT
|
2015-11-17 14:56:49 -08:00
|
|
|
jr nz, .right
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
2015-11-17 14:56:49 -08:00
|
|
|
|
|
|
|
.left
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE2_LOADGFX
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
2015-11-17 14:56:49 -08:00
|
|
|
|
|
|
|
.right
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, TRAINERCARDSTATE_PAGE1_LOADGFX
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [wJumptableIndex], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_PrintTopHalfOfCard:
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 0, 0
|
2015-12-28 07:57:04 -08:00
|
|
|
ld d, 5
|
|
|
|
call TrainerCard_InitBorder
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 2, 2
|
2015-12-28 07:57:04 -08:00
|
|
|
ld de, .Name_Money
|
2015-11-17 12:54:03 -08:00
|
|
|
call PlaceString
|
|
|
|
hlcoord 2, 4
|
2015-12-28 07:57:04 -08:00
|
|
|
ld de, .ID_No
|
|
|
|
call TrainerCardSetup_PlaceTilemapString
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 7, 2
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wPlayerName
|
2015-11-17 12:54:03 -08:00
|
|
|
call PlaceString
|
|
|
|
hlcoord 5, 4
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wPlayerID
|
2015-11-17 12:54:03 -08:00
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 2, 5
|
|
|
|
call PrintNum
|
|
|
|
hlcoord 7, 6
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMoney
|
2015-11-17 12:54:03 -08:00
|
|
|
lb bc, PRINTNUM_MONEY | 3, 6
|
|
|
|
call PrintNum
|
|
|
|
hlcoord 1, 3
|
2015-12-28 07:57:04 -08:00
|
|
|
ld de, .HorizontalDivider
|
|
|
|
call TrainerCardSetup_PlaceTilemapString
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 14, 1
|
|
|
|
lb bc, 5, 7
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hGraphicStartTile], a
|
2018-01-16 11:30:10 -08:00
|
|
|
predef PlaceGraphic
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
2015-12-28 07:57:04 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Name_Money:
|
2015-11-17 12:54:03 -08:00
|
|
|
db "NAME/"
|
|
|
|
next ""
|
|
|
|
next "MONEY@"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ID_No:
|
2018-01-11 11:43:18 -08:00
|
|
|
db $27, $28, -1 ; ID NO
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.HorizontalDivider:
|
2018-01-11 11:43:18 -08:00
|
|
|
db $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $25, $26, -1 ; ____________>
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page1_PrintDexCaught_GameTime:
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 2, 10
|
2015-12-28 07:57:04 -08:00
|
|
|
ld de, .Dex_PlayTime
|
2015-11-17 12:54:03 -08:00
|
|
|
call PlaceString
|
|
|
|
hlcoord 10, 15
|
2015-12-28 07:57:04 -08:00
|
|
|
ld de, .Badges
|
2015-11-17 12:54:03 -08:00
|
|
|
call PlaceString
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPokedexCaught
|
|
|
|
ld b, wEndPokedexCaught - wPokedexCaught
|
2015-11-17 12:54:03 -08:00
|
|
|
call CountSetBits
|
2018-07-28 16:27:34 -07:00
|
|
|
ld de, wNumSetBits
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 15, 10
|
|
|
|
lb bc, 1, 3
|
|
|
|
call PrintNum
|
2015-12-28 07:57:04 -08:00
|
|
|
call TrainerCard_Page1_PrintGameTime
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 2, 8
|
2015-12-28 07:57:04 -08:00
|
|
|
ld de, .StatusTilemap
|
|
|
|
call TrainerCardSetup_PlaceTilemapString
|
2017-12-28 04:15:46 -08:00
|
|
|
ld a, [wStatusFlags]
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS_POKEDEX_F, a
|
2015-11-17 12:54:03 -08:00
|
|
|
ret nz
|
|
|
|
hlcoord 1, 9
|
|
|
|
lb bc, 2, 17
|
|
|
|
call ClearBox
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Dex_PlayTime:
|
2015-11-17 12:54:03 -08:00
|
|
|
db "#DEX"
|
2018-11-17 10:33:03 -08:00
|
|
|
next "PLAY TIME@"
|
|
|
|
|
2020-10-28 07:21:10 -07:00
|
|
|
.Unused: ; unreferenced
|
|
|
|
db "@"
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Badges:
|
2015-11-17 12:54:03 -08:00
|
|
|
db " BADGESâ–¶@"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.StatusTilemap:
|
2018-01-11 11:43:18 -08:00
|
|
|
db $29, $2a, $2b, $2c, $2d, -1
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page2_3_InitObjectsAndStrings:
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 2, 8
|
2015-12-28 07:57:04 -08:00
|
|
|
ld de, .BadgesTilemap
|
|
|
|
call TrainerCardSetup_PlaceTilemapString
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 2, 10
|
|
|
|
ld a, $29
|
2015-12-28 07:57:04 -08:00
|
|
|
ld c, 4
|
|
|
|
.loop
|
|
|
|
call TrainerCard_Page2_3_PlaceLeadersFaces
|
2015-11-17 12:54:03 -08:00
|
|
|
rept 4
|
|
|
|
inc hl
|
|
|
|
endr
|
|
|
|
dec c
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .loop
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 2, 13
|
|
|
|
ld a, $51
|
2015-12-28 07:57:04 -08:00
|
|
|
ld c, 4
|
|
|
|
.loop2
|
|
|
|
call TrainerCard_Page2_3_PlaceLeadersFaces
|
2015-11-17 12:54:03 -08:00
|
|
|
rept 4
|
|
|
|
inc hl
|
|
|
|
endr
|
|
|
|
dec c
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .loop2
|
2015-11-17 12:54:03 -08:00
|
|
|
xor a
|
2018-01-11 11:43:18 -08:00
|
|
|
ld [wTrainerCardBadgeFrameCounter], a
|
2015-12-28 07:57:04 -08:00
|
|
|
ld hl, TrainerCard_JohtoBadgesOAM
|
|
|
|
call TrainerCard_Page2_3_OAMUpdate
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
2015-12-28 07:57:04 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.BadgesTilemap:
|
2018-01-11 11:43:18 -08:00
|
|
|
db $79, $7a, $7b, $7c, $7d, -1 ; "BADGES"
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCardSetup_PlaceTilemapString:
|
2015-12-28 07:57:04 -08:00
|
|
|
.loop
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, [de]
|
2018-01-11 11:43:18 -08:00
|
|
|
cp -1
|
2015-11-17 12:54:03 -08:00
|
|
|
ret z
|
|
|
|
ld [hli], a
|
|
|
|
inc de
|
2015-12-28 07:57:04 -08:00
|
|
|
jr .loop
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_InitBorder:
|
2018-01-11 11:43:18 -08:00
|
|
|
ld e, SCREEN_WIDTH
|
2015-12-28 07:57:04 -08:00
|
|
|
.loop1
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .loop1
|
|
|
|
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
2020-05-25 18:05:52 -07:00
|
|
|
|
|
|
|
ld e, SCREEN_WIDTH - 3
|
2015-12-28 07:57:04 -08:00
|
|
|
ld a, " "
|
|
|
|
.loop2
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .loop2
|
|
|
|
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, $1c
|
|
|
|
ld [hli], a
|
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
2020-05-25 18:05:52 -07:00
|
|
|
|
2015-12-28 07:57:04 -08:00
|
|
|
.loop3
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
2015-12-28 07:57:04 -08:00
|
|
|
|
2020-05-25 18:05:52 -07:00
|
|
|
ld e, SCREEN_WIDTH - 2
|
2015-12-28 07:57:04 -08:00
|
|
|
ld a, " "
|
|
|
|
.loop4
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .loop4
|
|
|
|
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
2020-05-25 18:05:52 -07:00
|
|
|
|
2015-11-17 12:54:03 -08:00
|
|
|
dec d
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .loop3
|
|
|
|
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
|
|
|
ld a, $24
|
|
|
|
ld [hli], a
|
2015-12-28 07:57:04 -08:00
|
|
|
|
2020-05-25 18:05:52 -07:00
|
|
|
ld e, SCREEN_WIDTH - 3
|
2015-12-28 07:57:04 -08:00
|
|
|
ld a, " "
|
|
|
|
.loop5
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .loop5
|
2020-05-25 18:05:52 -07:00
|
|
|
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
2020-05-25 18:05:52 -07:00
|
|
|
|
2018-01-11 11:43:18 -08:00
|
|
|
ld e, SCREEN_WIDTH
|
2015-12-28 07:57:04 -08:00
|
|
|
.loop6
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, $23
|
|
|
|
ld [hli], a
|
|
|
|
dec e
|
2015-12-28 07:57:04 -08:00
|
|
|
jr nz, .loop6
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page2_3_PlaceLeadersFaces:
|
2015-11-17 12:54:03 -08: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 07:57:04 -08:00
|
|
|
ld de, SCREEN_WIDTH - 3
|
2015-11-17 12:54:03 -08:00
|
|
|
add hl, de
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
2015-12-28 07:57:04 -08:00
|
|
|
ld de, SCREEN_WIDTH - 3
|
2015-11-17 12:54:03 -08:00
|
|
|
add hl, de
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
pop hl
|
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page1_PrintGameTime:
|
2015-11-17 12:54:03 -08:00
|
|
|
hlcoord 11, 12
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wGameTimeHours
|
2015-11-17 12:54:03 -08:00
|
|
|
lb bc, 2, 4
|
|
|
|
call PrintNum
|
|
|
|
inc hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wGameTimeMinutes
|
2015-11-17 12:54:03 -08:00
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
|
|
|
|
call PrintNum
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hVBlankCounter]
|
2015-11-17 12:54:03 -08:00
|
|
|
and $1f
|
|
|
|
ret nz
|
|
|
|
hlcoord 15, 12
|
|
|
|
ld a, [hl]
|
2017-12-12 21:28:48 -08:00
|
|
|
xor " " ^ $2e ; alternate between space and small colon ($2e) tiles
|
2015-11-17 12:54:03 -08:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page2_3_AnimateBadges:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hVBlankCounter]
|
2018-01-11 11:43:18 -08:00
|
|
|
and %111
|
2015-11-17 12:54:03 -08:00
|
|
|
ret nz
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, [wTrainerCardBadgeFrameCounter]
|
2015-11-17 12:54:03 -08:00
|
|
|
inc a
|
2018-01-11 11:43:18 -08:00
|
|
|
and %111
|
|
|
|
ld [wTrainerCardBadgeFrameCounter], a
|
2015-12-28 07:57:04 -08:00
|
|
|
jr TrainerCard_Page2_3_OAMUpdate
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_Page2_3_OAMUpdate:
|
2015-11-17 14:56:49 -08:00
|
|
|
; copy flag array pointer
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
2015-11-17 14:56:49 -08:00
|
|
|
; get flag array
|
2015-11-17 12:54:03 -08:00
|
|
|
ld d, a
|
|
|
|
ld a, [de]
|
|
|
|
ld c, a
|
2022-07-09 14:18:22 -07:00
|
|
|
ld de, wShadowOAMSprite00
|
2018-01-10 10:47:57 -08:00
|
|
|
ld b, NUM_JOHTO_BADGES
|
2015-11-17 14:56:49 -08:00
|
|
|
.loop
|
2015-11-17 12:54:03 -08:00
|
|
|
srl c
|
|
|
|
push bc
|
2015-11-17 14:56:49 -08:00
|
|
|
jr nc, .skip_badge
|
2015-11-17 12:54:03 -08:00
|
|
|
push hl
|
2015-11-17 14:56:49 -08:00
|
|
|
ld a, [hli] ; y
|
2015-11-17 12:54:03 -08:00
|
|
|
ld b, a
|
2015-11-17 14:56:49 -08:00
|
|
|
ld a, [hli] ; x
|
2015-11-17 12:54:03 -08:00
|
|
|
ld c, a
|
2015-11-17 14:56:49 -08:00
|
|
|
ld a, [hli] ; pal
|
2018-01-11 11:43:18 -08:00
|
|
|
ld [wTrainerCardBadgeAttributes], a
|
|
|
|
ld a, [wTrainerCardBadgeFrameCounter]
|
2015-11-17 12:54:03 -08:00
|
|
|
add l
|
|
|
|
ld l, a
|
|
|
|
ld a, 0
|
|
|
|
adc h
|
|
|
|
ld h, a
|
|
|
|
ld a, [hl]
|
2018-01-11 11:43:18 -08:00
|
|
|
ld [wTrainerCardBadgeTileID], a
|
2015-12-28 07:57:04 -08:00
|
|
|
call .PrepOAM
|
2015-11-17 12:54:03 -08:00
|
|
|
pop hl
|
2015-11-17 14:56:49 -08:00
|
|
|
.skip_badge
|
|
|
|
ld bc, $b ; 3 + 2 * 4
|
2015-11-17 12:54:03 -08:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-11-17 14:56:49 -08:00
|
|
|
jr nz, .loop
|
2015-11-17 12:54:03 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PrepOAM:
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, [wTrainerCardBadgeTileID]
|
|
|
|
and 1 << 7
|
2015-11-17 14:56:49 -08:00
|
|
|
jr nz, .xflip
|
|
|
|
ld hl, .facing1
|
2015-12-28 07:57:04 -08:00
|
|
|
jr .loop2
|
|
|
|
|
2015-11-17 14:56:49 -08:00
|
|
|
.xflip
|
|
|
|
ld hl, .facing2
|
2015-12-28 07:57:04 -08:00
|
|
|
.loop2
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, [hli]
|
2018-01-10 10:47:57 -08:00
|
|
|
cp -1
|
2015-11-17 12:54:03 -08:00
|
|
|
ret z
|
|
|
|
add b
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [de], a ; y
|
2015-11-17 12:54:03 -08:00
|
|
|
inc de
|
2015-11-17 14:56:49 -08:00
|
|
|
|
2015-11-17 12:54:03 -08:00
|
|
|
ld a, [hli]
|
|
|
|
add c
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [de], a ; x
|
2015-11-17 12:54:03 -08:00
|
|
|
inc de
|
2015-11-17 14:56:49 -08:00
|
|
|
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, [wTrainerCardBadgeTileID]
|
2021-11-23 17:37:18 -08:00
|
|
|
and ~(1 << 7)
|
2015-11-17 12:54:03 -08:00
|
|
|
add [hl]
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [de], a ; tile id
|
2015-11-17 12:54:03 -08:00
|
|
|
inc hl
|
|
|
|
inc de
|
2015-11-17 14:56:49 -08:00
|
|
|
|
2018-01-11 11:43:18 -08:00
|
|
|
ld a, [wTrainerCardBadgeAttributes]
|
2015-11-17 12:54:03 -08:00
|
|
|
add [hl]
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [de], a ; attributes
|
2015-11-17 12:54:03 -08:00
|
|
|
inc hl
|
|
|
|
inc de
|
2015-12-28 07:57:04 -08:00
|
|
|
jr .loop2
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.facing1
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 0, 0, 0, $00, 0
|
|
|
|
dbsprite 1, 0, 0, 0, $01, 0
|
|
|
|
dbsprite 0, 1, 0, 0, $02, 0
|
|
|
|
dbsprite 1, 1, 0, 0, $03, 0
|
2015-11-17 14:56:49 -08:00
|
|
|
db -1
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.facing2
|
`dsprite y, ypx, x, xpx, off, attr` -> `dbsprite x, y, xpx, ypx, off, attr`
2020-04-04 13:00:30 -07:00
|
|
|
dbsprite 0, 0, 0, 0, $01, 0 | X_FLIP
|
|
|
|
dbsprite 1, 0, 0, 0, $00, 0 | X_FLIP
|
|
|
|
dbsprite 0, 1, 0, 0, $03, 0 | X_FLIP
|
|
|
|
dbsprite 1, 1, 0, 0, $02, 0 | X_FLIP
|
2015-11-17 14:56:49 -08:00
|
|
|
db -1
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
TrainerCard_JohtoBadgesOAM:
|
2015-11-17 12:54:03 -08: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 04:15:46 -08:00
|
|
|
dw wJohtoBadges
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
; Zephyrbadge
|
2015-11-17 14:56:49 -08:00
|
|
|
db $68, $18, 0
|
2018-01-11 11:43:18 -08:00
|
|
|
db $00, $20, $24, $20 | (1 << 7)
|
|
|
|
db $00, $20, $24, $20 | (1 << 7)
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
; Hivebadge
|
2015-11-17 14:56:49 -08:00
|
|
|
db $68, $38, 0
|
2018-01-11 11:43:18 -08:00
|
|
|
db $04, $20, $24, $20 | (1 << 7)
|
|
|
|
db $04, $20, $24, $20 | (1 << 7)
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
; Plainbadge
|
2015-11-17 14:56:49 -08:00
|
|
|
db $68, $58, 0
|
2018-01-11 11:43:18 -08:00
|
|
|
db $08, $20, $24, $20 | (1 << 7)
|
|
|
|
db $08, $20, $24, $20 | (1 << 7)
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
; Fogbadge
|
2015-11-17 14:56:49 -08:00
|
|
|
db $68, $78, 0
|
2018-01-11 11:43:18 -08:00
|
|
|
db $0c, $20, $24, $20 | (1 << 7)
|
|
|
|
db $0c, $20, $24, $20 | (1 << 7)
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
; Mineralbadge
|
2015-11-17 14:56:49 -08:00
|
|
|
db $80, $38, 0
|
2018-01-11 11:43:18 -08:00
|
|
|
db $10, $20, $24, $20 | (1 << 7)
|
|
|
|
db $10, $20, $24, $20 | (1 << 7)
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
; Stormbadge
|
2015-11-17 14:56:49 -08:00
|
|
|
db $80, $18, 0
|
2018-01-11 11:43:18 -08:00
|
|
|
db $14, $20, $24, $20 | (1 << 7)
|
|
|
|
db $14, $20, $24, $20 | (1 << 7)
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
; Glacierbadge
|
2015-11-17 14:56:49 -08:00
|
|
|
db $80, $58, 0
|
2018-01-11 11:43:18 -08:00
|
|
|
db $18, $20, $24, $20 | (1 << 7)
|
|
|
|
db $18, $20, $24, $20 | (1 << 7)
|
2015-11-17 12:54:03 -08:00
|
|
|
|
|
|
|
; Risingbadge
|
|
|
|
; X-flips on alternate cycles.
|
2015-11-17 14:56:49 -08:00
|
|
|
db $80, $78, 0
|
2018-01-11 11:43:18 -08:00
|
|
|
db $1c, $20, $24, $20 | (1 << 7)
|
|
|
|
db $1c | (1 << 7), $20, $24, $20 | (1 << 7)
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2017-12-09 19:57:41 -08:00
|
|
|
CardStatusGFX: INCBIN "gfx/trainer_card/card_status.2bpp"
|
2015-11-17 12:54:03 -08:00
|
|
|
|
2017-12-09 19:57:41 -08: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 12:54:03 -08:00
|
|
|
|
2017-12-09 19:57:41 -08:00
|
|
|
CardRightCornerGFX: INCBIN "gfx/trainer_card/card_right_corner.2bpp"
|