Skip to content

Commit

Permalink
Simple implementation for AntiLagSwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
florianessl committed Mar 3, 2024
1 parent 1696ae8 commit ab232d1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/game_config_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void Game_ConfigGame::LoadFromArgs(CmdlineParser& cp) {
patch_common_this_event.Lock(false);
patch_key_patch.Lock(false);
patch_rpg2k3_commands.Lock(false);
patch_anti_lag_switch.Lock(false);
patch_override = true;
continue;
}
Expand All @@ -105,6 +106,11 @@ void Game_ConfigGame::LoadFromArgs(CmdlineParser& cp) {
patch_key_patch.Set(true);
} else if (v == "rpg2k3-cmds" || v == "rpg2k3-commands") {
patch_rpg2k3_commands.Set(true);
} else if (v.rfind("anti-lag-switch=") == 0) {
int num = static_cast<int>(std::strtol(v.substr(16).c_str(), nullptr, 0));
if (num > 0) {
patch_anti_lag_switch.Set(num);
}
}
}
patch_override = true;
Expand Down Expand Up @@ -151,4 +157,8 @@ void Game_ConfigGame::LoadFromStream(Filesystem_Stream::InputStream& is) {
if (patch_rpg2k3_commands.FromIni(ini)) {
patch_override = true;
}

if (patch_anti_lag_switch.FromIni(ini)) {
patch_override = true;
}
}
1 change: 1 addition & 0 deletions src/game_config_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct Game_ConfigGame {
BoolConfigParam patch_unlock_pics{ "Unlock Pictures", "Allow picture commands while a message is shown", "Patch", "PicUnlock", false };
BoolConfigParam patch_key_patch{ "Ineluki Key Patch", "Support \"Ineluki Key Patch\"", "Patch", "KeyPatch", false };
BoolConfigParam patch_rpg2k3_commands{ "RPG2k3 Event Commands", "Enable support for RPG2k3 event commands", "Patch", "RPG2k3Commands", false };
ConfigParam<int> patch_anti_lag_switch{ "Anti-Lag Switch", "Disable event page refreshes when switch is set", "Patch", "AntiLagSwitch", 0 };

// Command line only
BoolConfigParam patch_support{ "Support patches", "When OFF all patch support is disabled", "", "", true };
Expand Down
4 changes: 4 additions & 0 deletions src/game_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,10 @@ void Game_Map::SetPositionY(int y, bool reset_panorama) {
}

bool Game_Map::GetNeedRefresh() {
if (Player::game_config.patch_anti_lag_switch.Get() && Main_Data::game_switches->Get(Player::game_config.patch_anti_lag_switch.Get())) {
return false;
}

return need_refresh;
}

Expand Down
6 changes: 4 additions & 2 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,8 @@ void Player::CreateGameObjects() {
}
}

Output::Debug("Patch configuration: dynrpg={} maniac={} key-patch={} common-this={} pic-unlock={} 2k3-commands={}",
Player::IsPatchDynRpg(), Player::IsPatchManiac(), Player::IsPatchKeyPatch(), game_config.patch_common_this_event.Get(), game_config.patch_unlock_pics.Get(), game_config.patch_rpg2k3_commands.Get());
Output::Debug("Patch configuration: dynrpg={} maniac={} key-patch={} common-this={} pic-unlock={} 2k3-commands={} anti-lag-switch={}",
Player::IsPatchDynRpg(), Player::IsPatchManiac(), Player::IsPatchKeyPatch(), game_config.patch_common_this_event.Get(), game_config.patch_unlock_pics.Get(), game_config.patch_rpg2k3_commands.Get(), game_config.patch_anti_lag_switch.Get());

ResetGameObjects();

Expand Down Expand Up @@ -1403,6 +1403,8 @@ Engine options:
pic-unlock - Pictures are not blocked by messages
rpg2k3-cmds - Support all RPG Maker 2003 event commands
in any version of the engine
anti-lag-switch=[switch-id]
- Disable event page refreshes via switch
--no-patch Disable all engine patches.
--project-path PATH Instead of using the working directory, the game in PATH
is used.
Expand Down

0 comments on commit ab232d1

Please sign in to comment.