Ring with trainers' calls, rematch them and play the radio (Closes #30)
Checks / web (push) Successful in 2m38s
Private ROM checks / private-rom (push) Successful in 20m37s

Every registered trainer's callee and caller scripts run, with the
missing specials and commands (RandomPhoneWildMon, RandomUnseenWildMon,
swarms, gettrainerclassname, Kenji's break, the Blue Card and Buena's
password variables). Fight counts are saved, so rematches and gifts work
on every open map, and the daily reset clears the phone's flags.

Random calls follow CheckPhoneCall and the 20/10/5/3-minute call timer;
received calls ring twice with the caller's name, and calls play their
ringing, hang-up and no-signal sounds. Grass and fishing swarms use the
swarm tables.

The radio ports PlayRadioShow and every station frame by frame, with its
music: the Pokégear's radio card tunes by knob, house radios play through
MapRadio, and Buena's show takes the day's password for Blue Card points
that her receptionist exchanges for prizes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kawaandClaude Opus 5.5 committed 2026-10-16 11:10:02 +02:00
1 parent 7f30c3f450
commit 7c12c81a27
21 files changed
+2021 -64

No files matched your search

+15 -3
View File
@@ -25,6 +25,7 @@ The emulator-backed prototype is now at `/reference.html`. The default applicati
| The Battle Tower | Done |
| Wild and trainer battles, capture and the catching tutorial | Done for the areas that are open |
| Music and sound effects (Web Audio) | Done (no move animation sounds) |
| The phone's trainers, random calls, rematches and the radio | Done |
| 1. Complete the overworld foundation | Done |
| 2. Opening story and first battle slice | Mostly done |
| 3. Complete Crystal | In progress (Johto done) |
@@ -207,7 +208,7 @@ The numbered sections below keep their full scope. Each one opens with a checkli
- Calls follow `PokegearPhone_MakePhoneCall` and `MakePhoneCallFromPokegear`: "You're out of the service area." without service; otherwise two "……" rings, then `PhoneOutOfAreaScript` outside the callee's hours, `PhoneScript_JustTalkToThem` on the callee's map, or the callee script from `PhoneContacts`. The script runs on the start menu's draft, so its changes commit with the menu. The call ends with `HangUp`'s "Click!" and boops. Elm's and Mom's callee scripts run; trainer contacts are not reachable yet.
- Mom's savings: `wMomsMoney` is saved as `momsMoney` (migrated by absence to 0). The interpreter gained `givemoney`, `takemoney`, `checkmoney` and `getmoney` for both accounts, `getcurlandmarkname`, `getlandmarkname` and `random`. After the catching lesson, calling Mom runs her lecture, which sets `ENGINE_MOM_SAVING_MONEY` on a yes; later calls report where the player is and her balance. While she saves, a won trainer battle sends a quarter of the prize to her (`WinTrainerBattle.give_money`, "Sent some to MOM!"), unless her account is full.
- `HangUp` now shows "Click!" for its 20 frames and the boops' "……" for the remaining 120, instead of "Click!" for twice the whole duration.
- Not ported: the radio card (it is only obtainable in Goldenrod; it gives a notice); trainer callee scripts; random incoming calls; ringtones, music and the original card graphics.
- Since board #30: the radio card, trainer callee and caller scripts, random incoming calls and the ringing are ported (see below); the original card graphics are not.
## Implemented: Mom's bank and her purchases
@@ -469,7 +470,18 @@ The numbered sections below keep their full scope. Each one opens with a checkli
- Scripts: `playmusic`, `musicfadeout`, `playmapmusic`, `dontrestartmapmusic`, `cry` and `waitsfx` (which wait, frozen, as the original's busy loops do), `playsound`, `warpsound`, `specialsound` and `encountermusic`; the specials `RestartMapMusic`, `FadeOutMusic`, `PlayMapMusic`, `WaitSFX`, `PlaySlowCry`, `PlayCurMonCry` and `HealMachineAnim` (a sound per Poké Ball, MUSIC_HEAL, and its 30-frame and 80-frame waits); the text commands' fanfares (`TextSFX`). Text is shown a page at a time, so a sound started after text plays when its page appears.
- Battles: `PlayBattleMusic`'s choice (wild by time and region, Rockets, gym leaders, rivals, the Champion, the roaming beasts), the wild Pokémon's and each sent-out Pokémon's cry from its side, fainting (`SFX_KINESIS`, `SFX_FAINT`, the player's cry), `PlayVictoryMusic`, the capture music, `SFX_RUN`, the low HP tone (`CheckDanger` with `ComputeHPBarPixels`) and the map's music again after `reloadmapafterbattle`.
- Elsewhere: the intro's music and Wooper's cry, the talk and menu clicks (`PlayTalkObject`, `PromptButton`, `MenuClickSound`), `SFX_MENU`, bumping into walls, ledges, warps, Strength's boulders, the Bicycle's and Surf's music, the evolution music, cries and jingles, the Pokédex's cries and CRY, the PCs' boot, choice and shutdown sounds, the marts' transactions and the healing items' sounds.
- Not presented yet: move animations' sounds (there are no move animations), the experience bar, Poké Ball throws and wobbles, the Game Corner's and Unown puzzle's sounds, the battle transition, the radio and phone ringing (board #30), and the main menu and title music (there is no title screen). Physical phones are not tested (manual card).
- Not presented yet: move animations' sounds (there are no move animations), the experience bar, Poké Ball throws and wobbles, the Game Corner's and Unown puzzle's sounds, the battle transition, and the main menu and title music (there is no title screen). Physical phones are not tested (manual card).
## Implemented: the phone's trainers, random calls and the radio (board #30)
- Every registered trainer's callee and caller scripts run (`engine/phone/scripts`): their news, bragging and lost-Pokémon stories (`RandomPhoneMon`, `RandomPhoneWildMon`, `RandomUnseenWildMon` with its morning-list bug), rematch requests, gift offers, swarms (`swarm`, `ActivateFishingSwarm`), Kenji's break (`VAR_KENJI_BREAK`, a 3-6 day countdown at the daily reset) and Buena. New commands: `swarm`, `gettrainerclassname`; `readvar` reads the Blue Card balance, Buena's password and Kenji's break, and `writevar` sets the balance. A sweep runs every contact's callee and caller scripts under many flag and clock states without a refusal.
- Rematches: the trainers' fight counts (`w*FightCount`) are saved, and every registered trainer on an open map battles again, gives gifts or talks when ready (`tests/phone.test.ts` drives all of them through five fight counts). `CheckDailyResetTimer` now also clears the daily rematch, phone gift and phone time-of-day flags.
- Random calls (`CheckTimeEvents`' `CheckPhoneCall`): not on a doorway, after `CheckReceiveCallTimer`'s 20, 10, 5 then 3 minutes (restarted at every load, as `StartMap` does), half the time, with service, from a registered caller whose calling hours include now and who is not on this map. `Script_ReceivePhoneCall` rings twice (`RingTwice_StartCall`: `SFX_CALL` with the caller's name box shown, cleared and shown again), runs the caller script and hangs up with `SFX_HANG_UP`. Mom's and Bill's calls name their caller too. Outgoing calls ring with `SFX_CALL`, and `SFX_NO_SIGNAL` without service.
- Swarms: Dunsparce's and Yanma's grass swarms use `SwarmGrassWildMons` on the map a trainer named (`_SwarmWildmonCheck`), and the Qwilfish and Remoraid fishing swarms switch the fish group (`GetFishGroupIndex`).
- The radio (`game/scripts/radio.ts`): `PlayRadioShow` and every station frame by frame: Oak's Pokémon Talk (routes, Pokémon, adverbs and adjectives, the Pokémon Channel jingle), the Pokédex Show, Pokémon Music and Let's All Sing (march or lullaby by weekday), the Lucky Channel (with `CheckLuckyNumberShowFlag`), Places and People, Buena's Password (from 6 PM, the day's password; midnight and off-air texts), Team Rocket's broadcast during the takeover, and the Unown, Poké Flute and Lake of Rage stations' music. Lines show for 100 frames and scroll as `PrintRadioLine` and `RadioScroll` do. Station songs become the map music and keep playing after the radio is left, as in the original (`ExitPokegearRadio_HandleMusic`).
- The Pokégear's radio card runs every frame: up and down turn the knob by two, `RadioChannels` picks the station the place can hear (Johto, the Ruins, the Lake of Rage area, Kanto with the EXPN card). House radios (`Radio1Script`, `Radio2Script`) run `MapRadio`: the station's name in quotes for 100 frames, then the station until A or B.
- Buena's show at the Radio Tower: `AskRememberPassword`, `BuenasPassword` (the category's three words, B disabled) and `BuenaPrize` (prizes and points beside the Blue Card balance, confirm, pay, receive). Tests: `tests/phone.test.ts` (rematches, a random call, no call without a caller, the daily reset, swarms, each station's lines and music, the radio card, a house radio, Buena's password and prizes) and `tests/radio-browser.spec.ts` (the radio card in the browser).
- Not ported: the radio card's tuning dial graphics (the frequency is shown as text), holding up or down to turn the knob continuously, the Poké Flute channel waking Snorlax (Kanto is closed), and calls that use the mobile adapter.
## Native battles: current state
@@ -587,7 +599,7 @@ Acceptance: main-game/postgame playthroughs, representative optional content, ba
- [x] Touch battle commands, move list, PKMN party menu, PACK (Items and Balls pockets) and naming fields
- [x] Start menu, party menu and pack outside battle (switching, moves, held items, healing and PP items, tossing, the Bicycle)
- [x] Bill's PC: MOVE PKMN W/O MAIL between the party and every box
- [x] Pokégear clock, map and phone cards (the radio card waits for its stations)
- [x] Pokégear clock, map, phone and radio cards
- [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
- [x] Options screen, with the battle style and menu account in effect