From 9d3def4851e0298782f4d43d0ae0322ec73807e8 Mon Sep 17 00:00:00 2001 From: holysnipz <9103583+holysnipz@users.noreply.github.com> Date: Fri, 16 Feb 2024 01:28:05 +0700 Subject: [PATCH 1/6] ChaosMod: Increase vehicle wheel types to 12 where applicable (#3652) And added "random Wheel types" to Vehicle Rain effect as well Only tested in 3095. but should be fine with all versions, since GTA will default to Sport(0) if `WheelType` is *invalid* anyway. *example: trying to apply Track(12) type in pre Tuners update* --- ChaosMod/Effects/db/Misc/MiscVehicleRain.cpp | 3 +++ ChaosMod/Effects/db/Vehs/VehsSpawner.cpp | 2 +- ChaosMod/Effects/db/Vehs/VehsUpgradeController.cpp | 2 +- ChaosMod/Util/Vehicle.h | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChaosMod/Effects/db/Misc/MiscVehicleRain.cpp b/ChaosMod/Effects/db/Misc/MiscVehicleRain.cpp index b0d209b80..6e01dd7c6 100644 --- a/ChaosMod/Effects/db/Misc/MiscVehicleRain.cpp +++ b/ChaosMod/Effects/db/Misc/MiscVehicleRain.cpp @@ -31,6 +31,9 @@ static void OnTick() // Also apply random upgrades SET_VEHICLE_MOD_KIT(veh, 0); + + SET_VEHICLE_WHEEL_TYPE(veh, g_Random.GetRandomInt(0, 12)); + for (int i = 0; i < 50; i++) { int max = GET_NUM_VEHICLE_MODS(veh, i); diff --git a/ChaosMod/Effects/db/Vehs/VehsSpawner.cpp b/ChaosMod/Effects/db/Vehs/VehsSpawner.cpp index 9d8d52d14..77db19ce8 100644 --- a/ChaosMod/Effects/db/Vehs/VehsSpawner.cpp +++ b/ChaosMod/Effects/db/Vehs/VehsSpawner.cpp @@ -227,7 +227,7 @@ static void OnStartRandom() // Also apply random upgrades SET_VEHICLE_MOD_KIT(veh, 0); - SET_VEHICLE_WHEEL_TYPE(veh, g_Random.GetRandomInt(0, 7)); + SET_VEHICLE_WHEEL_TYPE(veh, g_Random.GetRandomInt(0, 12)); for (int i = 0; i < 50; i++) { diff --git a/ChaosMod/Effects/db/Vehs/VehsUpgradeController.cpp b/ChaosMod/Effects/db/Vehs/VehsUpgradeController.cpp index 5f5ae7015..b65e264a3 100644 --- a/ChaosMod/Effects/db/Vehs/VehsUpgradeController.cpp +++ b/ChaosMod/Effects/db/Vehs/VehsUpgradeController.cpp @@ -52,7 +52,7 @@ static void OnStartRandomUpgrades() { SET_VEHICLE_MOD_KIT(veh, 0); - SET_VEHICLE_WHEEL_TYPE(veh, g_Random.GetRandomInt(0, 7)); + SET_VEHICLE_WHEEL_TYPE(veh, g_Random.GetRandomInt(0, 12)); for (int i = 0; i < 50; i++) { diff --git a/ChaosMod/Util/Vehicle.h b/ChaosMod/Util/Vehicle.h index c58c1df38..12fd46f14 100644 --- a/ChaosMod/Util/Vehicle.h +++ b/ChaosMod/Util/Vehicle.h @@ -170,7 +170,7 @@ inline Vehicle CreateRandomVehicleWithPeds(Vehicle oldHandle, const std::vector< // Also apply random upgrades SET_VEHICLE_MOD_KIT(newVehicle, 0); - SET_VEHICLE_WHEEL_TYPE(newVehicle, g_Random.GetRandomInt(0, 7)); + SET_VEHICLE_WHEEL_TYPE(newVehicle, g_Random.GetRandomInt(0, 12)); for (int i = 0; i < 50; i++) { From 9101375d7dd606b56ded8c69e4507189066c7cce Mon Sep 17 00:00:00 2001 From: pongo1231 Date: Thu, 15 Feb 2024 18:42:19 +0000 Subject: [PATCH 2/6] ChaosMod: Move all remaining effect timer logic from EffectDispatcher to EffectDispatchTimer Only the meta effect timer logic remains in EffectDispatcher --- ChaosMod/Components/EffectDispatchTimer.cpp | 3 ++- ChaosMod/Components/EffectDispatchTimer.h | 1 + ChaosMod/Components/EffectDispatcher.cpp | 5 ++--- ChaosMod/Components/EffectDispatcher.h | 2 -- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ChaosMod/Components/EffectDispatchTimer.cpp b/ChaosMod/Components/EffectDispatchTimer.cpp index 37db56d68..f4b77ab08 100644 --- a/ChaosMod/Components/EffectDispatchTimer.cpp +++ b/ChaosMod/Components/EffectDispatchTimer.cpp @@ -10,6 +10,7 @@ EffectDispatchTimer::EffectDispatchTimer(const std::array &timerColor) { m_TimerColor = timerColor; + m_DrawTimerBar = !g_OptionsManager.GetConfigValue({ "DisableTimerBarDraw" }, OPTION_DEFAULT_NO_EFFECT_BAR); m_EffectSpawnTime = g_OptionsManager.GetConfigValue({ "NewEffectSpawnTime" }, OPTION_DEFAULT_EFFECT_SPAWN_TIME); m_DistanceChaosState.EnableDistanceBasedEffectDispatch = g_OptionsManager.GetConfigValue( @@ -174,7 +175,7 @@ void EffectDispatchTimer::ResetFakeTimerPercentage() void EffectDispatchTimer::OnRun() { - if (!m_EnableTimer + if (!m_EnableTimer || !m_DrawTimerBar || (ComponentExists() && (GetComponent()->HideChaosUI || GetComponent()->DisableChaos))) { diff --git a/ChaosMod/Components/EffectDispatchTimer.h b/ChaosMod/Components/EffectDispatchTimer.h index 081e75233..9c19f4cdd 100644 --- a/ChaosMod/Components/EffectDispatchTimer.h +++ b/ChaosMod/Components/EffectDispatchTimer.h @@ -8,6 +8,7 @@ class EffectDispatchTimer : public Component bool m_EnableTimer = true; bool m_PauseTimer = false; bool m_DispatchEffectsOnTimer = true; + bool m_DrawTimerBar = true; std::uint16_t m_EffectSpawnTime = 0; std::array m_TimerColor; float m_TimerPercentage = 0.f; diff --git a/ChaosMod/Components/EffectDispatcher.cpp b/ChaosMod/Components/EffectDispatcher.cpp index 3884938a0..a3b59f507 100644 --- a/ChaosMod/Components/EffectDispatcher.cpp +++ b/ChaosMod/Components/EffectDispatcher.cpp @@ -220,10 +220,9 @@ static void _OnRunEffects(LPVOID data) EffectDispatcher::EffectDispatcher(const std::array &textColor, const std::array &effectTimerColor) : Component() { - m_TextColor = textColor; - m_EffectTimerColor = effectTimerColor; + m_TextColor = textColor; + m_EffectTimerColor = effectTimerColor; - m_DisableDrawTimerBar = g_OptionsManager.GetConfigValue({ "DisableTimerBarDraw" }, OPTION_DEFAULT_NO_EFFECT_BAR); m_DisableDrawEffectTexts = g_OptionsManager.GetConfigValue({ "DisableEffectTextDraw" }, OPTION_DEFAULT_NO_TEXT_DRAW); diff --git a/ChaosMod/Components/EffectDispatcher.h b/ChaosMod/Components/EffectDispatcher.h index 23237ed2d..888ed17d2 100644 --- a/ChaosMod/Components/EffectDispatcher.h +++ b/ChaosMod/Components/EffectDispatcher.h @@ -105,7 +105,6 @@ class EffectDispatcher : public Component std::array m_TextColor; std::array m_EffectTimerColor; - bool m_DisableDrawTimerBar = false; bool m_DisableDrawEffectTexts = false; bool m_EnableNormalEffectDispatch = false; @@ -134,7 +133,6 @@ class EffectDispatcher : public Component void DispatchRandomEffect(DispatchEffectFlags dispatchEffectFlags = DispatchEffectFlag_None, const std::string &suffix = {}); - void UpdateTimer(int deltaTime); void UpdateEffects(int deltaTime); void UpdateMetaEffects(int deltaTime); From 4d93e02674e2c904dc8acd56ae1ac39f1fccf4a3 Mon Sep 17 00:00:00 2001 From: pongo1231 Date: Fri, 16 Feb 2024 23:09:14 +0000 Subject: [PATCH 3/6] ChaosMod/EffectDispatcher: Play custom sounds if MetaModifiers component doesn't exist --- ChaosMod/Components/EffectDispatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChaosMod/Components/EffectDispatcher.cpp b/ChaosMod/Components/EffectDispatcher.cpp index a3b59f507..ce3f7b201 100644 --- a/ChaosMod/Components/EffectDispatcher.cpp +++ b/ChaosMod/Components/EffectDispatcher.cpp @@ -61,7 +61,7 @@ static void _DispatchEffect(EffectDispatcher *effectDispatcher, const EffectDisp auto playEffectDispatchSound = [&]() { - if ((ComponentExists() && !GetComponent()->HideChaosUI) + if ((!ComponentExists() || GetComponent()->HideChaosUI) && ComponentExists()) { // Play global sound (if one exists) From 197f859c83df5fa98948576308ce19288d94e250 Mon Sep 17 00:00:00 2001 From: pongo1231 Date: Fri, 16 Feb 2024 23:30:45 +0000 Subject: [PATCH 4/6] ChaosMod/EffectIdentifier: Get rid of overloaded != operator This is not necessary anymore --- ChaosMod/Effects/EffectIdentifier.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ChaosMod/Effects/EffectIdentifier.h b/ChaosMod/Effects/EffectIdentifier.h index 7d24598a1..2992f60e2 100644 --- a/ChaosMod/Effects/EffectIdentifier.h +++ b/ChaosMod/Effects/EffectIdentifier.h @@ -22,11 +22,6 @@ class EffectIdentifier return m_EffectId == other.GetEffectId(); } - inline bool operator!=(const EffectIdentifier &other) const - { - return !(*this == other); - } - inline bool IsScript() const { return m_IsScript; From ad9bc47550388ec849e1aa10b68d7fd38e1a4244 Mon Sep 17 00:00:00 2001 From: pongo1231 Date: Fri, 16 Feb 2024 23:36:53 +0000 Subject: [PATCH 5/6] ChaosMod: Use DoesFeatureFlagExist helper function --- ChaosMod/Components/Voting.cpp | 2 +- ChaosMod/Effects/Effect.h | 2 +- ChaosMod/Main.cpp | 8 ++++---- ChaosMod/Memory/Memory.cpp | 6 +++--- ChaosMod/Util/CrashHandler.h | 4 ++-- ChaosMod/Util/File.h | 5 +++++ 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ChaosMod/Components/Voting.cpp b/ChaosMod/Components/Voting.cpp index 54fcdcfb2..861287ed2 100644 --- a/ChaosMod/Components/Voting.cpp +++ b/ChaosMod/Components/Voting.cpp @@ -369,7 +369,7 @@ bool Voting::Init() auto str = _wcsdup(VOTING_PROXY_START_ARGS); #ifdef _DEBUG DWORD attributes = NULL; - if (DoesFileExist("chaosmod\\.forcenovotingconsole")) + if (DoesFeatureFlagExist("forcenovotingconsole")) { attributes = CREATE_NO_WINDOW; } diff --git a/ChaosMod/Effects/Effect.h b/ChaosMod/Effects/Effect.h index bf70c9394..8c49129cc 100644 --- a/ChaosMod/Effects/Effect.h +++ b/ChaosMod/Effects/Effect.h @@ -144,7 +144,7 @@ class RegisterEffect { static bool disableEffectRegistration = []() { - return DoesFileExist("chaosmod\\.disablebuiltineffects"); + return DoesFeatureFlagExist("disablebuiltineffects"); }(); if (disableEffectRegistration) diff --git a/ChaosMod/Main.cpp b/ChaosMod/Main.cpp index 953220f30..74f35ea65 100644 --- a/ChaosMod/Main.cpp +++ b/ChaosMod/Main.cpp @@ -80,7 +80,7 @@ static void Init() }(); static std::streambuf *oldStreamBuf; - if (DoesFileExist("chaosmod\\.enableconsole")) + if (DoesFeatureFlagExist("enableconsole")) { if (GetConsoleWindow()) { @@ -147,7 +147,7 @@ static void Init() g_Random.SetSeed(g_OptionsManager.GetConfigValue({ "Seed" }, 0)); std::set blacklistedComponentNames; - if (DoesFileExist("chaosmod\\.blacklistedcomponents")) + if (DoesFeatureFlagExist("blacklistedcomponents")) { std::ifstream file("chaosmod\\.blacklistedcomponents"); if (!file.fail()) @@ -200,7 +200,7 @@ static void Init() INIT_COMPONENT("HelpTextQueue", "script help text queue", HelpTextQueue); #ifdef WITH_DEBUG_PANEL_SUPPORT - if (DoesFileExist("chaosmod\\.enabledebugsocket")) + if (DoesFeatureFlagExist("enabledebugsocket")) { INIT_COMPONENT("DebugSocket", "Debug Websocket", DebugSocket); } @@ -276,7 +276,7 @@ static void MainRun() { isDisabled = false; - if (DoesFileExist("chaosmod\\.clearlogfileonreset")) + if (DoesFeatureFlagExist("clearlogfileonreset")) { // Clear log g_Log = std::ofstream(CHAOS_LOG_FILE); diff --git a/ChaosMod/Memory/Memory.cpp b/ChaosMod/Memory/Memory.cpp index 05f895550..6e7aa3e48 100644 --- a/ChaosMod/Memory/Memory.cpp +++ b/ChaosMod/Memory/Memory.cpp @@ -26,7 +26,7 @@ namespace Memory MH_Initialize(); - if (DoesFileExist("chaosmod\\.skipintro")) + if (DoesFeatureFlagExist("skipintro")) { // Splash screen Handle handle = FindPattern("E8 ? ? ? ? 8B CF 40 88 2D"); @@ -58,7 +58,7 @@ namespace Memory } } - if (DoesFileExist("chaosmod\\.skipdlcs")) + if (DoesFeatureFlagExist("skipdlcs")) { Handle handle = FindPattern("84 C0 74 2C 48 8D 15 ? ? ? ? 48 8D 0D ? ? ? ? 45 33 C9 41 B0 01"); if (!handle.IsValid()) @@ -73,7 +73,7 @@ namespace Memory } } - if (DoesFileExist("chaosmod\\.blacklistedhooks")) + if (DoesFeatureFlagExist("blacklistedhooks")) { std::ifstream file("chaosmod\\.blacklistedhooks"); if (!file.fail()) diff --git a/ChaosMod/Util/CrashHandler.h b/ChaosMod/Util/CrashHandler.h index b2d43a544..89a9f1c09 100644 --- a/ChaosMod/Util/CrashHandler.h +++ b/ChaosMod/Util/CrashHandler.h @@ -11,7 +11,7 @@ inline LONG WINAPI CrashHandler(_EXCEPTION_POINTERS *exceptionInfo) { - if (DoesFileExist("chaosmod\\.nodumps")) + if (DoesFeatureFlagExist("nodumps")) { return EXCEPTION_CONTINUE_SEARCH; } @@ -37,7 +37,7 @@ inline LONG WINAPI CrashHandler(_EXCEPTION_POINTERS *exceptionInfo) DWORD flags = MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory; - if (DoesFileExist("chaosmod\\.fulldumps")) + if (DoesFeatureFlagExist("fulldumps")) { flags = MiniDumpWithFullMemory | MiniDumpWithHandleData | MiniDumpWithUnloadedModules | MiniDumpWithProcessThreadData | MiniDumpWithFullMemoryInfo | MiniDumpWithThreadInfo; diff --git a/ChaosMod/Util/File.h b/ChaosMod/Util/File.h index 619e6eafd..f9c830398 100644 --- a/ChaosMod/Util/File.h +++ b/ChaosMod/Util/File.h @@ -14,6 +14,11 @@ inline bool DoesFileExist(std::string_view fileName) return stat(fileName.data(), &temp) == 0; } +inline bool DoesFeatureFlagExist(const std::string &featureFlagName) +{ + return DoesFileExist("chaosmod\\." + featureFlagName); +} + inline std::vector GetFiles(std::string path, std::string extension, bool recursive, std::vector blacklistedFiles = {}) { From 2a1a3a8160e134d0f00d78d184e0a7f5ea3091d7 Mon Sep 17 00:00:00 2001 From: pongo1231 Date: Fri, 16 Feb 2024 23:50:06 +0000 Subject: [PATCH 6/6] ChaosMod: Add second instance of Random Used for purposes outside of non-voting effect weighting and effect logic --- ChaosMod/Components/DebugSocket.cpp | 2 +- ChaosMod/Components/Mp3Manager.cpp | 2 +- ChaosMod/Components/Voting.cpp | 2 +- ChaosMod/Main.cpp | 1 + ChaosMod/Util/Color.h | 16 ++++++++-------- ChaosMod/Util/PoolSpawner.cpp | 14 +++++++------- ChaosMod/Util/Random.h | 1 + ChaosMod/Util/Vehicle.h | 27 ++++++++++++++------------- 8 files changed, 34 insertions(+), 31 deletions(-) diff --git a/ChaosMod/Components/DebugSocket.cpp b/ChaosMod/Components/DebugSocket.cpp index 1cbc20063..96427047b 100644 --- a/ChaosMod/Components/DebugSocket.cpp +++ b/ChaosMod/Components/DebugSocket.cpp @@ -99,7 +99,7 @@ static void OnExecScript(DebugSocket *debugSocket, std::shared_ptr 1 ? cachedSoundFiles[g_Random.GetRandomInt(0, size - 1)] : cachedSoundFiles[0]; + auto chosenSound = size > 1 ? cachedSoundFiles[g_RandomNoDeterm.GetRandomInt(0, size - 1)] : cachedSoundFiles[0]; int error; { diff --git a/ChaosMod/Components/Voting.cpp b/ChaosMod/Components/Voting.cpp index 861287ed2..8d4aba2ed 100644 --- a/ChaosMod/Components/Voting.cpp +++ b/ChaosMod/Components/Voting.cpp @@ -227,7 +227,7 @@ void Voting::OnRun() totalWeight += effectData.GetEffectWeight(); } - float chosen = g_Random.GetRandomFloat(0.f, totalWeight); + float chosen = g_RandomNoDeterm.GetRandomFloat(0.f, totalWeight); totalWeight = 0.f; diff --git a/ChaosMod/Main.cpp b/ChaosMod/Main.cpp index 74f35ea65..b64eb44e9 100644 --- a/ChaosMod/Main.cpp +++ b/ChaosMod/Main.cpp @@ -145,6 +145,7 @@ static void Init() g_OptionsManager.GetConfigValue({ "EffectTimedTimerColor" }, OPTION_DEFAULT_TIMED_COLOR)); g_Random.SetSeed(g_OptionsManager.GetConfigValue({ "Seed" }, 0)); + g_RandomNoDeterm.SetSeed(GetTickCount64()); std::set blacklistedComponentNames; if (DoesFeatureFlagExist("blacklistedcomponents")) diff --git a/ChaosMod/Util/Color.h b/ChaosMod/Util/Color.h index 33796fe34..f5f62ff8b 100644 --- a/ChaosMod/Util/Color.h +++ b/ChaosMod/Util/Color.h @@ -16,10 +16,10 @@ struct Color inline Color GetRandomColorRGB(std::uint8_t min = 0, std::uint8_t max = 255) { return { - (std::uint8_t)g_Random.GetRandomInt(min, max), // R - (std::uint8_t)g_Random.GetRandomInt(min, max), // G - (std::uint8_t)g_Random.GetRandomInt(min, max), // B - 255 // A + (std::uint8_t)g_RandomNoDeterm.GetRandomInt(min, max), // R + (std::uint8_t)g_RandomNoDeterm.GetRandomInt(min, max), // G + (std::uint8_t)g_RandomNoDeterm.GetRandomInt(min, max), // B + 255 // A }; } @@ -27,9 +27,9 @@ inline Color GetRandomColorRGB(std::uint8_t min = 0, std::uint8_t max = 255) inline Color GetRandomColorRGBA(std::uint8_t min = 0, std::uint8_t max = 255) { return { - (std::uint8_t)g_Random.GetRandomInt(min, max), // R - (std::uint8_t)g_Random.GetRandomInt(min, max), // G - (std::uint8_t)g_Random.GetRandomInt(min, max), // B - (std::uint8_t)g_Random.GetRandomInt(min, max) // A + (std::uint8_t)g_RandomNoDeterm.GetRandomInt(min, max), // R + (std::uint8_t)g_RandomNoDeterm.GetRandomInt(min, max), // G + (std::uint8_t)g_RandomNoDeterm.GetRandomInt(min, max), // B + (std::uint8_t)g_RandomNoDeterm.GetRandomInt(min, max) // A }; } \ No newline at end of file diff --git a/ChaosMod/Util/PoolSpawner.cpp b/ChaosMod/Util/PoolSpawner.cpp index 000aa747c..0dcb7dd1c 100644 --- a/ChaosMod/Util/PoolSpawner.cpp +++ b/ChaosMod/Util/PoolSpawner.cpp @@ -140,7 +140,7 @@ Ped CreateRandomPoolPed(float x, float y, float z, float heading) Ped ped; if (!pedModels.empty()) { - Hash model = pedModels[g_Random.GetRandomInt(0, pedModels.size() - 1)]; + Hash model = pedModels[g_RandomNoDeterm.GetRandomInt(0, pedModels.size() - 1)]; ped = CreatePoolPed(4, model, x, y, z, heading); } @@ -154,20 +154,20 @@ Ped CreateRandomPoolPed(float x, float y, float z, float heading) for (int i = 0; i < 12; i++) { int drawableAmount = GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS(ped, i); - int drawable = drawableAmount == 0 ? 0 : g_Random.GetRandomInt(0, drawableAmount - 1); + int drawable = drawableAmount == 0 ? 0 : g_RandomNoDeterm.GetRandomInt(0, drawableAmount - 1); int textureAmount = GET_NUMBER_OF_PED_TEXTURE_VARIATIONS(ped, i, drawable); - int texture = textureAmount == 0 ? 0 : g_Random.GetRandomInt(0, textureAmount - 1); + int texture = textureAmount == 0 ? 0 : g_RandomNoDeterm.GetRandomInt(0, textureAmount - 1); - SET_PED_COMPONENT_VARIATION(ped, i, drawable, texture, g_Random.GetRandomInt(0, 3)); + SET_PED_COMPONENT_VARIATION(ped, i, drawable, texture, g_RandomNoDeterm.GetRandomInt(0, 3)); if (i < 4) { int propDrawableAmount = GET_NUMBER_OF_PED_PROP_DRAWABLE_VARIATIONS(ped, i); - int propDrawable = propDrawableAmount == 0 ? 0 : g_Random.GetRandomInt(0, propDrawableAmount - 1); + int propDrawable = propDrawableAmount == 0 ? 0 : g_RandomNoDeterm.GetRandomInt(0, propDrawableAmount - 1); - int propTextureAmount = GET_NUMBER_OF_PED_PROP_TEXTURE_VARIATIONS(ped, i, drawable); - int propTexture = propTextureAmount == 0 ? 0 : g_Random.GetRandomInt(0, propTextureAmount - 1); + int propTextureAmount = GET_NUMBER_OF_PED_PROP_TEXTURE_VARIATIONS(ped, i, drawable); + int propTexture = propTextureAmount == 0 ? 0 : g_RandomNoDeterm.GetRandomInt(0, propTextureAmount - 1); SET_PED_PROP_INDEX(ped, i, propDrawable, propTexture, true); } diff --git a/ChaosMod/Util/Random.h b/ChaosMod/Util/Random.h index 8743ee5fb..ac0c17c78 100644 --- a/ChaosMod/Util/Random.h +++ b/ChaosMod/Util/Random.h @@ -31,3 +31,4 @@ class Random }; inline Random g_Random; +inline Random g_RandomNoDeterm; \ No newline at end of file diff --git a/ChaosMod/Util/Vehicle.h b/ChaosMod/Util/Vehicle.h index 12fd46f14..93b76d928 100644 --- a/ChaosMod/Util/Vehicle.h +++ b/ChaosMod/Util/Vehicle.h @@ -98,7 +98,7 @@ inline Vehicle CreateRandomVehicleWithPeds(Vehicle oldHandle, const std::vector< Hash newVehModel = 0; do { - newVehModel = vehicleModels[g_Random.GetRandomInt(0, vehicleModels.size() - 1)]; + newVehModel = vehicleModels[g_RandomNoDeterm.GetRandomInt(0, vehicleModels.size() - 1)]; } while (GET_VEHICLE_MODEL_NUMBER_OF_SEATS(newVehModel) < seatPeds.size() || IS_THIS_MODEL_A_TRAIN(newVehModel) || GET_VEHICLE_MODEL_ACCELERATION(newVehModel) <= 0); @@ -170,35 +170,36 @@ inline Vehicle CreateRandomVehicleWithPeds(Vehicle oldHandle, const std::vector< // Also apply random upgrades SET_VEHICLE_MOD_KIT(newVehicle, 0); - SET_VEHICLE_WHEEL_TYPE(newVehicle, g_Random.GetRandomInt(0, 12)); + SET_VEHICLE_WHEEL_TYPE(newVehicle, g_RandomNoDeterm.GetRandomInt(0, 12)); for (int i = 0; i < 50; i++) { int max = GET_NUM_VEHICLE_MODS(newVehicle, i); if (max > 0) { - SET_VEHICLE_MOD(newVehicle, i, g_Random.GetRandomInt(0, max - 1), g_Random.GetRandomInt(0, 1)); + SET_VEHICLE_MOD(newVehicle, i, g_RandomNoDeterm.GetRandomInt(0, max - 1), + g_RandomNoDeterm.GetRandomInt(0, 1)); } - TOGGLE_VEHICLE_MOD(newVehicle, i, g_Random.GetRandomInt(0, 1)); + TOGGLE_VEHICLE_MOD(newVehicle, i, g_RandomNoDeterm.GetRandomInt(0, 1)); } - SET_VEHICLE_TYRES_CAN_BURST(newVehicle, g_Random.GetRandomInt(0, 1)); - SET_VEHICLE_WINDOW_TINT(newVehicle, g_Random.GetRandomInt(0, 6)); + SET_VEHICLE_TYRES_CAN_BURST(newVehicle, g_RandomNoDeterm.GetRandomInt(0, 1)); + SET_VEHICLE_WINDOW_TINT(newVehicle, g_RandomNoDeterm.GetRandomInt(0, 6)); - SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(newVehicle, g_Random.GetRandomInt(0, 255), g_Random.GetRandomInt(0, 255), - g_Random.GetRandomInt(0, 255)); - SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(newVehicle, g_Random.GetRandomInt(0, 255), g_Random.GetRandomInt(0, 255), - g_Random.GetRandomInt(0, 255)); + SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(newVehicle, g_RandomNoDeterm.GetRandomInt(0, 255), + g_RandomNoDeterm.GetRandomInt(0, 255), g_RandomNoDeterm.GetRandomInt(0, 255)); + SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(newVehicle, g_RandomNoDeterm.GetRandomInt(0, 255), + g_RandomNoDeterm.GetRandomInt(0, 255), g_RandomNoDeterm.GetRandomInt(0, 255)); - _SET_VEHICLE_NEON_LIGHTS_COLOUR(newVehicle, g_Random.GetRandomInt(0, 255), g_Random.GetRandomInt(0, 255), - g_Random.GetRandomInt(0, 255)); + _SET_VEHICLE_NEON_LIGHTS_COLOUR(newVehicle, g_RandomNoDeterm.GetRandomInt(0, 255), + g_RandomNoDeterm.GetRandomInt(0, 255), g_RandomNoDeterm.GetRandomInt(0, 255)); for (int i = 0; i < 4; i++) { _SET_VEHICLE_NEON_LIGHT_ENABLED(newVehicle, i, true); } - _SET_VEHICLE_XENON_LIGHTS_COLOR(newVehicle, g_Random.GetRandomInt(0, 12)); + _SET_VEHICLE_XENON_LIGHTS_COLOR(newVehicle, g_RandomNoDeterm.GetRandomInt(0, 12)); return newVehicle; }