Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new functions related to underwater effects #3463

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

XJMLN
Copy link
Contributor

@XJMLN XJMLN commented Jun 12, 2024

Client functions

  • setCameraUnderwaterEffectEnabled(bool state) - Enable or disable the underwater effect. This function does not affect the default diving behavior.
  • setCameraUnderwaterEffectSpeed(float speed, float frequency) - Change the speed and frequency of the underwater effect
  • setCameraUnderwaterDarkness(bool state, float maxDarknessDepth) - Enable or disable the screen getting darker as we dive deeper underwater. We can also set the depth at which the screen goes completely dark.
  • getCameraUnderwaterEffect() -> bool enabled, float speed, float frequency
  • getCameraUnderwaterDarkness() -> bool enabled, float maxDarknessDepth
  • resetCameraUnderwaterEffect() - Reset the underwater effect state, speed and frequency to their default values
  • resetCameraUnderwaterDarkness() - Reset the underwater darkness effect state and maximum darkness depth to their default values

Resolves #1297

@Proxy-99
Copy link
Contributor

Proxy-99 commented Jun 12, 2024

Great! We can fix #2598 by checking if the underwater effect is on, maybe after this PR merged?

@XJMLN
Copy link
Contributor Author

XJMLN commented Jun 12, 2024

Currently, getCameraUnderwaterEffect will return true only if it was enabled by setCameraUnderwaterEffectEnabled. I don't know if this is valid; maybe I should additionally check the value of CWeather::UnderWaterness(0xC8132C), which is used to enable this effect and changing the weather to ID 20 while underwater. Then getCameraUnderwaterEffect would return true in that case.

@Proxy-99
Copy link
Contributor

Proxy-99 commented Jun 12, 2024

Currently, getCameraUnderwaterEffect will return true only if it was enabled by setCameraUnderwaterEffectEnabled. I don't know if this is valid; maybe I should additionally check the value of CWeather::UnderWaterness(0xC8132C), which is used to enable this effect and changing the weather to ID 20 while underwater. Then getCameraUnderwaterEffect would return true in that case.

I think we should be able to check the effect anytime without relying on setCameraUnderwaterEffectEnabled

@Proxy-99
Copy link
Contributor

Proxy-99 commented Jun 12, 2024

resetCameraUnderwaterEffect() should not this also reset darkness too

and getCameraUnderwaterEffect() should not also get the darkness level too
instead of calling another function to check

@TheNormalnij
Copy link
Contributor

Nice job!
Reset effects when a player connect to a new server. please

Client/sdk/multiplayer/CMultiplayer.h Outdated Show resolved Hide resolved
Client/sdk/multiplayer/CMultiplayer.h Outdated Show resolved Hide resolved
Client/multiplayer_sa/CMultiplayerSA_Postprocess.cpp Outdated Show resolved Hide resolved
Client/multiplayer_sa/CMultiplayerSA_Postprocess.cpp Outdated Show resolved Hide resolved
Client/multiplayer_sa/CMultiplayerSA_Postprocess.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/luadefs/CLuaCameraDefs.h Outdated Show resolved Hide resolved
Client/multiplayer_sa/CMultiplayerSA.h Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
@XJMLN XJMLN requested a review from botder June 26, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way to use the "underwater camera effect"
6 participants