Skip to content

Commit

Permalink
Merge pull request #3074 from Ghabry/debug-speed
Browse files Browse the repository at this point in the history
Debug scene: Add option to set the hero movement speed
  • Loading branch information
fdelapena authored Sep 19, 2023
2 parents 322b8c3 + 60dc35b commit ea74470
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/scene_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,15 @@ void Scene_Debug::vUpdate() {
PushUiVarList();
}
break;
case eMoveSpeed:
if (sz > 1) {
DoMoveSpeed();
} else {
PushUiNumberInput(Main_Data::game_player->GetMoveSpeed(), 1, false);
range_index = 0;
range_window->SetIndex(range_index);
}
break;
case eCallCommonEvent:
if (sz > 2) {
DoCallCommonEvent();
Expand Down Expand Up @@ -508,6 +517,7 @@ void Scene_Debug::UpdateRangeListWindow() {
addItem("Full Heal");
addItem("Level");
} else {
addItem("Move Speed", !is_battle);
addItem("Call ComEvent");
addItem("Call MapEvent", Scene::Find(Scene::Map) != nullptr);
addItem("Call BtlEvent", is_battle);
Expand Down Expand Up @@ -572,6 +582,10 @@ void Scene_Debug::UpdateRangeListWindow() {
case eLevel:
addItem("Level");
break;
case eMoveSpeed:
addItem("Move Speed");
addItem("Range: 1-7");
break;
case eCallBattleEvent:
if (is_battle) {
auto* troop = Game_Battle::GetActiveTroop();
Expand Down Expand Up @@ -772,6 +786,12 @@ void Scene_Debug::DoLevel() {
Pop();
}

void Scene_Debug::DoMoveSpeed() {
Main_Data::game_player->SetMoveSpeed(Utils::Clamp<int>(GetFrame().value, 1, 7));

Pop();
}

void Scene_Debug::DoCallCommonEvent() {
const auto ceid = GetFrame(0).value;

Expand Down
2 changes: 2 additions & 0 deletions src/scene_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Scene_Debug : public Scene {
eMap,
eFullHeal,
eLevel,
eMoveSpeed,
eCallCommonEvent,
eCallMapEvent,
eCallBattleEvent,
Expand Down Expand Up @@ -107,6 +108,7 @@ class Scene_Debug : public Scene {
void DoMap();
void DoFullHeal();
void DoLevel();
void DoMoveSpeed();
void DoCallCommonEvent();
void DoCallMapEvent();
void DoCallBattleEvent();
Expand Down

0 comments on commit ea74470

Please sign in to comment.