Port the trainer card and the play time

The player's name in the start menu opens TrainerCard: page 1 with the
name, ID, money, Pokédex count and play time, page 2 with the Johto
leaders and the badges owned, turned and closed with the original
buttons. The card picture, leader faces and animated badges come from the
ROM with _CGB_TrainerCard's palettes. GameTimer now counts the play time
from the end of the introduction, capped at 999:59:59, and saves keep it.

Closes #23

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-10-01 13:32:14 +02:00
1 parent 38b9562bd3
commit 47698565ab
24 files changed
+954 -30

No files matched your search

+13
View File
@@ -9,6 +9,7 @@ import {
} from "../battle/battle";
import { receiveItem, removeFromSlot, type ItemSlot } from "../party/bag";
import { calcStats, maxPP, type PartyMon } from "../party/pokemon";
import type { GameTime } from "../world/game-time";
import { PartyEvolution, evoStoneCompatible } from "./evolution";
import {
copyScriptState,
@@ -18,6 +19,7 @@ import {
type ScriptState,
} from "./interpreter";
import { Pokegear } from "./pokegear";
import { TrainerCard } from "./trainer-card";
import { readString, readText, type TextContext } from "./text";
type Input = number | string | undefined;
@@ -115,6 +117,8 @@ export interface StartMenuHost {
scriptHost(): ScriptHost;
/** GetWorldMapLocation for any map. */
landmarkOf(mapId: string): number;
/** wGameTime, for the trainer card. */
gameTime(): GameTime;
}
/** The overworld start menu (engine/menus/start_menu.asm) with its
@@ -298,6 +302,15 @@ export class StartMenuRun {
landmarkOf: (mapId) => this.host.landmarkOf(mapId),
}).run();
break;
case STARTMENUITEM_STATUS:
// StartMenu_Status returns to the start menu.
yield* new TrainerCard(this.state, {
reader: this.reader,
text: () => this.text(),
player: () => this.host.scriptHost().player(),
gameTime: () => this.host.gameTime(),
}).run();
break;
case STARTMENUITEM_EXIT:
return;
case STARTMENUITEM_SAVE: