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

Avoid intro camera switching when only 1 trigger_camera available #873

Merged
merged 4 commits into from
Nov 26, 2023

Conversation

dystopm
Copy link
Contributor

@dystopm dystopm commented Oct 4, 2023

This PR omits the logic that changes the player's introduction camera to it (the same), which forces a rather annoying change of angles because there is no behavior that verifies if there is more than just one trigger_camera.

  • m_bMapHasCameras member from CSGameRules changed type to int, which is the same as BOOL internally, and it counts the number of trigger_camera entities in the map.
    • It is cached once on ClientPutInServer.
    • Default value in the construction of the CSGameRules class is now -1 (ToDo: I don't think I need to enclose that with the fixes macro).
  • m_fIntroCamTime is assigned to 0.0 if there's just only one trigger_camera, so it wont force an unnecesary camera updating every 6 seconds. A simple condition was added in the related thinking function JoiningThink.
  • Extra: code cleaning inside CheckLevelInitialized on the counting of info_player_* entities using the added function UTIL_CountEntities.

@fl0werD
Copy link
Contributor

fl0werD commented Oct 8, 2023

m_bMapHasCameras is unused. You can check if the next camera is available and that’s it.

@justgo97
Copy link

justgo97 commented Oct 8, 2023

A better spot than ClientPutInServer to cache the number of trigger_camera would be CheckMapConditions.

@dystopm
Copy link
Contributor Author

dystopm commented Oct 8, 2023

m_bMapHasCameras is unused. You can check if the next camera is available and that’s it.

Well I think I gave it one 😄

A better spot than ClientPutInServer to cache the number of trigger_camera would be CheckMapConditions.

I mean, the caching isn't an issue, only in the fact a modder is dynamically changing trigger_cameras in world, which tbh is strange. Any suggestions?

@justgo97
Copy link

justgo97 commented Oct 9, 2023

I mean, the caching isn't an issue, only in the fact a modder is dynamically changing trigger_cameras in world, which tbh is strange. Any suggestions?

I think it's up to the modder to also modify m_bMapHasCameras when they alter trigger_cameras in world, recaching the value when a trigger_camera is created/destroyed is also an option, but without that it's fine too.

@s1lentq s1lentq merged commit fba9a33 into s1lentq:master Nov 26, 2023
4 checks passed
@dystopm dystopm deleted the introcamera_fix branch August 13, 2024 01:35
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.

4 participants