|
15 | 15 | #define HOOKPOS_GrainEffect_RainModifier 0x705078 |
16 | 16 | #define HOOKPOS_GrainEffect_OverlayModifier 0x705091 |
17 | 17 |
|
| 18 | +#define VAR_CPostEffects_WaterEnable 0xC402D3 |
| 19 | +#define VAR_CPostEffects_WaterSpeed 0x8D5138 |
| 20 | +#define VAR_CPostEffects_WaterFreq 0x8D513C |
| 21 | +#define VAR_CPostEffects_WaterDepthDarkessEnabled 0x8D5144 |
| 22 | +#define VAR_CPostEffects_WaterFullDarknessDepth 0x8D5148 |
| 23 | +#define VAR_CPostEffects_WaterFxStartUnderWaterness 0x8D514C |
| 24 | +#define VAR_CWeather_UnderWaterness 0xC8132C |
| 25 | + |
| 26 | +#define DEFAULT_UNDERWATER_EFFECT_SPEED ( 0.0015f ) |
| 27 | +#define DEFAULT_UNDERWATER_EFFECT_FREQUENCY ( 0.04f ) |
| 28 | +#define DEFAULT_UNDERWATER_FULL_DARKNESS_DEPTH ( 90.0f ) |
| 29 | + |
18 | 30 | namespace GrainEffect |
19 | 31 | { |
20 | 32 |
|
@@ -154,22 +166,33 @@ void CMultiplayerSA::SetNightVisionEnabled(bool bEnabled, bool bNoiseEnabled) |
154 | 166 | } |
155 | 167 | } |
156 | 168 |
|
157 | | -void CMultiplayerSA::SetUnderwaterEffectEnabled(bool bEnabled) |
| 169 | +void CMultiplayerSA::SetUnderwaterEffectEnabled(bool isEnabled) |
158 | 170 | { |
159 | | - MemPutFast<BYTE>(0xC402D3, bEnabled ? 1 : 0); |
| 171 | + MemPutFast<uint8_t>(VAR_CPostEffects_WaterEnable, isEnabled ? 1 : 0); |
160 | 172 | } |
161 | 173 |
|
162 | | -void CMultiplayerSA::SetUnderwaterEffectSpeed(float fSpeed, float fFrequency) |
| 174 | +void CMultiplayerSA::SetUnderwaterEffectSpeed(float speed, float frequency) |
163 | 175 | { |
164 | | - MemPutFast<float>(0x8D5138, fSpeed); |
165 | | - MemPutFast<float>(0x8D513C, fFrequency); |
| 176 | + MemPutFast<float>(VAR_CPostEffects_WaterSpeed, speed); |
| 177 | + MemPutFast<float>(VAR_CPostEffects_WaterFreq, frequency); |
| 178 | +} |
| 179 | + |
| 180 | +void CMultiplayerSA::SetUnderwaterDarkness(bool isEnabled, float fullDarknessDepth) |
| 181 | +{ |
| 182 | + MemPutFast<uint8_t>(VAR_CPostEffects_WaterDepthDarkessEnabled, isEnabled ? 1 : 0); |
| 183 | + |
| 184 | + MemPutFast<float>(VAR_CPostEffects_WaterFullDarknessDepth, fullDarknessDepth); |
166 | 185 | } |
167 | 186 |
|
168 | | -void CMultiplayerSA::SetUnderwaterDarkness(bool bEnabled, float fFullDarknessDepth) |
| 187 | +void CMultiplayerSA::ResetUnderwaterEffect() |
169 | 188 | { |
170 | | - MemPutFast<BYTE>(0x8D5144, bEnabled ? 1 : 0); |
| 189 | + this->SetUnderwaterEffectEnabled(false); |
| 190 | + this->SetUnderwaterEffectSpeed(DEFAULT_UNDERWATER_EFFECT_SPEED, DEFAULT_UNDERWATER_EFFECT_FREQUENCY); |
| 191 | +} |
171 | 192 |
|
172 | | - MemPutFast<float>(0x8D5148, fFullDarknessDepth); |
| 193 | +void CMultiplayerSA::ResetUnderwaterDarkness() |
| 194 | +{ |
| 195 | + this->SetUnderwaterDarkness(false, DEFAULT_UNDERWATER_FULL_DARKNESS_DEPTH); |
173 | 196 | } |
174 | 197 |
|
175 | 198 | void CMultiplayerSA::SetThermalVisionEnabled(bool bEnabled, bool bNoiseEnabled) |
@@ -202,22 +225,17 @@ bool CMultiplayerSA::IsThermalVisionEnabled() |
202 | 225 | return (*(BYTE*)0xC402B9 == 1); |
203 | 226 | } |
204 | 227 |
|
205 | | -std::tuple<bool, float, float> CMultiplayerSA::GetUnderwaterEffect() |
| 228 | +void CMultiplayerSA::GetUnderwaterEffect(bool& isEnabled, float& speed, float& frequency) |
206 | 229 | { |
207 | | - bool bEnabled = (*(BYTE*)0xC402D3 == 1) || (*(float*)0xC8132C) >= 0.535f; |
208 | | - float fSpeed = (*(float*)0x8D5138); |
209 | | - float fFrequency = (*(float*)0x8D513C); |
210 | | - |
211 | | - return std::tuple<bool, float, float>(bEnabled, fSpeed, fFrequency); |
| 230 | + isEnabled = (*(uint8_t*)VAR_CPostEffects_WaterEnable == 1) || (*(float*)VAR_CWeather_UnderWaterness) >= (*(float*)VAR_CPostEffects_WaterFxStartUnderWaterness); |
| 231 | + speed = (*(float*)VAR_CPostEffects_WaterSpeed); |
| 232 | + frequency = (*(float*)VAR_CPostEffects_WaterFreq); |
212 | 233 | } |
213 | 234 |
|
214 | | - |
215 | | -std::tuple<bool, float> CMultiplayerSA::GetUnderwaterDarkness() |
| 235 | +void CMultiplayerSA::GetUnderwaterDarkness(bool& isEnabled, float& fullDarknessDepth) |
216 | 236 | { |
217 | | - bool bEnabled = (*(BYTE*)0x8D5144); |
218 | | - float fFullDarknessDepth = (*(float*)0x8D5148); |
219 | | - |
220 | | - return std::tuple<bool, float>(bEnabled, fFullDarknessDepth); |
| 237 | + isEnabled = (*(uint8_t*)VAR_CPostEffects_WaterDepthDarkessEnabled); |
| 238 | + fullDarknessDepth = (*(float*)VAR_CPostEffects_WaterFullDarknessDepth); |
221 | 239 | } |
222 | 240 |
|
223 | 241 | void CMultiplayerSA::InitHooks_Postprocess() |
|
0 commit comments