Commit graph

961 commits

Author SHA1 Message Date
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
Daniel Gibson
957176d659 Fix GCC -W(maybe-)uninitialized warnings that at least kinda had a point 2023-01-05 07:51:59 +01:00
Daniel Gibson
5844af62ce Don't use "register" keyword, it was deprecated in C++11
.. and even removed in C++17 - and before that it probably didn't do
much in most compilers
2023-01-05 05:07:53 +01: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
6940d7f678 Fix build with Visual Studio's builtin CMake support
For some reason MSVCs integrated CMake doesn't set CMAKE_GENERATOR_PLATFORM
so my CPU arch detection magic in CMakeLists.txt didn't work in that case..
Now (when using MSVC) the CPU architecture (D3_ARCH) is set in
neo/sys/platform.h instead.
2022-12-31 02:01:52 +01:00
Daniel Gibson
051abc0dd1 Add build instructions for Linux/Ubuntu to README.md
and some other small improvements to the README
2022-12-31 02:01:52 +01:00
Daniel Gibson
a6ba6cb5e5 Add GCC/clang-specific CMake options: ASAN, UBSAN, FORCE_COLORED_OUTPUT
-DASAN=ON   enables the Address Sanitizer (ASan), if supported
-DUBSAN=ON  same for Undefined Behavior Sanitizer (UBSan)
-DFORCE_COLORED_OUTPUT=ON  forces GCC or Clang to use colors in their
                           messages, useful when building with ninja

All three options default to OFF (though when building with make in a
suitable terminal, GCC and clang automatically use colors)

Also modified the cmake_minimum_required() line to shut up deprecation
warnings (though TBH I have no idea if this really still works with
CMake 2.6)
2022-12-31 02:01:52 +01:00
Daniel Gibson
4567f26539 Fix scaling down volume of all sounds, #179 #326
Commit 3c01757d27 introduced scaling down all sounds to prevent too
many loud-ish sounds from making OpenAL scale the overall volume down.

The problem is that before this change, many sounds had a volume > 1.0,
but vastly different: e.g. player_machinegun_fire was 5.039685 (14dB)
and player_chaingun_fire was 1.414214 (3dB).
But in the end, all volumes were clamped to 1.0 before setting AL_GAIN
(because AL_GAIN only supports values between 0 and 1 by default), so
the machinegun and chaingun had the same volume after all.

When scaling those down to 1/3 of the original volume, some sounds that
used to have a volume of >= 1.0 (=> AL_GAIN set to 1.0) had a volume
lower than 1.0, so they suddenly the chaingun sounded quiter than
the machinegun. While theoretically this is more correct than before
(after all, the sound shader of player_chaingun_fire set a much lower
 volume than that of player_machinegun_fire), it doesn't sound like it
used to (even with the old software sound backend!).

Clamping to 1.0 *before* scaling to 1/3 should restore the old behavior
(of all sounds with volume > 1.0 before clamping using the same AL_GAIN)
while still avoiding the issue of having OpenAL (Soft) scale down the
overall volume when shooting a metal wall with the shotgun.

Unsurprisingly the same problem (inconsistent weapon volumes due to
incorrect sound shaders setting the volume way to high and thus relying
on being clamped to 1.0) that occurred with my volume *= 0.333 hack
also happens when reducing the global volume.
So apply that global volume scale *after* clamping to 1.0

see https://github.com/bibendovsky/eaxefx/pull/28#issuecomment-1367436162
2022-12-31 02:00:30 +01:00
Daniel Gibson
ee4eced60b Fix typo in game/Weapon.cpp from "Fix renderlights ..." commit 2022-12-31 02:00:30 +01:00
Daniel Gibson
a7e4eb8644 Fix renderlights loaded from savegames aliasing other lights
Some entities wrote the handle from gameRenderWorld->AddLightDef()
into savegames and reused it after restoring it.
That's a bad idea, because at that point the handle most likely belongs
to something else (likely some idLight). The most visible issue this
can create is that the flashlight may not work correctly after loading
a savegame with flashlight on, when it happens to alias a light that's
updated each frame to (mostly) being off..

The correct way to handle this (THAT FOR SOME REASON WAS ALREADY
IMPLEMENTED IN D3XP BUT NOT THE BASE GAME - WHY?!) is to get a fresh
handle with AddLightDef() when restoring a savegame - unless the handle
was -1, which means that the light didn't exist when saving.

fixes #495
2022-11-06 18:12:54 +01:00
Daniel Gibson
2a85b73110 Fix some ubsan warnings 2022-11-06 03:09:05 +01:00
Daniel Gibson
e1e8103982 HARDLINK_GAME option in cmake
to compile game code into executable instead of base.dll/d3xp.dll

allows using UBsan
2022-11-06 03:09:05 +01:00
Daniel Gibson
4dcc7efe59 StartSoundShader() event: special-case for soundName "", refs #494
Some level scripts in d3xp (erebus4, erebus4, phobos2) use
  $entity.startSoundShader( "", SND_CHANNEL_BODY );
(or whatever channel) to stop the sound currently playing there.
With s_playDefaultSound 1 that results in a beep..
Added a special case to that event implementation to call StopSound()
instead when the soundName is "" (or NULL)
2022-10-31 03:20:57 +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
177740ca88 Fix crash in Radiant Model Preview Dialog, fix #496
the problem was a double-free on files, because USE_COLLADA is not defined.
I'm not even sure why this USE_COLLADA code exists, as we don't have any
real collada support code anywhere..
2022-10-22 20:47:33 +02:00
PLG
cc0f49f9a8 Remove deprecated warnings on mac for cString use. 2022-07-07 22:47:12 +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
Kevin Degeling
42b37b039e Include Linux metadata based on App Stream standard 2022-06-08 00:53:39 +02:00
Daniel Gibson
a2929d9062 Fix Light Editor in Radiant (#456)
When selecting a light in the Radiant (builtin Windows-only level editor)
and pressing `j`, the light editor opened (as expected) but said that
no entity was selected.
That was because com_editorActive was false, most probably because of
  e8a1eb8b Fix mouse remaining ungrabbed when running map from Radiant
which sets com_editorActive to false (via com->ActivateTool(false)) if
the Radiant window loses focus, which should be the case when opening
the light editor window.

`com_editors & EDITOR_RADIANT` is != 0 as long as the radiant is
running, no matter which window currently has focus, so it works better.
2022-05-30 00:33:16 +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