Skip to content
Draft
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
Expand Up @@ -12,6 +12,7 @@
#define PokemonAutomation_PokemonFRLG_BikeSpinMechanics_H

#include "Common/Cpp/Time.h"
#include "Pokemon/Navigation/Pokemon_MoveMechanics.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
Expand All @@ -28,7 +29,7 @@ namespace MovementMechanics{
// of the motion on screen) held "west 16 (open)" for 17 or 18 tiles on
// Route 8 (08.03 run 2). Not the decompilation's 4 frames a tile (67ms):
// the bike speeds up from rest.
inline constexpr Milliseconds BIKE_TILE_TIME(100);
inline constexpr Milliseconds BIKE_TILE_TIME = Pokemon::FRLG_MOVE_MECHANICS.bike->tile.across;

// On the Bicycle a tap never only turns the player: from rest, a 40ms tap
// moved a tile facing either way, and holds of 112, 150, 200, 250, 300,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <cstddef>
#include "Common/Cpp/Time.h"
#include "Pokemon/Navigation/Pokemon_MoveMechanics.h"
#include "PokemonFRLG_MovementStepPresses.h"
#include "PokemonFRLG_MovementTurnPresses.h"

Expand All @@ -44,10 +45,10 @@ namespace MovementMechanics{
// The game.

// Walking: a tile per 16 frames at 60 fps (console B, 2026-11-09).
inline constexpr Milliseconds TILE_TIME(267);
inline constexpr Milliseconds TILE_TIME = Pokemon::FRLG_MOVE_MECHANICS.walk.tile.across;
// Running with B held: a tile per 8 frames (console B, 2026-11-02, video
// of run 04.01).
inline constexpr Milliseconds RUN_TILE_TIME(133);
inline constexpr Milliseconds RUN_TILE_TIME = Pokemon::FRLG_MOVE_MECHANICS.run.tile.across;
// Surfing: a tile per 8 frames.
inline constexpr Milliseconds SURF_TILE_TIME(133);
// The longest tap measured to only turn a player facing another way, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <cstddef>
#include "Common/Cpp/Time.h"
#include "Pokemon/Navigation/Pokemon_MoveMechanics.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
Expand All @@ -21,10 +22,10 @@ namespace MovementMechanics{
// The release between a leg's hold and what comes next.
inline constexpr Milliseconds STEP_RELEASE(100);
// A one-step tap (step_once()).
inline constexpr Milliseconds STEP_TAP(66);
inline constexpr Milliseconds STEP_TAP = Pokemon::FRLG_MOVE_MECHANICS.step_tap;
// The release after a step tap: the next one starts STEP_TAP +
// STEP_TAP_RELEASE after it, past the lockout.
inline constexpr Milliseconds STEP_TAP_RELEASE(700);
inline constexpr Milliseconds STEP_TAP_RELEASE = Pokemon::FRLG_MOVE_MECHANICS.step_tap_release;


// How long the overworld must show nothing (no box, fade or battle) after
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <cstddef>
#include "Common/Cpp/Time.h"
#include "Pokemon/Navigation/Pokemon_MoveMechanics.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
Expand All @@ -19,7 +20,7 @@ namespace MovementMechanics{


// Turns a player facing another way, without a step.
inline constexpr Milliseconds TURN_TAP(40);
inline constexpr Milliseconds TURN_TAP = Pokemon::FRLG_MOVE_MECHANICS.turn_tap;
// How long to wait after a turn tap for the turn to show.
inline constexpr Milliseconds TURN_SETTLE(300);
// How many taps turn_to() tries before it takes the player as turned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <string_view>
#include "Common/Cpp/Time.h"
#include "PokemonFRLG_MovementMechanics.h"
#include "Pokemon/Navigation/Pokemon_MoveMechanics.h"
#include "PokemonFRLG_OverworldRoute.h"

namespace PokemonAutomation{
Expand Down Expand Up @@ -59,9 +60,9 @@ struct SimEncounter{
// detection delays (OverworldInterrupt::detection_delay()) are its guesses
// at these.
struct SimTiming{
Milliseconds tile = MovementMechanics::TILE_TIME;
Milliseconds tile = Pokemon::FRLG_MOVE_MECHANICS.walk.tile.across;
// A tile on the Bicycle.
Milliseconds bike_tile = MovementMechanics::BIKE_TILE_TIME;
Milliseconds bike_tile = Pokemon::FRLG_MOVE_MECHANICS.bike->tile.across;
Milliseconds flash{300};
Milliseconds battle_screen{3700};
// A wild battle's text box, before the HP boxes (battle_screen). Not
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Overworld Walk

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

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=851 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -28,6 +28,7 @@
#include "PokemonFRLG_OverworldBike.h"
#include "PokemonFRLG_BikeSpinMechanics.h"
#include "PokemonFRLG_BikeSpinPresses.h"
#include "Pokemon/Navigation/Pokemon_MoveMechanics.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
Expand Down Expand Up @@ -196,15 +197,16 @@
if (step.surfing){
return SURF_TILE_TIME;
}
const Pokemon::MoveMechanics& game = Pokemon::FRLG_MOVE_MECHANICS;
switch (step_speed(step, speed)){
case MoveSpeed::RUN:
return RUN_TILE_TIME;
return game.run.tile.along(step.direction);
case MoveSpeed::BIKE:
return BIKE_TILE_TIME;
return game.bike->tile.along(step.direction);
case MoveSpeed::WALK:
break;
}
return TILE_TIME;
return game.walk.tile.along(step.direction);
}

bool turns_first(const RouteStep& step, MoveSpeed speed, std::optional<Direction> facing){
Expand Down
Loading