From 60dc35bb7b74583616b63a54476d72a859dc85a6 Mon Sep 17 00:00:00 2001 From: Ghabry Date: Sun, 13 Aug 2023 15:35:31 +0200 Subject: [PATCH] Debug scene: Add option to set the hero movement speed --- src/scene_debug.cpp | 20 ++++++++++++++++++++ src/scene_debug.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/scene_debug.cpp b/src/scene_debug.cpp index 50dfaca9fa..032963e976 100644 --- a/src/scene_debug.cpp +++ b/src/scene_debug.cpp @@ -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(); @@ -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", !is_battle); addItem("Call BtlEvent", is_battle); @@ -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(); @@ -772,6 +786,12 @@ void Scene_Debug::DoLevel() { Pop(); } +void Scene_Debug::DoMoveSpeed() { + Main_Data::game_player->SetMoveSpeed(Utils::Clamp(GetFrame().value, 1, 7)); + + Pop(); +} + void Scene_Debug::DoCallCommonEvent() { const auto ceid = GetFrame(0).value; diff --git a/src/scene_debug.h b/src/scene_debug.h index 4d35c29fd7..d039607d9b 100644 --- a/src/scene_debug.h +++ b/src/scene_debug.h @@ -64,6 +64,7 @@ class Scene_Debug : public Scene { eMap, eFullHeal, eLevel, + eMoveSpeed, eCallCommonEvent, eCallMapEvent, eCallBattleEvent, @@ -107,6 +108,7 @@ class Scene_Debug : public Scene { void DoMap(); void DoFullHeal(); void DoLevel(); + void DoMoveSpeed(); void DoCallCommonEvent(); void DoCallMapEvent(); void DoCallBattleEvent();