Commit Graph

1001 Commits

Author SHA1 Message Date
bryanthaboi 079e9776bb more online fix attempts 2026-09-24 13:22:09 -04:00
bryanthaboi ff69ff7878 another one 2026-09-24 11:45:50 -04:00
bryanthaboi a3251d10d5 little clean up for mystery gifts 2026-09-24 11:24:20 -04:00
bryanthaboi 6fdff58b3d online fixes 2026-09-24 10:31:07 -04:00
bryanthaboi 72a17b27dd CLOSES #2444 2026-09-24 08:39:43 -04:00
bryanthaboi d51bdaff72 CLOSES #2441, CLOSES #2445, CLOSES #2448, CLOSES #2450 2026-09-24 06:24:54 -04:00
bryanthaboi 9335be1bbd online update 2026-09-24 05:17:32 -04:00
Colson Rice 833bee64b2 Keep the field effects upright when a render pipeline owns the world
endFrame composites a world override mirrored on LOVE 12, because a
pipeline's own projection pre-flips Y. ctx.drawFx puts the standing
effects into that same canvas as ordinary 2D, so the mirror inverts them
instead of righting them: a trainer's "!" draws upside down, below its
feet, on the mirrored half of the screen.

The condition is now Renderer.mirrorsWorldOverride, named because it is
not only the blit's business, and ctx.drawFx runs its block under the
matching mirror about the bound canvas. project() is left alone: it
already answers in screen rows.
2026-09-23 19:30:25 -04:00
bryanthaboi 8a3f8424f5 Merge pull request #2406 from thibautbus/feat/game3-japanese-rom-font
Draw Japanese text in FireRed with the cart's own Japanese fonts
2026-09-23 16:44:04 -04:00
bryanthaboi 2a09429699 Merge pull request #2434 from bryanthaboi/feat/game3-mods
feat(game3): in-game MODS entry with FRLG-styled mod manager
2026-09-23 16:44:00 -04:00
bryanthaboi c9c20d361e Merge remote-tracking branch 'origin/dev' into pr-2406
# Conflicts:
#	src/import/gba/versions.lua
2026-09-23 16:43:55 -04:00
bryanthaboi d2fdd3becc Merge remote-tracking branch 'origin/dev' into feat/game3-mods
# Conflicts:
#	src/ui/game3/start_menu.lua
2026-09-23 16:41:24 -04:00
bryanthaboi d408c9d78f Merge remote-tracking branch 'origin/dev' into pr-2442
# Conflicts:
#	src/core/game3/scripting/natives_seagallop.lua
2026-09-23 16:37:33 -04:00
bryanthaboi 123feef3a1 CLOSES #2425, CLOSES #2428, CLOSES #2431, CLOSES #2432, CLOSES #2433, CLOSES #2435, CLOSES #2436, CLOSES #2437, CLOSES #2440
CLOSES #2425, CLOSES #2428, CLOSES #2431, CLOSES #2432, CLOSES #2433, CLOSES #2435, CLOSES #2436, CLOSES #2437, CLOSES #2440
2026-09-23 16:34:15 -04:00
1jamie 8621d024dc feat(game3): implement roaming legendary beasts, Seagallop ferry, field weather, and overworld fixes
- Implement roaming legendary beast system (Raikou, Entei, Suicune) matching pokefirered (src/roamer.c), including 31-cap IV fix, Roar despawn fix, battle flee logic, and trapping interactions (Mean Look, Shadow Tag, Arena Trap, Wrap).
- Implement Seagallop ferry crossing cutscene and transit between Sevii Islands and Kanto.
- Implement field weather engine, weather extraction, and particle rendering.
- Implement renewable hidden items and step events.
- Fix poison step sound effect (SE_FIELD_POISON).
- Fix encounter cooldown lookup for grass/cave terrain.
- Add comprehensive test suites for roamers, weather, Seagallop animations, and ladders.
2026-09-23 13:46:57 -05:00
thibautbus 7e96172391 Space and cut FireRed Japanese text the way the cart does
A Japanese glyph advances by its width plus the window's letter spacing,
which a Latin one ignores (pokefirered/src/text.c:853): 1 for the normal
font (new_menu_helpers.c:413, the field message printer), 0 for the small
one (gFontInfos, new_menu_helpers.c:65). The engine already adds that
spacing, but only to a string carrying the {JPN} control code a ROM-
extracted one does; a mod's Japanese text has none, so its kana ran a pixel
tighter per character than on the cart. A glyph drawn from a Japanese sheet
now takes the window's spacing either way, and only once, falling back to
the message printer's spacing when the window sets none.

Name limits count characters (PLAYER_NAME_LENGTH, POKEMON_NAME_LENGTH), but
the start menu, the continue screen and the PC's hovered-mon panel cut names
with string.sub, in bytes. A kana is three bytes, so a five-kana species name
lost two characters in the PC and a Japanese player name was cut inside a
character. FrlgFont.truncate cuts by UTF-8 character, and those sites use it;
Latin names are cut as before, and an accented Latin name, whose accented
letters are two bytes, is no longer cut short either.
2026-09-23 18:23:27 +02:00
thibautbus 3252a3f2c9 Draw Japanese text in FireRed with the cart's own Japanese fonts
game3 prints every string with the US cart's Latin font, and FrlgFont has
no glyph for a kana, so a Japanese translation of FireRed would print
blank. The US cart still carries its Japanese fonts, which its text
printer draws for a string in Japanese mode (pokefirered/src/text.c:141,
:227): pret builds them into the US ROM, with the normal font's width
table.

The font extractor now bakes both, the normal font from its eight-to-a-row
layout (DecompressGlyph_Normal, text.c:1452) with its widths and the small
one sixteen to a row (DecompressGlyph_Small, text.c:1372), as
chrome/fonts/japanese_{normal,small}_{fg,shadow}.rgba and
japanese_widths.lua. LeafGreen's addresses follow the same -0x24 shift as
the rest of text.o. Cache version 120 re-imports existing caches.

FrlgFont numbers a Japanese character by its byte in the Japanese block of
pokefirered/charmap.txt (kana 01-A0, the full-width space, !?。ー), plus
the symbols the font keeps at the Latin block's codes in their full-width
forms (digits, letters, 『』「」, 円, /, :), offset past the Latin
glyphs. A character with no Latin glyph draws from the Japanese sheet, at
the width the cart gives it (the table for the normal font, 8px for the
small one). Latin text is drawn as before.
2026-09-23 18:07:32 +02:00
bryanthaboi dee935a4ea CLOSES #2430 2026-09-23 11:58:32 -04:00
Shane McGovern 2454173ac6 feat(game3): in-game MODS entry with FRLG-styled mod manager
Add a gated MODS row to the FireRed/LeafGreen start menu and an always-on
MODS row in the option menu. Both open a manager on the game3 stack that
reuses ManagerState behavior (list, detail, options, staged apply, profiles)
and draws with FRLG chrome. Nested name/quantity prompts route to the Gen 3
naming screen and a quantity dialog; APPLY & RESTART returns to the title.
2026-09-23 15:15:44 +01:00
bryanthaboi eaedbccb3b skip game3 trade rules test when no rom cache 2026-09-23 06:00:44 -04:00
bryanthaboi ebbf4709c8 CLOSES #2411, CLOSES #2418, CLOSES #2420, CLOSES #2422, CLOSES #2423, CLOSES #2424 2026-09-23 05:51:05 -04:00
bryanthaboi 18661d45a1 Merge branch 'dev' of https://github.com/bryanthaboi/gen1recomp into dev 2026-09-22 20:44:23 -04:00
bryanthaboi a446147787 CLOSES #2408, CLOSES #2413, CLOSES #2414, CLOSES #2415, CLOSES #2416, CLOSES #2417, CLOSES #2419 2026-09-22 20:44:21 -04:00
bryanthaboi 1c13c4c0d6 Merge pull request #2398 from thibautbus/fix/game3-trainer-class-ids
Recognise FireRed trainer classes by id, not by their name
2026-09-22 20:12:50 -04:00
bryanthaboi 2a463da06b Merge pull request #2400 from thibautbus/fix/game3-unicode-braille
Let FireRed braille messages take Unicode braille cells
2026-09-22 20:12:40 -04:00
1jamie 6a0e10ec66 fix(test): resolve test runner stubs, cache loaders, and thread yield handling 2026-09-22 18:53:24 -05:00
1jamie f2a75271b0 Merge upstream/dev into grandpas-garage and resolve switch_seq conflict 2026-09-22 18:41:25 -05:00
1jamie ce8a2d3777 Fix battle EXP distribution, party status badges, pacing trainer sight, and LeafGreen launcher colors 2026-09-22 18:32:26 -05:00
1jamie 249d321082 Implement Old Man battle tutorial and S.S. Anne departure cutscene with accurate pret timing and OAM layering 2026-09-22 17:20:31 -05:00
bryanthaboi d920f7acdb clean up 2026-09-22 17:05:12 -04:00
bryanthaboi 9208d83a28 Merge branch 'dev' into pr-2409
# Conflicts:
#	src/ui/game3/save_menu.lua
2026-09-22 16:41:00 -04:00
1jamie 109a87c81c fix(game3): fix BGM silence after fanfares during battle and overworld dialog
- Preserve active track voices in Player.stopAt after fast-forward catchup
- Add start-from-0 fallback in Player.stopAt when at timestamp predates the retained snaps ring
- Mute m4a worker during stopAt pause so it does not synthesize empty buffers while fanfare plays
- Ensure Audio.resumeBgm calls Source:play on bgmSource if stopped
2026-09-22 15:37:18 -05:00
bryanthaboi 23617f43b4 CLOSES #2290, CLOSES #2338, CLOSES #2186, CLOSES #2305, CLOSES #2332, CLOSES #2320, CLOSES #2344, CLOSES #2291, CLOSES #2335, CLOSES #2340, CLOSES #2385, CLOSES #2352, CLOSES #2378, CLOSES #2403, CLOSES #2404, CLOSES #2405, CLOSES #2367, CLOSES #2037, CLOSES #2177, CLOSES #2368, CLOSES #2382, CLOSES #1951
CLOSES #2290, CLOSES #2338, CLOSES #2186, CLOSES #2305, CLOSES #2332, CLOSES #2320, CLOSES #2344, CLOSES #2291, CLOSES #2335, CLOSES #2340, CLOSES #2385, CLOSES #2352, CLOSES #2378, CLOSES #2403, CLOSES #2404, CLOSES #2405, CLOSES #2367, CLOSES #2037, CLOSES #2177, CLOSES #2368, CLOSES #2382, CLOSES #1951
2026-09-22 16:27:28 -04:00
Shane McGovern a5014826cd fix(game3): multichoice cart-arity fallback and tint boundary coverage
The wave-3 tint batch as its own commit, so the harness fold before it stays
reviewable on its own.

multichoice.lua: Multichoice.COUNTS is the live option-count source for the
cart - 65 of 65 entries match pret's src/script_menu.c, where
ScriptMenu_MultichoiceGrid reads sMultichoiceLists[id].list and .count
(:915-930).  The table is load-bearing in a ROM-less run: with no import
cache present there is nothing else to ask how many options a list has.

adapters.lua: the multichoice operand reader no longer treats row[4] as an
option count.  pret asm/macros/event.inc:893-899 lays the command out as
x, y, multichoiceId, ignoreBPress - four bytes and no count field - so the
old read shifted the operand stream and every later decode in the command
went wrong with it.

tests/game3_photo_tint_boundary_test.lua: pins the cache-miss arity fallback
and the yield behaviour it rests on, which is the BUG2 root cause.  Run
twice green; the existing tint suite still passes 33/33 alongside it.
2026-09-22 19:24:52 +01:00
Shane McGovern 3cf9e23178 test: fold the harness and parity-seam fixes into one gate-hardening commit
Ships the CI fix together with the test-harness work that supports it, so
every tier stays honest on every machine.

scripts/test.sh
- T6 records missing-artifact failures as skips when no imported game3 data
  exists at all (empty CI identity, no data/generated): the data-driven
  top-level suites assert instead of self-skipping on a fresh runner.  The
  skipped suite names are printed with that reason; with data present the
  same failure gates exactly as before.
- The T3 content verdict now weighs the exit code and the FAIL-line allowlist
  together.  The exit code used to be discarded, so a mid-run crash
  (unresolvable require under POKEPORT_DATA_DIR) printed green checks, zero
  FAIL lines, and passed.  A non-zero exit with no FAIL line is reported as a
  crash with the error line captured - a crash is not a pass.

Test-suite fixes, each run green (several twice)
- tests/run_tests.lua: restore per-suite leaked state and add the Data seam,
  so one suite's loaded data cannot leak into the next.
- tests/mod_runtime_tests.lua: save and restore the environment around each
  case.
- tests/parity_ss_anne_rooms.lua: _loadModule raw-order fix (30/30).
- tests/parity_ss_anne_departure.lua: the Data seams plus the playMap stub.
- playMap stubs for parity_rival_walkoff, parity_tower_rival,
  parity_silph_rival_bug2241 and parity_ss_anne_guard.
- Class-B seams in mod_registry_tests, mod_catalog_tests, mod_ui_tests,
  parity_ball_shake_anim, parity_wavy_screen, parity_hidden_coins_bcd_bug1810,
  parity_mart_stock and parity_rocket3_sight_bug1814.

Together these close the 57 failing checks that were on the content tier
(allowlist stays at 0), so a content run on a machine with imports ends
ALL TESTS PASSED.
2026-09-22 19:17:22 +01:00
Shane McGovern 59886d9639 fix(game3): PC panel species scope fix and trainer-card var key fallback
Three follow-ups to the merge snapshot, kept as their own commit so the
review of the wave commit stays intact:

- The PC panel's left data panel broke in the merge: upstream inlines the
  egg-aware species read into frontPic while the M8 dedup had removed the
  duplicate local, so `sp` was referenced with no binding and the luacheck
  gate failed. One shared local sp = Pokemon.speciesOrEgg(hoveredMon) serves
  both the TV sprite and the stats card
  (pokefirered/src/pokemon_storage_system_data.c:1034, :1057,
  MON_DATA_SPECIES_OR_EGG).
- Trainer-card vars fall back to the stringified key: persist_sidecar and
  Flags.serialize write tostring(id) keys into session.vars, so a numeric miss
  used to read every var as 0.
- tests/game3_trainer_card_photo_tint_test.lua drives the whole Game Corner
  photo -> card tint chain (setvar -> UpdateTrainerCardPhotoIcons ->
  Flags.serialize/loadInto -> cardData) and pins c.monIconTint/c.monSpecies.
2026-09-22 18:38:24 +01:00
Shane McGovern 72f083f0c4 Merge remote-tracking branch 'upstream/dev' into nexhas28/gen3-review-v3-fixes
# Conflicts:
#	src/core/game3/save_schema_firered.lua
#	src/core/game3/scripting/natives.lua
#	src/import/RomExtractorGen3.lua
#	src/import/gba/versions.lua
2026-09-22 18:28:33 +01:00
Shane McGovern 41935aa2a2 fix(game3): wave 2 - 118 review fixes, seam work, and the gate to 282 suites
Second batch of the Gen 3 review work: the review lanes closed their queues
and the test gate grew with them.

Review census: 139 routed findings -- 118 fixed, 14 invalid (the report had
Gen 4+ semantics in more than one place), 6 struck as stale after
re-verification, 1 re-routed. Every fix carries its own pret citation in
docs/game3/review-v3-triage.md; the E10 opcode closure is itemised in
docs/game3/e10-opcode-spec.md (18 ops wired, 2 reclassified to the seam class).

Representative ROM-grounded changes:
- The POKéMON start-menu entry is now gated on FLAG_SYS_POKEMON_GET the way
  retail does it (pokefirered/src/start_menu.c:217-218, flag 0x828).
- Money ops read their amount raw and gate the change on the disable byte
  (pokefirered/src/scrcmd.c:1798-1830, pokefirered/asm/macros/event.inc:1166-1186);
  random and the warp family VarGet theirs
  (pokefirered/src/scrcmd.c:455-461, :719-731).
- The HM table matches FRLG: there is no Whirlpool HM
  (pokefirered/include/constants/items.h:411-418).
- The day-care party-full guard follows src/daycare.c:525, :1081.
- Knock Off keeps its battle-scoped send-out mask
  (pokefirered/src/battle_script_commands.c:2730-2752, :4489), carried from
  the first batch.

Structural work: the I6/I9/J1 architecture items landed as seams (profile
selector, capability flags, font provider, virtual-object layer), the adopted
footprint register keeps a KEEP verdict, the quantizer target is met, and the
30 drain items plus carves 1-4 are folded in.

Tests: T6 now runs 282 top-level suites (273 + 9 new), the re-sweep ends at
267 pass / 0 fail, the engine tier is 634 suites, modkit 37, and the full
gate ran green twice with T3 active on an imported Red cache. Documented
skips are the lua5.4 oversize-save oracle where lua5.4 is absent and the
config-partials listed in docs/game3/game3-artifact-conversions-v3.md.

Docs shipped: review-v3-triage.md, e10-opcode-spec.md, rse-seams.md,
game3-suite-sweep-v113.md, game3-artifact-conversions-v3.md,
test-baseline-v3.md (plus the first-batch docs already on the branch).
2026-09-22 18:23:06 +01:00
bryanthaboi 081787d614 Fix Gen 3 mod target expectations for LeafGreen 2026-09-22 11:49:50 -04:00
bryanthaboi 4bdb97fc8d Merge branch 'dev' of https://github.com/bryanthaboi/gen1recomp into dev 2026-09-22 11:44:52 -04:00
bryanthaboi 8356fdd8e1 othe rbig changes 2026-09-22 11:44:50 -04:00
bryanthaboi 29359ab039 Merge pull request #2360 from sergiomele97/fix/thunderAccuracyUnderWeather
fix(SecondGen): adds accuracy override for thunder under weather conditions
2026-09-22 10:26:36 -04:00
bryanthaboi 9308439697 Merge pull request #2370 from bryanthaboi/nexhas28-fix-gen2-encounters-unknown-id
Close Gold's encounters id space so an unknown id fails the mod (#2369)
2026-09-22 10:25:51 -04:00
thibautbus 2701b930d8 Let FireRed braille messages take Unicode braille cells
Braille.encode spells a braille message from Latin letters, through
Braille.CODE and the Latin charmap byte of any other character. That
covers the US cart, but the European carts' braille lines use cells no
character reaches: German ä (dots 3-4-5), the full cell, dot 5 alone. A
translation mod therefore cannot hand over the German, Spanish or Italian
braille, and the 39 lines of the Dotted Hole, Ruin Valley and Mt. Ember
stay in English in every language.

pret's braille font holds every dot combination
(pokefirered/include/characters.h:282), so Braille.encode now draws a
Unicode braille character (U+2800-U+283F) as that very cell, mapping
Unicode's dot bits to the cart's cell numbering (dot 1 = 0x01, 4 = 0x02,
2 = 0x04, 5 = 0x08, 3 = 0x10, 6 = 0x20). A cell spells its own number sign,
as the carts' braille does. Latin text is spelled as before.
2026-09-22 15:57:49 +02:00
bryanthaboi 21c868b90a leafgreen 2026-09-22 09:56:36 -04:00
thibautbus 5ad701022b Pick the FireRed Elite Four and champion transitions by class id
BattleTransition.pickTrainer told the Elite Four and the champion by class
names ("ELITE_FOUR", "CHAMPION", "RIVAL") or by class ids 57 and 58, and
the Elite Four members by trainer ids 412-419. None of these is
FireRed's: TRAINER_CLASS_ELITE_FOUR is 87, TRAINER_CLASS_CHAMPION 90, and
Lorelei, Bruno, Agatha and Lance are trainers 410-413 (735-738 for the
rematch). The bridge also never passed the class, so these battles always
got the terrain transition. The bridge now hands over the foe's class id
and pickTrainer follows GetTrainerBattleTransition
(pokefirered/src/battle_setup.c:624): the Elite Four member's own
transition, BLUE for the champion, and none for the rival's class (a
caller's isRival flag still asks for BLUE).

A Trainer Tower or e-Reader foe carries a facility class instead, whose
numbers overlap the trainer classes (FACILITY_CLASS_LASS is 90, the
champion's class), and pret never picks their transition by class
(battle_setup.c:660), so pickTrainer ignores the class for them.
2026-09-22 15:28:54 +02:00
thibautbus fa0ab3621f Record FireRed gym, Elite Four and champion wins by class id
The quest log told a gym leader, Elite Four or champion win from the
trainer's class name ("LEADER", "ELITE FOUR", "CHAMPION"). With a
translated class every such win fell back to the plain trainer event, and
in French, where the gym LEADER class reads CHAMPION, every gym win would
be logged as a champion battle. pret switches on the class id
(pokefirered/src/quest_log_battle.c:25); the battle state now keeps the
trainer's class id next to its name, and the recorder reads it.
2026-09-22 15:20:31 +02:00
thibautbus 1c2a7d64de Give the FireRed rival and champion the rival's name by class id
Trainers.info gave a trainer the player's chosen rival name only when its
class was called "RIVAL". A mod that translates the class (RIVALE in
German and Italian) made the rival battle as the ROM's placeholder TERRY,
and the champion, whose class is CHAMPION, was always TERRY. pret's
B_TXT_TRAINER1_NAME names TRAINER_CLASS_RIVAL_EARLY, _RIVAL_LATE and
_CHAMPION by the rival's name (pokefirered/src/battle_message.c:2078);
Trainers.info now does the same, by class id.
2026-09-22 15:20:31 +02:00
bryanthaboi 351b7b3cbb Merge pull request #2396 from thibautbus/fix/game3-egg-nickname 2026-09-22 07:38:18 -04:00
bryanthaboi 35f02cc5d2 CLOSES #2394 2026-09-22 07:36:16 -04:00