disables partial vid_restarts, hopefully works around issues like
https://github.com/dhewm/dhewm3/issues/587#issuecomment-2206937752
Note that resizing the window by dragging it does *not* call vid_restart
at all, so if you're having issues that are fixed by a full vid_restart
you should also set `r_windowResizable 0`
- screenshots on native wayland (SDL_VIDEODRIVER=wayland) were black,
at least on Gnome
=> fixed(?) by reading from the default (back) buffer instead of
the front buffer
- after taking a screenshot, resizing the window (or switching to
fullscreen) was broken (window remained black or became invisible
or partly contained garbage), both with native wayland and xwayland
=> fixed by restoring the glReadBuffer state after reading the pixels
assert( ret.width == glConfig.winWidth
&& ret.height == glConfig.winHeight );
in GLimp_GetCurState() triggered, because SDL_GetWindowSize(),
which was used to set glConfig.winWidth/Height in
GLimp_UpdateWindowSize(), returned different values than
SDL_GetWindowDisplayMode().
Now use SDL_GetWindowDisplayMode() in GLimp_UpdateWindowSize() so it's
at least consistent.
However it seems like SDL_GetWindowSize() returns the correct values
(IN THAT CASE), because with this change the mouse cursor doesn't work
that well (in the specific case described above).
In the end this is an SDL or Wayland bug or something, and I can only
recommend not using "real" fullscreen mode with Wayland, as it's fake
anyway (Wayland doesn't allow switching the display resolution, so
you get a magically scaled borderless fullscreen window at best)
Now the CVars are set immediately and "Apply" only does
`vid_restart partial`, while "Reset" resets the CVars to the values
that were set when opening the menu.
This also works the other way around: Changing a CVar (in the console
or other menu or r_fullscreen with Alt-Enter) is immediately reflected
in the menu.
Furthermore, "fullscreen desktop" now is its own setting (=> can be set
even if windowed mode is selected), to accommodate switchting between
windowed and fullscreen with Alt-Enter
it's queried from SDL so it should be up-to-date.
Using it in GLimp_SetScreenParms(), as it mostly did the same SDL calls
to get the current state for the partial vid_restart
Toggling with Alt-Enter relies on idRenderSystem::IsFullScreen() which
returns glConfig.isFullscreen
That can only work if GLimp_SetScreenParms() actually sets
glConfig.isFullscreen
Thanks j4reporting for reporting this! :)
"vid_restart partial" only changes the window size or its fullscreen
(or windowed) state, without recreating everything.
If that fails (or antialiasing settings have changed), it will fall back
to a full vid_restart (this behavior is different than original
"vid_restart partial" that probably was implemented in Vanilla Doom3
but not dhewm3)
This is used for Alt-Enter (which toggles between fullscreen and
windowed state) and when pressing the Apply button in the new Video Menu
incl. setting in SettingsMenu
With SDL 2.0.5 and newer this change is applied immediately,
2.0.0 to 2.0.4 need a vid_restart
(with SDL1.2 we don't support it at all)
the stb libs, miniz and minizip are now always optimized to speed up
performance, esp. level loading times, in debug builds.
So far the stb libs implementation were dragged into the source file
that uses them, now I created additional source files just for them so
those can be optimized while the engine source files using those libs
can remain unoptimized in debug builds.
Upstream commit: "Disabled: nested tooltips or other non-child window
within a BeginDisabled() block disable the disabled state. (#211, #7640)"
Should be in the next Dear ImGui release
for some reason <algorithm> dragged in <cstdio> which chocked on the
use_idStr_snPrintf #defines from Str.h
"fixed" by including <algorithm> first
also shut up some compiler warnings about signed/unsigned mismatch
ImGui uses UTF-8 for strings, Doom3 uses ISO8859-1, so the playername
must be translated.
Also it seems like the playername should have at least 40 chars,
at least that's the limit imposed by the original Doom3 menu
- convert to/from ISO8859-1 (Doom3's "High ASCII" encoding)
- count Unicode codepoints in UTF-8 string
- cut UTF-8 string off after N codepoints
- use the conversion function to replace iconv in sys/events.cpp
in_allowAlwaysRunInSP allows using in_alwaysRun and in_toggleRun
in Single Player (it'll still drain your stamina!)
m_invertLook allows inverting mouse look, both for up/down and
left/right, if you're into that kind of thing
- s_scaleDownAndClamp CVar so the clamping and scaling down of all
sounds (that is done to prevent clipping) can be disabled
(enabled by default)
- s_alOutputLimiter CVar to allow configuring ALC_SOFT_output_limiter
which (if enabled) reduces the overall volume if it gets too loud,
to avoid clipping (defaults to -1 = "let OpenAL decide")
- s_alHRTF to allow enabling or disabling HRTF, requires ALC_SOFT_HRTF
(defaults to -1 = "let OpenAL decide")
Those CVars can be changed at runtime and are applied immediately
(in case of s_alHRTF and s_alOutputLimiter by resetting the OpenAL
device, just like we do when a disconnect is detected)
In the main menu the ImGui/SDL/System cursor was only drawn when it was
over an ImGui window, so only the Doom3 cursor is shown when outside
of ImGui windows.
The only problem with this is that the Doom3 cursor is only shown in
the parst of the window actually covered by the main menu, not the black
bars that are drawn on the left/right for widescreen-resolutions when
scaling the menu to 4:3 is enabled (which it is by default).
So now the ImGui cursor is also drawn when the cursor is on those
black bars (if any).
Also tweaked the windowtitle background colors a bit.
* Binding menu makes sure that the AllBindingsMenu always gets focus
when opened
* Give binding-related popups slightly rounder edges
* Move Game Options tab behind Video and Audio Options
* Make warning overlays a bit less translucent
Pause the game (with g_stopTime) when the settings menu is opened
while ingame, unpause it when it's closed.
If the menu is open while ingame and an ImGui window has focus,
the mouse cursor is shown. If the player clicks outside an ImGui window,
it gets unfocused and the cursor is hidden and the player can look
around. Pressing F10 (or whatever key is bound to "dhewm3Settings")
will give focus back to an open ImGui window, pressing it again then
will close the settings window, pressing it once again afterwards will
open the settings window again.
handleMouseGrab() (in sys/events.cpp) now checks if sys_imgui thinks
that a cursor should be shown (via D3::ImGuiHooks::ShouldShowCursor())
and if so, shows it and ungrabs the mouse. This, together with
D3::ImGuiHooks::NewFrame() checking ShouldShowCursor() to (unset)
ImGuiConfigFlags_NoMouseCursorChange, should prevent flickering cursor
problems that sometimes occurred when ImGui's SDL2 backend and dhewm3
disagreed on whether the cursor should be visible.