From 341ee49b23a4f5c3dd47ce77d4ce0c346d93360d Mon Sep 17 00:00:00 2001 From: Edo Date: Mon, 16 Jan 2023 23:32:00 +0000 Subject: [PATCH] [ScriptError]: Use dvar in runtime error internal (#723) --- src/Components/Modules/Elevators.cpp | 4 ++-- src/Components/Modules/Friends.cpp | 3 +-- src/Components/Modules/GSC/ScriptError.cpp | 6 +++--- src/Components/Modules/Gamepad.cpp | 2 ++ src/Components/Modules/Playlist.cpp | 2 +- src/Components/Modules/QuickPatch.cpp | 2 +- src/Components/Modules/Theatre.cpp | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Components/Modules/Elevators.cpp b/src/Components/Modules/Elevators.cpp index 5c4d80da..b6998111 100644 --- a/src/Components/Modules/Elevators.cpp +++ b/src/Components/Modules/Elevators.cpp @@ -7,8 +7,8 @@ namespace Components int Elevators::PM_CorrectAllSolid(Game::pmove_s* pm, Game::pml_t* pml, Game::trace_t* trace) { - assert(pm != nullptr); - assert(pm->ps != nullptr); + assert(pm); + assert(pm->ps); Game::vec3_t point; auto* ps = pm->ps; diff --git a/src/Components/Modules/Friends.cpp b/src/Components/Modules/Friends.cpp index d888275b..b222ef40 100644 --- a/src/Components/Modules/Friends.cpp +++ b/src/Components/Modules/Friends.cpp @@ -563,8 +563,7 @@ namespace Components { Friends::LoggedOn = false; - if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) - return; + if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) return; Friends::UIStreamFriendly = Dvar::Register("ui_streamFriendly", false, Game::DVAR_ARCHIVE, "Stream friendly UI"); Friends::CLAnonymous = Dvar::Register("cl_anonymous", false, Game::DVAR_ARCHIVE, "Enable invisible mode for Steam"); diff --git a/src/Components/Modules/GSC/ScriptError.cpp b/src/Components/Modules/GSC/ScriptError.cpp index 381737aa..4faafb72 100644 --- a/src/Components/Modules/GSC/ScriptError.cpp +++ b/src/Components/Modules/GSC/ScriptError.cpp @@ -403,7 +403,7 @@ namespace Components if (!developer_) { assert(Scr_IsInOpcodeMemory(codePos)); - if (!Game::scrVmPub->terminal_error) + if (!(*Game::com_developer)->current.enabled) { return; } @@ -845,10 +845,10 @@ namespace Components return filePosId; } - void ScriptError::Scr_Settings_Hk(int developer, int developer_script, int abort_on_error) + void ScriptError::Scr_Settings_Hk([[maybe_unused]] int developer, int developer_script, int abort_on_error) { assert(!abort_on_error || developer); - developer_ = developer != 0; + developer_ = (*Game::com_developer)->current.enabled; Game::scrVarPub->developer_script = developer_script != 0; Game::scrVmPub->abort_on_error = abort_on_error != 0; } diff --git a/src/Components/Modules/Gamepad.cpp b/src/Components/Modules/Gamepad.cpp index edb34245..7a2dcb71 100644 --- a/src/Components/Modules/Gamepad.cpp +++ b/src/Components/Modules/Gamepad.cpp @@ -1993,7 +1993,9 @@ namespace Components Command::Add("togglescores", Scores_Toggle_f); if (Dedicated::IsEnabled()) + { return; + } // Gamepad on frame hook Utils::Hook(0x475E9E, IN_Frame_Hk, HOOK_CALL).install()->quick(); diff --git a/src/Components/Modules/Playlist.cpp b/src/Components/Modules/Playlist.cpp index 6e3bc714..6acb85d5 100644 --- a/src/Components/Modules/Playlist.cpp +++ b/src/Components/Modules/Playlist.cpp @@ -18,7 +18,7 @@ namespace Components if (*Game::s_havePlaylists) return; // Don't load playlists when dedi and no party - if (Dedicated::IsEnabled() && !Dvar::Var("party_enable").get()) + if (Dedicated::IsEnabled() && !Party::IsEnabled()) { *Game::s_havePlaylists = true; Dvar::Var("xblive_privateserver").set(true); diff --git a/src/Components/Modules/QuickPatch.cpp b/src/Components/Modules/QuickPatch.cpp index b07c53bb..80745e74 100644 --- a/src/Components/Modules/QuickPatch.cpp +++ b/src/Components/Modules/QuickPatch.cpp @@ -429,7 +429,7 @@ namespace Components // vid_restart when ingame Utils::Hook::Nop(0x4CA1FA, 6); - // Filter log (initially com_logFilter, but I don't see why that dvar is needed) + // Filter log (initially com_logFilter, but I don't see why that dvar print is needed) // Seems like it's needed for B3, so there is a separate handling for dedicated servers in Dedicated.cpp if (!Dedicated::IsEnabled()) { diff --git a/src/Components/Modules/Theatre.cpp b/src/Components/Modules/Theatre.cpp index 491fd1d5..0a27c9f9 100644 --- a/src/Components/Modules/Theatre.cpp +++ b/src/Components/Modules/Theatre.cpp @@ -422,7 +422,7 @@ namespace Components // Feeder UIFeeder::Add(10.0f, GetDemoCount, GetDemoText, SelectDemo); - // set the configstrings stuff to load the default (empty) string table; this should allow demo recording on all gametypes/maps + // Set the configstrings stuff to load the default (empty) string table; this should allow demo recording on all gametypes/maps if (!Dedicated::IsEnabled()) Utils::Hook::Set(0x47440B, "mp/defaultStringTable.csv"); // Change font size