Skip to content

Commit

Permalink
RPG_RT.ini Flags - VarMin and VarMax
Browse files Browse the repository at this point in the history
Usage inside RPG_RT.ini:
VarMin=-100
VarMax=100
  • Loading branch information
jetrotal committed Oct 21, 2023
1 parent 1f14e3e commit d7f6f23
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ namespace Player {
int message_box_offset_x = (screen_width - MENU_WIDTH) / 2;
bool has_custom_resolution = false;

int32_t iniVars_min = 0;
int32_t iniVars_max = 0;

bool exit_flag;
bool reset_flag;
bool debug_flag;
Expand Down Expand Up @@ -729,6 +732,10 @@ void Player::CreateGameObjects() {
Player::screen_height = ini.GetInteger("RPG_RT", "WinH", SCREEN_TARGET_HEIGHT);
Player::has_custom_resolution = true;
}
if (ini.HasValue("RPG_RT", "VarMin")) Player::iniVars_min = ini.GetInteger("RPG_RT", "VarMin", 0);
else Player::iniVars_min = 0;
if (ini.HasValue("RPG_RT", "VarMax")) Player::iniVars_max = ini.GetInteger("RPG_RT", "VarMax", 0);
else Player::iniVars_max = 0;
}
}
}
Expand Down Expand Up @@ -884,22 +891,24 @@ void Player::ResetGameObjects() {
Main_Data::game_switches = std::make_unique<Game_Switches>();
Main_Data::game_switches->SetLowerLimit(lcf::Data::switches.size());

auto min_var = lcf::Data::system.easyrpg_variable_min_value;
auto min_var = (iniVars_min != 0) ? iniVars_min : lcf::Data::system.easyrpg_variable_min_value;
if (min_var == 0) {
if (Player::IsPatchManiac()) {
min_var = std::numeric_limits<Game_Variables::Var_t>::min();
} else {
min_var = Player::IsRPG2k3() ? Game_Variables::min_2k3 : Game_Variables::min_2k;
}
}
auto max_var = lcf::Data::system.easyrpg_variable_max_value;
auto max_var = (iniVars_max != 0) ? iniVars_max : lcf::Data::system.easyrpg_variable_max_value;
if (max_var == 0) {
if (Player::IsPatchManiac()) {
max_var = std::numeric_limits<Game_Variables::Var_t>::max();
} else {
max_var = Player::IsRPG2k3() ? Game_Variables::max_2k3 : Game_Variables::max_2k;
}
}

Output::Debug("\n\nVariables Range: min {}, max {}\n", min_var, max_var);
Main_Data::game_variables = std::make_unique<Game_Variables>(min_var, max_var);
Main_Data::game_variables->SetLowerLimit(lcf::Data::variables.size());

Expand Down

0 comments on commit d7f6f23

Please sign in to comment.