pokecrystal/engine/pokemon/stats_screen.asm

1194 lines
18 KiB
NASM
Raw Normal View History

2018-01-31 16:38:45 +00:00
const_def 1
2018-01-11 17:00:01 +00:00
const PINK_PAGE ; 1
const GREEN_PAGE ; 2
const BLUE_PAGE ; 3
NUM_STAT_PAGES EQU const_value - 1
2018-01-11 17:00:01 +00:00
2020-03-21 17:07:18 +00:00
STAT_PAGE_MASK EQU %00000011
2018-06-24 14:09:41 +00:00
BattleStatsScreenInit:
2015-11-20 04:38:16 +00:00
ld a, [wLinkMode]
cp LINK_MOBILE
jr nz, StatsScreenInit
2015-11-20 04:38:16 +00:00
ld a, [wBattleMode]
2015-11-20 04:38:16 +00:00
and a
jr z, StatsScreenInit
jr _MobileStatsScreenInit
2015-11-20 04:38:16 +00:00
2018-06-24 14:09:41 +00:00
StatsScreenInit:
2015-11-20 04:38:16 +00:00
ld hl, StatsScreenMain
jr StatsScreenInit_gotaddress
2018-06-24 14:09:41 +00:00
_MobileStatsScreenInit:
ld hl, StatsScreenMobile
2015-11-20 04:38:16 +00:00
jr StatsScreenInit_gotaddress
2018-06-24 14:09:41 +00:00
StatsScreenInit_gotaddress:
ldh a, [hMapAnims]
2015-11-20 04:38:16 +00:00
push af
xor a
ldh [hMapAnims], a ; disable overworld tile animations
ld a, [wBoxAlignment] ; whether sprite is to be mirrorred
2015-11-20 04:38:16 +00:00
push af
ld a, [wJumptableIndex]
ld b, a
ld a, [wStatsScreenFlags]
2015-11-20 04:38:16 +00:00
ld c, a
push bc
push hl
call ClearBGPalettes
call ClearTilemap
2015-11-20 04:38:16 +00:00
call UpdateSprites
2017-12-24 17:47:30 +00:00
farcall StatsScreen_LoadFont
2015-11-20 04:38:16 +00:00
pop hl
call _hl_
call ClearBGPalettes
call ClearTilemap
2015-11-20 04:38:16 +00:00
pop bc
; restore old values
ld a, b
ld [wJumptableIndex], a
ld a, c
ld [wStatsScreenFlags], a
2015-11-20 04:38:16 +00:00
pop af
ld [wBoxAlignment], a
2015-11-20 04:38:16 +00:00
pop af
ldh [hMapAnims], a
2015-11-20 04:38:16 +00:00
ret
StatsScreenMain:
2015-11-20 04:38:16 +00:00
xor a
ld [wJumptableIndex], a
; ???
ld [wStatsScreenFlags], a
ld a, [wStatsScreenFlags]
2021-11-24 01:37:18 +00:00
and ~STAT_PAGE_MASK
2020-03-21 17:07:18 +00:00
or PINK_PAGE ; first_page
ld [wStatsScreenFlags], a
2018-06-24 14:09:41 +00:00
.loop
2015-11-20 04:38:16 +00:00
ld a, [wJumptableIndex]
2021-11-24 01:37:18 +00:00
and ~(1 << 7)
2015-11-20 04:38:16 +00:00
ld hl, StatsScreenPointerTable
rst JumpTable
2020-03-21 17:07:18 +00:00
call StatsScreen_WaitAnim
2015-11-20 04:38:16 +00:00
ld a, [wJumptableIndex]
bit 7, a
jr z, .loop
ret
2018-06-24 14:09:41 +00:00
StatsScreenMobile:
2015-11-20 04:38:16 +00:00
xor a
ld [wJumptableIndex], a
; ???
ld [wStatsScreenFlags], a
ld a, [wStatsScreenFlags]
2021-11-24 01:37:18 +00:00
and ~STAT_PAGE_MASK
2020-03-21 17:07:18 +00:00
or PINK_PAGE ; first_page
ld [wStatsScreenFlags], a
2015-11-20 04:38:16 +00:00
.loop
2017-12-24 17:47:30 +00:00
farcall Mobile_SetOverworldDelay
2015-11-20 04:38:16 +00:00
ld a, [wJumptableIndex]
2020-03-21 17:07:18 +00:00
and $7f
2015-11-20 04:38:16 +00:00
ld hl, StatsScreenPointerTable
rst JumpTable
2015-12-23 03:19:33 +00:00
call StatsScreen_WaitAnim
2017-12-24 17:47:30 +00:00
farcall MobileComms_CheckInactivityTimer
2015-11-20 04:38:16 +00:00
jr c, .exit
ld a, [wJumptableIndex]
bit 7, a
jr z, .loop
.exit
ret
2018-06-24 14:09:41 +00:00
StatsScreenPointerTable:
2015-12-27 02:59:03 +00:00
dw MonStatsInit ; regular pokémon
dw EggStatsInit ; egg
dw StatsScreenWaitCry
dw EggStatsJoypad
dw StatsScreen_LoadPage
dw StatsScreenWaitCry
dw MonStatsJoypad
dw StatsScreen_Exit
2015-11-20 04:38:16 +00:00
2018-06-24 14:09:41 +00:00
StatsScreen_WaitAnim:
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
bit 6, [hl]
2015-12-23 03:19:33 +00:00
jr nz, .try_anim
2015-11-20 04:38:16 +00:00
bit 5, [hl]
2015-12-23 03:19:33 +00:00
jr nz, .finish
2015-11-20 04:38:16 +00:00
call DelayFrame
ret
2015-12-23 03:19:33 +00:00
.try_anim
2017-12-24 17:47:30 +00:00
farcall SetUpPokeAnim
2015-12-23 03:19:33 +00:00
jr nc, .finish
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
res 6, [hl]
2015-12-23 03:19:33 +00:00
.finish
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
res 5, [hl]
farcall HDMATransferTilemapToWRAMBank3
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
StatsScreen_SetJumptableIndex:
2015-11-20 04:38:16 +00:00
ld a, [wJumptableIndex]
and $80
or h
ld [wJumptableIndex], a
ret
2018-06-24 14:09:41 +00:00
StatsScreen_Exit:
2015-11-20 04:38:16 +00:00
ld hl, wJumptableIndex
set 7, [hl]
ret
2018-06-24 14:09:41 +00:00
MonStatsInit:
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
res 6, [hl]
call ClearBGPalettes
call ClearTilemap
farcall HDMATransferTilemapToWRAMBank3
2015-12-23 14:12:29 +00:00
call StatsScreen_CopyToTempMon
2018-01-23 22:39:09 +00:00
ld a, [wCurPartySpecies]
2015-11-20 04:38:16 +00:00
cp EGG
2015-12-23 03:19:33 +00:00
jr z, .egg
call StatsScreen_InitUpperHalf
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
set 4, [hl]
2015-12-27 02:59:03 +00:00
ld h, 4
2015-12-23 03:19:33 +00:00
call StatsScreen_SetJumptableIndex
2015-11-20 04:38:16 +00:00
ret
2015-12-23 03:19:33 +00:00
.egg
2015-12-27 02:59:03 +00:00
ld h, 1
2015-12-23 03:19:33 +00:00
call StatsScreen_SetJumptableIndex
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
EggStatsInit:
2015-11-20 04:38:16 +00:00
call EggStatsScreen
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
ret
2018-06-24 14:09:41 +00:00
EggStatsJoypad:
2015-12-23 03:19:33 +00:00
call StatsScreen_GetJoypad
jr nc, .check
2015-12-27 02:59:03 +00:00
ld h, 0
2015-12-23 03:19:33 +00:00
call StatsScreen_SetJumptableIndex
2015-11-20 04:38:16 +00:00
ret
2015-12-23 03:19:33 +00:00
.check
bit A_BUTTON_F, a
jr nz, .quit
if DEF(_DEBUG)
cp START
jr z, .hatch
endc
2015-12-23 03:19:33 +00:00
and D_DOWN | D_UP | A_BUTTON | B_BUTTON
jp StatsScreen_JoypadAction
.quit
2015-12-27 02:59:03 +00:00
ld h, 7
2015-12-23 03:19:33 +00:00
call StatsScreen_SetJumptableIndex
2015-11-20 04:38:16 +00:00
ret
if DEF(_DEBUG)
.hatch
ld a, [wMonType]
or a
jr nz, .skip
push bc
push de
push hl
ld a, [wCurPartyMon]
ld bc, PARTYMON_STRUCT_LENGTH
ld hl, wPartyMon1Happiness
call AddNTimes
ld [hl], 1
ld a, 1
ld [wTempMonHappiness], a
ld a, 127
ld [wStepCount], a
ld de, .HatchSoonString
hlcoord 8, 17
call PlaceString
ld hl, wStatsScreenFlags
set 5, [hl]
pop hl
pop de
pop bc
.skip
xor a
jp StatsScreen_JoypadAction
.HatchSoonString:
db "▶HATCH SOON!@"
endc
2018-06-24 14:09:41 +00:00
StatsScreen_LoadPage:
2015-12-23 03:19:33 +00:00
call StatsScreen_LoadGFX
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
res 4, [hl]
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
ret
2018-06-24 14:09:41 +00:00
MonStatsJoypad:
2015-12-23 03:19:33 +00:00
call StatsScreen_GetJoypad
jr nc, .next
2015-12-27 02:59:03 +00:00
ld h, 0
2015-12-23 03:19:33 +00:00
call StatsScreen_SetJumptableIndex
2015-11-20 04:38:16 +00:00
ret
2015-12-23 03:19:33 +00:00
.next
and D_DOWN | D_UP | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON
jp StatsScreen_JoypadAction
2015-11-20 04:38:16 +00:00
2018-06-24 14:09:41 +00:00
StatsScreenWaitCry:
2015-11-20 04:38:16 +00:00
call IsSFXPlaying
ret nc
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
ret
2018-06-24 14:09:41 +00:00
StatsScreen_CopyToTempMon:
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2016-05-11 21:16:03 +00:00
cp TEMPMON
jr nz, .not_tempmon
ld a, [wBufferMonSpecies]
2018-01-23 22:39:09 +00:00
ld [wCurSpecies], a
2015-11-20 04:38:16 +00:00
call GetBaseData
2015-12-16 17:32:08 +00:00
ld hl, wBufferMon
2018-01-23 22:39:09 +00:00
ld de, wTempMon
2015-11-20 04:38:16 +00:00
ld bc, PARTYMON_STRUCT_LENGTH
call CopyBytes
2015-12-23 14:12:29 +00:00
jr .done
.not_tempmon
farcall CopyMonToTempMon
2018-01-23 22:39:09 +00:00
ld a, [wCurPartySpecies]
2015-11-20 04:38:16 +00:00
cp EGG
2015-12-23 14:12:29 +00:00
jr z, .done
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2015-11-20 04:38:16 +00:00
cp BOXMON
2015-12-23 14:12:29 +00:00
jr c, .done
2017-12-24 17:47:30 +00:00
farcall CalcTempmonStats
2015-12-23 14:12:29 +00:00
.done
2015-11-20 04:38:16 +00:00
and a
ret
2018-06-24 14:09:41 +00:00
StatsScreen_GetJoypad:
2015-11-20 04:38:16 +00:00
call GetJoypad
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2016-05-11 21:16:03 +00:00
cp TEMPMON
jr nz, .not_tempmon
2015-11-20 04:38:16 +00:00
push hl
push de
push bc
2017-12-24 17:47:30 +00:00
farcall StatsScreenDPad
2015-11-20 04:38:16 +00:00
pop bc
pop de
pop hl
2015-12-15 23:59:49 +00:00
ld a, [wMenuJoypad]
2015-12-23 03:19:33 +00:00
and D_DOWN | D_UP
2015-11-20 04:38:16 +00:00
jr nz, .set_carry
2015-12-15 23:59:49 +00:00
ld a, [wMenuJoypad]
jr .clear_carry
2015-11-20 04:38:16 +00:00
.not_tempmon
ldh a, [hJoyPressed]
.clear_carry
2015-11-20 04:38:16 +00:00
and a
ret
.set_carry
scf
ret
2018-06-24 14:09:41 +00:00
StatsScreen_JoypadAction:
2015-11-20 04:38:16 +00:00
push af
ld a, [wStatsScreenFlags]
2018-01-16 22:27:50 +00:00
maskbits NUM_STAT_PAGES
2015-11-20 04:38:16 +00:00
ld c, a
pop af
2015-12-23 03:19:33 +00:00
bit B_BUTTON_F, a
jp nz, .b_button
bit D_LEFT_F, a
jr nz, .d_left
bit D_RIGHT_F, a
jr nz, .d_right
bit A_BUTTON_F, a
jr nz, .a_button
bit D_UP_F, a
jr nz, .d_up
bit D_DOWN_F, a
jr nz, .d_down
jr .done
2015-12-23 14:12:29 +00:00
2015-12-23 03:19:33 +00:00
.d_down
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2015-11-20 04:38:16 +00:00
cp BOXMON
2015-12-23 03:19:33 +00:00
jr nc, .done
2015-11-20 04:38:16 +00:00
and a
2018-01-23 22:39:09 +00:00
ld a, [wPartyCount]
2015-12-23 03:19:33 +00:00
jr z, .next_mon
2018-01-23 22:39:09 +00:00
ld a, [wOTPartyCount]
2015-12-23 03:19:33 +00:00
.next_mon
2015-11-20 04:38:16 +00:00
ld b, a
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
2015-11-20 04:38:16 +00:00
inc a
cp b
2015-12-23 03:19:33 +00:00
jr z, .done
2018-01-23 22:39:09 +00:00
ld [wCurPartyMon], a
2015-11-20 04:38:16 +00:00
ld b, a
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2015-11-20 04:38:16 +00:00
and a
2015-12-23 03:19:33 +00:00
jr nz, .load_mon
2015-11-20 04:38:16 +00:00
ld a, b
inc a
2015-12-23 14:12:29 +00:00
ld [wPartyMenuCursor], a
2015-12-23 03:19:33 +00:00
jr .load_mon
2015-12-23 14:12:29 +00:00
2015-12-23 03:19:33 +00:00
.d_up
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
2015-11-20 04:38:16 +00:00
and a
2015-12-23 03:19:33 +00:00
jr z, .done
2015-11-20 04:38:16 +00:00
dec a
2018-01-23 22:39:09 +00:00
ld [wCurPartyMon], a
2015-11-20 04:38:16 +00:00
ld b, a
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2015-11-20 04:38:16 +00:00
and a
2015-12-23 03:19:33 +00:00
jr nz, .load_mon
2015-11-20 04:38:16 +00:00
ld a, b
inc a
2015-12-23 14:12:29 +00:00
ld [wPartyMenuCursor], a
2015-12-23 03:19:33 +00:00
jr .load_mon
2015-12-23 14:12:29 +00:00
2015-12-23 03:19:33 +00:00
.a_button
2015-11-20 04:38:16 +00:00
ld a, c
2018-01-11 17:00:01 +00:00
cp BLUE_PAGE ; last page
2015-12-23 03:19:33 +00:00
jr z, .b_button
.d_right
2015-11-20 04:38:16 +00:00
inc c
2018-01-11 17:00:01 +00:00
ld a, BLUE_PAGE ; last page
2015-11-20 04:38:16 +00:00
cp c
2015-12-23 03:19:33 +00:00
jr nc, .set_page
2018-01-11 17:00:01 +00:00
ld c, PINK_PAGE ; first page
2015-12-23 03:19:33 +00:00
jr .set_page
2015-12-23 14:12:29 +00:00
2015-12-23 03:19:33 +00:00
.d_left
2015-11-20 04:38:16 +00:00
dec c
2015-12-23 03:19:33 +00:00
jr nz, .set_page
2018-01-11 17:00:01 +00:00
ld c, BLUE_PAGE ; last page
2015-12-23 03:19:33 +00:00
jr .set_page
2015-12-23 14:12:29 +00:00
2015-12-23 03:19:33 +00:00
.done
2015-11-20 04:38:16 +00:00
ret
2015-12-23 03:19:33 +00:00
.set_page
ld a, [wStatsScreenFlags]
2021-11-24 01:37:18 +00:00
and ~STAT_PAGE_MASK
2015-11-20 04:38:16 +00:00
or c
ld [wStatsScreenFlags], a
2015-12-27 02:59:03 +00:00
ld h, 4
2015-12-23 03:19:33 +00:00
call StatsScreen_SetJumptableIndex
2015-11-20 04:38:16 +00:00
ret
2015-12-23 03:19:33 +00:00
.load_mon
2015-12-27 02:59:03 +00:00
ld h, 0
2015-12-23 03:19:33 +00:00
call StatsScreen_SetJumptableIndex
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.b_button
2015-12-27 02:59:03 +00:00
ld h, 7
2015-12-23 03:19:33 +00:00
call StatsScreen_SetJumptableIndex
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
StatsScreen_InitUpperHalf:
2015-12-23 03:19:33 +00:00
call .PlaceHPBar
2015-11-20 04:38:16 +00:00
xor a
ldh [hBGMapMode], a
2018-01-23 22:39:09 +00:00
ld a, [wBaseDexNo]
ld [wTextDecimalByte], a
2018-01-23 22:39:09 +00:00
ld [wCurSpecies], a
2015-11-20 04:38:16 +00:00
hlcoord 8, 0
ld [hl], "№"
inc hl
ld [hl], "."
inc hl
hlcoord 10, 0
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
ld de, wTextDecimalByte
2015-11-20 04:38:16 +00:00
call PrintNum
hlcoord 14, 0
call PrintLevel
2015-12-23 03:19:33 +00:00
ld hl, .NicknamePointers
call GetNicknamenamePointer
2015-12-23 03:19:33 +00:00
call CopyNickname
2015-11-20 04:38:16 +00:00
hlcoord 8, 2
call PlaceString
hlcoord 18, 0
2015-12-23 03:19:33 +00:00
call .PlaceGenderChar
2015-11-20 04:38:16 +00:00
hlcoord 9, 4
ld a, "/"
ld [hli], a
2018-01-23 22:39:09 +00:00
ld a, [wBaseDexNo]
ld [wNamedObjectIndex], a
2015-11-20 04:38:16 +00:00
call GetPokemonName
call PlaceString
2015-12-23 03:19:33 +00:00
call StatsScreen_PlaceHorizontalDivider
call StatsScreen_PlacePageSwitchArrows
call StatsScreen_PlaceShinyIcon
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.PlaceHPBar:
2018-01-23 22:39:09 +00:00
ld hl, wTempMonHP
2015-11-20 04:38:16 +00:00
ld a, [hli]
ld b, a
ld c, [hl]
2018-01-23 22:39:09 +00:00
ld hl, wTempMonMaxHP
2015-11-20 04:38:16 +00:00
ld a, [hli]
ld d, a
ld e, [hl]
farcall ComputeHPBarPixels
2017-12-10 00:41:03 +00:00
ld hl, wCurHPPal
2015-11-20 04:38:16 +00:00
call SetHPPal
2015-12-23 03:19:33 +00:00
ld b, SCGB_STATS_SCREEN_HP_PALS
2015-11-20 04:38:16 +00:00
call GetSGBLayout
call DelayFrame
ret
2018-06-24 14:09:41 +00:00
.PlaceGenderChar:
2015-11-20 04:38:16 +00:00
push hl
farcall GetGender
2015-11-20 04:38:16 +00:00
pop hl
ret c
ld a, "♂"
jr nz, .got_gender
ld a, "♀"
.got_gender
ld [hl], a
ret
2018-06-24 14:09:41 +00:00
.NicknamePointers:
2018-01-23 22:39:09 +00:00
dw wPartyMonNicknames
dw wOTPartyMonNicknames
2015-11-20 04:38:16 +00:00
dw sBoxMonNicknames
dw wBufferMonNickname
2015-11-20 04:38:16 +00:00
2020-10-05 20:15:57 +00:00
StatsScreen_PlaceVerticalDivider: ; unreferenced
; The Japanese stats screen has a vertical divider.
2015-11-20 04:38:16 +00:00
hlcoord 7, 0
ld bc, SCREEN_WIDTH
ld d, SCREEN_HEIGHT
.loop
ld a, $31 ; vertical divider
2015-11-20 04:38:16 +00:00
ld [hl], a
add hl, bc
dec d
jr nz, .loop
ret
2018-06-24 14:09:41 +00:00
StatsScreen_PlaceHorizontalDivider:
2015-11-20 04:38:16 +00:00
hlcoord 0, 7
ld b, SCREEN_WIDTH
ld a, $62 ; horizontal divider (empty HP/exp bar)
2015-11-20 04:38:16 +00:00
.loop
ld [hli], a
dec b
jr nz, .loop
ret
2018-06-24 14:09:41 +00:00
StatsScreen_PlacePageSwitchArrows:
2015-11-20 04:38:16 +00:00
hlcoord 12, 6
ld [hl], "◀"
hlcoord 19, 6
ld [hl], "▶"
ret
2018-06-24 14:09:41 +00:00
StatsScreen_PlaceShinyIcon:
2018-01-23 22:39:09 +00:00
ld bc, wTempMonDVs
2017-12-24 17:47:30 +00:00
farcall CheckShininess
2015-11-20 04:38:16 +00:00
ret nc
hlcoord 19, 0
2018-01-19 07:30:19 +00:00
ld [hl], "⁂"
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
StatsScreen_LoadGFX:
2018-01-23 22:39:09 +00:00
ld a, [wBaseDexNo]
ld [wTempSpecies], a
2018-01-23 22:39:09 +00:00
ld [wCurSpecies], a
2015-11-20 04:38:16 +00:00
xor a
ldh [hBGMapMode], a
2015-12-23 03:19:33 +00:00
call .ClearBox
call .PageTilemap
call .LoadPals
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
bit 4, [hl]
2015-12-21 19:10:16 +00:00
jr nz, .place_frontpic
2015-11-20 04:38:16 +00:00
call SetPalettes
ret
2015-12-21 19:10:16 +00:00
.place_frontpic
call StatsScreen_PlaceFrontpic
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.ClearBox:
ld a, [wStatsScreenFlags]
2018-01-16 22:27:50 +00:00
maskbits NUM_STAT_PAGES
2015-11-20 04:38:16 +00:00
ld c, a
2015-12-23 14:12:29 +00:00
call StatsScreen_LoadPageIndicators
2015-11-20 04:38:16 +00:00
hlcoord 0, 8
lb bc, 10, 20
call ClearBox
ret
2018-06-24 14:09:41 +00:00
.LoadPals:
ld a, [wStatsScreenFlags]
2018-01-16 22:27:50 +00:00
maskbits NUM_STAT_PAGES
2015-11-20 04:38:16 +00:00
ld c, a
2017-12-24 17:47:30 +00:00
farcall LoadStatsScreenPals
2015-11-20 04:38:16 +00:00
call DelayFrame
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
set 5, [hl]
ret
2018-06-24 14:09:41 +00:00
.PageTilemap:
ld a, [wStatsScreenFlags]
2018-01-16 22:27:50 +00:00
maskbits NUM_STAT_PAGES
2015-11-20 04:38:16 +00:00
dec a
2015-12-21 19:10:16 +00:00
ld hl, .Jumptable
2015-11-20 04:38:16 +00:00
rst JumpTable
ret
2018-06-24 14:09:41 +00:00
.Jumptable:
2018-01-11 17:00:01 +00:00
; entries correspond to *_PAGE constants
2021-10-24 22:25:44 +00:00
table_width 2, StatsScreen_LoadGFX.Jumptable
dw LoadPinkPage
dw LoadGreenPage
dw LoadBluePage
2021-10-24 22:25:44 +00:00
assert_table_length NUM_STAT_PAGES
2015-11-20 04:38:16 +00:00
LoadPinkPage:
2015-11-20 04:38:16 +00:00
hlcoord 0, 9
ld b, $0
predef DrawPlayerHP
2015-11-20 04:38:16 +00:00
hlcoord 8, 9
ld [hl], $41 ; right HP/exp bar end cap
2015-12-21 19:10:16 +00:00
ld de, .Status_Type
2015-11-20 04:38:16 +00:00
hlcoord 0, 12
call PlaceString
2018-01-23 22:39:09 +00:00
ld a, [wTempMonPokerusStatus]
2015-11-20 04:38:16 +00:00
ld b, a
and $f
2015-12-21 19:10:16 +00:00
jr nz, .HasPokerus
2015-11-20 04:38:16 +00:00
ld a, b
and $f0
2015-12-21 19:10:16 +00:00
jr z, .NotImmuneToPkrs
2015-11-20 04:38:16 +00:00
hlcoord 8, 8
ld [hl], "." ; Pokérus immunity dot
.NotImmuneToPkrs:
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2015-12-21 19:10:16 +00:00
cp BOXMON
jr z, .StatusOK
2015-11-20 04:38:16 +00:00
hlcoord 6, 13
push hl
2018-01-23 22:39:09 +00:00
ld de, wTempMonStatus
predef PlaceStatusString
2015-11-20 04:38:16 +00:00
pop hl
2015-12-21 19:10:16 +00:00
jr nz, .done_status
jr .StatusOK
.HasPokerus:
2015-12-21 19:10:16 +00:00
ld de, .PkrsStr
2015-11-20 04:38:16 +00:00
hlcoord 1, 13
call PlaceString
2015-12-21 19:10:16 +00:00
jr .done_status
.StatusOK:
2015-12-21 19:10:16 +00:00
ld de, .OK_str
2015-11-20 04:38:16 +00:00
call PlaceString
2015-12-21 19:10:16 +00:00
.done_status
2015-11-20 04:38:16 +00:00
hlcoord 1, 15
predef PrintMonTypes
2015-11-20 04:38:16 +00:00
hlcoord 9, 8
2015-12-21 19:10:16 +00:00
ld de, SCREEN_WIDTH
ld b, 10
ld a, $31 ; vertical divider
2015-12-21 19:10:16 +00:00
.vertical_divider
2015-11-20 04:38:16 +00:00
ld [hl], a
add hl, de
dec b
2015-12-21 19:10:16 +00:00
jr nz, .vertical_divider
ld de, .ExpPointStr
2015-11-20 04:38:16 +00:00
hlcoord 10, 9
call PlaceString
hlcoord 17, 14
2015-12-21 19:10:16 +00:00
call .PrintNextLevel
2015-11-20 04:38:16 +00:00
hlcoord 13, 10
lb bc, 3, 7
2018-01-23 22:39:09 +00:00
ld de, wTempMonExp
2015-11-20 04:38:16 +00:00
call PrintNum
2015-12-21 19:10:16 +00:00
call .CalcExpToNextLevel
2015-11-20 04:38:16 +00:00
hlcoord 13, 13
lb bc, 3, 7
2020-11-04 00:53:07 +00:00
ld de, wExpToNextLevel
2015-11-20 04:38:16 +00:00
call PrintNum
2015-12-21 19:10:16 +00:00
ld de, .LevelUpStr
2015-11-20 04:38:16 +00:00
hlcoord 10, 12
call PlaceString
2015-12-21 19:10:16 +00:00
ld de, .ToStr
2015-11-20 04:38:16 +00:00
hlcoord 14, 14
call PlaceString
hlcoord 11, 16
2018-01-23 22:39:09 +00:00
ld a, [wTempMonLevel]
2015-11-20 04:38:16 +00:00
ld b, a
2018-01-23 22:39:09 +00:00
ld de, wTempMonExp + 2
predef FillInExpBar
2015-11-20 04:38:16 +00:00
hlcoord 10, 16
ld [hl], $40 ; left exp bar end cap
2015-11-20 04:38:16 +00:00
hlcoord 19, 16
ld [hl], $41 ; right exp bar end cap
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.PrintNextLevel:
2018-01-23 22:39:09 +00:00
ld a, [wTempMonLevel]
2015-11-20 04:38:16 +00:00
push af
cp MAX_LEVEL
2015-12-21 19:10:16 +00:00
jr z, .AtMaxLevel
2015-11-20 04:38:16 +00:00
inc a
2018-01-23 22:39:09 +00:00
ld [wTempMonLevel], a
.AtMaxLevel:
2015-11-20 04:38:16 +00:00
call PrintLevel
pop af
2018-01-23 22:39:09 +00:00
ld [wTempMonLevel], a
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.CalcExpToNextLevel:
2018-01-23 22:39:09 +00:00
ld a, [wTempMonLevel]
2015-11-20 04:38:16 +00:00
cp MAX_LEVEL
2015-12-21 19:10:16 +00:00
jr z, .AlreadyAtMaxLevel
2015-11-20 04:38:16 +00:00
inc a
ld d, a
2017-12-24 17:47:30 +00:00
farcall CalcExpAtLevel
2018-01-23 22:39:09 +00:00
ld hl, wTempMonExp + 2
ld hl, wTempMonExp + 2
ldh a, [hQuotient + 3]
2015-11-20 04:38:16 +00:00
sub [hl]
dec hl
2020-11-04 00:53:07 +00:00
ld [wExpToNextLevel + 2], a
ldh a, [hQuotient + 2]
2015-11-20 04:38:16 +00:00
sbc [hl]
dec hl
2020-11-04 00:53:07 +00:00
ld [wExpToNextLevel + 1], a
ldh a, [hQuotient + 1]
2015-11-20 04:38:16 +00:00
sbc [hl]
2020-11-04 00:53:07 +00:00
ld [wExpToNextLevel], a
2015-11-20 04:38:16 +00:00
ret
2015-12-21 19:10:16 +00:00
.AlreadyAtMaxLevel:
2020-11-04 00:53:07 +00:00
ld hl, wExpToNextLevel
2015-11-20 04:38:16 +00:00
xor a
ld [hli], a
ld [hli], a
2015-11-20 04:38:16 +00:00
ld [hl], a
ret
2018-06-24 14:09:41 +00:00
.Status_Type:
2015-11-20 04:38:16 +00:00
db "STATUS/"
next "TYPE/@"
2018-06-24 14:09:41 +00:00
.OK_str:
2015-11-20 04:38:16 +00:00
db "OK @"
2018-06-24 14:09:41 +00:00
.ExpPointStr:
2015-11-20 04:38:16 +00:00
db "EXP POINTS@"
2018-06-24 14:09:41 +00:00
.LevelUpStr:
2015-11-20 04:38:16 +00:00
db "LEVEL UP@"
2018-06-24 14:09:41 +00:00
.ToStr:
2015-11-20 04:38:16 +00:00
db "TO@"
2018-06-24 14:09:41 +00:00
.PkrsStr:
2015-11-20 04:38:16 +00:00
db "#RUS@"
LoadGreenPage:
2015-12-21 19:10:16 +00:00
ld de, .Item
2015-11-20 04:38:16 +00:00
hlcoord 0, 8
call PlaceString
2015-12-21 19:10:16 +00:00
call .GetItemName
2015-11-20 04:38:16 +00:00
hlcoord 8, 8
call PlaceString
2015-12-21 19:10:16 +00:00
ld de, .Move
2015-11-20 04:38:16 +00:00
hlcoord 0, 10
call PlaceString
2018-01-23 22:39:09 +00:00
ld hl, wTempMonMoves
2015-11-20 04:38:16 +00:00
ld de, wListMoves_MoveIndicesBuffer
ld bc, NUM_MOVES
call CopyBytes
hlcoord 8, 10
ld a, SCREEN_WIDTH * 2
2020-11-04 00:53:07 +00:00
ld [wListMovesLineSpacing], a
predef ListMoves
2015-11-20 04:38:16 +00:00
hlcoord 12, 11
2015-12-21 19:10:16 +00:00
ld a, SCREEN_WIDTH * 2
2020-11-04 00:53:07 +00:00
ld [wListMovesLineSpacing], a
predef ListMovePP
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.GetItemName:
2015-12-21 19:10:16 +00:00
ld de, .ThreeDashes
2018-01-23 22:39:09 +00:00
ld a, [wTempMonItem]
2015-11-20 04:38:16 +00:00
and a
ret z
ld b, a
2017-12-24 17:47:30 +00:00
farcall TimeCapsule_ReplaceTeruSama
2015-11-20 04:38:16 +00:00
ld a, b
ld [wNamedObjectIndex], a
2015-11-20 04:38:16 +00:00
call GetItemName
ret
2018-06-24 14:09:41 +00:00
.Item:
2015-11-20 04:38:16 +00:00
db "ITEM@"
2018-06-24 14:09:41 +00:00
.ThreeDashes:
2015-11-20 04:38:16 +00:00
db "---@"
2018-06-24 14:09:41 +00:00
.Move:
2015-11-20 04:38:16 +00:00
db "MOVE@"
LoadBluePage:
2015-12-21 19:10:16 +00:00
call .PlaceOTInfo
2015-11-20 04:38:16 +00:00
hlcoord 10, 8
2015-12-21 19:10:16 +00:00
ld de, SCREEN_WIDTH
ld b, 10
ld a, $31 ; vertical divider
.vertical_divider
2015-11-20 04:38:16 +00:00
ld [hl], a
add hl, de
dec b
jr nz, .vertical_divider
2015-11-20 04:38:16 +00:00
hlcoord 11, 8
2015-12-21 19:10:16 +00:00
ld bc, 6
predef PrintTempMonStats
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.PlaceOTInfo:
2015-11-20 04:38:16 +00:00
ld de, IDNoString
hlcoord 0, 9
call PlaceString
ld de, OTString
hlcoord 0, 12
call PlaceString
hlcoord 2, 10
lb bc, PRINTNUM_LEADINGZEROS | 2, 5
2018-01-23 22:39:09 +00:00
ld de, wTempMonID
2015-11-20 04:38:16 +00:00
call PrintNum
2015-12-21 19:10:16 +00:00
ld hl, .OTNamePointers
call GetNicknamenamePointer
2015-12-23 03:19:33 +00:00
call CopyNickname
farcall CorrectNickErrors
2015-11-20 04:38:16 +00:00
hlcoord 2, 13
call PlaceString
2018-01-23 22:39:09 +00:00
ld a, [wTempMonCaughtGender]
2015-11-20 04:38:16 +00:00
and a
2015-12-21 19:10:16 +00:00
jr z, .done
2015-11-20 04:38:16 +00:00
cp $7f
2015-12-21 19:10:16 +00:00
jr z, .done
2020-03-21 17:07:18 +00:00
and CAUGHT_GENDER_MASK
2015-11-20 04:38:16 +00:00
ld a, "♂"
2015-12-21 19:10:16 +00:00
jr z, .got_gender
2015-11-20 04:38:16 +00:00
ld a, "♀"
2015-12-21 19:10:16 +00:00
.got_gender
2015-11-20 04:38:16 +00:00
hlcoord 9, 13
ld [hl], a
2015-12-21 19:10:16 +00:00
.done
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.OTNamePointers:
dw wPartyMonOTs
dw wOTPartyMonOTs
dw sBoxMonOTs
2015-12-21 19:10:16 +00:00
dw wBufferMonOT
2015-11-20 04:38:16 +00:00
2018-06-24 14:09:41 +00:00
IDNoString:
2015-12-21 19:10:16 +00:00
db "<ID>№.@"
2015-11-20 04:38:16 +00:00
2018-06-24 14:09:41 +00:00
OTString:
2015-11-20 04:38:16 +00:00
db "OT/@"
2018-06-24 14:09:41 +00:00
StatsScreen_PlaceFrontpic:
2018-01-23 22:39:09 +00:00
ld hl, wTempMonDVs
predef GetUnownLetter
2015-12-21 19:10:16 +00:00
call StatsScreen_GetAnimationParam
jr c, .egg
2015-11-20 04:38:16 +00:00
and a
2015-12-21 19:10:16 +00:00
jr z, .no_cry
jr .cry
.egg
2015-12-23 14:12:29 +00:00
call .AnimateEgg
2015-11-20 04:38:16 +00:00
call SetPalettes
ret
2015-12-21 19:10:16 +00:00
.no_cry
2015-12-23 14:12:29 +00:00
call .AnimateMon
2015-11-20 04:38:16 +00:00
call SetPalettes
ret
2015-12-21 19:10:16 +00:00
.cry
2015-11-20 04:38:16 +00:00
call SetPalettes
2015-12-23 14:12:29 +00:00
call .AnimateMon
2018-01-23 22:39:09 +00:00
ld a, [wCurPartySpecies]
call PlayMonCry2
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.AnimateMon:
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
set 5, [hl]
2018-01-23 22:39:09 +00:00
ld a, [wCurPartySpecies]
2015-11-20 04:38:16 +00:00
cp UNOWN
2015-12-21 19:10:16 +00:00
jr z, .unown
2015-11-20 04:38:16 +00:00
hlcoord 0, 0
call PrepMonFrontpic
ret
2015-12-21 19:10:16 +00:00
.unown
2015-11-20 04:38:16 +00:00
xor a
ld [wBoxAlignment], a
2015-11-20 04:38:16 +00:00
hlcoord 0, 0
call _PrepMonFrontpic
ret
2018-06-24 14:09:41 +00:00
.AnimateEgg:
2018-01-23 22:39:09 +00:00
ld a, [wCurPartySpecies]
2015-11-20 04:38:16 +00:00
cp UNOWN
2015-12-23 14:12:29 +00:00
jr z, .unownegg
ld a, TRUE
ld [wBoxAlignment], a
2015-12-23 14:12:29 +00:00
call .get_animation
2015-11-20 04:38:16 +00:00
ret
2015-12-21 19:10:16 +00:00
2015-12-23 14:12:29 +00:00
.unownegg
2015-11-20 04:38:16 +00:00
xor a
ld [wBoxAlignment], a
2015-12-23 14:12:29 +00:00
call .get_animation
2015-11-20 04:38:16 +00:00
ret
2018-06-24 14:09:41 +00:00
.get_animation
2018-01-23 22:39:09 +00:00
ld a, [wCurPartySpecies]
2015-11-20 04:38:16 +00:00
call IsAPokemon
ret c
2019-04-08 12:15:10 +00:00
call StatsScreen_LoadTextboxSpaceGFX
2017-12-28 12:32:33 +00:00
ld de, vTiles2 tile $00
predef GetAnimatedFrontpic
2015-11-20 04:38:16 +00:00
hlcoord 0, 0
ld d, $0
ld e, ANIM_MON_MENU
predef LoadMonAnimation
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
set 6, [hl]
ret
2018-06-24 14:09:41 +00:00
StatsScreen_GetAnimationParam:
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2015-11-20 04:38:16 +00:00
ld hl, .Jumptable
rst JumpTable
ret
2018-06-24 14:09:41 +00:00
.Jumptable:
2015-12-21 19:10:16 +00:00
dw .PartyMon
dw .OTPartyMon
dw .BoxMon
dw .Tempmon
dw .Wildmon
2015-11-20 04:38:16 +00:00
2018-06-24 14:09:41 +00:00
.PartyMon:
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
ld hl, wPartyMon1
2015-11-20 04:38:16 +00:00
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld b, h
ld c, l
2015-12-21 19:10:16 +00:00
jr .CheckEggFaintedFrzSlp
2015-11-20 04:38:16 +00:00
2018-06-24 14:09:41 +00:00
.OTPartyMon:
2015-11-20 04:38:16 +00:00
xor a
ret
2018-06-24 14:09:41 +00:00
.BoxMon:
2015-11-20 04:38:16 +00:00
ld hl, sBoxMons
ld bc, PARTYMON_STRUCT_LENGTH
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
2015-11-20 04:38:16 +00:00
call AddNTimes
ld b, h
ld c, l
ld a, BANK(sBoxMons)
call OpenSRAM
2015-12-21 19:10:16 +00:00
call .CheckEggFaintedFrzSlp
2015-11-20 04:38:16 +00:00
push af
call CloseSRAM
pop af
ret
2018-06-24 14:09:41 +00:00
.Tempmon:
2018-01-23 22:39:09 +00:00
ld bc, wTempMonSpecies
2015-12-21 19:10:16 +00:00
jr .CheckEggFaintedFrzSlp ; utterly pointless
2015-11-20 04:38:16 +00:00
2018-06-24 14:09:41 +00:00
.CheckEggFaintedFrzSlp:
2018-01-23 22:39:09 +00:00
ld a, [wCurPartySpecies]
2015-11-20 04:38:16 +00:00
cp EGG
jr z, .egg
call CheckFaintedFrzSlp
2015-12-21 19:10:16 +00:00
jr c, .FaintedFrzSlp
2015-11-20 04:38:16 +00:00
.egg
xor a
scf
ret
2018-06-24 14:09:41 +00:00
.Wildmon:
2015-11-20 04:38:16 +00:00
ld a, $1
and a
ret
2015-12-21 19:10:16 +00:00
2018-06-24 14:09:41 +00:00
.FaintedFrzSlp:
2015-11-20 04:38:16 +00:00
xor a
ret
2019-04-08 12:15:10 +00:00
StatsScreen_LoadTextboxSpaceGFX:
2015-11-20 04:38:16 +00:00
nop
push hl
push de
push bc
push af
call DelayFrame
ldh a, [rVBK]
2015-11-20 04:38:16 +00:00
push af
ld a, $1
ldh [rVBK], a
2019-04-08 12:15:10 +00:00
ld de, TextboxSpaceGFX
lb bc, BANK(TextboxSpaceGFX), 1
2018-01-13 20:22:16 +00:00
ld hl, vTiles2 tile " "
2015-11-20 04:38:16 +00:00
call Get2bpp
pop af
ldh [rVBK], a
2015-11-20 04:38:16 +00:00
pop af
pop bc
pop de
pop hl
ret
StatsScreenSpaceGFX: ; unreferenced
2020-02-27 19:33:30 +00:00
INCBIN "gfx/font/space.2bpp"
2015-11-20 04:38:16 +00:00
2018-06-24 14:09:41 +00:00
EggStatsScreen:
2015-11-20 04:38:16 +00:00
xor a
ldh [hBGMapMode], a
2017-12-10 00:41:03 +00:00
ld hl, wCurHPPal
2015-11-20 04:38:16 +00:00
call SetHPPal
2015-12-23 03:19:33 +00:00
ld b, SCGB_STATS_SCREEN_HP_PALS
2015-11-20 04:38:16 +00:00
call GetSGBLayout
2015-12-23 03:19:33 +00:00
call StatsScreen_PlaceHorizontalDivider
2015-11-20 04:38:16 +00:00
ld de, EggString
hlcoord 8, 1
call PlaceString
ld de, IDNoString
hlcoord 8, 3
call PlaceString
ld de, OTString
hlcoord 8, 5
call PlaceString
ld de, FiveQMarkString
hlcoord 11, 3
call PlaceString
ld de, FiveQMarkString
hlcoord 11, 5
call PlaceString
if DEF(_DEBUG)
ld de, .PushStartString
hlcoord 8, 17
call PlaceString
jr .placed_push_start
.PushStartString:
db "▶PUSH START.@"
.placed_push_start
endc
2018-01-23 22:39:09 +00:00
ld a, [wTempMonHappiness] ; egg status
2015-11-20 04:38:16 +00:00
ld de, EggSoonString
cp $6
jr c, .picked
ld de, EggCloseString
cp $b
jr c, .picked
ld de, EggMoreTimeString
cp $29
jr c, .picked
ld de, EggALotMoreTimeString
.picked
hlcoord 1, 9
call PlaceString
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
set 5, [hl]
call SetPalettes ; pals
call DelayFrame
hlcoord 0, 0
call PrepMonFrontpic
farcall HDMATransferTilemapToWRAMBank3
2015-12-21 19:10:16 +00:00
call StatsScreen_AnimateEgg
2015-11-20 04:38:16 +00:00
2018-01-23 22:39:09 +00:00
ld a, [wTempMonHappiness]
2015-11-20 04:38:16 +00:00
cp 6
ret nc
ld de, SFX_2_BOOPS
call PlaySFX
ret
2018-06-24 14:09:41 +00:00
EggString:
2015-11-20 04:38:16 +00:00
db "EGG@"
2018-06-24 14:09:41 +00:00
FiveQMarkString:
2015-11-20 04:38:16 +00:00
db "?????@"
EggSoonString:
2015-11-20 04:38:16 +00:00
db "It's making sounds"
next "inside. It's going"
next "to hatch soon!@"
EggCloseString:
2015-11-20 04:38:16 +00:00
db "It moves around"
next "inside sometimes."
next "It must be close"
next "to hatching.@"
EggMoreTimeString:
2015-11-20 04:38:16 +00:00
db "Wonder what's"
next "inside? It needs"
next "more time, though.@"
EggALotMoreTimeString:
2015-11-20 04:38:16 +00:00
db "This EGG needs a"
next "lot more time to"
next "hatch.@"
2018-06-24 14:09:41 +00:00
StatsScreen_AnimateEgg:
2015-12-21 19:10:16 +00:00
call StatsScreen_GetAnimationParam
2015-11-20 04:38:16 +00:00
ret nc
2018-01-23 22:39:09 +00:00
ld a, [wTempMonHappiness]
2015-11-20 04:38:16 +00:00
ld e, $7
2015-12-21 19:10:16 +00:00
cp 6
jr c, .animate
2015-11-20 04:38:16 +00:00
ld e, $8
2015-12-21 19:10:16 +00:00
cp 11
jr c, .animate
2015-11-20 04:38:16 +00:00
ret
2015-12-21 19:10:16 +00:00
.animate
2015-11-20 04:38:16 +00:00
push de
ld a, $1
ld [wBoxAlignment], a
2019-04-08 12:15:10 +00:00
call StatsScreen_LoadTextboxSpaceGFX
2017-12-28 12:32:33 +00:00
ld de, vTiles2 tile $00
predef GetAnimatedFrontpic
2015-11-20 04:38:16 +00:00
pop de
hlcoord 0, 0
ld d, $0
predef LoadMonAnimation
ld hl, wStatsScreenFlags
2015-11-20 04:38:16 +00:00
set 6, [hl]
ret
2018-06-24 14:09:41 +00:00
StatsScreen_LoadPageIndicators:
2015-11-20 04:38:16 +00:00
hlcoord 13, 5
ld a, $36 ; first of 4 small square tiles
2015-11-20 04:38:16 +00:00
call .load_square
hlcoord 15, 5
2018-01-19 02:15:59 +00:00
ld a, $36 ; " " " "
2015-11-20 04:38:16 +00:00
call .load_square
hlcoord 17, 5
2018-01-19 02:15:59 +00:00
ld a, $36 ; " " " "
2015-11-20 04:38:16 +00:00
call .load_square
ld a, c
2018-01-11 17:00:01 +00:00
cp GREEN_PAGE
ld a, $3a ; first of 4 large square tiles
2018-01-11 17:00:01 +00:00
hlcoord 13, 5 ; PINK_PAGE (< GREEN_PAGE)
2015-11-20 04:38:16 +00:00
jr c, .load_square
2018-01-11 17:00:01 +00:00
hlcoord 15, 5 ; GREEN_PAGE (= GREEN_PAGE)
2015-11-20 04:38:16 +00:00
jr z, .load_square
2018-01-11 17:00:01 +00:00
hlcoord 17, 5 ; BLUE_PAGE (> GREEN_PAGE)
2018-06-24 14:09:41 +00:00
.load_square
2015-11-20 04:38:16 +00:00
push bc
ld [hli], a
inc a
ld [hld], a
ld bc, SCREEN_WIDTH
add hl, bc
inc a
ld [hli], a
inc a
ld [hl], a
pop bc
ret
2018-06-24 14:09:41 +00:00
CopyNickname:
2018-01-23 22:39:09 +00:00
ld de, wStringBuffer1
2018-01-20 17:25:55 +00:00
ld bc, MON_NAME_LENGTH
jr .okay ; utterly pointless
2015-11-20 04:38:16 +00:00
.okay
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2015-11-20 04:38:16 +00:00
cp BOXMON
jr nz, .partymon
ld a, BANK(sBoxMonNicknames)
call OpenSRAM
2015-11-20 04:38:16 +00:00
push de
call CopyBytes
pop de
call CloseSRAM
ret
.partymon
push de
call CopyBytes
pop de
ret
GetNicknamenamePointer:
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2015-11-20 04:38:16 +00:00
add a
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
2018-01-23 22:39:09 +00:00
ld a, [wMonType]
2016-05-11 21:16:03 +00:00
cp TEMPMON
2015-11-20 04:38:16 +00:00
ret z
2018-01-23 22:39:09 +00:00
ld a, [wCurPartyMon]
2015-11-20 04:38:16 +00:00
jp SkipNames
2018-06-24 14:09:41 +00:00
CheckFaintedFrzSlp:
2015-11-20 04:38:16 +00:00
ld hl, MON_HP
add hl, bc
ld a, [hli]
or [hl]
jr z, .fainted_frz_slp
ld hl, MON_STATUS
add hl, bc
ld a, [hl]
2018-01-09 22:20:47 +00:00
and 1 << FRZ | SLP
2015-11-20 04:38:16 +00:00
jr nz, .fainted_frz_slp
and a
ret
.fainted_frz_slp
scf
ret