summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Add-a-fourth-stats-page.md94
1 files changed, 93 insertions, 1 deletions
diff --git a/Add-a-fourth-stats-page.md b/Add-a-fourth-stats-page.md
index b67373d..79f1484 100644
--- a/Add-a-fourth-stats-page.md
+++ b/Add-a-fourth-stats-page.md
@@ -9,6 +9,7 @@ This tutorial is for how to add a fourth page to Pokémon stats. As an example,
2. [Load and apply the fourth page's palette](#2-load-and-apply-the-fourth-pages-palette)
3. [Display the fourth page's content](#3-display-the-fourth-pages-content)
4. [Account for the shifted page indexes](#4-account-for-the-shifted-page-indexes)
+5. [Show Caught Data on the fourth page](#5-show-caught-data-on-the-fourth-page)
## 1. Define the fourth page's colors
@@ -387,4 +388,95 @@ Now we have a fourth stats page in-game!
![Screenshot](screenshots/fourth-stats-page.png)
-TODO: show caught data on the orange page.
+## 5. Show Caught Data on the fourth page
+
+This is an alternative `loadOrangePage`, as opposed to the "Hello world!" example earlier. It displays the Caught Location (or "UNKNOWN"), the caught Time (or a blank row if the Caught Location was unknown) as well as the level the Pokémon was met at (or "???").
+```diff
++LoadOrangePage:
++ call .placeCaughtLocation
++ ld de, MetAtMapString
++ hlcoord 0, 9
++ call PlaceString
++ call .placeCaughtLevel
++ ret
++
++.placeCaughtLocation
++ ld a, [wTempMonCaughtLocation]
++ and CAUGHT_LOCATION_MASK
++ jr z, .unknown_location
++ cp LANDMARK_EVENT
++ jr z, .unknown_location
++ cp LANDMARK_GIFT
++ jr z, .unknown_location
++ ld e, a
++ farcall GetLandmarkName
++ ld de, wStringBuffer1
++ hlcoord 1, 10
++ call PlaceString
++ ld a, [wTempMonCaughtTime]
++ and CAUGHT_TIME_MASK
++ ret z ; no time
++ rlca
++ rlca
++ dec a
++ ld hl, .times
++ call GetNthString
++ ld d, h
++ ld e, l
++ call CopyName1
++ ld de, wStringBuffer2
++ hlcoord 1, 11
++ call PlaceString
++ ret
++
++.unknown_location:
++ ld de, MetUnknownMapString
++ hlcoord 1, 10
++ call PlaceString
++ ret
++
++.times
++ db "MORN@"
++ db "DAY@"
++ db "NITE@"
++
++.placeCaughtLevel
++ ; caught level
++ ; Limited to between 1 and 63 since it's a 6-bit quantity.
++ ld a, [wTempMonCaughtLevel]
++ and CAUGHT_LEVEL_MASK
++ jr z, .unknown_level
++ cp CAUGHT_EGG_LEVEL ; egg marker value
++ jr nz, .print
++ ld a, EGG_LEVEL ; egg hatch level
++
++.print
++ ld [wTextDecimalByte], a
++ hlcoord 2, 13
++ ld de, wTextDecimalByte
++ lb bc, PRINTNUM_LEFTALIGN | 1, 3
++ call PrintNum
++ ld de, MetAtLevelString
++ hlcoord 0, 12
++ call PlaceString
++ hlcoord 1, 13
++ ld [hl], "<LV>"
++ ret
++
++.unknown_level
++ ld de, MetUnknownLevelString
++ hlcoord 1, 12
++ call PlaceString
++ ret
++
++MetAtMapString:
++ db "MET AT:@"
++
++MetUnknownMapString:
++ db "UNKNOWN@"
++
++MetAtLevelString:
++ db "MET LEVEL:@"
++MetUnknownLevelString:
++ db "???@"
+```