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:
1 parent
47698565ab
commit
c4cc0e756c
19 files changed
+732
-21
No files matched your search
@@ -87,7 +87,8 @@ callee's ROM script in the event interpreter on the same draft. The world
|
||||
keeps the card on screen (`world.pokegear`) during the call's texts.
|
||||
`scripts/mom.ts` runs `BankOfMom` as a special; its amount box is a
|
||||
`mombank` effect answered with buttons in the same way, and so are the
|
||||
pages of `scripts/trainer-card.ts`. The world refreshes the card's play
|
||||
pages of `scripts/trainer-card.ts` and the screen of `scripts/options.ts`,
|
||||
whose option bytes live in the script state. The world refreshes the card's play
|
||||
time, colon and badge step every tick; `world/game-time.ts` is the play
|
||||
time (`wGameTime`), which the world advances two frames per tick.
|
||||
|
||||
|
||||
+3
-2
@@ -35,6 +35,7 @@ These paths refer to the pinned [PRET source](https://github.com/pret/pokecrysta
|
||||
| `game/scripts/start-menu.ts` | `engine/menus/start_menu.asm`, `engine/pokemon/mon_menu.asm`, `mon_submenu.asm`, `party_menu.asm`, `switchpartymons.asm`, `engine/items/pack.asm`, `engine/items/item_effects.asm` | The start menu, the party menu with the Pokémon submenu (STATS, SWITCH, MOVE, ITEM) and the pack (USE, GIVE, TOSS) with the field item effects listed below, including Rare Candy, stones and vitamins. Menu strings, prompts and texts come from the ROM; screens are native. Field moves from the menu (checked by the world), Softboiled and Milk Drink, SEL and the Select button (`SelectMenu`). MAIL and the other field items give a notice. |
|
||||
| `game/scripts/pokegear.ts` | `engine/pokegear/pokegear.asm`, `engine/phone/phone.asm`, `engine/phone/scripts/mom.asm`, `elm.asm`, `engine/rtc/print_hours_mins.asm` | `PokeGear` with each card's joypad handling: the clock (`Pokegear_UpdateClock`, `PrintHoursMins`), the map card's landmark cursor (`TownMap_InitCursorAndPlayerIconPositions`, `TownMap_GetKantoLandmarkLimits`), the phone list (`PokegearPhone_UpdateDisplayList`, `GetCallerClassAndName`, `PokegearPhoneContactSubmenu`, `CheckCanDeletePhoneNumber`) and calls (`MakePhoneCallFromPokegear`, `CheckPhoneContactTimeOfDay`, `GetMapPhoneService`, `HangUp`). Callee scripts run in the event interpreter on the start menu's draft. Screens are native; the radio's stations are not ported. |
|
||||
| `game/scripts/trainer-card.ts` | `engine/menus/trainer_card.asm`, `engine/gfx/player_gfx.asm` (`GetCardPic`), `engine/gfx/cgb_layouts.asm` (`_CGB_TrainerCard`), `home/game_time.asm` | `TrainerCard`'s two reachable pages with their joypad rules, strings from `.Name_Money`, `.Dex_PlayTime` and `.Badges`, the caught count, and the badges from `TrainerCard_JohtoBadgesOAM` with their eight-frame steps. `rendering/trainer-card.ts` draws the card picture, leader faces and badges from the ROM with the card's palettes and attribute map. `world/game-time.ts` is `GameTimer` (capped at 999:59:59). Text is native; the blinking colon's and badges' phase start at the page load. |
|
||||
| `game/scripts/options.ts` | `engine/menus/options_menu.asm`, `data/default_options.asm`, `engine/battle/core.asm` (`CheckWhetherToAskSwitch`), `engine/menus/start_menu.asm` | `_Option` with `OptionsControl` and each option's routine on the four option bytes, `DefaultOptions`, and the two settings consumed so far: `BATTLE_SHIFT` and `MENU_ACCOUNT`. Strings come from the ROM; the screen is native. |
|
||||
| `game/scripts/evolution.ts` | `engine/pokemon/evolve.asm`, `engine/pokemon/learn.asm`, `engine/movie/evolution_animation.asm`, `engine/pokemon/party_menu.asm` | `EvolveAfterBattle`/`EvolvePokemon` over the raw evolution bytes, the evolution texts and a timed, B-stoppable picture sequence, `UpdateSpeciesNameIfNotNicknamed`, `CalcMonStats` and the HP rise, `LearnLevelMoves`, `LearnMove`/`ForgetMove` outside battle and `PlacePartyMonEvoStoneCompatibility`. |
|
||||
| `game/rom/pokemon.ts` | `data/pokemon/base_stats`, `evos_attacks.asm`, `data/moves/moves.asm`, `data/items/attributes.asm`, `engine/gfx/load_pics.asm` | Species, move and item names, base data, evolution lists, learnsets, move PP, item pockets, growth-rate exp and front pictures (`FixPicBank`, `PadFrontpic`). Starter pictures match rebuilt bytes; all 251 evolution lists match the pinned source. |
|
||||
| `game/party` | `engine/pokemon/move_mon.asm`, `engine/pokemon/caught_data.asm`, `engine/items/items.asm` | `GeneratePartyMonStats` for script gifts: DVs, `FillMoves`, PP, exp, `CalcMonStatC`, happiness and caught data. `PutItemInPocket`, key items and `TossItem`. `SendMonIntoBox`, `SendGetMonIntoFromBox` (deposit and withdraw), `RestorePPOfDepositedPokemon` and `CalcLevel` for the PC's boxes and item storage. TMs and HMs are refused. |
|
||||
@@ -289,8 +290,8 @@ the original.
|
||||
engine flags and the party, and `StartMenu.Items` supplies each item's
|
||||
string and description. The start menu runs as `StartMenuRun`, a native
|
||||
generator on a copy of the script state, so nothing commits before it
|
||||
closes and a save meanwhile keeps the previous state. POKéDEX and OPTION
|
||||
are not ported and give a notice; POKéGEAR and the trainer card run inside
|
||||
closes and a save meanwhile keeps the previous state. POKéDEX is not
|
||||
ported and gives a notice; POKéGEAR, the trainer card and OPTION run inside
|
||||
the start menu run.
|
||||
|
||||
The party menu prints `PartyMenuStrings` for the `PARTYMENUACTION_*` in use.
|
||||
|
||||
+11
-4
@@ -164,7 +164,7 @@ The numbered sections below keep their full scope. Each one opens with a checkli
|
||||
|
||||
## Implemented: the start menu, party menu and pack
|
||||
|
||||
- Start opens `StartMenu` with the items `SetUpMenuItems` lists for the player's progress (POKéDEX, POKéMON, PACK, POKéGEAR, the player's name, SAVE, OPTION, EXIT) and their ROM descriptions. POKéDEX and OPTION give a notice (POKéGEAR and the trainer card run since the sections below); SAVE points to the automatic session saves.
|
||||
- Start opens `StartMenu` with the items `SetUpMenuItems` lists for the player's progress (POKéDEX, POKéMON, PACK, POKéGEAR, the player's name, SAVE, OPTION, EXIT) and their ROM descriptions. POKéDEX gives a notice (POKéGEAR, the trainer card and OPTION run since the sections below); SAVE points to the automatic session saves.
|
||||
- POKéMON: the party menu with the ROM's prompts and `GetMonSubmenuItems`: field moves the Pokémon knows (from `MonMenuOptions`), STATS, SWITCH, MOVE, ITEM or MAIL, and CANCEL when there is room. STATS opens the stats screen; SWITCH asks "Move to where?" and swaps the two Pokémon; MOVE (`MoveScreenLoop`) swaps two moves with their PP; ITEM gives an item from the pack (key items and untossable items "can't be held"), swaps it with the held item or takes it back, with the pack-full checks of `TryGiveItemToPartymon` and `TakePartyItem`.
|
||||
- PACK: the Items, Balls, Key and TM pockets (left and right change pockets; there are no TMs or HMs yet), and each item's submenu chosen by its permissions and field menu (`USE`, `GIVE`, `TOSS`, `SEL`, `QUIT`). TOSS asks how many and confirms. USE follows `UseItem`: Oak's warning without a field use, "You don't have a POKéMON!" for party items without one, and `_DoItemEffect` by the item's `ItemEffects` address: Potions and the other `HealingHPAmounts` items, status healers, Full Restore, Revive and Max Revive, the bitter Energypowder, Energy Root, Heal Powder and Revival Herb, Ethers, Elixers, the MysteryBerry and PP Up. The Bicycle closes the menu and runs `Script_GetOnBike` or `Script_GetOffBike` outdoors; elsewhere Oak objects, because `wFieldMoveSucceeded` shares `wItemEffectSucceeded`'s byte.
|
||||
- PP Up keeps a quirk: `wUsePPUp` shares `wTempPP`'s byte, so `ComputeMaxPP` adds one step (a fifth of the base PP, at most 7) to the current PP as well as the maximum. Sketch and moves with three PP Ups are "maxed out".
|
||||
@@ -217,11 +217,17 @@ The numbered sections below keep their full scope. Each one opens with a checkli
|
||||
- `wGameTime` is new: `GameTimer` counts 60 frames to the second, two per overworld tick, from the end of the introduction through scenes, menus and battles, and caps at 999:59:59. A save made during a scene keeps the current play time; everything else in it is still the state before the scene. Save format 3 gained `gameTime`, migrated by absence to zero. The save screen and the Hall of Fame, which pause it in the original, are not ported.
|
||||
- The labels drawn as tiles ("ID NO", "STATUS" and "BADGES") are presented as text; the other strings come from the ROM.
|
||||
|
||||
## Implemented: the options
|
||||
|
||||
- OPTION in the start menu runs `_Option` and returns to the start menu. The labels come from `StringOptions` and the settings from each routine's strings. Up and down move the ▶ with `OptionsControl`'s wrapping, left and right change the option under it, A on CANCEL, B or Start leaves. Each routine is ported from its bit handling: text speed cycles FAST, MID and SLOW through `GetTextSpeed` (`.Save` keeps only the high nybble), the battle scene, battle style, sound and menu account toggle with either direction, printing cycles through the five `GBPRINTER_*` levels through `GetPrinterSetting`, and the frame wraps through `TYPE 1` to `8`.
|
||||
- The four bytes (`wOptions`, `wTextboxFrame`, `wGBPrinterBrightness`, `wOptions2`) are kept in the script state, so they change on the start menu's draft and commit when it closes. Save format 3 gained `options`, migrated by absence to `DefaultOptions`.
|
||||
- In effect: the battle style (`CheckWhetherToAskSwitch`: SET makes no offer when a trainer sends out its next Pokémon) and the menu account (`StartMenu`'s descriptions). Not yet: text speed (native text appears at once), the battle scene (no move animations), sound (no audio), printing and the textbox frame. The catching tutorial's temporary medium text speed has nothing to change.
|
||||
|
||||
## Native battles: current state
|
||||
|
||||
The battle core, ROM tables, encounter hooks, battle UI and whiteout hooks are present. Unit tests cover wins, escape, loss, experience, move learning and capture; reference tests compare damage, type effectiveness, stat calculation and experience curves. Browser tests drive a test-only wild encounter through the real UI: victory with level-up and move learning, escape, whiteout, catching with a nickname, keyboard and on-screen D-pad menu navigation, mid-battle backup restore, rollback of unsupported effects, switching through the party menu and a Potion from the Items pocket. Real Route 29 encounters now use the ROM's encounter tables. Only the special Kurt and Park balls remain unported among battle items.
|
||||
|
||||
This is still not a complete new game. The Pokégear's radio, the Pokédex screen, the options, story progression beyond Route 30 and Mr. Pokémon's house, and audio remain unfinished. The start menu opens the party menu and the pack, and Select uses the registered item, such as the Bicycle; the PCs store Pokémon, items and decorations. Surfing and terrain animation now have native implementations; later maps remain gated. Save slots, a Johto/Kanto atlas, Pokédex records, online Link, friends and real-world steps come later.
|
||||
This is still not a complete new game. The Pokégear's radio, the Pokédex screen, story progression beyond Route 30 and Mr. Pokémon's house, and audio remain unfinished. The start menu opens the party menu and the pack, and Select uses the registered item, such as the Bicycle; the PCs store Pokémon, items and decorations. Surfing and terrain animation now have native implementations; later maps remain gated. Save slots, a Johto/Kanto atlas, Pokédex records, online Link, friends and real-world steps come later.
|
||||
|
||||
## 1. Complete the overworld foundation
|
||||
|
||||
@@ -299,7 +305,7 @@ Introduce native player, party, Pokémon, inventory, money and quest models. Rea
|
||||
|
||||
Expand script calls, choices, scene state, inventory commands and native special handlers. Translate routines reached through assembly calls into explicit native services; never fall back to emulator execution in the shipping game.
|
||||
|
||||
Meeting Mom, Elm's introduction, the starter, the aide's Potion, Route 29, Cherrygrove, Route 30's trainers, Mr. Pokémon's house, the Cherrygrove rival battle, the return to Elm, capture, the catching tutorial, the PC, the introduction's naming and clock screens, and switching and healing items in battle run now. The opening milestone is complete within the recorded acceptance boundaries. The start menu, party menu and pack now run outside battle, and Pokémon evolve. Field moves from the menu, SEL/Select and MOVE PKMN W/O MAIL run too, and the Pokégear's clock, map and phone cards, with calls to Mom and Elm, Mom's bank at home and her purchases, and the trainer card with the play time. Next: the options.
|
||||
Meeting Mom, Elm's introduction, the starter, the aide's Potion, Route 29, Cherrygrove, Route 30's trainers, Mr. Pokémon's house, the Cherrygrove rival battle, the return to Elm, capture, the catching tutorial, the PC, the introduction's naming and clock screens, and switching and healing items in battle run now. The opening milestone is complete within the recorded acceptance boundaries. The start menu, party menu and pack now run outside battle, and Pokémon evolve. Field moves from the menu, SEL/Select and MOVE PKMN W/O MAIL run too, and the Pokégear's clock, map and phone cards, with calls to Mom and Elm, Mom's bank at home and her purchases, the trainer card with the play time, and the options. Next: the Fly map and Teleport/Dig warps.
|
||||
|
||||
Complete and validate the native battle engine: deterministic randomness, stats, move selection, accuracy/critical checks, damage, status, turn order, switching, fainting, experience, capture and rewards. Compare controlled seeds and states with the original, including integer rounding and overflow behavior.
|
||||
|
||||
@@ -335,7 +341,8 @@ Acceptance: main-game/postgame playthroughs, representative optional content, ba
|
||||
- [x] Pokégear clock, map and phone cards (the radio card waits for its stations)
|
||||
- [x] Mom's bank: the amount box with its digit cursor, on keyboard, D-pad and on-screen buttons
|
||||
- [x] Trainer card: both pages, with the ROM's card picture, leader faces and animated badges
|
||||
- [ ] Pokédex and options screens
|
||||
- [x] Options screen, with the battle style and menu account in effect
|
||||
- [ ] Pokédex screen
|
||||
- [ ] Scalable text, configurable controls and fuller accessibility
|
||||
- [ ] Save slots with migration, atomic writes and import previews
|
||||
- [ ] Installable web app with offline app shell, safe updates and quota handling
|
||||
|
||||
@@ -929,3 +929,40 @@ physical-device run.
|
||||
|
||||
Next: the options screen (board #24), then the Fly map and Teleport/Dig
|
||||
warps.
|
||||
|
||||
The trainer card increment was committed as `4769856` (`Closes #23`; the
|
||||
hook moved the card to Fait). Not pushed.
|
||||
|
||||
## Options: 2026-10-01
|
||||
|
||||
Continued in the same session with board card #24.
|
||||
|
||||
- `src/game/scripts/options.ts` (`OptionsMenu`): OPTION in the start menu
|
||||
runs `_Option` on `state.options` (the start menu's draft) and returns to
|
||||
the start menu. `options` effect answered with buttons; Start/B leave,
|
||||
A on CANCEL leaves; `OptionsControl` wrapping; each option routine ported
|
||||
from its bits (text speed's `.Save` keeps only the high nybble, so bit 3
|
||||
is lost and bit 4 kept). Labels from `StringOptions` (read with a longer
|
||||
`readString` limit), settings from the routines' strings.
|
||||
- `GameOptions` = `wOptions`, `wTextboxFrame`, `wGBPrinterBrightness`,
|
||||
`wOptions2`; `defaultOptions()` is `DefaultOptions`. In `ScriptState` and
|
||||
saves (migrated by absence; frame above 7 refused).
|
||||
- Consumers: `Battle` takes `shift` (from `BATTLE_SHIFT`) and
|
||||
`CheckWhetherToAskSwitch` honours it; `StartMenu` drops descriptions
|
||||
without `MENU_ACCOUNT`. Text speed, battle scene, sound, print and frame
|
||||
are stored only.
|
||||
- New `OPTIONS` profile table and OW option constants, verified by
|
||||
`check:reference` (decimal literals: the checker skips `0b` values, which
|
||||
a deliberately wrong `TEXT_DELAY_MED` confirmed).
|
||||
- UI: `#options` panel, labels in a fixed column; checked at desktop and
|
||||
390px widths.
|
||||
|
||||
Checks: 413 unit tests with the local ROM (134 passed, 279 skipped without
|
||||
it; new `tests/options.test.ts` and a Set-mode test in
|
||||
`tests/battle-switch.test.ts`); 119 Chromium/WebKit browser tests passed,
|
||||
19 skipped intentionally (a new options flow in both browsers); native and
|
||||
reference builds; reference, vendor and release checks; `git diff --check`.
|
||||
No emulator comparison; no CI or physical-device run.
|
||||
|
||||
Next: the Fly map and Teleport/Dig/Escape Rope warps (board #25), which
|
||||
need script commands after a warp; then Headbutt and Rock Smash (#26).
|
||||
Reference in new issue
Block a user