From 1a3f4454a69360f298b8c758f3f40de322377dc8 Mon Sep 17 00:00:00 2001 From: Petr Ohlidal Date: Wed, 1 Sep 2021 08:03:02 +0200 Subject: [PATCH 1/4] :boomerang: Console: `CamelCase()` -> `mixedCase()` --- source/main/gui/panels/GUI_ConsoleView.cpp | 4 +- source/main/gui/panels/GUI_ConsoleWindow.cpp | 8 +- source/main/gui/panels/GUI_ConsoleWindow.h | 2 +- source/main/main.cpp | 14 +- source/main/network/Network.cpp | 2 +- source/main/scripting/ScriptEngine.cpp | 2 +- source/main/system/AppCommandLine.cpp | 6 +- source/main/system/AppConfig.cpp | 14 +- source/main/system/CVar.cpp | 318 +++++++++---------- source/main/system/Console.cpp | 12 +- source/main/system/Console.h | 36 +-- source/main/system/ConsoleCmd.cpp | 18 +- 12 files changed, 218 insertions(+), 218 deletions(-) diff --git a/source/main/gui/panels/GUI_ConsoleView.cpp b/source/main/gui/panels/GUI_ConsoleView.cpp index 1809d3be2e..35fc504c56 100644 --- a/source/main/gui/panels/GUI_ConsoleView.cpp +++ b/source/main/gui/panels/GUI_ConsoleView.cpp @@ -47,7 +47,7 @@ void ConsoleView::DrawConsoleMessages() int num_incoming = this->UpdateMessages(); // Gather visible (non-expired) messages - const unsigned long curr_timestamp = App::GetConsole()->QueryMessageTimer(); + const unsigned long curr_timestamp = App::GetConsole()->queryMessageTimer(); m_display_messages.clear(); std::string last_prefix; for (Console::Message& m: m_filtered_messages) @@ -149,7 +149,7 @@ ImVec2 ConsoleView::DrawMessage(ImVec2 cursor, Console::Message const& m) Str line; GUIManager::GuiTheme& theme = App::GetGuiManager()->GetTheme(); - const unsigned long curr_timestamp = App::GetConsole()->QueryMessageTimer(); + const unsigned long curr_timestamp = App::GetConsole()->queryMessageTimer(); unsigned long overtime = curr_timestamp - (m.cm_timestamp + (cvw_msg_duration_ms - fadeout_interval)); if (overtime > fadeout_interval) diff --git a/source/main/gui/panels/GUI_ConsoleWindow.cpp b/source/main/gui/panels/GUI_ConsoleWindow.cpp index fd8ab5f49e..ab8f05c05c 100644 --- a/source/main/gui/panels/GUI_ConsoleWindow.cpp +++ b/source/main/gui/panels/GUI_ConsoleWindow.cpp @@ -56,7 +56,7 @@ void ConsoleWindow::Draw() ImGui::SetColumnWidth(0, 100); // TODO: Calculate dynamically ImGui::SetColumnWidth(1, 170); // TODO: Calculate dynamically - for (auto& cmd_pair: App::GetConsole()->GetCommands()) + for (auto& cmd_pair: App::GetConsole()->getCommands()) { if (ImGui::Selectable(cmd_pair.second->GetName().c_str())) { @@ -85,7 +85,7 @@ void ConsoleWindow::Draw() const ImGuiInputTextFlags cmd_flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackHistory; if (ImGui::InputText(_LC("Console", "Command"), m_cmd_buffer.GetBuffer(), m_cmd_buffer.GetCapacity(), cmd_flags, &ConsoleWindow::TextEditCallback, this)) { - this->DoCommand(m_cmd_buffer.ToCStr()); + this->doCommand(m_cmd_buffer.ToCStr()); m_cmd_buffer.Clear(); } @@ -98,7 +98,7 @@ void ConsoleWindow::Draw() } } -void ConsoleWindow::DoCommand(std::string msg) // All commands are processed here +void ConsoleWindow::doCommand(std::string msg) // All commands are processed here { Ogre::StringUtil::trim(msg); if (msg.empty()) @@ -114,7 +114,7 @@ void ConsoleWindow::DoCommand(std::string msg) // All commands are processed her } m_cmd_history_cursor = -1; - App::GetConsole()->DoCommand(msg); + App::GetConsole()->doCommand(msg); } int ConsoleWindow::TextEditCallback(ImGuiTextEditCallbackData *data) diff --git a/source/main/gui/panels/GUI_ConsoleWindow.h b/source/main/gui/panels/GUI_ConsoleWindow.h index 8d8b3ad786..d500602a52 100644 --- a/source/main/gui/panels/GUI_ConsoleWindow.h +++ b/source/main/gui/panels/GUI_ConsoleWindow.h @@ -45,7 +45,7 @@ class ConsoleWindow bool IsVisible() const { return m_is_visible; } void Draw(); - void DoCommand(std::string msg); + void doCommand(std::string msg); private: diff --git a/source/main/main.cpp b/source/main/main.cpp index 2833289a43..e48bcd2240 100644 --- a/source/main/main.cpp +++ b/source/main/main.cpp @@ -80,7 +80,7 @@ int main(int argc, char *argv[]) #endif // Create cvars, set default values - App::GetConsole()->CVarSetupBuiltins(); + App::GetConsole()->cVarSetupBuiltins(); // Update cvars 'sys_process_dir', 'sys_user_dir' if (!App::GetAppContext()->SetUpProgramPaths()) @@ -98,19 +98,19 @@ int main(int argc, char *argv[]) App::sys_screenshot_dir->SetStr(PathCombine(App::sys_user_dir->GetStr(), "screenshots")); // Load RoR.cfg - updates cvars - App::GetConsole()->LoadConfig(); + App::GetConsole()->loadConfig(); // Process command line params - updates 'cli_*' cvars - App::GetConsole()->ProcessCommandLine(argc, argv); + App::GetConsole()->processCommandLine(argc, argv); if (App::app_state->GetEnum() == AppState::PRINT_HELP_EXIT) { - App::GetConsole()->ShowCommandLineUsage(); + App::GetConsole()->showCommandLineUsage(); return 0; } if (App::app_state->GetEnum() == AppState::PRINT_VERSION_EXIT) { - App::GetConsole()->ShowCommandLineVersion(); + App::GetConsole()->showCommandLineVersion(); return 0; } @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) #ifndef NOLANG App::GetLanguageEngine()->setup(); #endif // NOLANG - App::GetConsole()->RegBuiltinCommands(); // Call after localization had been set up + App::GetConsole()->regBuiltinCommands(); // Call after localization had been set up App::GetContentManager()->InitContentManager(); @@ -306,7 +306,7 @@ int main(int argc, char *argv[]) { App::GetGameContext()->SaveScene("autosave.sav"); } - App::GetConsole()->SaveConfig(); // RoR.cfg + App::GetConsole()->saveConfig(); // RoR.cfg App::GetDiscordRpc()->Shutdown(); #ifdef USE_SOCKETW if (App::mp_state->GetEnum() == MpState::CONNECTED) diff --git a/source/main/network/Network.cpp b/source/main/network/Network.cpp index b8ab97fdb1..6923b0ec51 100644 --- a/source/main/network/Network.cpp +++ b/source/main/network/Network.cpp @@ -594,7 +594,7 @@ void Network::Disconnect() m_disconnected_users.clear(); m_recv_packet_buffer.clear(); m_send_packet_buffer.clear(); - App::GetConsole()->DoCommand("clear net"); + App::GetConsole()->doCommand("clear net"); m_shutdown = false; App::mp_state->SetVal((int)MpState::DISABLED); diff --git a/source/main/scripting/ScriptEngine.cpp b/source/main/scripting/ScriptEngine.cpp index c21593b688..c3ac3de7e5 100644 --- a/source/main/scripting/ScriptEngine.cpp +++ b/source/main/scripting/ScriptEngine.cpp @@ -91,7 +91,7 @@ ScriptEngine::~ScriptEngine() void ScriptEngine::messageLogged( const String& message, LogMessageLevel lml, bool maskDebug, const String &logName, bool& skipThisMessage) { - RoR::App::GetConsole()->ForwardLogMessage(Console::CONSOLE_MSGTYPE_SCRIPT, message, lml); + RoR::App::GetConsole()->forwardLogMessage(Console::CONSOLE_MSGTYPE_SCRIPT, message, lml); } // continue with initializing everything diff --git a/source/main/system/AppCommandLine.cpp b/source/main/system/AppCommandLine.cpp index 2932c0b8b0..0acbaa1a8a 100644 --- a/source/main/system/AppCommandLine.cpp +++ b/source/main/system/AppCommandLine.cpp @@ -66,7 +66,7 @@ CSimpleOpt::SOption cmdline_options[] = { SO_END_OF_OPTIONS }; -void Console::ProcessCommandLine(int argc, char *argv[]) +void Console::processCommandLine(int argc, char *argv[]) { CSimpleOpt args(argc, argv, cmdline_options); @@ -144,7 +144,7 @@ void Console::ProcessCommandLine(int argc, char *argv[]) } } -void Console::ShowCommandLineUsage() +void Console::showCommandLineUsage() { ErrorUtils::ShowInfo( _L("Command Line Arguments"), @@ -162,7 +162,7 @@ void Console::ShowCommandLineUsage() "For example: RoR.exe -map simple2 -pos '518 0 518' -rot 45 -truck semi.truck -enter")); } -void Console::ShowCommandLineVersion() +void Console::showCommandLineVersion() { ErrorUtils::ShowInfo(_L("Version Information"), getVersionString()); #ifdef __GNUC__ diff --git a/source/main/system/AppConfig.cpp b/source/main/system/AppConfig.cpp index 02dfe920ab..296cfe58fb 100644 --- a/source/main/system/AppConfig.cpp +++ b/source/main/system/AppConfig.cpp @@ -38,7 +38,7 @@ using namespace RoR; void AssignHelper(CVar* cvar, int val) { Str<25> s; s << val; - App::GetConsole()->CVarAssign(cvar, s.ToCStr()); + App::GetConsole()->cVarAssign(cvar, s.ToCStr()); } void ParseHelper(CVar* cvar, std::string const & val) @@ -100,11 +100,11 @@ void ParseHelper(CVar* cvar, std::string const & val) } else { - App::GetConsole()->CVarAssign(cvar, val); + App::GetConsole()->cVarAssign(cvar, val); } } -void Console::LoadConfig() +void Console::loadConfig() { Ogre::ConfigFile cfg; try @@ -116,7 +116,7 @@ void Console::LoadConfig() while (i.hasMoreElements()) { std::string cvar_name = RoR::Utils::SanitizeUtf8String(i.peekNextKey()); - CVar* cvar = App::GetConsole()->CVarFind(cvar_name); + CVar* cvar = App::GetConsole()->cVarFind(cvar_name); if (cvar && !cvar->HasFlag(CVAR_ARCHIVE)) { RoR::LogFormat("[RoR|Settings] CVar '%s' cannot be set from %s (defined without 'archive' flag)", cvar->GetName().c_str(), CONFIG_FILE_NAME); @@ -126,7 +126,7 @@ void Console::LoadConfig() if (!cvar) { - cvar = App::GetConsole()->CVarGet(cvar_name, CVAR_ARCHIVE); + cvar = App::GetConsole()->cVarGet(cvar_name, CVAR_ARCHIVE); } ParseHelper(cvar, RoR::Utils::SanitizeUtf8String(i.peekNextValue())); @@ -141,7 +141,7 @@ void WriteVarsHelper(std::stringstream& f, const char* label, const char* prefix { f << std::endl << "; " << label << std::endl; - for (auto& pair: App::GetConsole()->GetCVars()) + for (auto& pair: App::GetConsole()->getCVars()) { if (pair.second->HasFlag(CVAR_ARCHIVE) && pair.first.find(prefix) == 0) { @@ -169,7 +169,7 @@ void WriteVarsHelper(std::stringstream& f, const char* label, const char* prefix } } -void Console::SaveConfig() +void Console::saveConfig() { std::stringstream f; diff --git a/source/main/system/CVar.cpp b/source/main/system/CVar.cpp index e257095f64..6f9edfb307 100644 --- a/source/main/system/CVar.cpp +++ b/source/main/system/CVar.cpp @@ -26,161 +26,161 @@ using namespace RoR; -void Console::CVarSetupBuiltins() +void Console::cVarSetupBuiltins() { - App::app_state = this->CVarCreate("app_state", "", CVAR_TYPE_INT, "0"/*(int)AppState::BOOTSTRAP*/); - App::app_language = this->CVarCreate("app_language", "Language", CVAR_ARCHIVE, "en"); - App::app_country = this->CVarCreate("app_country", "Country", CVAR_ARCHIVE, "us"); - App::app_skip_main_menu = this->CVarCreate("app_skip_main_menu", "SkipMainMenu", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::app_async_physics = this->CVarCreate("app_async_physics", "AsyncPhysics", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::app_num_workers = this->CVarCreate("app_num_workers", "NumWorkerThreads", CVAR_ARCHIVE | CVAR_TYPE_INT); - App::app_screenshot_format = this->CVarCreate("app_screenshot_format", "Screenshot Format", CVAR_ARCHIVE, "png"); - App::app_rendersys_override = this->CVarCreate("app_rendersys_override", "Render system", CVAR_ARCHIVE); - App::app_extra_mod_path = this->CVarCreate("app_extra_mod_path", "Extra mod path", CVAR_ARCHIVE); - App::app_force_cache_purge = this->CVarCreate("app_force_cache_purge", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::app_force_cache_update = this->CVarCreate("app_force_cache_update", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::app_disable_online_api = this->CVarCreate("app_disable_online_api", "Disable Online API", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::app_config_long_names = this->CVarCreate("app_config_long_names", "Config uses long names", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - - App::sim_state = this->CVarCreate("sim_state", "", CVAR_TYPE_INT, "0"/*(int)SimState::OFF*/); - App::sim_terrain_name = this->CVarCreate("sim_terrain_name", "", 0); - App::sim_terrain_gui_name = this->CVarCreate("sim_terrain_gui_name", "", 0); - App::sim_spawn_running = this->CVarCreate("sim_spawn_running", "Engines spawn running", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::sim_replay_enabled = this->CVarCreate("sim_replay_enabled", "Replay mode", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::sim_replay_length = this->CVarCreate("sim_replay_length", "Replay length", CVAR_ARCHIVE | CVAR_TYPE_INT, "200"); - App::sim_replay_stepping = this->CVarCreate("sim_replay_stepping", "Replay Steps per second", CVAR_ARCHIVE | CVAR_TYPE_INT, "1000"); - App::sim_realistic_commands = this->CVarCreate("sim_realistic_commands", "Realistic forward commands", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::sim_races_enabled = this->CVarCreate("sim_races_enabled", "Races", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::sim_no_collisions = this->CVarCreate("sim_no_collisions", "DisableCollisions", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::sim_no_self_collisions = this->CVarCreate("sim_no_self_collisions", "DisableSelfCollisions", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::sim_gearbox_mode = this->CVarCreate("sim_gearbox_mode", "GearboxMode", CVAR_ARCHIVE | CVAR_TYPE_INT); - App::sim_soft_reset_mode = this->CVarCreate("sim_soft_reset_mode", "", CVAR_TYPE_BOOL, "false"); - App::sim_quickload_dialog = this->CVarCreate("sim_quickload_dialog", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - - App::mp_state = this->CVarCreate("mp_state", "", CVAR_TYPE_INT, "0"/*(int)MpState::DISABLED*/); - App::mp_join_on_startup = this->CVarCreate("mp_join_on_startup", "Auto connect", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::mp_chat_auto_hide = this->CVarCreate("mp_chat_auto_hide", "Auto hide chat", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::mp_hide_net_labels = this->CVarCreate("mp_hide_net_labels", "Hide net labels", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::mp_hide_own_net_label = this->CVarCreate("mp_hide_own_net_label", "Hide own net label", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::mp_pseudo_collisions = this->CVarCreate("mp_pseudo_collisions", "Multiplayer collisions", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::mp_server_host = this->CVarCreate("mp_server_host", "Server name", CVAR_ARCHIVE); - App::mp_server_port = this->CVarCreate("mp_server_port", "Server port", CVAR_ARCHIVE | CVAR_TYPE_INT); - App::mp_server_password = this->CVarCreate("mp_server_password", "Server password", CVAR_ARCHIVE | CVAR_NO_LOG); - App::mp_player_name = this->CVarCreate("mp_player_name", "Nickname", CVAR_ARCHIVE, "Player"); - App::mp_player_token = this->CVarCreate("mp_player_token", "User Token", CVAR_ARCHIVE | CVAR_NO_LOG); - App::mp_api_url = this->CVarCreate("mp_api_url", "Online API URL", CVAR_ARCHIVE, "http://api.rigsofrods.org"); - - App::diag_auto_spawner_report= this->CVarCreate("diag_auto_spawner_report","AutoActorSpawnerReport", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_camera = this->CVarCreate("diag_camera", "Camera Debug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_rig_log_node_import= this->CVarCreate("diag_rig_log_node_import","RigImporter_LogAllNodes", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_rig_log_node_stats = this->CVarCreate("diag_rig_log_node_stats", "RigImporter_LogNodeStats", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_collisions = this->CVarCreate("diag_collisions", "Debug Collisions", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_truck_mass = this->CVarCreate("diag_truck_mass", "Debug Truck Mass", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_envmap = this->CVarCreate("diag_envmap", "EnvMapDebug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_videocameras = this->CVarCreate("diag_videocameras", "VideoCameraDebug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_preset_terrain = this->CVarCreate("diag_preset_terrain", "Preselected Terrain", CVAR_ARCHIVE); - App::diag_preset_spawn_pos = this->CVarCreate("diag_spawn_position", "", CVAR_ARCHIVE); - App::diag_preset_spawn_rot = this->CVarCreate("diag_spawn_rotation", "", CVAR_ARCHIVE); - App::diag_preset_vehicle = this->CVarCreate("diag_preset_vehicle", "Preselected Truck", CVAR_ARCHIVE); - App::diag_preset_veh_config = this->CVarCreate("diag_preset_veh_config", "Preselected TruckConfig", CVAR_ARCHIVE); - App::diag_preset_veh_enter = this->CVarCreate("diag_preset_veh_enter", "Enter Preselected Truck", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_log_console_echo = this->CVarCreate("diag_log_console_echo", "Enable Ingame Console", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_log_beam_break = this->CVarCreate("diag_log_beam_break", "Beam Break Debug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_log_beam_deform = this->CVarCreate("diag_log_beam_deform", "Beam Deform Debug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_log_beam_trigger = this->CVarCreate("diag_log_beam_trigger", "Trigger Debug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_simple_materials = this->CVarCreate("diag_simple_materials", "SimpleMaterials", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_warning_texture = this->CVarCreate("diag_warning_texture", "Warning texture", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_hide_broken_beams = this->CVarCreate("diag_hide_broken_beams", "Hide broken beams", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_hide_beam_stress = this->CVarCreate("diag_hide_beam_stress", "Hide beam stress", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::diag_hide_wheel_info = this->CVarCreate("diag_hide_wheel_info", "Hide wheel info", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::diag_hide_wheels = this->CVarCreate("diag_hide_wheels", "Hide wheels", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_hide_nodes = this->CVarCreate("diag_hide_nodes", "Hide nodes", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::diag_terrn_log_roads = this->CVarCreate("diag_terrn_log_roads", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - - App::sys_process_dir = this->CVarCreate("sys_process_dir", "", 0); - App::sys_user_dir = this->CVarCreate("sys_user_dir", "", 0); - App::sys_config_dir = this->CVarCreate("sys_config_dir", "Config Root", 0); - App::sys_cache_dir = this->CVarCreate("sys_cache_dir", "Cache Path", 0); - App::sys_logs_dir = this->CVarCreate("sys_logs_dir", "Log Path", 0); - App::sys_resources_dir = this->CVarCreate("sys_resources_dir", "Resources Path", 0); - App::sys_profiler_dir = this->CVarCreate("sys_profiler_dir", "Profiler output dir", 0); - App::sys_savegames_dir = this->CVarCreate("sys_savegames_dir", "", 0); - App::sys_screenshot_dir = this->CVarCreate("sys_screenshot_dir", "", 0); - - App::cli_server_host = this->CVarCreate("cli_server_host", "", 0); - App::cli_server_port = this->CVarCreate("cli_server_port", "", CVAR_TYPE_INT, "0"); - App::cli_preset_vehicle = this->CVarCreate("cli_preset_vehicle", "", 0); - App::cli_preset_veh_config = this->CVarCreate("cli_preset_veh_config", "", 0); - App::cli_preset_terrain = this->CVarCreate("cli_preset_terrain", "", 0); - App::cli_preset_spawn_pos = this->CVarCreate("cli_preset_spawn_pos", "", 0); - App::cli_preset_spawn_rot = this->CVarCreate("cli_preset_spawn_rot", "", 0); - App::cli_preset_veh_enter = this->CVarCreate("cli_preset_veh_enter", "", CVAR_TYPE_BOOL, "false"); - App::cli_force_cache_update = this->CVarCreate("cli_force_cache_update", "", CVAR_TYPE_BOOL, "false"); - App::cli_resume_autosave = this->CVarCreate("cli_resume_autosave", "", CVAR_TYPE_BOOL, "false"); - - App::io_analog_smoothing = this->CVarCreate("io_analog_smoothing", "Analog Input Smoothing", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "1.0"); - App::io_analog_sensitivity = this->CVarCreate("io_analog_sensitivity", "Analog Input Sensitivity", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "1.0"); - App::io_blink_lock_range = this->CVarCreate("io_blink_lock_range", "Blinker Lock Range", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "0.1"); - App::io_ffb_enabled = this->CVarCreate("io_ffb_enabled", "Force Feedback", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::io_ffb_camera_gain = this->CVarCreate("io_ffb_camera_gain", "Force Feedback Camera", CVAR_ARCHIVE | CVAR_TYPE_FLOAT); - App::io_ffb_center_gain = this->CVarCreate("io_ffb_center_gain", "Force Feedback Centering", CVAR_ARCHIVE | CVAR_TYPE_FLOAT); - App::io_ffb_master_gain = this->CVarCreate("io_ffb_master_gain", "Force Feedback Gain", CVAR_ARCHIVE | CVAR_TYPE_FLOAT); - App::io_ffb_stress_gain = this->CVarCreate("io_ffb_stress_gain", "Force Feedback Stress", CVAR_ARCHIVE | CVAR_TYPE_FLOAT); - App::io_input_grab_mode = this->CVarCreate("io_input_grab_mode", "Input Grab", CVAR_ARCHIVE | CVAR_TYPE_INT, "1"/*(int)IoInputGrabMode::ALL*/); - App::io_arcade_controls = this->CVarCreate("io_arcade_controls", "ArcadeControls", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::io_hydro_coupling = this->CVarCreate("io_hydro_coupling", "Keyboard Steering Speed Coupling",CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::io_outgauge_mode = this->CVarCreate("io_outgauge_mode", "OutGauge Mode", CVAR_ARCHIVE | CVAR_TYPE_INT); // 0 = disabled, 1 = enabled - App::io_outgauge_ip = this->CVarCreate("io_outgauge_ip", "OutGauge IP", CVAR_ARCHIVE, "192.168.1.100"); - App::io_outgauge_port = this->CVarCreate("io_outgauge_port", "OutGauge Port", CVAR_ARCHIVE | CVAR_TYPE_INT, "1337"); - App::io_outgauge_delay = this->CVarCreate("io_outgauge_delay", "OutGauge Delay", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "10.0"); - App::io_outgauge_id = this->CVarCreate("io_outgauge_id", "OutGauge ID", CVAR_ARCHIVE | CVAR_TYPE_INT); - App::io_discord_rpc = this->CVarCreate("io_discord_rpc", "Discord Rich Presence", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - - App::audio_master_volume = this->CVarCreate("audio_master_volume", "Sound Volume", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "1.0"); - App::audio_enable_creak = this->CVarCreate("audio_enable_creak", "Creak Sound", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::audio_device_name = this->CVarCreate("audio_device_name", "AudioDevice", CVAR_ARCHIVE); - App::audio_menu_music = this->CVarCreate("audio_menu_music", "MainMenuMusic", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - - App::gfx_flares_mode = this->CVarCreate("gfx_flares_mode", "Lights", CVAR_ARCHIVE | CVAR_TYPE_INT, "4"/*(int)GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS*/); - App::gfx_shadow_type = this->CVarCreate("gfx_shadow_type", "Shadow technique", CVAR_ARCHIVE | CVAR_TYPE_INT, "1"/*(int)GfxShadowType::PSSM*/); - App::gfx_extcam_mode = this->CVarCreate("gfx_extcam_mode", "External Camera Mode", CVAR_ARCHIVE | CVAR_TYPE_INT, "2"/*(int)GfxExtCamMode::PITCHING*/); - App::gfx_sky_mode = this->CVarCreate("gfx_sky_mode", "Sky effects", CVAR_ARCHIVE | CVAR_TYPE_INT, "1"/*(int)GfxSkyMode::CAELUM*/); - App::gfx_sky_time_cycle = this->CVarCreate("gfx_sky_time_cycle", "", CVAR_TYPE_BOOL, "false"); - App::gfx_sky_time_speed = this->CVarCreate("gfx_sky_time_speed", "", CVAR_TYPE_INT, "300"); - App::gfx_texture_filter = this->CVarCreate("gfx_texture_filter", "Texture Filtering", CVAR_ARCHIVE | CVAR_TYPE_INT, "3"/*(int)GfxTexFilter::ANISOTROPIC*/); - App::gfx_vegetation_mode = this->CVarCreate("gfx_vegetation_mode", "Vegetation", CVAR_ARCHIVE | CVAR_TYPE_INT, "3"/*(int)GfxVegetation::FULL*/); - App::gfx_water_mode = this->CVarCreate("gfx_water_mode", "Water effects", CVAR_ARCHIVE | CVAR_TYPE_INT, "3"/*(int)GfxWaterMode::FULL_FAST*/); - App::gfx_anisotropy = this->CVarCreate("gfx_anisotropy", "Anisotropy", CVAR_ARCHIVE | CVAR_TYPE_INT, "4"); - App::gfx_water_waves = this->CVarCreate("gfx_water_waves", "Waves", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::gfx_particles_mode = this->CVarCreate("gfx_particles_mode", "Particles", CVAR_ARCHIVE | CVAR_TYPE_INT); - App::gfx_enable_videocams = this->CVarCreate("gfx_enable_videocams", "gfx_enable_videocams", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::gfx_window_videocams = this->CVarCreate("gfx_window_videocams", "UseVideocameraWindows", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::gfx_surveymap_icons = this->CVarCreate("gfx_surveymap_icons", "Overview map icons", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::gfx_declutter_map = this->CVarCreate("gfx_declutter_map", "Declutter overview map", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::gfx_envmap_enabled = this->CVarCreate("gfx_envmap_enabled", "Reflections", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::gfx_envmap_rate = this->CVarCreate("gfx_envmap_rate", "ReflectionUpdateRate", CVAR_ARCHIVE | CVAR_TYPE_INT, "1"); - App::gfx_shadow_quality = this->CVarCreate("gfx_shadow_quality", "Shadows Quality", CVAR_ARCHIVE | CVAR_TYPE_INT, "2"); - App::gfx_skidmarks_mode = this->CVarCreate("gfx_skidmarks_mode", "Skidmarks", CVAR_ARCHIVE | CVAR_TYPE_INT, "0"); - App::gfx_sight_range = this->CVarCreate("gfx_sight_range", "SightRange", CVAR_ARCHIVE | CVAR_TYPE_INT, "5000"); - App::gfx_camera_height = this->CVarCreate("gfx_camera_height", "Static camera height", CVAR_ARCHIVE | CVAR_TYPE_INT, "5"); - App::gfx_fov_external = this->CVarCreate("gfx_fov_external", "", CVAR_TYPE_INT, "60"); - App::gfx_fov_external_default= this->CVarCreate("gfx_fov_external_default","FOV External", CVAR_ARCHIVE | CVAR_TYPE_INT, "60"); - App::gfx_fov_internal = this->CVarCreate("gfx_fov_internal", "", CVAR_TYPE_INT, "75"); - App::gfx_fov_internal_default= this->CVarCreate("gfx_fov_internal_default","FOV Internal", CVAR_ARCHIVE | CVAR_TYPE_INT, "75"); - App::gfx_static_cam_fov_exp = this->CVarCreate("gfx_static_cam_fov_exp", "", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "1.0"); - App::gfx_fixed_cam_tracking = this->CVarCreate("gfx_fixed_cam_tracking", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::gfx_fps_limit = this->CVarCreate("gfx_fps_limit", "FPS-Limiter", CVAR_ARCHIVE | CVAR_TYPE_INT, "0"); - App::gfx_speedo_digital = this->CVarCreate("gfx_speedo_digital", "DigitalSpeedo", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::gfx_speedo_imperial = this->CVarCreate("gfx_speedo_imperial", "gfx_speedo_imperial", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::gfx_flexbody_cache = this->CVarCreate("gfx_flexbody_cache", "Flexbody_UseCache", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::gfx_reduce_shadows = this->CVarCreate("gfx_reduce_shadows", "Shadow optimizations", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); - App::gfx_enable_rtshaders = this->CVarCreate("gfx_enable_rtshaders", "Use RTShader System", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); - App::gfx_classic_shaders = this->CVarCreate("gfx_classic_shaders", "Classic material shaders", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::app_state = this->cVarCreate("app_state", "", CVAR_TYPE_INT, "0"/*(int)AppState::BOOTSTRAP*/); + App::app_language = this->cVarCreate("app_language", "Language", CVAR_ARCHIVE, "en"); + App::app_country = this->cVarCreate("app_country", "Country", CVAR_ARCHIVE, "us"); + App::app_skip_main_menu = this->cVarCreate("app_skip_main_menu", "SkipMainMenu", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::app_async_physics = this->cVarCreate("app_async_physics", "AsyncPhysics", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::app_num_workers = this->cVarCreate("app_num_workers", "NumWorkerThreads", CVAR_ARCHIVE | CVAR_TYPE_INT); + App::app_screenshot_format = this->cVarCreate("app_screenshot_format", "Screenshot Format", CVAR_ARCHIVE, "png"); + App::app_rendersys_override = this->cVarCreate("app_rendersys_override", "Render system", CVAR_ARCHIVE); + App::app_extra_mod_path = this->cVarCreate("app_extra_mod_path", "Extra mod path", CVAR_ARCHIVE); + App::app_force_cache_purge = this->cVarCreate("app_force_cache_purge", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::app_force_cache_update = this->cVarCreate("app_force_cache_update", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::app_disable_online_api = this->cVarCreate("app_disable_online_api", "Disable Online API", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::app_config_long_names = this->cVarCreate("app_config_long_names", "Config uses long names", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + + App::sim_state = this->cVarCreate("sim_state", "", CVAR_TYPE_INT, "0"/*(int)SimState::OFF*/); + App::sim_terrain_name = this->cVarCreate("sim_terrain_name", "", 0); + App::sim_terrain_gui_name = this->cVarCreate("sim_terrain_gui_name", "", 0); + App::sim_spawn_running = this->cVarCreate("sim_spawn_running", "Engines spawn running", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::sim_replay_enabled = this->cVarCreate("sim_replay_enabled", "Replay mode", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::sim_replay_length = this->cVarCreate("sim_replay_length", "Replay length", CVAR_ARCHIVE | CVAR_TYPE_INT, "200"); + App::sim_replay_stepping = this->cVarCreate("sim_replay_stepping", "Replay Steps per second", CVAR_ARCHIVE | CVAR_TYPE_INT, "1000"); + App::sim_realistic_commands = this->cVarCreate("sim_realistic_commands", "Realistic forward commands", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::sim_races_enabled = this->cVarCreate("sim_races_enabled", "Races", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::sim_no_collisions = this->cVarCreate("sim_no_collisions", "DisableCollisions", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::sim_no_self_collisions = this->cVarCreate("sim_no_self_collisions", "DisableSelfCollisions", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::sim_gearbox_mode = this->cVarCreate("sim_gearbox_mode", "GearboxMode", CVAR_ARCHIVE | CVAR_TYPE_INT); + App::sim_soft_reset_mode = this->cVarCreate("sim_soft_reset_mode", "", CVAR_TYPE_BOOL, "false"); + App::sim_quickload_dialog = this->cVarCreate("sim_quickload_dialog", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + + App::mp_state = this->cVarCreate("mp_state", "", CVAR_TYPE_INT, "0"/*(int)MpState::DISABLED*/); + App::mp_join_on_startup = this->cVarCreate("mp_join_on_startup", "Auto connect", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::mp_chat_auto_hide = this->cVarCreate("mp_chat_auto_hide", "Auto hide chat", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::mp_hide_net_labels = this->cVarCreate("mp_hide_net_labels", "Hide net labels", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::mp_hide_own_net_label = this->cVarCreate("mp_hide_own_net_label", "Hide own net label", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::mp_pseudo_collisions = this->cVarCreate("mp_pseudo_collisions", "Multiplayer collisions", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::mp_server_host = this->cVarCreate("mp_server_host", "Server name", CVAR_ARCHIVE); + App::mp_server_port = this->cVarCreate("mp_server_port", "Server port", CVAR_ARCHIVE | CVAR_TYPE_INT); + App::mp_server_password = this->cVarCreate("mp_server_password", "Server password", CVAR_ARCHIVE | CVAR_NO_LOG); + App::mp_player_name = this->cVarCreate("mp_player_name", "Nickname", CVAR_ARCHIVE, "Player"); + App::mp_player_token = this->cVarCreate("mp_player_token", "User Token", CVAR_ARCHIVE | CVAR_NO_LOG); + App::mp_api_url = this->cVarCreate("mp_api_url", "Online API URL", CVAR_ARCHIVE, "http://api.rigsofrods.org"); + + App::diag_auto_spawner_report= this->cVarCreate("diag_auto_spawner_report","AutoActorSpawnerReport", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_camera = this->cVarCreate("diag_camera", "Camera Debug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_rig_log_node_import= this->cVarCreate("diag_rig_log_node_import","RigImporter_LogAllNodes", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_rig_log_node_stats = this->cVarCreate("diag_rig_log_node_stats", "RigImporter_LogNodeStats", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_collisions = this->cVarCreate("diag_collisions", "Debug Collisions", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_truck_mass = this->cVarCreate("diag_truck_mass", "Debug Truck Mass", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_envmap = this->cVarCreate("diag_envmap", "EnvMapDebug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_videocameras = this->cVarCreate("diag_videocameras", "VideoCameraDebug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_preset_terrain = this->cVarCreate("diag_preset_terrain", "Preselected Terrain", CVAR_ARCHIVE); + App::diag_preset_spawn_pos = this->cVarCreate("diag_spawn_position", "", CVAR_ARCHIVE); + App::diag_preset_spawn_rot = this->cVarCreate("diag_spawn_rotation", "", CVAR_ARCHIVE); + App::diag_preset_vehicle = this->cVarCreate("diag_preset_vehicle", "Preselected Truck", CVAR_ARCHIVE); + App::diag_preset_veh_config = this->cVarCreate("diag_preset_veh_config", "Preselected TruckConfig", CVAR_ARCHIVE); + App::diag_preset_veh_enter = this->cVarCreate("diag_preset_veh_enter", "Enter Preselected Truck", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_log_console_echo = this->cVarCreate("diag_log_console_echo", "Enable Ingame Console", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_log_beam_break = this->cVarCreate("diag_log_beam_break", "Beam Break Debug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_log_beam_deform = this->cVarCreate("diag_log_beam_deform", "Beam Deform Debug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_log_beam_trigger = this->cVarCreate("diag_log_beam_trigger", "Trigger Debug", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_simple_materials = this->cVarCreate("diag_simple_materials", "SimpleMaterials", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_warning_texture = this->cVarCreate("diag_warning_texture", "Warning texture", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_hide_broken_beams = this->cVarCreate("diag_hide_broken_beams", "Hide broken beams", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_hide_beam_stress = this->cVarCreate("diag_hide_beam_stress", "Hide beam stress", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::diag_hide_wheel_info = this->cVarCreate("diag_hide_wheel_info", "Hide wheel info", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::diag_hide_wheels = this->cVarCreate("diag_hide_wheels", "Hide wheels", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_hide_nodes = this->cVarCreate("diag_hide_nodes", "Hide nodes", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::diag_terrn_log_roads = this->cVarCreate("diag_terrn_log_roads", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + + App::sys_process_dir = this->cVarCreate("sys_process_dir", "", 0); + App::sys_user_dir = this->cVarCreate("sys_user_dir", "", 0); + App::sys_config_dir = this->cVarCreate("sys_config_dir", "Config Root", 0); + App::sys_cache_dir = this->cVarCreate("sys_cache_dir", "Cache Path", 0); + App::sys_logs_dir = this->cVarCreate("sys_logs_dir", "Log Path", 0); + App::sys_resources_dir = this->cVarCreate("sys_resources_dir", "Resources Path", 0); + App::sys_profiler_dir = this->cVarCreate("sys_profiler_dir", "Profiler output dir", 0); + App::sys_savegames_dir = this->cVarCreate("sys_savegames_dir", "", 0); + App::sys_screenshot_dir = this->cVarCreate("sys_screenshot_dir", "", 0); + + App::cli_server_host = this->cVarCreate("cli_server_host", "", 0); + App::cli_server_port = this->cVarCreate("cli_server_port", "", CVAR_TYPE_INT, "0"); + App::cli_preset_vehicle = this->cVarCreate("cli_preset_vehicle", "", 0); + App::cli_preset_veh_config = this->cVarCreate("cli_preset_veh_config", "", 0); + App::cli_preset_terrain = this->cVarCreate("cli_preset_terrain", "", 0); + App::cli_preset_spawn_pos = this->cVarCreate("cli_preset_spawn_pos", "", 0); + App::cli_preset_spawn_rot = this->cVarCreate("cli_preset_spawn_rot", "", 0); + App::cli_preset_veh_enter = this->cVarCreate("cli_preset_veh_enter", "", CVAR_TYPE_BOOL, "false"); + App::cli_force_cache_update = this->cVarCreate("cli_force_cache_update", "", CVAR_TYPE_BOOL, "false"); + App::cli_resume_autosave = this->cVarCreate("cli_resume_autosave", "", CVAR_TYPE_BOOL, "false"); + + App::io_analog_smoothing = this->cVarCreate("io_analog_smoothing", "Analog Input Smoothing", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "1.0"); + App::io_analog_sensitivity = this->cVarCreate("io_analog_sensitivity", "Analog Input Sensitivity", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "1.0"); + App::io_blink_lock_range = this->cVarCreate("io_blink_lock_range", "Blinker Lock Range", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "0.1"); + App::io_ffb_enabled = this->cVarCreate("io_ffb_enabled", "Force Feedback", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::io_ffb_camera_gain = this->cVarCreate("io_ffb_camera_gain", "Force Feedback Camera", CVAR_ARCHIVE | CVAR_TYPE_FLOAT); + App::io_ffb_center_gain = this->cVarCreate("io_ffb_center_gain", "Force Feedback Centering", CVAR_ARCHIVE | CVAR_TYPE_FLOAT); + App::io_ffb_master_gain = this->cVarCreate("io_ffb_master_gain", "Force Feedback Gain", CVAR_ARCHIVE | CVAR_TYPE_FLOAT); + App::io_ffb_stress_gain = this->cVarCreate("io_ffb_stress_gain", "Force Feedback Stress", CVAR_ARCHIVE | CVAR_TYPE_FLOAT); + App::io_input_grab_mode = this->cVarCreate("io_input_grab_mode", "Input Grab", CVAR_ARCHIVE | CVAR_TYPE_INT, "1"/*(int)IoInputGrabMode::ALL*/); + App::io_arcade_controls = this->cVarCreate("io_arcade_controls", "ArcadeControls", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::io_hydro_coupling = this->cVarCreate("io_hydro_coupling", "Keyboard Steering Speed Coupling",CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::io_outgauge_mode = this->cVarCreate("io_outgauge_mode", "OutGauge Mode", CVAR_ARCHIVE | CVAR_TYPE_INT); // 0 = disabled, 1 = enabled + App::io_outgauge_ip = this->cVarCreate("io_outgauge_ip", "OutGauge IP", CVAR_ARCHIVE, "192.168.1.100"); + App::io_outgauge_port = this->cVarCreate("io_outgauge_port", "OutGauge Port", CVAR_ARCHIVE | CVAR_TYPE_INT, "1337"); + App::io_outgauge_delay = this->cVarCreate("io_outgauge_delay", "OutGauge Delay", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "10.0"); + App::io_outgauge_id = this->cVarCreate("io_outgauge_id", "OutGauge ID", CVAR_ARCHIVE | CVAR_TYPE_INT); + App::io_discord_rpc = this->cVarCreate("io_discord_rpc", "Discord Rich Presence", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + + App::audio_master_volume = this->cVarCreate("audio_master_volume", "Sound Volume", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "1.0"); + App::audio_enable_creak = this->cVarCreate("audio_enable_creak", "Creak Sound", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::audio_device_name = this->cVarCreate("audio_device_name", "AudioDevice", CVAR_ARCHIVE); + App::audio_menu_music = this->cVarCreate("audio_menu_music", "MainMenuMusic", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + + App::gfx_flares_mode = this->cVarCreate("gfx_flares_mode", "Lights", CVAR_ARCHIVE | CVAR_TYPE_INT, "4"/*(int)GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS*/); + App::gfx_shadow_type = this->cVarCreate("gfx_shadow_type", "Shadow technique", CVAR_ARCHIVE | CVAR_TYPE_INT, "1"/*(int)GfxShadowType::PSSM*/); + App::gfx_extcam_mode = this->cVarCreate("gfx_extcam_mode", "External Camera Mode", CVAR_ARCHIVE | CVAR_TYPE_INT, "2"/*(int)GfxExtCamMode::PITCHING*/); + App::gfx_sky_mode = this->cVarCreate("gfx_sky_mode", "Sky effects", CVAR_ARCHIVE | CVAR_TYPE_INT, "1"/*(int)GfxSkyMode::CAELUM*/); + App::gfx_texture_filter = this->cVarCreate("gfx_texture_filter", "Texture Filtering", CVAR_ARCHIVE | CVAR_TYPE_INT, "3"/*(int)GfxTexFilter::ANISOTROPIC*/); + App::gfx_vegetation_mode = this->cVarCreate("gfx_vegetation_mode", "Vegetation", CVAR_ARCHIVE | CVAR_TYPE_INT, "3"/*(int)GfxVegetation::FULL*/); + App::gfx_sky_time_cycle = this->cVarCreate("gfx_sky_time_cycle", "", CVAR_TYPE_BOOL, "false"); + App::gfx_sky_time_speed = this->cVarCreate("gfx_sky_time_speed", "", CVAR_TYPE_INT, "300"); + App::gfx_water_mode = this->cVarCreate("gfx_water_mode", "Water effects", CVAR_ARCHIVE | CVAR_TYPE_INT, "3"/*(int)GfxWaterMode::FULL_FAST*/); + App::gfx_anisotropy = this->cVarCreate("gfx_anisotropy", "Anisotropy", CVAR_ARCHIVE | CVAR_TYPE_INT, "4"); + App::gfx_water_waves = this->cVarCreate("gfx_water_waves", "Waves", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::gfx_particles_mode = this->cVarCreate("gfx_particles_mode", "Particles", CVAR_ARCHIVE | CVAR_TYPE_INT); + App::gfx_enable_videocams = this->cVarCreate("gfx_enable_videocams", "gfx_enable_videocams", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::gfx_window_videocams = this->cVarCreate("gfx_window_videocams", "UseVideocameraWindows", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::gfx_surveymap_icons = this->cVarCreate("gfx_surveymap_icons", "Overview map icons", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::gfx_declutter_map = this->cVarCreate("gfx_declutter_map", "Declutter overview map", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::gfx_envmap_enabled = this->cVarCreate("gfx_envmap_enabled", "Reflections", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::gfx_envmap_rate = this->cVarCreate("gfx_envmap_rate", "ReflectionUpdateRate", CVAR_ARCHIVE | CVAR_TYPE_INT, "1"); + App::gfx_shadow_quality = this->cVarCreate("gfx_shadow_quality", "Shadows Quality", CVAR_ARCHIVE | CVAR_TYPE_INT, "2"); + App::gfx_skidmarks_mode = this->cVarCreate("gfx_skidmarks_mode", "Skidmarks", CVAR_ARCHIVE | CVAR_TYPE_INT, "0"); + App::gfx_sight_range = this->cVarCreate("gfx_sight_range", "SightRange", CVAR_ARCHIVE | CVAR_TYPE_INT, "5000"); + App::gfx_camera_height = this->cVarCreate("gfx_camera_height", "Static camera height", CVAR_ARCHIVE | CVAR_TYPE_INT, "5"); + App::gfx_fov_external = this->cVarCreate("gfx_fov_external", "", CVAR_TYPE_INT, "60"); + App::gfx_fov_external_default= this->cVarCreate("gfx_fov_external_default","FOV External", CVAR_ARCHIVE | CVAR_TYPE_INT, "60"); + App::gfx_fov_internal = this->cVarCreate("gfx_fov_internal", "", CVAR_TYPE_INT, "75"); + App::gfx_fov_internal_default= this->cVarCreate("gfx_fov_internal_default","FOV Internal", CVAR_ARCHIVE | CVAR_TYPE_INT, "75"); + App::gfx_static_cam_fov_exp = this->cVarCreate("gfx_static_cam_fov_exp", "", CVAR_ARCHIVE | CVAR_TYPE_FLOAT, "1.0"); + App::gfx_fixed_cam_tracking = this->cVarCreate("gfx_fixed_cam_tracking", "", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::gfx_fps_limit = this->cVarCreate("gfx_fps_limit", "FPS-Limiter", CVAR_ARCHIVE | CVAR_TYPE_INT, "0"); + App::gfx_speedo_digital = this->cVarCreate("gfx_speedo_digital", "DigitalSpeedo", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::gfx_speedo_imperial = this->cVarCreate("gfx_speedo_imperial", "gfx_speedo_imperial", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::gfx_flexbody_cache = this->cVarCreate("gfx_flexbody_cache", "Flexbody_UseCache", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::gfx_reduce_shadows = this->cVarCreate("gfx_reduce_shadows", "Shadow optimizations", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "true"); + App::gfx_enable_rtshaders = this->cVarCreate("gfx_enable_rtshaders", "Use RTShader System", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); + App::gfx_classic_shaders = this->cVarCreate("gfx_classic_shaders", "Classic material shaders", CVAR_ARCHIVE | CVAR_TYPE_BOOL, "false"); } -CVar* Console::CVarCreate(std::string const& name, std::string const& long_name, +CVar* Console::cVarCreate(std::string const& name, std::string const& long_name, int flags, std::string const& val/* = std::string()*/) { CVar* cvar = nullptr; @@ -195,7 +195,7 @@ CVar* Console::CVarCreate(std::string const& name, std::string const& long_name, if (!val.empty()) { - this->CVarAssign(cvar, val); + this->cVarAssign(cvar, val); } m_cvars.insert(std::make_pair(name, cvar)); @@ -204,7 +204,7 @@ CVar* Console::CVarCreate(std::string const& name, std::string const& long_name, return cvar; } -void Console::CVarAssign(CVar* cvar, std::string const& value) +void Console::cVarAssign(CVar* cvar, std::string const& value) { if (cvar->HasFlag(CVAR_TYPE_BOOL | CVAR_TYPE_INT | CVAR_TYPE_FLOAT)) { @@ -222,7 +222,7 @@ void Console::CVarAssign(CVar* cvar, std::string const& value) } } -CVar* Console::CVarFind(std::string const& input_name) +CVar* Console::cVarFind(std::string const& input_name) { CVarPtrMap::const_iterator itor = m_cvars.find(input_name); if (itor != m_cvars.end()) @@ -239,26 +239,26 @@ CVar* Console::CVarFind(std::string const& input_name) return nullptr; } -CVar* Console::CVarSet(std::string const& input_name, std::string const& input_val) +CVar* Console::cVarSet(std::string const& input_name, std::string const& input_val) { - CVar* found = this->CVarFind(input_name); + CVar* found = this->cVarFind(input_name); if (found) { - this->CVarAssign(found, input_val); + this->cVarAssign(found, input_val); } return nullptr; } -CVar* Console::CVarGet(std::string const& input_name, int flags) +CVar* Console::cVarGet(std::string const& input_name, int flags) { - CVar* found = this->CVarFind(input_name); + CVar* found = this->cVarFind(input_name); if (found) { return found; } - return this->CVarCreate(input_name, input_name, flags); + return this->cVarCreate(input_name, input_name, flags); } void CVar::LogUpdate(std::string const& new_val) diff --git a/source/main/system/Console.cpp b/source/main/system/Console.cpp index 1fbb510bad..a2460a0cdb 100644 --- a/source/main/system/Console.cpp +++ b/source/main/system/Console.cpp @@ -33,11 +33,11 @@ void Console::messageLogged(const Ogre::String& message, Ogre::LogMessageLevel l { if (App::diag_log_console_echo->GetBool()) { - this->ForwardLogMessage(CONSOLE_MSGTYPE_LOG, message, lml); + this->forwardLogMessage(CONSOLE_MSGTYPE_LOG, message, lml); } } -void Console::ForwardLogMessage(MessageArea area, std::string const& message, Ogre::LogMessageLevel lml) +void Console::forwardLogMessage(MessageArea area, std::string const& message, Ogre::LogMessageLevel lml) { switch (lml) { @@ -55,7 +55,7 @@ void Console::ForwardLogMessage(MessageArea area, std::string const& message, Og } } -void Console::HandleMessage(MessageArea area, MessageType type, std::string const& msg, int net_userid/* = 0*/) +void Console::handleMessage(MessageArea area, MessageType type, std::string const& msg, int net_userid/* = 0*/) { if (net_userid < 0) // 0=server, positive=clients, negative=invalid { @@ -91,16 +91,16 @@ void Console::HandleMessage(MessageArea area, MessageType type, std::string cons // Lock and update message list std::lock_guard lock(m_messages_mutex); // Scoped lock - m_messages.emplace_back(area, type, msg, this->QueryMessageTimer(), net_userid); + m_messages.emplace_back(area, type, msg, this->queryMessageTimer(), net_userid); } void Console::putMessage(MessageArea area, MessageType type, std::string const& msg, std::string icon, size_t ttl, bool forcevisible) { - this->HandleMessage(area, type, msg); + this->handleMessage(area, type, msg); } void Console::putNetMessage(int user_id, MessageType type, const char* text) { - this->HandleMessage(CONSOLE_MSGTYPE_INFO, type, text, user_id); + this->handleMessage(CONSOLE_MSGTYPE_INFO, type, text, user_id); } diff --git a/source/main/system/Console.h b/source/main/system/Console.h index d370e491bf..9650506754 100644 --- a/source/main/system/Console.h +++ b/source/main/system/Console.h @@ -91,56 +91,56 @@ class Console : public Ogre::LogListener void putMessage(MessageArea area, MessageType type, std::string const& msg, std::string icon = "", size_t ttl = 0, bool forcevisible = false); void putNetMessage(int user_id, MessageType type, const char* text); - void ForwardLogMessage(MessageArea area, std::string const& msg, Ogre::LogMessageLevel lml); - unsigned long QueryMessageTimer() { return m_msg_timer.getMilliseconds(); } + void forwardLogMessage(MessageArea area, std::string const& msg, Ogre::LogMessageLevel lml); + unsigned long queryMessageTimer() { return m_msg_timer.getMilliseconds(); } // ---------------------------- // Commands (defined in ConsoleCmd.cpp): /// Register builtin commands - void RegBuiltinCommands(); + void regBuiltinCommands(); /// Identify and execute any console line - void DoCommand(std::string msg); + void doCommand(std::string msg); // ---------------------------- // CVars (defined in CVar.cpp): /// Add CVar and parse default value if specified - CVar* CVarCreate(std::string const& name, std::string const& long_name, + CVar* cVarCreate(std::string const& name, std::string const& long_name, int flags, std::string const& val = std::string()); /// Parse value by cvar type - void CVarAssign(CVar* cvar, std::string const& value); + void cVarAssign(CVar* cvar, std::string const& value); /// Find cvar by short/long name - CVar* CVarFind(std::string const& input_name); + CVar* cVarFind(std::string const& input_name); /// Set existing cvar by short/long name. Return the modified cvar (or NULL if not found) - CVar* CVarSet(std::string const& input_name, std::string const& input_val); + CVar* cVarSet(std::string const& input_name, std::string const& input_val); /// Get cvar by short/long name, or create new one using input as short name. - CVar* CVarGet(std::string const& input_name, int flags); + CVar* cVarGet(std::string const& input_name, int flags); /// Create builtin vars and set defaults - void CVarSetupBuiltins(); + void cVarSetupBuiltins(); - CVarPtrMap& GetCVars() { return m_cvars; } + CVarPtrMap& getCVars() { return m_cvars; } - CommandPtrMap& GetCommands() { return m_commands; } + CommandPtrMap& getCommands() { return m_commands; } // ---------------------------- // Command line (defined in AppCommandLine.cpp) - void ProcessCommandLine(int argc, char *argv[]); - void ShowCommandLineUsage(); - void ShowCommandLineVersion(); + void processCommandLine(int argc, char *argv[]); + void showCommandLineUsage(); + void showCommandLineVersion(); // ---------------------------- // Config file (defined in AppConfig.cpp) - void LoadConfig(); - void SaveConfig(); + void loadConfig(); + void saveConfig(); private: // Ogre::LogListener @@ -148,7 +148,7 @@ class Console : public Ogre::LogListener const Ogre::String& message, Ogre::LogMessageLevel lml, bool maskDebug, const Ogre::String& logName, bool& skipThisMessage) override; - void HandleMessage(MessageArea area, MessageType type, std::string const& msg, int net_id = 0); + void handleMessage(MessageArea area, MessageType type, std::string const& msg, int net_id = 0); std::vector m_messages; std::mutex m_messages_mutex; diff --git a/source/main/system/ConsoleCmd.cpp b/source/main/system/ConsoleCmd.cpp index a17d53f652..48c1b9bd9c 100644 --- a/source/main/system/ConsoleCmd.cpp +++ b/source/main/system/ConsoleCmd.cpp @@ -358,7 +358,7 @@ class HelpCmd: public ConsoleCmd Console::CONSOLE_TITLE, _L("Available commands:")); Str<500> line; - for (auto& cmd_pair: App::GetConsole()->GetCommands()) + for (auto& cmd_pair: App::GetConsole()->getCommands()) { line.Clear() << cmd_pair.second->GetName() << " " << cmd_pair.second->GetUsage() << " - " << cmd_pair.second->GetDoc(); @@ -384,7 +384,7 @@ class VarsCmd: public ConsoleCmd void Run(Ogre::StringVector const& args) override { - for (auto& pair: App::GetConsole()->GetCVars()) + for (auto& pair: App::GetConsole()->getCVars()) { bool match = args.size() == 1; for (size_t i = 1; i < args.size(); ++i) @@ -434,12 +434,12 @@ class SetCmd: public ConsoleCmd } else { - CVar* cvar = App::GetConsole()->CVarFind(args[1]); + CVar* cvar = App::GetConsole()->cVarFind(args[1]); if (cvar) { if (args.size() > 2) { - App::GetConsole()->CVarAssign(cvar, args[2]); + App::GetConsole()->cVarAssign(cvar, args[2]); } reply_type = Console::CONSOLE_SYSTEM_REPLY; reply << cvar->GetName() << " = " << cvar->GetStr(); @@ -490,10 +490,10 @@ class SetCVarCmd: public ConsoleCmd // Generic } else { - CVar* cvar = App::GetConsole()->CVarGet(args[i], flags); + CVar* cvar = App::GetConsole()->cVarGet(args[i], flags); if (args.size() > (i+1)) { - App::GetConsole()->CVarAssign(cvar, args[i+1]); + App::GetConsole()->cVarAssign(cvar, args[i+1]); } reply_type = Console::CONSOLE_SYSTEM_REPLY; reply << cvar->GetName() << " = " << cvar->GetStr(); @@ -586,7 +586,7 @@ class ClearCmd: public ConsoleCmd // ------------------------------------------------------------------------------------- // Console integration -void Console::RegBuiltinCommands() +void Console::regBuiltinCommands() { ConsoleCmd* cmd = nullptr; @@ -613,7 +613,7 @@ void Console::RegBuiltinCommands() cmd = new VarsCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); } -void Console::DoCommand(std::string msg) +void Console::doCommand(std::string msg) { if (msg[0] == '/' || msg[0] == '\\') { @@ -631,7 +631,7 @@ void Console::DoCommand(std::string msg) return; } - CVar* cvar = this->CVarFind(args[0]); + CVar* cvar = this->cVarFind(args[0]); if (cvar) { Str<200> reply; From 66122a1f489e5ab5d40f8d8c294a15792d37f4c5 Mon Sep 17 00:00:00 2001 From: Petr Ohlidal Date: Wed, 1 Sep 2021 08:20:54 +0200 Subject: [PATCH 2/4] :boomerang: CVar: `CamelCase()` -> `mixedCase()` --- source/main/AppContext.cpp | 66 +++---- source/main/GameContext.cpp | 58 +++--- source/main/audio/MumbleIntegration.cpp | 10 +- source/main/audio/SoundManager.cpp | 16 +- source/main/audio/SoundScriptManager.cpp | 6 +- source/main/gameplay/Character.cpp | 12 +- source/main/gameplay/CharacterFactory.cpp | 2 +- source/main/gameplay/EngineSim.cpp | 4 +- source/main/gameplay/ProceduralManager.cpp | 2 +- source/main/gameplay/RecoveryMode.cpp | 8 +- source/main/gameplay/Replay.cpp | 2 +- source/main/gameplay/Road2.cpp | 2 +- source/main/gameplay/SceneMouse.cpp | 8 +- source/main/gfx/EnvironmentMap.cpp | 6 +- source/main/gfx/GfxActor.cpp | 26 +-- source/main/gfx/GfxScene.cpp | 4 +- source/main/gfx/HydraxWater.cpp | 4 +- source/main/gfx/ShadowManager.cpp | 6 +- source/main/gfx/Water.cpp | 20 +-- source/main/gfx/camera/CameraManager.cpp | 38 ++-- source/main/gui/GUIManager.cpp | 14 +- source/main/gui/GUIUtils.cpp | 32 ++-- source/main/gui/imgui/imgui.cpp | 10 +- source/main/gui/imgui/imgui.h | 6 +- source/main/gui/imgui/imgui_internal.h | 2 +- source/main/gui/imgui/imgui_widgets.cpp | 4 +- source/main/gui/panels/GUI_ConsoleWindow.cpp | 4 +- source/main/gui/panels/GUI_GameAbout.cpp | 2 +- source/main/gui/panels/GUI_GameChatBox.cpp | 4 +- source/main/gui/panels/GUI_GameMainMenu.cpp | 22 +-- source/main/gui/panels/GUI_GameSettings.cpp | 44 ++--- source/main/gui/panels/GUI_LoadingWindow.cpp | 2 +- source/main/gui/panels/GUI_MainSelector.cpp | 10 +- source/main/gui/panels/GUI_MessageBox.cpp | 4 +- .../gui/panels/GUI_MultiplayerClientList.cpp | 4 +- .../gui/panels/GUI_MultiplayerSelector.cpp | 20 +-- source/main/gui/panels/GUI_SurveyMap.cpp | 10 +- .../main/gui/panels/GUI_TextureToolWindow.cpp | 2 +- source/main/gui/panels/GUI_TopMenubar.cpp | 50 +++--- source/main/main.cpp | 170 +++++++++--------- source/main/network/DiscordRpc.cpp | 14 +- source/main/network/Network.cpp | 20 +-- source/main/network/OutGauge.cpp | 8 +- source/main/physics/Actor.cpp | 10 +- source/main/physics/ActorForcesEuler.cpp | 6 +- source/main/physics/ActorManager.cpp | 24 +-- source/main/physics/ActorSpawner.cpp | 54 +++--- source/main/physics/Savegame.cpp | 22 +-- source/main/physics/collision/Collisions.cpp | 4 +- source/main/physics/flex/FlexFactory.cpp | 4 +- source/main/resources/CacheSystem.cpp | 6 +- source/main/resources/ContentManager.cpp | 38 ++-- .../otc_fileformat/OTCFileFormat.cpp | 54 +++--- .../rig_def_fileformat/RigDef_Node.cpp | 4 +- .../rig_def_fileformat/RigDef_Node.h | 2 +- .../rig_def_fileformat/RigDef_Parser.cpp | 2 +- .../RigDef_SequentialImporter.cpp | 4 +- .../terrn2_fileformat/Terrn2FileFormat.cpp | 16 +- source/main/scripting/GameScript.cpp | 16 +- source/main/scripting/ScriptEngine.cpp | 2 +- source/main/system/AppCommandLine.cpp | 26 +-- source/main/system/AppConfig.cpp | 56 +++--- source/main/system/CVar.cpp | 24 +-- source/main/system/CVar.h | 34 ++-- source/main/system/Console.cpp | 2 +- source/main/system/ConsoleCmd.cpp | 62 +++---- source/main/system/ConsoleCmd.h | 2 +- source/main/terrain/TerrainEditor.cpp | 2 +- source/main/terrain/TerrainManager.cpp | 30 ++-- source/main/terrain/TerrainObjectManager.cpp | 12 +- source/main/threadpool/ThreadPool.h | 4 +- source/main/utils/ConfigFile.cpp | 6 +- source/main/utils/ConfigFile.h | 18 +- source/main/utils/ForceFeedback.cpp | 8 +- source/main/utils/InputEngine.cpp | 4 +- source/main/utils/Language.cpp | 6 +- 76 files changed, 661 insertions(+), 661 deletions(-) diff --git a/source/main/AppContext.cpp b/source/main/AppContext.cpp index 9839cf89b4..11d8150727 100644 --- a/source/main/AppContext.cpp +++ b/source/main/AppContext.cpp @@ -66,7 +66,7 @@ bool AppContext::SetUpInput() App::GetInputEngine()->SetKeyboardListener(this); App::GetInputEngine()->SetJoystickListener(this); - if (App::io_ffb_enabled->GetBool()) + if (App::io_ffb_enabled->getBool()) { m_force_feedback.Setup(); } @@ -110,7 +110,7 @@ bool AppContext::mousePressed(const OIS::MouseEvent& arg, OIS::MouseButtonID _id handled = App::GetOverlayWrapper()->mousePressed(arg, _id); // update the old airplane / autopilot gui } - if (!handled && App::app_state->GetEnum() == AppState::SIMULATION) + if (!handled && App::app_state->getEnum() == AppState::SIMULATION) { App::GetGameContext()->GetSceneMouse().mousePressed(arg, _id); App::GetCameraManager()->mousePressed(arg, _id); @@ -136,7 +136,7 @@ bool AppContext::mouseReleased(const OIS::MouseEvent& arg, OIS::MouseButtonID _i { handled = App::GetOverlayWrapper()->mouseReleased(arg, _id); // update the old airplane / autopilot gui } - if (!handled && App::app_state->GetEnum() == AppState::SIMULATION) + if (!handled && App::app_state->getEnum() == AppState::SIMULATION) { App::GetGameContext()->GetSceneMouse().mouseReleased(arg, _id); } @@ -190,7 +190,7 @@ void AppContext::windowResized(Ogre::RenderWindow* rw) { App::GetInputEngine()->windowResized(rw); // Update mouse area App::GetOverlayWrapper()->windowResized(); - if (App::sim_state->GetEnum() == RoR::AppState::SIMULATION) + if (App::sim_state->getEnum() == RoR::AppState::SIMULATION) { for (Actor* actor: App::GetGameContext()->GetActorManager()->GetActors()) { @@ -229,21 +229,21 @@ void AppContext::SetRenderWindowIcon(Ogre::RenderWindow* rw) bool AppContext::SetUpRendering() { // Create 'OGRE root' facade - std::string log_filepath = PathCombine(App::sys_logs_dir->GetStr(), "RoR.log"); - std::string cfg_filepath = PathCombine(App::sys_config_dir->GetStr(), "ogre.cfg"); + std::string log_filepath = PathCombine(App::sys_logs_dir->getStr(), "RoR.log"); + std::string cfg_filepath = PathCombine(App::sys_config_dir->getStr(), "ogre.cfg"); m_ogre_root = new Ogre::Root("", cfg_filepath, log_filepath); // load OGRE plugins manually #ifdef _DEBUG - std::string plugins_path = PathCombine(RoR::App::sys_process_dir->GetStr(), "plugins_d.cfg"); + std::string plugins_path = PathCombine(RoR::App::sys_process_dir->getStr(), "plugins_d.cfg"); #else - std::string plugins_path = PathCombine(RoR::App::sys_process_dir->GetStr(), "plugins.cfg"); + std::string plugins_path = PathCombine(RoR::App::sys_process_dir->getStr(), "plugins.cfg"); #endif try { Ogre::ConfigFile cfg; cfg.load(plugins_path); - std::string plugin_dir = cfg.getSetting("PluginFolder", /*section=*/"", /*default=*/App::sys_process_dir->GetStr()); + std::string plugin_dir = cfg.getSetting("PluginFolder", /*section=*/"", /*default=*/App::sys_process_dir->getStr()); Ogre::StringVector plugins = cfg.getMultiSetting("Plugin"); for (Ogre::String plugin_filename: plugins) { @@ -270,14 +270,14 @@ bool AppContext::SetUpRendering() ErrorUtils::ShowError (_L("Startup error"), _L("No render system plugin available. Check your plugins.cfg")); } - const auto rs = m_ogre_root->getRenderSystemByName(App::app_rendersys_override->GetStr()); + const auto rs = m_ogre_root->getRenderSystemByName(App::app_rendersys_override->getStr()); if (rs != nullptr && rs != m_ogre_root->getRenderSystem()) { // The user has selected a different render system during the previous session. m_ogre_root->setRenderSystem(rs); m_ogre_root->saveConfig(); } - App::app_rendersys_override->SetStr(""); + App::app_rendersys_override->setStr(""); // Start the renderer m_ogre_root->initialise(/*createWindow=*/false); @@ -341,17 +341,17 @@ void AppContext::CaptureScreenshot() std::stringstream stamp; stamp << std::put_time(std::localtime(&time), "%Y-%m-%d_%H-%M-%S") << "_" << index - << "." << App::app_screenshot_format->GetStr(); - std::string path = PathCombine(App::sys_screenshot_dir->GetStr(), "screenshot_") + stamp.str(); + << "." << App::app_screenshot_format->getStr(); + std::string path = PathCombine(App::sys_screenshot_dir->getStr(), "screenshot_") + stamp.str(); - if (App::app_screenshot_format->GetStr() == "png") + if (App::app_screenshot_format->getStr() == "png") { AdvancedScreen png(m_render_window, path); - png.addData("User_NickName", App::mp_player_name->GetStr()); - png.addData("User_Language", App::app_language->GetStr()); + png.addData("User_NickName", App::mp_player_name->getStr()); + png.addData("User_Language", App::app_language->getStr()); - if (App::app_state->GetEnum() == AppState::SIMULATION && + if (App::app_state->getEnum() == AppState::SIMULATION && App::GetGameContext()->GetPlayerActor()) { png.addData("Truck_file", App::GetGameContext()->GetPlayerActor()->ar_filename); @@ -359,12 +359,12 @@ void AppContext::CaptureScreenshot() } if (App::GetSimTerrain()) { - png.addData("Terrn_file", App::sim_terrain_name->GetStr()); - png.addData("Terrn_name", App::sim_terrain_gui_name->GetStr()); + png.addData("Terrn_file", App::sim_terrain_name->getStr()); + png.addData("Terrn_name", App::sim_terrain_gui_name->getStr()); } - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { - png.addData("MP_ServerName", App::mp_server_host->GetStr()); + png.addData("MP_ServerName", App::mp_server_host->getStr()); } png.write(); @@ -408,14 +408,14 @@ bool AppContext::SetUpProgramPaths() ErrorUtils::ShowError(_L("Startup error"), _L("Error while retrieving program directory path")); return false; } - App::sys_process_dir->SetStr(RoR::GetParentDirectory(exe_path.c_str()).c_str()); + App::sys_process_dir->setStr(RoR::GetParentDirectory(exe_path.c_str()).c_str()); // RoR's home directory - std::string local_userdir = PathCombine(App::sys_process_dir->GetStr(), "config"); // TODO: Think of a better name, this is ambiguious with ~/.rigsofrods/config which stores configfiles! ~ only_a_ptr, 02/2018 + std::string local_userdir = PathCombine(App::sys_process_dir->getStr(), "config"); // TODO: Think of a better name, this is ambiguious with ~/.rigsofrods/config which stores configfiles! ~ only_a_ptr, 02/2018 if (FolderExists(local_userdir)) { // It's a portable installation - App::sys_user_dir->SetStr(local_userdir.c_str()); + App::sys_user_dir->setStr(local_userdir.c_str()); } else { @@ -441,7 +441,7 @@ bool AppContext::SetUpProgramPaths() ror_homedir << user_home << PATH_SLASH << "RigsOfRods"; #endif CreateFolder(ror_homedir.ToCStr ()); - App::sys_user_dir->SetStr(ror_homedir.ToCStr ()); + App::sys_user_dir->setStr(ror_homedir.ToCStr ()); } return true; @@ -449,9 +449,9 @@ bool AppContext::SetUpProgramPaths() void AppContext::SetUpLogging() { - std::string logs_dir = PathCombine(App::sys_user_dir->GetStr(), "logs"); + std::string logs_dir = PathCombine(App::sys_user_dir->getStr(), "logs"); CreateFolder(logs_dir); - App::sys_logs_dir->SetStr(logs_dir.c_str()); + App::sys_logs_dir->setStr(logs_dir.c_str()); auto ogre_log_manager = OGRE_NEW Ogre::LogManager(); std::string rorlog_path = PathCombine(logs_dir, "RoR.log"); @@ -465,7 +465,7 @@ void AppContext::SetUpLogging() bool AppContext::SetUpResourcesDir() { - std::string process_dir = PathCombine(App::sys_process_dir->GetStr(), "resources"); + std::string process_dir = PathCombine(App::sys_process_dir->getStr(), "resources"); #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX if (!FolderExists(process_dir)) { @@ -477,13 +477,13 @@ bool AppContext::SetUpResourcesDir() ErrorUtils::ShowError(_L("Startup error"), _L("Resources folder not found. Check if correctly installed.")); return false; } - App::sys_resources_dir->SetStr(process_dir); + App::sys_resources_dir->setStr(process_dir); return true; } bool AppContext::SetUpConfigSkeleton() { - Ogre::String src_path = PathCombine(App::sys_resources_dir->GetStr(), "skeleton.zip"); + Ogre::String src_path = PathCombine(App::sys_resources_dir->getStr(), "skeleton.zip"); Ogre::ResourceGroupManager::getSingleton().addResourceLocation(src_path, "Zip", "SrcRG"); Ogre::FileInfoListPtr fl = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("SrcRG", "*", true); if (fl->empty()) @@ -491,7 +491,7 @@ bool AppContext::SetUpConfigSkeleton() ErrorUtils::ShowError(_L("Startup error"), _L("Faulty resource folder. Check if correctly installed.")); return false; } - Ogre::String dst_path = PathCombine(App::sys_user_dir->GetStr(), ""); + Ogre::String dst_path = PathCombine(App::sys_user_dir->getStr(), ""); for (auto file : *fl) { CreateFolder(dst_path + file.basename); @@ -533,7 +533,7 @@ void AppContext::SetUpObsoleteConfMarker() { if (!FileExists(Ogre::StringUtil::format("%s\\OBSOLETE_FOLDER.txt", old_ror_homedir.c_str()))) { - Ogre::String obsoleteMessage = Ogre::StringUtil::format("This folder is obsolete, please move your mods to %s", App::sys_user_dir->GetStr()); + Ogre::String obsoleteMessage = Ogre::StringUtil::format("This folder is obsolete, please move your mods to %s", App::sys_user_dir->getStr()); try { Ogre::ResourceGroupManager::getSingleton().addResourceLocation(old_ror_homedir, "FileSystem", "homedir", false, false); @@ -548,7 +548,7 @@ void AppContext::SetUpObsoleteConfMarker() Ogre::String message = Ogre::StringUtil::format( "Welcome to Rigs of Rods %s\nPlease note that the mods folder has moved to:\n\"%s\"\nPlease move your mods to the new folder to continue using them", ROR_VERSION_STRING_SHORT, - App::sys_user_dir->GetStr() + App::sys_user_dir->getStr() ); RoR::App::GetGuiManager()->ShowMessageBox("Obsolete folder detected", message.c_str()); diff --git a/source/main/GameContext.cpp b/source/main/GameContext.cpp index 598fc6a67a..21afc6cc7d 100644 --- a/source/main/GameContext.cpp +++ b/source/main/GameContext.cpp @@ -192,7 +192,7 @@ Actor* GameContext::SpawnActor(ActorSpawnRequest& rq) #ifdef USE_SOCKETW if (rq.asr_origin != ActorSpawnRequest::Origin::NETWORK) { - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { RoRnet::UserInfo info = App::GetNetwork()->GetLocalUserData(); rq.asr_net_username = tryConvertUTF(info.username); @@ -226,13 +226,13 @@ Actor* GameContext::SpawnActor(ActorSpawnRequest& rq) { if (fresh_actor->ar_driveable != NOT_DRIVEABLE && fresh_actor->ar_num_nodes > 0 && - App::diag_preset_veh_enter->GetBool()) + App::diag_preset_veh_enter->getBool()) { this->PushMessage(Message(MSG_SIM_SEAT_PLAYER_REQUESTED, (void*)fresh_actor)); } if (fresh_actor->ar_driveable != NOT_DRIVEABLE && fresh_actor->ar_num_nodes > 0 && - App::cli_preset_veh_enter->GetBool()) + App::cli_preset_veh_enter->getBool()) { this->PushMessage(Message(MSG_SIM_SEAT_PLAYER_REQUESTED, (void*)fresh_actor)); } @@ -361,7 +361,7 @@ void GameContext::DeleteActor(Actor* actor) App::GetGfxScene()->RemoveGfxActor(actor->GetGfxActor()); #ifdef USE_SOCKETW - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { m_character_factory.UndoRemoteActorCoupling(actor); } @@ -545,7 +545,7 @@ void GameContext::SpawnPreselectedActor(std::string const& preset_vehicle, std:: void GameContext::ShowLoaderGUI(int type, const Ogre::String& instance, const Ogre::String& box) { // first, test if the place if clear, BUT NOT IN MULTIPLAYER - if (!(App::mp_state->GetEnum() == MpState::CONNECTED)) + if (!(App::mp_state->getEnum() == MpState::CONNECTED)) { collision_box_t* spawnbox = App::GetSimTerrain()->GetCollisions()->getBox(instance, box); for (auto actor : this->GetActorManager()->GetActors()) @@ -650,27 +650,27 @@ void GameContext::CreatePlayerCharacter() } // Preset position - commandline has precedence - if (App::cli_preset_spawn_pos->GetStr() != "") + if (App::cli_preset_spawn_pos->getStr() != "") { - spawn_pos = Ogre::StringConverter::parseVector3(App::cli_preset_spawn_pos->GetStr(), spawn_pos); - App::cli_preset_spawn_pos->SetStr(""); + spawn_pos = Ogre::StringConverter::parseVector3(App::cli_preset_spawn_pos->getStr(), spawn_pos); + App::cli_preset_spawn_pos->setStr(""); } - else if (App::diag_preset_spawn_pos->GetStr() != "") + else if (App::diag_preset_spawn_pos->getStr() != "") { - spawn_pos = Ogre::StringConverter::parseVector3(App::diag_preset_spawn_pos->GetStr(), spawn_pos); - App::diag_preset_spawn_pos->SetStr(""); + spawn_pos = Ogre::StringConverter::parseVector3(App::diag_preset_spawn_pos->getStr(), spawn_pos); + App::diag_preset_spawn_pos->setStr(""); } // Preset rotation - commandline has precedence - if (App::cli_preset_spawn_rot->GetStr() != "") + if (App::cli_preset_spawn_rot->getStr() != "") { - spawn_rot = Ogre::StringConverter::parseReal(App::cli_preset_spawn_rot->GetStr(), spawn_rot); - App::cli_preset_spawn_rot->SetStr(""); + spawn_rot = Ogre::StringConverter::parseReal(App::cli_preset_spawn_rot->getStr(), spawn_rot); + App::cli_preset_spawn_rot->setStr(""); } - else if (App::diag_preset_spawn_rot->GetStr() != "") + else if (App::diag_preset_spawn_rot->getStr() != "") { - spawn_rot = Ogre::StringConverter::parseReal(App::diag_preset_spawn_rot->GetStr(), spawn_rot); - App::diag_preset_spawn_rot->SetStr(""); + spawn_rot = Ogre::StringConverter::parseReal(App::diag_preset_spawn_rot->getStr(), spawn_rot); + App::diag_preset_spawn_rot->setStr(""); } spawn_pos.y = App::GetSimTerrain()->GetCollisions()->getSurfaceHeightBelow(spawn_pos.x, spawn_pos.z, spawn_pos.y + 1.8f); @@ -737,7 +737,7 @@ void GameContext::UpdateGlobalInputEvents() // Generic escape key event if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_QUIT_GAME)) { - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { if (App::GetGuiManager()->IsVisible_GameAbout()) { @@ -760,21 +760,21 @@ void GameContext::UpdateGlobalInputEvents() this->PushMessage(Message(MSG_APP_SHUTDOWN_REQUESTED)); } } - else if (App::app_state->GetEnum() == AppState::SIMULATION) + else if (App::app_state->getEnum() == AppState::SIMULATION) { if (App::GetGuiManager()->IsVisible_MainSelector()) { App::GetGuiManager()->GetMainSelector()->Close(); } - else if (App::sim_state->GetEnum() == SimState::RUNNING) + else if (App::sim_state->getEnum() == SimState::RUNNING) { this->PushMessage(Message(MSG_GUI_OPEN_MENU_REQUESTED)); - if (App::mp_state->GetEnum() != MpState::CONNECTED) + if (App::mp_state->getEnum() != MpState::CONNECTED) { this->PushMessage(Message(MSG_SIM_PAUSE_REQUESTED)); } } - else if (App::sim_state->GetEnum() == SimState::PAUSED) + else if (App::sim_state->getEnum() == SimState::PAUSED) { this->PushMessage(Message(MSG_SIM_UNPAUSE_REQUESTED)); this->PushMessage(Message(MSG_GUI_CLOSE_MENU_REQUESTED)); @@ -832,10 +832,10 @@ void GameContext::UpdateGlobalInputEvents() if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_TOGGLE_RESET_MODE)) { - App::sim_soft_reset_mode->SetVal(!App::sim_soft_reset_mode->GetBool()); + App::sim_soft_reset_mode->setVal(!App::sim_soft_reset_mode->getBool()); App::GetConsole()->putMessage( Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_NOTICE, - (App::sim_soft_reset_mode->GetBool()) ? _L("Enabled soft reset mode") : _L("Enabled hard reset mode")); + (App::sim_soft_reset_mode->getBool()) ? _L("Enabled soft reset mode") : _L("Enabled hard reset mode")); } } @@ -963,7 +963,7 @@ void GameContext::UpdateSimInputEvents(float dt) void GameContext::UpdateSkyInputEvents(float dt) { #ifdef USE_CAELUM - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::CAELUM && + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::CAELUM && App::GetSimTerrain()->getSkyManager()) { float time_factor = 1.0f; @@ -984,9 +984,9 @@ void GameContext::UpdateSkyInputEvents(float dt) { time_factor = -10000.0f; } - else if (App::gfx_sky_time_cycle->GetBool()) + else if (App::gfx_sky_time_cycle->getBool()) { - time_factor = App::gfx_sky_time_speed->GetInt(); + time_factor = App::gfx_sky_time_speed->getInt(); } if (App::GetSimTerrain()->getSkyManager()->GetSkyTimeFactor() != time_factor) @@ -998,7 +998,7 @@ void GameContext::UpdateSkyInputEvents(float dt) } #endif // USE_CAELUM - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::SKYX && + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::SKYX && App::GetSimTerrain()->getSkyXManager()) { if (RoR::App::GetInputEngine()->getEventBoolValue(EV_SKY_INCREASE_TIME)) @@ -1121,7 +1121,7 @@ void GameContext::UpdateCommonInputEvents(float dt) } if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_RESCUE_TRUCK, 0.5f) && - App::mp_state->GetEnum() != MpState::CONNECTED && + App::mp_state->getEnum() != MpState::CONNECTED && m_player_actor->ar_driveable != AIRPLANE) { Actor* rescuer = nullptr; diff --git a/source/main/audio/MumbleIntegration.cpp b/source/main/audio/MumbleIntegration.cpp index 44de9ae8e2..b44adcefe9 100644 --- a/source/main/audio/MumbleIntegration.cpp +++ b/source/main/audio/MumbleIntegration.cpp @@ -100,8 +100,8 @@ void MumbleIntegration::SetNonPositionalAudio() void MumbleIntegration::Update() { - if (App::app_state->GetEnum() == AppState::SIMULATION && - App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::app_state->getEnum() == AppState::SIMULATION && + App::mp_state->getEnum() == MpState::CONNECTED) { // calculate orientation of avatar first Character* avatar = App::GetGameContext()->GetPlayerCharacter(); @@ -180,7 +180,7 @@ void MumbleIntegration::updateMumble(Ogre::Vector3 cameraPos, Ogre::Vector3 came lm->fCameraTop[2] = -cameraUp.z; // Identifier which uniquely identifies a certain player in a context (e.g. the ingame Name). - MyGUI::UString player_name(RoR::App::mp_player_name->GetStr()); + MyGUI::UString player_name(RoR::App::mp_player_name->getStr()); wcsncpy(lm->identity, player_name.asWStr_c_str(), 256); // Context should be equal for players which should be able to hear each other _positional_ and @@ -193,9 +193,9 @@ void MumbleIntegration::updateMumble(Ogre::Vector3 cameraPos, Ogre::Vector3 came // so we should take that into account as well int teamID = 0; // RoR currently doesn't have any kind of team-based gameplay - int port = RoR::App::mp_server_port->GetInt(); + int port = RoR::App::mp_server_port->getInt(); port = (port != 0) ? port : 1337; - sprintf((char *)lm->context, "%s:%d|%d", RoR::App::mp_server_host->GetStr().c_str(), port, teamID); + sprintf((char *)lm->context, "%s:%d|%d", RoR::App::mp_server_host->getStr().c_str(), port, teamID); lm->context_len = (int)strnlen((char *)lm->context, 256); } diff --git a/source/main/audio/SoundManager.cpp b/source/main/audio/SoundManager.cpp index 6966913528..d87728cda7 100644 --- a/source/main/audio/SoundManager.cpp +++ b/source/main/audio/SoundManager.cpp @@ -59,18 +59,18 @@ SoundManager::SoundManager() : , sound_context(NULL) , audio_device(NULL) { - if (App::audio_device_name->GetStr() == "") + if (App::audio_device_name->getStr() == "") { LOGSTREAM << "No audio device configured, opening default."; audio_device = alcOpenDevice(nullptr); } else { - audio_device = alcOpenDevice(App::audio_device_name->GetStr().c_str()); + audio_device = alcOpenDevice(App::audio_device_name->getStr().c_str()); if (!audio_device) { - LOGSTREAM << "Failed to open configured audio device \"" << App::audio_device_name->GetStr() << "\", opening default."; - App::audio_device_name->SetStr(""); + LOGSTREAM << "Failed to open configured audio device \"" << App::audio_device_name->getStr() << "\", opening default."; + App::audio_device_name->setStr(""); audio_device = alcOpenDevice(nullptr); } } @@ -238,7 +238,7 @@ void SoundManager::recomputeSource(int source_index, int reason, float vfl, Vect break; case Sound::REASON_STOP: alSourceStop(hw_source); break; - case Sound::REASON_GAIN: alSourcef(hw_source, AL_GAIN, vfl * App::audio_master_volume->GetFloat()); + case Sound::REASON_GAIN: alSourcef(hw_source, AL_GAIN, vfl * App::audio_master_volume->getFloat()); break; case Sound::REASON_LOOP: alSourcei(hw_source, AL_LOOPING, (vfl > 0.5) ? AL_TRUE : AL_FALSE); break; @@ -305,7 +305,7 @@ void SoundManager::assign(int source_index, int hardware_index) // the hardware source is supposed to be stopped! alSourcei(hw_source, AL_BUFFER, audio_source->buffer); - alSourcef(hw_source, AL_GAIN, audio_source->gain * App::audio_master_volume->GetFloat()); + alSourcef(hw_source, AL_GAIN, audio_source->gain * App::audio_master_volume->getFloat()); alSourcei(hw_source, AL_LOOPING, (audio_source->loop) ? AL_TRUE : AL_FALSE); alSourcef(hw_source, AL_PITCH, audio_source->pitch); alSource3f(hw_source, AL_POSITION, audio_source->position.x, audio_source->position.y, audio_source->position.z); @@ -344,7 +344,7 @@ void SoundManager::resumeAllSounds() if (!audio_device) return; // no mutex needed - alListenerf(AL_GAIN, App::audio_master_volume->GetFloat()); + alListenerf(AL_GAIN, App::audio_master_volume->getFloat()); } void SoundManager::setMasterVolume(float v) @@ -352,7 +352,7 @@ void SoundManager::setMasterVolume(float v) if (!audio_device) return; // no mutex needed - App::audio_master_volume->SetVal(v); // TODO: Use 'pending' mechanism and set externally, only 'apply' here. + App::audio_master_volume->setVal(v); // TODO: Use 'pending' mechanism and set externally, only 'apply' here. alListenerf(AL_GAIN, v); } diff --git a/source/main/audio/SoundScriptManager.cpp b/source/main/audio/SoundScriptManager.cpp index f321bd35a1..395955b65e 100644 --- a/source/main/audio/SoundScriptManager.cpp +++ b/source/main/audio/SoundScriptManager.cpp @@ -305,8 +305,8 @@ void SoundScriptManager::modulate(int actor_id, int mod, float value, int linkTy void SoundScriptManager::update(float dt_sec) { - if (App::sim_state->GetEnum() == SimState::RUNNING || - App::sim_state->GetEnum() == SimState::EDITOR_MODE) + if (App::sim_state->getEnum() == SimState::RUNNING || + App::sim_state->getEnum() == SimState::EDITOR_MODE) { Ogre::SceneNode* cam_node = App::GetCameraManager()->GetCameraNode(); static Vector3 lastCameraPosition; @@ -674,7 +674,7 @@ bool SoundScriptTemplate::setParameter(Ogre::StringVector vec) trigger_source = SS_TRIG_GEARSLIDE; return true; }; - if (vec[1] == String("creak") && App::audio_enable_creak->GetBool()) + if (vec[1] == String("creak") && App::audio_enable_creak->getBool()) { trigger_source = SS_TRIG_CREAK; return true; diff --git a/source/main/gameplay/Character.cpp b/source/main/gameplay/Character.cpp index c63b23d128..0f7957e761 100644 --- a/source/main/gameplay/Character.cpp +++ b/source/main/gameplay/Character.cpp @@ -62,7 +62,7 @@ Character::Character(int source, unsigned int streamid, UTFString player_name, i m_instance_name = "Character" + TOSTRING(id_counter); ++id_counter; - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { this->SendStreamSetup(); } @@ -128,7 +128,7 @@ float calculate_collision_depth(Vector3 pos) void Character::update(float dt) { - if (!m_is_remote && (m_actor_coupling == nullptr) && (App::sim_state->GetEnum() != SimState::PAUSED)) + if (!m_is_remote && (m_actor_coupling == nullptr) && (App::sim_state->getEnum() != SimState::PAUSED)) { // disable character movement when using the free camera mode or when the menu is opened // TODO: check for menu being opened @@ -391,7 +391,7 @@ void Character::update(float dt) } #ifdef USE_SOCKETW - if ((App::mp_state->GetEnum() == MpState::CONNECTED) && !m_is_remote) + if ((App::mp_state->getEnum() == MpState::CONNECTED) && !m_is_remote) { this->SendStreamData(); } @@ -524,7 +524,7 @@ void Character::SetActorCoupling(bool enabled, Actor* actor) { m_actor_coupling = actor; #ifdef USE_SOCKETW - if (App::mp_state->GetEnum() == MpState::CONNECTED && !m_is_remote) + if (App::mp_state->getEnum() == MpState::CONNECTED && !m_is_remote) { if (enabled) { @@ -688,7 +688,7 @@ void RoR::GfxCharacter::UpdateCharacterInScene() // Multiplayer label #ifdef USE_SOCKETW - if (App::mp_state->GetEnum() == MpState::CONNECTED && !xc_simbuf.simbuf_actor_coupling) + if (App::mp_state->getEnum() == MpState::CONNECTED && !xc_simbuf.simbuf_actor_coupling) { if (xc_movable_text == nullptr) { @@ -714,7 +714,7 @@ void RoR::GfxCharacter::UpdateCharacterInScene() if (xc_movable_text != nullptr) { - if (App::mp_hide_net_labels->GetBool() || (!xc_simbuf.simbuf_is_remote && App::mp_hide_own_net_label->GetBool())) + if (App::mp_hide_net_labels->getBool() || (!xc_simbuf.simbuf_is_remote && App::mp_hide_own_net_label->getBool())) { xc_movable_text->setVisible(false); return; diff --git a/source/main/gameplay/CharacterFactory.cpp b/source/main/gameplay/CharacterFactory.cpp index c42c57b24d..4a00bbce59 100644 --- a/source/main/gameplay/CharacterFactory.cpp +++ b/source/main/gameplay/CharacterFactory.cpp @@ -34,7 +34,7 @@ Character* CharacterFactory::CreateLocalCharacter() Ogre::UTFString playerName = ""; #ifdef USE_SOCKETW - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { RoRnet::UserInfo info = App::GetNetwork()->GetLocalUserData(); colourNum = info.colournum; diff --git a/source/main/gameplay/EngineSim.cpp b/source/main/gameplay/EngineSim.cpp index f9eaa7a4d0..5b52dc0690 100644 --- a/source/main/gameplay/EngineSim.cpp +++ b/source/main/gameplay/EngineSim.cpp @@ -1287,7 +1287,7 @@ void EngineSim::UpdateInputEvents(float dt) } // arcade controls are only working with auto-clutch! - if (!App::io_arcade_controls->GetBool() || (this->GetAutoShiftMode() >= SimGearboxMode::MANUAL)) + if (!App::io_arcade_controls->getBool() || (this->GetAutoShiftMode() >= SimGearboxMode::MANUAL)) { // classic mode, realistic this->autoSetAcc(accl); @@ -1418,7 +1418,7 @@ void EngineSim::UpdateInputEvents(float dt) else if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SHIFT_DOWN)) { if (shiftmode > SimGearboxMode::SEMI_AUTO || - shiftmode == SimGearboxMode::SEMI_AUTO && (!App::io_arcade_controls->GetBool()) || + shiftmode == SimGearboxMode::SEMI_AUTO && (!App::io_arcade_controls->getBool()) || shiftmode == SimGearboxMode::SEMI_AUTO && this->GetGear() > 0 || shiftmode == SimGearboxMode::AUTO) { diff --git a/source/main/gameplay/ProceduralManager.cpp b/source/main/gameplay/ProceduralManager.cpp index 96f0804d0e..44c423ddbf 100644 --- a/source/main/gameplay/ProceduralManager.cpp +++ b/source/main/gameplay/ProceduralManager.cpp @@ -52,7 +52,7 @@ int ProceduralManager::updateObject(ProceduralObject& po) // create new road2 object po.road = new Road2((int)pObjects.size()); // In diagnostic mode, disable collisions (speeds up terrain loading) - po.road->setCollisionEnabled(!App::diag_terrn_log_roads->GetBool()); + po.road->setCollisionEnabled(!App::diag_terrn_log_roads->getBool()); std::vector::iterator it; for (it = po.points.begin(); it != po.points.end(); it++) diff --git a/source/main/gameplay/RecoveryMode.cpp b/source/main/gameplay/RecoveryMode.cpp index a81446db45..3712bcabfd 100644 --- a/source/main/gameplay/RecoveryMode.cpp +++ b/source/main/gameplay/RecoveryMode.cpp @@ -28,7 +28,7 @@ using namespace RoR; void RecoveryMode::UpdateInputEvents(float dt) { - if (App::sim_state->GetEnum() != SimState::RUNNING && + if (App::sim_state->getEnum() != SimState::RUNNING && App::GetGameContext()->GetPlayerActor() && App::GetGameContext()->GetPlayerActor()->ar_sim_state != Actor::SimState::NETWORKED_OK && App::GetGameContext()->GetPlayerActor()->ar_sim_state != Actor::SimState::LOCAL_REPLAY) @@ -113,7 +113,7 @@ void RecoveryMode::UpdateInputEvents(float dt) App::GetGameContext()->GetPlayerActor()->requestRotation(rotation, rotation_center); App::GetGameContext()->GetPlayerActor()->requestTranslation(translation); - if (App::sim_soft_reset_mode->GetBool()) + if (App::sim_soft_reset_mode->getBool()) { for (auto actor : App::GetGameContext()->GetPlayerActor()->getAllLinkedActors()) { @@ -127,7 +127,7 @@ void RecoveryMode::UpdateInputEvents(float dt) else if (App::GetInputEngine()->isKeyDownValueBounce(OIS::KC_SPACE)) { App::GetGameContext()->GetPlayerActor()->requestAngleSnap(45); - if (App::sim_soft_reset_mode->GetBool()) + if (App::sim_soft_reset_mode->getBool()) { for (auto actor : App::GetGameContext()->GetPlayerActor()->getAllLinkedActors()) { @@ -141,7 +141,7 @@ void RecoveryMode::UpdateInputEvents(float dt) } auto reset_type = ActorModifyRequest::Type::RESET_ON_SPOT; - if (App::sim_soft_reset_mode->GetBool()) + if (App::sim_soft_reset_mode->getBool()) { reset_type = ActorModifyRequest::Type::SOFT_RESET; for (auto actor : App::GetGameContext()->GetPlayerActor()->getAllLinkedActors()) diff --git a/source/main/gameplay/Replay.cpp b/source/main/gameplay/Replay.cpp index 24e6bb216f..de65e1cd15 100644 --- a/source/main/gameplay/Replay.cpp +++ b/source/main/gameplay/Replay.cpp @@ -54,7 +54,7 @@ Replay::Replay(Actor* actor, int _numFrames) writeIndex = 0; firstRun = 1; - int steps = App::sim_replay_stepping->GetInt(); + int steps = App::sim_replay_stepping->getInt(); if (steps <= 0) this->ar_replay_precision = 0.0f; diff --git a/source/main/gameplay/Road2.cpp b/source/main/gameplay/Road2.cpp index a4f7718ea5..79d287f069 100644 --- a/source/main/gameplay/Road2.cpp +++ b/source/main/gameplay/Road2.cpp @@ -249,7 +249,7 @@ void Road2::addBlock(Vector3 pos, Quaternion rot, int type, float width, float b lastbheight = bheight; lasttype = type; - if (App::diag_terrn_log_roads->GetBool()) + if (App::diag_terrn_log_roads->getBool()) { Str<2000> msg; msg << "[RoR] Road Block |"; msg << " pos=(" << pos.x << " " << pos.y << " " << pos.z << ")"; diff --git a/source/main/gameplay/SceneMouse.cpp b/source/main/gameplay/SceneMouse.cpp index b6dcfa83a1..c062f8d2dc 100644 --- a/source/main/gameplay/SceneMouse.cpp +++ b/source/main/gameplay/SceneMouse.cpp @@ -88,7 +88,7 @@ void SceneMouse::DiscardVisuals() void SceneMouse::releaseMousePick() { - if (App::sim_state->GetEnum() == SimState::PAUSED) { return; } // Do nothing when paused + if (App::sim_state->getEnum() == SimState::PAUSED) { return; } // Do nothing when paused // remove forces if (grab_truck) @@ -219,7 +219,7 @@ void SceneMouse::UpdateVisuals() bool SceneMouse::mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) { - if (App::sim_state->GetEnum() == SimState::PAUSED) { return true; } // Do nothing when paused + if (App::sim_state->getEnum() == SimState::PAUSED) { return true; } // Do nothing when paused const OIS::MouseState ms = _arg.state; @@ -229,7 +229,7 @@ bool SceneMouse::mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID _i lastMouseX = ms.X.abs; Ray mouseRay = getMouseRay(); - if (App::sim_state->GetEnum() == SimState::EDITOR_MODE) + if (App::sim_state->getEnum() == SimState::EDITOR_MODE) { return true; } @@ -295,7 +295,7 @@ bool SceneMouse::mousePressed(const OIS::MouseEvent& _arg, OIS::MouseButtonID _i bool SceneMouse::mouseReleased(const OIS::MouseEvent& _arg, OIS::MouseButtonID _id) { - if (App::sim_state->GetEnum() == SimState::PAUSED) { return true; } // Do nothing when paused + if (App::sim_state->getEnum() == SimState::PAUSED) { return true; } // Do nothing when paused if (mouseGrabState == 1) { diff --git a/source/main/gfx/EnvironmentMap.cpp b/source/main/gfx/EnvironmentMap.cpp index 90ff28a9da..fc28ec1703 100644 --- a/source/main/gfx/EnvironmentMap.cpp +++ b/source/main/gfx/EnvironmentMap.cpp @@ -67,7 +67,7 @@ void RoR::GfxEnvmap::SetupEnvMap() m_cameras[4]->setDirection(-Ogre::Vector3::UNIT_Z); m_cameras[5]->setDirection(+Ogre::Vector3::UNIT_Z); - if (App::diag_envmap->GetBool()) + if (App::diag_envmap->getBool()) { // create fancy mesh for debugging the envmap Ogre::Overlay* overlay = Ogre::OverlayManager::getSingleton().create("EnvMapDebugOverlay"); @@ -204,9 +204,9 @@ RoR::GfxEnvmap::~GfxEnvmap() void RoR::GfxEnvmap::UpdateEnvMap(Ogre::Vector3 center, GfxActor* gfx_actor, bool full/*=false*/) { // how many of the 6 render planes to update at once? Use cvar 'gfx_envmap_rate', unless instructed to do full render. - const int update_rate = full ? NUM_FACES : App::gfx_envmap_rate->GetInt(); + const int update_rate = full ? NUM_FACES : App::gfx_envmap_rate->getInt(); - if (!App::gfx_envmap_enabled->GetBool()) + if (!App::gfx_envmap_enabled->getBool()) { return; } diff --git a/source/main/gfx/GfxActor.cpp b/source/main/gfx/GfxActor.cpp index be1964ec5d..a035f0b5b6 100644 --- a/source/main/gfx/GfxActor.cpp +++ b/source/main/gfx/GfxActor.cpp @@ -384,7 +384,7 @@ void RoR::GfxActor::UpdateVideoCameras(float dt_sec) #ifdef USE_CAELUM // caelum needs to know that we changed the cameras SkyManager* sky = App::GetSimTerrain()->getSkyManager(); - if ((sky != nullptr) && (RoR::App::app_state->GetEnum() == RoR::AppState::SIMULATION)) + if ((sky != nullptr) && (RoR::App::app_state->getEnum() == RoR::AppState::SIMULATION)) { sky->NotifySkyCameraChanged(vidcam.vcam_ogre_camera); } @@ -677,7 +677,7 @@ void RoR::GfxActor::UpdateDebugView() const size_t num_beams = static_cast(m_actor->ar_num_beams); for (size_t i = 0; i < num_beams; ++i) { - if (App::diag_hide_wheels->GetBool() && + if (App::diag_hide_wheels->getBool() && (beams[i].p1->nd_tyre_node || beams[i].p1->nd_rim_node || beams[i].p2->nd_tyre_node || beams[i].p2->nd_rim_node)) continue; @@ -692,7 +692,7 @@ void RoR::GfxActor::UpdateDebugView() if (beams[i].bm_broken) { - if (!App::diag_hide_broken_beams->GetBool()) + if (!App::diag_hide_broken_beams->getBool()) { drawlist->AddLine(pos1xy, pos2xy, BEAM_BROKEN_COLOR, BEAM_BROKEN_THICKNESS); } @@ -707,7 +707,7 @@ void RoR::GfxActor::UpdateDebugView() else { ImU32 color = BEAM_COLOR; - if (!App::diag_hide_beam_stress->GetBool()) + if (!App::diag_hide_beam_stress->getBool()) { if (beams[i].stress > 0) { @@ -727,14 +727,14 @@ void RoR::GfxActor::UpdateDebugView() } } - if (!App::diag_hide_nodes->GetBool()) + if (!App::diag_hide_nodes->getBool()) { // Nodes const node_t* nodes = m_actor->ar_nodes; const size_t num_nodes = static_cast(m_actor->ar_num_nodes); for (size_t i = 0; i < num_nodes; ++i) { - if (App::diag_hide_wheels->GetBool() && (nodes[i].nd_tyre_node || nodes[i].nd_rim_node)) + if (App::diag_hide_wheels->getBool() && (nodes[i].nd_tyre_node || nodes[i].nd_rim_node)) continue; Ogre::Vector3 pos_xyz = world2screen.Convert(nodes[i].AbsPosition); @@ -758,7 +758,7 @@ void RoR::GfxActor::UpdateDebugView() { for (size_t i = 0; i < num_nodes; ++i) { - if ((App::diag_hide_wheels->GetBool() || App::diag_hide_wheel_info->GetBool()) && + if ((App::diag_hide_wheels->getBool() || App::diag_hide_wheel_info->getBool()) && (nodes[i].nd_tyre_node || nodes[i].nd_rim_node)) continue; @@ -788,7 +788,7 @@ void RoR::GfxActor::UpdateDebugView() { for (size_t i = 0; i < num_beams; ++i) { - if ((App::diag_hide_wheels->GetBool() || App::diag_hide_wheel_info->GetBool()) && + if ((App::diag_hide_wheels->getBool() || App::diag_hide_wheel_info->getBool()) && (beams[i].p1->nd_tyre_node || beams[i].p1->nd_rim_node || beams[i].p2->nd_tyre_node || beams[i].p2->nd_rim_node)) continue; @@ -2053,7 +2053,7 @@ void RoR::GfxActor::UpdateNetLabels(float dt) // TODO: Remake network player labels via GUI... they shouldn't be billboards inside the scene ~ only_a_ptr, 05/2018 if (m_actor->m_net_label_node && m_actor->m_net_label_mt) { - if (App::mp_hide_net_labels->GetBool() || (!m_simbuf.simbuf_is_remote && App::mp_hide_own_net_label->GetBool())) + if (App::mp_hide_net_labels->getBool() || (!m_simbuf.simbuf_is_remote && App::mp_hide_own_net_label->getBool())) { m_actor->m_net_label_mt->setVisible(false); return; @@ -2121,7 +2121,7 @@ void RoR::GfxActor::UpdateBeaconFlare(Prop & prop, float dt, bool is_player_acto // TODO: Quick and dirty port from Beam::updateFlares(), clean it up ~ only_a_ptr, 06/2018 using namespace Ogre; - bool enableAll = !((App::gfx_flares_mode->GetEnum() == GfxFlaresMode::CURR_VEHICLE_HEAD_ONLY) && !is_player_actor); + bool enableAll = !((App::gfx_flares_mode->getEnum() == GfxFlaresMode::CURR_VEHICLE_HEAD_ONLY) && !is_player_actor); SimBuffer::NodeSB* nodes = this->GetSimNodeBuffer(); if (prop.pp_beacon_type == 'b') @@ -2340,7 +2340,7 @@ void RoR::GfxActor::UpdateProps(float dt, bool is_player_actor) this->SetBeaconsEnabled(m_beaconlight_active); } - if ((App::gfx_flares_mode->GetEnum() != GfxFlaresMode::NONE) + if ((App::gfx_flares_mode->getEnum() != GfxFlaresMode::NONE) && m_beaconlight_active) { for (Prop& prop: m_props) @@ -2390,7 +2390,7 @@ void RoR::GfxActor::UpdateRenderdashRTT() void RoR::GfxActor::SetBeaconsEnabled(bool beacon_light_is_active) { - const bool enableLight = (App::gfx_flares_mode->GetEnum() != GfxFlaresMode::NO_LIGHTSOURCES); + const bool enableLight = (App::gfx_flares_mode->getEnum() != GfxFlaresMode::NO_LIGHTSOURCES); for (Prop& prop: m_props) { @@ -3187,7 +3187,7 @@ void RoR::GfxActor::UpdateFlares(float dt_sec, bool is_player) { // == Flare states are determined in simulation, this function only applies them to OGRE objects == - bool enableAll = ((App::gfx_flares_mode->GetEnum() == GfxFlaresMode::CURR_VEHICLE_HEAD_ONLY) && !is_player); + bool enableAll = ((App::gfx_flares_mode->getEnum() == GfxFlaresMode::CURR_VEHICLE_HEAD_ONLY) && !is_player); SimBuffer::NodeSB* nodes = this->GetSimNodeBuffer(); int num_flares = static_cast(m_actor->ar_flares.size()); diff --git a/source/main/gfx/GfxScene.cpp b/source/main/gfx/GfxScene.cpp index a99f5a64c0..5a85d33b80 100644 --- a/source/main/gfx/GfxScene.cpp +++ b/source/main/gfx/GfxScene.cpp @@ -105,12 +105,12 @@ void RoR::GfxScene::UpdateScene(float dt_sec) if (m_simbuf.simbuf_camera_behavior != CameraManager::CAMERA_BEHAVIOR_STATIC) { float fov = (m_simbuf.simbuf_camera_behavior == CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM) - ? App::gfx_fov_internal->GetFloat() : App::gfx_fov_external->GetFloat(); + ? App::gfx_fov_internal->getFloat() : App::gfx_fov_external->getFloat(); RoR::App::GetCameraManager()->GetCamera()->setFOVy(Ogre::Degree(fov)); } // Particles - if (App::gfx_particles_mode->GetInt() == 1) + if (App::gfx_particles_mode->getInt() == 1) { for (GfxActor* gfx_actor: m_all_gfx_actors) { diff --git a/source/main/gfx/HydraxWater.cpp b/source/main/gfx/HydraxWater.cpp index cacda8491d..cd26c688cb 100644 --- a/source/main/gfx/HydraxWater.cpp +++ b/source/main/gfx/HydraxWater.cpp @@ -125,7 +125,7 @@ void HydraxWater::SetWaterVisible(bool value) float HydraxWater::CalcWavesHeight(Vector3 pos) { - if (!RoR::App::gfx_water_waves->GetBool()) + if (!RoR::App::gfx_water_waves->getBool()) { return waterHeight; } @@ -135,7 +135,7 @@ float HydraxWater::CalcWavesHeight(Vector3 pos) Vector3 HydraxWater::CalcWavesVelocity(Vector3 pos) { - if (!RoR::App::gfx_water_waves->GetBool()) + if (!RoR::App::gfx_water_waves->getBool()) return Vector3(0, 0, 0); return Vector3(0, 0, 0); //TODO diff --git a/source/main/gfx/ShadowManager.cpp b/source/main/gfx/ShadowManager.cpp index 11bedc34dd..4ad50f5b04 100644 --- a/source/main/gfx/ShadowManager.cpp +++ b/source/main/gfx/ShadowManager.cpp @@ -38,7 +38,7 @@ ShadowManager::ShadowManager() PSSM_Shadows.mPSSMSetup.setNull(); PSSM_Shadows.mDepthShadows = false; PSSM_Shadows.ShadowsTextureNum = 3; - PSSM_Shadows.Quality = RoR::App::gfx_shadow_quality->GetInt(); //0 = Low quality, 1 = mid, 2 = hq, 3 = ultra + PSSM_Shadows.Quality = RoR::App::gfx_shadow_quality->getInt(); //0 = Low quality, 1 = mid, 2 = hq, 3 = ultra } ShadowManager::~ShadowManager() @@ -56,7 +56,7 @@ int ShadowManager::updateShadowTechnique() App::GetGfxScene()->GetSceneManager()->setShadowColour(Ogre::ColourValue(0.563 + scoef, 0.578 + scoef, 0.625 + scoef)); App::GetGfxScene()->GetSceneManager()->setShowDebugShadows(false); - if (App::gfx_shadow_type->GetEnum() == GfxShadowType::PSSM) + if (App::gfx_shadow_type->getEnum() == GfxShadowType::PSSM) { processPSSM(); if (App::GetGfxScene()->GetSceneManager()->getShowDebugShadows()) @@ -163,7 +163,7 @@ void ShadowManager::updatePSSM() void ShadowManager::updateTerrainMaterial(Ogre::TerrainPSSMMaterialGenerator::SM2Profile* matProfile) { - if (App::gfx_shadow_type->GetEnum() == GfxShadowType::PSSM) + if (App::gfx_shadow_type->getEnum() == GfxShadowType::PSSM) { Ogre::PSSMShadowCameraSetup* pssmSetup = static_cast(PSSM_Shadows.mPSSMSetup.get()); matProfile->setReceiveDynamicShadowsDepth(true); diff --git a/source/main/gfx/Water.cpp b/source/main/gfx/Water.cpp index 9b94834bac..d491dd2670 100644 --- a/source/main/gfx/Water.cpp +++ b/source/main/gfx/Water.cpp @@ -59,7 +59,7 @@ Water::Water(Ogre::Vector3 terrn_size) : m_waterplane_mesh_scale = 1.5f; char line[1024] = {}; - std::string filepath = PathCombine(RoR::App::sys_config_dir->GetStr(), "wavefield.cfg"); + std::string filepath = PathCombine(RoR::App::sys_config_dir->getStr(), "wavefield.cfg"); FILE* fd = fopen(filepath.c_str(), "r"); if (fd) { @@ -177,7 +177,7 @@ void Water::PrepareWater() m_water_plane.normal = Vector3::UNIT_Y; m_water_plane.d = 0; - const auto type = App::gfx_water_mode->GetEnum(); + const auto type = App::gfx_water_mode->getEnum(); const bool full_gfx = type == GfxWaterMode::FULL_HQ || type == GfxWaterMode::FULL_FAST; if (full_gfx || type == GfxWaterMode::REFLECT) @@ -357,7 +357,7 @@ void Water::SetWaterVisible(bool value) void Water::SetReflectionPlaneHeight(float centerheight) { - const auto type = App::gfx_water_mode->GetEnum(); + const auto type = App::gfx_water_mode->getEnum(); if (type == GfxWaterMode::FULL_HQ || type == GfxWaterMode::FULL_FAST || type == GfxWaterMode::REFLECT) { this->UpdateReflectionPlane(centerheight); @@ -441,12 +441,12 @@ void Water::UpdateWater() m_waterplane_node->setPosition(Vector3(waterPos.x, m_water_height, waterPos.z)); m_bottomplane_node->setPosition(bottomPos); } - if (RoR::App::gfx_water_waves->GetBool() && RoR::App::mp_state->GetEnum() == RoR::MpState::DISABLED) + if (RoR::App::gfx_water_waves->getBool() && RoR::App::mp_state->getEnum() == RoR::MpState::DISABLED) this->ShowWave(m_waterplane_node->getPosition()); } m_frame_counter++; - if (App::gfx_water_mode->GetEnum() == GfxWaterMode::FULL_FAST) + if (App::gfx_water_mode->getEnum() == GfxWaterMode::FULL_FAST) { if (m_frame_counter % 2 == 1 || m_waterplane_force_update_pos) { @@ -463,7 +463,7 @@ void Water::UpdateWater() m_refract_rtt_target->update(); } } - else if (App::gfx_water_mode->GetEnum() == GfxWaterMode::FULL_HQ) + else if (App::gfx_water_mode->getEnum() == GfxWaterMode::FULL_HQ) { m_reflect_cam->setOrientation(camera_rot); m_reflect_cam->setPosition(camera_pos); @@ -475,7 +475,7 @@ void Water::UpdateWater() m_refract_cam->setFOVy(camera_fov); m_refract_rtt_target->update(); } - else if (App::gfx_water_mode->GetEnum() == GfxWaterMode::REFLECT) + else if (App::gfx_water_mode->getEnum() == GfxWaterMode::REFLECT) { m_reflect_cam->setOrientation(camera_rot); m_reflect_cam->setPosition(camera_pos); @@ -518,7 +518,7 @@ void Water::SetWaterBottomHeight(float value) float Water::CalcWavesHeight(Vector3 pos) { // no waves? - if (!RoR::App::gfx_water_waves->GetBool() || RoR::App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (!RoR::App::gfx_water_waves->getBool() || RoR::App::mp_state->getEnum() == RoR::MpState::CONNECTED) { // constant height, sea is flat as pancake return m_water_height; @@ -551,7 +551,7 @@ bool Water::IsUnderWater(Vector3 pos) { float waterheight = m_water_height; - if (RoR::App::gfx_water_waves->GetBool() && RoR::App::mp_state->GetEnum() == RoR::MpState::DISABLED) + if (RoR::App::gfx_water_waves->getBool() && RoR::App::mp_state->getEnum() == RoR::MpState::DISABLED) { float waveheight = GetWaveHeight(pos); @@ -566,7 +566,7 @@ bool Water::IsUnderWater(Vector3 pos) Vector3 Water::CalcWavesVelocity(Vector3 pos) { - if (!RoR::App::gfx_water_waves->GetBool() || RoR::App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (!RoR::App::gfx_water_waves->getBool() || RoR::App::mp_state->getEnum() == RoR::MpState::CONNECTED) return Vector3::ZERO; float waveheight = GetWaveHeight(pos); diff --git a/source/main/gfx/camera/CameraManager.cpp b/source/main/gfx/camera/CameraManager.cpp index a88891dbf9..3deefe6b85 100644 --- a/source/main/gfx/camera/CameraManager.cpp +++ b/source/main/gfx/camera/CameraManager.cpp @@ -199,7 +199,7 @@ void CameraManager::UpdateCurrentBehavior() } case CAMERA_BEHAVIOR_STATIC: - m_staticcam_fov_exponent = App::gfx_static_cam_fov_exp->GetFloat(); + m_staticcam_fov_exponent = App::gfx_static_cam_fov_exp->getFloat(); this->UpdateCameraBehaviorStatic(); return; @@ -241,8 +241,8 @@ void CameraManager::UpdateCurrentBehavior() void CameraManager::UpdateInputEvents(float dt) // Called every frame { - if (App::sim_state->GetEnum() != SimState::RUNNING && - App::sim_state->GetEnum() != SimState::EDITOR_MODE) + if (App::sim_state->getEnum() != SimState::RUNNING && + App::sim_state->getEnum() != SimState::EDITOR_MODE) { return; } @@ -292,10 +292,10 @@ void CameraManager::UpdateInputEvents(float dt) // Called every frame int fov = -1; if (modifier != 0) { - fov = cvar_fov->GetInt() + modifier; + fov = cvar_fov->getInt() + modifier; if (fov >= 10 && fov <= 160) { - cvar_fov->SetVal(fov); + cvar_fov->setVal(fov); } else { @@ -306,7 +306,7 @@ void CameraManager::UpdateInputEvents(float dt) // Called every frame { CVar* cvar_fov_default = ((this->GetCurrentBehavior() == CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM)) ? App::gfx_fov_internal_default : App::gfx_fov_external_default; - cvar_fov->SetVal(cvar_fov_default->GetInt()); + cvar_fov->setVal(cvar_fov_default->getInt()); } if (fov != -1) @@ -350,7 +350,7 @@ void CameraManager::ResetCurrentBehavior() case CAMERA_BEHAVIOR_STATIC: m_staticcam_fov_exponent = 1.0f; - App::gfx_static_cam_fov_exp->SetVal(1.0f); + App::gfx_static_cam_fov_exp->setVal(1.0f); return; case CAMERA_BEHAVIOR_VEHICLE: @@ -361,7 +361,7 @@ void CameraManager::ResetCurrentBehavior() case CAMERA_BEHAVIOR_VEHICLE_CINECAM: CameraManager::CameraBehaviorOrbitReset(); m_cam_rot_y = Degree(DEFAULT_INTERNAL_CAM_PITCH); - App::GetCameraManager()->GetCamera()->setFOVy(Degree(App::gfx_fov_internal->GetInt())); + App::GetCameraManager()->GetCamera()->setFOVy(Degree(App::gfx_fov_internal->getInt())); return; case CAMERA_BEHAVIOR_FREE: return; @@ -418,7 +418,7 @@ void CameraManager::ActivateNewBehavior(CameraBehaviors new_behavior, bool reset this->ResetCurrentBehavior(); } - App::GetCameraManager()->GetCamera()->setFOVy(Degree(App::gfx_fov_internal->GetInt())); + App::GetCameraManager()->GetCamera()->setFOVy(Degree(App::gfx_fov_internal->getInt())); m_cct_player_actor->prepareInside(true); @@ -475,7 +475,7 @@ void CameraManager::DeactivateCurrentBehavior() { if ( m_cct_player_actor != nullptr ) { - App::GetCameraManager()->GetCamera()->setFOVy(Degree(App::gfx_fov_external->GetInt())); + App::GetCameraManager()->GetCamera()->setFOVy(Degree(App::gfx_fov_external->getInt())); m_cct_player_actor->prepareInside(false); m_cct_player_actor->NotifyActorCameraChanged(); } @@ -534,7 +534,7 @@ void CameraManager::ResetAllBehaviors() bool CameraManager::mouseMoved(const OIS::MouseEvent& _arg) { - if (App::sim_state->GetEnum() == SimState::PAUSED) + if (App::sim_state->getEnum() == SimState::PAUSED) { return true; // Do nothing when paused } @@ -736,7 +736,7 @@ void CameraManager::UpdateCameraBehaviorStatic() Vector3 lookAtPrediction = lookAt + velocity * speed; float distance = m_staticcam_position.distance(lookAt); float interval = std::max(radius, speed); - float cmradius = std::max(radius, App::gfx_camera_height->GetFloat() / 7.0f); + float cmradius = std::max(radius, App::gfx_camera_height->getFloat() / 7.0f); if (m_staticcam_force_update || (distance > cmradius * 8.0f && angle < Degree(30)) || @@ -746,7 +746,7 @@ void CameraManager::UpdateCameraBehaviorStatic() { const auto water = App::GetSimTerrain()->getWater(); float water_height = (water && !water->IsUnderWater(lookAt)) ? water->GetStaticWaterHeight() : 0.0f; - float desired_offset = std::max(std::sqrt(radius) * 2.89f, App::gfx_camera_height->GetFloat()); + float desired_offset = std::max(std::sqrt(radius) * 2.89f, App::gfx_camera_height->getFloat()); std::vector> viable_positions; for (int i = 0; i < 10; i++) @@ -806,7 +806,7 @@ bool CameraManager::CameraBehaviorStaticMouseMoved(const OIS::MouseEvent& _arg) float scale = RoR::App::GetInputEngine()->isKeyDown(OIS::KC_LMENU) ? 0.00002f : 0.0002f; m_staticcam_fov_exponent += ms.Z.rel * scale; m_staticcam_fov_exponent = Math::Clamp(m_staticcam_fov_exponent, 0.8f, 1.50f); - App::gfx_static_cam_fov_exp->SetVal(m_staticcam_fov_exponent); + App::gfx_static_cam_fov_exp->setVal(m_staticcam_fov_exponent); return true; } @@ -954,7 +954,7 @@ void CameraManager::CameraBehaviorOrbitReset() m_cam_look_at_last = Vector3::ZERO; m_cam_look_at_smooth = Vector3::ZERO; m_cam_look_at_smooth_last = Vector3::ZERO; - App::GetCameraManager()->GetCamera()->setFOVy(Degree(App::gfx_fov_external->GetInt())); + App::GetCameraManager()->GetCamera()->setFOVy(Degree(App::gfx_fov_external->getInt())); } void CameraManager::UpdateCameraBehaviorFree() @@ -1033,7 +1033,7 @@ void CameraManager::UpdateCameraBehaviorFree() void CameraManager::UpdateCameraBehaviorFixed() { - if (App::gfx_fixed_cam_tracking->GetBool()) + if (App::gfx_fixed_cam_tracking->getBool()) { Vector3 look_at = m_cct_player_actor ? m_cct_player_actor->getPosition() : App::GetGameContext()->GetPlayerCharacter()->getPosition(); App::GetCameraManager()->GetCameraNode()->lookAt(look_at, Ogre::Node::TS_WORLD); @@ -1047,7 +1047,7 @@ void CameraManager::UpdateCameraBehaviorVehicle() m_cam_target_direction = -atan2(dir.dotProduct(Vector3::UNIT_X), dir.dotProduct(-Vector3::UNIT_Z)); m_cam_target_pitch = 0.0f; - if ( RoR::App::gfx_extcam_mode->GetEnum() == RoR::GfxExtCamMode::PITCHING) + if ( RoR::App::gfx_extcam_mode->getEnum() == RoR::GfxExtCamMode::PITCHING) { m_cam_target_pitch = -asin(dir.dotProduct(Vector3::UNIT_Y)); } @@ -1120,7 +1120,7 @@ void CameraManager::CameraBehaviorVehicleSplineUpdate() m_cam_target_pitch = 0.0f; - if (App::gfx_extcam_mode->GetEnum() == GfxExtCamMode::PITCHING) + if (App::gfx_extcam_mode->getEnum() == GfxExtCamMode::PITCHING) { m_cam_target_pitch = -asin(dir.dotProduct(Vector3::UNIT_Y)); } @@ -1311,7 +1311,7 @@ void CameraManager::CameraBehaviorVehicleSplineCreateSpline() m_splinecam_spline_len /= 2.0f; - if (!m_splinecam_mo && RoR::App::diag_camera->GetBool()) + if (!m_splinecam_mo && RoR::App::diag_camera->getBool()) { m_splinecam_mo = App::GetGfxScene()->GetSceneManager()->createManualObject(); SceneNode* splineNode = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode(); diff --git a/source/main/gui/GUIManager.cpp b/source/main/gui/GUIManager.cpp index 968eecb6b1..f31d62a8d6 100644 --- a/source/main/gui/GUIManager.cpp +++ b/source/main/gui/GUIManager.cpp @@ -148,7 +148,7 @@ GUI::MpClientList* GUIManager::GetMpClientList() { return &m_impl- GUIManager::GUIManager() { - std::string gui_logpath = PathCombine(App::sys_logs_dir->GetStr(), "MyGUI.log"); + std::string gui_logpath = PathCombine(App::sys_logs_dir->getStr(), "MyGUI.log"); auto mygui_platform = new MyGUI::OgrePlatform(); mygui_platform->initialise( App::GetAppContext()->GetRenderWindow(), @@ -215,7 +215,7 @@ void GUIManager::ApplyGuiCaptureKeyboard() void GUIManager::DrawSimulationGui(float dt) { - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { m_impl->panel_TopMenubar.Update(); @@ -379,7 +379,7 @@ void GUIManager::UpdateMouseCursorVisibility() void GUIManager::ReflectGameState() { - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { m_impl->overlay_Wallpaper ->show(); @@ -392,7 +392,7 @@ void GUIManager::ReflectGameState() m_impl->panel_SimPerfStats .SetVisible(false); m_impl->panel_DirectionArrow .SetVisible(false); } - else if (App::app_state->GetEnum() == AppState::SIMULATION) + else if (App::app_state->getEnum() == AppState::SIMULATION) { m_impl->panel_GameMainMenu .SetVisible(false); m_impl->overlay_Wallpaper ->hide(); @@ -474,7 +474,7 @@ void GUIManager::SetupImGui() void GUIManager::DrawCommonGui() { - if (App::mp_state->GetEnum() == MpState::CONNECTED && !m_hide_gui) + if (App::mp_state->getEnum() == MpState::CONNECTED && !m_hide_gui) { m_impl->panel_MpClientList.Draw(); } @@ -562,7 +562,7 @@ void GUIManager::UpdateInputEvents(float dt) App::GetGuiManager()->SetVisible_Console(! App::GetGuiManager()->IsVisible_Console()); } - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { // EV_COMMON_HIDE_GUI if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_HIDE_GUI)) @@ -572,7 +572,7 @@ void GUIManager::UpdateInputEvents(float dt) // EV_COMMON_ENTER_CHATMODE if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_ENTER_CHATMODE, 0.5f) && - App::mp_state->GetEnum() == MpState::CONNECTED) + App::mp_state->getEnum() == MpState::CONNECTED) { App::GetGuiManager()->SetVisible_ChatBox(!App::GetGuiManager()->IsVisible_ChatBox()); } diff --git a/source/main/gui/GUIUtils.cpp b/source/main/gui/GUIUtils.cpp index fdab2d5208..f9c943f481 100644 --- a/source/main/gui/GUIUtils.cpp +++ b/source/main/gui/GUIUtils.cpp @@ -259,57 +259,57 @@ void RoR::ImTextWrappedColorMarked(std::string const& text) void RoR::DrawGCheckbox(CVar* cvar, const char* label) { - bool val = cvar->GetBool(); + bool val = cvar->getBool(); if (ImGui::Checkbox(label, &val)) { - cvar->SetVal(val); + cvar->setVal(val); } } void RoR::DrawGIntCheck(CVar* cvar, const char* label) { - bool val = (cvar->GetInt() != 0); + bool val = (cvar->getInt() != 0); if (ImGui::Checkbox(label, &val)) { - cvar->SetVal(val ? 1 : 0); + cvar->setVal(val ? 1 : 0); } } void RoR::DrawGIntBox(CVar* cvar, const char* label) { - int val = cvar->GetInt(); + int val = cvar->getInt(); if (ImGui::InputInt(label, &val, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue)) { - cvar->SetVal(val); + cvar->setVal(val); } } void RoR::DrawGIntSlider(CVar* cvar, const char* label, int v_min, int v_max) { - int val = cvar->GetInt(); + int val = cvar->getInt(); if (ImGui::SliderInt(label, &val, v_min, v_max)) { - cvar->SetVal(val); + cvar->setVal(val); } } void RoR::DrawGFloatSlider(CVar* cvar, const char* label, float v_min, float v_max) { - float val = cvar->GetFloat(); + float val = cvar->getFloat(); if (ImGui::SliderFloat(label, &val, v_min, v_max, "%.2f")) { - cvar->SetVal(val); + cvar->setVal(val); } } void RoR::DrawGFloatBox(CVar* cvar, const char* label) { - float fval = cvar->GetFloat(); + float fval = cvar->getFloat(); if (ImGui::InputFloat(label, &fval, 0.f, 0.f, "%.3f", ImGuiInputTextFlags_EnterReturnsTrue)) { - cvar->SetVal(fval); + cvar->setVal(fval); } } @@ -317,7 +317,7 @@ void RoR::DrawGTextEdit(CVar* cvar, const char* label, Str<1000>& buf) { if (ImGui::InputText(label, buf.GetBuffer(), buf.GetCapacity(), ImGuiInputTextFlags_EnterReturnsTrue)) { - cvar->SetStr(buf.GetBuffer()); + cvar->setStr(buf.GetBuffer()); } if (ImGui::IsItemActive()) { @@ -325,16 +325,16 @@ void RoR::DrawGTextEdit(CVar* cvar, const char* label, Str<1000>& buf) } else { - buf.Assign(cvar->GetStr().c_str()); + buf.Assign(cvar->getStr().c_str()); } } void RoR::DrawGCombo(CVar* cvar, const char* label, const char* values) { - int selection = cvar->GetInt(); + int selection = cvar->getInt(); if (ImGui::Combo(label, &selection, values)) { - cvar->SetVal(selection); + cvar->setVal(selection); } } diff --git a/source/main/gui/imgui/imgui.cpp b/source/main/gui/imgui/imgui.cpp index 29a80f35c7..54f58e92bc 100644 --- a/source/main/gui/imgui/imgui.cpp +++ b/source/main/gui/imgui/imgui.cpp @@ -1954,7 +1954,7 @@ void ImGuiStorage::BuildSortByKey() ImQsort(Data.Data, (size_t)Data.Size, sizeof(ImGuiStoragePair), StaticFunc::PairCompareByID); } -int ImGuiStorage::GetInt(ImGuiID key, int default_val) const +int ImGuiStorage::getInt(ImGuiID key, int default_val) const { ImGuiStoragePair* it = LowerBound(const_cast&>(Data), key); if (it == Data.end() || it->key != key) @@ -1962,12 +1962,12 @@ int ImGuiStorage::GetInt(ImGuiID key, int default_val) const return it->val_i; } -bool ImGuiStorage::GetBool(ImGuiID key, bool default_val) const +bool ImGuiStorage::getBool(ImGuiID key, bool default_val) const { - return GetInt(key, default_val ? 1 : 0) != 0; + return getInt(key, default_val ? 1 : 0) != 0; } -float ImGuiStorage::GetFloat(ImGuiID key, float default_val) const +float ImGuiStorage::getFloat(ImGuiID key, float default_val) const { ImGuiStoragePair* it = LowerBound(const_cast&>(Data), key); if (it == Data.end() || it->key != key) @@ -2013,7 +2013,7 @@ void** ImGuiStorage::GetVoidPtrRef(ImGuiID key, void* default_val) return &it->val_p; } -// FIXME-OPT: Need a way to reuse the result of lower_bound when doing GetInt()/SetInt() - not too bad because it only happens on explicit interaction (maximum one a frame) +// FIXME-OPT: Need a way to reuse the result of lower_bound when doing getInt()/SetInt() - not too bad because it only happens on explicit interaction (maximum one a frame) void ImGuiStorage::SetInt(ImGuiID key, int val) { ImGuiStoragePair* it = LowerBound(Data, key); diff --git a/source/main/gui/imgui/imgui.h b/source/main/gui/imgui/imgui.h index 2badb23a17..8f169edadc 100644 --- a/source/main/gui/imgui/imgui.h +++ b/source/main/gui/imgui/imgui.h @@ -1678,11 +1678,11 @@ struct ImGuiStorage // - Set***() functions find pair, insertion on demand if missing. // - Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair. void Clear() { Data.clear(); } - IMGUI_API int GetInt(ImGuiID key, int default_val = 0) const; + IMGUI_API int getInt(ImGuiID key, int default_val = 0) const; IMGUI_API void SetInt(ImGuiID key, int val); - IMGUI_API bool GetBool(ImGuiID key, bool default_val = false) const; + IMGUI_API bool getBool(ImGuiID key, bool default_val = false) const; IMGUI_API void SetBool(ImGuiID key, bool val); - IMGUI_API float GetFloat(ImGuiID key, float default_val = 0.0f) const; + IMGUI_API float getFloat(ImGuiID key, float default_val = 0.0f) const; IMGUI_API void SetFloat(ImGuiID key, float val); IMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL IMGUI_API void SetVoidPtr(ImGuiID key, void* val); diff --git a/source/main/gui/imgui/imgui_internal.h b/source/main/gui/imgui/imgui_internal.h index 6d3931039e..5418d14853 100644 --- a/source/main/gui/imgui/imgui_internal.h +++ b/source/main/gui/imgui/imgui_internal.h @@ -293,7 +293,7 @@ struct IMGUI_API ImPool ImPool() { FreeIdx = 0; } ~ImPool() { Clear(); } - T* GetByKey(ImGuiID key) { int idx = Map.GetInt(key, -1); return (idx != -1) ? &Data[idx] : NULL; } + T* GetByKey(ImGuiID key) { int idx = Map.getInt(key, -1); return (idx != -1) ? &Data[idx] : NULL; } T* GetByIndex(ImPoolIdx n) { return &Data[n]; } ImPoolIdx GetIndex(const T* p) const { IM_ASSERT(p >= Data.Data && p < Data.Data + Data.Size); return (ImPoolIdx)(p - Data.Data); } T* GetOrAddByKey(ImGuiID key) { int* p_idx = Map.GetIntRef(key, -1); if (*p_idx != -1) return &Data[*p_idx]; *p_idx = FreeIdx; return Add(); } diff --git a/source/main/gui/imgui/imgui_widgets.cpp b/source/main/gui/imgui/imgui_widgets.cpp index 70986fd1ba..075b0a881a 100644 --- a/source/main/gui/imgui/imgui_widgets.cpp +++ b/source/main/gui/imgui/imgui_widgets.cpp @@ -5200,7 +5200,7 @@ bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags) else { // We treat ImGuiCond_Once and ImGuiCond_FirstUseEver the same because tree node state are not saved persistently. - const int stored_value = storage->GetInt(id, -1); + const int stored_value = storage->getInt(id, -1); if (stored_value == -1) { is_open = g.NextItemData.OpenVal; @@ -5214,7 +5214,7 @@ bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags) } else { - is_open = storage->GetInt(id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0; + is_open = storage->getInt(id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0; } // When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior). diff --git a/source/main/gui/panels/GUI_ConsoleWindow.cpp b/source/main/gui/panels/GUI_ConsoleWindow.cpp index ab8f05c05c..6797f518fd 100644 --- a/source/main/gui/panels/GUI_ConsoleWindow.cpp +++ b/source/main/gui/panels/GUI_ConsoleWindow.cpp @@ -58,9 +58,9 @@ void ConsoleWindow::Draw() for (auto& cmd_pair: App::GetConsole()->getCommands()) { - if (ImGui::Selectable(cmd_pair.second->GetName().c_str())) + if (ImGui::Selectable(cmd_pair.second->getName().c_str())) { - cmd_pair.second->Run(Ogre::StringVector{cmd_pair.second->GetName()}); + cmd_pair.second->Run(Ogre::StringVector{cmd_pair.second->getName()}); } ImGui::NextColumn(); ImGui::Text("%s", cmd_pair.second->GetUsage().c_str()); diff --git a/source/main/gui/panels/GUI_GameAbout.cpp b/source/main/gui/panels/GUI_GameAbout.cpp index 141ea9ba15..fb301829c7 100644 --- a/source/main/gui/panels/GUI_GameAbout.cpp +++ b/source/main/gui/panels/GUI_GameAbout.cpp @@ -156,7 +156,7 @@ void GameAbout::Draw() void GameAbout::SetVisible(bool v) { m_is_visible = v; - if(!v && (App::app_state->GetEnum() == AppState::MAIN_MENU)) + if(!v && (App::app_state->getEnum() == AppState::MAIN_MENU)) { App::GetGuiManager()->SetVisible_GameMainMenu(true); } diff --git a/source/main/gui/panels/GUI_GameChatBox.cpp b/source/main/gui/panels/GUI_GameChatBox.cpp index dbc0f62195..ebe828b1b6 100644 --- a/source/main/gui/panels/GUI_GameChatBox.cpp +++ b/source/main/gui/panels/GUI_GameChatBox.cpp @@ -111,7 +111,7 @@ void GameChatBox::Draw() } } - if (!App::mp_chat_auto_hide->GetBool()) + if (!App::mp_chat_auto_hide->getBool()) { m_console_view.cvw_msg_duration_ms = 2629800000; // 1month, should be enough } @@ -147,7 +147,7 @@ void GameChatBox::Draw() const ImGuiInputTextFlags cmd_flags = ImGuiInputTextFlags_EnterReturnsTrue; if (ImGui::InputText("", m_msg_buffer.GetBuffer(), m_msg_buffer.GetCapacity(), cmd_flags)) { - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { this->SubmitMessage(); } diff --git a/source/main/gui/panels/GUI_GameMainMenu.cpp b/source/main/gui/panels/GUI_GameMainMenu.cpp index 9f41ba6f35..94d746b8ed 100644 --- a/source/main/gui/panels/GUI_GameMainMenu.cpp +++ b/source/main/gui/panels/GUI_GameMainMenu.cpp @@ -47,7 +47,7 @@ GameMainMenu::GameMainMenu(): void GameMainMenu::Draw() { this->DrawMenuPanel(); - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { this->DrawVersionBox(); if (cache_updated) @@ -64,11 +64,11 @@ void GameMainMenu::CacheUpdatedNotice() void GameMainMenu::DrawMenuPanel() { - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { title = "Main menu"; m_num_buttons = 5; - if (FileExists(PathCombine(App::sys_savegames_dir->GetStr(), "autosave.sav"))) + if (FileExists(PathCombine(App::sys_savegames_dir->getStr(), "autosave.sav"))) { m_num_buttons++; } @@ -76,7 +76,7 @@ void GameMainMenu::DrawMenuPanel() else { m_num_buttons = 3; - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { title = "Menu"; } @@ -126,7 +126,7 @@ void GameMainMenu::DrawMenuPanel() int button_index = 0; ImVec2 btn_size(WINDOW_WIDTH, 0.f); - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { if (HighlightButton(_LC("MainMenu", "Single player"), btn_size, button_index++)) { @@ -136,7 +136,7 @@ void GameMainMenu::DrawMenuPanel() App::GetGameContext()->PushMessage(m); } - if (FileExists(PathCombine(App::sys_savegames_dir->GetStr(), "autosave.sav"))) + if (FileExists(PathCombine(App::sys_savegames_dir->getStr(), "autosave.sav"))) { if ( HighlightButton(_LC("MainMenu", "Resume game"), btn_size, button_index++)) { @@ -145,7 +145,7 @@ void GameMainMenu::DrawMenuPanel() } } } - else if (App::app_state->GetEnum() == AppState::SIMULATION) + else if (App::app_state->getEnum() == AppState::SIMULATION) { if (HighlightButton(_LC("MainMenu", "Resume game"), btn_size, button_index++)) { @@ -154,7 +154,7 @@ void GameMainMenu::DrawMenuPanel() } } - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { if (HighlightButton(_LC("MainMenu", "Multiplayer"), btn_size, button_index++)) { @@ -174,12 +174,12 @@ void GameMainMenu::DrawMenuPanel() this->SetVisible(false); } } - else if (App::app_state->GetEnum() == AppState::SIMULATION) + else if (App::app_state->getEnum() == AppState::SIMULATION) { if (HighlightButton(_L("Return to menu"), btn_size, button_index++)) { App::GetGameContext()->PushMessage(Message(MSG_SIM_UNLOAD_TERRN_REQUESTED)); - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { App::GetGameContext()->PushMessage(Message(MSG_NET_DISCONNECT_REQUESTED)); } @@ -194,7 +194,7 @@ void GameMainMenu::DrawMenuPanel() } } - if (App::app_state->GetEnum() == AppState::SIMULATION && App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::app_state->getEnum() == AppState::SIMULATION && App::mp_state->getEnum() == MpState::CONNECTED) { App::GetGuiManager()->RequestGuiCaptureKeyboard(true); if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape))) diff --git a/source/main/gui/panels/GUI_GameSettings.cpp b/source/main/gui/panels/GUI_GameSettings.cpp index 7eaa0326e1..9a25a93cfd 100644 --- a/source/main/gui/panels/GUI_GameSettings.cpp +++ b/source/main/gui/panels/GUI_GameSettings.cpp @@ -119,14 +119,14 @@ void GameSettings::DrawRenderSystemSettings() { render_system_names += rs->getName() + '\0'; } - const auto ro = ogre_root->getRenderSystemByName(App::app_rendersys_override->GetStr()); + const auto ro = ogre_root->getRenderSystemByName(App::app_rendersys_override->getStr()); const auto rs = ro ? ro : ogre_root->getRenderSystem(); const auto it = std::find(render_systems.begin(), render_systems.end(), rs); int render_id = it != render_systems.end() ? std::distance(render_systems.begin(), it) : 0; /* Combobox for selecting the Render System*/ if (ImGui::Combo(_LC ("GameSettings", "Render System"), &render_id, render_system_names.c_str())) { - App::app_rendersys_override->SetStr(render_systems[render_id]->getName()); + App::app_rendersys_override->setStr(render_systems[render_id]->getName()); } const auto config_options = ogre_root->getRenderSystem()->getConfigOptions(); @@ -172,11 +172,11 @@ void GameSettings::DrawGeneralSettings() lang_values += value.first + '\0'; } const auto it = std::find_if(languages.begin(), languages.end(), - [](const std::pair& l) { return l.second == App::app_language->GetStr(); }); + [](const std::pair& l) { return l.second == App::app_language->getStr(); }); int lang_selection = it != languages.end() ? std::distance(languages.begin(), it) : 0; if (ImGui::Combo(_LC("GameSettings", "Language"), &lang_selection, lang_values.c_str())) { - App::app_language->SetStr(languages[lang_selection].second); + App::app_language->setStr(languages[lang_selection].second); App::GetLanguageEngine()->setup(); } #endif @@ -203,21 +203,21 @@ void GameSettings::DrawGeneralSettings() { country_values += value + '\0'; } - const auto it = std::find(countries.begin(), countries.end(), App::app_country->GetStr()); + const auto it = std::find(countries.begin(), countries.end(), App::app_country->getStr()); int country_selection = it != countries.end() ? std::distance(countries.begin(), it) : 0; if (ImGui::Combo(_LC("GameSettings", "Country"), &country_selection, country_values.c_str())) { - App::app_country->SetStr(countries[country_selection].c_str()); + App::app_country->setStr(countries[country_selection].c_str()); } } - int sshot_select = (App::app_screenshot_format->GetStr() == "jpg") ? 1 : 0; // Hardcoded; TODO: list available formats. + int sshot_select = (App::app_screenshot_format->getStr() == "jpg") ? 1 : 0; // Hardcoded; TODO: list available formats. /* Screenshot format: Can be png or jpg*/ if (ImGui::Combo(_LC("GameSettings", "Screenshot format"), &sshot_select, "png\0jpg\0\0")) { std::string str = (sshot_select == 1) ? "jpg" : "png"; - App::app_screenshot_format->SetStr(str); + App::app_screenshot_format->setStr(str); } DrawGTextEdit(App::app_extra_mod_path, _LC("GameSettings", "Extra mod path"), m_buf_app_extra_mod_dir); @@ -253,7 +253,7 @@ void GameSettings::DrawGameplaySettings() DrawGCheckbox(App::sim_spawn_running, _LC("GameSettings", "Engines spawn running")); DrawGCheckbox(App::sim_replay_enabled, _LC("GameSettings", "Replay mode")); - if (App::sim_replay_enabled->GetBool()) + if (App::sim_replay_enabled->getBool()) { DrawGIntBox(App::sim_replay_length, _LC("GameSettings", "Replay length")); DrawGIntBox(App::sim_replay_stepping, _LC("GameSettings", "Replay stepping")); @@ -288,11 +288,11 @@ void GameSettings::DrawAudioSettings() next += (len + 2); } - const auto it = std::find(audio_devices.begin(), audio_devices.end(), App::audio_device_name->GetStr()); + const auto it = std::find(audio_devices.begin(), audio_devices.end(), App::audio_device_name->getStr()); int device_id = it != audio_devices.end() ? std::distance(audio_devices.begin(), it) : 0; if (ImGui::Combo(_LC("GameSettings", "Audio device"), &device_id, devices)) { - App::audio_device_name->SetStr(audio_devices[device_id]); + App::audio_device_name->setStr(audio_devices[device_id]); } DrawGCheckbox(App::audio_enable_creak, _LC("GameSettings", "Creak sound")); @@ -316,10 +316,10 @@ void GameSettings::DrawGraphicsSettings() "Disabled\0" "PSSM\0\0"); - if (App::gfx_shadow_type->GetEnum() != GfxShadowType::NONE) + if (App::gfx_shadow_type->getEnum() != GfxShadowType::NONE) { DrawGCheckbox(App::gfx_reduce_shadows, _LC("GameSettings", "Shadow optimizations")); - if (App::gfx_shadow_type->GetEnum() == GfxShadowType::PSSM) + if (App::gfx_shadow_type->getEnum() == GfxShadowType::PSSM) { DrawGIntSlider(App::gfx_shadow_quality, _LC("GameSettings", "Shadow quality"), 0, 3); } @@ -330,7 +330,7 @@ void GameSettings::DrawGraphicsSettings() "Caelum (best looking, slower)\0" "SkyX (best looking, slower)\0\0"); - if (App::gfx_sky_mode->GetEnum() != GfxSkyMode::SKYX) + if (App::gfx_sky_mode->getEnum() != GfxSkyMode::SKYX) { DrawGIntSlider(App::gfx_sight_range, _LC("GameSettings", "Sight range (meters)"), 100, 5000); } @@ -341,13 +341,13 @@ void GameSettings::DrawGraphicsSettings() "Trilinear\0" "Anisotropic\0\0"); - if (App::gfx_texture_filter->GetEnum() == GfxTexFilter::ANISOTROPIC) + if (App::gfx_texture_filter->getEnum() == GfxTexFilter::ANISOTROPIC) { - int anisotropy = Ogre::Math::Clamp(App::gfx_anisotropy->GetInt(), 1, 16); + int anisotropy = Ogre::Math::Clamp(App::gfx_anisotropy->getInt(), 1, 16); int selection = std::log2(anisotropy); if (ImGui::Combo(_LC("GameSettings", "Anisotropy"), &selection, "1\0""2\0""4\0""8\0""16\0\0")) { - App::gfx_anisotropy->SetVal(std::pow(2, selection)); + App::gfx_anisotropy->setVal(std::pow(2, selection)); } } @@ -371,7 +371,7 @@ void GameSettings::DrawGraphicsSettings() DrawGIntCheck(App::gfx_skidmarks_mode, _LC("GameSettings", "Enable skidmarks")); DrawGCheckbox(App::gfx_envmap_enabled, _LC("GameSettings", "Realtime reflections")); - if (App::gfx_envmap_enabled->GetBool()) + if (App::gfx_envmap_enabled->getBool()) { ImGui::PushItemWidth(125.f); // Width includes [+/-] buttons DrawGIntSlider(App::gfx_envmap_rate, _LC("GameSettings", "Realtime refl. update rate"), 0, 6); @@ -380,7 +380,7 @@ void GameSettings::DrawGraphicsSettings() DrawGCheckbox(App::gfx_enable_videocams, _LC("GameSettings", "Render video cameras")); DrawGCheckbox(App::gfx_surveymap_icons, _LC("GameSettings", "Overview map icons")); - if (App::gfx_surveymap_icons->GetBool()) + if (App::gfx_surveymap_icons->getBool()) { DrawGCheckbox(App::gfx_declutter_map, _LC("GameSettings", "Declutter overview map")); } @@ -447,7 +447,7 @@ void GameSettings::DrawControlSettings() DrawGCheckbox(App::io_arcade_controls, _LC("GameSettings", "Use arcade controls")); DrawGCheckbox(App::io_ffb_enabled, _LC("GameSettings", "Enable ForceFeedback")); - if (App::io_ffb_enabled->GetBool()) + if (App::io_ffb_enabled->getBool()) { ImGui::PushItemWidth(125.f); DrawGFloatBox(App::io_ffb_camera_gain, _LC("GameSettings", "FFB camera gain")); @@ -458,7 +458,7 @@ void GameSettings::DrawControlSettings() } DrawGIntCheck(App::io_outgauge_mode, _LC("GameSettings", "Enable OutGauge protocol")); - if (App::io_outgauge_mode->GetBool()) + if (App::io_outgauge_mode->getBool()) { DrawGTextEdit(App::io_outgauge_ip, _LC("GameSettings", "OutGauge IP"), m_buf_io_outgauge_ip); ImGui::PushItemWidth(125.f); @@ -472,7 +472,7 @@ void GameSettings::DrawControlSettings() void GameSettings::SetVisible(bool v) { m_is_visible = v; - if (!v && App::app_state->GetEnum() == RoR::AppState::MAIN_MENU) + if (!v && App::app_state->getEnum() == RoR::AppState::MAIN_MENU) { App::GetGuiManager()->SetVisible_GameMainMenu(true); } diff --git a/source/main/gui/panels/GUI_LoadingWindow.cpp b/source/main/gui/panels/GUI_LoadingWindow.cpp index 0d9dfee42a..8b7ce92019 100644 --- a/source/main/gui/panels/GUI_LoadingWindow.cpp +++ b/source/main/gui/panels/GUI_LoadingWindow.cpp @@ -73,7 +73,7 @@ void LoadingWindow::SetProgressNetConnect(const std::string& net_status) { this->SetProgress(PERC_SHOW_SPINNER, fmt::format( "{} [{}:{}]\n{}", _LC("LoadingWindow", "Joining"), - App::mp_server_host->GetStr(), App::mp_server_port->GetInt(), net_status)); + App::mp_server_host->getStr(), App::mp_server_port->getInt(), net_status)); } void LoadingWindow::Draw() diff --git a/source/main/gui/panels/GUI_MainSelector.cpp b/source/main/gui/panels/GUI_MainSelector.cpp index ec564def01..1451994316 100644 --- a/source/main/gui/panels/GUI_MainSelector.cpp +++ b/source/main/gui/panels/GUI_MainSelector.cpp @@ -555,15 +555,15 @@ void MainSelector::Cancel() { this->Close(); - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { App::GetGameContext()->PushMessage(Message(MSG_NET_DISCONNECT_REQUESTED)); } App::GetGuiManager()->SetVisible_GameMainMenu(true); } - else if (App::app_state->GetEnum() == AppState::SIMULATION) + else if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetGameContext()->OnLoaderGuiCancel(); } @@ -575,12 +575,12 @@ void MainSelector::Apply() DisplayEntry& sd_entry = m_display_entries[m_selected_entry]; if (m_loader_type == LT_Terrain && - App::app_state->GetEnum() == AppState::MAIN_MENU) + App::app_state->getEnum() == AppState::MAIN_MENU) { App::GetGameContext()->PushMessage(Message(MSG_SIM_LOAD_TERRN_REQUESTED, sd_entry.sde_entry->fname)); this->Close(); } - else if (App::app_state->GetEnum() == AppState::SIMULATION) + else if (App::app_state->getEnum() == AppState::SIMULATION) { LoaderType type = m_loader_type; std::string sectionconfig; diff --git a/source/main/gui/panels/GUI_MessageBox.cpp b/source/main/gui/panels/GUI_MessageBox.cpp index 3bfabc8a61..296a5a17b5 100644 --- a/source/main/gui/panels/GUI_MessageBox.cpp +++ b/source/main/gui/panels/GUI_MessageBox.cpp @@ -105,10 +105,10 @@ void MessageBoxDialog::Draw() if (m_cfg.mbc_always_ask_conf) { ImGui::Separator(); - bool ask = m_cfg.mbc_always_ask_conf->GetBool(); + bool ask = m_cfg.mbc_always_ask_conf->getBool(); if (ImGui::Checkbox(_LC("MessageBox", "Always ask"), &ask)) { - m_cfg.mbc_always_ask_conf->SetVal(ask); + m_cfg.mbc_always_ask_conf->setVal(ask); } } diff --git a/source/main/gui/panels/GUI_MultiplayerClientList.cpp b/source/main/gui/panels/GUI_MultiplayerClientList.cpp index 427042f6cb..a6d37e05a1 100644 --- a/source/main/gui/panels/GUI_MultiplayerClientList.cpp +++ b/source/main/gui/panels/GUI_MultiplayerClientList.cpp @@ -81,7 +81,7 @@ void MpClientList::Draw() // Stream state indicators if (user.uniqueid != local_user.uniqueid && - App::app_state->GetEnum() != AppState::MAIN_MENU) + App::app_state->getEnum() != AppState::MAIN_MENU) { switch (App::GetGameContext()->GetActorManager()->CheckNetworkStreamsOk(user.uniqueid)) { @@ -165,7 +165,7 @@ void MpClientList::Draw() // Stream state if (user.uniqueid != local_user.uniqueid && - App::app_state->GetEnum() != AppState::MAIN_MENU) + App::app_state->getEnum() != AppState::MAIN_MENU) { ImGui::Separator(); ImGui::TextDisabled("%s", _LC("MultiplayerClientList", "truck loading state")); diff --git a/source/main/gui/panels/GUI_MultiplayerSelector.cpp b/source/main/gui/panels/GUI_MultiplayerSelector.cpp index 58b15a53fc..70fcc68b51 100644 --- a/source/main/gui/panels/GUI_MultiplayerSelector.cpp +++ b/source/main/gui/panels/GUI_MultiplayerSelector.cpp @@ -222,7 +222,7 @@ void MultiplayerSelector::DrawDirectTab() ImGui::SetCursorPosY(ImGui::GetCursorPosY() + BUTTONS_EXTRA_SPACE); if (ImGui::Button(_LC("MultiplayerSelector", "Join"))) { - App::mp_server_password->SetStr(m_password_buf.GetBuffer()); + App::mp_server_password->setStr(m_password_buf.GetBuffer()); App::GetGameContext()->PushMessage(Message(MSG_NET_CONNECT_REQUESTED)); } @@ -293,9 +293,9 @@ void MultiplayerSelector::DrawServerlistTab() if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) { // Handle left doubleclick - App::mp_server_password->SetStr(m_password_buf.GetBuffer()); - App::mp_server_host->SetStr(server.net_host.c_str()); - App::mp_server_port->SetVal(server.net_port); + App::mp_server_password->setStr(m_password_buf.GetBuffer()); + App::mp_server_host->setStr(server.net_host.c_str()); + App::mp_server_port->setVal(server.net_port); App::GetGameContext()->PushMessage(Message(MSG_NET_CONNECT_REQUESTED)); } if (server.has_password && m_lock_icon) @@ -328,9 +328,9 @@ void MultiplayerSelector::DrawServerlistTab() MpServerInfo& server = m_serverlist_data[m_selected_item]; if (ImGui::Button(_LC("MultiplayerSelector", "Join"), ImVec2(200.f, 0.f))) { - App::mp_server_password->SetStr(m_password_buf.GetBuffer()); - App::mp_server_host->SetStr(server.net_host.c_str()); - App::mp_server_port->SetVal(server.net_port); + App::mp_server_password->setStr(m_password_buf.GetBuffer()); + App::mp_server_host->setStr(server.net_host.c_str()); + App::mp_server_port->setVal(server.net_port); App::GetGameContext()->PushMessage(Message(MSG_NET_CONNECT_REQUESTED)); } if (server.has_password) @@ -363,7 +363,7 @@ void MultiplayerSelector::StartAsyncRefresh() m_serverlist_msg = _LC("MultiplayerSelector", "... refreshing ..."); m_serverlist_msg_color = App::GetGuiManager()->GetTheme().in_progress_text_color; std::packaged_task task(FetchServerlist); - std::thread(std::move(task), App::mp_api_url->GetStr()).detach(); // launch on a thread + std::thread(std::move(task), App::mp_api_url->getStr()).detach(); // launch on a thread #endif // defined(USE_CURL) } @@ -373,9 +373,9 @@ void MultiplayerSelector::SetVisible(bool visible) if (visible && m_serverlist_data.size() == 0) // Do an initial refresh { this->StartAsyncRefresh(); - m_password_buf = App::mp_server_password->GetStr(); + m_password_buf = App::mp_server_password->getStr(); } - else if (!visible && App::app_state->GetEnum() == AppState::MAIN_MENU) + else if (!visible && App::app_state->getEnum() == AppState::MAIN_MENU) { App::GetGuiManager()->SetVisible_GameMainMenu(true); } diff --git a/source/main/gui/panels/GUI_SurveyMap.cpp b/source/main/gui/panels/GUI_SurveyMap.cpp index ceb3627f48..d031cd6d2b 100644 --- a/source/main/gui/panels/GUI_SurveyMap.cpp +++ b/source/main/gui/panels/GUI_SurveyMap.cpp @@ -55,7 +55,7 @@ void SurveyMap::Draw() // Handle input if (App::GetInputEngine()->getEventBoolValueBounce(EV_SURVEY_MAP_TOGGLE_ICONS)) - App::gfx_surveymap_icons->SetVal(!App::gfx_surveymap_icons->GetBool()); + App::gfx_surveymap_icons->setVal(!App::gfx_surveymap_icons->getBool()); if (mMapMode == SurveyMapMode::SMALL) { @@ -178,7 +178,7 @@ void SurveyMap::Draw() drawlist->AddText(text_pos, ImGui::GetColorU32(ImGui::GetStyle().Colors[ImGuiCol_Text]), title); } - if (App::gfx_surveymap_icons->GetBool()) + if (App::gfx_surveymap_icons->getBool()) { // Draw terrain object icons for (TerrainObjectManager::MapEntity& e: App::GetSimTerrain()->getObjectManager()->GetMapEntities()) @@ -188,7 +188,7 @@ void SurveyMap::Draw() Str<100> filename; filename << "icon_" << e.type << ".dds"; - if ((visible) && (!App::gfx_declutter_map->GetBool())) + if ((visible) && (!App::gfx_declutter_map->getBool())) { this->DrawMapIcon(tl_screen_pos, view_size, view_origin, filename.ToCStr(), e.name, e.pos.x, e.pos.z, e.rot); } @@ -209,7 +209,7 @@ void SurveyMap::Draw() fileName << "icon_" << type_str << ".dds"; // gray icon auto& simbuf = gfx_actor->GetSimDataBuffer(); - std::string caption = (App::mp_state->GetEnum() == MpState::CONNECTED) ? simbuf.simbuf_net_username : ""; + std::string caption = (App::mp_state->getEnum() == MpState::CONNECTED) ? simbuf.simbuf_net_username : ""; this->DrawMapIcon(tl_screen_pos, view_size, view_origin, fileName.ToCStr(), caption, simbuf.simbuf_pos.x, simbuf.simbuf_pos.z, simbuf.simbuf_rotation); } @@ -220,7 +220,7 @@ void SurveyMap::Draw() auto& simbuf = gfx_character->xc_simbuf; if (!simbuf.simbuf_actor_coupling) { - std::string caption = (App::mp_state->GetEnum() == MpState::CONNECTED) ? simbuf.simbuf_net_username : ""; + std::string caption = (App::mp_state->getEnum() == MpState::CONNECTED) ? simbuf.simbuf_net_username : ""; this->DrawMapIcon(tl_screen_pos, view_size, view_origin, "icon_person_activated.dds", caption, simbuf.simbuf_character_pos.x, simbuf.simbuf_character_pos.z, simbuf.simbuf_character_rot.valueRadians()); diff --git a/source/main/gui/panels/GUI_TextureToolWindow.cpp b/source/main/gui/panels/GUI_TextureToolWindow.cpp index ed1c0270d7..7be2ad1a71 100644 --- a/source/main/gui/panels/GUI_TextureToolWindow.cpp +++ b/source/main/gui/panels/GUI_TextureToolWindow.cpp @@ -162,7 +162,7 @@ void TextureToolWindow::SaveTexture(std::string texName, bool usePNG) tex->convertToImage(img); // Save to disk! - std::string outname = PathCombine(App::sys_user_dir->GetStr(), StringUtil::replaceAll(texName, "/", "_")); + std::string outname = PathCombine(App::sys_user_dir->getStr(), StringUtil::replaceAll(texName, "/", "_")); if (usePNG) outname += ".png"; diff --git a/source/main/gui/panels/GUI_TopMenubar.cpp b/source/main/gui/panels/GUI_TopMenubar.cpp index e8f57f59e6..7e7fcd3df6 100644 --- a/source/main/gui/panels/GUI_TopMenubar.cpp +++ b/source/main/gui/panels/GUI_TopMenubar.cpp @@ -121,7 +121,7 @@ void TopMenubar::Update() { m_open_menu = TopMenu::TOPMENU_SAVEGAMES; m_quicksave_name = App::GetGameContext()->GetQuicksaveFilename(); - m_quickload = FileExists(PathCombine(App::sys_savegames_dir->GetStr(), m_quicksave_name)); + m_quickload = FileExists(PathCombine(App::sys_savegames_dir->getStr(), m_quicksave_name)); m_savegame_names.clear(); for (int i = 0; i <= 9; i++) { @@ -139,7 +139,7 @@ void TopMenubar::Update() { m_open_menu = TopMenu::TOPMENU_SETTINGS; #ifdef USE_CAELUM - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::CAELUM) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::CAELUM) m_daytime = App::GetSimTerrain()->getSkyManager()->GetTime(); #endif // USE_CAELUM } @@ -270,7 +270,7 @@ void TopMenubar::Update() } } - if (App::mp_state->GetEnum() != MpState::CONNECTED) + if (App::mp_state->getEnum() != MpState::CONNECTED) { if (ImGui::Button(_LC("TopMenubar", "Reload current terrain"))) { @@ -287,7 +287,7 @@ void TopMenubar::Update() if (ImGui::Button(_LC("TopMenubar", "Back to menu"))) { - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { App::GetGameContext()->PushMessage(Message(MSG_NET_DISCONNECT_REQUESTED)); } @@ -314,7 +314,7 @@ void TopMenubar::Update() ImGui::SetNextWindowPos(menu_pos); if (ImGui::Begin(_LC("TopMenubar", "Actors menu"), nullptr, static_cast(flags))) { - if (App::mp_state->GetEnum() != MpState::CONNECTED) + if (App::mp_state->getEnum() != MpState::CONNECTED) { this->DrawActorListSinglePlayer(); } @@ -418,7 +418,7 @@ void TopMenubar::Update() DrawGFloatSlider(App::audio_master_volume, _LC("TopMenubar", "Volume"), 0, 1); ImGui::Separator(); ImGui::TextColored(GRAY_HINT_TEXT, _LC("TopMenubar", "Frames per second:")); - if (App::gfx_envmap_enabled->GetBool()) + if (App::gfx_envmap_enabled->getBool()) { DrawGIntSlider(App::gfx_envmap_rate, _LC("TopMenubar", "Reflections"), 0, 6); } @@ -449,18 +449,18 @@ void TopMenubar::Update() ImGui::TextColored(GRAY_HINT_TEXT, _LC("TopMenubar", "Camera:")); if (App::GetCameraManager()->GetCurrentBehavior() == CameraManager::CAMERA_BEHAVIOR_VEHICLE_CINECAM) { - int fov = App::gfx_fov_internal->GetInt(); + int fov = App::gfx_fov_internal->getInt(); if (ImGui::SliderInt(_LC("TopMenubar", "FOV"), &fov, 10, 120)) { - App::gfx_fov_internal->SetVal(fov); + App::gfx_fov_internal->setVal(fov); } } else { - int fov = App::gfx_fov_external->GetInt(); + int fov = App::gfx_fov_external->getInt(); if (ImGui::SliderInt(_LC("TopMenubar", "FOV"), &fov, 10, 120)) { - App::gfx_fov_external->SetVal(fov); + App::gfx_fov_external->setVal(fov); } } if (App::GetCameraManager()->GetCurrentBehavior() == CameraManager::CAMERA_BEHAVIOR_FIXED) @@ -469,7 +469,7 @@ void TopMenubar::Update() } } #ifdef USE_CAELUM - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::CAELUM) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::CAELUM) { ImGui::Separator(); ImGui::TextColored(GRAY_HINT_TEXT, _LC("TopMenubar", "Time of day:")); @@ -480,15 +480,15 @@ void TopMenubar::Update() } ImGui::SameLine(); DrawGCheckbox(App::gfx_sky_time_cycle, _LC("TopMenubar", "Cycle")); - if (App::gfx_sky_time_cycle->GetBool()) + if (App::gfx_sky_time_cycle->getBool()) { DrawGIntSlider(App::gfx_sky_time_speed, _LC("TopMenubar", "Speed"), 10, 2000); } } #endif // USE_CAELUM - if (RoR::App::gfx_water_waves->GetBool() && App::mp_state->GetEnum() != MpState::CONNECTED && App::GetSimTerrain()->getWater()) + if (RoR::App::gfx_water_waves->getBool() && App::mp_state->getEnum() != MpState::CONNECTED && App::GetSimTerrain()->getWater()) { - if (App::gfx_water_mode->GetEnum() != GfxWaterMode::HYDRAX && App::gfx_water_mode->GetEnum() != GfxWaterMode::NONE) + if (App::gfx_water_mode->getEnum() != GfxWaterMode::HYDRAX && App::gfx_water_mode->getEnum() != GfxWaterMode::NONE) { ImGui::PushID("waves"); ImGui::TextColored(GRAY_HINT_TEXT, _LC("TopMenubar", "Waves Height:")); @@ -506,7 +506,7 @@ void TopMenubar::Update() ImGui::TextColored(GRAY_HINT_TEXT,_LC("TopMenubar", "Vehicle control options:")); DrawGCheckbox(App::io_hydro_coupling, _LC("TopMenubar", "Keyboard steering speed coupling")); } - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { ImGui::Separator(); ImGui::TextColored(GRAY_HINT_TEXT, _LC("TopMenubar", "Multiplayer:")); @@ -564,10 +564,10 @@ void TopMenubar::Update() ImGui::Separator(); ImGui::TextColored(GRAY_HINT_TEXT, _LC("TopMenubar", "Pre-spawn diag. options:")); - bool diag_mass = App::diag_truck_mass->GetBool(); + bool diag_mass = App::diag_truck_mass->getBool(); if (ImGui::Checkbox(_LC("TopMenubar", "Node mass recalc. logging"), &diag_mass)) { - App::diag_truck_mass->SetVal(diag_mass); + App::diag_truck_mass->setVal(diag_mass); } if (ImGui::IsItemHovered()) { @@ -576,10 +576,10 @@ void TopMenubar::Update() ImGui::EndTooltip(); } - bool diag_break = App::diag_log_beam_break->GetBool(); + bool diag_break = App::diag_log_beam_break->getBool(); if (ImGui::Checkbox(_LC("TopMenubar", "Beam break logging"), &diag_break)) { - App::diag_log_beam_break->SetVal(diag_break); + App::diag_log_beam_break->setVal(diag_break); } if (ImGui::IsItemHovered()) { @@ -588,10 +588,10 @@ void TopMenubar::Update() ImGui::EndTooltip(); } - bool diag_deform = App::diag_log_beam_deform->GetBool(); + bool diag_deform = App::diag_log_beam_deform->getBool(); if (ImGui::Checkbox(_LC("TopMenubar", "Beam deform. logging"), &diag_deform)) { - App::diag_log_beam_deform->SetVal(diag_deform); + App::diag_log_beam_deform->setVal(diag_deform); } if (ImGui::IsItemHovered()) { @@ -600,10 +600,10 @@ void TopMenubar::Update() ImGui::EndTooltip(); } - bool diag_trig = App::diag_log_beam_trigger->GetBool(); + bool diag_trig = App::diag_log_beam_trigger->getBool(); if (ImGui::Checkbox(_LC("TopMenubar", "Trigger logging"), &diag_trig)) { - App::diag_log_beam_trigger->SetVal(diag_trig); + App::diag_log_beam_trigger->setVal(diag_trig); } if (ImGui::IsItemHovered()) { @@ -612,10 +612,10 @@ void TopMenubar::Update() ImGui::EndTooltip(); } - bool diag_vcam = App::diag_videocameras->GetBool(); + bool diag_vcam = App::diag_videocameras->getBool(); if (ImGui::Checkbox(_LC("TopMenubar", "VideoCamera direction marker"), &diag_vcam)) { - App::diag_videocameras->SetVal(diag_vcam); + App::diag_videocameras->setVal(diag_vcam); } if (ImGui::IsItemHovered()) { diff --git a/source/main/main.cpp b/source/main/main.cpp index e48bcd2240..2fc7c76efc 100644 --- a/source/main/main.cpp +++ b/source/main/main.cpp @@ -92,10 +92,10 @@ int main(int argc, char *argv[]) App::GetAppContext()->SetUpLogging(); // User directories - App::sys_config_dir ->SetStr(PathCombine(App::sys_user_dir->GetStr(), "config")); - App::sys_cache_dir ->SetStr(PathCombine(App::sys_user_dir->GetStr(), "cache")); - App::sys_savegames_dir ->SetStr(PathCombine(App::sys_user_dir->GetStr(), "savegames")); - App::sys_screenshot_dir->SetStr(PathCombine(App::sys_user_dir->GetStr(), "screenshots")); + App::sys_config_dir ->setStr(PathCombine(App::sys_user_dir->getStr(), "config")); + App::sys_cache_dir ->setStr(PathCombine(App::sys_user_dir->getStr(), "cache")); + App::sys_savegames_dir ->setStr(PathCombine(App::sys_user_dir->getStr(), "savegames")); + App::sys_screenshot_dir->setStr(PathCombine(App::sys_user_dir->getStr(), "screenshots")); // Load RoR.cfg - updates cvars App::GetConsole()->loadConfig(); @@ -103,12 +103,12 @@ int main(int argc, char *argv[]) // Process command line params - updates 'cli_*' cvars App::GetConsole()->processCommandLine(argc, argv); - if (App::app_state->GetEnum() == AppState::PRINT_HELP_EXIT) + if (App::app_state->getEnum() == AppState::PRINT_HELP_EXIT) { App::GetConsole()->showCommandLineUsage(); return 0; } - if (App::app_state->GetEnum() == AppState::PRINT_VERSION_EXIT) + if (App::app_state->getEnum() == AppState::PRINT_VERSION_EXIT) { App::GetConsole()->showCommandLineVersion(); return 0; @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) } // Make sure config directory exists - to save 'ogre.cfg' - CreateFolder(App::sys_config_dir->GetStr()); + CreateFolder(App::sys_config_dir->getStr()); // Load and start OGRE renderer, uses config directory if (!App::GetAppContext()->SetUpRendering()) @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, res / 2, res / 2, 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET, 0, false, fsaa); - if (!App::diag_warning_texture->GetBool()) + if (!App::diag_warning_texture->getBool()) { // We overwrite the default warning texture (yellow stripes) with something unobtrusive Ogre::uchar data[3] = {0}; @@ -202,11 +202,11 @@ int main(int argc, char *argv[]) App::GetGameContext()->GetActorManager()->GetInertiaConfig().LoadDefaultInertiaModels(); // Load mod cache - if (App::app_force_cache_purge->GetBool()) + if (App::app_force_cache_purge->getBool()) { App::GetGameContext()->PushMessage(Message(MSG_APP_MODCACHE_PURGE_REQUESTED)); } - else if (App::cli_force_cache_update->GetBool() || App::app_force_cache_update->GetBool()) + else if (App::cli_force_cache_update->getBool() || App::app_force_cache_update->getBool()) { App::GetGameContext()->PushMessage(Message(MSG_APP_MODCACHE_UPDATE_REQUESTED)); } @@ -216,36 +216,36 @@ int main(int argc, char *argv[]) } // Handle game state presets - if (App::cli_server_host->GetStr() != "" && App::cli_server_port->GetInt() != 0) // Multiplayer, commandline + if (App::cli_server_host->getStr() != "" && App::cli_server_port->getInt() != 0) // Multiplayer, commandline { - App::mp_server_host->SetStr(App::cli_server_host->GetStr()); - App::mp_server_port->SetVal(App::cli_server_port->GetInt()); + App::mp_server_host->setStr(App::cli_server_host->getStr()); + App::mp_server_port->setVal(App::cli_server_port->getInt()); App::GetGameContext()->PushMessage(Message(MSG_NET_CONNECT_REQUESTED)); } - else if (App::mp_join_on_startup->GetBool()) // Multiplayer, conf file + else if (App::mp_join_on_startup->getBool()) // Multiplayer, conf file { App::GetGameContext()->PushMessage(Message(MSG_NET_CONNECT_REQUESTED)); } else // Single player { - if (App::cli_preset_terrain->GetStr() != "") // Terrain, commandline + if (App::cli_preset_terrain->getStr() != "") // Terrain, commandline { - App::GetGameContext()->PushMessage(Message(MSG_SIM_LOAD_TERRN_REQUESTED, App::cli_preset_terrain->GetStr())); + App::GetGameContext()->PushMessage(Message(MSG_SIM_LOAD_TERRN_REQUESTED, App::cli_preset_terrain->getStr())); } - else if (App::diag_preset_terrain->GetStr() != "") // Terrain, conf file + else if (App::diag_preset_terrain->getStr() != "") // Terrain, conf file { - App::GetGameContext()->PushMessage(Message(MSG_SIM_LOAD_TERRN_REQUESTED, App::diag_preset_terrain->GetStr())); + App::GetGameContext()->PushMessage(Message(MSG_SIM_LOAD_TERRN_REQUESTED, App::diag_preset_terrain->getStr())); } else // Main menu { - if (App::cli_resume_autosave->GetBool()) + if (App::cli_resume_autosave->getBool()) { - if (FileExists(PathCombine(App::sys_savegames_dir->GetStr(), "autosave.sav"))) + if (FileExists(PathCombine(App::sys_savegames_dir->getStr(), "autosave.sav"))) { App::GetGameContext()->PushMessage(RoR::Message(MSG_SIM_LOAD_SAVEGAME_REQUESTED, "autosave.sav")); } } - else if (App::app_skip_main_menu->GetBool()) + else if (App::app_skip_main_menu->getBool()) { // MainMenu disabled (singleplayer mode) -> go directly to map selector (traditional behavior) RoR::Message m(MSG_GUI_OPEN_SELECTOR_REQUESTED); @@ -259,11 +259,11 @@ int main(int argc, char *argv[]) } } - App::app_state->SetVal((int)AppState::MAIN_MENU); + App::app_state->setVal((int)AppState::MAIN_MENU); App::GetGuiManager()->ReflectGameState(); #ifdef USE_OPENAL - if (App::audio_menu_music->GetBool()) + if (App::audio_menu_music->getBool()) { App::GetSoundScriptManager()->createInstance("tracks/main_menu_tune", -1, nullptr); SOUND_START(-1, SS_TRIG_MAIN_MENU); @@ -281,12 +281,12 @@ int main(int argc, char *argv[]) auto start_time = std::chrono::high_resolution_clock::now(); - while (App::app_state->GetEnum() != AppState::SHUTDOWN) + while (App::app_state->getEnum() != AppState::SHUTDOWN) { OgreBites::WindowEventUtilities::messagePump(); // Halt physics (wait for async tasks to finish) - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetGameContext()->GetActorManager()->SyncWithSimThread(); } @@ -302,19 +302,19 @@ int main(int argc, char *argv[]) // -- Application events -- case MSG_APP_SHUTDOWN_REQUESTED: - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetGameContext()->SaveScene("autosave.sav"); } App::GetConsole()->saveConfig(); // RoR.cfg App::GetDiscordRpc()->Shutdown(); #ifdef USE_SOCKETW - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { App::GetNetwork()->Disconnect(); } #endif // USE_SOCKETW - App::app_state->SetVal((int)AppState::SHUTDOWN); + App::app_state->setVal((int)AppState::SHUTDOWN); break; case MSG_APP_SCREENSHOT_REQUESTED: @@ -344,7 +344,7 @@ int main(int argc, char *argv[]) break; case MSG_APP_MODCACHE_UPDATE_REQUESTED: - if (App::app_state->GetEnum() == AppState::MAIN_MENU) // No actors must be spawned; they keep pointers to CacheEntries + if (App::app_state->getEnum() == AppState::MAIN_MENU) // No actors must be spawned; they keep pointers to CacheEntries { RoR::Log("[RoR|ModCache] Cache update requested"); App::GetGuiManager()->SetMouseCursorVisibility(GUIManager::MouseCursorVisibility::HIDDEN); @@ -353,7 +353,7 @@ int main(int argc, char *argv[]) break; case MSG_APP_MODCACHE_PURGE_REQUESTED: - if (App::app_state->GetEnum() == AppState::MAIN_MENU) // No actors must be spawned; they keep pointers to CacheEntries + if (App::app_state->getEnum() == AppState::MAIN_MENU) // No actors must be spawned; they keep pointers to CacheEntries { RoR::Log("[RoR|ModCache] Cache rebuild requested"); App::GetGuiManager()->SetMouseCursorVisibility(GUIManager::MouseCursorVisibility::HIDDEN); @@ -368,10 +368,10 @@ int main(int argc, char *argv[]) break; case MSG_NET_DISCONNECT_REQUESTED: - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { App::GetNetwork()->Disconnect(); - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { App::GetGuiManager()->GetMainSelector()->Close(); // We may get disconnected while still in map selection App::GetGameContext()->PushMessage(Message(MSG_GUI_OPEN_MENU_REQUESTED)); @@ -408,7 +408,7 @@ int main(int argc, char *argv[]) case MSG_NET_CONNECT_SUCCESS: App::GetGuiManager()->GetLoadingWindow()->SetVisible(false); App::GetNetwork()->StopConnecting(); - App::mp_state->SetVal((int)RoR::MpState::CONNECTED); + App::mp_state->setVal((int)RoR::MpState::CONNECTED); RoR::ChatSystem::SendStreamSetup(); if (!App::GetMumble()) { @@ -421,7 +421,7 @@ int main(int argc, char *argv[]) else { // Connected -> go directly to map selector - if (App::diag_preset_terrain->GetStr().empty()) + if (App::diag_preset_terrain->getStr().empty()) { RoR::Message m(MSG_GUI_OPEN_SELECTOR_REQUESTED); m.payload = reinterpret_cast(new LoaderType(LT_Terrain)); @@ -429,7 +429,7 @@ int main(int argc, char *argv[]) } else { - App::GetGameContext()->PushMessage(Message(MSG_SIM_LOAD_TERRN_REQUESTED, App::diag_preset_terrain->GetStr())); + App::GetGameContext()->PushMessage(Message(MSG_SIM_LOAD_TERRN_REQUESTED, App::diag_preset_terrain->getStr())); } } break; @@ -460,7 +460,7 @@ int main(int argc, char *argv[]) { actor->muteAllSounds(); } - App::sim_state->SetVal((int)SimState::PAUSED); + App::sim_state->setVal((int)SimState::PAUSED); break; case MSG_SIM_UNPAUSE_REQUESTED: @@ -468,7 +468,7 @@ int main(int argc, char *argv[]) { actor->unmuteAllSounds(); } - App::sim_state->SetVal((int)SimState::RUNNING); + App::sim_state->setVal((int)SimState::RUNNING); break; case MSG_SIM_LOAD_TERRN_REQUESTED: @@ -479,27 +479,27 @@ int main(int argc, char *argv[]) { App::GetGameContext()->CreatePlayerCharacter(); // Spawn preselected vehicle; commandline has precedence - if (App::cli_preset_vehicle->GetStr() != "") - App::GetGameContext()->SpawnPreselectedActor(App::cli_preset_vehicle->GetStr(), App::cli_preset_veh_config->GetStr()); // Needs character for position - else if (App::diag_preset_vehicle->GetStr() != "") - App::GetGameContext()->SpawnPreselectedActor(App::diag_preset_vehicle->GetStr(), App::diag_preset_veh_config->GetStr()); // Needs character for position + if (App::cli_preset_vehicle->getStr() != "") + App::GetGameContext()->SpawnPreselectedActor(App::cli_preset_vehicle->getStr(), App::cli_preset_veh_config->getStr()); // Needs character for position + else if (App::diag_preset_vehicle->getStr() != "") + App::GetGameContext()->SpawnPreselectedActor(App::diag_preset_vehicle->getStr(), App::diag_preset_veh_config->getStr()); // Needs character for position App::GetGameContext()->GetSceneMouse().InitializeVisuals(); App::CreateOverlayWrapper(); App::GetGuiManager()->GetDirectionArrow()->LoadOverlay(); - if (App::audio_menu_music->GetBool()) + if (App::audio_menu_music->getBool()) { SOUND_KILL(-1, SS_TRIG_MAIN_MENU); } App::GetGfxScene()->GetSceneManager()->setAmbientLight(Ogre::ColourValue(0.3f, 0.3f, 0.3f)); App::GetDiscordRpc()->UpdatePresence(); - App::sim_state->SetVal((int)SimState::RUNNING); - App::app_state->SetVal((int)AppState::SIMULATION); + App::sim_state->setVal((int)SimState::RUNNING); + App::app_state->setVal((int)AppState::SIMULATION); App::GetGuiManager()->ReflectGameState(); App::GetGuiManager()->SetVisible_LoadingWindow(false); - App::gfx_fov_external->SetVal(App::gfx_fov_external_default->GetInt()); - App::gfx_fov_internal->SetVal(App::gfx_fov_internal_default->GetInt()); + App::gfx_fov_external->setVal(App::gfx_fov_external_default->getInt()); + App::gfx_fov_internal->setVal(App::gfx_fov_internal_default->getInt()); #ifdef USE_SOCKETW - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { char text[300]; std::snprintf(text, 300, _L("Press %s to start chatting"), @@ -508,14 +508,14 @@ int main(int argc, char *argv[]) Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_NOTICE, text, "", 5000); } #endif // USE_SOCKETW - if (App::io_outgauge_mode->GetInt() > 0) + if (App::io_outgauge_mode->getInt() > 0) { App::GetOutGauge()->Connect(); } } else { - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { App::GetGameContext()->PushMessage(Message(MSG_NET_DISCONNECT_REQUESTED)); } @@ -529,7 +529,7 @@ int main(int argc, char *argv[]) break; case MSG_SIM_UNLOAD_TERRN_REQUESTED: - if (App::sim_state->GetEnum() == SimState::EDITOR_MODE) + if (App::sim_state->getEnum() == SimState::EDITOR_MODE) { App::GetSimTerrain()->GetTerrainEditor()->WriteOutputFile(); } @@ -541,14 +541,14 @@ int main(int argc, char *argv[]) App::DestroyOverlayWrapper(); App::GetCameraManager()->ResetAllBehaviors(); App::GetGuiManager()->SetVisible_LoadingWindow(false); - App::sim_state->SetVal((int)SimState::OFF); - App::app_state->SetVal((int)AppState::MAIN_MENU); + App::sim_state->setVal((int)SimState::OFF); + App::app_state->setVal((int)AppState::MAIN_MENU); App::GetGuiManager()->ReflectGameState(); delete App::GetSimTerrain(); App::SetSimTerrain(nullptr); App::GetGfxScene()->ClearScene(); - App::sim_terrain_name->SetStr(""); - App::sim_terrain_gui_name->SetStr(""); + App::sim_terrain_name->setStr(""); + App::sim_terrain_gui_name->setStr(""); App::GetOutGauge()->Close(); break; @@ -559,23 +559,23 @@ int main(int argc, char *argv[]) { Str<400> msg; msg << _L("Could not read savegame file") << "'" << m.description << "'"; App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_ERROR, msg.ToCStr()); - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { App::GetGameContext()->PushMessage(Message(MSG_GUI_OPEN_MENU_REQUESTED)); } } - else if (terrn_filename == App::sim_terrain_name->GetStr()) + else if (terrn_filename == App::sim_terrain_name->getStr()) { App::GetGameContext()->LoadScene(m.description); } - else if (terrn_filename != App::sim_terrain_name->GetStr() && App::mp_state->GetEnum() == MpState::CONNECTED) + else if (terrn_filename != App::sim_terrain_name->getStr() && App::mp_state->getEnum() == MpState::CONNECTED) { Str<400> msg; msg << _L("Error while loading scene: Terrain mismatch"); App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_ERROR, msg.ToCStr()); } else { - if (App::sim_terrain_name->GetStr() != "") + if (App::sim_terrain_name->getStr() != "") { App::GetGameContext()->PushMessage(Message(MSG_SIM_UNLOAD_TERRN_REQUESTED)); } @@ -589,7 +589,7 @@ int main(int argc, char *argv[]) break; case MSG_SIM_SPAWN_ACTOR_REQUESTED: - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { ActorSpawnRequest* rq = (ActorSpawnRequest*)m.payload; App::GetGameContext()->SpawnActor(*rq); @@ -598,7 +598,7 @@ int main(int argc, char *argv[]) break; case MSG_SIM_MODIFY_ACTOR_REQUESTED: - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { ActorModifyRequest* rq = (ActorModifyRequest*)m.payload; App::GetGameContext()->ModifyActor(*rq); @@ -607,21 +607,21 @@ int main(int argc, char *argv[]) break; case MSG_SIM_DELETE_ACTOR_REQUESTED: - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetGameContext()->DeleteActor((Actor*)m.payload); } break; case MSG_SIM_SEAT_PLAYER_REQUESTED: - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetGameContext()->ChangePlayerActor((Actor*)m.payload); } break; case MSG_SIM_TELEPORT_PLAYER_REQUESTED: - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { Ogre::Vector3* pos = (Ogre::Vector3*)m.payload; App::GetGameContext()->TeleportPlayer(pos->x, pos->z); @@ -668,20 +668,20 @@ int main(int argc, char *argv[]) break; case MSG_EDI_ENTER_TERRN_EDITOR_REQUESTED: - if (App::sim_state->GetEnum() != SimState::EDITOR_MODE) + if (App::sim_state->getEnum() != SimState::EDITOR_MODE) { - App::sim_state->SetVal((int)SimState::EDITOR_MODE); + App::sim_state->setVal((int)SimState::EDITOR_MODE); App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_NOTICE, _L("Entered terrain editing mode")); } break; case MSG_EDI_LEAVE_TERRN_EDITOR_REQUESTED: - if (App::sim_state->GetEnum() == SimState::EDITOR_MODE) + if (App::sim_state->getEnum() == SimState::EDITOR_MODE) { App::GetSimTerrain()->GetTerrainEditor()->WriteOutputFile(); App::GetSimTerrain()->GetTerrainEditor()->ClearSelection(); - App::sim_state->SetVal((int)SimState::RUNNING); + App::sim_state->setVal((int)SimState::RUNNING); App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_NOTICE, _L("Left terrain editing mode")); } @@ -729,9 +729,9 @@ int main(int argc, char *argv[]) } // Game events block // Check FPS limit - if (App::gfx_fps_limit->GetInt() > 0) + if (App::gfx_fps_limit->getInt() > 0) { - const float min_frame_time = 1.0f / Ogre::Math::Clamp(App::gfx_fps_limit->GetInt(), 5, 240); + const float min_frame_time = 1.0f / Ogre::Math::Clamp(App::gfx_fps_limit->getInt(), 5, 240); float dt = std::chrono::duration(std::chrono::high_resolution_clock::now() - start_time).count(); while (dt < min_frame_time) { @@ -746,13 +746,13 @@ int main(int argc, char *argv[]) #ifdef USE_SOCKETW // Process incoming network traffic - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { std::vector packets = App::GetNetwork()->GetIncomingStreamData(); if (!packets.empty()) { RoR::ChatSystem::HandleStreamData(packets); - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetGameContext()->GetActorManager()->HandleActorStreamData(packets); App::GetGameContext()->GetCharacterFactory()->handleStreamData(packets); // Update characters last (or else beam coupling might fail) @@ -771,16 +771,16 @@ int main(int argc, char *argv[]) App::GetGameContext()->UpdateGlobalInputEvents(); App::GetGuiManager()->UpdateInputEvents(dt); - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetCameraManager()->UpdateInputEvents(dt); App::GetOverlayWrapper()->update(dt); - if (App::sim_state->GetEnum() == SimState::EDITOR_MODE) + if (App::sim_state->getEnum() == SimState::EDITOR_MODE) { App::GetGameContext()->UpdateSkyInputEvents(dt); App::GetSimTerrain()->GetTerrainEditor()->UpdateInputEvents(dt); } - else if (App::sim_state->GetEnum() == SimState::RUNNING) + else if (App::sim_state->getEnum() == SimState::RUNNING) { App::GetGameContext()->GetCharacterFactory()->Update(dt); if (App::GetCameraManager()->GetCurrentBehavior() != CameraManager::CAMERA_BEHAVIOR_FREE) @@ -819,14 +819,14 @@ int main(int argc, char *argv[]) } // Update OutGauge device - if (App::io_outgauge_mode->GetInt() > 0) + if (App::io_outgauge_mode->getInt() > 0) { App::GetOutGauge()->Update(dt, App::GetGameContext()->GetPlayerActor()); } // Early GUI updates which require halted physics App::GetGuiManager()->NewImGuiFrame(dt); - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetGuiManager()->DrawSimulationGui(dt); for (auto actor : App::GetGameContext()->GetActorManager()->GetActors()) @@ -855,42 +855,42 @@ int main(int argc, char *argv[]) #endif // USE_OPENAL #ifdef USE_ANGELSCRIPT - if (App::app_state->GetEnum() == AppState::SIMULATION) + if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetScriptEngine()->framestep(dt); } #endif // USE_ANGELSCRIPT - if (App::io_ffb_enabled->GetBool() && - App::sim_state->GetEnum() == SimState::RUNNING) + if (App::io_ffb_enabled->getBool() && + App::sim_state->getEnum() == SimState::RUNNING) { App::GetAppContext()->GetForceFeedback().Update(); } - if (App::sim_state->GetEnum() == SimState::RUNNING) + if (App::sim_state->getEnum() == SimState::RUNNING) { App::GetGameContext()->GetSceneMouse().UpdateSimulation(); } // Create snapshot of simulation state for Gfx/GUI updates - if (App::sim_state->GetEnum() == SimState::RUNNING || // Obviously - App::sim_state->GetEnum() == SimState::EDITOR_MODE) // Needed for character movement + if (App::sim_state->getEnum() == SimState::RUNNING || // Obviously + App::sim_state->getEnum() == SimState::EDITOR_MODE) // Needed for character movement { App::GetGfxScene()->BufferSimulationData(); } // Advance simulation - if (App::sim_state->GetEnum() == SimState::RUNNING) + if (App::sim_state->getEnum() == SimState::RUNNING) { App::GetGameContext()->UpdateActors(); // *** Start new physics tasks. No reading from Actor N/B beyond this point. } // Scene and GUI updates - if (App::app_state->GetEnum() == AppState::MAIN_MENU) + if (App::app_state->getEnum() == AppState::MAIN_MENU) { App::GetGuiManager()->DrawMainMenuGui(); } - else if (App::app_state->GetEnum() == AppState::SIMULATION) + else if (App::app_state->getEnum() == AppState::SIMULATION) { App::GetGfxScene()->UpdateScene(dt); // Draws GUI as well } diff --git a/source/main/network/DiscordRpc.cpp b/source/main/network/DiscordRpc.cpp index 1b36fa8717..496c99784c 100644 --- a/source/main/network/DiscordRpc.cpp +++ b/source/main/network/DiscordRpc.cpp @@ -44,7 +44,7 @@ void DiscordReadyCallback(const DiscordUser *user) void DiscordRpc::Init() { #ifdef USE_DISCORD_RPC - if(App::io_discord_rpc->GetBool()) + if(App::io_discord_rpc->getBool()) { DiscordEventHandlers handlers; memset(&handlers, 0, sizeof(handlers)); @@ -60,23 +60,23 @@ void DiscordRpc::Init() void DiscordRpc::UpdatePresence() { #ifdef USE_DISCORD_RPC - if(App::io_discord_rpc->GetBool()) + if(App::io_discord_rpc->getBool()) { char buffer[256]; DiscordRichPresence discordPresence; memset(&discordPresence, 0, sizeof(discordPresence)); - if (App::mp_state->GetEnum() == MpState::CONNECTED) + if (App::mp_state->getEnum() == MpState::CONNECTED) { discordPresence.state = "Playing online"; sprintf(buffer, "On server: %s:%d on terrain: %s", - RoR::App::mp_server_host->GetStr().c_str(), - RoR::App::mp_server_port->GetInt(), - RoR::App::sim_terrain_gui_name->GetStr().c_str()); + RoR::App::mp_server_host->getStr().c_str(), + RoR::App::mp_server_port->getInt(), + RoR::App::sim_terrain_gui_name->getStr().c_str()); } else { discordPresence.state = "Playing singleplayer"; - sprintf(buffer, "On terrain: %s", RoR::App::sim_terrain_gui_name->GetStr().c_str()); + sprintf(buffer, "On terrain: %s", RoR::App::sim_terrain_gui_name->getStr().c_str()); } discordPresence.details = buffer; discordPresence.startTimestamp = time(0); diff --git a/source/main/network/Network.cpp b/source/main/network/Network.cpp index 6923b0ec51..c10ec36d52 100644 --- a/source/main/network/Network.cpp +++ b/source/main/network/Network.cpp @@ -388,22 +388,22 @@ void Network::CouldNotConnect(std::string const & msg, bool close_socket /*= tru bool Network::StartConnecting() { // Shadow vars for threaded access - m_username = App::mp_player_name->GetStr(); - m_token = App::mp_player_token->GetStr(); - m_net_host = App::mp_server_host->GetStr(); - m_net_port = App::mp_server_port->GetInt(); - m_password = App::mp_server_password->GetStr(); + m_username = App::mp_player_name->getStr(); + m_token = App::mp_player_token->getStr(); + m_net_host = App::mp_server_host->getStr(); + m_net_port = App::mp_server_port->getInt(); + m_password = App::mp_server_password->getStr(); try { m_connect_thread = std::thread(&Network::ConnectThread, this); - App::mp_state->SetVal((int)MpState::CONNECTING); // Mark connect thread as started + App::mp_state->setVal((int)MpState::CONNECTING); // Mark connect thread as started PushNetMessage(MSG_NET_CONNECT_STARTED, _LC("Network", "Starting...")); return true; } catch (std::exception& e) { - App::mp_state->SetVal((int)MpState::DISABLED); + App::mp_state->setVal((int)MpState::DISABLED); PushNetMessage(MSG_NET_CONNECT_FAILURE, _L("Failed to launch connection thread")); RoR::LogFormat("[RoR|Networking] Failed to launch connection thread, message: %s", e.what()); return false; @@ -497,8 +497,8 @@ bool Network::ConnectThread() strncpy(c.usertoken, Utils::Sha1Hash(m_token).c_str(), size_t(40)); strncpy(c.clientversion, ROR_VERSION_STRING, strnlen(ROR_VERSION_STRING, 25)); strncpy(c.clientname, "RoR", 10); - std::string language = App::app_language->GetStr().substr(0, 2); - std::string country = App::app_country->GetStr().substr(0, 2); + std::string language = App::app_language->getStr().substr(0, 2); + std::string country = App::app_country->getStr().substr(0, 2); strncpy(c.language, (language + std::string("_") + country).c_str(), 5); strcpy(c.sessiontype, "normal"); if (!SendNetMessage(MSG2_USER_INFO, 0, sizeof(RoRnet::UserInfo), (char*)&c)) @@ -597,7 +597,7 @@ void Network::Disconnect() App::GetConsole()->doCommand("clear net"); m_shutdown = false; - App::mp_state->SetVal((int)MpState::DISABLED); + App::mp_state->setVal((int)MpState::DISABLED); LOG("[RoR|Networking] Disconnect() done"); } diff --git a/source/main/network/OutGauge.cpp b/source/main/network/OutGauge.cpp index 34969c7fbf..bb373a76e5 100644 --- a/source/main/network/OutGauge.cpp +++ b/source/main/network/OutGauge.cpp @@ -76,7 +76,7 @@ void OutGauge::Connect() } // get the IP of the remote side, this function is compatible with windows 2000 - hostent* remoteHost = gethostbyname(App::io_outgauge_ip->GetStr().c_str()); + hostent* remoteHost = gethostbyname(App::io_outgauge_ip->getStr().c_str()); char* ip = inet_ntoa(*(struct in_addr *)*remoteHost->h_addr_list); // init socket data @@ -84,7 +84,7 @@ void OutGauge::Connect() memset(&sendaddr, 0, sizeof(sendaddr)); sendaddr.sin_family = AF_INET; sendaddr.sin_addr.s_addr = inet_addr(ip); - sendaddr.sin_port = htons(App::io_outgauge_port->GetInt()); + sendaddr.sin_port = htons(App::io_outgauge_port->getInt()); // connect if (connect(sockfd, (struct sockaddr *) &sendaddr, sizeof(sendaddr)) == SOCKET_ERROR) @@ -110,7 +110,7 @@ bool OutGauge::Update(float dt, Actor* truck) // below the set delay? timer += dt; - if (timer < (0.1f * App::io_outgauge_delay->GetFloat())) + if (timer < (0.1f * App::io_outgauge_delay->getFloat())) { return true; } @@ -122,7 +122,7 @@ bool OutGauge::Update(float dt, Actor* truck) // set some common things gd.Time = Root::getSingleton().getTimer()->getMilliseconds(); - gd.ID = App::io_outgauge_id->GetInt(); + gd.ID = App::io_outgauge_id->getInt(); gd.Flags = 0 | OG_KM; sprintf(gd.Car, "RoR"); diff --git a/source/main/physics/Actor.cpp b/source/main/physics/Actor.cpp index 17686e0e1c..5f3fae82c1 100644 --- a/source/main/physics/Actor.cpp +++ b/source/main/physics/Actor.cpp @@ -701,7 +701,7 @@ void Actor::RecalculateNodeMasses(Real total) !(m_definition->minimass_skip_loaded_nodes && ar_nodes[i].nd_loaded_mass) && ar_nodes[i].mass < ar_minimass[i]) { - if (App::diag_truck_mass->GetBool()) + if (App::diag_truck_mass->getBool()) { char buf[300]; snprintf(buf, 300, "Node '%d' mass (%f Kg) is too light. Resetting to 'minimass' (%f Kg)", i, ar_nodes[i].mass, ar_minimass[i]); @@ -714,7 +714,7 @@ void Actor::RecalculateNodeMasses(Real total) m_total_mass = 0; for (int i = 0; i < ar_num_nodes; i++) { - if (App::diag_truck_mass->GetBool()) + if (App::diag_truck_mass->getBool()) { String msg = "Node " + TOSTRING(i) + " : " + TOSTRING((int)ar_nodes[i].mass) + " kg"; if (ar_nodes[i].nd_loaded_mass) @@ -1605,7 +1605,7 @@ void Actor::SyncReset(bool reset_position) if (ar_engine) { - if (App::sim_spawn_running->GetBool()) + if (App::sim_spawn_running->getBool()) { ar_engine->StartEngine(); } @@ -2938,7 +2938,7 @@ void Actor::prepareInside(bool inside) // m_gfx_actor->GetCabTransMaterial()->setReceiveShadows(!inside); // } - if (App::gfx_reduce_shadows->GetBool()) + if (App::gfx_reduce_shadows->getBool()) { m_gfx_actor->SetCastShadows(!inside); } @@ -3105,7 +3105,7 @@ void Actor::setBlinkType(BlinkType blink) void Actor::autoBlinkReset() { // TODO: make this set-able per actor - const float blink_lock_range = App::io_blink_lock_range->GetFloat(); + const float blink_lock_range = App::io_blink_lock_range->getFloat(); if (m_blink_type == BLINK_LEFT && ar_hydro_dir_state < -blink_lock_range) { diff --git a/source/main/physics/ActorForcesEuler.cpp b/source/main/physics/ActorForcesEuler.cpp index d1aad42559..c82497c45f 100644 --- a/source/main/physics/ActorForcesEuler.cpp +++ b/source/main/physics/ActorForcesEuler.cpp @@ -548,8 +548,8 @@ void Actor::CalcHydros() if (!ar_hydro_speed_coupling) { // need a maximum rate for analog devices, otherwise hydro beams break - float smoothing = Math::Clamp(App::io_analog_smoothing->GetFloat(), 0.5f, 2.0f); - float sensitivity = Math::Clamp(App::io_analog_sensitivity->GetFloat(), 0.5f, 2.0f); + float smoothing = Math::Clamp(App::io_analog_smoothing->getFloat(), 0.5f, 2.0f); + float sensitivity = Math::Clamp(App::io_analog_sensitivity->getFloat(), 0.5f, 2.0f); float diff = ar_hydro_dir_command - ar_hydro_dir_state; float rate = std::exp(-std::min(std::abs(diff), 1.0f) / sensitivity) * diff; ar_hydro_dir_state += (10.0f / smoothing) * PHYSICS_DT * rate; @@ -558,7 +558,7 @@ void Actor::CalcHydros() { if (ar_hydro_dir_command != 0) { - if (!App::io_hydro_coupling->GetBool()) + if (!App::io_hydro_coupling->getBool()) { float rate = std::max(1.2f, 30.0f / (10.0f)); if (ar_hydro_dir_state > ar_hydro_dir_command) diff --git a/source/main/physics/ActorManager.cpp b/source/main/physics/ActorManager.cpp index dcecfe6b9c..074fe4a113 100644 --- a/source/main/physics/ActorManager.cpp +++ b/source/main/physics/ActorManager.cpp @@ -110,7 +110,7 @@ void ActorManager::SetupActor(Actor* actor, ActorSpawnRequest rq, std::shared_pt actor->UpdateBoundingBoxes(); // (records the unrotated dimensions for 'veh_aab_size') - if (App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (App::mp_state->getEnum() == RoR::MpState::CONNECTED) { // Calculate optimal node position compression (for network transfer) Vector3 aabb_size = actor->ar_bounding_box.getSize(); @@ -280,7 +280,7 @@ void ActorManager::SetupActor(Actor* actor, ActorSpawnRequest rq, std::shared_pt if (actor->ar_engine) { - if (!actor->m_preloaded_with_terrain && App::sim_spawn_running->GetBool()) + if (!actor->m_preloaded_with_terrain && App::sim_spawn_running->getBool()) actor->ar_engine->StartEngine(); else actor->ar_engine->OffStart(); @@ -293,7 +293,7 @@ void ActorManager::SetupActor(Actor* actor, ActorSpawnRequest rq, std::shared_pt actor->ar_sim_state = Actor::SimState::LOCAL_SLEEPING; - if (App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (App::mp_state->getEnum() == RoR::MpState::CONNECTED) { // network buffer layout (without RoRnet::VehicleState): // @@ -329,9 +329,9 @@ void ActorManager::SetupActor(Actor* actor, ActorSpawnRequest rq, std::shared_pt actor->m_net_label_node->setVisible(true); actor->m_deletion_scene_nodes.emplace_back(actor->m_net_label_node); } - else if (App::sim_replay_enabled->GetBool()) + else if (App::sim_replay_enabled->getBool()) { - actor->m_replay_handler = new Replay(actor, App::sim_replay_length->GetInt()); + actor->m_replay_handler = new Replay(actor, App::sim_replay_length->getInt()); } LOG(" ===== DONE LOADING VEHICLE"); @@ -342,7 +342,7 @@ Actor* ActorManager::CreateActorInstance(ActorSpawnRequest rq, std::shared_ptr(m_actors.size()), def, rq); actor->setUsedSkin(rq.asr_skin_entry); - if (App::mp_state->GetEnum() == MpState::CONNECTED && rq.asr_origin != ActorSpawnRequest::Origin::NETWORK) + if (App::mp_state->getEnum() == MpState::CONNECTED && rq.asr_origin != ActorSpawnRequest::Origin::NETWORK) { actor->sendStreamSetup(); } @@ -681,7 +681,7 @@ void ActorManager::ForwardCommands(Actor* source_actor) actor->ar_sim_state = Actor::SimState::LOCAL_SIMULATED; } - if (App::sim_realistic_commands->GetBool()) + if (App::sim_realistic_commands->getBool()) { if (std::find(linked_actors.begin(), linked_actors.end(), actor) == linked_actors.end()) continue; @@ -878,7 +878,7 @@ void ActorManager::DeleteActorInternal(Actor* actor) this->SyncWithSimThread(); #ifdef USE_SOCKETW - if (App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (App::mp_state->getEnum() == RoR::MpState::CONNECTED) { if (actor->ar_sim_state != Actor::SimState::NETWORKED_OK) { @@ -1033,12 +1033,12 @@ void ActorManager::UpdateActors(Actor* player_actor) if (actor->ar_sim_state != Actor::SimState::LOCAL_SLEEPING) { actor->updateVisual(dt); - if (actor->ar_update_physics && App::gfx_skidmarks_mode->GetInt() > 0) + if (actor->ar_update_physics && App::gfx_skidmarks_mode->getInt() > 0) { actor->updateSkidmarks(); } } - if (App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (App::mp_state->getEnum() == RoR::MpState::CONNECTED) { if (actor->ar_sim_state == Actor::SimState::NETWORKED_OK) actor->calcNetwork(); @@ -1077,7 +1077,7 @@ void ActorManager::UpdateActors(Actor* player_actor) m_total_sim_time += dt; - if (!App::app_async_physics->GetBool()) + if (!App::app_async_physics->getBool()) m_sim_task->join(); } @@ -1128,7 +1128,7 @@ void ActorManager::UpdatePhysicsSimulation() for (auto actor : m_actors) { if (actor->m_inter_point_col_detector != nullptr && (actor->ar_update_physics || - (App::mp_pseudo_collisions->GetBool() && actor->ar_sim_state == Actor::SimState::NETWORKED_OK))) + (App::mp_pseudo_collisions->getBool() && actor->ar_sim_state == Actor::SimState::NETWORKED_OK))) { auto func = std::function([this, actor]() { diff --git a/source/main/physics/ActorSpawner.cpp b/source/main/physics/ActorSpawner.cpp index 08a074a905..e28876f763 100644 --- a/source/main/physics/ActorSpawner.cpp +++ b/source/main/physics/ActorSpawner.cpp @@ -267,12 +267,12 @@ void ActorSpawner::InitializeRig() m_actor->m_odometer_user = 0; m_actor->m_masscount=0; - m_actor->m_disable_smoke = App::gfx_particles_mode->GetInt() == 0; + m_actor->m_disable_smoke = App::gfx_particles_mode->getInt() == 0; m_actor->ar_exhaust_pos_node=0; m_actor->ar_exhaust_dir_node=0; - m_actor->m_beam_break_debug_enabled = App::diag_log_beam_break->GetBool(); - m_actor->m_beam_deform_debug_enabled = App::diag_log_beam_deform->GetBool(); - m_actor->m_trigger_debug_enabled = App::diag_log_beam_trigger->GetBool(); + m_actor->m_beam_break_debug_enabled = App::diag_log_beam_break->getBool(); + m_actor->m_beam_deform_debug_enabled = App::diag_log_beam_deform->getBool(); + m_actor->m_trigger_debug_enabled = App::diag_log_beam_trigger->getBool(); m_actor->ar_origin=Ogre::Vector3::ZERO; m_actor->m_slidenodes.clear(); @@ -338,12 +338,12 @@ void ActorSpawner::InitializeRig() /* Collisions */ - if (!App::sim_no_collisions->GetBool()) + if (!App::sim_no_collisions->getBool()) { m_actor->m_inter_point_col_detector = new PointColDetector(m_actor); } - if (!App::sim_no_self_collisions->GetBool()) + if (!App::sim_no_self_collisions->getBool()) { m_actor->m_intra_point_col_detector = new PointColDetector(m_actor); } @@ -351,7 +351,7 @@ void ActorSpawner::InitializeRig() m_actor->ar_submesh_ground_model = App::GetSimTerrain()->GetCollisions()->defaultgm; // Lights mode - m_actor->m_flares_mode = App::gfx_flares_mode->GetEnum(); + m_actor->m_flares_mode = App::gfx_flares_mode->getEnum(); m_actor->m_definition = m_file; @@ -361,7 +361,7 @@ void ActorSpawner::InitializeRig() m_placeholder_managedmat = Ogre::MaterialManager::getSingleton().getByName("rigsofrods/managedmaterial-placeholder"); // Built-in - m_apply_simple_materials = App::diag_simple_materials->GetBool(); + m_apply_simple_materials = App::diag_simple_materials->getBool(); if (m_apply_simple_materials) { m_simple_material_base = Ogre::MaterialManager::getSingleton().getByName("tracks/simple"); // Built-in material @@ -393,7 +393,7 @@ void ActorSpawner::FinalizeRig() } //Gearbox - m_actor->ar_engine->SetAutoMode(App::sim_gearbox_mode->GetEnum()); + m_actor->ar_engine->SetAutoMode(App::sim_gearbox_mode->getEnum()); } // Sanitize trigger_cmdshort and trigger_cmdlong @@ -2124,7 +2124,7 @@ void ActorSpawner::ProcessFlare2(RigDef::Flare2 & def) flare.isVisible = true; flare.light = nullptr; - if ((App::gfx_flares_mode->GetEnum() >= GfxFlaresMode::CURR_VEHICLE_HEAD_ONLY) && size > 0.001) + if ((App::gfx_flares_mode->getEnum() >= GfxFlaresMode::CURR_VEHICLE_HEAD_ONLY) && size > 0.001) { //if (type == 'f' && usingDefaultMaterial && flaresMode >=2 && size > 0.001) if (flare.fl_type == FlareType::HEADLIGHT && using_default_material ) @@ -2139,7 +2139,7 @@ void ActorSpawner::ProcessFlare2(RigDef::Flare2 & def) flare.light->setCastShadows(false); } } - if ((App::gfx_flares_mode->GetEnum() >= GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS) && size > 0.001) + if ((App::gfx_flares_mode->getEnum() >= GfxFlaresMode::ALL_VEHICLES_ALL_LIGHTS) && size > 0.001) { if (flare.fl_type == FlareType::HEADLIGHT && ! using_default_material) { @@ -2233,7 +2233,7 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def) if (def.HasSpecularMap()) { /* FLEXMESH, damage, specular */ - if (App::gfx_classic_shaders->GetBool()) + if (App::gfx_classic_shaders->getBool()) { material = this->InstantiateManagedMaterial(mat_name_base + "/speculardamage_nicemetal", custom_name); } @@ -2245,7 +2245,7 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def) { return; } - if(App::gfx_classic_shaders->GetBool()) + if(App::gfx_classic_shaders->getBool()) { material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map); material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Dmg_Diffuse_Map")->setTextureName(def.damaged_diffuse_map); @@ -2276,7 +2276,7 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def) if (def.HasSpecularMap()) { /* FLEXMESH, no_damage, specular */ - if (App::gfx_classic_shaders->GetBool()) + if (App::gfx_classic_shaders->getBool()) { material = this->InstantiateManagedMaterial(mat_name_base + "/specularonly_nicemetal", custom_name); } @@ -2288,7 +2288,7 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def) { return; } - if (App::gfx_classic_shaders->GetBool()) + if (App::gfx_classic_shaders->getBool()) { material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map); material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map); @@ -2322,7 +2322,7 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def) if (def.HasSpecularMap()) { /* MESH, specular */ - if (App::gfx_classic_shaders->GetBool()) + if (App::gfx_classic_shaders->getBool()) { material = this->InstantiateManagedMaterial(mat_name_base + "/specular_nicemetal", custom_name); } @@ -2334,7 +2334,7 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def) { return; } - if (App::gfx_classic_shaders->GetBool()) + if (App::gfx_classic_shaders->getBool()) { material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Diffuse_Map")->setTextureName(def.diffuse_map); material->getTechnique("BaseTechnique")->getPass("BaseRender")->getTextureUnitState("Specular_Map")->setTextureName(def.specular_map); @@ -2366,7 +2366,7 @@ void ActorSpawner::ProcessManagedMaterial(RigDef::ManagedMaterial & def) material->getTechnique("BaseTechnique")->getPass("BaseRender")->setCullingMode(Ogre::CULL_NONE); if (def.HasSpecularMap()) { - if (App::gfx_classic_shaders->GetBool()) + if (App::gfx_classic_shaders->getBool()) { material->getTechnique("BaseTechnique")->getPass("Specular")->setCullingMode(Ogre::CULL_NONE); } @@ -2626,7 +2626,7 @@ void ActorSpawner::ProcessTorqueCurve(RigDef::TorqueCurve & def) void ActorSpawner::ProcessParticle(RigDef::Particle & def) { - if (App::gfx_particles_mode->GetInt() != 1) + if (App::gfx_particles_mode->getInt() != 1) { return; } @@ -5155,7 +5155,7 @@ void ActorSpawner::ProcessEngine(RigDef::Engine & def) m_actor ); - m_actor->ar_engine->SetAutoMode(App::sim_gearbox_mode->GetEnum()); + m_actor->ar_engine->SetAutoMode(App::sim_gearbox_mode->getEnum()); }; void ActorSpawner::ProcessHelp() @@ -6547,7 +6547,7 @@ void ActorSpawner::FinalizeGfxSetup() } } - if (!App::gfx_enable_videocams->GetBool()) + if (!App::gfx_enable_videocams->getBool()) { m_actor->m_gfx_actor->SetVideoCamState(GfxActor::VideoCamState::VCSTATE_DISABLED); } @@ -6574,9 +6574,9 @@ void ActorSpawner::FinalizeGfxSetup() { if (m_actor->ar_driveable == TRUCK) // load default for a truck { - if (App::gfx_speedo_digital->GetBool()) + if (App::gfx_speedo_digital->getBool()) { - if (App::gfx_speedo_imperial->GetBool()) + if (App::gfx_speedo_imperial->getBool()) { if (m_actor->ar_engine->getMaxRPM() > 3500) { @@ -6605,7 +6605,7 @@ void ActorSpawner::FinalizeGfxSetup() } else // Analog speedometer { - if (App::gfx_speedo_imperial->GetBool()) + if (App::gfx_speedo_imperial->getBool()) { if (m_actor->ar_engine->getMaxRPM() > 3500) { @@ -6711,7 +6711,7 @@ void ActorSpawner::FinalizeGfxSetup() Ogre::ColourValue(0,0,0) ); } - if (App::gfx_reduce_shadows->GetBool()) + if (App::gfx_reduce_shadows->getBool()) { backmat->setReceiveShadows(false); } @@ -7032,7 +7032,7 @@ void ActorSpawner::CreateVideoCamera(RigDef::VideoCamera* def) // TODO: Eliminate gEnv vcam.vcam_ogre_camera = App::GetGfxScene()->GetSceneManager()->createCamera(vcam.vcam_material->getName() + "_camera"); - if (!App::gfx_window_videocams->GetBool()) + if (!App::gfx_window_videocams->getBool()) { vcam.vcam_render_tex = Ogre::TextureManager::getSingleton().createManual( vcam.vcam_material->getName() + "_texture", @@ -7091,7 +7091,7 @@ void ActorSpawner::CreateVideoCamera(RigDef::VideoCamera* def) vcam.vcam_material->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(vcam.vcam_off_tex_name); } - if (App::diag_videocameras->GetBool()) + if (App::diag_videocameras->getBool()) { Ogre::ManualObject* mo = CreateVideocameraDebugMesh(); // local helper function vcam.vcam_debug_node = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode(); diff --git a/source/main/physics/Savegame.cpp b/source/main/physics/Savegame.cpp index 559e15a14b..695dd765d7 100644 --- a/source/main/physics/Savegame.cpp +++ b/source/main/physics/Savegame.cpp @@ -53,8 +53,8 @@ using namespace RoR; std::string GameContext::GetQuicksaveFilename() { - std::string terrain_name = App::sim_terrain_name->GetStr(); - std::string mp = (App::mp_state->GetEnum() == RoR::MpState::CONNECTED) ? "_mp" : ""; + std::string terrain_name = App::sim_terrain_name->getStr(); + std::string mp = (App::mp_state->getEnum() == RoR::MpState::CONNECTED) ? "_mp" : ""; return "quicksave_" + StringUtil::replaceAll(terrain_name, ".terrn2", "") + mp + ".sav"; } @@ -144,7 +144,7 @@ void GameContext::HandleSavegameHotkeys() App::GetGameContext()->PushMessage(Message(MSG_SIM_LOAD_SAVEGAME_REQUESTED, filename)); } - if (App::sim_terrain_name->GetStr() == "" || App::sim_state->GetEnum() != SimState::RUNNING) + if (App::sim_terrain_name->getStr() == "" || App::sim_state->getEnum() != SimState::RUNNING) return; slot = -1; @@ -198,7 +198,7 @@ void GameContext::HandleSavegameHotkeys() if (App::GetInputEngine()->getEventBoolValueBounce(EV_COMMON_QUICKLOAD, 1.0f)) { - if (App::sim_quickload_dialog->GetBool()) + if (App::sim_quickload_dialog->getBool()) { GUI::MessageBoxConfig* dialog = new GUI::MessageBoxConfig; dialog->mbc_title = _LC("QuickloadDialog", "Load game?"); @@ -256,11 +256,11 @@ bool ActorManager::LoadScene(Ogre::String filename) // Terrain String terrain_name = j_doc["terrain_name"].GetString(); - if (App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (App::mp_state->getEnum() == RoR::MpState::CONNECTED) { if (filename == "autosave.sav") return false; - if (terrain_name != App::sim_terrain_name->GetStr()) + if (terrain_name != App::sim_terrain_name->getStr()) { App::GetConsole()->putMessage( Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_ERROR, _L("Error while loading scene: Terrain mismatch")); @@ -279,7 +279,7 @@ bool ActorManager::LoadScene(Ogre::String filename) App::GetGameContext()->GetActorManager()->SetSimulationPaused(j_doc["physics_paused"].GetBool()); #ifdef USE_CAELUM - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::CAELUM) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::CAELUM) { if (j_doc.HasMember("daytime")) { @@ -409,7 +409,7 @@ bool ActorManager::SaveScene(Ogre::String filename) { std::vector x_actors = GetLocalActors(); - if (App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (App::mp_state->getEnum() == RoR::MpState::CONNECTED) { if (filename == "autosave.sav") return false; @@ -426,15 +426,15 @@ bool ActorManager::SaveScene(Ogre::String filename) j_doc.AddMember("format_version", SAVEGAME_FILE_FORMAT, j_doc.GetAllocator()); // Pretty name - String pretty_name = App::GetCacheSystem()->GetPrettyName(App::sim_terrain_name->GetStr()); + String pretty_name = App::GetCacheSystem()->GetPrettyName(App::sim_terrain_name->getStr()); String scene_name = StringUtil::format("%s [%d]", pretty_name.c_str(), x_actors.size()); j_doc.AddMember("scene_name", rapidjson::StringRef(scene_name.c_str()), j_doc.GetAllocator()); // Terrain - j_doc.AddMember("terrain_name", rapidjson::StringRef(App::sim_terrain_name->GetStr().c_str()), j_doc.GetAllocator()); + j_doc.AddMember("terrain_name", rapidjson::StringRef(App::sim_terrain_name->getStr().c_str()), j_doc.GetAllocator()); #ifdef USE_CAELUM - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::CAELUM) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::CAELUM) { j_doc.AddMember("daytime", App::GetSimTerrain()->getSkyManager()->GetTime(), j_doc.GetAllocator()); } diff --git a/source/main/physics/collision/Collisions.cpp b/source/main/physics/collision/Collisions.cpp index 66835142d5..3dcb88d70d 100644 --- a/source/main/physics/collision/Collisions.cpp +++ b/source/main/physics/collision/Collisions.cpp @@ -124,7 +124,7 @@ Collisions::Collisions(Ogre::Vector3 terrn_size): , landuse(0) , m_terrain_size(terrn_size) { - debugMode = App::diag_collisions->GetBool(); // TODO: make interactive - do not copy the value, use GVar directly + debugMode = App::diag_collisions->getBool(); // TODO: make interactive - do not copy the value, use GVar directly for (int i=0; i < HASH_POWER; i++) { hashmask = hashmask << 1; @@ -149,7 +149,7 @@ Collisions::~Collisions() int Collisions::loadDefaultModels() { - return loadGroundModelsConfigFile(PathCombine(App::sys_config_dir->GetStr(), "ground_models.cfg")); + return loadGroundModelsConfigFile(PathCombine(App::sys_config_dir->getStr(), "ground_models.cfg")); } int Collisions::loadGroundModelsConfigFile(Ogre::String filename) diff --git a/source/main/physics/flex/FlexFactory.cpp b/source/main/physics/flex/FlexFactory.cpp index 24ac851aac..6abfc7b97f 100644 --- a/source/main/physics/flex/FlexFactory.cpp +++ b/source/main/physics/flex/FlexFactory.cpp @@ -54,7 +54,7 @@ const char * FlexBodyFileIO::SIGNATURE = "RoR FlexBody"; FlexFactory::FlexFactory(ActorSpawner* rig_spawner): m_rig_spawner(rig_spawner), m_is_flexbody_cache_loaded(false), - m_is_flexbody_cache_enabled(App::gfx_flexbody_cache->GetBool()), + m_is_flexbody_cache_enabled(App::gfx_flexbody_cache->getBool()), m_flexbody_cache_next_index(0) { } @@ -294,7 +294,7 @@ void FlexBodyFileIO::OpenFile(const char* fopen_mode) throw RESULT_CODE_ERR_CACHE_NUMBER_UNDEFINED; } char path[500]; - sprintf(path, "%s%cflexbodies_mod_%00d.dat", App::sys_cache_dir->GetStr().c_str(), RoR::PATH_SLASH, m_cache_entry_number); + sprintf(path, "%s%cflexbodies_mod_%00d.dat", App::sys_cache_dir->getStr().c_str(), RoR::PATH_SLASH, m_cache_entry_number); m_file = fopen(path, fopen_mode); if (m_file == nullptr) { diff --git a/source/main/resources/CacheSystem.cpp b/source/main/resources/CacheSystem.cpp index c4c3c56bb8..3fd3a43295 100644 --- a/source/main/resources/CacheSystem.cpp +++ b/source/main/resources/CacheSystem.cpp @@ -130,11 +130,11 @@ void CacheSystem::LoadModCache(CacheValidity validity) RoR::Log("[RoR|ModCache] Performing update ..."); this->PruneCache(); } - const bool orig_echo = App::diag_log_console_echo->GetBool(); - App::diag_log_console_echo->SetVal(false); + const bool orig_echo = App::diag_log_console_echo->getBool(); + App::diag_log_console_echo->setVal(false); this->ParseZipArchives(RGN_CONTENT); this->ParseKnownFiles(RGN_CONTENT); - App::diag_log_console_echo->SetVal(orig_echo); + App::diag_log_console_echo->setVal(orig_echo); this->DetectDuplicates(); this->WriteCacheFileJson(); } diff --git a/source/main/resources/ContentManager.cpp b/source/main/resources/ContentManager.cpp index d4e6e8359a..0cef65b075 100644 --- a/source/main/resources/ContentManager.cpp +++ b/source/main/resources/ContentManager.cpp @@ -115,7 +115,7 @@ void ContentManager::AddResourcePack(ResourcePack const& resource_pack, std::str std::stringstream log_msg; log_msg << "[RoR|ContentManager] Loading resource pack \"" << resource_pack.name << "\" to group \"" << rg_name << "\""; - std::string dir_path = PathCombine(App::sys_resources_dir->GetStr(), resource_pack.name); + std::string dir_path = PathCombine(App::sys_resources_dir->getStr(), resource_pack.name); std::string zip_path = dir_path + ".zip"; if (FileExists(zip_path)) { @@ -147,9 +147,9 @@ void ContentManager::AddResourcePack(ResourcePack const& resource_pack, std::str void ContentManager::InitContentManager() { ResourceGroupManager::getSingleton().addResourceLocation( - App::sys_config_dir->GetStr(), "FileSystem", RGN_CONFIG, /*recursive=*/false, /*readOnly=*/false); + App::sys_config_dir->getStr(), "FileSystem", RGN_CONFIG, /*recursive=*/false, /*readOnly=*/false); ResourceGroupManager::getSingleton().addResourceLocation( - App::sys_savegames_dir->GetStr(), "FileSystem", RGN_SAVEGAMES, /*recursive=*/false, /*readOnly=*/false); + App::sys_savegames_dir->getStr(), "FileSystem", RGN_SAVEGAMES, /*recursive=*/false, /*readOnly=*/false); Ogre::ScriptCompilerManager::getSingleton().setListener(this); @@ -208,7 +208,7 @@ void ContentManager::InitContentManager() LOG("RoR|ContentManager: Loading filesystems"); // add scripts folder - ResourceGroupManager::getSingleton().addResourceLocation(std::string(App::sys_user_dir->GetStr()) + PATH_SLASH + "scripts", "FileSystem", "Scripts"); + ResourceGroupManager::getSingleton().addResourceLocation(std::string(App::sys_user_dir->getStr()) + PATH_SLASH + "scripts", "FileSystem", "Scripts"); LOG("RoR|ContentManager: Registering colored text overlay factory"); ColoredTextAreaOverlayElementFactory* pCT = new ColoredTextAreaOverlayElementFactory(); @@ -219,14 +219,14 @@ void ContentManager::InitContentManager() TextureManager::getSingleton().setDefaultNumMipmaps(5); TextureFilterOptions tfo = TFO_NONE; - switch (App::gfx_texture_filter->GetEnum()) + switch (App::gfx_texture_filter->getEnum()) { case GfxTexFilter::ANISOTROPIC: tfo = TFO_ANISOTROPIC; break; case GfxTexFilter::TRILINEAR: tfo = TFO_TRILINEAR; break; case GfxTexFilter::BILINEAR: tfo = TFO_BILINEAR; break; case GfxTexFilter::NONE: tfo = TFO_NONE; break; } - MaterialManager::getSingleton().setDefaultAnisotropy(Math::Clamp(App::gfx_anisotropy->GetInt(), 1, 16)); + MaterialManager::getSingleton().setDefaultAnisotropy(Math::Clamp(App::gfx_anisotropy->getInt(), 1, 16)); MaterialManager::getSingleton().setDefaultTextureFiltering(tfo); // load all resources now, so the zip files are also initiated @@ -247,14 +247,14 @@ void ContentManager::InitContentManager() void ContentManager::InitModCache(CacheValidity validity) { ResourceGroupManager::getSingleton().addResourceLocation( - App::sys_cache_dir->GetStr(), "FileSystem", RGN_CACHE, /*recursive=*/false, /*readOnly=*/false); - std::string user = App::sys_user_dir->GetStr(); - std::string base = App::sys_process_dir->GetStr(); + App::sys_cache_dir->getStr(), "FileSystem", RGN_CACHE, /*recursive=*/false, /*readOnly=*/false); + std::string user = App::sys_user_dir->getStr(); + std::string base = App::sys_process_dir->getStr(); std::string objects = PathCombine("resources", "beamobjects.zip"); - if (!App::app_extra_mod_path->GetStr().empty()) + if (!App::app_extra_mod_path->getStr().empty()) { - std::string extra_mod_path = App::app_extra_mod_path->GetStr(); + std::string extra_mod_path = App::app_extra_mod_path->getStr(); ResourceGroupManager::getSingleton().addResourceLocation(extra_mod_path , "FileSystem", RGN_CONTENT); } ResourceGroupManager::getSingleton().addResourceLocation(PathCombine(user, "mods") , "FileSystem", RGN_CONTENT); @@ -265,9 +265,9 @@ void ContentManager::InitModCache(CacheValidity validity) ResourceGroupManager::getSingleton().addResourceLocation(PathCombine(base, objects) , "Zip" , RGN_CONTENT); ResourceGroupManager::getSingleton().createResourceGroup(RGN_TEMP, false); - if (!App::app_extra_mod_path->GetStr().empty()) + if (!App::app_extra_mod_path->getStr().empty()) { - std::string extra_mod_path = App::app_extra_mod_path->GetStr(); + std::string extra_mod_path = App::app_extra_mod_path->getStr(); ResourceGroupManager::getSingleton().addResourceLocation(extra_mod_path , "FileSystem", RGN_TEMP, true); } ResourceGroupManager::getSingleton().addResourceLocation(PathCombine(user, "mods") , "FileSystem", RGN_TEMP, true); @@ -349,10 +349,10 @@ bool ContentManager::handleEvent(ScriptCompiler *compiler, ScriptCompilerEvent * void ContentManager::InitManagedMaterials(std::string const & rg_name) { - Ogre::String managed_materials_dir = PathCombine(App::sys_resources_dir->GetStr(), "managed_materials"); + Ogre::String managed_materials_dir = PathCombine(App::sys_resources_dir->getStr(), "managed_materials"); //Dirty, needs to be improved - if (App::gfx_shadow_type->GetEnum() == GfxShadowType::PSSM) + if (App::gfx_shadow_type->getEnum() == GfxShadowType::PSSM) { if (rg_name == RGN_MANAGED_MATS) // Only load shared resources on startup { @@ -390,16 +390,16 @@ void ContentManager::LoadGameplayResources() m_base_resource_loaded = true; } - if (App::gfx_water_mode->GetEnum() == GfxWaterMode::HYDRAX) + if (App::gfx_water_mode->getEnum() == GfxWaterMode::HYDRAX) this->AddResourcePack(ContentManager::ResourcePack::HYDRAX); - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::CAELUM) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::CAELUM) this->AddResourcePack(ContentManager::ResourcePack::CAELUM); - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::SKYX) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::SKYX) this->AddResourcePack(ContentManager::ResourcePack::SKYX); - if (App::gfx_vegetation_mode->GetEnum() != RoR::GfxVegetation::NONE) + if (App::gfx_vegetation_mode->getEnum() != RoR::GfxVegetation::NONE) this->AddResourcePack(ContentManager::ResourcePack::PAGED); } diff --git a/source/main/resources/otc_fileformat/OTCFileFormat.cpp b/source/main/resources/otc_fileformat/OTCFileFormat.cpp index f0c4e4dc9c..298e9dc5cf 100644 --- a/source/main/resources/otc_fileformat/OTCFileFormat.cpp +++ b/source/main/resources/otc_fileformat/OTCFileFormat.cpp @@ -44,30 +44,30 @@ bool RoR::OTCParser::LoadMasterConfig(Ogre::DataStreamPtr &ds, const char* filen { cfg.load(ds, "\t:=", false); - m_def->disable_cache = cfg.GetBool ("disableCaching", false); - m_def->world_size_x = cfg.GetInt ("WorldSizeX", 1024); - m_def->world_size_y = cfg.GetInt ("WorldSizeY", 50); - m_def->world_size_z = cfg.GetInt ("WorldSizeZ", 1024); - m_def->page_size = cfg.GetInt ("PageSize", 1025); - m_def->pages_max_x = cfg.GetInt ("PagesX", 0); - m_def->pages_max_z = cfg.GetInt ("PagesZ", 0); + m_def->disable_cache = cfg.getBool ("disableCaching", false); + m_def->world_size_x = cfg.getInt ("WorldSizeX", 1024); + m_def->world_size_y = cfg.getInt ("WorldSizeY", 50); + m_def->world_size_z = cfg.getInt ("WorldSizeZ", 1024); + m_def->page_size = cfg.getInt ("PageSize", 1025); + m_def->pages_max_x = cfg.getInt ("PagesX", 0); + m_def->pages_max_z = cfg.getInt ("PagesZ", 0); m_def->page_filename_format = cfg.GetString("PageFileFormat", file_basename + "-page-{X}-{Z}.otc"); - m_def->is_flat = cfg.GetBool ("Flat", false); - m_def->max_pixel_error = cfg.GetInt ("MaxPixelError", 5); - m_def->batch_size_min = cfg.GetInt ("minBatchSize", 33); - m_def->batch_size_max = cfg.GetInt ("maxBatchSize", 65); - m_def->lightmap_enabled = cfg.GetBool ("LightmapEnabled", false); - m_def->norm_map_enabled = cfg.GetBool ("NormalMappingEnabled", false); - m_def->spec_map_enabled = cfg.GetBool ("SpecularMappingEnabled", false); - m_def->parallax_enabled = cfg.GetBool ("ParallaxMappingEnabled", false); - m_def->blendmap_dbg_enabled = cfg.GetBool ("DebugBlendMaps", false); - m_def->global_colormap_enabled = cfg.GetBool ("GlobalColourMapEnabled", false); - m_def->recv_dyn_shadows_depth = cfg.GetBool ("ReceiveDynamicShadowsDepth", false); - m_def->composite_map_distance = cfg.GetInt ("CompositeMapDistance", 4000); - m_def->layer_blendmap_size = cfg.GetInt ("LayerBlendMapSize", 1024); - m_def->composite_map_size = cfg.GetInt ("CompositeMapSize", 1024); - m_def->lightmap_size = cfg.GetInt ("LightMapSize", 1024); - m_def->skirt_size = cfg.GetInt ("SkirtSize", 30); + m_def->is_flat = cfg.getBool ("Flat", false); + m_def->max_pixel_error = cfg.getInt ("MaxPixelError", 5); + m_def->batch_size_min = cfg.getInt ("minBatchSize", 33); + m_def->batch_size_max = cfg.getInt ("maxBatchSize", 65); + m_def->lightmap_enabled = cfg.getBool ("LightmapEnabled", false); + m_def->norm_map_enabled = cfg.getBool ("NormalMappingEnabled", false); + m_def->spec_map_enabled = cfg.getBool ("SpecularMappingEnabled", false); + m_def->parallax_enabled = cfg.getBool ("ParallaxMappingEnabled", false); + m_def->blendmap_dbg_enabled = cfg.getBool ("DebugBlendMaps", false); + m_def->global_colormap_enabled = cfg.getBool ("GlobalColourMapEnabled", false); + m_def->recv_dyn_shadows_depth = cfg.getBool ("ReceiveDynamicShadowsDepth", false); + m_def->composite_map_distance = cfg.getInt ("CompositeMapDistance", 4000); + m_def->layer_blendmap_size = cfg.getInt ("LayerBlendMapSize", 1024); + m_def->composite_map_size = cfg.getInt ("CompositeMapSize", 1024); + m_def->lightmap_size = cfg.getInt ("LightMapSize", 1024); + m_def->skirt_size = cfg.getInt ("SkirtSize", 30); m_def->world_size = std::max(m_def->world_size_x, m_def->world_size_z); m_def->origin_pos = Ogre::Vector3(m_def->world_size_x / 2.0f, 0.0f, m_def->world_size_z / 2.0f); @@ -84,10 +84,10 @@ bool RoR::OTCParser::LoadMasterConfig(Ogre::DataStreamPtr &ds, const char* filen char base[50], key[75]; snprintf(base, 50, "Heightmap.%d.%d", x, z); - snprintf(key, 75, "%s.raw.size", base); int raw_size = cfg.GetInt(key, 1025); - snprintf(key, 75, "%s.raw.bpp", base); int raw_bpp = cfg.GetInt(key, 2); - snprintf(key, 75, "%s.flipX", base); bool flip_x = cfg.GetBool(key, false); - snprintf(key, 75, "%s.flipY", base); bool flip_y = cfg.GetBool(key, false); + snprintf(key, 75, "%s.raw.size", base); int raw_size = cfg.getInt(key, 1025); + snprintf(key, 75, "%s.raw.bpp", base); int raw_bpp = cfg.getInt(key, 2); + snprintf(key, 75, "%s.flipX", base); bool flip_x = cfg.getBool(key, false); + snprintf(key, 75, "%s.flipY", base); bool flip_y = cfg.getBool(key, false); m_def->pages.emplace_back(x, z, filename, flip_x, flip_y, raw_size, raw_bpp); } diff --git a/source/main/resources/rig_def_fileformat/RigDef_Node.cpp b/source/main/resources/rig_def_fileformat/RigDef_Node.cpp index 24e60f5e01..824a955a8f 100644 --- a/source/main/resources/rig_def_fileformat/RigDef_Node.cpp +++ b/source/main/resources/rig_def_fileformat/RigDef_Node.cpp @@ -47,7 +47,7 @@ Node::Id::Id(std::string const & id_str): m_id_num(0), m_flags(0) { - this->SetStr(id_str); + this->setStr(id_str); } // Setters @@ -60,7 +60,7 @@ void Node::Id::SetNum(unsigned int num) BITMASK_SET_1(m_flags, IS_TYPE_NUMBERED | IS_VALID); } -void Node::Id::SetStr(std::string const & id_str) +void Node::Id::setStr(std::string const & id_str) { m_id_num = 0; m_id_str = id_str; diff --git a/source/main/resources/rig_def_fileformat/RigDef_Node.h b/source/main/resources/rig_def_fileformat/RigDef_Node.h index e0353f766e..8214ffd9a0 100644 --- a/source/main/resources/rig_def_fileformat/RigDef_Node.h +++ b/source/main/resources/rig_def_fileformat/RigDef_Node.h @@ -55,7 +55,7 @@ struct Node // Setters void SetNum(unsigned int id_num); - void SetStr(std::string const & id_str); + void setStr(std::string const & id_str); // Getters inline std::string const & Str() const { return m_id_str; } diff --git a/source/main/resources/rig_def_fileformat/RigDef_Parser.cpp b/source/main/resources/rig_def_fileformat/RigDef_Parser.cpp index 6ac229b253..16ccf20f60 100644 --- a/source/main/resources/rig_def_fileformat/RigDef_Parser.cpp +++ b/source/main/resources/rig_def_fileformat/RigDef_Parser.cpp @@ -2781,7 +2781,7 @@ void Parser::ParseNodesUnified() if (m_current_section == File::SECTION_NODES_2) { std::string node_name = this->GetArgStr(0); - node.id.SetStr(node_name); + node.id.setStr(node_name); if (m_sequential_importer.IsEnabled()) { m_sequential_importer.AddNamedNode(node_name); diff --git a/source/main/resources/rig_def_fileformat/RigDef_SequentialImporter.cpp b/source/main/resources/rig_def_fileformat/RigDef_SequentialImporter.cpp index 46cc402033..e80f0a3675 100644 --- a/source/main/resources/rig_def_fileformat/RigDef_SequentialImporter.cpp +++ b/source/main/resources/rig_def_fileformat/RigDef_SequentialImporter.cpp @@ -92,11 +92,11 @@ void SequentialImporter::Process(std::shared_ptr def) this->ProcessModule((*itor).second); } - if (RoR::App::diag_rig_log_node_stats->GetBool()) + if (RoR::App::diag_rig_log_node_stats->getBool()) { this->AddMessage(Message::TYPE_INFO, this->GetNodeStatistics()); } - if (RoR::App::diag_rig_log_node_import->GetBool()) + if (RoR::App::diag_rig_log_node_import->getBool()) { this->AddMessage(Message::TYPE_INFO, this->IterateAndPrintAllNodes()); } diff --git a/source/main/resources/terrn2_fileformat/Terrn2FileFormat.cpp b/source/main/resources/terrn2_fileformat/Terrn2FileFormat.cpp index 0b128c11f4..7194a1fb34 100644 --- a/source/main/resources/terrn2_fileformat/Terrn2FileFormat.cpp +++ b/source/main/resources/terrn2_fileformat/Terrn2FileFormat.cpp @@ -59,20 +59,20 @@ bool Terrn2Parser::LoadTerrn2(Terrn2Def& def, Ogre::DataStreamPtr &ds) } def.ambient_color = file.GetColourValue("AmbientColor", "General", ColourValue::White); - def.category_id = file.GetInt ("CategoryID", "General", 129); + def.category_id = file.getInt ("CategoryID", "General", 129); def.guid = file.GetStringEx ("GUID", "General"); - def.version = file.GetInt ("Version", "General", 1); - def.gravity = file.GetFloat ("Gravity", "General", -9.81); + def.version = file.getInt ("Version", "General", 1); + def.gravity = file.getFloat ("Gravity", "General", -9.81); def.caelum_config = file.GetStringEx ("CaelumConfigFile", "General"); def.cubemap_config = file.GetStringEx ("SandStormCubeMap", "General"); - def.caelum_fog_start = file.GetInt ("CaelumFogStart", "General", -1); - def.caelum_fog_end = file.GetInt ("CaelumFogEnd", "General", -1); - def.has_water = file.GetBool ("Water", "General", false); + def.caelum_fog_start = file.getInt ("CaelumFogStart", "General", -1); + def.caelum_fog_end = file.getInt ("CaelumFogEnd", "General", -1); + def.has_water = file.getBool ("Water", "General", false); def.hydrax_conf_file = file.GetStringEx ("HydraxConfigFile", "General"); def.skyx_config = file.GetStringEx ("SkyXConfigFile", "General"); def.traction_map_file = file.GetStringEx ("TractionMap", "General"); - def.water_height = file.GetFloat ("WaterLine", "General"); - def.water_bottom_height = file.GetFloat ("WaterBottomLine", "General"); + def.water_height = file.getFloat ("WaterLine", "General"); + def.water_bottom_height = file.getFloat ("WaterBottomLine", "General"); def.custom_material_name = file.GetStringEx ("CustomMaterial", "General"); def.start_position = StringConverter::parseVector3(file.GetStringEx("StartPosition", "General"), Vector3(512.0f, 0.0f, 512.0f)); diff --git a/source/main/scripting/GameScript.cpp b/source/main/scripting/GameScript.cpp index 58dca2cc41..ed9d3b6689 100644 --- a/source/main/scripting/GameScript.cpp +++ b/source/main/scripting/GameScript.cpp @@ -706,7 +706,7 @@ void GameScript::cameraLookAt(const Vector3& pos) int GameScript::useOnlineAPI(const String& apiquery, const AngelScript::CScriptDictionary& dict, String& result) { - if (App::app_disable_online_api->GetBool()) + if (App::app_disable_online_api->getBool()) return 0; Actor* player_actor = App::GetGameContext()->GetPlayerActor(); @@ -714,9 +714,9 @@ int GameScript::useOnlineAPI(const String& apiquery, const AngelScript::CScriptD if (player_actor == nullptr) return 1; - std::string hashtok = Utils::Sha1Hash(App::mp_player_name->GetStr()); - std::string url = App::mp_api_url->GetStr() + apiquery; - std::string user = std::string("RoR-Api-User: ") + App::mp_player_name->GetStr(); + std::string hashtok = Utils::Sha1Hash(App::mp_player_name->getStr()); + std::string url = App::mp_api_url->getStr() + apiquery; + std::string user = std::string("RoR-Api-User: ") + App::mp_player_name->getStr(); std::string token = std::string("RoR-Api-User-Token: ") + hashtok; std::string terrain_name = App::GetSimTerrain()->getTerrainName(); @@ -727,12 +727,12 @@ int GameScript::useOnlineAPI(const String& apiquery, const AngelScript::CScriptD rapidjson::Document j_doc; j_doc.SetObject(); - j_doc.AddMember("user-name", rapidjson::StringRef(App::mp_player_name->GetStr().c_str()), j_doc.GetAllocator()); - j_doc.AddMember("user-country", rapidjson::StringRef(App::app_country->GetStr().c_str()), j_doc.GetAllocator()); + j_doc.AddMember("user-name", rapidjson::StringRef(App::mp_player_name->getStr().c_str()), j_doc.GetAllocator()); + j_doc.AddMember("user-country", rapidjson::StringRef(App::app_country->getStr().c_str()), j_doc.GetAllocator()); j_doc.AddMember("user-token", rapidjson::StringRef(hashtok.c_str()), j_doc.GetAllocator()); j_doc.AddMember("terrain-name", rapidjson::StringRef(terrain_name.c_str()), j_doc.GetAllocator()); - j_doc.AddMember("terrain-filename", rapidjson::StringRef(App::sim_terrain_name->GetStr().c_str()), j_doc.GetAllocator()); + j_doc.AddMember("terrain-filename", rapidjson::StringRef(App::sim_terrain_name->getStr().c_str()), j_doc.GetAllocator()); j_doc.AddMember("script-name", rapidjson::StringRef(script_name.c_str()), j_doc.GetAllocator()); j_doc.AddMember("script-hash", rapidjson::StringRef(script_hash.c_str()), j_doc.GetAllocator()); @@ -834,7 +834,7 @@ int GameScript::deleteScriptVariable(const String& arg) int GameScript::sendGameCmd(const String& message) { #ifdef USE_SOCKETW - if (RoR::App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (RoR::App::mp_state->getEnum() == RoR::MpState::CONNECTED) { App::GetNetwork()->AddPacket(0, RoRnet::MSG2_GAME_CMD, (int)message.size(), const_cast(message.c_str())); return 0; diff --git a/source/main/scripting/ScriptEngine.cpp b/source/main/scripting/ScriptEngine.cpp index c3ac3de7e5..8a90c581a6 100644 --- a/source/main/scripting/ScriptEngine.cpp +++ b/source/main/scripting/ScriptEngine.cpp @@ -78,7 +78,7 @@ ScriptEngine::ScriptEngine() : , scriptLog(0) , scriptName() { - scriptLog = LogManager::getSingleton().createLog(PathCombine(App::sys_logs_dir->GetStr(), "Angelscript.log"), false); + scriptLog = LogManager::getSingleton().createLog(PathCombine(App::sys_logs_dir->getStr(), "Angelscript.log"), false); this->init(); } diff --git a/source/main/system/AppCommandLine.cpp b/source/main/system/AppCommandLine.cpp index 0acbaa1a8a..cb57075d82 100644 --- a/source/main/system/AppCommandLine.cpp +++ b/source/main/system/AppCommandLine.cpp @@ -74,50 +74,50 @@ void Console::processCommandLine(int argc, char *argv[]) { if (args.LastError() != SO_SUCCESS) { - App::app_state->SetVal((int)AppState::PRINT_HELP_EXIT); + App::app_state->setVal((int)AppState::PRINT_HELP_EXIT); return; } else if (args.OptionId() == OPT_HELP) { - App::app_state->SetVal((int)AppState::PRINT_HELP_EXIT); + App::app_state->setVal((int)AppState::PRINT_HELP_EXIT); return; } else if (args.OptionId() == OPT_VER) { - App::app_state->SetVal((int)AppState::PRINT_VERSION_EXIT); + App::app_state->setVal((int)AppState::PRINT_VERSION_EXIT); return; } else if (args.OptionId() == OPT_TRUCK) { - App::cli_preset_vehicle->SetStr(args.OptionArg()); + App::cli_preset_vehicle->setStr(args.OptionArg()); } else if (args.OptionId() == OPT_TRUCKCONFIG) { - App::cli_preset_veh_config->SetStr(args.OptionArg()); + App::cli_preset_veh_config->setStr(args.OptionArg()); } else if (args.OptionId() == OPT_MAP) { - App::cli_preset_terrain->SetStr(args.OptionArg()); + App::cli_preset_terrain->setStr(args.OptionArg()); } else if (args.OptionId() == OPT_POS) { - App::cli_preset_spawn_pos->SetStr(args.OptionArg()); + App::cli_preset_spawn_pos->setStr(args.OptionArg()); } else if (args.OptionId() == OPT_ROT) { - App::cli_preset_spawn_rot->SetStr(args.OptionArg()); + App::cli_preset_spawn_rot->setStr(args.OptionArg()); } else if (args.OptionId() == OPT_RESUME) { - App::cli_resume_autosave->SetVal(true); + App::cli_resume_autosave->setVal(true); } else if (args.OptionId() == OPT_CHECKCACHE) { - App::cli_force_cache_update->SetVal(true); + App::cli_force_cache_update->setVal(true); } else if (args.OptionId() == OPT_ENTERTRUCK) { - App::cli_preset_veh_enter->SetVal(true); + App::cli_preset_veh_enter->setVal(true); } else if (args.OptionId() == OPT_JOINMPSERVER) { @@ -137,8 +137,8 @@ void Console::processCommandLine(int argc, char *argv[]) host_str = server_args.substr(0, colon); port_str = server_args.substr(colon + 1, server_args.length()); } - App::cli_server_host->SetStr(host_str.c_str()); - App::cli_server_port->SetVal(Ogre::StringConverter::parseInt(port_str)); + App::cli_server_host->setStr(host_str.c_str()); + App::cli_server_port->setVal(Ogre::StringConverter::parseInt(port_str)); } } } diff --git a/source/main/system/AppConfig.cpp b/source/main/system/AppConfig.cpp index 296cfe58fb..08266e84e9 100644 --- a/source/main/system/AppConfig.cpp +++ b/source/main/system/AppConfig.cpp @@ -43,54 +43,54 @@ void AssignHelper(CVar* cvar, int val) void ParseHelper(CVar* cvar, std::string const & val) { - if (cvar->GetName() == App::gfx_envmap_rate->GetName()) + if (cvar->getName() == App::gfx_envmap_rate->getName()) { int rate = Ogre::StringConverter::parseInt(val); if (rate < 0) { rate = 0; } if (rate > 6) { rate = 6; } AssignHelper(App::gfx_envmap_rate, rate); } - else if (cvar->GetName() == App::gfx_shadow_quality->GetName()) + else if (cvar->getName() == App::gfx_shadow_quality->getName()) { int quality = Ogre::StringConverter::parseInt(val); if (quality < 0) { quality = 0; } if (quality > 3) { quality = 3; } AssignHelper(App::gfx_shadow_quality, quality); } - else if (cvar->GetName() == App::gfx_shadow_type->GetName()) + else if (cvar->getName() == App::gfx_shadow_type->getName()) { AssignHelper(App::gfx_shadow_type, (int)ParseGfxShadowType(val)); } - else if (cvar->GetName() == App::gfx_extcam_mode->GetName()) + else if (cvar->getName() == App::gfx_extcam_mode->getName()) { AssignHelper(App::gfx_extcam_mode, (int)ParseGfxExtCamMode(val)); } - else if (cvar->GetName() == App::gfx_texture_filter->GetName()) + else if (cvar->getName() == App::gfx_texture_filter->getName()) { AssignHelper(App::gfx_texture_filter, (int)ParseGfxTexFilter(val)); } - else if (cvar->GetName() == App::gfx_vegetation_mode->GetName()) + else if (cvar->getName() == App::gfx_vegetation_mode->getName()) { AssignHelper(App::gfx_vegetation_mode, (int)ParseGfxVegetation(val)); } - else if (cvar->GetName() == App::gfx_flares_mode->GetName()) + else if (cvar->getName() == App::gfx_flares_mode->getName()) { AssignHelper(App::gfx_flares_mode, (int)ParseGfxFlaresMode(val)); } - else if (cvar->GetName() == App::gfx_water_mode->GetName()) + else if (cvar->getName() == App::gfx_water_mode->getName()) { AssignHelper(App::gfx_water_mode, (int)ParseGfxWaterMode(val)); } - else if (cvar->GetName() == App::gfx_sky_mode->GetName()) + else if (cvar->getName() == App::gfx_sky_mode->getName()) { AssignHelper(App::gfx_sky_mode, (int)ParseGfxSkyMode(val)); } - else if (cvar->GetName() == App::sim_gearbox_mode->GetName()) + else if (cvar->getName() == App::sim_gearbox_mode->getName()) { AssignHelper(App::sim_gearbox_mode, (int)ParseSimGearboxMode(val)); } - else if (cvar->GetName() == App::gfx_fov_external_default->GetName() || - cvar->GetName() == App::gfx_fov_internal_default->GetName()) + else if (cvar->getName() == App::gfx_fov_external_default->getName() || + cvar->getName() == App::gfx_fov_internal_default->getName()) { int fov = Ogre::StringConverter::parseInt(val); if (fov >= 10) // FOV shouldn't be below 10 @@ -109,7 +109,7 @@ void Console::loadConfig() Ogre::ConfigFile cfg; try { - std::string path = PathCombine(App::sys_config_dir->GetStr(), CONFIG_FILE_NAME); + std::string path = PathCombine(App::sys_config_dir->getStr(), CONFIG_FILE_NAME); cfg.load(path, "=:\t", /*trimWhitespace=*/true); Ogre::ConfigFile::SettingsIterator i = cfg.getSettingsIterator(); @@ -117,9 +117,9 @@ void Console::loadConfig() { std::string cvar_name = RoR::Utils::SanitizeUtf8String(i.peekNextKey()); CVar* cvar = App::GetConsole()->cVarFind(cvar_name); - if (cvar && !cvar->HasFlag(CVAR_ARCHIVE)) + if (cvar && !cvar->hasFlag(CVAR_ARCHIVE)) { - RoR::LogFormat("[RoR|Settings] CVar '%s' cannot be set from %s (defined without 'archive' flag)", cvar->GetName().c_str(), CONFIG_FILE_NAME); + RoR::LogFormat("[RoR|Settings] CVar '%s' cannot be set from %s (defined without 'archive' flag)", cvar->getName().c_str(), CONFIG_FILE_NAME); i.moveNext(); continue; } @@ -143,26 +143,26 @@ void WriteVarsHelper(std::stringstream& f, const char* label, const char* prefix for (auto& pair: App::GetConsole()->getCVars()) { - if (pair.second->HasFlag(CVAR_ARCHIVE) && pair.first.find(prefix) == 0) + if (pair.second->hasFlag(CVAR_ARCHIVE) && pair.first.find(prefix) == 0) { - if (App::app_config_long_names->GetBool()) + if (App::app_config_long_names->getBool()) { - f << pair.second->GetLongName() << "="; + f << pair.second->getLongName() << "="; } else { - f << pair.second->GetName() << "="; + f << pair.second->getName() << "="; } - if (pair.second->GetName() == App::gfx_shadow_type->GetName() ){ f << GfxShadowTypeToStr(App::gfx_shadow_type ->GetEnum()); } - else if (pair.second->GetName() == App::gfx_extcam_mode->GetName() ){ f << GfxExtCamModeToStr(App::gfx_extcam_mode ->GetEnum()); } - else if (pair.second->GetName() == App::gfx_texture_filter->GetName() ){ f << GfxTexFilterToStr (App::gfx_texture_filter ->GetEnum()); } - else if (pair.second->GetName() == App::gfx_vegetation_mode->GetName() ){ f << GfxVegetationToStr(App::gfx_vegetation_mode ->GetEnum()); } - else if (pair.second->GetName() == App::gfx_flares_mode->GetName() ){ f << GfxFlaresModeToStr(App::gfx_flares_mode ->GetEnum()); } - else if (pair.second->GetName() == App::gfx_water_mode->GetName() ){ f << GfxWaterModeToStr (App::gfx_water_mode ->GetEnum()); } - else if (pair.second->GetName() == App::gfx_sky_mode->GetName() ){ f << GfxSkyModeToStr (App::gfx_sky_mode ->GetEnum()); } - else if (pair.second->GetName() == App::sim_gearbox_mode->GetName() ){ f << SimGearboxModeToStr(App::sim_gearbox_mode->GetEnum()); } - else { f << pair.second->GetStr(); } + if (pair.second->getName() == App::gfx_shadow_type->getName() ){ f << GfxShadowTypeToStr(App::gfx_shadow_type ->getEnum()); } + else if (pair.second->getName() == App::gfx_extcam_mode->getName() ){ f << GfxExtCamModeToStr(App::gfx_extcam_mode ->getEnum()); } + else if (pair.second->getName() == App::gfx_texture_filter->getName() ){ f << GfxTexFilterToStr (App::gfx_texture_filter ->getEnum()); } + else if (pair.second->getName() == App::gfx_vegetation_mode->getName() ){ f << GfxVegetationToStr(App::gfx_vegetation_mode ->getEnum()); } + else if (pair.second->getName() == App::gfx_flares_mode->getName() ){ f << GfxFlaresModeToStr(App::gfx_flares_mode ->getEnum()); } + else if (pair.second->getName() == App::gfx_water_mode->getName() ){ f << GfxWaterModeToStr (App::gfx_water_mode ->getEnum()); } + else if (pair.second->getName() == App::gfx_sky_mode->getName() ){ f << GfxSkyModeToStr (App::gfx_sky_mode ->getEnum()); } + else if (pair.second->getName() == App::sim_gearbox_mode->getName() ){ f << SimGearboxModeToStr(App::sim_gearbox_mode->getEnum()); } + else { f << pair.second->getStr(); } f << std::endl; } diff --git a/source/main/system/CVar.cpp b/source/main/system/CVar.cpp index 6f9edfb307..d6e59bcba9 100644 --- a/source/main/system/CVar.cpp +++ b/source/main/system/CVar.cpp @@ -206,19 +206,19 @@ CVar* Console::cVarCreate(std::string const& name, std::string const& long_name, void Console::cVarAssign(CVar* cvar, std::string const& value) { - if (cvar->HasFlag(CVAR_TYPE_BOOL | CVAR_TYPE_INT | CVAR_TYPE_FLOAT)) + if (cvar->hasFlag(CVAR_TYPE_BOOL | CVAR_TYPE_INT | CVAR_TYPE_FLOAT)) { float val = 0.f; - if (cvar->HasFlag(CVAR_TYPE_BOOL)) { val = (float)Ogre::StringConverter::parseBool(value); } - else if (cvar->HasFlag(CVAR_TYPE_INT)) { val = (float)Ogre::StringConverter::parseInt(value); } - else if (cvar->HasFlag(CVAR_TYPE_FLOAT)) { val = Ogre::StringConverter::parseReal(value); } + if (cvar->hasFlag(CVAR_TYPE_BOOL)) { val = (float)Ogre::StringConverter::parseBool(value); } + else if (cvar->hasFlag(CVAR_TYPE_INT)) { val = (float)Ogre::StringConverter::parseInt(value); } + else if (cvar->hasFlag(CVAR_TYPE_FLOAT)) { val = Ogre::StringConverter::parseReal(value); } - cvar->SetVal(val); + cvar->setVal(val); } else { - cvar->SetStr(value); + cvar->setStr(value); } } @@ -261,29 +261,29 @@ CVar* Console::cVarGet(std::string const& input_name, int flags) return this->cVarCreate(input_name, input_name, flags); } -void CVar::LogUpdate(std::string const& new_val) +void CVar::logUpdate(std::string const& new_val) { if (!Ogre::LogManager::getSingletonPtr()) return; - if (this->HasFlag(CVAR_NO_LOG)) + if (this->hasFlag(CVAR_NO_LOG)) return; LogFormat("[RoR|CVar] %20s: \"%s\" (was: \"%s\")", m_name.c_str(), new_val.c_str(), m_value_str.c_str()); } -std::string CVar::ConvertStr(float val) +std::string CVar::convertStr(float val) { - if (this->HasFlag(CVAR_TYPE_BOOL)) + if (this->hasFlag(CVAR_TYPE_BOOL)) { return ((bool)val) ? "Yes" : "No"; } - else if (this->HasFlag(CVAR_TYPE_INT)) + else if (this->hasFlag(CVAR_TYPE_INT)) { return Ogre::StringUtil::format("%d", (int)val); } - else if (this->HasFlag(CVAR_TYPE_FLOAT)) + else if (this->hasFlag(CVAR_TYPE_FLOAT)) { return std::to_string((float)val); } diff --git a/source/main/system/CVar.h b/source/main/system/CVar.h index 8719633576..70109cd37e 100644 --- a/source/main/system/CVar.h +++ b/source/main/system/CVar.h @@ -56,31 +56,31 @@ class CVar m_value_num(0.f) { // Initialize string representation - if (this->HasFlag(CVAR_TYPE_BOOL | CVAR_TYPE_INT | CVAR_TYPE_FLOAT)) + if (this->hasFlag(CVAR_TYPE_BOOL | CVAR_TYPE_INT | CVAR_TYPE_FLOAT)) { - m_value_str = this->ConvertStr(m_value_num); + m_value_str = this->convertStr(m_value_num); } } // Data setters template - void SetVal(T val) + void setVal(T val) { if ((T)m_value_num != val) { - std::string str = this->ConvertStr((float)val); - this->LogUpdate(str); + std::string str = this->convertStr((float)val); + this->logUpdate(str); m_value_num = (float)val; m_value_str = str; } } - void SetStr(std::string const& str) + void setStr(std::string const& str) { if (m_value_str != str) { - this->LogUpdate(str); + this->logUpdate(str); m_value_num = 0; m_value_str = str; } @@ -88,21 +88,21 @@ class CVar // Data getters - std::string const& GetStr() const { return m_value_str; } - float GetFloat() const { return m_value_num; } - int GetInt() const { return (int)m_value_num; } - bool GetBool() const { return (bool)m_value_num; } - template T GetEnum() const { return (T)this->GetInt(); } + std::string const& getStr() const { return m_value_str; } + float getFloat() const { return m_value_num; } + int getInt() const { return (int)m_value_num; } + bool getBool() const { return (bool)m_value_num; } + template T getEnum() const { return (T)this->getInt(); } // Info getters - std::string const& GetName() const { return m_name; } - std::string const& GetLongName() const { return m_long_name; } - bool HasFlag(int f) const { return m_flags & f; } + std::string const& getName() const { return m_name; } + std::string const& getLongName() const { return m_long_name; } + bool hasFlag(int f) const { return m_flags & f; } private: - void LogUpdate(std::string const& new_val); - std::string ConvertStr(float val); + void logUpdate(std::string const& new_val); + std::string convertStr(float val); // Variables diff --git a/source/main/system/Console.cpp b/source/main/system/Console.cpp index a2460a0cdb..c2110c2395 100644 --- a/source/main/system/Console.cpp +++ b/source/main/system/Console.cpp @@ -31,7 +31,7 @@ using namespace Ogre; void Console::messageLogged(const Ogre::String& message, Ogre::LogMessageLevel lml, bool maskDebug, const Ogre::String& logName, bool& skipThisMessage) { - if (App::diag_log_console_echo->GetBool()) + if (App::diag_log_console_echo->getBool()) { this->forwardLogMessage(CONSOLE_MSGTYPE_LOG, message, lml); } diff --git a/source/main/system/ConsoleCmd.cpp b/source/main/system/ConsoleCmd.cpp index 48c1b9bd9c..9ce8e7bffb 100644 --- a/source/main/system/ConsoleCmd.cpp +++ b/source/main/system/ConsoleCmd.cpp @@ -201,10 +201,10 @@ class LogCmd: public ConsoleCmd Console::MessageType reply_type = Console::CONSOLE_SYSTEM_REPLY; // switch to console logging - bool now_logging = !App::diag_log_console_echo->GetBool(); + bool now_logging = !App::diag_log_console_echo->getBool(); const char* msg = (now_logging) ? " logging to console enabled" : " logging to console disabled"; reply << _L(msg); - App::diag_log_console_echo->SetVal(now_logging); + App::diag_log_console_echo->setVal(now_logging); App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, reply_type, reply.ToCStr()); } @@ -360,7 +360,7 @@ class HelpCmd: public ConsoleCmd Str<500> line; for (auto& cmd_pair: App::GetConsole()->getCommands()) { - line.Clear() << cmd_pair.second->GetName() << " " + line.Clear() << cmd_pair.second->getName() << " " << cmd_pair.second->GetUsage() << " - " << cmd_pair.second->GetDoc(); App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, @@ -399,15 +399,15 @@ class VarsCmd: public ConsoleCmd if (match) { Str<200> reply; - reply << "vars: " << pair.first << "=" << pair.second->GetStr() << " ("; + reply << "vars: " << pair.first << "=" << pair.second->getStr() << " ("; - if (pair.second->HasFlag(CVAR_TYPE_BOOL)) { reply << "bool"; } - else if (pair.second->HasFlag(CVAR_TYPE_INT)) { reply << "int"; } - else if (pair.second->HasFlag(CVAR_TYPE_FLOAT)) { reply << "float"; } + if (pair.second->hasFlag(CVAR_TYPE_BOOL)) { reply << "bool"; } + else if (pair.second->hasFlag(CVAR_TYPE_INT)) { reply << "int"; } + else if (pair.second->hasFlag(CVAR_TYPE_FLOAT)) { reply << "float"; } else { reply << "string"; } - if (pair.second->HasFlag(CVAR_ARCHIVE)) { reply << ", archive"; } - if (pair.second->HasFlag(CVAR_NO_LOG)) { reply << ", no log"; } + if (pair.second->hasFlag(CVAR_ARCHIVE)) { reply << ", archive"; } + if (pair.second->hasFlag(CVAR_NO_LOG)) { reply << ", no log"; } reply << ")"; App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_REPLY, reply.ToCStr()); @@ -442,7 +442,7 @@ class SetCmd: public ConsoleCmd App::GetConsole()->cVarAssign(cvar, args[2]); } reply_type = Console::CONSOLE_SYSTEM_REPLY; - reply << cvar->GetName() << " = " << cvar->GetStr(); + reply << cvar->getName() << " = " << cvar->getStr(); } else { @@ -496,7 +496,7 @@ class SetCVarCmd: public ConsoleCmd // Generic App::GetConsole()->cVarAssign(cvar, args[i+1]); } reply_type = Console::CONSOLE_SYSTEM_REPLY; - reply << cvar->GetName() << " = " << cvar->GetStr(); + reply << cvar->getName() << " = " << cvar->getStr(); } } @@ -591,26 +591,26 @@ void Console::regBuiltinCommands() ConsoleCmd* cmd = nullptr; // Classics - cmd = new GravityCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new WaterlevelCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new TerrainheightCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new SpawnobjectCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new LogCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new VerCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new PosCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new GotoCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new AsCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new QuitCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new HelpCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); + cmd = new GravityCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new WaterlevelCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new TerrainheightCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new SpawnobjectCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new LogCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new VerCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new PosCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new GotoCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new AsCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new QuitCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new HelpCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); // Additions - cmd = new ClearCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); + cmd = new ClearCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); // CVars - cmd = new SetCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new SetstringCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new SetboolCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new SetintCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new SetfloatCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); - cmd = new VarsCmd(); m_commands.insert(std::make_pair(cmd->GetName(), cmd)); + cmd = new SetCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new SetstringCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new SetboolCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new SetintCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new SetfloatCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); + cmd = new VarsCmd(); m_commands.insert(std::make_pair(cmd->getName(), cmd)); } void Console::doCommand(std::string msg) @@ -635,7 +635,7 @@ void Console::doCommand(std::string msg) if (cvar) { Str<200> reply; - reply << cvar->GetName() << " = " << cvar->GetStr(); + reply << cvar->getName() << " = " << cvar->getStr(); App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_REPLY, reply.ToCStr()); return; } @@ -650,7 +650,7 @@ void Console::doCommand(std::string msg) bool ConsoleCmd::CheckAppState(AppState state) { - if (App::app_state->GetEnum() == state) + if (App::app_state->getEnum() == state) return true; Str<200> reply; diff --git a/source/main/system/ConsoleCmd.h b/source/main/system/ConsoleCmd.h index d304c6ea91..593add998a 100644 --- a/source/main/system/ConsoleCmd.h +++ b/source/main/system/ConsoleCmd.h @@ -40,7 +40,7 @@ class ConsoleCmd // abstract virtual void Run(Ogre::StringVector const& args) = 0; - std::string const& GetName() const { return m_name; } + std::string const& getName() const { return m_name; } std::string const& GetUsage() const { return m_usage; } std::string const& GetDoc() const { return m_doc; } diff --git a/source/main/terrain/TerrainEditor.cpp b/source/main/terrain/TerrainEditor.cpp index 4d1a7cf008..be9db13fa0 100644 --- a/source/main/terrain/TerrainEditor.cpp +++ b/source/main/terrain/TerrainEditor.cpp @@ -247,7 +247,7 @@ void TerrainEditor::UpdateInputEvents(float dt) void TerrainEditor::WriteOutputFile() { const char* filename = "editor_out.log"; - std::string editor_logpath = PathCombine(App::sys_logs_dir->GetStr(), filename); + std::string editor_logpath = PathCombine(App::sys_logs_dir->getStr(), filename); try { Ogre::DataStreamPtr stream diff --git a/source/main/terrain/TerrainManager.cpp b/source/main/terrain/TerrainManager.cpp index fb06a47ba7..47e1562367 100644 --- a/source/main/terrain/TerrainManager.cpp +++ b/source/main/terrain/TerrainManager.cpp @@ -63,7 +63,7 @@ TerrainManager::TerrainManager(CacheEntry* entry) TerrainManager::~TerrainManager() { - if (App::app_state->GetEnum() == AppState::SHUTDOWN) + if (App::app_state->getEnum() == AppState::SHUTDOWN) { // Rush to exit return; @@ -164,7 +164,7 @@ TerrainManager* TerrainManager::LoadAndPrepareTerrain(CacheEntry* entry) loading_window->SetProgress(27, _L("Initializing Light Subsystem")); terrn_mgr->initLight(); - if (App::gfx_sky_mode->GetEnum() != GfxSkyMode::CAELUM) //Caelum has its own fog management + if (App::gfx_sky_mode->getEnum() != GfxSkyMode::CAELUM) //Caelum has its own fog management { loading_window->SetProgress(29, _L("Initializing Fog Subsystem")); terrn_mgr->initFog(); @@ -223,8 +223,8 @@ TerrainManager* TerrainManager::LoadAndPrepareTerrain(CacheEntry* entry) LOG(" ===== TERRAIN LOADING DONE " + filename); - App::sim_terrain_name->SetStr(filename); - App::sim_terrain_gui_name->SetStr(terrn_mgr->m_def.name); + App::sim_terrain_name->setStr(filename); + App::sim_terrain_gui_name->setStr(terrn_mgr->m_def.name); return terrn_mgr.release(); } @@ -234,23 +234,23 @@ void TerrainManager::initCamera() App::GetCameraManager()->GetCamera()->getViewport()->setBackgroundColour(m_def.ambient_color); App::GetCameraManager()->GetCameraNode()->setPosition(m_def.start_position); - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::SKYX) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::SKYX) { m_sight_range = 5000; //Force unlimited for SkyX, lower settings are glitchy } else { - m_sight_range = App::gfx_sight_range->GetInt(); + m_sight_range = App::gfx_sight_range->getInt(); } - if (m_sight_range < UNLIMITED_SIGHTRANGE && App::gfx_sky_mode->GetEnum() != GfxSkyMode::SKYX) + if (m_sight_range < UNLIMITED_SIGHTRANGE && App::gfx_sky_mode->getEnum() != GfxSkyMode::SKYX) { App::GetCameraManager()->GetCamera()->setFarClipDistance(m_sight_range); } else { // disabled in global config - if (App::gfx_water_mode->GetEnum() != GfxWaterMode::HYDRAX) + if (App::gfx_water_mode->getEnum() != GfxWaterMode::HYDRAX) App::GetCameraManager()->GetCamera()->setFarClipDistance(0); //Unlimited else App::GetCameraManager()->GetCamera()->setFarClipDistance(9999 * 6); //Unlimited for hydrax and stuff @@ -261,7 +261,7 @@ void TerrainManager::initSkySubSystem() { #ifdef USE_CAELUM // Caelum skies - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::CAELUM) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::CAELUM) { m_sky_manager = new SkyManager(); @@ -280,7 +280,7 @@ void TerrainManager::initSkySubSystem() else #endif //USE_CAELUM // SkyX skies - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::SKYX) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::SKYX) { // try to load SkyX config if (!m_def.skyx_config.empty() && ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(m_def.skyx_config)) @@ -306,13 +306,13 @@ void TerrainManager::initSkySubSystem() void TerrainManager::initLight() { - if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::CAELUM) + if (App::gfx_sky_mode->getEnum() == GfxSkyMode::CAELUM) { #ifdef USE_CAELUM m_main_light = m_sky_manager->GetSkyMainLight(); #endif } - else if (App::gfx_sky_mode->GetEnum() == GfxSkyMode::SKYX) + else if (App::gfx_sky_mode->getEnum() == GfxSkyMode::SKYX) { m_main_light = SkyX_manager->getMainLight(); } @@ -344,7 +344,7 @@ void TerrainManager::initFog() void TerrainManager::initVegetation() { - switch (App::gfx_vegetation_mode->GetEnum()) + switch (App::gfx_vegetation_mode->getEnum()) { case GfxVegetation::x20PERC: m_paged_detail_factor = 0.2f; @@ -390,7 +390,7 @@ void TerrainManager::fixCompositorClearColor() void TerrainManager::initWater() { // disabled in global config - if (App::gfx_water_mode->GetEnum() == GfxWaterMode::NONE) + if (App::gfx_water_mode->getEnum() == GfxWaterMode::NONE) return; // disabled in map config @@ -399,7 +399,7 @@ void TerrainManager::initWater() return; } - if (App::gfx_water_mode->GetEnum() == GfxWaterMode::HYDRAX) + if (App::gfx_water_mode->getEnum() == GfxWaterMode::HYDRAX) { // try to load hydrax config if (!m_def.hydrax_conf_file.empty() && ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(m_def.hydrax_conf_file)) diff --git a/source/main/terrain/TerrainObjectManager.cpp b/source/main/terrain/TerrainObjectManager.cpp index 2012594e72..734636c16d 100644 --- a/source/main/terrain/TerrainObjectManager.cpp +++ b/source/main/terrain/TerrainObjectManager.cpp @@ -190,7 +190,7 @@ void TerrainObjectManager::LoadTObjFile(Ogre::String tobj_name) } // Section 'trees' - if (App::gfx_vegetation_mode->GetEnum() != GfxVegetation::NONE) + if (App::gfx_vegetation_mode->getEnum() != GfxVegetation::NONE) { for (TObjTree tree : tobj->trees) { @@ -204,7 +204,7 @@ void TerrainObjectManager::LoadTObjFile(Ogre::String tobj_name) } // Section 'grass' / 'grass2' - if (App::gfx_vegetation_mode->GetEnum() != GfxVegetation::NONE) + if (App::gfx_vegetation_mode->getEnum() != GfxVegetation::NONE) { for (TObjGrass grass : tobj->grass) { @@ -256,7 +256,7 @@ void TerrainObjectManager::LoadTObjFile(Ogre::String tobj_name) this->LoadTerrainObject(entry.odef_name, entry.position, entry.rotation, m_staticgeometry_bake_node, entry.instance_name, entry.type); } - if (App::diag_terrn_log_roads->GetBool()) + if (App::diag_terrn_log_roads->getBool()) { m_procedural_mgr->logDiagnostics(); } @@ -289,7 +289,7 @@ void TerrainObjectManager::ProcessTree( //densityMap->setMapBounds(TRect(0, 0, mapsizex, mapsizez)); PagedGeometry* geom = new PagedGeometry(); - geom->setTempDir(App::sys_cache_dir->GetStr() + PATH_SLASH); + geom->setTempDir(App::sys_cache_dir->getStr() + PATH_SLASH); geom->setCamera(App::GetCameraManager()->GetCamera()); geom->setPageSize(50); geom->setInfinite(); @@ -915,7 +915,7 @@ void TerrainObjectManager::LoadTelepoints() void TerrainObjectManager::LoadPredefinedActors() { // in netmode, don't load other actors! - if (RoR::App::mp_state->GetEnum() == RoR::MpState::CONNECTED) + if (RoR::App::mp_state->getEnum() == RoR::MpState::CONNECTED) { return; } @@ -952,7 +952,7 @@ void TerrainObjectManager::ProcessODefCollisionBoxes(StaticObject* obj, ODefFile bool race_event = !params.instance_name.compare(0, 10, "checkpoint") || !params.instance_name.compare(0, 4, "race"); - if (params.enable_collisions && (App::sim_races_enabled->GetBool() || !race_event)) + if (params.enable_collisions && (App::sim_races_enabled->getBool() || !race_event)) { // Validate AABB (minimum corners must be less or equal to maximum corners) if (cbox.aabb_min.x > cbox.aabb_max.x || cbox.aabb_min.y > cbox.aabb_max.y || cbox.aabb_min.z > cbox.aabb_max.z) diff --git a/source/main/threadpool/ThreadPool.h b/source/main/threadpool/ThreadPool.h index 96fbe54389..a98fb6cba9 100644 --- a/source/main/threadpool/ThreadPool.h +++ b/source/main/threadpool/ThreadPool.h @@ -109,11 +109,11 @@ class ThreadPool { // Create general-purpose thread pool int logical_cores = std::thread::hardware_concurrency(); - int num_threads = App::app_num_workers->GetInt(); + int num_threads = App::app_num_workers->getInt(); if (num_threads < 1 || num_threads > logical_cores) { num_threads = Ogre::Math::Clamp(logical_cores - 1, 1, 8); - App::app_num_workers->SetVal(num_threads); + App::app_num_workers->setVal(num_threads); } RoR::LogFormat("[RoR|ThreadPool] Found %d logical CPU cores, creating %d worker threads", diff --git a/source/main/utils/ConfigFile.cpp b/source/main/utils/ConfigFile.cpp index 2c31e7c32d..8b3278259f 100644 --- a/source/main/utils/ConfigFile.cpp +++ b/source/main/utils/ConfigFile.cpp @@ -34,7 +34,7 @@ using namespace RoR; -float ConfigFile::GetFloat(Ogre::String const& key, Ogre::String const& section, float defaultValue) +float ConfigFile::getFloat(Ogre::String const& key, Ogre::String const& section, float defaultValue) { return Ogre::StringConverter::parseReal(Ogre::ConfigFile::getSetting(key, section), defaultValue); } @@ -44,12 +44,12 @@ Ogre::ColourValue ConfigFile::GetColourValue(Ogre::String const& key, Ogre::Stri return Ogre::StringConverter::parseColourValue(Ogre::ConfigFile::getSetting(key, section), defaultValue); } -int ConfigFile::GetInt(Ogre::String const& key, Ogre::String const& section, int defaultValue) +int ConfigFile::getInt(Ogre::String const& key, Ogre::String const& section, int defaultValue) { return Ogre::StringConverter::parseInt(Ogre::ConfigFile::getSetting(key, section), defaultValue); } -bool ConfigFile::GetBool(Ogre::String const& key, Ogre::String const& section, bool defaultValue) +bool ConfigFile::getBool(Ogre::String const& key, Ogre::String const& section, bool defaultValue) { return Ogre::StringConverter::parseBool(Ogre::ConfigFile::getSetting(key, section), defaultValue); } diff --git a/source/main/utils/ConfigFile.h b/source/main/utils/ConfigFile.h index 1d2ca6efbe..9a805bc6e7 100644 --- a/source/main/utils/ConfigFile.h +++ b/source/main/utils/ConfigFile.h @@ -45,26 +45,26 @@ class ConfigFile: public Ogre::ConfigFile Ogre::ColourValue GetColourValue(Ogre::String const& key, Ogre::String const& section, Ogre::ColourValue const& defaultValue = Ogre::ColourValue()); - float GetFloat(Ogre::String const& key, float defaultValue = 0.f) + float getFloat(Ogre::String const& key, float defaultValue = 0.f) { - return this->GetFloat(key, Ogre::StringUtil::BLANK, defaultValue); + return this->getFloat(key, Ogre::StringUtil::BLANK, defaultValue); } - float GetFloat(Ogre::String const& key, Ogre::String const& section, float defaultValue = 0.f); + float getFloat(Ogre::String const& key, Ogre::String const& section, float defaultValue = 0.f); - bool GetBool(Ogre::String const& key, bool defaultValue = false) + bool getBool(Ogre::String const& key, bool defaultValue = false) { - return this->GetBool(key, Ogre::StringUtil::BLANK, defaultValue); + return this->getBool(key, Ogre::StringUtil::BLANK, defaultValue); } - bool GetBool(Ogre::String const& key, Ogre::String const& section, bool defaultValue = false); + bool getBool(Ogre::String const& key, Ogre::String const& section, bool defaultValue = false); - int GetInt(Ogre::String const& key, int defaultValue = 0) + int getInt(Ogre::String const& key, int defaultValue = 0) { - return this->GetInt(key, Ogre::StringUtil::BLANK, defaultValue); + return this->getInt(key, Ogre::StringUtil::BLANK, defaultValue); } - int GetInt(Ogre::String const& key, Ogre::String const& section, int defaultValue = 0); + int getInt(Ogre::String const& key, Ogre::String const& section, int defaultValue = 0); Ogre::String GetString(Ogre::String const& key, Ogre::String const& defaultValue = "") { diff --git a/source/main/utils/ForceFeedback.cpp b/source/main/utils/ForceFeedback.cpp index 2710fbef60..6e4e0e22ab 100644 --- a/source/main/utils/ForceFeedback.cpp +++ b/source/main/utils/ForceFeedback.cpp @@ -78,8 +78,8 @@ void ForceFeedback::SetForces(float roll, float pitch, float wspeed, float dirco OIS::ConstantEffect* hydroConstForce = dynamic_cast(m_hydro_effect->getForceEffect()); if (hydroConstForce != nullptr) { - float stress_gain = App::io_ffb_stress_gain->GetFloat(); - float centering_gain = App::io_ffb_center_gain->GetFloat(); + float stress_gain = App::io_ffb_stress_gain->getFloat(); + float centering_gain = App::io_ffb_center_gain->getFloat(); float ff = -stress * stress_gain + dircommand * 100.0 * centering_gain * wspeed * wspeed; if (ff > 10000) ff = 10000; @@ -96,7 +96,7 @@ void ForceFeedback::SetEnabled(bool b) if (b != m_enabled) { - float gain = (b) ? App::io_ffb_master_gain->GetFloat() : 0.f; + float gain = (b) ? App::io_ffb_master_gain->getFloat() : 0.f; m_device->setMasterGain(gain); } m_enabled = b; @@ -108,7 +108,7 @@ void ForceFeedback::Update() { App::GetConsole()->putMessage(Console::CONSOLE_MSGTYPE_INFO, Console::CONSOLE_SYSTEM_WARNING, _L("Disabling force feedback - no controller found")); - App::io_ffb_enabled->SetVal(false); + App::io_ffb_enabled->setVal(false); return; } diff --git a/source/main/utils/InputEngine.cpp b/source/main/utils/InputEngine.cpp index 2e35b7ac9b..ca9e3da5af 100644 --- a/source/main/utils/InputEngine.cpp +++ b/source/main/utils/InputEngine.cpp @@ -464,7 +464,7 @@ bool InputEngine::setup() ParamList pl; pl.insert(OIS::ParamList::value_type("WINDOW", TOSTRING(hWnd))); - if (App::io_input_grab_mode->GetEnum() != RoR::IoInputGrabMode::ALL) + if (App::io_input_grab_mode->getEnum() != RoR::IoInputGrabMode::ALL) { #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX pl.insert(OIS::ParamList::value_type("x11_mouse_hide", "true")); @@ -480,7 +480,7 @@ bool InputEngine::setup() } #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 - if (App::io_input_grab_mode->GetEnum() != IoInputGrabMode::ALL) + if (App::io_input_grab_mode->getEnum() != IoInputGrabMode::ALL) { ShowCursor(FALSE); } diff --git a/source/main/utils/Language.cpp b/source/main/utils/Language.cpp index b53ba664b6..efdb087934 100644 --- a/source/main/utils/Language.cpp +++ b/source/main/utils/Language.cpp @@ -52,7 +52,7 @@ void LanguageEngine::setup() languages = { {"English", "en"} }; auto& moFileReader = moFileLib::moFileReaderSingleton::GetInstance(); - String base_path = PathCombine(App::sys_process_dir->GetStr(), "languages"); + String base_path = PathCombine(App::sys_process_dir->getStr(), "languages"); ResourceGroupManager::getSingleton().addResourceLocation(base_path, "FileSystem", "LngRG"); FileInfoListPtr fl = ResourceGroupManager::getSingleton().findResourceFileInfo("LngRG", "*", true); if (!fl->empty()) @@ -72,13 +72,13 @@ void LanguageEngine::setup() } ResourceGroupManager::getSingleton().destroyResourceGroup("LngRG"); - String locale_path = PathCombine(base_path, App::app_language->GetStr().substr(0, 2)); + String locale_path = PathCombine(base_path, App::app_language->getStr().substr(0, 2)); String mo_path = PathCombine(locale_path, "ror.mo"); if (moFileReader.ReadFile(mo_path.c_str()) == moFileLib::moFileReader::EC_SUCCESS) { String info = moFileLib::moFileReaderSingleton::GetInstance().Lookup(""); - App::app_language->SetStr(extractLang(info).second); + App::app_language->setStr(extractLang(info).second); RoR::LogFormat("[RoR|App] Loading language file '%s'", mo_path.c_str()); } else From 029b1e6e71f9f5889ee98b27435c5f42d1f33709 Mon Sep 17 00:00:00 2001 From: Petr Ohlidal Date: Wed, 1 Sep 2021 08:51:44 +0200 Subject: [PATCH 3/4] :scroll: Scripting: added Console + CVars --- source/main/scripting/ScriptEngine.cpp | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/source/main/scripting/ScriptEngine.cpp b/source/main/scripting/ScriptEngine.cpp index 8a90c581a6..6d141e9306 100644 --- a/source/main/scripting/ScriptEngine.cpp +++ b/source/main/scripting/ScriptEngine.cpp @@ -178,6 +178,32 @@ void ScriptEngine::init() // Register everything + + // class CVar + result = engine->RegisterObjectType("CVarClass", sizeof(Console), AngelScript::asOBJ_REF | AngelScript::asOBJ_NOCOUNT); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("CVarClass", "const string& getName()", AngelScript::asMETHOD(CVar,getName), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("CVarClass", "const string& getStr()", AngelScript::asMETHOD(CVar,getStr), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("CVarClass", "int getInt()", AngelScript::asMETHOD(CVar,getInt), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("CVarClass", "float getFloat()", AngelScript::asMETHOD(CVar,getFloat), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("CVarClass", "bool getBool()", AngelScript::asMETHOD(CVar,getBool), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + + // enum CVarFlags + result = engine->RegisterEnum("CVarFlags"); ROR_ASSERT(result >= 0); + result = engine->RegisterEnumValue("CVarFlags", "CVAR_TYPE_BOOL", CVAR_TYPE_BOOL); ROR_ASSERT(result >= 0); + result = engine->RegisterEnumValue("CVarFlags", "CVAR_TYPE_INT", CVAR_TYPE_INT); ROR_ASSERT(result >= 0); + result = engine->RegisterEnumValue("CVarFlags", "CVAR_TYPE_FLOAT", CVAR_TYPE_FLOAT); ROR_ASSERT(result >= 0); + result = engine->RegisterEnumValue("CVarFlags", "CVAR_ARCHIVE", CVAR_ARCHIVE); ROR_ASSERT(result >= 0); + result = engine->RegisterEnumValue("CVarFlags", "CVAR_NO_LOG", CVAR_NO_LOG); ROR_ASSERT(result >= 0); + + // class Console + result = engine->RegisterObjectType("ConsoleClass", sizeof(Console), AngelScript::asOBJ_REF | AngelScript::asOBJ_NOCOUNT); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("ConsoleClass", "CVarClass @cVarCreate(const string &in, const string &in, int, const string &in)", AngelScript::asMETHOD(Console,cVarCreate), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("ConsoleClass", "CVarClass @cVarFind(const string &in)", AngelScript::asMETHOD(Console,cVarFind), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("ConsoleClass", "CVarClass @cVarGet(const string &in, int)", AngelScript::asMETHOD(Console,cVarGet), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("ConsoleClass", "CVarClass @cVarSet(const string &in, const string &in)", AngelScript::asMETHOD(Console,cVarSet), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + result = engine->RegisterObjectMethod("ConsoleClass", "void cVarAssign(CVarClass@, const string &in)", AngelScript::asMETHOD(Console,cVarAssign), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); + + // class Actor (historically Beam) result = engine->RegisterObjectType("BeamClass", sizeof(Actor), AngelScript::asOBJ_REF); ROR_ASSERT(result>=0); result = engine->RegisterObjectMethod("BeamClass", "void scaleTruck(float)", AngelScript::asMETHOD(Actor,scaleTruck), AngelScript::asCALL_THISCALL); ROR_ASSERT(result>=0); @@ -366,6 +392,7 @@ void ScriptEngine::init() // now the global instances result = engine->RegisterGlobalProperty("GameScriptClass game", &m_game_script); ROR_ASSERT(result>=0); + result = engine->RegisterGlobalProperty("ConsoleClass console", App::GetConsole()); ROR_ASSERT(result>=0); SLOG("Type registrations done. If you see no error above everything should be working"); From 9b88295f69d1e5b50eb81229477a56fe212c5b51 Mon Sep 17 00:00:00 2001 From: Petr Ohlidal Date: Wed, 1 Sep 2021 10:08:55 +0200 Subject: [PATCH 4/4] :books: Added scripting doc for console + cvars --- doc/angelscript/CVarClass.h | 34 ++++++++++++++++++++++++++++++++ doc/angelscript/ConsoleClass.h | 35 +++++++++++++++++++++++++++++++++ doc/angelscript/SettingsClass.h | 24 ---------------------- 3 files changed, 69 insertions(+), 24 deletions(-) create mode 100644 doc/angelscript/CVarClass.h create mode 100644 doc/angelscript/ConsoleClass.h delete mode 100644 doc/angelscript/SettingsClass.h diff --git a/doc/angelscript/CVarClass.h b/doc/angelscript/CVarClass.h new file mode 100644 index 0000000000..88cec7eb47 --- /dev/null +++ b/doc/angelscript/CVarClass.h @@ -0,0 +1,34 @@ + +/** + * @brief Types and special attributes of cvars. + * @note Default cvar type is string - To create a string cvar, enter '0' as flags. + */ +enum CVarFlags +{ + CVAR_TYPE_BOOL = BITMASK(1), + CVAR_TYPE_INT = BITMASK(2), + CVAR_TYPE_FLOAT = BITMASK(3), + CVAR_ARCHIVE = BITMASK(4), //!< Will be written to RoR.cfg + CVAR_NO_LOG = BITMASK(5) //!< Will not be written to RoR.log +}; + +/** + * @brief A console variable, usually defined in RoR.cfg but also created by users or scripts. + */ +class CVarClass +{ +public: + + /** + * @brief Get the value converted to string, works with any CVAR_TYPE. + */ + std::string const& getStr() const { return m_value_str; } + + float getFloat() const { return m_value_num; } + + int getInt() const { return (int)m_value_num; } + + bool getBool() const { return (bool)m_value_num; } + + std::string const& getName() const { return m_name; } +}; diff --git a/doc/angelscript/ConsoleClass.h b/doc/angelscript/ConsoleClass.h new file mode 100644 index 0000000000..f52bbe754f --- /dev/null +++ b/doc/angelscript/ConsoleClass.h @@ -0,0 +1,35 @@ + + +/** + * @brief A class that gives you access to console variables (cvars), usually defined in RoR.cfg file. + * @note This object is created automatically as global variable `console`. + */ +class ConsoleClass +{ +public: + /** + * @brief Add CVar and parse default value if specified + */ + CVar* cVarCreate(std::string const& name, std::string const& long_name, + int flags, std::string const& val = std::string()); + + /** + * Parse value by cvar type + */ + void cVarAssign(CVar* cvar, std::string const& value); + + /** + * Find cvar by short/long name + */ + CVar* cVarFind(std::string const& input_name); + + /** + * Set existing cvar by short/long name. Return the modified cvar (or NULL if not found) + */ + CVar* cVarSet(std::string const& input_name, std::string const& input_val); + + /** + * Get cvar by short/long name, or create new one using input as short name. + */ + CVar* cVarGet(std::string const& input_name, int flags); +}; diff --git a/doc/angelscript/SettingsClass.h b/doc/angelscript/SettingsClass.h deleted file mode 100644 index 4327fac3f7..0000000000 --- a/doc/angelscript/SettingsClass.h +++ /dev/null @@ -1,24 +0,0 @@ - - -/** - * @brief A class that gives you access to the RoR.cfg file. - * @note The settings object is already created for you, you don't need to create it yourself. - * E.g.: you can get a setting using settings.getSetting("Nickname"); - */ -class SettingsClass -{ -public: - /** - * Gets a setting from the RoR.cfg file. - * @param key the name of the setting - * @return The current value of the setting - */ - string getSetting(string key); - - /** - * Sets a setting in the RoR.cfg file. - * @param key the name of the setting - * @param value The new value for the setting - */ - void setSetting(string key, string value); -};