Commit graph

981 commits

Author SHA1 Message Date
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
Daniel Gibson
09c89206a4 Fix gamepad button names for nintendo gamepads
oops, forgot to switch X and Y
2024-01-18 03:11:23 +01:00
Daniel Gibson
bb568bc3da Gamepad layout autodetection (for SDL 2.0.12 and newer)
turns out SDL 2.0.12 added SDL_GameControllerGetType() which tells you
what kind of controller it is (xbox, playstation, nintendo, ..).

Using this to implement an auto-mode for joy_gamepadLayout, when it's
set to -1 (the new default).

This should still build with older versions of SDL2 (but won't have
that autodetection then).
2024-01-17 21:25: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
e0bb01ef52 Gamepad cursor control improvements
- make moving the cursor more precise by using an exponential curve
  for axis value => cursor speed
- emulate cursor keys with DPad and Enter with left trigger
- also use right trigger for leftclick, as it's usually used for firing
  a weapon and thus used for "clicking" ingame UIs
- fix hovering/highlighting menu elements when moving cursor
  with gamepad
2024-01-16 19:18:54 +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
wof8317
f8557f6bd5 Modified some code to compile 2024-01-16 02:08:56 +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
fgsfds
37b0551ba8
Added 21:9 and 32:9 resolutions (#532)
* added 21:9 and 32:9 resolutions
2023-11-18 06:27:44 +01:00
Daniel Gibson
80ae0b0bed Mention screenshot formats in Changelog 2023-11-01 06:47:25 +01:00
Daniel Gibson
ba986a2dc5 Merge branch 'eezstreet-screenshot-formats'
added some comments, renamed WriteScreenshot()
to WriteScreenshotForSTBIW() and made it static
2023-06-26 02:03:04 +02:00
Daniel Gibson
62f18c11a5 README: Update link to Steam
Doom3 and RoE can't be bought alone anymore, only as part of D3 BFG,
so link that instead.
Has the advantage of being cheaper, also giving you the BFG edition,
and (presumably?) making RoE available to German users.

(also added a comment in CMakeLists.txt, for mingw32, copy of the
 equivalent comment in MSVC section)
2023-06-26 01:11:36 +02:00
Nick Whitlock
d468e91d29 Made compress_for_stbiw static 2023-05-24 12:01:11 -04:00
Nick Whitlock
e74e8f5d7c Solution for not breaking SDK ABI 2023-05-24 01:40:18 -04:00
Nick Whitlock
619c5d43f8 Optimization for screenshot flipping 2023-05-24 01:28:46 -04:00
Nick Whitlock
b880e8625b Use zlib for compression of png screenshots 2023-05-23 01:29:17 -04:00
Nick Whitlock
c86cb9a982 Use TGA in specific places 2023-05-22 21:45:34 -04:00
Nick Whitlock
df4e8405b0 Introduced cvar: 'r_screenshotPngCompression' 2023-05-22 21:34:49 -04:00
Nick Whitlock
7ea3e91474 Added new screenshot formats.
Added the ability to change the screenshot format with a new CVar:
r_screenshotFormat. This has four options: 0 (TGA), 1 (BMP), 2 (PNG),
and 3 (JPG). JPG quality can be selected with a new CVar:
r_screenshotJpgQuality. TGA is the default to preserve original behavior
from DOOM 3.

A new dependency on stb_image_write has been added. It has been
included. No additional configuration with CMake is required.
2023-05-22 09:40:11 -04:00
Daniel Gibson
b6365e91d7 CMake: Detect all variations of the clang compiler (hopefully)
According to
https://cmake.org/cmake/help/v3.26/variable/CMAKE_LANG_COMPILER_ID.html
there's at least "Clang" (plain LLVM clang), "AppleClang", "ARMClang",
"FujitsuClang", "XLClang" and "IBMClang" (both of which are variations
of the clang/llvm-based IBM XL compiler).

This should detect all of them (I hope they all behave close enough
to normal clang to work..)

There's also "IntelLLVM", but I have no idea if that's based on Clang
or does its own thing based on LLVM.. I also doubt dhewm3 will ever
be built with any other clang-derivate than "Clang" and "AppleClang" :-p

fixes #510
2023-05-19 03:33:46 +02:00
Daniel Gibson
03fccc6220 R_IssueEntityDefCallback() fix bounds check
in the "Work around false positive GCC -W(maybe-)uninitialized warnings"
commit I changed that code.. but my change made it nonsensical,
of course we must get oldBounds before calling the callback which
changes the bounds, otherwise comparing the "oldbounds" with the
current bounds just compares them with themselves..
2023-03-28 19:18:55 +02:00
Daniel Gibson
6f35ce045d _alloca16(): Use __builtin_alloca_with_align() on GCC
we're already using it with MinGW, no reason not to use it with
"normal" GCC on Unix (and clang, which also defines __GNUC__) as well.
2023-03-28 19:14:29 +02:00
Daniel Gibson
56b3c46ba8 Fix MSVC non-Release builds (_alloca()/assert() didn't play nice) 2023-03-02 18:04:48 +01:00
Daniel Gibson
85a6b3b067
README: Update build instructions for newer versions of VS 2023-02-12 20:09:00 +01:00
James Addison
d57f438db1 Fixup: typo: 'hiehgt' -> 'height' in a few places around the codebase 2023-02-04 19:34:29 +01:00
Daniel Gibson
95d8d75ae0 Update Changelog, another small MD3 fix 2023-01-29 02:46:34 +01:00
Daniel Gibson
604dc7c44d Fix MD3 model support (esp. on 64bit)
.. but even on 32bit it didn't work reliably due to
an uninitialized value
2023-01-29 01:10:41 +01:00
Daniel Gibson
2de8c22f3b Fix MSVC + Tools build
afxv_w32.h (apparently included indirectly viw edit_gui_common.h)
complained that windows.h (included indirectly via DebuggerServer.h
-> platform.h) was included first, apparently that's not allowed..

this was broken by the recent "fix mingw build" commit; now hopefully
both work (MinGW doesn't support building the tools, because they need MFC
which only works with MSVC)
2023-01-21 20:33:14 +01:00
Daniel Gibson
dee76dbb21 Increase stack size on Windows to 8MB, so huge models work
The HD version of the "Birdman" Hellknight model crashed the game,
because on Linux it triggered the 600KB _alloca() assertion and on
Windows (that didn't have such an assertion up to this commit) it
overflowed the stack.
Thde default stacksize on Windows is 1MB, increasing that to 8MB fixes the
problem (in Doom3 1.3.1 it was 4MB).
I also implemented the _alloca() size check assertion for Windows, and
increased the allowed size to 2MB (so it can be safely called multiple
times per function)
Model: https://www.moddb.com/mods/birdman-doom3/downloads/birdman-doom3-v11
2023-01-21 19:26:11 +01:00
Daniel Gibson
e7e06d05f1 Fix SDL1.2 build and type of xthreadInfo::threadId 2023-01-16 03:22:01 +01:00
Daniel Gibson
07985cc5ea Fix MinGW build, #505
<intrin.h>, included by SDL_cpuinfo.h via SDL.h, defines strcmp.
If the idlib/Str.h `#define strcmp idStr::Cmp` hack is visible when
that file is parsed, there's a compiler error (because strcmp in
intrin.h is replaced with idStr::Cmp then).
So I reorderedd includes a bit until it compiled again..
2023-01-16 03:15:21 +01:00
Daniel Gibson
477252308d Fix date/time handling in idParser::ExpandBuiltinDefine()
this was so broken, I think if anyone ever tried to use __DATE__ or
__TIME__ it must've crashed, either from free(curtime) (which was the
return value of ctime()) or from things like token[7] = NULL when token
was a pointer (to a single element!).

I think it could work now.

Also fixed potential memory leaks in cases that don't "return" anything
2023-01-05 09:07:04 +01:00
Daniel Gibson
dbe4174c0b Fix/work around other misc. compiler warnings
or, in the case of AF.cpp, at least comment on them

I think this fixes most of the remaining "interesting" GCC 12 on Linux
warnings, except for some in idParser::ExpandBuiltinDefine() that I'll
fix in the next commit
2023-01-05 09:06:34 +01:00
Daniel Gibson
996947eec6 Fix -Wmismatched-new-delete warnings
totally valid, how didn't we find them yet (ok, maybe because those
functions aren't called much)
2023-01-05 07:56:16 +01:00
Daniel Gibson
6730ddcb29 Work around false positive GCC -W(maybe-)uninitialized warnings
shouldn't hurt too much, and the R_IssueEntityDefCallback() code
even is a bit better now
2023-01-05 07:54:41 +01:00