diff --git a/Client/core/CClientVariables.cpp b/Client/core/CClientVariables.cpp index 2ebb5f7418e..7a46f3242e6 100644 --- a/Client/core/CClientVariables.cpp +++ b/Client/core/CClientVariables.cpp @@ -329,6 +329,7 @@ void CClientVariables::LoadDefaults() DEFAULT("tyre_smoke_enabled", 1); // Enable tyre smoke DEFAULT("high_detail_vehicles", 0); // Disable rendering high detail vehicles all the time DEFAULT("high_detail_peds", 0); // Disable rendering high detail peds all the time + DEFAULT("corona_reflections", 0); // Disable corona rain reflections DEFAULT("fast_clothes_loading", 1); // 0-off 1-auto 2-on DEFAULT("allow_screen_upload", 1); // 0-off 1-on DEFAULT("allow_external_sounds", 1); // 0-off 1-on diff --git a/Client/core/CCore.cpp b/Client/core/CCore.cpp index d650e7bffd9..6c867ef358e 100644 --- a/Client/core/CCore.cpp +++ b/Client/core/CCore.cpp @@ -579,6 +579,7 @@ void CCore::ApplyGameSettings() pGameSettings->UpdateFieldOfViewFromSettings(); pGameSettings->ResetVehiclesLODDistance(false); pGameSettings->ResetPedsLODDistance(false); + pGameSettings->ResetCoronaReflectionsEnabled(); pController->SetVerticalAimSensitivityRawValue(CVARS_GET_VALUE("vertical_aim_sensitivity")); CVARS_GET("mastervolume", fVal); pGameSettings->SetRadioVolume(pGameSettings->GetRadioVolume() * fVal); diff --git a/Client/core/CSettings.cpp b/Client/core/CSettings.cpp index 17d7a331aef..566ed82eae6 100644 --- a/Client/core/CSettings.cpp +++ b/Client/core/CSettings.cpp @@ -851,6 +851,11 @@ void CSettings::CreateGUI() fPosY -= 20.0f; } #endif + + m_pCheckBoxCoronaReflections = reinterpret_cast(pManager->CreateCheckBox(pTabVideo, _("Corona rain reflections"), true)); + m_pCheckBoxCoronaReflections->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 90.0f)); + m_pCheckBoxCoronaReflections->AutoSize(NULL, 20.0f); + vecTemp.fY += 10; m_pTabs->GetSize(vecTemp); @@ -1557,6 +1562,11 @@ void CSettings::UpdateVideoTab() CVARS_GET("high_detail_peds", bHighDetailPeds); m_pCheckBoxHighDetailPeds->SetSelected(bHighDetailPeds); + // Corona rain reflections + bool bCoronaReflections; + CVARS_GET("corona_reflections", bCoronaReflections); + m_pCheckBoxCoronaReflections->SetSelected(bCoronaReflections); + PopulateResolutionComboBox(); // Fullscreen style @@ -1781,6 +1791,7 @@ bool CSettings::OnVideoDefaultClick(CGUIElement* pElement) CVARS_SET("tyre_smoke_enabled", true); CVARS_SET("high_detail_vehicles", false); CVARS_SET("high_detail_peds", false); + CVARS_SET("corona_reflections", false); gameSettings->UpdateFieldOfViewFromSettings(); gameSettings->SetDrawDistance(1.19625f); // All values taken from a default SA install, no gta_sa.set or coreconfig.xml modifications. gameSettings->SetBrightness(253); @@ -3426,6 +3437,11 @@ void CSettings::SaveData() CVARS_SET("high_detail_peds", bHighDetailPeds); gameSettings->ResetPedsLODDistance(false); + // Corona rain reflections + bool bCoronaReflections = m_pCheckBoxCoronaReflections->GetSelected(); + CVARS_SET("corona_reflections", bCoronaReflections); + gameSettings->ResetCoronaReflectionsEnabled(); + // Fast clothes loading if (CGUIListItem* pSelected = m_pFastClothesCombo->GetSelectedItem()) { diff --git a/Client/core/CSettings.h b/Client/core/CSettings.h index 6af8bf153e9..e648c75c7d1 100644 --- a/Client/core/CSettings.h +++ b/Client/core/CSettings.h @@ -160,6 +160,7 @@ class CSettings CGUICheckBox* m_pCheckBoxTyreSmokeParticles; CGUICheckBox* m_pCheckBoxHighDetailVehicles; CGUICheckBox* m_pCheckBoxHighDetailPeds; + CGUICheckBox* m_pCheckBoxCoronaReflections; CGUILabel* m_pFieldOfViewLabel; CGUIScrollBar* m_pFieldOfView; CGUILabel* m_pFieldOfViewValueLabel; diff --git a/Client/core/Graphics/CRenderItemManager.cpp b/Client/core/Graphics/CRenderItemManager.cpp index 9e7b77e8734..10ca9cd3351 100644 --- a/Client/core/Graphics/CRenderItemManager.cpp +++ b/Client/core/Graphics/CRenderItemManager.cpp @@ -782,6 +782,7 @@ void CRenderItemManager::GetDxStatus(SDxStatus& outStatus) outStatus.settings.fFieldOfView = 70; outStatus.settings.bHighDetailVehicles = false; outStatus.settings.bHighDetailPeds = false; + outStatus.settings.bCoronaReflections = false; CVARS_GET("streaming_memory", outStatus.settings.iStreamingMemory); CVARS_GET("volumetric_shadows", outStatus.settings.bVolumetricShadows); @@ -793,6 +794,7 @@ void CRenderItemManager::GetDxStatus(SDxStatus& outStatus) CVARS_GET("fov", outStatus.settings.fFieldOfView); CVARS_GET("high_detail_vehicles", outStatus.settings.bHighDetailVehicles); CVARS_GET("high_detail_peds", outStatus.settings.bHighDetailPeds); + CVARS_GET("corona_reflections", outStatus.settings.bCoronaReflections); if (outStatus.settings.iFXQuality == 0) { diff --git a/Client/game_sa/CCoronasSA.cpp b/Client/game_sa/CCoronasSA.cpp index 1d19e761536..3d02f3e10e7 100644 --- a/Client/game_sa/CCoronasSA.cpp +++ b/Client/game_sa/CCoronasSA.cpp @@ -108,3 +108,49 @@ void CCoronasSA::DisableSunAndMoon(bool bDisabled) byteOriginal = 0; } } + +/* + Enable or disable corona rain reflections. + ucEnabled: + 0 - disabled + 1 - enabled + 2 - force enabled (render even if there is no rain) +*/ +void CCoronasSA::SetCoronaReflectionsEnabled(unsigned char ucEnabled) +{ + m_ucCoronaReflectionsEnabled = ucEnabled; + + if (ucEnabled == 0) + { + // Disable corona rain reflections + // Return out CCoronas::RenderReflections() + MemPut(0x6FB630, 0xC3); + } + else + { + // Enable corona rain reflections + // Re-enable CCoronas::RenderReflections() + MemPut(0x6FB630, 0xD9); + } + + if (ucEnabled == 2) + { + // Force enable corona reflections (render even if there is no rain) + // Disable fWetGripScale check + MemPut(0x6FB645, 0xEB); + + // Patch "fld fWetGripScale" to "fld fOne" + MemCpy((void*)0x6FB906, "\x24\x86\x85\x00", 4); + } + else + { + // Restore patched code + MemPut(0x6FB645, 0x7A); + MemCpy((void*)0x6FB906, "\x08\x13\xC8\x00", 4); + } +} + +unsigned char CCoronasSA::GetCoronaReflectionsEnabled() +{ + return m_ucCoronaReflectionsEnabled; +} diff --git a/Client/game_sa/CCoronasSA.h b/Client/game_sa/CCoronasSA.h index 989c8aedf55..ffa9e097006 100644 --- a/Client/game_sa/CCoronasSA.h +++ b/Client/game_sa/CCoronasSA.h @@ -25,6 +25,7 @@ class CCoronasSA : public CCoronas { private: CRegisteredCoronaSA* Coronas[MAX_CORONAS]; + unsigned char m_ucCoronaReflectionsEnabled; public: CCoronasSA(); @@ -37,4 +38,7 @@ class CCoronasSA : public CCoronas RwTexture* GetTexture(eCoronaType type); void DisableSunAndMoon(bool bDisabled); + + void SetCoronaReflectionsEnabled(unsigned char ucEnabled); + unsigned char GetCoronaReflectionsEnabled(); }; diff --git a/Client/game_sa/CRegisteredCoronaSA.cpp b/Client/game_sa/CRegisteredCoronaSA.cpp index 277da2eb0a7..6c28efa93b1 100644 --- a/Client/game_sa/CRegisteredCoronaSA.cpp +++ b/Client/game_sa/CRegisteredCoronaSA.cpp @@ -106,6 +106,11 @@ VOID CRegisteredCoronaSA::SetFlareType(BYTE fFlareType) internalInterface->FlareType = fFlareType; } +VOID CRegisteredCoronaSA::SetReflectionType(BYTE reflectionType) +{ + internalInterface->ReflectionType = reflectionType; +} + DWORD CRegisteredCoronaSA::GetID() { DEBUG_TRACE("DWORD CRegisteredCoronaSA::GetID()"); @@ -128,7 +133,7 @@ VOID CRegisteredCoronaSA::Init(DWORD Identifier) internalInterface->Intensity = 255; internalInterface->FadedIntensity = 255; internalInterface->FlareType = 0; - internalInterface->ReflectionType = 1; + internalInterface->ReflectionType = 0; internalInterface->JustCreated = 1; internalInterface->RegisteredThisFrame = 1; // won't appear in-game without this } diff --git a/Client/game_sa/CRegisteredCoronaSA.h b/Client/game_sa/CRegisteredCoronaSA.h index 9da812b9e05..32c58a11442 100644 --- a/Client/game_sa/CRegisteredCoronaSA.h +++ b/Client/game_sa/CRegisteredCoronaSA.h @@ -72,6 +72,7 @@ class CRegisteredCoronaSA : public CRegisteredCorona VOID SetTexture(eCoronaType texture); BYTE GetFlareType(); VOID SetFlareType(BYTE fFlareType); + VOID SetReflectionType(BYTE reflectionType); DWORD GetIdentifier() { return internalInterface->Identifier; } DWORD GetID(); VOID Init(DWORD Identifier); diff --git a/Client/game_sa/CSettingsSA.cpp b/Client/game_sa/CSettingsSA.cpp index 6ad24ffe351..cb608846597 100644 --- a/Client/game_sa/CSettingsSA.cpp +++ b/Client/game_sa/CSettingsSA.cpp @@ -43,6 +43,7 @@ CSettingsSA::CSettingsSA() m_pInterface->bFrameLimiter = false; m_bVolumetricShadowsEnabled = false; m_bVolumetricShadowsSuspended = false; + m_bCoronaReflectionsViaScript = false; SetAspectRatio(ASPECT_RATIO_4_3); HookInstall(HOOKPOS_GetFxQuality, (DWORD)HOOK_GetFxQuality, 5); HookInstall(HOOKPOS_StoreShadowForVehicle, (DWORD)HOOK_StoreShadowForVehicle, 9); @@ -698,6 +699,29 @@ float CSettingsSA::GetPedsLODDistance() return ms_fPedsLODDistance; } +//////////////////////////////////////////////// +// +// Corona rain reflections +// +// When corona reflections are controlled by script changing this option +// in settings doesn't produce any effect +// +//////////////////////////////////////////////// +void CSettingsSA::ResetCoronaReflectionsEnabled() +{ + if (m_bCoronaReflectionsViaScript) + return; + + bool bEnabled; + g_pCore->GetCVars()->Get("corona_reflections", bEnabled); + g_pCore->GetGame()->GetCoronas()->SetCoronaReflectionsEnabled(bEnabled ? 1 : 0); +} + +void CSettingsSA::SetCoronaReflectionsControlledByScript(bool bViaScript) +{ + m_bCoronaReflectionsViaScript = bViaScript; +} + //////////////////////////////////////////////// // // CSettingsSA::HasUnsafeResolutions diff --git a/Client/game_sa/CSettingsSA.h b/Client/game_sa/CSettingsSA.h index 4f75c95a258..8226a1321f7 100644 --- a/Client/game_sa/CSettingsSA.h +++ b/Client/game_sa/CSettingsSA.h @@ -89,6 +89,7 @@ class CSettingsSA : public CGameSettings eAspectRatio m_AspectRatio; int m_iDesktopWidth; int m_iDesktopHeight; + bool m_bCoronaReflectionsViaScript; public: CSettingsSA(); @@ -163,6 +164,9 @@ class CSettingsSA : public CGameSettings void ResetVehiclesLODDistanceFromScript(); void GetVehiclesLODDistance(float& fVehiclesLODDistance, float& fTrainsPlanesLODDistance); + void ResetCoronaReflectionsEnabled(); + void SetCoronaReflectionsControlledByScript(bool bViaScript); + void Save(); void SetPedsLODDistance(float fPedsLODDistance, bool bFromScript); diff --git a/Client/mods/deathmatch/logic/CClientCorona.cpp b/Client/mods/deathmatch/logic/CClientCorona.cpp index 6597a888b2e..4632a644cd4 100644 --- a/Client/mods/deathmatch/logic/CClientCorona.cpp +++ b/Client/mods/deathmatch/logic/CClientCorona.cpp @@ -21,6 +21,7 @@ CClientCorona::CClientCorona(CClientMarker* pThis) m_Color = SColorRGBA(255, 0, 0, 255); m_fSize = 4.0f; m_pCoronas = g_pGame->GetCoronas(); + m_bReflectionEnabled = false; // Pick an unique identifier static unsigned long ulIdentifier = 0xFFFFFFFF; @@ -75,9 +76,10 @@ void CClientCorona::DoPulse() color.A = 0; pCorona->SetColor(color.R, color.G, color.B, color.A); pCorona->SetSize(m_fSize); + pCorona->SetReflectionType(m_bReflectionEnabled); } else { pCorona->Disable(); } -} \ No newline at end of file +} diff --git a/Client/mods/deathmatch/logic/CClientCorona.h b/Client/mods/deathmatch/logic/CClientCorona.h index 641cee4fd49..ed1977cadb9 100644 --- a/Client/mods/deathmatch/logic/CClientCorona.h +++ b/Client/mods/deathmatch/logic/CClientCorona.h @@ -38,6 +38,9 @@ class CClientCorona : public CClientMarkerCommon float GetSize() const { return m_fSize; }; void SetSize(float fSize) { m_fSize = fSize; }; + void SetReflectionEnabled(bool bEnabled) { m_bReflectionEnabled = bEnabled; }; + bool IsReflectionEnabled() const { return m_bReflectionEnabled; }; + protected: bool IsStreamedIn() { return m_bStreamedIn; }; void StreamIn(); @@ -53,5 +56,6 @@ class CClientCorona : public CClientMarkerCommon bool m_bVisible; float m_fSize; SColor m_Color; + bool m_bReflectionEnabled; CCoronas* m_pCoronas; }; diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index 886af5017de..6e12752d888 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -5297,6 +5297,10 @@ void CClientGame::ResetMapInfo() // Peds LOD distance g_pGame->GetSettings()->ResetPedsLODDistanceFromScript(); + // Corona rain reflections + g_pGame->GetSettings()->SetCoronaReflectionsControlledByScript(false); + g_pGame->GetSettings()->ResetCoronaReflectionsEnabled(); + // Sun color g_pMultiplayer->ResetSunColor(); diff --git a/Client/mods/deathmatch/logic/CClientGame.h b/Client/mods/deathmatch/logic/CClientGame.h index 9bcd7c06f62..7ffc7610866 100644 --- a/Client/mods/deathmatch/logic/CClientGame.h +++ b/Client/mods/deathmatch/logic/CClientGame.h @@ -193,6 +193,7 @@ class CClientGame GLITCH_KICKOUTOFVEHICLE_ONMODELREPLACE, NUM_GLITCHES }; + class CStoredWeaponSlot { public: diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp index 0963f58abfa..fe7b440d8b6 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaDrawingDefs.cpp @@ -1712,6 +1712,10 @@ int CLuaDrawingDefs::DxGetStatus(lua_State* luaVM) lua_pushboolean(luaVM, dxStatus.settings.bHighDetailPeds); lua_settable(luaVM, -3); + lua_pushstring(luaVM, "SettingCoronaReflections"); + lua_pushboolean(luaVM, dxStatus.settings.bCoronaReflections); + lua_settable(luaVM, -3); + lua_pushstring(luaVM, "TotalPhysicalMemory"); lua_pushnumber(luaVM, static_cast(SharedUtil::GetWMITotalPhysicalMemory()) / 1024.0 / 1024.0); lua_settable(luaVM, -3); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp index 9064fbe1520..1348d16c179 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.cpp @@ -10,6 +10,7 @@ *****************************************************************************/ #include "StdInc.h" +#include "lua/CLuaFunctionParser.h" void CLuaMarkerDefs::LoadFunctions() { @@ -21,6 +22,9 @@ void CLuaMarkerDefs::LoadFunctions() {"setMarkerType", SetMarkerType}, {"setMarkerSize", SetMarkerSize}, {"setMarkerColor", SetMarkerColor}, {"setMarkerTarget", SetMarkerTarget}, {"setMarkerIcon", SetMarkerIcon}, + + {"setCoronaReflectionEnabled", ArgumentParser}, + {"isCoronaReflectionEnabled", ArgumentParser}, }; // Add functions @@ -40,12 +44,14 @@ void CLuaMarkerDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "getSize", "getMarkerSize"); lua_classfunction(luaVM, "getTarget", OOP_GetMarkerTarget); lua_classfunction(luaVM, "getColor", "getMarkerColor"); + lua_classfunction(luaVM, "isCoronaReflectionEnabled", "isCoronaReflectionEnabled"); lua_classfunction(luaVM, "setType", "setMarkerType"); lua_classfunction(luaVM, "setIcon", "setMarkerIcon"); lua_classfunction(luaVM, "setSize", "setMarkerSize"); lua_classfunction(luaVM, "setTarget", "setMarkerTarget"); lua_classfunction(luaVM, "setColor", "setMarkerColor"); + lua_classfunction(luaVM, "setCoronaReflectionEnabled", "setCoronaReflectionEnabled"); lua_classvariable(luaVM, "markerType", "setMarkerType", "getMarkerType"); lua_classvariable(luaVM, "icon", "setMarkerIcon", "getMarkerIcon"); @@ -385,3 +391,22 @@ int CLuaMarkerDefs::SetMarkerIcon(lua_State* luaVM) lua_pushboolean(luaVM, false); return 1; } + +bool CLuaMarkerDefs::SetCoronaReflectionEnabled(CClientMarker* pMarker, bool bEnabled) +{ + CClientCorona* pCorona = pMarker->GetCorona(); + if (!pCorona) + return false; + + pCorona->SetReflectionEnabled(bEnabled); + return true; +} + +bool CLuaMarkerDefs::IsCoronaReflectionEnabled(CClientMarker* pMarker) +{ + CClientCorona* pCorona = pMarker->GetCorona(); + if (!pCorona) + return false; + + return pCorona->IsReflectionEnabled(); +} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.h index d470a47268c..6f0c1c0abbb 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaMarkerDefs.h @@ -32,4 +32,7 @@ class CLuaMarkerDefs : public CLuaDefs LUA_DECLARE(SetMarkerColor); LUA_DECLARE(SetMarkerTarget); LUA_DECLARE(SetMarkerIcon); -}; \ No newline at end of file + + static bool SetCoronaReflectionEnabled(CClientMarker* pMarker, bool bEnabled); + static bool IsCoronaReflectionEnabled(CClientMarker* pMarker); +}; diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp index c9cd9f5cebf..fe356321ceb 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp @@ -51,6 +51,7 @@ void CLuaWorldDefs::LoadFunctions() {"getMoonSize", GetMoonSize}, {"getFPSLimit", GetFPSLimit}, {"getBirdsEnabled", GetBirdsEnabled}, + {"getCoronaReflectionsEnabled", ArgumentParser}, // World set funcs {"setTime", SetTime}, @@ -88,6 +89,7 @@ void CLuaWorldDefs::LoadFunctions() {"setPedTargetingMarkerEnabled", SetPedTargetingMarkerEnabled}, {"setMoonSize", SetMoonSize}, {"setFPSLimit", SetFPSLimit}, + {"setCoronaReflectionsEnabled", ArgumentParser}, {"removeWorldModel", RemoveWorldBuilding}, {"restoreAllWorldModels", RestoreWorldBuildings}, {"restoreWorldModel", RestoreWorldBuilding}, @@ -98,6 +100,7 @@ void CLuaWorldDefs::LoadFunctions() // World reset funcs {"resetColorFilter", ArgumentParser}, + {"resetCoronaReflectionsEnabled", ArgumentParser}, {"resetSkyGradient", ResetSkyGradient}, {"resetHeatHaze", ResetHeatHaze}, {"resetWindVelocity", ResetWindVelocity}, @@ -1990,3 +1993,25 @@ bool CLuaWorldDefs::SetColorFilter(uchar ucPass0Red, uchar ucPass0Green, uchar u g_pMultiplayer->SetColorFilter(ulColor0, ulColor1); return true; } + +bool CLuaWorldDefs::SetCoronaReflectionsEnabled(uchar ucEnabled) +{ + if(ucEnabled > 2) + return false; + + g_pGame->GetSettings()->SetCoronaReflectionsControlledByScript(true); + g_pGame->GetCoronas()->SetCoronaReflectionsEnabled(ucEnabled); + return true; +} + +uchar CLuaWorldDefs::GetCoronaReflectionsEnabled() +{ + return g_pGame->GetCoronas()->GetCoronaReflectionsEnabled(); +} + +bool CLuaWorldDefs::ResetCoronaReflectionsEnabled() +{ + g_pGame->GetSettings()->SetCoronaReflectionsControlledByScript(false); + g_pGame->GetSettings()->ResetCoronaReflectionsEnabled(); + return true; +} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h index 9dda8ca027a..19fe94a3a32 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h @@ -116,4 +116,8 @@ class CLuaWorldDefs : public CLuaDefs static bool ResetColorFilter(); static bool SetColorFilter(uchar ucPass0Red, uchar ucPass0Green, uchar ucPass0Blue, uchar ucPass0Alpha, uchar ucPass1Red, uchar ucPass1Green, uchar ucPass1Blue, uchar ucPass1Alpha); + + static bool SetCoronaReflectionsEnabled(uchar ucEnabled); + static uchar GetCoronaReflectionsEnabled(); + static bool ResetCoronaReflectionsEnabled(); }; diff --git a/Client/multiplayer_sa/CMultiplayerSA.cpp b/Client/multiplayer_sa/CMultiplayerSA.cpp index b2fa00f4a93..1991807dd96 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA.cpp @@ -1538,6 +1538,10 @@ void CMultiplayerSA::InitHooks() for (auto uiAddr : shadowAddr) MemPut(uiAddr, &m_fShadowsOffset); + // Fix corona rain reflections aren't rendering (#2345) + // By using zBufferFar instead of zBufferNear for corona position + MemPut(0x6FB9A0, 0x1C); + // Skip check for disabled HUD MemSet((void*)0x58FBC4, 0x90, 9); diff --git a/Client/sdk/core/CRenderItemManagerInterface.h b/Client/sdk/core/CRenderItemManagerInterface.h index 59cc62ddb89..db59fc25456 100644 --- a/Client/sdk/core/CRenderItemManagerInterface.h +++ b/Client/sdk/core/CRenderItemManagerInterface.h @@ -128,6 +128,7 @@ struct SDxStatus float fFieldOfView; bool bHighDetailVehicles; bool bHighDetailPeds; + bool bCoronaReflections; } settings; }; diff --git a/Client/sdk/game/CCoronas.h b/Client/sdk/game/CCoronas.h index afc318647fb..87b6f6f44d0 100644 --- a/Client/sdk/game/CCoronas.h +++ b/Client/sdk/game/CCoronas.h @@ -28,4 +28,6 @@ class CCoronas virtual CRegisteredCorona* FindFreeCorona() = 0; virtual CRegisteredCorona* FindCorona(DWORD Identifier) = 0; virtual void DisableSunAndMoon(bool bDisabled) = 0; + virtual void SetCoronaReflectionsEnabled(unsigned char ucEnabled) = 0; + virtual unsigned char GetCoronaReflectionsEnabled() = 0; }; diff --git a/Client/sdk/game/CRegisteredCorona.h b/Client/sdk/game/CRegisteredCorona.h index 07ce647ba58..23a7252d226 100644 --- a/Client/sdk/game/CRegisteredCorona.h +++ b/Client/sdk/game/CRegisteredCorona.h @@ -33,6 +33,7 @@ class CRegisteredCorona virtual VOID SetTexture(eCoronaType texture) = 0; virtual BYTE GetFlareType() = 0; virtual VOID SetFlareType(BYTE fFlareType) = 0; + virtual VOID SetReflectionType(BYTE reflectionType) = 0; virtual DWORD GetIdentifier() = 0; virtual DWORD GetID() = 0; virtual VOID Refresh() = 0; diff --git a/Client/sdk/game/CSettings.h b/Client/sdk/game/CSettings.h index d51125ae6f0..acaa15d81dc 100644 --- a/Client/sdk/game/CSettings.h +++ b/Client/sdk/game/CSettings.h @@ -166,5 +166,8 @@ class CGameSettings virtual void ResetPedsLODDistanceFromScript() = 0; virtual float GetPedsLODDistance() = 0; + virtual void ResetCoronaReflectionsEnabled() = 0; + virtual void SetCoronaReflectionsControlledByScript(bool bViaScript) = 0; + virtual void Save() = 0; };