From 2829c0f3eb404cd3b86cc6812e63ffc5d1be4238 Mon Sep 17 00:00:00 2001 From: samr46 Date: Sun, 30 Apr 2023 20:27:26 +0300 Subject: [PATCH 1/3] Add getWorldProperty, setWorldProperty, resetWorldProperty --- Client/game_sa/CWeatherSA.cpp | 166 ++++++++ Client/game_sa/CWeatherSA.h | 28 ++ Client/mods/deathmatch/logic/CClientGame.cpp | 22 ++ .../logic/lua/CLuaFunctionParseHelpers.cpp | 24 ++ .../logic/lua/CLuaFunctionParseHelpers.h | 5 + .../logic/luadefs/CLuaWorldDefs.cpp | 174 +++++++++ .../deathmatch/logic/luadefs/CLuaWorldDefs.h | 4 + Client/multiplayer_sa/CMultiplayerSA.cpp | 354 +++++++++++++++++- Client/multiplayer_sa/CMultiplayerSA.h | 53 +++ Client/sdk/game/CWeather.h | 28 ++ Client/sdk/game/Common.h | 24 ++ Client/sdk/multiplayer/CMultiplayer.h | 52 +++ 12 files changed, 933 insertions(+), 1 deletion(-) diff --git a/Client/game_sa/CWeatherSA.cpp b/Client/game_sa/CWeatherSA.cpp index 7b6364334c..1049a37599 100644 --- a/Client/game_sa/CWeatherSA.cpp +++ b/Client/game_sa/CWeatherSA.cpp @@ -67,3 +67,169 @@ void CWeatherSA::ResetAmountOfRain() MemCpy((LPVOID)0x72BC92, &originalFstp1, 6); MemCpy((LPVOID)0x72C686, &originalFstp2, 6); } + +float CWeatherSA::GetWetRoads() +{ + return *(float*)0xC81308; +} + +bool CWeatherSA::SetWetRoads(float fAmount) +{ + MemSet((LPVOID)(0x72BB9F + 2), 0x90, 3); + MemSet((LPVOID)(0x72BBB7 + 2), 0x90, 3); + MemSet((LPVOID)(0x72BBD0 + 1), 0x90, 3); + MemSet((LPVOID)(0x72BBD7 + 2), 0x90, 3); + + MemPutFast(0xC81308, fAmount); + return true; +} + +bool CWeatherSA::ResetWetRoads() +{ + BYTE originalCodes[3] = {0x08, 0x13, 0xC8}; + MemCpy((LPVOID)(0x72BB9F + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72BBB7 + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72BBD0 + 1), &originalCodes, 3); + MemCpy((LPVOID)(0x72BBD7 + 2), &originalCodes, 3); + return true; +} + +float CWeatherSA::GetFoggyness() +{ + return *(float*)0xC81300; +} + +bool CWeatherSA::SetFoggyness(float fAmount) +{ + MemSet((LPVOID)(0x72BDF5 + 2), 0x90, 3); + MemSet((LPVOID)(0x72BDDD + 2), 0x90, 3); + MemSet((LPVOID)(0x72BE13 + 2), 0x90, 3); + + MemPutFast(0xC81300, fAmount); + return true; +} + +bool CWeatherSA::ResetFoggyness() +{ + BYTE originalCodes[3] = {0x00, 0x13, 0xC8}; + MemCpy((LPVOID)(0x72BDF5 + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72BDDD + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72BE13 + 2), &originalCodes, 3); + return true; +} + +float CWeatherSA::GetFog() +{ + return *(float*)0xC812FC; +} + +bool CWeatherSA::SetFog(float fAmount) +{ + MemSet((LPVOID)(0x72BE37 + 2), 0x90, 3); + MemSet((LPVOID)(0x72BE1F + 2), 0x90, 3); + MemSet((LPVOID)(0x72BE4F + 2), 0x90, 3); + + MemPutFast(0xC812FC, fAmount); + return true; +} + +bool CWeatherSA::ResetFog() +{ + BYTE originalCodes[3] = {0xFC, 0x12, 0xC8}; + MemCpy((LPVOID)(0x72BE37 + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72BE1F + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72BE4F + 2), &originalCodes, 3); + return true; +} + +float CWeatherSA::GetRainFog() +{ + return *(float*)0xC81410; +} + +bool CWeatherSA::SetRainFog(float fAmount) +{ + MemSet((LPVOID)(0x72ADD8 + 2), 0x90, 3); + MemSet((LPVOID)(0x72ADE4 + 2), 0x90, 3); + + MemPutFast(0xC81410, fAmount); + return true; +} + +bool CWeatherSA::ResetRainFog() +{ + BYTE originalCodes[3] = {0x10, 0x14, 0xC8}; + MemCpy((LPVOID)(0x72ADD8 + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72ADE4 + 2), &originalCodes, 3); + return true; +} + +float CWeatherSA::GetWaterFog() +{ + return *(float*)0xC81338; +} + +bool CWeatherSA::SetWaterFog(float fAmount) +{ + MemSet((LPVOID)(0x72C35C + 2), 0x90, 3); + MemSet((LPVOID)(0x72C38E + 2), 0x90, 3); + MemSet((LPVOID)(0x72C36F + 2), 0x90, 3); + + MemPutFast(0xC81338, fAmount); + return true; +} + +bool CWeatherSA::ResetWaterFog() +{ + BYTE originalCodes[3] = {0x38, 0x13, 0xC8}; + MemCpy((LPVOID)(0x72C35C + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72C38E + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72C36F + 2), &originalCodes, 3); + return true; +} + +float CWeatherSA::GetSandstorm() +{ + return *(float*)0xC812F4; +} + +bool CWeatherSA::SetSandstorm(float fAmount) +{ + MemSet((LPVOID)(0x72A4B6 + 1), 0x90, 3); + MemSet((LPVOID)(0x72BCEB + 1), 0x90, 3); + MemSet((LPVOID)(0x72BD0B + 2), 0x90, 3); + + MemPutFast(0xC812F4, fAmount); + return true; +} + +bool CWeatherSA::ResetSandstorm() +{ + BYTE originalCodes[3] = {0xF4, 0x12, 0xC8}; + MemCpy((LPVOID)(0x72A4B6 + 1), &originalCodes, 3); + MemCpy((LPVOID)(0x72BCEB + 1), &originalCodes, 3); + MemCpy((LPVOID)(0x72BD0B + 2), &originalCodes, 3); + return true; +} + +float CWeatherSA::GetRainbow() +{ + return *(float*)0xC812E4; +} + +bool CWeatherSA::SetRainbow(float fAmount) +{ + MemSet((LPVOID)(0x72BF51 + 2), 0x90, 3); + MemSet((LPVOID)(0x72BF59 + 2), 0x90, 3); + + MemPutFast(0xC812E4, fAmount); + return true; +} + +bool CWeatherSA::ResetRainbow() +{ + BYTE originalCodes[3] = {0xE4, 0x12, 0xC8}; + MemCpy((LPVOID)(0x72BF51 + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x72BF59 + 2), &originalCodes, 3); + return true; +} diff --git a/Client/game_sa/CWeatherSA.h b/Client/game_sa/CWeatherSA.h index baf1b98e1d..4513284475 100644 --- a/Client/game_sa/CWeatherSA.h +++ b/Client/game_sa/CWeatherSA.h @@ -27,6 +27,34 @@ class CWeatherSA : public CWeather void SetAmountOfRain(float fAmount); void ResetAmountOfRain(); + float GetWetRoads(); + bool SetWetRoads(float fAmount); + bool ResetWetRoads(); + + float GetFoggyness(); + bool SetFoggyness(float fAmount); + bool ResetFoggyness(); + + float GetFog(); + bool SetFog(float fAmount); + bool ResetFog(); + + float GetRainFog(); + bool SetRainFog(float fAmount); + bool ResetRainFog(); + + float GetWaterFog(); + bool SetWaterFog(float fAmount); + bool ResetWaterFog(); + + float GetSandstorm(); + bool SetSandstorm(float fAmount); + bool ResetSandstorm(); + + float GetRainbow(); + bool SetRainbow(float fAmount); + bool ResetRainbow(); + private: static unsigned char* VAR_CWeather__ForcedWeatherType; static unsigned char* VAR_CWeather__OldWeatherType; diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index cee25e7987..cd64f46dde 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -5379,6 +5379,28 @@ void CClientGame::ResetMapInfo() // Moon size g_pMultiplayer->ResetMoonSize(); + // World properties + g_pMultiplayer->ResetAmbientColor(); + g_pMultiplayer->ResetAmbientObjectColor(); + g_pMultiplayer->ResetDirectionalColor(); + g_pMultiplayer->ResetSpriteSize(); + g_pMultiplayer->ResetSpriteBrightness(); + g_pMultiplayer->ResetPoleShadowStrength(); + g_pMultiplayer->ResetShadowStrength(); + g_pMultiplayer->ResetShadowsOffset(); + g_pMultiplayer->ResetLightsOnGroundBrightness(); + g_pMultiplayer->ResetLowCloudsColor(); + g_pMultiplayer->ResetBottomCloudsColor(); + g_pMultiplayer->ResetCloudsAlpha1(); + g_pMultiplayer->ResetIllumination(); + g_pGame->GetWeather()->ResetWetRoads(); + g_pGame->GetWeather()->ResetFoggyness(); + g_pGame->GetWeather()->ResetFog(); + g_pGame->GetWeather()->ResetRainFog(); + g_pGame->GetWeather()->ResetWaterFog(); + g_pGame->GetWeather()->ResetSandstorm(); + g_pGame->GetWeather()->ResetRainbow(); + // Disable the change of any player stats g_pMultiplayer->SetLocalStatsStatic(true); diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp index ae3b38d3f0..6f85eeec9c 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.cpp @@ -778,6 +778,30 @@ ADD_ENUM(eModelIdeFlag::IS_BREAKABLE_STATUE, "is_breakable_statue") ADD_ENUM(eModelIdeFlag::IS_CRANE, "is_crane") IMPLEMENT_ENUM_CLASS_END("model-ide-flag") +// World properties +IMPLEMENT_ENUM_BEGIN(eWorldProperty) +ADD_ENUM(AMBIENT_COLOR, "AmbientColor") +ADD_ENUM(AMBIENT_OBJ_COLOR, "AmbientObjColor") +ADD_ENUM(DIRECTIONAL_COLOR, "DirectionalColor") +ADD_ENUM(SPRITE_SIZE, "SpriteSize") +ADD_ENUM(SPRITE_BRIGHTNESS, "SpriteBrightness") +ADD_ENUM(POLE_SHADOW_STRENGTH, "PoleShadowStrength") +ADD_ENUM(SHADOW_STRENGTH, "ShadowStrength") +ADD_ENUM(SHADOWS_OFFSET, "ShadowsOffset") +ADD_ENUM(LIGHTS_ON_GROUND, "LightsOnGround") +ADD_ENUM(LOW_CLOUDS_COLOR, "LowCloudsColor") +ADD_ENUM(BOTTOM_CLOUDS_COLOR, "BottomCloudsColor") +ADD_ENUM(CLOUDS_ALPHA1, "CloudsAlpha") +ADD_ENUM(ILLUMINATION, "Illumination") +ADD_ENUM(WEATHER_WET_ROADS, "WetRoads") +ADD_ENUM(WEATHER_FOGGYNESS, "Foggyness") +ADD_ENUM(WEATHER_FOG, "Fog") +ADD_ENUM(WEATHER_RAIN_FOG, "RainFog") +ADD_ENUM(WEATHER_WATER_FOG, "WaterFog") +ADD_ENUM(WEATHER_SANDSTORM, "Sandstorm") +ADD_ENUM(WEATHER_RAINBOW, "Rainbow") +IMPLEMENT_ENUM_END("world-property") + // // CResource from userdata // diff --git a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h index 9b0e8d8885..578df111aa 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h +++ b/Client/mods/deathmatch/logic/lua/CLuaFunctionParseHelpers.h @@ -79,6 +79,7 @@ DECLARE_ENUM_CLASS(eSoundEffectParams::I3DL2Reverb); DECLARE_ENUM_CLASS(eSoundEffectParams::ParamEq); DECLARE_ENUM_CLASS(eSoundEffectParams::Reverb); DECLARE_ENUM_CLASS(eModelIdeFlag); +DECLARE_ENUM(eWorldProperty); class CRemoteCall; @@ -488,6 +489,10 @@ inline SString GetClassTypeName(eSoundEffectParams::Reverb*) { return "soundeffect-params-reverb"; } +inline SString GetClassTypeName(eWorldProperty*) +{ + return "world-property"; +} inline SString GetClassTypeName(CClientVectorGraphic*) { diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp index da0a5d18e6..c0285ab9ae 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp @@ -56,6 +56,7 @@ void CLuaWorldDefs::LoadFunctions() {"getFPSLimit", GetFPSLimit}, {"getBirdsEnabled", GetBirdsEnabled}, {"getCoronaReflectionsEnabled", ArgumentParser}, + {"getWorldProperty", ArgumentParserWarn}, // World set funcs {"setTime", SetTime}, @@ -94,6 +95,7 @@ void CLuaWorldDefs::LoadFunctions() {"setMoonSize", SetMoonSize}, {"setFPSLimit", SetFPSLimit}, {"setCoronaReflectionsEnabled", ArgumentParser}, + {"setWorldProperty", ArgumentParserWarn}, {"removeWorldModel", RemoveWorldBuilding}, {"restoreAllWorldModels", RestoreWorldBuildings}, {"restoreWorldModel", RestoreWorldBuilding}, @@ -118,6 +120,7 @@ void CLuaWorldDefs::LoadFunctions() {"resetSunSize", ResetSunSize}, {"resetMoonSize", ResetMoonSize}, {"resetBlurLevel", ResetBlurLevel}, + {"resetWorldProperty", ArgumentParserWarn}, // World check funcs {"areTrafficLightsLocked", AreTrafficLightsLocked}, @@ -2020,3 +2023,174 @@ bool CLuaWorldDefs::ResetCoronaReflectionsEnabled() g_pGame->GetSettings()->ResetCoronaReflectionsEnabled(); return true; } + +std::variant> CLuaWorldDefs::GetWorldProperty(eWorldProperty property) +{ + switch (property) + { + case eWorldProperty::AMBIENT_COLOR: + { + float red, green, blue; + g_pMultiplayer->GetAmbientColor(red, green, blue); + return std::make_tuple((int16)(red * 255), (int16)(green * 255), (int16)(blue * 255)); + } + case eWorldProperty::AMBIENT_OBJ_COLOR: + { + float red, green, blue; + g_pMultiplayer->GetAmbientObjectColor(red, green, blue); + return std::make_tuple((int16)(red * 255), (int16)(green * 255), (int16)(blue * 255)); + } + case eWorldProperty::DIRECTIONAL_COLOR: + { + float red, green, blue; + g_pMultiplayer->GetDirectionalColor(red, green, blue); + return std::make_tuple((int16)(red * 255), (int16)(green * 255), (int16)(blue * 255)); + } + case eWorldProperty::SPRITE_SIZE: + return g_pMultiplayer->GetSpriteSize(); + case eWorldProperty::SPRITE_BRIGHTNESS: + return g_pMultiplayer->GetSpriteBrightness(); + case eWorldProperty::POLE_SHADOW_STRENGTH: + return (float)g_pMultiplayer->GetPoleShadowStrength(); + case eWorldProperty::SHADOW_STRENGTH: + return (float)g_pMultiplayer->GetShadowStrength(); + case eWorldProperty::SHADOWS_OFFSET: + return g_pMultiplayer->GetShadowsOffset(); + case eWorldProperty::LIGHTS_ON_GROUND: + return g_pMultiplayer->GetLightsOnGroundBrightness(); + case eWorldProperty::LOW_CLOUDS_COLOR: + { + int16 red, green, blue; + g_pMultiplayer->GetLowCloudsColor(red, green, blue); + return std::make_tuple(red, green, blue); + } + case eWorldProperty::BOTTOM_CLOUDS_COLOR: + { + int16 red, green, blue; + g_pMultiplayer->GetBottomCloudsColor(red, green, blue); + return std::make_tuple(red, green, blue); + } + case eWorldProperty::CLOUDS_ALPHA1: + return g_pMultiplayer->GetCloudsAlpha1(); + case eWorldProperty::ILLUMINATION: + return g_pMultiplayer->GetIllumination(); + case eWorldProperty::WEATHER_WET_ROADS: + return g_pGame->GetWeather()->GetWetRoads(); + case eWorldProperty::WEATHER_FOGGYNESS: + return g_pGame->GetWeather()->GetFoggyness(); + case eWorldProperty::WEATHER_FOG: + return g_pGame->GetWeather()->GetFog(); + case eWorldProperty::WEATHER_RAIN_FOG: + return g_pGame->GetWeather()->GetRainFog(); + case eWorldProperty::WEATHER_WATER_FOG: + return g_pGame->GetWeather()->GetWaterFog(); + case eWorldProperty::WEATHER_SANDSTORM: + return g_pGame->GetWeather()->GetSandstorm(); + case eWorldProperty::WEATHER_RAINBOW: + return g_pGame->GetWeather()->GetRainbow(); + } + return false; +} + +bool CLuaWorldDefs::SetWorldProperty(eWorldProperty property, float arg1, std::optional arg2, std::optional arg3) +{ + if (arg2.has_value() && arg3.has_value()) + { + switch (property) + { + case eWorldProperty::AMBIENT_COLOR: + return g_pMultiplayer->SetAmbientColor(arg1 / 255, arg2.value() / 255, arg3.value() / 255); + case eWorldProperty::AMBIENT_OBJ_COLOR: + return g_pMultiplayer->SetAmbientObjectColor(arg1 / 255, arg2.value() / 255, arg3.value() / 255); + case eWorldProperty::DIRECTIONAL_COLOR: + return g_pMultiplayer->SetDirectionalColor(arg1 / 255, arg2.value() / 255, arg3.value() / 255); + case eWorldProperty::LOW_CLOUDS_COLOR: + return g_pMultiplayer->SetLowCloudsColor((int16)arg1, (int16)arg2.value(), (int16)arg3.value()); + case eWorldProperty::BOTTOM_CLOUDS_COLOR: + return g_pMultiplayer->SetBottomCloudsColor((int16)arg1, (int16)arg2.value(), (int16)arg3.value()); + } + return false; + } + switch (property) + { + case eWorldProperty::SPRITE_SIZE: + return g_pMultiplayer->SetSpriteSize(arg1); + case eWorldProperty::SPRITE_BRIGHTNESS: + return g_pMultiplayer->SetSpriteBrightness(arg1); + case eWorldProperty::POLE_SHADOW_STRENGTH: + return g_pMultiplayer->SetPoleShadowStrength(arg1); + case eWorldProperty::SHADOW_STRENGTH: + return g_pMultiplayer->SetShadowStrength(arg1); + case eWorldProperty::SHADOWS_OFFSET: + return g_pMultiplayer->SetShadowsOffset(arg1); + case eWorldProperty::LIGHTS_ON_GROUND: + return g_pMultiplayer->SetLightsOnGroundBrightness(arg1); + case eWorldProperty::CLOUDS_ALPHA1: + return g_pMultiplayer->SetCloudsAlpha1(arg1); + case eWorldProperty::ILLUMINATION: + return g_pMultiplayer->SetIllumination(arg1); + case eWorldProperty::WEATHER_WET_ROADS: + return g_pGame->GetWeather()->SetWetRoads(arg1); + case eWorldProperty::WEATHER_FOGGYNESS: + return g_pGame->GetWeather()->SetFoggyness(arg1); + case eWorldProperty::WEATHER_FOG: + return g_pGame->GetWeather()->SetFog(arg1); + case eWorldProperty::WEATHER_RAIN_FOG: + return g_pGame->GetWeather()->SetRainFog(arg1); + case eWorldProperty::WEATHER_WATER_FOG: + return g_pGame->GetWeather()->SetWaterFog(arg1); + case eWorldProperty::WEATHER_SANDSTORM: + return g_pGame->GetWeather()->SetSandstorm(arg1); + case eWorldProperty::WEATHER_RAINBOW: + return g_pGame->GetWeather()->SetRainbow(arg1); + } + return false; +} + +bool CLuaWorldDefs::ResetWorldProperty(eWorldProperty property) +{ + switch (property) + { + case eWorldProperty::AMBIENT_COLOR: + return g_pMultiplayer->ResetAmbientColor(); + case eWorldProperty::AMBIENT_OBJ_COLOR: + return g_pMultiplayer->ResetAmbientObjectColor(); + case eWorldProperty::DIRECTIONAL_COLOR: + return g_pMultiplayer->ResetDirectionalColor(); + case eWorldProperty::SPRITE_SIZE: + return g_pMultiplayer->ResetSpriteSize(); + case eWorldProperty::SPRITE_BRIGHTNESS: + return g_pMultiplayer->ResetSpriteBrightness(); + case eWorldProperty::POLE_SHADOW_STRENGTH: + return g_pMultiplayer->ResetPoleShadowStrength(); + case eWorldProperty::SHADOW_STRENGTH: + return g_pMultiplayer->ResetShadowStrength(); + case eWorldProperty::SHADOWS_OFFSET: + return g_pMultiplayer->ResetShadowsOffset(); + case eWorldProperty::LIGHTS_ON_GROUND: + return g_pMultiplayer->ResetLightsOnGroundBrightness(); + case eWorldProperty::LOW_CLOUDS_COLOR: + return g_pMultiplayer->ResetLowCloudsColor(); + case eWorldProperty::BOTTOM_CLOUDS_COLOR: + return g_pMultiplayer->ResetBottomCloudsColor(); + case eWorldProperty::CLOUDS_ALPHA1: + return g_pMultiplayer->ResetCloudsAlpha1(); + case eWorldProperty::ILLUMINATION: + return g_pMultiplayer->ResetIllumination(); + case eWorldProperty::WEATHER_WET_ROADS: + return g_pGame->GetWeather()->ResetWetRoads(); + case eWorldProperty::WEATHER_FOGGYNESS: + return g_pGame->GetWeather()->ResetFoggyness(); + case eWorldProperty::WEATHER_FOG: + return g_pGame->GetWeather()->ResetFog(); + case eWorldProperty::WEATHER_RAIN_FOG: + return g_pGame->GetWeather()->ResetRainFog(); + case eWorldProperty::WEATHER_WATER_FOG: + return g_pGame->GetWeather()->ResetWaterFog(); + case eWorldProperty::WEATHER_SANDSTORM: + return g_pGame->GetWeather()->ResetSandstorm(); + case eWorldProperty::WEATHER_RAINBOW: + return g_pGame->GetWeather()->ResetRainbow(); + } + return false; +} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h index 73a94b24ca..c7c4ff6d3f 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.h @@ -120,4 +120,8 @@ class CLuaWorldDefs : public CLuaDefs static bool SetCoronaReflectionsEnabled(uchar ucEnabled); static uchar GetCoronaReflectionsEnabled(); static bool ResetCoronaReflectionsEnabled(); + + static std::variant> GetWorldProperty(eWorldProperty property); + static bool SetWorldProperty(eWorldProperty property, float arg1, std::optional arg2, std::optional arg3); + static bool ResetWorldProperty(eWorldProperty property); }; diff --git a/Client/multiplayer_sa/CMultiplayerSA.cpp b/Client/multiplayer_sa/CMultiplayerSA.cpp index e4c40fc364..bab4769a6a 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA.cpp @@ -330,6 +330,32 @@ BYTE ucSkyGradientTopB = 0; BYTE ucSkyGradientBottomR = 0; BYTE ucSkyGradientBottomG = 0; BYTE ucSkyGradientBottomB = 0; + +bool bUsingCustomAmbientColor = false; +float fAmbientColorR = 0.0F; +float fAmbientColorG = 0.0F; +float fAmbientColorB = 0.0F; + +bool bUsingCustomAmbientObjectColor = false; +float fAmbientObjectColorR = 0.0F; +float fAmbientObjectColorG = 0.0F; +float fAmbientObjectColorB = 0.0F; + +bool bUsingCustomDirectionalColor = false; +float fDirectionalColorR = 0.0F; +float fDirectionalColorG = 0.0F; +float fDirectionalColorB = 0.0F; + +bool bUsingCustomLowCloudsColor = false; +int16 iLowCloudsColorR = 0; +int16 iLowCloudsColorG = 0; +int16 iLowCloudsColorB = 0; + +bool bUsingCustomBottomCloudsColor = false; +int16 iBottomCloudsColorR = 0; +int16 iBottomCloudsColorG = 0; +int16 iBottomCloudsColorB = 0; + bool bUsingCustomWaterColor = false; float fWaterColorR = 0.0F; float fWaterColorG = 0.0F; @@ -1537,7 +1563,7 @@ void CMultiplayerSA::InitHooks() fDuckingHealthThreshold = 0; // Lower the GTA shadows offset closer to ground/floor level - m_fShadowsOffset = 0.013f; // GTA default = 0.06f + m_fShadowsOffset = DEFAULT_SHADOWS_OFFSET; for (auto uiAddr : shadowAddr) MemPut(uiAddr, &m_fShadowsOffset); @@ -2260,6 +2286,302 @@ void CMultiplayerSA::ResetWater() MemPut(0x7051D7, 184); } +void CMultiplayerSA::GetAmbientColor(float& red, float& green, float& blue) +{ + if (bUsingCustomAmbientColor) + red = fAmbientColorR, green = fAmbientColorG, blue = fAmbientColorB; + else + red = *(float*)0xB7C4A0, green = *(float*)0xB7C4A4, blue = *(float*)0xB7C4A8; +} + +bool CMultiplayerSA::SetAmbientColor(float red, float green, float blue) +{ + bUsingCustomAmbientColor = true; + fAmbientColorR = red; + fAmbientColorG = green; + fAmbientColorB = blue; + return true; +} + +bool CMultiplayerSA::ResetAmbientColor() +{ + bUsingCustomAmbientColor = false; + return true; +} + +void CMultiplayerSA::GetAmbientObjectColor(float& red, float& green, float& blue) +{ + if (bUsingCustomAmbientObjectColor) + red = fAmbientObjectColorR, green = fAmbientObjectColorG, blue = fAmbientObjectColorB; + else + red = *(float*)0xB7C4AC, green = *(float*)0xB7C4B0, blue = *(float*)0xB7C4B4; +} + +bool CMultiplayerSA::SetAmbientObjectColor(float red, float green, float blue) +{ + bUsingCustomAmbientObjectColor = true; + fAmbientObjectColorR = red; + fAmbientObjectColorG = green; + fAmbientObjectColorB = blue; + return true; +} + +bool CMultiplayerSA::ResetAmbientObjectColor() +{ + bUsingCustomAmbientObjectColor = false; + return true; +} + +void CMultiplayerSA::GetDirectionalColor(float& red, float& green, float& blue) +{ + if (bUsingCustomDirectionalColor) + red = fDirectionalColorR, green = fDirectionalColorG, blue = fDirectionalColorB; + else + red = *(float*)0xB7C4B8, green = *(float*)0xB7C4BC, blue = *(float*)0xB7C4C0; +} + +bool CMultiplayerSA::SetDirectionalColor(float red, float green, float blue) +{ + bUsingCustomDirectionalColor = true; + fDirectionalColorR = red; + fDirectionalColorG = green; + fDirectionalColorB = blue; + return true; +} + +bool CMultiplayerSA::ResetDirectionalColor() +{ + bUsingCustomDirectionalColor = false; + return true; +} + +float CMultiplayerSA::GetSpriteSize() +{ + return *(float*)0xB7C4E0; +} + +bool CMultiplayerSA::SetSpriteSize(float size) +{ + MemPut(0x55FC21, 0xDD); + MemPut(0x55FC22, 0xD8); + MemPut(0x55FC23, 0x90); + + MemPutFast(0xB7C4E0, size); + return true; +} + +bool CMultiplayerSA::ResetSpriteSize() +{ + MemPut(0x55FC21, 0xD9); + MemPut(0x55FC22, 0x5E); + MemPut(0x55FC23, 0x40); + return true; +} + +float CMultiplayerSA::GetSpriteBrightness() +{ + return *(float*)0xB7C4E4; +} + +bool CMultiplayerSA::SetSpriteBrightness(float brightness) +{ + MemPut(0x55FC34, 0xDD); + MemPut(0x55FC35, 0xD8); + MemPut(0x55FC36, 0x90); + + MemPutFast(0xB7C4E4, brightness); + return true; +} + +bool CMultiplayerSA::ResetSpriteBrightness() +{ + MemPut(0x55FC34, 0xD9); + MemPut(0x55FC35, 0x5E); + MemPut(0x55FC36, 0x44); + return true; +} + +int16 CMultiplayerSA::GetPoleShadowStrength() +{ + return *(int16*)0xB7C4EC; +} + +bool CMultiplayerSA::SetPoleShadowStrength(int16 strength) +{ + MemSet((LPVOID)0x55FCB8, 0x90, 4); + MemSet((LPVOID)(0x56023A + 2), 0x90, 3); + MemSet((LPVOID)(0x5602A6 + 2), 0x90, 3); + + MemPutFast(0xB7C4EC, strength); + return true; +} + +bool CMultiplayerSA::ResetPoleShadowStrength() +{ + BYTE originalMov[4] = {0x66, 0x89, 0x46, 0x4C}; + MemCpy((LPVOID)0x55FCB8, &originalMov, 4); + + BYTE originalCodes[3] = {0xEC, 0xC4, 0xB7}; + MemCpy((LPVOID)(0x56023A + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x5602A6 + 2), &originalCodes, 3); + return true; +} + +int16 CMultiplayerSA::GetShadowStrength() +{ + return *(int16*)0xB7C4E8; +} + +bool CMultiplayerSA::SetShadowStrength(int16 strength) +{ + MemSet((LPVOID)0x55FC5E, 0x90, 4); + MemSet((LPVOID)(0x56022E + 2), 0x90, 3); + MemSet((LPVOID)(0x560234 + 2), 0x90, 3); + MemSet((LPVOID)(0x56029A + 2), 0x90, 3); + MemSet((LPVOID)(0x5602A0 + 2), 0x90, 3); + + MemPutFast(0xB7C4E8, strength); + return true; +} + +bool CMultiplayerSA::ResetShadowStrength() +{ + BYTE originalMov[4] = {0x66, 0x89, 0x46, 0x48}; + MemCpy((LPVOID)0x55FC5E, &originalMov, 4); + + BYTE originalCodes[3] = {0xE8, 0xC4, 0xB7}; + MemCpy((LPVOID)(0x56022E + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x560234 + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x56029A + 2), &originalCodes, 3); + MemCpy((LPVOID)(0x5602A0 + 2), &originalCodes, 3); + return true; +} + +float CMultiplayerSA::GetShadowsOffset() +{ + return m_fShadowsOffset; +} + +bool CMultiplayerSA::SetShadowsOffset(float offset) +{ + m_fShadowsOffset = offset; + return true; +} + +bool CMultiplayerSA::ResetShadowsOffset() +{ + m_fShadowsOffset = DEFAULT_SHADOWS_OFFSET; + return true; +} + +float CMultiplayerSA::GetLightsOnGroundBrightness() +{ + return *(float*)0xB7C4F8; +} + +bool CMultiplayerSA::SetLightsOnGroundBrightness(float brightness) +{ + MemPut(0x55FDBC, 0xDD); + MemPut(0x55FDBD, 0xD8); + MemPut(0x55FDBE, 0x90); + MemSet((LPVOID)(0x5602AC + 2), 0x90, 3); + + MemPutFast(0xB7C4F8, brightness); + return true; +} + +bool CMultiplayerSA::ResetLightsOnGroundBrightness() +{ + BYTE originalFstp[3] = {0xD9, 0x5E, 0x58}; + MemCpy((LPVOID)0x55FDBC, &originalFstp, 3); + + BYTE originalCodes[3] = {0xF8, 0xC4, 0xB7}; + MemCpy((LPVOID)(0x5602AC + 2), &originalCodes, 3); + return true; +} + +void CMultiplayerSA::GetLowCloudsColor(int16& red, int16& green, int16& blue) +{ + if (bUsingCustomLowCloudsColor) + red = iLowCloudsColorR, green = iLowCloudsColorG, blue = iLowCloudsColorB; + else + red = *(int16*)0xB7C4FC, green = *(int16*)0xB7C4FE, blue = *(int16*)0xB7C500; +} + +bool CMultiplayerSA::SetLowCloudsColor(int16 red, int16 green, int16 blue) +{ + bUsingCustomLowCloudsColor = true; + iLowCloudsColorR = red; + iLowCloudsColorG = green; + iLowCloudsColorB = blue; + return true; +} + +bool CMultiplayerSA::ResetLowCloudsColor() +{ + bUsingCustomLowCloudsColor = false; + return true; +} + +void CMultiplayerSA::GetBottomCloudsColor(int16& red, int16& green, int16& blue) +{ + if (bUsingCustomBottomCloudsColor) + red = iBottomCloudsColorR, green = iBottomCloudsColorG, blue = iBottomCloudsColorB; + else + red = *(int16*)0xB7C502, green = *(int16*)0xB7C504, blue = *(int16*)0xB7C506; +} + +bool CMultiplayerSA::SetBottomCloudsColor(int16 red, int16 green, int16 blue) +{ + bUsingCustomBottomCloudsColor = true; + iBottomCloudsColorR = red; + iBottomCloudsColorG = green; + iBottomCloudsColorB = blue; + return true; +} + +bool CMultiplayerSA::ResetBottomCloudsColor() +{ + bUsingCustomBottomCloudsColor = false; + return true; +} + +float CMultiplayerSA::GetCloudsAlpha1() +{ + return *(float*)0xB7C538; +} + +bool CMultiplayerSA::SetCloudsAlpha1(float alpha) +{ + MemPut(0x55FDD5, 0xD8); + MemPutFast(0xB7C538, alpha); + return true; +} + +bool CMultiplayerSA::ResetCloudsAlpha1() +{ + MemPut(0x55FDD5, 0xD9); + return true; +} + +float CMultiplayerSA::GetIllumination() +{ + return *(float*)0xB7C544; +} + +bool CMultiplayerSA::SetIllumination(float illumination) +{ + MemPut(0x55FE46, 0xD8); + MemPutFast(0xB7C544, illumination); + return true; +} + +bool CMultiplayerSA::ResetIllumination() +{ + MemPut(0x55FE46, 0xD9); + return true; +} + bool CMultiplayerSA::GetExplosionsDisabled() { return m_bExplosionsDisabled; @@ -3622,6 +3944,36 @@ void _cdecl DoEndWorldColorsPokes() MemPutFast(0xB7C4CC, ucSkyGradientBottomG); MemPutFast(0xB7C4CE, ucSkyGradientBottomB); } + if (bUsingCustomAmbientColor) + { + MemPutFast(0xB7C4A0, fAmbientColorR); + MemPutFast(0xB7C4A4, fAmbientColorG); + MemPutFast(0xB7C4A8, fAmbientColorB); + } + if (bUsingCustomAmbientObjectColor) + { + MemPutFast(0xB7C4AC, fAmbientObjectColorR); + MemPutFast(0xB7C4B0, fAmbientObjectColorG); + MemPutFast(0xB7C4B4, fAmbientObjectColorB); + } + if (bUsingCustomDirectionalColor) + { + MemPutFast(0xB7C4B8, fDirectionalColorR); + MemPutFast(0xB7C4BC, fDirectionalColorG); + MemPutFast(0xB7C4C0, fDirectionalColorB); + } + if (bUsingCustomLowCloudsColor) + { + MemPutFast(0xB7C4FC, iLowCloudsColorR); + MemPutFast(0xB7C4FE, iLowCloudsColorG); + MemPutFast(0xB7C500, iLowCloudsColorB); + } + if (bUsingCustomBottomCloudsColor) + { + MemPutFast(0xB7C502, iBottomCloudsColorR); + MemPutFast(0xB7C504, iBottomCloudsColorG); + MemPutFast(0xB7C506, iBottomCloudsColorB); + } if (bUsingCustomWaterColor) { MemPutFast(0xB7C508, fWaterColorR); diff --git a/Client/multiplayer_sa/CMultiplayerSA.h b/Client/multiplayer_sa/CMultiplayerSA.h index 26b50b36b4..29a8c3c492 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.h +++ b/Client/multiplayer_sa/CMultiplayerSA.h @@ -21,6 +21,7 @@ class CRemoteDataSA; #define DEFAULT_NEAR_CLIP_DISTANCE ( 0.3f ) +#define DEFAULT_SHADOWS_OFFSET ( 0.013f ) // GTA default = 0.06f enum eRadioStationID { @@ -192,6 +193,58 @@ class CMultiplayerSA : public CMultiplayer int GetMoonSize(); void ResetMoonSize(); + void GetAmbientColor(float& red, float& green, float& blue); + bool SetAmbientColor(float red, float green, float blue); + bool ResetAmbientColor(); + + void GetAmbientObjectColor(float& red, float& green, float& blue); + bool SetAmbientObjectColor(float red, float green, float blue); + bool ResetAmbientObjectColor(); + + void GetDirectionalColor(float& red, float& green, float& blue); + bool SetDirectionalColor(float red, float green, float blue); + bool ResetDirectionalColor(); + + float GetSpriteSize(); + bool SetSpriteSize(float size); + bool ResetSpriteSize(); + + float GetSpriteBrightness(); + bool SetSpriteBrightness(float brightness); + bool ResetSpriteBrightness(); + + int16 GetPoleShadowStrength(); + bool SetPoleShadowStrength(int16 strength); + bool ResetPoleShadowStrength(); + + int16 GetShadowStrength(); + bool SetShadowStrength(int16 strength); + bool ResetShadowStrength(); + + float GetShadowsOffset(); + bool SetShadowsOffset(float offset); + bool ResetShadowsOffset(); + + float GetLightsOnGroundBrightness(); + bool SetLightsOnGroundBrightness(float brightness); + bool ResetLightsOnGroundBrightness(); + + void GetLowCloudsColor(int16& red, int16& green, int16& blue); + bool SetLowCloudsColor(int16 red, int16 green, int16 blue); + bool ResetLowCloudsColor(); + + void GetBottomCloudsColor(int16& red, int16& green, int16& blue); + bool SetBottomCloudsColor(int16 red, int16 green, int16 blue); + bool ResetBottomCloudsColor(); + + float GetCloudsAlpha1(); + bool SetCloudsAlpha1(float alpha); + bool ResetCloudsAlpha1(); + + float GetIllumination(); + bool SetIllumination(float illumination); + bool ResetIllumination(); + void SetNightVisionEnabled(bool bEnabled, bool bNoiseEnabled); void SetThermalVisionEnabled(bool bEnabled, bool bNoiseEnabled); bool IsNightVisionEnabled(); diff --git a/Client/sdk/game/CWeather.h b/Client/sdk/game/CWeather.h index 36fbf0dd78..3962b73c33 100644 --- a/Client/sdk/game/CWeather.h +++ b/Client/sdk/game/CWeather.h @@ -23,4 +23,32 @@ class CWeather virtual float GetAmountOfRain() = 0; virtual void SetAmountOfRain(float fAmount) = 0; virtual void ResetAmountOfRain() = 0; + + virtual float GetWetRoads() = 0; + virtual bool SetWetRoads(float fAmount) = 0; + virtual bool ResetWetRoads() = 0; + + virtual float GetFoggyness() = 0; + virtual bool SetFoggyness(float fAmount) = 0; + virtual bool ResetFoggyness() = 0; + + virtual float GetFog() = 0; + virtual bool SetFog(float fAmount) = 0; + virtual bool ResetFog() = 0; + + virtual float GetRainFog() = 0; + virtual bool SetRainFog(float fAmount) = 0; + virtual bool ResetRainFog() = 0; + + virtual float GetWaterFog() = 0; + virtual bool SetWaterFog(float fAmount) = 0; + virtual bool ResetWaterFog() = 0; + + virtual float GetSandstorm() = 0; + virtual bool SetSandstorm(float fAmount) = 0; + virtual bool ResetSandstorm() = 0; + + virtual float GetRainbow() = 0; + virtual bool SetRainbow(float fAmount) = 0; + virtual bool ResetRainbow() = 0; }; diff --git a/Client/sdk/game/Common.h b/Client/sdk/game/Common.h index 503f4c9021..3656553f87 100644 --- a/Client/sdk/game/Common.h +++ b/Client/sdk/game/Common.h @@ -1598,3 +1598,27 @@ namespace eSoundEffectParams HIGH_FREQ_RT_RATIO, }; } // namespace eSoundEffectParams + +enum eWorldProperty +{ + AMBIENT_COLOR, + AMBIENT_OBJ_COLOR, + DIRECTIONAL_COLOR, + SPRITE_SIZE, + SPRITE_BRIGHTNESS, + POLE_SHADOW_STRENGTH, + SHADOW_STRENGTH, + SHADOWS_OFFSET, + LIGHTS_ON_GROUND, + LOW_CLOUDS_COLOR, + BOTTOM_CLOUDS_COLOR, + CLOUDS_ALPHA1, + ILLUMINATION, + WEATHER_WET_ROADS, + WEATHER_FOGGYNESS, + WEATHER_FOG, + WEATHER_RAIN_FOG, + WEATHER_WATER_FOG, + WEATHER_SANDSTORM, + WEATHER_RAINBOW, +}; diff --git a/Client/sdk/multiplayer/CMultiplayer.h b/Client/sdk/multiplayer/CMultiplayer.h index 1981cbb33c..56b1b3c0b8 100644 --- a/Client/sdk/multiplayer/CMultiplayer.h +++ b/Client/sdk/multiplayer/CMultiplayer.h @@ -295,6 +295,58 @@ class CMultiplayer virtual int GetMoonSize() = 0; virtual void ResetMoonSize() = 0; + virtual void GetAmbientColor(float& red, float& green, float& blue) = 0; + virtual bool SetAmbientColor(float red, float green, float blue) = 0; + virtual bool ResetAmbientColor() = 0; + + virtual void GetAmbientObjectColor(float& red, float& green, float& blue) = 0; + virtual bool SetAmbientObjectColor(float red, float green, float blue) = 0; + virtual bool ResetAmbientObjectColor() = 0; + + virtual void GetDirectionalColor(float& red, float& green, float& blue) = 0; + virtual bool SetDirectionalColor(float red, float green, float blue) = 0; + virtual bool ResetDirectionalColor() = 0; + + virtual float GetSpriteSize() = 0; + virtual bool SetSpriteSize(float size) = 0; + virtual bool ResetSpriteSize() = 0; + + virtual float GetSpriteBrightness() = 0; + virtual bool SetSpriteBrightness(float brightness) = 0; + virtual bool ResetSpriteBrightness() = 0; + + virtual int16 GetPoleShadowStrength() = 0; + virtual bool SetPoleShadowStrength(int16 strength) = 0; + virtual bool ResetPoleShadowStrength() = 0; + + virtual int16 GetShadowStrength() = 0; + virtual bool SetShadowStrength(int16 strength) = 0; + virtual bool ResetShadowStrength() = 0; + + virtual float GetShadowsOffset() = 0; + virtual bool SetShadowsOffset(float offset) = 0; + virtual bool ResetShadowsOffset() = 0; + + virtual float GetLightsOnGroundBrightness() = 0; + virtual bool SetLightsOnGroundBrightness(float brightness) = 0; + virtual bool ResetLightsOnGroundBrightness() = 0; + + virtual void GetLowCloudsColor(int16& red, int16& green, int16& blue) = 0; + virtual bool SetLowCloudsColor(int16 red, int16 green, int16 blue) = 0; + virtual bool ResetLowCloudsColor() = 0; + + virtual void GetBottomCloudsColor(int16& red, int16& green, int16& blue) = 0; + virtual bool SetBottomCloudsColor(int16 red, int16 green, int16 blue) = 0; + virtual bool ResetBottomCloudsColor() = 0; + + virtual float GetCloudsAlpha1() = 0; + virtual bool SetCloudsAlpha1(float alpha) = 0; + virtual bool ResetCloudsAlpha1() = 0; + + virtual float GetIllumination() = 0; + virtual bool SetIllumination(float illumination) = 0; + virtual bool ResetIllumination() = 0; + virtual void DisableEnterExitVehicleKey(bool bDisabled) = 0; virtual void SetNightVisionEnabled(bool bEnabled, bool bNoiseEnabled) = 0; From 813aec8a04413b2263d1505c5e59ea3709df8918 Mon Sep 17 00:00:00 2001 From: samr46 Date: Fri, 7 Jun 2024 22:06:55 +0300 Subject: [PATCH 2/3] Add const qualifier for getters --- Client/game_sa/CWeatherSA.cpp | 14 ++++++------- Client/game_sa/CWeatherSA.h | 14 ++++++------- Client/multiplayer_sa/CMultiplayerSA.cpp | 26 ++++++++++++------------ Client/multiplayer_sa/CMultiplayerSA.h | 26 ++++++++++++------------ Client/sdk/game/CWeather.h | 14 ++++++------- Client/sdk/multiplayer/CMultiplayer.h | 26 ++++++++++++------------ 6 files changed, 60 insertions(+), 60 deletions(-) diff --git a/Client/game_sa/CWeatherSA.cpp b/Client/game_sa/CWeatherSA.cpp index 8300c5b9c1..c549aa08e1 100644 --- a/Client/game_sa/CWeatherSA.cpp +++ b/Client/game_sa/CWeatherSA.cpp @@ -63,7 +63,7 @@ void CWeatherSA::ResetAmountOfRain() MemCpy((LPVOID)0x72C686, &originalFstp2, 6); } -float CWeatherSA::GetWetRoads() +float CWeatherSA::GetWetRoads() const { return *(float*)0xC81308; } @@ -89,7 +89,7 @@ bool CWeatherSA::ResetWetRoads() return true; } -float CWeatherSA::GetFoggyness() +float CWeatherSA::GetFoggyness() const { return *(float*)0xC81300; } @@ -113,7 +113,7 @@ bool CWeatherSA::ResetFoggyness() return true; } -float CWeatherSA::GetFog() +float CWeatherSA::GetFog() const { return *(float*)0xC812FC; } @@ -137,7 +137,7 @@ bool CWeatherSA::ResetFog() return true; } -float CWeatherSA::GetRainFog() +float CWeatherSA::GetRainFog() const { return *(float*)0xC81410; } @@ -159,7 +159,7 @@ bool CWeatherSA::ResetRainFog() return true; } -float CWeatherSA::GetWaterFog() +float CWeatherSA::GetWaterFog() const { return *(float*)0xC81338; } @@ -183,7 +183,7 @@ bool CWeatherSA::ResetWaterFog() return true; } -float CWeatherSA::GetSandstorm() +float CWeatherSA::GetSandstorm() const { return *(float*)0xC812F4; } @@ -207,7 +207,7 @@ bool CWeatherSA::ResetSandstorm() return true; } -float CWeatherSA::GetRainbow() +float CWeatherSA::GetRainbow() const { return *(float*)0xC812E4; } diff --git a/Client/game_sa/CWeatherSA.h b/Client/game_sa/CWeatherSA.h index 25c4423302..8e6d970d1d 100644 --- a/Client/game_sa/CWeatherSA.h +++ b/Client/game_sa/CWeatherSA.h @@ -27,31 +27,31 @@ class CWeatherSA : public CWeather void SetAmountOfRain(float fAmount); void ResetAmountOfRain(); - float GetWetRoads(); + float GetWetRoads() const; bool SetWetRoads(float fAmount); bool ResetWetRoads(); - float GetFoggyness(); + float GetFoggyness() const; bool SetFoggyness(float fAmount); bool ResetFoggyness(); - float GetFog(); + float GetFog() const; bool SetFog(float fAmount); bool ResetFog(); - float GetRainFog(); + float GetRainFog() const; bool SetRainFog(float fAmount); bool ResetRainFog(); - float GetWaterFog(); + float GetWaterFog() const; bool SetWaterFog(float fAmount); bool ResetWaterFog(); - float GetSandstorm(); + float GetSandstorm() const; bool SetSandstorm(float fAmount); bool ResetSandstorm(); - float GetRainbow(); + float GetRainbow() const; bool SetRainbow(float fAmount); bool ResetRainbow(); diff --git a/Client/multiplayer_sa/CMultiplayerSA.cpp b/Client/multiplayer_sa/CMultiplayerSA.cpp index edea35a3ce..eae38cf0c2 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA.cpp @@ -2250,7 +2250,7 @@ void CMultiplayerSA::ResetWater() MemPut(0x7051D7, 184); } -void CMultiplayerSA::GetAmbientColor(float& red, float& green, float& blue) +void CMultiplayerSA::GetAmbientColor(float& red, float& green, float& blue) const { if (bUsingCustomAmbientColor) red = fAmbientColorR, green = fAmbientColorG, blue = fAmbientColorB; @@ -2273,7 +2273,7 @@ bool CMultiplayerSA::ResetAmbientColor() return true; } -void CMultiplayerSA::GetAmbientObjectColor(float& red, float& green, float& blue) +void CMultiplayerSA::GetAmbientObjectColor(float& red, float& green, float& blue) const { if (bUsingCustomAmbientObjectColor) red = fAmbientObjectColorR, green = fAmbientObjectColorG, blue = fAmbientObjectColorB; @@ -2296,7 +2296,7 @@ bool CMultiplayerSA::ResetAmbientObjectColor() return true; } -void CMultiplayerSA::GetDirectionalColor(float& red, float& green, float& blue) +void CMultiplayerSA::GetDirectionalColor(float& red, float& green, float& blue) const { if (bUsingCustomDirectionalColor) red = fDirectionalColorR, green = fDirectionalColorG, blue = fDirectionalColorB; @@ -2319,7 +2319,7 @@ bool CMultiplayerSA::ResetDirectionalColor() return true; } -float CMultiplayerSA::GetSpriteSize() +float CMultiplayerSA::GetSpriteSize() const { return *(float*)0xB7C4E0; } @@ -2342,7 +2342,7 @@ bool CMultiplayerSA::ResetSpriteSize() return true; } -float CMultiplayerSA::GetSpriteBrightness() +float CMultiplayerSA::GetSpriteBrightness() const { return *(float*)0xB7C4E4; } @@ -2365,7 +2365,7 @@ bool CMultiplayerSA::ResetSpriteBrightness() return true; } -int16 CMultiplayerSA::GetPoleShadowStrength() +int16 CMultiplayerSA::GetPoleShadowStrength() const { return *(int16*)0xB7C4EC; } @@ -2391,7 +2391,7 @@ bool CMultiplayerSA::ResetPoleShadowStrength() return true; } -int16 CMultiplayerSA::GetShadowStrength() +int16 CMultiplayerSA::GetShadowStrength() const { return *(int16*)0xB7C4E8; } @@ -2421,7 +2421,7 @@ bool CMultiplayerSA::ResetShadowStrength() return true; } -float CMultiplayerSA::GetShadowsOffset() +float CMultiplayerSA::GetShadowsOffset() const { return m_fShadowsOffset; } @@ -2438,7 +2438,7 @@ bool CMultiplayerSA::ResetShadowsOffset() return true; } -float CMultiplayerSA::GetLightsOnGroundBrightness() +float CMultiplayerSA::GetLightsOnGroundBrightness() const { return *(float*)0xB7C4F8; } @@ -2464,7 +2464,7 @@ bool CMultiplayerSA::ResetLightsOnGroundBrightness() return true; } -void CMultiplayerSA::GetLowCloudsColor(int16& red, int16& green, int16& blue) +void CMultiplayerSA::GetLowCloudsColor(int16& red, int16& green, int16& blue) const { if (bUsingCustomLowCloudsColor) red = iLowCloudsColorR, green = iLowCloudsColorG, blue = iLowCloudsColorB; @@ -2487,7 +2487,7 @@ bool CMultiplayerSA::ResetLowCloudsColor() return true; } -void CMultiplayerSA::GetBottomCloudsColor(int16& red, int16& green, int16& blue) +void CMultiplayerSA::GetBottomCloudsColor(int16& red, int16& green, int16& blue) const { if (bUsingCustomBottomCloudsColor) red = iBottomCloudsColorR, green = iBottomCloudsColorG, blue = iBottomCloudsColorB; @@ -2510,7 +2510,7 @@ bool CMultiplayerSA::ResetBottomCloudsColor() return true; } -float CMultiplayerSA::GetCloudsAlpha1() +float CMultiplayerSA::GetCloudsAlpha1() const { return *(float*)0xB7C538; } @@ -2528,7 +2528,7 @@ bool CMultiplayerSA::ResetCloudsAlpha1() return true; } -float CMultiplayerSA::GetIllumination() +float CMultiplayerSA::GetIllumination() const { return *(float*)0xB7C544; } diff --git a/Client/multiplayer_sa/CMultiplayerSA.h b/Client/multiplayer_sa/CMultiplayerSA.h index 58c2e4720d..66f48789f2 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.h +++ b/Client/multiplayer_sa/CMultiplayerSA.h @@ -196,55 +196,55 @@ class CMultiplayerSA : public CMultiplayer int GetMoonSize(); void ResetMoonSize(); - void GetAmbientColor(float& red, float& green, float& blue); + void GetAmbientColor(float& red, float& green, float& blue) const; bool SetAmbientColor(float red, float green, float blue); bool ResetAmbientColor(); - void GetAmbientObjectColor(float& red, float& green, float& blue); + void GetAmbientObjectColor(float& red, float& green, float& blue) const; bool SetAmbientObjectColor(float red, float green, float blue); bool ResetAmbientObjectColor(); - void GetDirectionalColor(float& red, float& green, float& blue); + void GetDirectionalColor(float& red, float& green, float& blue) const; bool SetDirectionalColor(float red, float green, float blue); bool ResetDirectionalColor(); - float GetSpriteSize(); + float GetSpriteSize() const; bool SetSpriteSize(float size); bool ResetSpriteSize(); - float GetSpriteBrightness(); + float GetSpriteBrightness() const; bool SetSpriteBrightness(float brightness); bool ResetSpriteBrightness(); - int16 GetPoleShadowStrength(); + int16 GetPoleShadowStrength() const; bool SetPoleShadowStrength(int16 strength); bool ResetPoleShadowStrength(); - int16 GetShadowStrength(); + int16 GetShadowStrength() const; bool SetShadowStrength(int16 strength); bool ResetShadowStrength(); - float GetShadowsOffset(); + float GetShadowsOffset() const; bool SetShadowsOffset(float offset); bool ResetShadowsOffset(); - float GetLightsOnGroundBrightness(); + float GetLightsOnGroundBrightness() const; bool SetLightsOnGroundBrightness(float brightness); bool ResetLightsOnGroundBrightness(); - void GetLowCloudsColor(int16& red, int16& green, int16& blue); + void GetLowCloudsColor(int16& red, int16& green, int16& blue) const; bool SetLowCloudsColor(int16 red, int16 green, int16 blue); bool ResetLowCloudsColor(); - void GetBottomCloudsColor(int16& red, int16& green, int16& blue); + void GetBottomCloudsColor(int16& red, int16& green, int16& blue) const; bool SetBottomCloudsColor(int16 red, int16 green, int16 blue); bool ResetBottomCloudsColor(); - float GetCloudsAlpha1(); + float GetCloudsAlpha1() const; bool SetCloudsAlpha1(float alpha); bool ResetCloudsAlpha1(); - float GetIllumination(); + float GetIllumination() const; bool SetIllumination(float illumination); bool ResetIllumination(); diff --git a/Client/sdk/game/CWeather.h b/Client/sdk/game/CWeather.h index 3962b73c33..41461142e7 100644 --- a/Client/sdk/game/CWeather.h +++ b/Client/sdk/game/CWeather.h @@ -24,31 +24,31 @@ class CWeather virtual void SetAmountOfRain(float fAmount) = 0; virtual void ResetAmountOfRain() = 0; - virtual float GetWetRoads() = 0; + virtual float GetWetRoads() const = 0; virtual bool SetWetRoads(float fAmount) = 0; virtual bool ResetWetRoads() = 0; - virtual float GetFoggyness() = 0; + virtual float GetFoggyness() const = 0; virtual bool SetFoggyness(float fAmount) = 0; virtual bool ResetFoggyness() = 0; - virtual float GetFog() = 0; + virtual float GetFog() const = 0; virtual bool SetFog(float fAmount) = 0; virtual bool ResetFog() = 0; - virtual float GetRainFog() = 0; + virtual float GetRainFog() const = 0; virtual bool SetRainFog(float fAmount) = 0; virtual bool ResetRainFog() = 0; - virtual float GetWaterFog() = 0; + virtual float GetWaterFog() const = 0; virtual bool SetWaterFog(float fAmount) = 0; virtual bool ResetWaterFog() = 0; - virtual float GetSandstorm() = 0; + virtual float GetSandstorm() const = 0; virtual bool SetSandstorm(float fAmount) = 0; virtual bool ResetSandstorm() = 0; - virtual float GetRainbow() = 0; + virtual float GetRainbow() const = 0; virtual bool SetRainbow(float fAmount) = 0; virtual bool ResetRainbow() = 0; }; diff --git a/Client/sdk/multiplayer/CMultiplayer.h b/Client/sdk/multiplayer/CMultiplayer.h index 7162991793..37d1e3efab 100644 --- a/Client/sdk/multiplayer/CMultiplayer.h +++ b/Client/sdk/multiplayer/CMultiplayer.h @@ -308,55 +308,55 @@ class CMultiplayer virtual int GetMoonSize() = 0; virtual void ResetMoonSize() = 0; - virtual void GetAmbientColor(float& red, float& green, float& blue) = 0; + virtual void GetAmbientColor(float& red, float& green, float& blue) const = 0; virtual bool SetAmbientColor(float red, float green, float blue) = 0; virtual bool ResetAmbientColor() = 0; - virtual void GetAmbientObjectColor(float& red, float& green, float& blue) = 0; + virtual void GetAmbientObjectColor(float& red, float& green, float& blue) const = 0; virtual bool SetAmbientObjectColor(float red, float green, float blue) = 0; virtual bool ResetAmbientObjectColor() = 0; - virtual void GetDirectionalColor(float& red, float& green, float& blue) = 0; + virtual void GetDirectionalColor(float& red, float& green, float& blue) const = 0; virtual bool SetDirectionalColor(float red, float green, float blue) = 0; virtual bool ResetDirectionalColor() = 0; - virtual float GetSpriteSize() = 0; + virtual float GetSpriteSize() const = 0; virtual bool SetSpriteSize(float size) = 0; virtual bool ResetSpriteSize() = 0; - virtual float GetSpriteBrightness() = 0; + virtual float GetSpriteBrightness() const = 0; virtual bool SetSpriteBrightness(float brightness) = 0; virtual bool ResetSpriteBrightness() = 0; - virtual int16 GetPoleShadowStrength() = 0; + virtual int16 GetPoleShadowStrength() const = 0; virtual bool SetPoleShadowStrength(int16 strength) = 0; virtual bool ResetPoleShadowStrength() = 0; - virtual int16 GetShadowStrength() = 0; + virtual int16 GetShadowStrength() const = 0; virtual bool SetShadowStrength(int16 strength) = 0; virtual bool ResetShadowStrength() = 0; - virtual float GetShadowsOffset() = 0; + virtual float GetShadowsOffset() const = 0; virtual bool SetShadowsOffset(float offset) = 0; virtual bool ResetShadowsOffset() = 0; - virtual float GetLightsOnGroundBrightness() = 0; + virtual float GetLightsOnGroundBrightness() const = 0; virtual bool SetLightsOnGroundBrightness(float brightness) = 0; virtual bool ResetLightsOnGroundBrightness() = 0; - virtual void GetLowCloudsColor(int16& red, int16& green, int16& blue) = 0; + virtual void GetLowCloudsColor(int16& red, int16& green, int16& blue) const = 0; virtual bool SetLowCloudsColor(int16 red, int16 green, int16 blue) = 0; virtual bool ResetLowCloudsColor() = 0; - virtual void GetBottomCloudsColor(int16& red, int16& green, int16& blue) = 0; + virtual void GetBottomCloudsColor(int16& red, int16& green, int16& blue) const = 0; virtual bool SetBottomCloudsColor(int16 red, int16 green, int16 blue) = 0; virtual bool ResetBottomCloudsColor() = 0; - virtual float GetCloudsAlpha1() = 0; + virtual float GetCloudsAlpha1() const = 0; virtual bool SetCloudsAlpha1(float alpha) = 0; virtual bool ResetCloudsAlpha1() = 0; - virtual float GetIllumination() = 0; + virtual float GetIllumination() const = 0; virtual bool SetIllumination(float illumination) = 0; virtual bool ResetIllumination() = 0; From a304adf075761d46dcf3c4d4969af6da4c08038f Mon Sep 17 00:00:00 2001 From: samr46 Date: Tue, 25 Jun 2024 20:51:11 +0300 Subject: [PATCH 3/3] Use ArgumentParser --- Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp index a6e480a1e2..96dd447921 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaWorldDefs.cpp @@ -58,7 +58,7 @@ void CLuaWorldDefs::LoadFunctions() {"getFPSLimit", GetFPSLimit}, {"getBirdsEnabled", GetBirdsEnabled}, {"getCoronaReflectionsEnabled", ArgumentParser}, - {"getWorldProperty", ArgumentParserWarn}, + {"getWorldProperty", ArgumentParser}, // World set funcs {"setTime", SetTime}, @@ -74,7 +74,7 @@ void CLuaWorldDefs::LoadFunctions() {"setWaveHeight", SetWaveHeight}, {"setMinuteDuration", SetMinuteDuration}, {"setGarageOpen", SetGarageOpen}, - {"setWorldSpecialPropertyEnabled", ArgumentParserWarn}, + {"setWorldSpecialPropertyEnabled", ArgumentParser}, {"setBlurLevel", SetBlurLevel}, {"setJetpackMaxHeight", SetJetpackMaxHeight}, {"setCloudsEnabled", SetCloudsEnabled}, @@ -99,7 +99,7 @@ void CLuaWorldDefs::LoadFunctions() {"setMoonSize", SetMoonSize}, {"setFPSLimit", SetFPSLimit}, {"setCoronaReflectionsEnabled", ArgumentParser}, - {"setWorldProperty", ArgumentParserWarn}, + {"setWorldProperty", ArgumentParser}, {"removeWorldModel", RemoveWorldBuilding}, {"restoreAllWorldModels", RestoreWorldBuildings}, {"restoreWorldModel", RestoreWorldBuilding},