Port the Pokédex list, entries and tab (#35)
The start menu's POKéDEX runs Pokedex in New mode: the list up to the last seen Pokémon, its cursor and page moves, and DisplayDexEntry with the category, number, footprint, and the height, weight and pages once caught. The Pokédex tab shows the same records from the loaded game. Order, entries and footprints are compared with the pinned PRET source. AREA, CRY, PRNT, the option and search screens, Old and A to Z modes and Unown mode remain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
03aa913a94
commit
cdee576818
20 files changed
+1624
-29
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import type { RomReader } from "../rom/reader";
|
||||
import type { PokemonData } from "../rom/pokemon";
|
||||
import type { PokedexData } from "../rom/pokedex";
|
||||
import { BATTLE, ENGINE_FLAGS, MENU, OVERWORLD, RAM } from "../rom/profile";
|
||||
import { C } from "../battle/constants";
|
||||
import {
|
||||
@@ -22,6 +23,7 @@ import {
|
||||
} from "./interpreter";
|
||||
import { Pokegear } from "./pokegear";
|
||||
import { TrainerCard } from "./trainer-card";
|
||||
import { Pokedex } from "./pokedex";
|
||||
import { OptionsMenu, menuAccount } from "./options";
|
||||
import { flyMap } from "./fly-map";
|
||||
import { OW } from "../world/constants";
|
||||
@@ -102,11 +104,13 @@ const FACING_VECTORS = [
|
||||
|
||||
/** Menu cursors in work RAM, which CleanUpBattleRAM clears after every
|
||||
* battle: wBattleMenuCursorPosition (the start menu's 1-based position,
|
||||
* shared with the battle menu), wPartyMenuCursor (1-based) and wLastPocket. */
|
||||
* shared with the battle menu), wPartyMenuCursor (1-based) and wLastPocket.
|
||||
* wPrevDexEntry, the Pokédex's last entry, survives battles. */
|
||||
export interface MenuCursors {
|
||||
start: number;
|
||||
party: number;
|
||||
pocket: number;
|
||||
dex: number;
|
||||
}
|
||||
|
||||
/** The world's verdict on a field move chosen from the party menu: a
|
||||
@@ -131,6 +135,7 @@ export type MenuFieldMove =
|
||||
export interface StartMenuHost {
|
||||
reader: RomReader;
|
||||
data: PokemonData;
|
||||
dex: PokedexData;
|
||||
text(): TextContext;
|
||||
/** BikeFunction: the script that getting on or off the Bicycle queues
|
||||
* here, or undefined when .CheckEnvironment refuses it. */
|
||||
@@ -187,7 +192,7 @@ export class StartMenuRun {
|
||||
constructor(
|
||||
state: ScriptState,
|
||||
private host: StartMenuHost,
|
||||
cursors: MenuCursors = { start: 0, party: 0, pocket: 0 },
|
||||
cursors: MenuCursors = { start: 0, party: 0, pocket: 0, dex: 0 },
|
||||
select = false,
|
||||
) {
|
||||
this.state = copyScriptState(state);
|
||||
@@ -323,6 +328,22 @@ export class StartMenuRun {
|
||||
this.cursors.start = choice + 1;
|
||||
const item = items[choice];
|
||||
switch (item) {
|
||||
case STARTMENUITEM_POKEDEX: {
|
||||
// StartMenu_Pokedex needs a party and returns to the start menu.
|
||||
if (!this.state.party.length) break;
|
||||
const dex = new Pokedex(
|
||||
{
|
||||
data: this.data,
|
||||
dex: this.host.dex,
|
||||
seen: this.state.pokedex.seen,
|
||||
caught: this.state.pokedex.caught,
|
||||
},
|
||||
this.cursors.dex,
|
||||
);
|
||||
yield* dex.run();
|
||||
this.cursors.dex = dex.prevEntry;
|
||||
break;
|
||||
}
|
||||
case STARTMENUITEM_POKEMON:
|
||||
if (yield* this.pokemon()) return;
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user