Commit Graph

938 Commits

Author SHA1 Message Date
1jamie aed3bbced7 fix(game3): battle animation timing, RNG parity, pokedex habitats, multichoice UI and overworld events
- Battle Animation Pipeline:
  * Eliminate 90-frame audio polling stall in anim_vm end/waitsound opcodes,
    allowing attack animations to transition instantly into target hit flicker
    and HP bar drain.
  * Correct visual task counting in AnimVm:visualCount to match pret gAnimVisualTaskCount.
  * Signal bg task completion on restorebg (vm.args[7] = -1).
  * Fix termination conditions on shake tasks (ShakeMon, ShakeMon2, ShakeBattleTerrain),
    WaterSport droplet arcs, and StartSinAnimTimer.
  * Handle RGB555 color args in start_blend_anim_sprite_color and route P.destroyTask
    to AnimTasks.destroy.

- RNG System & Seeding Parity:
  * Replace math.random in Party.giveMon with Rng.Random32() for personality values
    and Rng.Random() for IV bitfield extraction (HP/Atk/Def/Spe/SpA/SpD) matching GBA format.
  * Seed RNG on Title Screen A/Start press via Rng.seedNewGame() (matching SeedRngAndSetTrainerId)
    and perturb RNG state on title menu inputs.
  * Route NPC overworld idle/wander timers and wild encounter slot rolls through Rng.compat.

- Pokédex Habitat & Area Maps:
  * Fix encounter tables extraction and map indexing to resolve Pokemon habitat
    locations across Kanto/Sevii maps rather than showing Area Unknown.
  * Render steady semi-transparent red overlays for Pokédex area map locations.

- Multichoice Menus & UI:
  * Implement multichoice table extraction and data population for Viridian blackboard
    status ailments and special dialog interactions.
  * Improve choice box borders, pagination, and Town Map wall viewing.

- Overworld Events & Flags:
  * Fix Route 1 entrance girl NPC spawning and script triggers after starter selection.
  * Ensure consistent save reload state in Oak's Lab.
2026-09-19 01:30:46 -05:00
1jamie d95960b2f1 fixes undefined vars 2026-09-18 20:47:35 -05:00
1jamie 03db72b70e Fixed evolution soft lock
fixed keyboard special keys highlighting
fixed audio flow for evolution
fixed town map
fixed pause menu not pausing tick
2026-09-18 20:44:18 -05:00
bryanthaboi 7279ce57c1 Update WorldAPI.lua 2026-09-18 17:23:21 -04:00
bryanthaboi b2a1fc8f0d beta 2026-09-18 17:19:05 -04:00
bryanthaboi 425a762491 Merge branch 'bryanthaboi:dev' into grandpas-garage 2026-09-18 17:08:49 -04:00
bryanthaboi 661d75ef1c junk 2026-09-18 16:49:48 -04:00
bryanthaboi bdfac727aa bing bang bong 2026-09-18 15:42:32 -04:00
bryanthaboi 96d23ab93b battle stuff 2026-09-18 13:11:33 -04:00
bryanthaboi 9e9a54cbb4 oaky baby 2026-09-18 09:12:33 -04:00
bryanthaboi c86cf40e73 perfected intro babbyyyyy 2026-09-18 08:28:29 -04:00
bryanthaboi b9ba8b3ee4 addl api capabilities 2026-09-18 07:53:42 -04:00
bryanthaboi c8bfac84f9 havok fixes and what not 2026-09-17 12:26:56 -04:00
bryanthaboi 4c3212538b Merge PR #1: restore FireRed object interaction text
From Nexhas28, 1Jamie/gen1recomp-gaia#1, branch firered-object-interactions.
2026-09-17 11:22:31 -04:00
bryanthaboi dfc0b05436 namign screen fix 2026-09-17 11:07:33 -04:00
bryanthaboi dbe0c5c9f0 all the fun features 2026-09-17 10:51:09 -04:00
bryanthaboi 84d0ea8616 audio update and return to launcher 2026-09-17 09:42:08 -04:00
bryanthaboi a820875208 Merge remote-tracking branch 'upstream/dev' into grandpas-garage 2026-09-17 08:26:26 -04:00
Shane McGovern 1629922f48 feat(game3): restore FireRed object interaction text 2026-09-17 11:24:47 +01:00
1jamie 5900359c39 Fix M4A CGB channel priority tuning dissonance and trainer encounter audio flow 2026-09-16 18:35:52 -05:00
Shane McGovern 4010857a32 feat(game3): add FireRed help system and quest log
Add ROM-backed contextual L/R help with article navigation and safe pause/resume. Record recent field scenes and gameplay events for the skippable Continue recap, with playback isolated from live progress.

Integrate extraction and cache validation, preserve bundled script flags during import, and cover navigation, persistence, event recording, playback isolation, and both ROM revisions with tests.
2026-09-16 22:28:13 +01:00
bryanthaboi e2114f7c85 importers / lttp example 2026-09-16 16:42:59 -04:00
bryanthaboi de1415de51 Merge pull request #2284 from campavao/rfc-0021-link-battle-items
engine: opts.items — items on the link cable, for a mode that asks (RFC 0021)
2026-09-16 09:53:39 -04:00
bryanthaboi 8c8581ed0c CLOSES #2089, CLOSES #2198, CLOSES #2227, CLOSES #2246, CLOSES #2277, CLOSES #2278, CLOSES #2280, CLOSES #2281, CLOSES #2282, CLOSES #2283, CLOSES #2286 2026-09-16 09:45:20 -04:00
1jamie ff18f605c2 fix(game3): start player item PC with single Potion 2026-09-15 17:06:11 -05:00
1jamie 06dd4ffba8 game3: add fanfare/emote parity, pause & main menu exit flows, and bump fr cache 2026-09-15 15:41:51 -05:00
DESKTOP-8SRFDDM\cam95 dd2a1f89ff engine: opts.items -- items on the link cable, for a mode that asks (RFC 0021)
A link battle runs under cable rules and LinkBattle keeps them: openItems
prints "Items can't be used in a link battle!" and the wire knows move,
struggle, locked, switch and RUN.  Right for the Cable Club, wrong for a
mode that is not the Cable Club -- a battle royale played over
LinkState.newFromSession fights with real, damaged parties, and the
potions and X items on the ground are its whole economy; against a bot
the bag works, against a person it says no.  The mode cannot fix it:
submit, resolveLockstep and the decoder are closures, and there is no
action that means "nothing" to spend the turn on.

opts.items = true on newHost/newGuest (off by default, set on both
machines like turnLimit): the bag is BattleState.openItems -- the vanilla
BagMenu against this battle, whose picker already offers the clamped
copies -- and the effect is ItemEffects.use as in any fight.  What
changes is what spending the turn means: itemUsed puts { kind = "item",
item, index, move } on the wire as the turn's action instead of running
the AI's reply.  Both machines and a spectator resolve it before switches
and moves: the user's side is already applied (the bag did it), the other
side applies the same effect to its own copies of that side through
src/link/LinkItems.lua -- ItemEffects.use behind a battle whose player is
the user's battler and a save whose party is the user's copies, nothing
consumed -- and prints "<name> used <ITEM>!" plus the effect's lines.
Every effect reachable in a battle is deterministic, so the per-turn
hash still agrees.  BagMenu hands itemUsed the item, target and move it
used; a local battle ignores them.  A ball on the cable is refused
(ItemEffects), the way the doll is in any trainer battle.

tests/engine/link_items.lua: cable rules by default; opted in, the host's
POTION heals the guest's copy before the moves, both print the lines,
one turn, hashes agree; a spectator fed the same two messages heals its
copy too.  docs/modding.md and docs/rfcs/0021-link-battle-items.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 08:19:06 -05:00
1jamie b67fb745fa feat(game3): battle anim engine parity, sub-containers, town map, and party menu fixes 2026-09-13 20:07:53 -05:00
bryanthaboi 0292d8eeb0 Merge pull request #2271 from AverageConsumer/codex/gen2-mirrored-menu-render-fix 2026-09-13 12:01:42 -04:00
bryanthaboi feec1d43fd CLOSES #2235, CLOSES #2245, CLOSES #2252, CLOSES #2253, CLOSES #2257, CLOSES #2261, CLOSES #2262, CLOSES #2263, CLOSES #2264, CLOSES #2267, CLOSES #2268, CLOSES #2272, CLOSES #2273, CLOSES #2274, CLOSES #2275 2026-09-13 11:49:05 -04:00
bryanthaboi d615ad39ab bazinga 2 2026-09-13 03:34:39 -04:00
bryanthaboi acdcbd8d4d bazinga 2026-09-13 01:06:04 -04:00
AverageConsumer e90ab09d6f Skip redundant Gen 2 panel draws beneath mirrored menus 2026-09-12 18:20:51 +02:00
1jamie 65badd1a4b fix(game3): fix learn-move show and pump for both battle and party contexts
Two contexts call LearnMove.begin with different pushMsg semantics:
- Battle (Ui.push): single-arg, ignores callback -> pump() must poll
  Ui.dialogPending() to wait for the player to dismiss the message
- Party menu / rare candy (PartyMenu.showMessage): honours the callback,
  calling it when the player presses A -> finish() must fire inline

Fix: set _pending='done' for the pump() path (battle) AND restore the
say() callback for the direct path (party menu). A guard on _pending
prevents double-finish. pump() now checks Ui.dialogPending() before
acting on 'done' so the 'X learned Y!' message stays visible until
the player dismisses it in both contexts.
2026-09-11 17:02:16 -05:00
1jamie dc9d5c74c7 fix(game3): fix level-up move learn soft lock when mon has free move slots
LearnMove.begin's free-slot path called say(text, cb) expecting pushMsg
to invoke the callback once the message is dismissed. The battle UI's
hooks.pushMsg is Ui.push which only accepts (text) and silently drops
the callback, so finish(ok) was never called, LearnMove._active stayed
true forever → soft lock (reported as Charmander learning Ember).

Fix: set _pending="done" + _pendingResult before say() so pump() can
complete the sequence on the next update tick once the dialog drains,
matching how the 4-move full path already uses _pending="delete".
The say() callback is still wired so contexts whose pushMsg does honour
it (party_menu TM flow) finish inline as before.
2026-09-11 16:50:56 -05:00
Code-Grub 4bd44050ec Give mon menu icons the trueColor opt-out
A full-colour icon pack renders white with purple blotches on any screen
that declares an SGB palette zone, and only in ADVANCED. Colour there is
applied after the frame is drawn: a shader reads each pixel's red channel
and swaps in one of four palette colours. That suits the game's own art,
which is already four greys. Full-colour art is not. A yellow body is
nearly all high red, so it clears 0.83 and comes back as colour 0, white in
every palette, while the darker pixels land in colour 2, which MEWMON
paints {115,33,165}.

Art that should be left alone says so with a trueColor flag and is re-blit
unshaded. Battle pics, trainer portraits and overworld sprites all carry
one. Menu icons had no way to. The icons record has no such field, and
Sprites.iconPath returned a path alone where Sprites.path and
Sprites.playerPic both return path, trueColor. Nowhere to put the flag and
nothing to read it, so the art always met the shader.

R.sprites is the precedent for allowing it. Overworld walkers are OBJ art
drawn through an OBJ palette, the same hardware class as a menu icon, and
they carry the flag already.

iconPath now takes the record's flag through opts and returns it, and a
pokemon.icon hook may set ctx.trueColor for art it substitutes, which is
the contract pokemon.sprite already has.

PartyMenu.drawIcon skips the OBP bake for flagged art and reports its
covering rect. The bake matters as much as the shader does: obpIcon is
itself a four-shade remap on the red channel, so it flattens full-colour
art before the zone pass ever runs. The flag overrides `name` rather than
being read beside it, because a hook can substitute full-colour art for a
species that resolved to a built-in class through icons.byDex, leaving name
set. The entry-shape split from #274 does not catch that case.

The reported rect is 16x16 for the two OAM-block branches and the file's
own size for single-frame art, matching what each branch actually draws.

No vanilla icon record sets the flag, so both rect buckets stay empty on a
vanilla boot and the zone lists stay exactly the ones the states returned.
2026-09-11 11:55:52 -04:00
1jamie 0ec555b25b feat(android): update application ID for development and add FireRed manifest support
- Change application ID to 'com.theboisclub.pokemonred.dev' for development builds.
- Introduce FireRed manifest handling in build scripts and ensure its validation during packaging.
- Update various scripts to include FireRed resources in the build process.
- fixed a lot of the cachefs extraction to work on android
2026-09-11 10:41:37 -05:00
bryanthaboi e6ee9aeee7 CLOSES #2120 2026-09-11 09:11:34 -04:00
1jamie b06d8bc99c feat(game3): battle animation VM rendering architecture, full ROM extraction, evolution scene, and UI refinements 2026-09-10 20:12:29 -05:00
bryanthaboi dccc90ead7 CLOSES #1709, CLOSES #2202, CLOSES #2217, CLOSES #2234, CLOSES #2237, CLOSES #2238, CLOSES #2239, CLOSES #2240, CLOSES #2241, CLOSES #2242, CLOSES #2243, CLOSES #2244, CLOSES #2247, CLOSES #2248, CLOSES #2249, CLOSES #2250, CLOSES #2251 2026-09-10 17:50:42 -04:00
1jamie 0c55d1d32f feat(game3): align battle flow, transitions, and animations 1:1 with pret pokefirered
- Add spinning rotation to Pokeball throw animations
- Align enemy trainer send-out sequence and concurrent slide-out
- Fix battle intro terrain parking to prevent initial frame position snapping
- Initiate battle BGM immediately on transition start matching retail FRLG
- Extract authentic red dialogue prompt down-arrow from ROM
- Split battle terrain background wallpaper from transparent platform ovals
- Fix faint, exp, and shift-switch sequencing order
2026-09-10 13:05:01 -05:00
1jamie 6874e3705b feat(game3): extract ROM trainers, line-of-sight sight check, dialogues, and battle rewards
- Add full 743 trainer ROM extraction from gTrainers with 4-tier party struct support
- Account for flat IV scaling math ((rawIv * 31) / 255) and enforce 0 EVs for trainer Pokémon
- Decompose 32-bit AI script flags for runtime execution
- Implement backwards-search fallback for boss dialogue disconnect (0x1, 0x3, 0x9)
- Implement TrainerSight line-of-sight raycast with elevation & ledge masking and spinning trainer turn hooks
- Support pre-battle intro dialogue, encounter music, and in-battle defeat quotes
- Implement authentic prize money calculation and reward triggering
- Fix move name resolution for table-wrapped party moves in battle UI and party menus
2026-09-09 18:19:45 -05:00
1jamie 4f1877daae fix(game3): fix surf blob animation/palette, cut effects, and tree canopy path collision 2026-09-09 17:13:41 -05:00
1jamie 2426e519b2 bit of fixes for door transition and stub placeholders for field moves 2026-09-09 16:37:01 -05:00
1jamie ce0edb6994 fix(host): close iOS branch in HostShell.restart 2026-09-09 15:06:15 -05:00
1jamie 342e80b963 fix(game3): safely resolve harborVar in space.lua to prevent nil table index on new game 2026-09-09 15:02:51 -05:00
1jamie 1c173a6377 feat(game3): make extraction and runtime 100% self-contained and ROM-derived
- Implement pure ROM extraction for Trainer Card backgrounds and badges
- Connect TrainerCardExtract to RomExtractorGen3 and CacheContract
- Update TrainerCard, FrlgFont, Chrome, PcChrome, PokedexChrome, and SummaryChrome to route exclusively through CacheFs
- Remove all legacy fallback paths to src/import/gba/chrome and hardcoded pret directories
- Add standalone procedural fallbacks for field effects and Pokecenter heal
2026-09-09 14:56:34 -05:00
1jamie 432c8bb4d7 feat(game3): pure ROM extractor for FRLG text fonts, widths, and dialogue chrome 2026-09-09 14:42:27 -05:00
1jamie dcb18bd34e fix(launcher): balance GBA cart sizing and margins in game panel 2026-09-09 14:20:09 -05:00
1jamie c860065e4a feat(launcher): configure GBA cart shape and FireRed label art for launcher 2026-09-09 14:18:26 -05:00