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

Support CstDoom3 GUIs for aspect-ratio-independent HUD #641

Merged
merged 4 commits into from
Jan 22, 2025

Conversation

DanielGibson
Copy link
Member

@DanielGibson DanielGibson commented Jan 18, 2025

As requested in #324.
You won't see any difference unless you use CstDoom3's GUI files. But note that you can't just use their .pk4 files, because they contain other things incompatible with dhewm3 (I didn't port any gameplay changes from CstDoom3).

For the basegame I prepared this .pk4 (rename the .zip to .pk4 after download, Github doesn't support attaching .pk4 files): z_cstd3_guis.zip
It's for the base game, so put it into Doom3/base/, next to pak000.pk4 etc.

Also note that old savegames will stop working once you add z_cstd3_guis.pk4.

I'd appreciate if someone else could create cleaner .pk4s with .gui files for both the base game and d3xp and upload them somewhere, so I can link them on the dhewm3 page once this is merged.
I'm not gonna ship them with dhewm3, for license reasons and because so far dhewm3 could avoid shipping any own gamedata and I'd like to keep it like that, if possible.

@DanielGibson
Copy link
Member Author

Testbuilds for Windows under Artifacts: https://github.com/dhewm/dhewm3/actions/runs/12840240228

@DanielGibson
Copy link
Member Author

Note that neither CstDoom3 nor dhewm3 with those changes has widescreen menus or a widescreen PDA. But the HUD is widescreen now.
And at least in dhewm3 the menus and PDA have the correct aspect ratio, while in CstDoom3 they are stretched in widescreen resolutions.

It might be possible to create a widescreen-compatible main menu and/or PDA with thist CstDoom3 anchor stuff. They didn't do that though, and I have no time/motivation to try it myself.
Would love to see the results if someone else tries it, though!

@Sol1vaN
Copy link

Sol1vaN commented Jan 21, 2025

Hi Daniel! many thanks for your effort! I really appreciate it!
However, it seems like it doesn't work, look:

I've tested with dhewm3-1.5.4 1305 and dhewm3 1.5.4pre 1305

without z_cstd3_guis.pk4
cst3 no

with z_cstd3_guis.pk4
cst3 yes

z_cstd3_guis.pk4 log
cst3 yes log

i'll try to fin what happens and ill tell you.

@DanielGibson
Copy link
Member Author

DanielGibson commented Jan 21, 2025

Thanks for testing! :)

However,

I've tested with dhewm3-1.5.4 1305 and dhewm3 1.5.4pre 1305

those are old versions, it should be 1.5.5pre, and you specifically need to use the dhewm3.exe from https://github.com/dhewm/dhewm3/actions/runs/12840240228/artifacts/2450198235 (that I linked above), because all others don't have the CstDoom3 code

@Sol1vaN
Copy link

Sol1vaN commented Jan 21, 2025

this time the pk4 load fine, but still don't have effect on HUD.
image
shot00005

@DanielGibson
Copy link
Member Author

oh right, one thing I forgot: you have to set the cst_hudAdjustAspect CVar to 1, for whatever reason it defaults to 0.
I should change that..

those GUIs are aspectratio-independent

doesn't properly work yet, esp. together with my hack that makes sure
menus are rendered in 4:3
In idWindow::Redraw(), I had to make sure the menu scale fix (which,
if enabled for a window, renders that in 4:3 with empty or black bars
on the side if needed for widescreen etc, instead of stretching it)
is disabled if a window uses CST anchors, because the CST anchor code
also adjusts for the display aspect ratio and if we do both, things get
distorted in the other way.

The biggest change is that idDeviceContext::DrawStretchPic(Rotated) now
has code to adjust the coordinates for both CST and the menu scale fix,
so idDeviceContext::AdjustCoords() is mostly obsolete - it's only still
used by idRenderWindow.
Unlike DstDoom3 now that extra adjustCoords argument to those Draw
functions indicates that any coordinate adjustment should be done, so
if it's set by a caller, it's set to true.

I removed idDeviceContext::AdjustCursorCoords() because it was only used
in one place anyway
incl. backwards compat for older savegames.
only partly useful: old savegames only work if you didn't change the
gamedata, with the CstDoom3 .gui files, loading them crashes. I don't
think that can be avoided, apparently Doom3 has no way to detect that
the GUIs have changed?
If GUIs with CST anchors are there, they should be displayed correctly.
With standard GUIs this doesn't make a difference, so it doesn't hurt.
@DanielGibson
Copy link
Member Author

Does it work with the CVar set to 1?
There's also a new testbuild that sets it to 1 by default, but that wouldn't help you because it should already be saved with 0 in your config - so you'd still have to change the CVar manually (or delete your dhewm3.cfg).

Anyway, the updated binaries for Windows can be downloaded here (under "Artifacts"): https://github.com/dhewm/dhewm3/actions/runs/12878746410?pr=641

@Sol1vaN
Copy link

Sol1vaN commented Jan 21, 2025

Hi Daniel, sorry for don't answer you.
Recently I've come back from my work.

I've tested the cst_hudAdjustAspect 1 and yes! this work flawessly!
image

@DanielGibson
Copy link
Member Author

Thanks a lot for testing, good to hear it works for you as well!

@DanielGibson DanielGibson merged commit 63b84a8 into dhewm:master Jan 22, 2025
4 checks passed
@Sol1vaN
Copy link

Sol1vaN commented Jan 22, 2025

but... there's a chance to implement com_gameHz and com_preciseTic on this branch? 😌

@DanielGibson
Copy link
Member Author

I will eventually rebase the code of #585 to the then-current master branch so it will include this.

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

Successfully merging this pull request may close these issues.

2 participants