Commit graph

970 commits

Author SHA1 Message Date
Daniel Gibson
23627380dd some debug code for soft particles in RB_STD_T_RenderShaderPasses() 2024-07-25 03:24:20 +02:00
Daniel Gibson
41eef54611 Merge soft particles from thedarkmod 2.04
don't really work, though
2024-07-25 03:24:20 +02:00
Daniel Gibson
10eee1eb43 map command without any arguments prints current map name 2024-07-25 02:47:33 +02:00
Daniel Gibson
794d40a04c Add CVar r_vidRestartAlwaysFull
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`
2024-07-25 02:47:25 +02:00
Daniel Gibson
b2ba15425c Hopefully fix screenshots on Wayland
- 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
2024-07-25 02:47:07 +02:00
Daniel Gibson
5c7aacb954 Make fullscreen mode with XWayland a bit less broken, #587
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)
2024-07-03 01:01:16 +02:00
Daniel Gibson
cec78b5a99
Merge pull request #576 from DanielGibson/imgui-rebased
Integrate Dear ImGui and implement a new settings menu with it and much more

also replaced zlib with miniz, HiDPI support, lots of new configuration options
2024-06-18 01:18:35 +02:00
Daniel Gibson
9eff1d9be2 Dhewm3SettingsMenu: Rework resolution/windowed/MSAA part of Video Options
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
2024-06-12 22:47:43 +02:00
Daniel Gibson
94738f1f16 Add glimpParms_t GLimp_GetCurState() to get current window state
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
2024-06-12 22:26:30 +02:00
Daniel Gibson
387430a01f Fix vid_restart partial for real fullscreen mode 2024-06-11 19:03:54 +02:00
Daniel Gibson
c096a86ce8 Fix toggling fullscreen mode with vid_restart partial, esp for Alt-Enter
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! :)
2024-06-11 18:32:35 +02:00
Daniel Gibson
44d19a4175 Implement GLimp_SetScreenParms() for "vid_restart partial"
"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
2024-06-11 16:45:34 +02:00
Daniel Gibson
ac8eec932b Add r_windowResizable to configure if window is resizable
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)
2024-06-08 11:39:21 +02:00
Daniel Gibson
a6870cabfc minizconf.h: (hopefully) fix MinGW compatibility of z_off64_t 2024-06-08 10:44:02 +02:00
Daniel Gibson
ab676878b9 Make dhewm3 window resizable (when using SDL2)
is this really all that's needed?!
2024-06-07 20:51:22 +02:00
Daniel Gibson
28b753d50b Fix crash in Dhewm3SettingsMenu after switching fullscreen w/ Alt-Enter
Seems like calling ImGui::CalcTextSize() is only safe after
(or at the end of) NewFrame()
2024-06-07 13:39:51 +02:00
Daniel Gibson
cff73ff591 Dhewm3SettingsMenu: Remove testing printfs 2024-06-07 11:53:04 +02:00
Daniel Gibson
49ed8ec439 Adjust imgui_savestyle.cpp for 1.90.8
ImGuiDir now is a proper enum, not just a typedef of int that happens
to have a similar name to the actual enum
2024-06-06 20:07:30 +02:00
Daniel Gibson
863dc48ff4 Update Dear ImGui to 1.90.8 2024-06-06 20:05:54 +02:00
Daniel Gibson
e8b8f5c02d Always optimize code of some integrated libraries, even in Debug builds
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.
2024-06-05 21:40:59 +02:00
Daniel Gibson
af34aba577 ImGui: Apply patch from upstream that fixes tooltips of disabled buttons
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
2024-06-05 16:58:12 +02:00
Daniel Gibson
ab5d590b6f Update Changelog, mention new settings menu in Readme 2024-06-04 12:40:43 +02:00
Daniel Gibson
51270dd390 Store imgui.ini and user.imstyle in dhewm3 config dir instead of $PWD 2024-06-04 10:52:30 +02:00
Daniel Gibson
81d912ab4b Give Dhewm3SettingsMenu a sane default size and position 2024-06-04 10:32:28 +02:00
Daniel Gibson
c317e604c6 Improve minizconf.h; in CMake, don't use C++-compilerflags for plain C 2024-06-04 09:30:54 +02:00
Daniel Gibson
1b344d4b78 Replace zlib with integrated miniz
using amalgamated miniz 3.0.2 from https://github.com/richgel999/miniz
and minizconf.h from Yamagi Quake II:
https://github.com/yquake2/yquake2/blob/master/src/common/unzip/miniz/minizconf.h
2024-06-03 22:02:56 +02:00
Daniel Gibson
a9bee9f76e Fix build on Windows/MSVC
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
2024-06-03 19:25:50 +02:00
Daniel Gibson
5376c6d74c HighDPI support, hopefully 2024-06-03 14:49:23 +02:00
Daniel Gibson
28d81ed5f5 Fix ImGui with r_fillWindowAlphaChan
turns out ImGui also messes with the windows alpha chan, so, it
must render before the alpha chan is filled
2024-06-03 11:39:28 +02:00
Daniel Gibson
7aa6c6a70f "Properly" scale ImGui font by reloading font with scaled size 2024-06-02 16:50:28 +02:00
Daniel Gibson
cb5d988058 Fix SDL1.2 build and some runtime issues with SDL1.2 2024-06-02 15:40:09 +02:00
Daniel Gibson
7f62e9aa94 Better descriptions for screenshot CVars; document new CVars 2024-06-02 15:40:09 +02:00
Daniel Gibson
67a0dc8c46 Dhewm3SettingsMenu: Save number of BindingColumns in a CVar
so it gets saved in the config

also added another Game Option and added separators to that menu
2024-06-02 15:39:18 +02:00
Daniel Gibson
10312f6998 Allow disabling Dear ImGui integration in CMake
and do it automatically when using SDL1.2, as it requires SDL2
(or SDL3 once we support it)
2024-06-02 14:07:29 +02:00
Daniel Gibson
ecee402927 Dhewm3SettingsMenu: properly handle playername encoding and length
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
2024-06-02 13:18:37 +02:00
Daniel Gibson
6dc36c6175 Add some functions to handle UTF-8 strings
- 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
2024-06-02 13:14:30 +02:00
Daniel Gibson
30e4a9bb51 Dhewm3SettingsMenu: Add game options and m_invertLook 2024-06-02 07:20:11 +02:00
Daniel Gibson
50d7129b1c New input CVars: in_allowAlwaysRunInSP, m_invertLook
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
2024-06-02 07:16:44 +02:00
Daniel Gibson
bd22f55f56 Dhewm3SettingsMenu: Support new sound CVars, show OpenAL info 2024-06-01 07:11:14 +02:00
Daniel Gibson
2c58845d28 Several OpenAL improvements
- 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)
2024-06-01 07:09:42 +02:00
Daniel Gibson
7b6fdc845a Dhewm3SettingsMenu: Add Audio Options, make Video Options nicer 2024-05-31 15:58:12 +02:00
Daniel Gibson
337b339dd7 Update Dear ImGui to 1.90.7 2024-05-31 00:16:00 +02:00
Daniel Gibson
fcbc757615 Add optional "nores" argument to Com_ExecMachineSpec_f()
if set, the display resolution (r_mode) is not modified
2024-05-30 09:04:06 +02:00
Daniel Gibson
410d2791ae Dhewm3SettingsMenu: More video settings, a few other tweaks 2024-05-30 08:59:28 +02:00
Daniel Gibson
2aaaeb1456 Dhewm3SettingsMenu: Added VSync option 2024-05-30 05:55:53 +02:00
Daniel Gibson
e3d67f0ac9 Allow changing r_swapInterval (VSync) on-the-fly
Not supported with SDL1.2 - but that's only still supported by dhewm3
because I'm too lazy to rip it out :-p
2024-05-30 05:54:18 +02:00
Daniel Gibson
139020f52b Dhewm3SettingsMenu: More video options 2024-05-30 05:02:59 +02:00
Daniel Gibson
0e341176d4 Dhewm3SettingsMenu: Start implementing video options 2024-05-30 05:00:52 +02:00
Daniel Gibson
1697831e74 ImGui: Draw ImGui cursor on black bars in main menu; tweak some colors
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.
2024-05-30 01:26:40 +02:00
Daniel Gibson
7af7508a7f ImGui stuff: Some tweaks
* 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
2024-05-28 04:49:24 +02:00