Skip to content

Commit 414914e

Browse files
committed
Added new game config for enabling MoveRoute debugging
1 parent 802ffee commit 414914e

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

src/game_config_game.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ void Game_ConfigGame::LoadFromArgs(CmdlineParser& cp) {
177177

178178
continue;
179179
}
180+
if (cp.ParseNext(arg, 0, { "--debug-routes", "--debug-move-routes" })) {
181+
debug_moveroutes.Set(true);
182+
continue;
183+
}
180184

181185
cp.SkipNext();
182186
}
@@ -229,6 +233,8 @@ void Game_ConfigGame::LoadFromStream(Filesystem_Stream::InputStream& is) {
229233
if (patch_direct_menu.FromIni(ini)) {
230234
patch_override = true;
231235
}
236+
237+
debug_moveroutes.FromIni(ini);
232238
}
233239

234240
void Game_ConfigGame::PrintActivePatches() {

src/game_config_game.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct Game_ConfigGame {
4848
BoolConfigParam patch_rpg2k3_commands{ "RPG2k3 Event Commands", "Enable support for RPG2k3 event commands", "Patch", "RPG2k3Commands", false };
4949
ConfigParam<int> patch_anti_lag_switch{ "Anti-Lag Switch", "Disable event page refreshes when switch is set", "Patch", "AntiLagSwitch", 0 };
5050
ConfigParam<int> patch_direct_menu{ "Direct Menu", " Allows direct access to subscreens of the default menu", "Patch", "DirectMenu", 0 };
51+
BoolConfigParam debug_moveroutes{ "Debug MoveRoutes", "Generate Interpreter warnings whenever \"MoveRoute\" commands are blocked", "Game", "DebugMoveRoutes", false };
5152

5253
// Command line only
5354
BoolConfigParam patch_support{ "Support patches", "When OFF all patch support is disabled", "", "", true };

src/game_interpreter.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ void Game_Interpreter::Update(bool reset_loop_count) {
456456
}
457457

458458
if (_state.wait_movement) {
459-
if (ShouldAssertMoveRoutes()) {
459+
if (Player::game_config.debug_moveroutes.Get()) {
460460
Debug::AssertBlockedMoves(main_flag);
461461
}
462462
if (Game_Map::IsAnyMovePending()) {
@@ -5887,10 +5887,3 @@ bool Game_Interpreter_Inspector::IsInActiveExcecution(Game_CommonEvent const& ce
58875887
}
58885888
return ce.interpreter && ce.interpreter->IsRunning();
58895889
}
5890-
5891-
bool Game_Interpreter::ShouldAssertMoveRoutes() const {
5892-
//FIXME: Needs liblcf update
5893-
//return (main_flag && (_state.easyrpg_debug_flags & lcf::rpg::SaveEventExecState::DebugFlags_warn_on_blocked_movement_main) > 0)
5894-
// || (!main_flag && (_state.easyrpg_debug_flags & lcf::rpg::SaveEventExecState::DebugFlags_warn_on_blocked_movement_parallel) > 0);
5895-
return true;
5896-
}

src/game_interpreter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ class Game_Interpreter : public Game_BaseInterpreterContext
130130
/** @return true if wait command (time or key) is active. Used by 2k3 battle system */
131131
bool IsWaitingForWaitCommand() const;
132132

133-
bool ShouldAssertMoveRoutes() const;
134133
protected:
135134
static constexpr int loop_limit = 10000;
136135
static constexpr int call_stack_limit = 1000;

src/player.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,11 @@ Debug options:
15491549
--start-position X Y Overwrite the party start position and move the party to
15501550
position (X, Y).
15511551
Incompatible with --load-game-id.
1552+
--debug-routes This option enables a range of asserts whenever a
1553+
scripting stack is halted due to a WaitForAllMovement
1554+
command. If the Interpreter is not able to resume operation,
1555+
due to a blocked route, detailed warnings will be printed to
1556+
the output.
15521557
--test-play Enable TestPlay (Debug) mode.
15531558
15541559
Other options:

0 commit comments

Comments
 (0)