Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Overworld Sim

Check warning on line 1 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=997 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -355,7 +355,7 @@

// The player has taken `step`, pressed at `pressed`. Returns whether the
// game stopped them there: a warp, a trainer, a wild battle.
bool OverworldSim::after_step(const Step& step, Milliseconds pressed){

Check warning on line 358 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::OverworldSim::after_step( const Step & step , Milliseconds pressed): function_lines=35 (advisory above 25, limit 50)
const SimTiming& timing = m_script.timing;
if (step.warped && black_without_warp(pressed)){
return true;
Expand All @@ -377,7 +377,10 @@
}
m_frozen = true;
schedule(pressed + timing.tile, SimScreen::FADE, false);
schedule(pressed + timing.tile + timing.fade, SimScreen::OVERWORLD, true);
schedule(pressed + timing.tile + timing.fade, SimScreen::OVERWORLD, timing.fade_in == 0ms);
if (timing.fade_in > 0ms){
schedule(pressed + timing.tile + timing.fade + timing.fade_in, SimScreen::OVERWORLD, true);
}
note("warped to " + to_string(m_state.position) + ".");
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ struct SimTiming{
std::optional<Milliseconds> battle_wipe;
Milliseconds message{400};
Milliseconds fade{1000}; // from the step's end to the new map
// From the fade's end, the new map fades in this long, and the game
// takes no input yet (fault-class sweep; BDSP's Center, lab-B
// 2026-11-10). Not measured on FRLG: 0, none.
Milliseconds fade_in{0};
Milliseconds trainer_notice{1000}; // "!" over the trainer, before they walk up
Milliseconds trainer_battle{2000}; // after the trainer's message closes
// From a battle's end on, the game ignores taps this long.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* AutoStory Fault Sweep Tests

Check warning on line 1 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=622 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand All @@ -13,6 +13,9 @@
* land encounters, over GAME_ODDS_SEEDS seeds (08.01's Rock Tunnel).
* - LATE_FADE: every warp's fade ends LATE_FADE later than the sim's
* usual (07.02's warp to Cerulean City).
* - SLOW_FADE_IN: after every warp's fade the new map fades in for
* SLOW_FADE_IN, the game taking no input yet: a fixed wait after a
* fade, then a move (BDSP 00.04b heal_sandgem, lab-B 2026-11-10).
* - DARK_CAVE: the caves without Flash dark (DARK_MAPS), so each
* battle there ends on the dark cave's overworld, with no wild
* battles and with them at the game's odds (08.01 hiker_lenny, lab-B
Expand Down Expand Up @@ -70,6 +73,7 @@
SCENE_END_POSE,
WILD_BATTLES,
LATE_FADE,
SLOW_FADE_IN,
DARK_CAVE,
LOST_TAP,
};
Expand All @@ -81,6 +85,8 @@
return "wild battles at the game's odds";
case FaultClass::LATE_FADE:
return "late warp fade";
case FaultClass::SLOW_FADE_IN:
return "slow fade-in after every warp";
case FaultClass::DARK_CAVE:
return "dark cave without Flash";
case FaultClass::LOST_TAP:
Expand Down Expand Up @@ -116,6 +122,9 @@
// How much later than SimTiming's a late fade ends: the new map shows
// this long after the usual.
constexpr Milliseconds LATE_FADE = 1500ms;
// How long the new map fades in after a warp's fade, taking no input: a
// model, longer than the GBA's fade-in, to find moves made in it.
constexpr Milliseconds SLOW_FADE_IN = 1000ms;

// The maps as the story after the Hall of Fame and a new game flag them:
// the same set for every row, as each stage's tests use.
Expand Down Expand Up @@ -391,6 +400,18 @@
return sweep_result(logger, FaultClass::LATE_FADE, row.id, 1, failures);
}

// Row `row` with every warp's new map fading in for SLOW_FADE_IN.
UnitTestResult sweep_slow_fade_in(Logger& logger, const StoryCheckpoint& row, const RowRun& clean){
SimScript script;
script.timing.fade_in = SLOW_FADE_IN;
const std::string stopped = differs(run_row(row, script, {}, clean.scripted), clean);
std::vector<SweepFailure> failures;
if (!stopped.empty()){
failures.push_back({"", std::format("every warp fading in {} ms", SLOW_FADE_IN.count()), stopped});
}
return sweep_result(logger, FaultClass::SLOW_FADE_IN, row.id, 1, failures);
}

// Row `row` with DARK_MAPS dark: once with no wild battles, then with
// them at the game's odds from DARK_CAVE_SEEDS seeds. Each trainer's
// battle there ends on the dark overworld (battle_end_on_sim() in
Expand Down Expand Up @@ -546,6 +567,8 @@
return sweep_wild_battles(logger, m_row, clean);
case FaultClass::LATE_FADE:
return sweep_late_fade(logger, m_row, clean);
case FaultClass::SLOW_FADE_IN:
return sweep_slow_fade_in(logger, m_row, clean);
case FaultClass::DARK_CAVE:
return sweep_dark_cave(logger, m_row, clean);
case FaultClass::LOST_TAP:
Expand All @@ -565,6 +588,7 @@
{.input = {.fault = FaultClass::SCENE_END_POSE}, .expectation = {}},
{.input = {.fault = FaultClass::WILD_BATTLES}, .expectation = {}},
{.input = {.fault = FaultClass::LATE_FADE}, .expectation = {}},
{.input = {.fault = FaultClass::SLOW_FADE_IN}, .expectation = {}},
{.input = {.fault = FaultClass::DARK_CAVE}, .expectation = {}},
{.input = {.fault = FaultClass::LOST_TAP}, .expectation = {}},
};
Expand Down
Loading