Commit graph

229 commits

Author SHA1 Message Date
Daniel Gibson
0e341176d4 Dhewm3SettingsMenu: Start implementing video options 2024-05-30 05:00:52 +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
894aa67a8f Dhewm3SettingsMenu: Add button to copy current style to clipboard as C++ 2024-05-25 18:16:00 +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
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
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
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
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
f4446ca666 Bump version to 1.5.4pre
this is not 1.5.3 anymore.
2024-05-22 19:46:19 +02:00
Daniel Gibson
a454d965a2 dhewm3 1.5.3 2024-03-29 01:41:04 +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
fac06f0421 1.5.3 RC2 2024-03-17 04:25:29 +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
8a3e0a328f 1.5.3 RC1 2024-02-04 21:57:44 +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
Daniel Gibson
86690df24e Add joy_gamepadLayout CVar to better support nintendo/PS-style gamepads
The button names shown in the controls menu now depend on this CVar.
So if you set it to 1 (Nintendo), the "A" button (which, based on its
position, would be "B" on XBox/XInput gamepads) is actually shown as
"Pad A", and if it's set to 2 (Playstation), it's shown as "Pad Cross".

The "real" names, used in the config, remain the same and are based on
position: JOY_BTN_SOUTH, JOY_BTN_EAST, JOY_BTN_WEST, JOY_BTN_NORTH
2024-01-17 18:54:09 +01:00
Daniel Gibson
cf5d10f4e6 Fix gamepad pseudo-mouse input for UIs in multiplayer mode
also, only generate pseudo-mouse-move events for gamecode
(by modifying idUsercmdGenLocal::continuousMouseX/Y) when an
interactive ingame UI is active
2024-01-17 17:45:43 +01:00
Daniel Gibson
03ec74fd6f Make PDA work with gamepad, incl. making Pad A emulate leftclick
this is a bit hacky and ugly, and doesn't work properly in multiplayer
mode yet, see FIXME in idUserInterfaceLocal::Activate()
2024-01-17 07:06:52 +01:00
Daniel Gibson
6eac0540bf Various gamepad improvements
- treat DPad as 4 regular buttons (was already the case mostly, but now
  the code is simpler)
- rename in_invertLook to joy_invertLook and in_useJoystick to
  in_useGamepad and remove unused CVars
- make controller Start button generate K_ESCAPE events, so it can
  always be used to open/close the menu (similar to D3BFG)
- move mousecursor with sticks, A button (south) for left-click,
  B button (east) for right-click (doesn't work in PDA yet)
- removed special handling of K_JOY_BTN_* in idWindow::HandleEvent()
  by generating fake mouse button events for gamepad A/B
  in idUserInterfaceLocal::HandleEvent()
2024-01-16 17:29:30 +01:00
Daniel Gibson
700b3ee558 Clean up gamepad code a bit, rename buttons
- renamed gamepad/joystick actions and keys to have some meaning
  for buttons (instead of just JOY1, JOY2 etc)
- compiles with SDL1.2 again (there gamepads aren't supported though)
- shorter names for gamepad keys/axis in the key bindings menu
2024-01-08 05:26:27 +01:00
Daniel Gibson
ab53e9aa13 Merge GameController support from Quadrilateral Cowboy
https://github.com/blendogames/quadrilateralcowboy

pretty much as it is there, with only minimal changes required to work
with dhewm3
2024-01-07 01:26:45 +01:00
Nick Whitlock
e74e8f5d7c Solution for not breaking SDK ABI 2023-05-24 01:40:18 -04:00
Nick Whitlock
c86cb9a982 Use TGA in specific places 2023-05-22 21:45:34 -04:00
Daniel Gibson
279a40a981 Fix -Wformat-security warnings - thanks James Addison!
This is based on https://github.com/dhewm/dhewm3/pull/500
by https://github.com/jayaddison

See also https://github.com/blendogames/quadrilateralcowboy/pull/4
2023-01-05 04:45:34 +01:00
Daniel Gibson
d0d00c0095 Bump version to 1.5.3pre
this is not 1.5.2 anymore
2022-10-22 20:57:48 +02:00
Daniel Gibson
2e71b99ee0 dhewm3 1.5.2 2022-06-13 03:36:23 +02:00
Daniel Gibson
89c44d7ac9 Make warning about falling back to base.dll more visible
.. by surrounding it with newlines.
This warning is shown when trying to start a mod without its game dll
(because the user has forgotten to unpack the mod dll archive, or
 because it's a mod that doesn't have its own dll).
Surrounding it with empty lines hopefully makes it easier for users
to figure out what went wrong when they look at the log.
2022-06-08 03:22:12 +02:00
Daniel Gibson
6dfada9af0 Update version to 1.5.2rc2
and add entry to changelog about absolute mouse input etc - this change
was already in RC1 but I forgot to mention it..

and fixed comments for GAME_NAME and ENGINE_VERSION (nowadays dhewm3
uses ENGINE_VERSION for the window title)
2022-05-28 18:06:52 +02:00
Daniel Gibson
cdbb526a3b Add Doom3: Phobos to list of mods that need d3xp (STILL UNSUPPORTED!)
Hoping that Team Future eventually fulfills their promise of releasing
the source of the highly praised Phobos mod, I'm adding it to the list.

Currently this is not very useful, but when (if) the phobos source
becomes available I at least won't have to do a new dhewm3 release to
support it (but only provide tfphobos.dll/.so/.dylib).
2022-05-25 06:34:04 +02:00
Daniel Gibson
2f92bc268d Support loading The Lost Mission and librecoopd3xp via mods menu
by adding special cases for them that set `fs_game_base d3xp`.
Unfortunately there is no more generic way to do this, as mods have
no way to tell the engine if they need fs_game_base.
2022-05-25 06:17:29 +02:00
Daniel Gibson
a363ab4e31 Update version to 1.5.2rc1
.. and fix a link in the changelog
2022-05-16 17:44:15 +02:00
Daniel Gibson
4f74c15afe Make sure MAX_OSPATH has sane size; fix some typos 2022-01-16 06:02:40 +01:00
Daniel Gibson
ae63021d00 Add absolute mouse mode and refactor mouse grabbing code
There were lots of places in the code that called Sys_GrabInput(),
some of them each frame.
Most of this is unified in events.cpp now, in handleMouseGrab() which
is called once per frame by Sys_GenerateEvents() - this makes reasoning
about when the mouse is grabbed and when not a lot easier.
Sys_GrabInput(false) still is called in a few places, before operations
that tend to take long (like loading a map or vid_restart), but
(hopefully) not regularly anymore.

The other big change is that the game now uses SDLs absolute mouse mode
for fullscreen menus (except the PDA which is an ugly hack), so the
ingame cursor is at the same position as the system cursor, which
especially helps when debugging with `in_nograb 1` and should also help
if someone wants to integrate an additional GUI toolkit like Dear ImGui.
2022-01-10 00:46:32 +01:00
Daniel Gibson
ea781c577e Use idStr::Copynz() instead of strncpy()
to guarantee \0-termination
2022-01-08 16:58:48 +01:00
Daniel Gibson
dcbe0b172e Print SDL2 "video driver" at startup 2021-11-21 03:13:35 +01:00
Daniel Gibson
5e4e1d61be Merge branch 'debugger' 2021-07-16 02:21:16 +02:00
Daniel Gibson
78ab625edd Improve handling of "console key", add in_ignoreConsoleKey CVar
If in_ignoreConsoleKey is set, the console can only be opened with
Shift+Esc, not `/^/whatever, so you can easily type whatever character
is on your "console key" into the game, or even bind that key.
Otherwise, with SDL2, that key (KEY_SCANCODE_GRAVE) always generates the
newly added K_CONSOLE.
in_kbd has a new (SDL2-only) "auto" mode which tries to detect the
keyboard layout based on SDL_GetKeyFromScancode( SDL_SCANCODE_GRAVE ).
Wherever Sys_GetConsoleKey() is called, I now take the current state of
Shift into account, so we don't discard more chars than necessary, esp.
when they keyboard-layout (in_kbd) is *not* correctly set.

(TBH the only reason besides SDL1.2 to keep in_kbd around is to ignore
 the char generated by the "console key" in the console..)
2021-07-15 07:00:18 +02:00