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

vscript vgui HUD visibility control #213

Merged
merged 9 commits into from
Nov 21, 2022

Conversation

samisalreadytaken
Copy link

@samisalreadytaken samisalreadytaken commented Nov 1, 2022

I think this might be the best way to handle HUD visibility; this wasn't part of the main PR because I just hadn't thought about this issue for many months.

Global hidehud bits set the visibility of multiple elements at once, which is not ideal at all. For example with the existing custom HUDs (CSGO and TF2) using the previous method, there is no item pickup icons, no zoom or damage indicators.

This allows individual management of every HUD element listed below

CAchievementNotificationPanel
CHUDAutoAim
CHUDQuickInfo
CHudAmmo
CHudAnimationInfo
CHudBattery
CHudChat
CHudCloseCaption
CHudCommentary
CHudCredits
CHudCrosshair
CHudDamageIndicator
CHudDeathNotice
CHudFilmDemo
CHudFlashlight
CHudGeiger
CHudHDRDemo
CHudHealth
CHudHintDisplay
CHudHintKeyDisplay
CHudHistoryResource
CHudLocator
CHudMenu
CHudMessage
CHudPoisonDamageIndicator
CHudPosture
CHudSecondaryAmmo
CHudSquadStatus
CHudSuitPower
CHudTrain
CHudVehicle
CHudWeapon
CHudWeaponSelection
CHudZoom
CMapOverview
CPDumpPanel

Two things I'm uncertain about,

the namespace of this function:

vgui.SetHudElementVisible( "CHudCrosshair", false );

SetHudElementVisible( "CHudCrosshair", false );

and the capitalisation of 'hud':

SetHudElementVisible( "CHudCrosshair", false );

SetHUDElementVisible( "CHudCrosshair", false );

PR Checklist

  • My PR follows all guidelines in the CONTRIBUTING.md file
  • My PR targets a develop branch OR targets another branch with a specific goal in mind

Copy link
Member

@Blixibon Blixibon left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I think the function's namespace and the current capitalization of Hud work well as-is.

@samisalreadytaken samisalreadytaken force-pushed the vscript_vgui-patch branch 2 times, most recently from ca47f40 to 3a4249b Compare November 8, 2022 21:46
@samisalreadytaken samisalreadytaken marked this pull request as draft November 10, 2022 15:56
@Blixibon
Copy link
Member

Is there any reason in particular this was marked as a draft?

I was planning to merge this for Mapbase v7.1, and while it's okay if you have reasons for this to not be merged yet, I would either have to wait for this PR or remove the current SetHUDHiddenBits functionality separately before I can release the update.

@samisalreadytaken
Copy link
Author

samisalreadytaken commented Nov 17, 2022

I set it to draft as I was fixing some bugs, but then I noticed more issues to resolve, I thought I would just include them here (let me know if you think the non-vgui fixes should be a separate PR).

a1c8dba

3D skybox angle calculation is reduced from angle -> vector -> transform -> normalise -> matrix -> quaternion -> angle & rotate into angle -> matrix -> concat -> angle.

55b8c8d

fake_worldportal optimisation also reduces multiple angle/matrix/vector conversions into simple matrix calculations.

b42086c

This clipping plane fix technically changes what the entity used to display, but the existing values made no sense. Here is a video comparing old and new: https://youtu.be/4AJ5tbOAGMw


The worldportal optimisation changes some existing questionable design choices.

In 7.0, brush angles are used in view transformation, which is an issue on its own as brushes never have any angles unless manually input by the user. Map-placed brushes with render target faces in different directions will result in inconsistent renders.

This could have been avoided by choosing to implement Portal 2's linked_portal_door entity behaviour, using 2 point entities which could be oriented freely; however the m_PlaneAngles offset angle (which also modifies the clip plane) can be used to simulate the rotation of the portal surface.

I would consider this inconsistency a bug, hence the fix to ignore the brush entity angles.

@samisalreadytaken samisalreadytaken marked this pull request as ready for review November 17, 2022 07:37
Consistent and descriptive variable names, simplified calculations.
Copy link
Member

@Blixibon Blixibon left a comment

Choose a reason for hiding this comment

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

This looks good to me, and I'm alright with including these changes in this PR.

I really appreciate that you optimized the fake worldportals and 3D skybox angles. I didn't know much about what I was doing when I designed them and I was kind of embarrassed by how sloppy their implementation was.

@Blixibon Blixibon merged commit 4cc1816 into mapbase-source:develop Nov 21, 2022
VDeltaGabriel pushed a commit to Project-P2009/p2009_sdk that referenced this pull request Apr 27, 2023
…vgui-patch

vscript vgui HUD visibility control
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.

None yet

2 participants