HUD component visibility state handling#5028
Conversation
Implemented owner-aware HUD visibility: - `showhud` and the full-screen map no longer overwrite each other’s state. - `isPlayerHudComponentVisible` now respects global HUD visibility. - Radar child components respect the main radar’s state. - Reset behavior clears stale map/HUD state. - No migration, network, or component-ID changes. - Formatting, project generation, and source-level checks passed. - Nothing was staged, committed, or pushed; runtime testing remains.
|
What makes this PR better than #5027 ? |
|
@FileEX Apologies, this PR was meant to stay as a draft because I wasn’t done finalizing it yet. I’ve prioritized it and pushed the remaining changes so it doesn’t become stale I've incorporated your suggestions and made some further improvements to how HUD visibility is handled. Compared with the other PR, I think this approach is more complete because it fixes the underlying issue while preserving the existing behavior for scripts. It also keeps the requested HUD state separate from temporary suppression and effective visibility, which avoids changing the meaning of the existing API |
|
At the moment, your PR replicates the behavior of #5027, including adding a new argument to the function 👀 |
I compared it with mine just now, and at this point they provide essentially the same API and behavior. Though mine is somewhat smaller and avoids the suppression enum, bitset, and additional state methods, but that is an implementation trade off rather than a clear advantage over #5027. I don't think the remaining differences are enough to justify using my PR. There are still a couple of smaller implementation details from this PR that may be useful there such as:
Basically your PR suggestions. You can close this one in favor of #5027, I don't mind it! |
|
Closing in favor of #5027 |
Summary
Updated
isPlayerHudComponentVisibleto report whether a HUD component can actually be drawn, including the globalshowhudstate and fullscreen map suppression.Radar child components now follow the parent radar state without losing their own visibility settings.
Motivation
Previously,
isPlayerHudComponentVisibleonly checked the state of the requested component. This meant the radar could be hidden byshowhudwhile the function still returnedtrue.The fullscreen player map also used the same global HUD state. Closing the map could re-enable a HUD that the player had already hidden with
showhud.For example, a resource might display a custom minimap only while the GTA radar is hidden. If the API incorrectly reports that the radar is still visible, the resource cannot reliably decide when to show its replacement.
Fixes #5026.
Test plan
Runtime
showhudhid the radar, butisPlayerHudComponentVisible("radar")still returnedtrue.falsewhile the HUD was hidden and returnedtrueafter restoring it.showhud, and restoring the HUD kept the radar hidden until it was explicitly restored.showhud.radar_map,radar_blips, andradar_altimeterfollowed the parent radar state while keeping their own visibility settings.Builds and Tests
Debug | Win32: Client build passed.Release | Win32: Client build passed.clang-format.Checklist