pokecrystal/engine/stats_screen.asm

1171 lines
18 KiB
NASM
Raw Normal View History

2015-12-23 14:12:29 +00:00
BattleStatsScreenInit: ; 4dc7b (13:5c7b)
2015-11-20 04:38:16 +00:00
ld a, [wLinkMode]
cp LINK_MOBILE
jr nz, StatsScreenInit
ld a, [wBattleMode] ; wd22d (aliases: EnemyMonEnd)
and a
jr z, StatsScreenInit
jr _MobileStatsScreenInit
2015-11-20 04:38:16 +00:00
StatsScreenInit: ; 4dc8a
ld hl, StatsScreenMain
jr StatsScreenInit_gotaddress
_MobileStatsScreenInit: ; 4dc8f
ld hl, StatsScreenMobile
2015-11-20 04:38:16 +00:00
jr StatsScreenInit_gotaddress
StatsScreenInit_gotaddress: ; 4dc94
ld a, [hMapAnims]
push af
xor a
ld [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, [wcf64]
ld c, a
push bc
push hl
call ClearBGPalettes
call ClearTileMap
call UpdateSprites
callba StatsScreen_LoadFont
2015-11-20 04:38:16 +00:00
pop hl
call _hl_
call ClearBGPalettes
call ClearTileMap
pop bc
; restore old values
ld a, b
ld [wJumptableIndex], a
ld a, c
ld [wcf64], a
pop af
ld [wBoxAlignment], a
2015-11-20 04:38:16 +00:00
pop af
ld [hMapAnims], a
ret
; 0x4dcd2
StatsScreenMain: ; 0x4dcd2
xor a
ld [wJumptableIndex], a
; stupid interns
ld [wcf64], a
ld a, [wcf64]
and $fc
or $1
ld [wcf64], a
.loop ; 4dce3
ld a, [wJumptableIndex]
and $7f
ld hl, StatsScreenPointerTable
rst JumpTable
2015-12-23 03:19:33 +00:00
call StatsScreen_WaitAnim ; check for keys?
2015-11-20 04:38:16 +00:00
ld a, [wJumptableIndex]
bit 7, a
jr z, .loop
ret
; 0x4dcf7
StatsScreenMobile: ; 4dcf7
2015-11-20 04:38:16 +00:00
xor a
ld [wJumptableIndex], a
; stupid interns
ld [wcf64], a
ld a, [wcf64]
and $fc
or $1
ld [wcf64], a
.loop
2015-12-28 15:57:04 +00:00
callba Mobile_SetOverworldDelay
2015-11-20 04:38:16 +00:00
ld a, [wJumptableIndex]
and $7f
ld hl, StatsScreenPointerTable
rst JumpTable
2015-12-23 03:19:33 +00:00
call StatsScreen_WaitAnim
callba MobileComms_CheckInactivityTimer
2015-11-20 04:38:16 +00:00
jr c, .exit
ld a, [wJumptableIndex]
bit 7, a
jr z, .loop
.exit
ret
; 4dd2a
StatsScreenPointerTable: ; 4dd2a
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
; 4dd3a
2015-12-23 03:19:33 +00:00
StatsScreen_WaitAnim: ; 4dd3a (13:5d3a)
2015-11-20 04:38:16 +00:00
ld hl, wcf64
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
callba SetUpPokeAnim
2015-12-23 03:19:33 +00:00
jr nc, .finish
2015-11-20 04:38:16 +00:00
ld hl, wcf64
res 6, [hl]
2015-12-23 03:19:33 +00:00
.finish
2015-11-20 04:38:16 +00:00
ld hl, wcf64
res 5, [hl]
2016-05-05 02:34:09 +00:00
callba HDMATransferTileMapToWRAMBank3
2015-11-20 04:38:16 +00:00
ret
2015-12-23 03:19:33 +00:00
StatsScreen_SetJumptableIndex: ; 4dd62 (13:5d62)
2015-11-20 04:38:16 +00:00
ld a, [wJumptableIndex]
and $80
or h
ld [wJumptableIndex], a
ret
2015-12-23 03:19:33 +00:00
StatsScreen_Exit: ; 4dd6c (13:5d6c)
2015-11-20 04:38:16 +00:00
ld hl, wJumptableIndex
set 7, [hl]
ret
MonStatsInit: ; 4dd72 (13:5d72)
ld hl, wcf64
res 6, [hl]
call ClearBGPalettes
call ClearTileMap
2016-05-05 02:34:09 +00:00
callba HDMATransferTileMapToWRAMBank3
2015-12-23 14:12:29 +00:00
call StatsScreen_CopyToTempMon
2015-11-20 04:38:16 +00:00
ld a, [CurPartySpecies]
cp EGG
2015-12-23 03:19:33 +00:00
jr z, .egg
call StatsScreen_InitUpperHalf
2015-11-20 04:38:16 +00:00
ld hl, wcf64
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
EggStatsInit: ; 4dda1
call EggStatsScreen
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
ret
; 0x4ddac
2015-12-23 03:19:33 +00:00
EggStatsJoypad: ; 4ddac (13:5dac)
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
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
2015-12-23 03:19:33 +00:00
StatsScreen_LoadPage: ; 4ddc6 (13:5dc6)
call StatsScreen_LoadGFX
2015-11-20 04:38:16 +00:00
ld hl, wcf64
res 4, [hl]
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
ret
2015-12-23 03:19:33 +00:00
MonStatsJoypad: ; 4ddd6 (13:5dd6)
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
StatsScreenWaitCry: ; 4dde6 (13:5de6)
call IsSFXPlaying
ret nc
ld a, [wJumptableIndex]
inc a
ld [wJumptableIndex], a
ret
2015-12-23 14:12:29 +00:00
StatsScreen_CopyToTempMon: ; 4ddf2 (13:5df2)
2015-11-20 04:38:16 +00:00
ld a, [MonType]
cp BREEDMON
2015-12-23 14:12:29 +00:00
jr nz, .breedmon
2015-12-16 17:32:08 +00:00
ld a, [wBufferMon]
2015-11-20 04:38:16 +00:00
ld [CurSpecies], a
call GetBaseData
2015-12-16 17:32:08 +00:00
ld hl, wBufferMon
2015-11-20 04:38:16 +00:00
ld de, TempMon
ld bc, PARTYMON_STRUCT_LENGTH
call CopyBytes
2015-12-23 14:12:29 +00:00
jr .done
.breedmon
2015-11-20 04:38:16 +00:00
callba CopyPkmnToTempMon
ld a, [CurPartySpecies]
cp EGG
2015-12-23 14:12:29 +00:00
jr z, .done
2015-11-20 04:38:16 +00:00
ld a, [MonType]
cp BOXMON
2015-12-23 14:12:29 +00:00
jr c, .done
2015-12-16 17:32:08 +00:00
callba CalcTempmonStats
2015-12-23 14:12:29 +00:00
.done
2015-11-20 04:38:16 +00:00
and a
ret
2015-12-23 03:19:33 +00:00
StatsScreen_GetJoypad: ; 4de2c (13:5e2c)
2015-11-20 04:38:16 +00:00
call GetJoypad
ld a, [MonType]
cp BREEDMON
jr nz, .notbreedmon
push hl
push de
push bc
2015-12-16 17:32:08 +00:00
callba 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]
2015-11-20 04:38:16 +00:00
jr .clear_flags
.notbreedmon
ld a, [hJoyPressed]
.clear_flags
and a
ret
.set_carry
scf
ret
2015-12-23 03:19:33 +00:00
StatsScreen_JoypadAction: ; 4de54 (13:5e54)
2015-11-20 04:38:16 +00:00
push af
ld a, [wcf64]
and $3
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
2015-11-20 04:38:16 +00:00
ld a, [MonType]
cp BOXMON
2015-12-23 03:19:33 +00:00
jr nc, .done
2015-11-20 04:38:16 +00:00
and a
ld a, [PartyCount]
2015-12-23 03:19:33 +00:00
jr z, .next_mon
2015-11-20 04:38:16 +00:00
ld a, [OTPartyCount]
2015-12-23 03:19:33 +00:00
.next_mon
2015-11-20 04:38:16 +00:00
ld b, a
ld a, [CurPartyMon]
inc a
cp b
2015-12-23 03:19:33 +00:00
jr z, .done
2015-11-20 04:38:16 +00:00
ld [CurPartyMon], a
ld b, a
ld a, [MonType]
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
2015-11-20 04:38:16 +00:00
ld a, [CurPartyMon]
and a
2015-12-23 03:19:33 +00:00
jr z, .done
2015-11-20 04:38:16 +00:00
dec a
ld [CurPartyMon], a
ld b, a
ld a, [MonType]
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
cp $3
2015-12-23 03:19:33 +00:00
jr z, .b_button
.d_right
2015-11-20 04:38:16 +00:00
inc c
ld a, $3
cp c
2015-12-23 03:19:33 +00:00
jr nc, .set_page
2015-11-20 04:38:16 +00:00
ld c, $1
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
2015-11-20 04:38:16 +00:00
ld c, $3
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
2015-11-20 04:38:16 +00:00
ld a, [wcf64]
2015-12-23 03:19:33 +00:00
and %11111100
2015-11-20 04:38:16 +00:00
or c
ld [wcf64], 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
.b_button ; 4dee4 (13:5ee4)
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
2015-12-23 03:19:33 +00:00
StatsScreen_InitUpperHalf: ; 4deea (13:5eea)
call .PlaceHPBar
2015-11-20 04:38:16 +00:00
xor a
ld [hBGMapMode], a
ld a, [CurBaseData] ; wd236 (aliases: BaseDexNo)
ld [wd265], a
ld [CurSpecies], a
hlcoord 8, 0
ld [hl], "№"
inc hl
ld [hl], "."
inc hl
hlcoord 10, 0
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
ld de, wd265
call PrintNum
hlcoord 14, 0
call PrintLevel
2015-12-23 03:19:33 +00:00
ld hl, .NicknamePointers
call GetNicknamePointer
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
ld a, [CurBaseData] ; wd236 (aliases: BaseDexNo)
ld [wd265], a
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
2015-12-23 03:19:33 +00:00
.PlaceHPBar: ; 4df45 (13:5f45)
2015-11-20 04:38:16 +00:00
ld hl, TempMonHP
ld a, [hli]
ld b, a
ld c, [hl]
ld hl, TempMonMaxHP
ld a, [hli]
ld d, a
ld e, [hl]
2015-12-14 16:12:18 +00:00
callba ComputeHPBarPixels
2015-11-20 04:38:16 +00:00
ld hl, wcda1
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
2015-12-23 03:19:33 +00:00
.PlaceGenderChar: ; 4df66 (13:5f66)
2015-11-20 04:38:16 +00:00
push hl
callba GetGender
pop hl
ret c
ld a, "♂"
jr nz, .got_gender
ld a, "♀"
.got_gender
ld [hl], a
ret
; 4df77 (13:5f77)
2015-12-23 03:19:33 +00:00
.NicknamePointers: ; 4df77
2015-11-20 04:38:16 +00:00
dw PartyMonNicknames
dw OTPartyMonNicknames
dw sBoxMonNicknames
2015-12-23 03:19:33 +00:00
dw wBufferMonNick
2015-11-20 04:38:16 +00:00
; 4df7f
Function4df7f: ; 4df7f
2015-12-23 14:12:29 +00:00
; unreferenced
2015-11-20 04:38:16 +00:00
hlcoord 7, 0
ld bc, SCREEN_WIDTH
ld d, SCREEN_HEIGHT
.loop
ld a, $31
ld [hl], a
add hl, bc
dec d
jr nz, .loop
ret
; 4df8f
2015-12-23 03:19:33 +00:00
StatsScreen_PlaceHorizontalDivider: ; 4df8f (13:5f8f)
2015-11-20 04:38:16 +00:00
hlcoord 0, 7
ld b, SCREEN_WIDTH
ld a, "_"
.loop
ld [hli], a
dec b
jr nz, .loop
ret
2015-12-23 03:19:33 +00:00
StatsScreen_PlacePageSwitchArrows: ; 4df9b (13:5f9b)
2015-11-20 04:38:16 +00:00
hlcoord 12, 6
ld [hl], "◀"
hlcoord 19, 6
ld [hl], "▶"
ret
2015-12-23 03:19:33 +00:00
StatsScreen_PlaceShinyIcon: ; 4dfa6 (13:5fa6)
2015-11-20 04:38:16 +00:00
ld bc, TempMonDVs
callba CheckShininess
ret nc
hlcoord 19, 0
ld [hl], "<SHINY>"
ret
2015-12-23 03:19:33 +00:00
StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
2015-12-21 19:10:16 +00:00
ld a, [BaseDexNo] ; wd236 (aliases: BaseDexNo)
2015-11-20 04:38:16 +00:00
ld [wd265], a
ld [CurSpecies], a
xor a
ld [hBGMapMode], a
2015-12-23 03:19:33 +00:00
call .ClearBox
call .PageTilemap
call .LoadPals
2015-11-20 04:38:16 +00:00
ld hl, wcf64
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
2015-12-23 03:19:33 +00:00
.ClearBox: ; 4dfda (13:5fda)
2015-11-20 04:38:16 +00:00
ld a, [wcf64]
and $3
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
2015-12-23 03:19:33 +00:00
.LoadPals: ; 4dfed (13:5fed)
2015-11-20 04:38:16 +00:00
ld a, [wcf64]
and $3
ld c, a
2015-12-23 03:19:33 +00:00
callba LoadStatsScreenPals
2015-11-20 04:38:16 +00:00
call DelayFrame
ld hl, wcf64
set 5, [hl]
ret
2015-12-23 03:19:33 +00:00
.PageTilemap: ; 4e002 (13:6002)
2015-11-20 04:38:16 +00:00
ld a, [wcf64]
and $3
dec a
2015-12-21 19:10:16 +00:00
ld hl, .Jumptable
2015-11-20 04:38:16 +00:00
rst JumpTable
ret
2015-12-21 19:10:16 +00:00
.Jumptable: ; 4e00d (13:600d)
2015-12-27 02:59:03 +00:00
dw .PinkPage
dw .GreenPage
dw .BluePage
2015-11-20 04:38:16 +00:00
2015-12-21 19:10:16 +00:00
.PinkPage: ; 4e013 (13:6013)
2015-11-20 04:38:16 +00:00
hlcoord 0, 9
ld b, $0
predef DrawPlayerHP
hlcoord 8, 9
ld [hl], $41
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
ld a, [TempMonPokerusStatus]
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
2015-12-21 19:10:16 +00:00
ld [hl], "."
.NotImmuneToPkrs:
2015-11-20 04:38:16 +00:00
ld a, [MonType]
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
ld de, TempMonStatus
predef PlaceStatusString
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
hlcoord 9, 8
2015-12-21 19:10:16 +00:00
ld de, SCREEN_WIDTH
ld b, 10
2015-11-20 04:38:16 +00:00
ld a, $31
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
ld de, TempMonExp
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
ld de, Buffer1 ; wd1ea (aliases: MagikarpLength)
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
ld a, [TempMonLevel]
ld b, a
ld de, TempMonExp + 2
predef FillInExpBar
hlcoord 10, 16
ld [hl], $40
hlcoord 19, 16
ld [hl], $41
ret
2015-12-21 19:10:16 +00:00
.PrintNextLevel: ; 4e0d3 (13:60d3)
2015-11-20 04:38:16 +00:00
ld a, [TempMonLevel]
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
ld [TempMonLevel], a
.AtMaxLevel:
2015-11-20 04:38:16 +00:00
call PrintLevel
pop af
ld [TempMonLevel], a
ret
2015-12-21 19:10:16 +00:00
.CalcExpToNextLevel: ; 4e0e7 (13:60e7)
2015-11-20 04:38:16 +00:00
ld a, [TempMonLevel]
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
callba CalcExpAtLevel
ld hl, TempMonExp + 2
ld hl, TempMonExp + 2
2015-12-21 19:10:16 +00:00
ld a, [hQuotient + 2]
2015-11-20 04:38:16 +00:00
sub [hl]
dec hl
2015-12-21 19:10:16 +00:00
ld [Buffer3], a
ld a, [hQuotient + 1]
2015-11-20 04:38:16 +00:00
sbc [hl]
dec hl
ld [Buffer2], a ; wd1eb (aliases: MovementType)
ld a, [hQuotient]
sbc [hl]
ld [Buffer1], a ; wd1ea (aliases: MagikarpLength)
ret
2015-12-21 19:10:16 +00:00
.AlreadyAtMaxLevel:
2015-11-20 04:38:16 +00:00
ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
xor a
ld [hli], a
ld [hli], a
2015-11-20 04:38:16 +00:00
ld [hl], a
ret
; 4e119 (13:6119)
2015-12-21 19:10:16 +00:00
.Status_Type: ; 4e119
2015-11-20 04:38:16 +00:00
db "STATUS/"
next "TYPE/@"
; 4e127
2015-12-21 19:10:16 +00:00
.OK_str: ; 4e127
2015-11-20 04:38:16 +00:00
db "OK @"
; 4e12b
2015-12-21 19:10:16 +00:00
.ExpPointStr: ; 4e12b
2015-11-20 04:38:16 +00:00
db "EXP POINTS@"
; 4e136
2015-12-21 19:10:16 +00:00
.LevelUpStr: ; 4e136
2015-11-20 04:38:16 +00:00
db "LEVEL UP@"
; 4e13f
2015-12-21 19:10:16 +00:00
.ToStr: ; 4e13f
2015-11-20 04:38:16 +00:00
db "TO@"
; 4e142
2015-12-21 19:10:16 +00:00
.PkrsStr: ; 4e142
2015-11-20 04:38:16 +00:00
db "#RUS@"
; 4e147
2015-12-21 19:10:16 +00:00
.GreenPage: ; 4e147 (13:6147)
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
ld hl, TempMonMoves
ld de, wListMoves_MoveIndicesBuffer
ld bc, NUM_MOVES
call CopyBytes
hlcoord 8, 10
ld a, SCREEN_WIDTH * 2
ld [Buffer1], a
predef ListMoves
hlcoord 12, 11
2015-12-21 19:10:16 +00:00
ld a, SCREEN_WIDTH * 2
2015-11-20 04:38:16 +00:00
ld [Buffer1], a
2015-12-04 13:46:11 +00:00
predef ListMovePP
2015-11-20 04:38:16 +00:00
ret
2015-12-21 19:10:16 +00:00
.GetItemName: ; 4e189 (13:6189)
ld de, .ThreeDashes
2015-11-20 04:38:16 +00:00
ld a, [TempMonItem]
and a
ret z
ld b, a
2015-12-21 19:10:16 +00:00
callba TimeCapsule_ReplaceTeruSama
2015-11-20 04:38:16 +00:00
ld a, b
ld [wd265], a
call GetItemName
ret
; 4e1a0 (13:61a0)
2015-12-21 19:10:16 +00:00
.Item: ; 4e1a0
2015-11-20 04:38:16 +00:00
db "ITEM@"
; 4e1a5
2015-12-21 19:10:16 +00:00
.ThreeDashes: ; 4e1a5
2015-11-20 04:38:16 +00:00
db "---@"
; 4e1a9
2015-12-21 19:10:16 +00:00
.Move: ; 4e1a9
2015-11-20 04:38:16 +00:00
db "MOVE@"
; 4e1ae
2015-12-21 19:10:16 +00:00
.BluePage: ; 4e1ae (13:61ae)
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
2015-11-20 04:38:16 +00:00
ld a, $31
.BluePageVerticalDivider:
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, .BluePageVerticalDivider
2015-11-20 04:38:16 +00:00
hlcoord 11, 8
2015-12-21 19:10:16 +00:00
ld bc, 6
2015-11-20 04:38:16 +00:00
predef PrintTempMonStats
ret
2015-12-21 19:10:16 +00:00
.PlaceOTInfo: ; 4e1cc (13:61cc)
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
ld de, TempMonID
call PrintNum
2015-12-21 19:10:16 +00:00
ld hl, .OTNamePointers
2015-12-23 03:19:33 +00:00
call GetNicknamePointer
call CopyNickname
2015-11-20 04:38:16 +00:00
callba CheckNickErrors
hlcoord 2, 13
call PlaceString
ld a, [TempMonCaughtGender]
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
2015-11-20 04:38:16 +00:00
and $80
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
; 4e216 (13:6216)
2015-12-21 19:10:16 +00:00
.OTNamePointers: ; 4e216
2015-11-20 04:38:16 +00:00
dw PartyMonOT
dw OTPartyMonOT
dw sBoxMonOT
2015-12-21 19:10:16 +00:00
dw wBufferMonOT
2015-11-20 04:38:16 +00:00
; 4e21e
IDNoString: ; 4e21e
2015-12-21 19:10:16 +00:00
db "<ID>№.@"
2015-11-20 04:38:16 +00:00
OTString: ; 4e222
db "OT/@"
; 4e226
2015-12-21 19:10:16 +00:00
StatsScreen_PlaceFrontpic: ; 4e226 (13:6226)
2015-11-20 04:38:16 +00:00
ld hl, TempMonDVs
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
2015-11-20 04:38:16 +00:00
ld a, [CurPartySpecies]
call PlayCry2
ret
2015-12-23 14:12:29 +00:00
.AnimateMon: ; 4e253 (13:6253)
2015-11-20 04:38:16 +00:00
ld hl, wcf64
set 5, [hl]
ld a, [CurPartySpecies]
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
2015-12-23 14:12:29 +00:00
.AnimateEgg: ; 4e271 (13:6271)
2015-11-20 04:38:16 +00:00
ld a, [CurPartySpecies]
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
.get_animation ; 4e289 (13:6289)
2015-11-20 04:38:16 +00:00
ld a, [CurPartySpecies]
call IsAPokemon
ret c
2015-12-23 14:12:29 +00:00
call StatsScreen_LoadTextBoxSpaceGFX
2015-11-20 04:38:16 +00:00
ld de, VTiles2 tile $00
2015-11-20 20:15:32 +00:00
predef FrontpicPredef
2015-11-20 04:38:16 +00:00
hlcoord 0, 0
ld d, $0
ld e, $2
predef LoadMonAnimation
ld hl, wcf64
set 6, [hl]
ret
2015-12-21 19:10:16 +00:00
StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad)
2015-11-20 04:38:16 +00:00
ld a, [MonType]
ld hl, .Jumptable
rst JumpTable
ret
.Jumptable: ; 4e2b5 (13:62b5)
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
2015-12-21 19:10:16 +00:00
.PartyMon: ; 4e2bf (13:62bf)
2015-11-20 04:38:16 +00:00
ld a, [CurPartyMon]
ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
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
2015-12-21 19:10:16 +00:00
.OTPartyMon: ; 4e2cf (13:62cf)
2015-11-20 04:38:16 +00:00
xor a
ret
2015-12-21 19:10:16 +00:00
.BoxMon: ; 4e2d1 (13:62d1)
2015-11-20 04:38:16 +00:00
ld hl, sBoxMons
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon]
call AddNTimes
ld b, h
ld c, l
ld a, BANK(sBoxMons)
call GetSRAMBank
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
2015-12-21 19:10:16 +00:00
.Tempmon: ; 4e2ed (13:62ed)
2015-11-20 04:38:16 +00:00
ld bc, TempMonSpecies ; wd10e (aliases: TempMon)
2015-12-21 19:10:16 +00:00
jr .CheckEggFaintedFrzSlp ; utterly pointless
2015-11-20 04:38:16 +00:00
2015-12-21 19:10:16 +00:00
.CheckEggFaintedFrzSlp: ; 4e2f2 (13:62f2)
2015-11-20 04:38:16 +00:00
ld a, [CurPartySpecies]
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
2015-12-21 19:10:16 +00:00
.Wildmon: ; 4e301 (13:6301)
2015-11-20 04:38:16 +00:00
ld a, $1
and a
ret
2015-12-21 19:10:16 +00:00
.FaintedFrzSlp: ; 4e305 (13:6305)
2015-11-20 04:38:16 +00:00
xor a
ret
2015-12-23 14:12:29 +00:00
StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307)
2015-11-20 04:38:16 +00:00
nop
push hl
push de
push bc
push af
call DelayFrame
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ld de, TextBoxSpaceGFX
lb bc, BANK(TextBoxSpaceGFX), 1
ld hl, VTiles2 tile $7f
call Get2bpp
pop af
ld [rVBK], a
pop af
pop bc
pop de
pop hl
ret
; 4e32a (13:632a)
Unknown_4e32a: ; 4e32a
; A blank tile?
ds 16
; 4e33a
EggStatsScreen: ; 4e33a
xor a
ld [hBGMapMode], a
ld hl, wcda1
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
ld a, [TempMonHappiness] ; egg status
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, wcf64
set 5, [hl]
call SetPalettes ; pals
call DelayFrame
hlcoord 0, 0
call PrepMonFrontpic
2016-05-05 02:34:09 +00:00
callba HDMATransferTileMapToWRAMBank3
2015-12-21 19:10:16 +00:00
call StatsScreen_AnimateEgg
2015-11-20 04:38:16 +00:00
ld a, [TempMonHappiness]
cp 6
ret nc
ld de, SFX_2_BOOPS
call PlaySFX
ret
; 0x4e3c0
EggString: ; 4e3c0
db "EGG@"
FiveQMarkString: ; 4e3c4
db "?????@"
EggSoonString: ; 0x4e3ca
db "It's making sounds"
next "inside. It's going"
next "to hatch soon!@"
EggCloseString: ; 0x4e3fd
db "It moves around"
next "inside sometimes."
next "It must be close"
next "to hatching.@"
EggMoreTimeString: ; 0x4e43d
db "Wonder what's"
next "inside? It needs"
next "more time, though.@"
EggALotMoreTimeString: ; 0x4e46e
db "This EGG needs a"
next "lot more time to"
next "hatch.@"
; 0x4e497
2015-12-21 19:10:16 +00:00
StatsScreen_AnimateEgg: ; 4e497 (13:6497)
call StatsScreen_GetAnimationParam
2015-11-20 04:38:16 +00:00
ret nc
ld a, [TempMonHappiness]
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
2015-12-23 14:12:29 +00:00
call StatsScreen_LoadTextBoxSpaceGFX
2015-11-20 04:38:16 +00:00
ld de, VTiles2 tile $00
2015-11-20 20:15:32 +00:00
predef FrontpicPredef
2015-11-20 04:38:16 +00:00
pop de
hlcoord 0, 0
ld d, $0
predef LoadMonAnimation
ld hl, wcf64
set 6, [hl]
ret
2015-12-23 14:12:29 +00:00
StatsScreen_LoadPageIndicators: ; 4e4cd (13:64cd)
2015-11-20 04:38:16 +00:00
hlcoord 13, 5
ld a, $36
call .load_square
hlcoord 15, 5
ld a, $36
call .load_square
hlcoord 17, 5
ld a, $36
call .load_square
ld a, c
cp $2
ld a, $3a
hlcoord 13, 5
jr c, .load_square
hlcoord 15, 5
jr z, .load_square
hlcoord 17, 5
.load_square ; 4e4f7 (13:64f7)
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
2015-12-23 03:19:33 +00:00
CopyNickname: ; 4e505 (13:6505)
2015-11-20 04:38:16 +00:00
ld de, StringBuffer1
ld bc, PKMN_NAME_LENGTH
jr .okay ; uuterly pointless
.okay
ld a, [MonType]
cp BOXMON
jr nz, .partymon
ld a, BANK(sBoxMonNicknames)
call GetSRAMBank
push de
call CopyBytes
pop de
call CloseSRAM
ret
.partymon
push de
call CopyBytes
pop de
ret
2015-12-23 03:19:33 +00:00
GetNicknamePointer: ; 4e528 (13:6528)
2015-11-20 04:38:16 +00:00
ld a, [MonType]
add a
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [MonType]
2015-12-23 03:19:33 +00:00
cp BREEDMON
2015-11-20 04:38:16 +00:00
ret z
ld a, [CurPartyMon]
jp SkipNames
CheckFaintedFrzSlp: ; 4e53f
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]
and (1 << FRZ) | SLP
jr nz, .fainted_frz_slp
and a
ret
.fainted_frz_slp
scf
ret
; 4e554