Commit graph

968 commits

Author SHA1 Message Date
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
Daniel Gibson
954620e1b3 minizip/unzip.cpp: restore TRYFREE() macro
reverting this upstream commit:
384e50eea4
so we can still use a custom allocator
2024-02-12 05:03:02 +01:00
Daniel Gibson
2595a2dbe6 Update minizip source to latest code from zlib development branch
commit f56ad0aafa868303ce324ae8d45675570c66b050 from 2024-01-23
"Note termination of returned strings in contrib/minizip/unzip.h."

this is the code as it is upstream, the next commit will add some
doom3-specific changes
2024-02-12 04:51:14 +01:00
Daniel Gibson
606a6c8e85 Configuration.md: document CVars, link alternative gamepad configs 2024-02-06 17:21:50 +01:00
r-a-sattarov
6ed10c1dac Workaround for MCST-LCC compiler < 1.28 version
mcst-lcc < 1.28 does not support __builtin_alloca_with_align()
Ref: http://mcst.ru/lcc
2024-02-06 17:20:05 +01:00
Daniel Gibson
8a3e0a328f 1.5.3 RC1 2024-02-04 21:57:44 +01:00
Daniel Gibson
9e3acf4b38 Update stb_image and stb_vorbis
from unofficial forks that are quicker to merge security fixes

stb_image.h:
 https://github.com/NBickford-NV/stb/tree/neilbickford/all-fixes
 commit 66e4fb617ad697c62ebe2814804881fe127cb232 from Jan 30, 2024

stb_vorbis.c: https://github.com/sezero/stb/tree/stb_vorbis-sezero
 commit 3ba957b34a949413886c9b8eb1842bdbd3957093 from Dec 12, 2023
2024-02-04 04:41:05 +01:00
Daniel Gibson
e63b63fcff Turn assertion in idRenderWorldLocal::BoundsInAreas() into Warning
apparently this happens sometimes, but not often enough to reproduce
properly?

also some small changes (mostly formatting) to Configuration.md

refs #540
2024-02-03 15:43:59 +01:00
Daniel Gibson
94a208ea18 Configuration.md: Document the bindings in gamepad.cfg
and made the list of button/stick/trigger names prettier
2024-01-22 17:12:52 +01:00
Daniel Gibson
c743d21f08 Merge branch 'controller-input' 2024-01-22 16:41:53 +01:00
Daniel Gibson
d5f2dc4916 Add and link Configuration.md and gamepad configs
it documents dhewm3-specific configuration, esp. for gamepads
(but also listing other CVars added in dhewm3)
2024-01-22 06:18:41 +01:00
Daniel Gibson
5b8e67762b Also allow using "Pad Y" for leftclick in menus 2024-01-22 05:50:45 +01:00
Daniel Gibson
9e8d399257 Further gamepad improvements
- the gamepad button (or trigger) bound to attack (fire) now always
  acts like the left mouse button in menus
- Display correct button name for "Back" button on Playstation-like
  gamepads, even depending on whether it's PS3-like ("Select") or
  PS4/5-like ("Share")
- Log some more information about detected gamepads
2024-01-18 19:53:45 +01:00
Daniel Gibson
e7eb7d17fe Improve Nintendo Pro Controller support
and some general gamepad support improvements, like logging the
detected gamepad name and type
2024-01-18 06:09:33 +01:00