Skip to content

Commit

Permalink
Merge pull request EasyRPG#3123 from EasyRPG-NewFeatures/NewCommand-T…
Browse files Browse the repository at this point in the history
…oggleFlags

New Command: 2053 - Set Interpreter Flag
  • Loading branch information
Ghabry authored May 13, 2024
2 parents 56c239d + 70794e8 commit 12599cf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,8 @@ bool Game_Interpreter::ExecuteCommand(lcf::rpg::EventCommand const& com) {
return CommandManiacControlStrings(com);
case Cmd::Maniac_CallCommand:
return CommandManiacCallCommand(com);
case static_cast<Game_Interpreter::Cmd>(2053): //Cmd::EasyRpg_SetInterpreterFlag
return CommandEasyRpgSetInterpreterFlag(com);
default:
return true;
}
Expand Down Expand Up @@ -5108,6 +5110,35 @@ bool Game_Interpreter::CommandManiacCallCommand(lcf::rpg::EventCommand const& co
return true;
}

bool Game_Interpreter::CommandEasyRpgSetInterpreterFlag(lcf::rpg::EventCommand const& com) {
if (!Player::HasEasyRpgExtensions()) {
return true;
}

// FIXME: Store them as part of the interpreter state

std::string flag_name = Utils::LowerCase(ToString(com.string));
int flag_value = ValueOrVariable(com.parameters[0], com.parameters[1]);

if (flag_name == "dynrpg")
Player::game_config.patch_dynrpg.Set(flag_value);
if (flag_name == "maniac")
Player::game_config.patch_maniac.Set(flag_value);
if (flag_name == "common-this")
Player::game_config.patch_common_this_event.Set(flag_value);
if (flag_name == "pic-unlock")
Player::game_config.patch_unlock_pics.Set(flag_value);
if (flag_name == "key-patch")
Player::game_config.patch_key_patch.Set(flag_value);
if (flag_name == "rpg2k3-cmds" || flag_name == "rpg2k3-commands")
Player::game_config.patch_rpg2k3_commands.Set(flag_value);

if (flag_name == "rpg2k-battle")
lcf::Data::system.easyrpg_use_rpg2k_battle_system = flag_value;

return true;
}

Game_Interpreter& Game_Interpreter::GetForegroundInterpreter() {
return Game_Battle::IsBattleRunning()
? Game_Battle::GetInterpreter()
Expand Down
1 change: 1 addition & 0 deletions src/game_interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ class Game_Interpreter
bool CommandManiacSetGameOption(lcf::rpg::EventCommand const& com);
bool CommandManiacControlStrings(lcf::rpg::EventCommand const& com);
bool CommandManiacCallCommand(lcf::rpg::EventCommand const& com);
bool CommandEasyRpgSetInterpreterFlag(lcf::rpg::EventCommand const& com);

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

0 comments on commit 12599cf

Please sign in to comment.