Port the options screen
Checks / web (push) Canceled after 0s

OPTION in the start menu runs _Option with the ROM's labels and settings,
OptionsControl's cursor wrapping and each option's bit handling. The four
option bytes live in the script state and saves, defaulting to
DefaultOptions. The battle style now decides whether a trainer's next
Pokémon brings an offer to switch, and the menu account whether the start
menu describes its items; the other settings are kept for later.

Closes #24

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sébastien QUEROLandClaude Opus 5.5 committed 2026-10-02 10:47:11 +02:00
1 parent 47698565ab
commit c4cc0e756c
19 files changed
+732 -21

No files matched your search

+12 -2
View File
@@ -20,6 +20,7 @@ import {
} from "./interpreter";
import { Pokegear } from "./pokegear";
import { TrainerCard } from "./trainer-card";
import { OptionsMenu, menuAccount } from "./options";
import { readString, readText, type TextContext } from "./text";
type Input = number | string | undefined;
@@ -278,8 +279,10 @@ export class StartMenuRun {
const choice = yield* this.menu(
[],
items.map((item) => this.itemString(item, 1)),
// The menu account (on by default) describes the highlighted item.
items.map((item) => this.itemString(item, 2).replace("\n", " ")),
// The menu account (wOptions2) describes the highlighted item.
menuAccount(this.state.options)
? items.map((item) => this.itemString(item, 2).replace("\n", " "))
: undefined,
Math.min(items.length - 1, Math.max(0, this.cursors.start - 1)),
);
if (choice < 0) return;
@@ -311,6 +314,13 @@ export class StartMenuRun {
gameTime: () => this.host.gameTime(),
}).run();
break;
case STARTMENUITEM_OPTION:
// StartMenu_Option returns to the start menu.
yield* new OptionsMenu(this.state.options, {
reader: this.reader,
text: () => this.text(),
}).run();
break;
case STARTMENUITEM_EXIT:
return;
case STARTMENUITEM_SAVE: