Commit graph

931 commits

Author SHA1 Message Date
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
Daniel Gibson
4bdee4f638 Dhewm3SettingsMenu: Improve cursor handling and opening menu ingame
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.
2024-05-28 04:49:24 +02:00
Daniel Gibson
c0b6660389 ImGui styles: Allow writing only changed values to C++ code 2024-05-26 03:56:28 +02:00
Daniel Gibson
2a7683ebaa imgui_savestyle.cpp - some improvements
- write code uses fewer/shorter string literals
- code generated by WriteImGuiStyleToCode() has nicer alignment
- small improvements in some comments
2024-05-26 01:23:30 +02:00
Daniel Gibson
894aa67a8f Dhewm3SettingsMenu: Add button to copy current style to clipboard as C++ 2024-05-25 18:16:00 +02:00
Daniel Gibson
99b65a3edf Add WriteImGuiStyleToCode() to imgui_savestyle.cpp 2024-05-25 18:15:07 +02:00
Daniel Gibson
fd36e8e477 imgui_savestyle.cpp: use common->Warning() for warnPrintf() 2024-05-25 06:58:19 +02:00
Daniel Gibson
bb0511ac7b sys_imgui.cpp: Move code to read/write style to imgui_savestyle.cpp
it's nicely self-contained, I'll release it as a mini-library/addon
for Dear ImGui on https://github.com/DanielGibson/Snippets/
2024-05-25 06:58:19 +02:00
Daniel Gibson
53906538e6 Dhewm3SettingsMenu: Scroll within the tabs and similar tweaks 2024-05-24 17:05:37 +02:00
Daniel Gibson
2e8cbc1344 Allow saving ImGui Userstyles
You can pry X macros from my cold dead hands
2024-05-24 16:16:47 +02:00
Daniel Gibson
ef529cf49a Bind F10 to open dhewm3Settings menu, unless F10 is already bound
Also fix MSVC build: For some reason Microsoft's sad excuse of a compiler
 only sets __cplusplus to a value from this millenium if the
/Zc:__cplusplus compiler option is set, but that's only supported from
VS2017 15.7 on. The alternative is to use _MSVC_LANG, which always holds
the version that __cplusplus *should* have...
2024-05-23 19:29:38 +02:00
Daniel Gibson
2892e416f5 Add keybinding menu to Dhewm3SettingsMenu
I first developed that as a prototype in
https://github.com/DanielGibson/dhewm3/blob/imgui/neo/libs/imgui/examples/example_sdl2_opengl2/main.cpp
there one can also find a commit history from writing that code, even
though not all commit messages are overly helpful :-p
2024-05-23 19:28:10 +02:00
Daniel Gibson
6d508eac17 Some functions that will be used by the ImGui keybinding menu 2024-05-22 19:46:38 +02:00
Daniel Gibson
8554487bf5 Dhewm3SettingsMenu: Get rid of obscureBindingEntries list
they're part of the regular list now. this will help with the actual
binding implementation I'll merge next
2024-05-22 19:46:38 +02:00
Daniel Gibson
809bbfcccf Workaround for missing " or " string in Doom3 demo for Windows
The original binding menu uses #str_07183 between keys - this
should be " or ", but in the windows demo that entry is missing
in strings/english.lang
2024-05-22 19:46:38 +02:00
Daniel Gibson
9e4fe84eb8 Dhewm3SettingsMenu: some more joystick settings, stub of a binding menu
I actually did this before the prototyping of a keybindings menu
in the imgui example code, so the prototype is actually based on this.
I'll merge the code from the prototype back once it's done.
2024-05-22 19:46:38 +02:00
Daniel Gibson
7023475c9d Add idStr::(V)Format(), make idList compatible with C++ foreach
idStr::(V)Format() is a static (v)printf-like function that returns
and idStr. Can be used like a better va(), or for
idStr mystr = idStr::Format( "number of items: %d", myarr.Num() );
2024-05-22 19:46:38 +02:00
Daniel Gibson
0418f62489 Update ImGui to 1.90.6 2024-05-22 19:46:38 +02:00
Daniel Gibson
c9a8901dbd ImGui: Improve integration, use scalable font, Control Options menu 2024-05-22 19:46:38 +02:00
Daniel Gibson
86be2eb513 initial support for DPI scaling of imgui 2024-05-22 19:46:38 +02:00
Daniel Gibson
ffaf135758 Start ImGui-based settings menu
the integration of that at least, the menu is still a stub
2024-05-22 19:46:38 +02:00
Daniel Gibson
8fce796680 improve imgui integration 2024-05-22 19:46:38 +02:00
Daniel Gibson
c0c82e763a Initial ImGui integration in the engine
still a bit hacky, but shows imgui windows that can be clicked etc
2024-05-22 19:46:38 +02:00
Daniel Gibson
33ed99902e Integrate ImGui into buildsystem, adjust its OpenGL code for qgl 2024-05-22 19:46:38 +02:00
Daniel Gibson
07f7d14f9b Add Dear ImGui 1.90.4 source 2024-05-22 19:46:38 +02:00
Daniel Gibson
f4446ca666 Bump version to 1.5.4pre
this is not 1.5.3 anymore.
2024-05-22 19:46:19 +02:00
Daniel Gibson
6daf1e9e7f Don't use GCC's __builtin_alloca_with_align(), fix #572
turns out that __builtin_alloca_with_align() might releases the
allocated memory at the end of the block it was allocated in, instead
of the end of the function (which is the behavior of regular alloca()
and __builtin_alloca()): "The lifetime of the allocated object ends at
 the end of the block in which the function was called. The allocated
 storage is released no later than just before the calling function
 returns to its caller, but may be released at the end of the block in
 which the function was called."
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005falloca_005fwith_005falign

Clang also supports __builtin_alloca_with_align(), but always releases
the memory at the end of the function.

And it seems that newer GCC versions also tend to release it at the
end of the function, but GCC 4.7.2 (that I use for the official Linux
release binaries) didn't, and that caused weird graphical glitches.
But as I don't want to rely on newer GCC versions behaving like this
(and the documentation explicitly says that it *may* be released at
 the end of the block, but will definitely be released at the end of
 the function), I removed all usage of __builtin_alloca_with_align().

(Side-Note: GCC only started documenting the behavior of
 __builtin_alloca and __builtin_alloca_with_align at all with GCC 6.1.0)
2024-04-19 07:24:32 +02:00
Martin Hauke
b565c6c732 Fix desktop files
"desktop-file-validate" reports the following error:

org.dhewm3.Dhewm3.desktop: error: value "dhewm3 "$@"" for key "Exec"
in group "Desktop Entry" contains a non-escaped character '$' in a
quote, but it should be escaped with two backslashes ("\\$")

see
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables
2024-04-02 12:51:27 +02:00
Daniel Gibson
9892438a9b Update changelog for 1.5.3 2024-03-29 01:55:34 +01:00
Daniel Gibson
a454d965a2 dhewm3 1.5.3 2024-03-29 01:41:04 +01:00
Daniel Gibson
7804daebac Suppress GCC warnings about variables with C++20 keyword names
"requires" is a keyword in C++20, so newer g++ complains about them.
We currently use C++98, so who cares
2024-03-27 16:15:21 +01:00
Daniel Gibson
d6c0bb2003 Make it build and work on old PPC Macs again (#568)
also added the changelog entry for in_namePressed
2024-03-27 01:04:11 +01:00
Daniel Gibson
9ccce9b4b6 in_namePressed: Only print key name on down events; document it 2024-03-25 02:39:34 +01:00
Biel Bestué de Luna
3504e693bf added a simple printing of the key/button pressed (#567)
added a simple helper print method to know what key/button is being pressed,
controlled via a bool cvar "in_namePressed" 1 or 0.
I tested it and it works with keyboard, mouse and gamepad.
2024-03-25 02:39:12 +01:00
Daniel Gibson
fb5eedb35f Initialize variabls ubsan complained about
I did this change ages ago in game/, forgot to do it in d3xp/ as well
2024-03-20 18:32:26 +01:00
Daniel Gibson
6310f699e1 Fix cursor focus for gamepads, once again, #566
hopefully it works now...
2024-03-20 18:31:28 +01:00
Daniel Gibson
fac06f0421 1.5.3 RC2 2024-03-17 04:25:29 +01:00
Daniel Gibson
27aeda205c Make Sys_SetInteractiveIngameGuiActive() work better
it could happen that UIs are added to the internal list twice,
and also that the last UI wasn't removed from the list when a new one
was focused fast enough.

That should work better now, I hope I didn't break anything..
2024-03-17 04:03:27 +01:00
Daniel Gibson
0d4405bbe6 Merge branch 'minizip-update' 2024-02-12 05:15:40 +01:00
Daniel Gibson
f6f654ee53 minizip: re-add doom3-specific changes 2024-02-12 05:05:31 +01:00