Skip to content

Commit 9154831

Browse files
committed
New Command - SetGameSpeed
To use it, write in Maniacs TPC: `@raw 2049, "", speedIsVar, speed` e.g.: `@raw 2049, "", 0,12` The command must be inserted inside a parallel process, because `Game_Clock::SetGameSpeedFactor(speed);` only changes the speed at current frame. Any refactor (to improve how it's called or to hide the speed counter) is welcome.
1 parent ad6e823 commit 9154831

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/game_interpreter.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,8 @@ bool Game_Interpreter::ExecuteCommand(lcf::rpg::EventCommand const& com) {
821821
return CommandManiacSetGameOption(com);
822822
case Cmd::Maniac_CallCommand:
823823
return CommandManiacCallCommand(com);
824+
case static_cast<Game_Interpreter::Cmd>(2049) : //Cmd::Easy_SetGameSpeed
825+
return CommandSetGameSpeed(com);
824826
default:
825827
return true;
826828
}
@@ -4643,6 +4645,12 @@ bool Game_Interpreter::CommandManiacCallCommand(lcf::rpg::EventCommand const&) {
46434645
return true;
46444646
}
46454647

4648+
bool Game_Interpreter::CommandSetGameSpeed(lcf::rpg::EventCommand const& com) {
4649+
int32_t speed = ValueOrVariable(com.parameters[0], com.parameters[1]);
4650+
Game_Clock::SetGameSpeedFactor(speed);
4651+
return true;
4652+
}
4653+
46464654
Game_Interpreter& Game_Interpreter::GetForegroundInterpreter() {
46474655
return Game_Battle::IsBattleRunning()
46484656
? Game_Battle::GetInterpreter()

src/game_interpreter.h

+1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ class Game_Interpreter
284284
bool CommandManiacChangePictureId(lcf::rpg::EventCommand const& com);
285285
bool CommandManiacSetGameOption(lcf::rpg::EventCommand const& com);
286286
bool CommandManiacCallCommand(lcf::rpg::EventCommand const& com);
287+
bool CommandSetGameSpeed(lcf::rpg::EventCommand const& com);
287288

288289
int DecodeInt(lcf::DBArray<int32_t>::const_iterator& it);
289290
const std::string DecodeString(lcf::DBArray<int32_t>::const_iterator& it);

0 commit comments

Comments
 (0)