Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add new functions related to underwater effects #3463

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

Open
XJMLN wants to merge 13 commits into multitheftauto:master
base: master
Choose a base branch
Loading
from XJMLN:feature/underwater-effect

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

esmail9900, Proxy-99, jayceon123, Nico8340, Wannacry-ops, Fernando-A-Rocha, and YSAFE reacted with heart emoji Proxy-99 and Fernando-A-Rocha reacted with rocket emoji
Copy link
Contributor

Proxy-99 commented Jun 12, 2024
edited
Loading

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

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 reacted with thumbs up emoji

Copy link
Contributor

Proxy-99 commented Jun 12, 2024
edited
Loading

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

Copy link
Contributor

Proxy-99 commented Jun 12, 2024
edited
Loading

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

Copy link
Member

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

XJMLN reacted with thumbs up emoji

@XJMLN XJMLN requested a review from botder June 26, 2024 21:40
Copy link
Contributor

Good job, but please address the requested changed

Copy link

YSAFE commented Jan 20, 2025

Bump?

Copy link
Contributor

Proxy-99 commented Feb 7, 2025
edited
Loading

can you fix the build @XJMLN

 D:\a\mtasa-blue\mtasa-blue\Client\multiplayer_sa\CMultiplayerSA.h(260,10): error C3668: 'CMultiplayerSA::SetUnderwaterEffectEnabled': method with override specifier 'override' did not override any base class methods [D:\a\mtasa-blue\mtasa-blue\Build\Multiplayer SA.vcxproj]
 D:\a\mtasa-blue\mtasa-blue\Client\multiplayer_sa\CMultiplayerSA.h(261,10): error C3668: 'CMultiplayerSA::SetUnderwaterEffectSpeed': method with override specifier 'override' did not override any base class methods [D:\a\mtasa-blue\mtasa-blue\Build\Multiplayer SA.vcxproj]
 "D:\a\mtasa-blue\mtasa-blue\Build\MTASA.sln" (default target) (1) ->
 "D:\a\mtasa-blue\mtasa-blue\Build\Client Deathmatch.vcxproj" (default target) (18) ->
 D:\a\mtasa-blue\mtasa-blue\Client\mods\deathmatch\logic\luadefs\CLuaCameraDefs.cpp(509,22): error C2511: 'bool CLuaCameraDefs::SetCameraUnderwaterEffectSpeed(float,std::optional<float>)': overloaded member function not found in 'CLuaCameraDefs' [D:\a\mtasa-blue\mtasa-blue\Build\Client 

@FileEX FileEX added enhancement New feature or request feedback Further information is requested labels Aug 24, 2025
return true;
}

bool CLuaCameraDefs::SetCameraUnderwaterEffectSpeed(float fSpeed, std::optional<float> fFrequency)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incompatible with the declaration given in the header: static bool SetCameraUnderwaterEffectSpeed(float speed, float frequency);

Copy link
Member

tederis commented Sep 24, 2025

@XJMLN Please, fix the project build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tederis tederis tederis left review comments

@FileEX FileEX FileEX requested changes

@botder botder Awaiting requested review from botder

+3 more reviewers

@TheNormalnij TheNormalnij TheNormalnij left review comments

@TracerDS TracerDS TracerDS requested changes

@Proxy-99 Proxy-99 Proxy-99 requested changes

Reviewers whose approvals may not affect merge requirements

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

enhancement New feature or request feedback Further information is requested

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add a way to use the "underwater camera effect"

AltStyle によって変換されたページ (->オリジナル) /