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

HL25 HUD #412

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

HL25 HUD #412

wants to merge 7 commits into from

Conversation

a1batross
Copy link
Member

@a1batross a1batross commented Dec 21, 2023

This set of patches adds support for available since HL25 update HD set of sprite sheets.

Because not every player might like the new HUD look, there is a new cvar hud_allow_hd that limits the usage of HD sprites and reverts some style changes, like battery HUD being super close to the left and HUD numbers are shifted down a bit to match the icons (additionally, it fixes HUD inconsistency bug caused by this change, see ValveSoftware/halflife#3728).

There is no way to switch between old and new HUD by toggling hud_allow_hd cvar without restarting a level, so I wonder if we should use Xash3D's FCVAR_LATCH extended flag to notify the player that the change will be skipped until server restart.

@a1batross
Copy link
Member Author

a1batross commented Dec 21, 2023

I reverse-engineered the exact numbers (like switching between resolutions in GetSpriteRes and iHudNumbersYOffset) but I wrote the code the way I wanted, so for example the function I mentioned doesn't exist in decompiled client.so.

@tmp64
Copy link

tmp64 commented Dec 21, 2023

While the code matches HL, I think ammo bars should scale with HUD size for consistency

if( ScreenWidth >= 640 )
{
giABWidth = 20;
giABHeight = 4;
}
else
{
giABWidth = 10;
giABHeight = 2;
}

@a1batross
Copy link
Member Author

@tmp64 yeah, I checked that specifically in decompile, and they haven't touched that.
Dunno, it still looks good enough to me.

@FreeSlave
Copy link
Member

FreeSlave commented Dec 21, 2023

They also got the train sprite wrong as described in ValveSoftware/halflife#3510
But it's more of the resource issue.

@a1batross
Copy link
Member Author

@FreeSlave about train code not referencing train sprites hud.txt: I don't think the behavior should be changed that much.

@a1batross
Copy link
Member Author

@tmp64 I fixed the ammo bar scaling you mentioned in last commit.

@FreeSlave
Copy link
Member

FreeSlave commented Dec 22, 2023

Imagine the following situation.
The mod uses this code and provides sprites for high resolutions. Some sprites are larger than 256x256 and the pre-anniversary goldsource wouldn't be able to load them. However the developer wants the mod to work on both current and legacy branches.
So we need to detect whether the client is running on the legacy version, and not load high res sprites in this case and treat everything as if hud_allow_hd was set to 0.

@a1batross
Copy link
Member Author

a1batross commented Dec 22, 2023 via email

@nekonomicon
Copy link
Member

Is it ready to merge?

@a1batross
Copy link
Member Author

I'm too lazy to check whether legacy GoldSrc can support this.

Until we get confirmation that it works, or otherwise I make some detection to disable the HD HUD, I don't think it's ready to be merged.

@a1batross
Copy link
Member Author

Also, this:

There is no way to switch between old and new HUD by toggling hud_allow_hd cvar without restarting a level, so I wonder if we should use Xash3D's FCVAR_LATCH extended flag to notify the player that the change will be skipped until server restart.

I'm still not sure about this. Should we just use LATCH flag from Xash3D (and hope that it won't break anything for GoldSrc) or do some workaround?

@FreeSlave
Copy link
Member

As I said before, before merging we need to add a dynamic check for the legacy GoldSource version so mods won't try loading highres sprites when running on steam_legacy.

@tmp64
Copy link

tmp64 commented Jan 19, 2024

@FreeSlave
Copy link
Member

FreeSlave commented Jan 19, 2024

It's not what I'm talking about.
You can't rely on checking for resources.
Imagine an author wants a mod to run on both steam_legacy and the current HL versions, using benefits of support for highres sprites when it's possible. The old engine doesn't support big sprites (I actually need to check what happens if it tries to load them).

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

4 participants