Commit graph

670 commits

Author SHA1 Message Date
Daniel Gibson
f024a8440c Mention stb_image and stb_vorbis in README 2021-04-27 20:08:59 +02:00
Daniel Gibson
1c13fe2d39 Use stb_vorbis instead of libogg and libvorbis(file)
Seems to work; note that idWaveFile is only ever used in idSoundSample::Load()

As stb_vorbis doesn't support custom callbacks for reading, I feed it
the full .ogg files as a buffer. Shouldn't make much of a difference
though - either the whole file is decoded on load anyway (so the buffer
is freed after decoding, or it's streamed, but in that case the old code
also kept the whole ogg file in memory by using idFily_Memory.

I also added warning messages in places where calls to stb_vorbis_*()
can fail, where there were none in the equivalent libvorbis code.
2021-04-27 20:08:59 +02:00
Daniel Gibson
1ae268a20e Fix stb_vorbis failing to load .ogg files without comments
fix taken from https://github.com/nothings/stb/pull/1095
2021-04-27 20:08:59 +02:00
Daniel Gibson
c1c8de214a Add stb_vorbis so it can replace libogg/vorbis(file)
from https://github.com/nothings/stb/

renamed it from .c to .h so build systems don't get confused.
2021-04-27 20:08:59 +02:00
Daniel Gibson
b0e0883f6e Replace libjpeg with stb_image.h
libjpeg is a pain in the ass, especially due to Ubuntu shipping
libjpeg-turbo in jpeg8 mode as their default libjpeg, while every other
distro I checked (including debian!) ships libjpeg-turbo in jpeg6.2 mode

Thankfully stb_image.h exists - just a single header and it even
has a (much!) friendlier API.

It's not like Doom3 (or any of the mods I checked) actually use JPEGs,
but I'm sure if I'd drop support completely, someone would complain
(perhaps rightfully so).
2021-04-27 20:08:59 +02:00
Daniel Gibson
bb7346579e GLimp_Init() Print actually received color/alpha/stencil/depth bits
to help debugging #368 and #348
2021-04-24 20:27:16 +02:00
Daniel Gibson
13ac657ebf Make deleting listenerSlot in idSoundWorldLocal::Shutdown() work
the problem was that the sources were still associated to it, because
they get deleted after the listenerSlot: the sources get freed in
idSoundSystemLocal::Shutdown() which is called by
idCommonLocal::ShutdownGame() in line 3217,
while the listenerSlot is deleted via idSessionLocal::Shutdown()
-> delete sw/rw -> idSoundWorldLocal::~idSoundWorldLocal()
-> idSoundWorldLocal::Shutdown() - and idSessionLocal::Shutdown() is
called in idCommonLocal::ShutdownGame() line 3211, before the other.

I'm not gonna mess with the order of deleting things in ShutdownGame(),
but it's sufficient to unassociate the effect slot from the source
when destroying the emitters in idSoundWorldLocal::Shutdown(),
by adding a call for that to idSoundChannel::ALStop() - and destroying
the emitters before deleting listenerSlot.

Before this fix, with ALSOFT_LOGLEVEL=3 you got the following warning:
  (WW) Error generated on context 0x5578fce2a280, code 0xa004,
  "Deleting in-use effect slot 1"
Thanks for openal-soft's KittyCat for pointing this out!
2021-04-12 19:17:12 +02:00
Turo Lamminen
9c6b835f16 Fix uninitialized members of drawInteraction_t in RB_CreateSingleDrawInteractions 2021-04-12 19:13:39 +02:00
Turo Lamminen
cbd59321a8 Fix uninitialized members in idSoundWorldLocal 2021-04-12 19:13:39 +02:00
Daniel Gibson
81a8611aba
Merge pull request #342 from turol/warnings
Fix some warnings
2021-04-08 17:22:33 +02:00
Daniel Gibson
5adff43c6f Update ENGINE_VERSION to 1.5.2pre 2021-04-08 04:13:08 +02:00
Turo Lamminen
7aee2af217 Silence misleading indentation warnings 2021-03-15 13:02:45 +02:00
Turo Lamminen
8cfeb51b84 Silence an uninitialized variable warning 2021-03-15 13:02:45 +02:00
Turo Lamminen
1ae9ff7d74 Don't use memset to zero non-trivial type volumeIntegrals_t 2021-03-15 13:02:45 +02:00
Turo Lamminen
59940c9b2f Don't memcpy non-trivial type idDrawVert in idSurface constructor 2021-03-15 13:02:45 +02:00
Turo Lamminen
8d2d41345d Don't use memset in idMat6::Zero 2021-03-15 13:02:45 +02:00
Turo Lamminen
30175c72ae Be more careful with memcpy in idMat6 constructor 2021-03-15 13:02:45 +02:00
Turo Lamminen
669e259787 Don't use memset in idMat5::Zero 2021-03-15 13:02:45 +02:00
Turo Lamminen
6a7bb7e305 Don't use memcpy in idMat5 constructor 2021-03-15 13:02:45 +02:00
Turo Lamminen
8fa3793410 Don't use memset in idMat4::Zero 2021-03-15 13:02:45 +02:00
Turo Lamminen
57f09de425 Don't use memcpy in idMat4 constructor 2021-03-15 13:02:45 +02:00
Turo Lamminen
37ed3e9e46 Don't use memset in idMat3::Zero 2021-03-15 13:02:45 +02:00
Turo Lamminen
c67c455180 Don't use memcpy in idMat3 constructor 2021-03-15 13:02:45 +02:00
Turo Lamminen
df9d8cf0ce Don't use memcpy in idMat2 constructor 2021-03-15 13:02:45 +02:00
Daniel Gibson
441c26e5b0 README: how to crosscompile for AMD64, fixes #352 2021-03-14 03:51:07 +01:00
Daniel Gibson
c0421c9e0f Set ENGINE_VERSION to 1.5.1, remove usage of C++11 nullptr 2021-03-14 03:43:58 +01:00
Stradex
f2239c75da fix: cdkey check now properly disable in clients 2021-03-08 17:56:26 +01:00
Daniel Gibson
d54ccee1f5 Update date for reproducible builds for 1.5.1 RC3 2021-02-22 03:18:34 +01:00
Daniel Gibson
891f8720fc Fix Win32/VS build on Win64 hosts
Turns out that ${CMAKE_SYSTEM_PROCESSOR} is broken on Windows
(both for Visual Studio and for 32bit MinGW/msys shells which for some
 reason seem to output x86_64 in uname -a)

Also suppressed -Wclass-memaccess warnings from GCC >= 8
2021-02-22 02:48:39 +01:00
Daniel Gibson
4bd46b3e28 Fix player's clipModel->axis when loading savegame, fixes #328
idClipModel::axis is an idMat3 rotation matrix.
Usually it's an identity matrix, but if the player is pushed around by
an idPush entity it's modified and apparently can (wrongly) remain
modified, possibly when saving while idPush is active.
This seems to happen sometimes on the crashing elevator in game/delta1.
The fix/workaround is to reset it to mat3_identity when loading a
savegame.
2021-02-21 06:05:47 +01:00
Daniel Gibson
1b2baf43ad Add information about dhewm3 build to savegames
like the dhewm3 version and the OS and architecture of the dhewm3
version that created the savegame.
Also added an internalSavegameVersion so be independent of BUILD_NUMBER

fixes #344
2021-02-21 06:05:47 +01:00
Daniel Gibson
2c58b2fb44 Fix savegame-compatibility of scripts, increase BUILD_NUMBER
"Fix "t->c->value.argSize == func->parmTotal" Assertion in Scripts, #303"
had broken old savegames because the script checksum
(idProgram::CalculateChecksum()) changed, see #344.
This is fixed now, also the BUILD_NUMBER is increased so old savegames
can be identified for a workaround.

Don't use this commit without the next one which will further modify the
savegame format (for the new BUILD_NUMBER 1305)
2021-02-21 06:05:47 +01:00
Daniel Gibson
2139a122c5 Revert "Use SDL2's own SDL2.cmake."
This reverts commit 01ac144b09.

Looks like this broke the build on some systems, because some
package managers pack SDL2Config.cmake and others pack sdl2-config.cmake
in their SDL2 development packages (for some reason, SDL2 seems
to ship both in their source, and they appear to be incompatible).

Shipping our own FindSDL2.cmake might be unclean/ugly/whatever, but
at least it works (most of the time? at least it appears to work better
than not shipping it)
2021-01-24 04:10:18 +01:00
HarrievG
5dd826ee38 Dll load errors (#1)
* Windows DLL-Load-Errors
Added error reporting using formatmessage, ignoring if the DLL just
doesn't exist, custom warning for "[193 (0xC1)] is not a valid Win32
application." (probably wrong architecture)

* update gitignore with build folder
2021-01-18 00:38:29 +01:00
Daniel Gibson
430a8f5e95 POSIX: Show errormessage if loading a (Mod) .so failed, refs #318
.. but only if the file exists.
It's ok if mods don't have their own DLL/.so, but if they do have one
and loading fails it's interesting why they failed (e.g. no access
rights, 64bit lib with 32bit executable or other way around, missing
symbols due to wrong libc version, ...)

The same should be done for Windows, but that's still TODO.
2021-01-17 06:58:13 +01:00
Daniel Gibson
117f0948e4 Posix_InitConsoleInput(): Accept everything that starts with "xterm-"
no matter if it's xterm-color or xterm-256color or whatever
2021-01-16 05:34:58 +01:00
Daniel Gibson
8f467d678b Fix build on Windows+MSVC after removing FindSDL2.cmake
I updated sdl2-config.cmake in dhewm3-libs so building on Windows with
them works again, however that required also a little change in
dhewm3's CMakeLists.txt

I also still had some uncommited changes for that fullscreen workaround
that I'm committing now.
2021-01-16 04:47:27 +01:00
Tobias Frost
01ac144b09 Use SDL2's own SDL2.cmake. 2021-01-16 04:40:38 +01:00
Daniel Gibson
9a83b3def4 Add r_fullscreenDesktop CVar for "desktop"/windowed fullscreen mode
.. that doesn't switch the display resolution, but creates a borderless
fullscreen window at current desktop resolution.
SDL2-only (SDL_WINDOW_FULLSCREEN_DESKTOP).

Doing this with an additional CVar instead of r_fullscreen 2 or similar
has the advantage that it works properly with Alt-Enter
2021-01-15 18:24:48 +01:00
Daniel Gibson
d1b0073582 Try to enforce selected fullscreen resolution
SDL has a bug (at least on Windows) where SDL_CreateWindow() with
SDL_WINDOW_FULLSCREEN doesn't use the configured resolution (if it's
higher than the current desktop resolution).
Try to work around that - based on Yamagi Quake II code.

Also, if GLimp_Init() fails, the "safe mode" fallback is now in
windowed mode instead of fullscreen mode.
2021-01-15 18:24:48 +01:00
Tobias Frost
8c699cd030 s/referneces/references 2021-01-15 18:00:25 +01:00
Boris I. Bendovsky
fa51007a6f Calculate EFX occlusion as in Creative's EFX-Util 2021-01-15 17:57:39 +01:00
Boris I. Bendovsky
432b86fdeb Calculate EFX density as in EFX-Util 2021-01-15 17:57:17 +01:00
Daniel Gibson
7297ebcaf6 Fix fonts on Big Endian systems, fixes #148
The code used #ifdef __ppc__, probably a leftover from old Mac support,
which apparently doesn't work on all PPC systems (maybe not 64bit PPC).

Now using the LittleFloat() function instead which exists for
exactly this purpose and already handles endianess properly.
2021-01-14 12:25:22 +01:00
Petter Uvesten
bbe30e300c Enable building on Apple Silicon 2020-11-02 06:01:02 +01:00
Daniel Gibson
c4c7236352 Fix "t->c->value.argSize == func->parmTotal" Assertion in Scripts, #303
If a "class" (object) in a Script has multiple member function
prototypes, and one function implementation later calls another before
that is implemented, there was an assertion when the script was parsed
(at map start), because the size of function arguments at the call-site
didn't match what the function expected - because the function hadn't
calculated that size yet, that only happened once its own
implementation was parsed.
Now it's calculated (and stored) when the prototype/declaration is
parsed to prevent this issue, which seems to be kinda common with Mods,
esp. Script-only mods, as the release game DLLs had Assertions disabled.
2020-09-05 20:46:01 +02:00
Daniel Gibson
c684c38f2d SDL2: Create window on display the cursor is currently on, fix #309
I hope this provides a good enough way to "select" the display to play on.
2020-09-05 20:31:14 +02:00
Daniel Gibson
12fa3eb814 Disable broken idSIMD_SSE::UpSampleOGGTo44kHz()
It corrupted the stack when called with buffers allocated on the stack
and numSamples that are not a multiple of four, apparently, by writing
4 floats too many, at least in the 22KHz Stereo case..

This caused the crash described in
  https://github.com/dhewm/dhewm3/issues/303#issuecomment-678809662

Now it just uses the generic C code, like all platforms besides MSVC/x86
already do.
2020-09-05 20:28:03 +02:00
Daniel Gibson
8b66bad68f Windows/VS: Fix Build with VS2019 integrated CMake, set startup project
Apparently VS2019 (or its integrated CMake?) interpreted
add_definitions(/MP) as "also pass it to rc.exe" which didn't like it..
no idea why this worked before, but now it seems to work everywhere.
fix #304

Also set VS_STARTUP_PROJECT so when launching the debugger in VS it doesn't
try to launch ALL_BUILD (...) but dhewm3.
2020-08-02 04:41:45 +02:00
Daniel Gibson
7d2bda07a3 Don't use translation in Autosave filenames, fixes #305
idSessionLocal::SaveGame() uses saveName for both the description in
savegames/bla.txt and the filename itself ("bla" in this case), which
is a "scrubbed" version of that string ("file extension" removed,
problematic chars replaced with '_').
In case of Autosaves, MoveToNewMap() passes a translated name of the
map as saveName, which makes sense for the description, but not so much
for the filename.
In Spanish the Alpha Labs names are like "LAB. ALFA 1", "LAB. ALFA 2" ..
and everything after "LAB" is cut off as a file extension - so every
autosave of an Alpha Labs part overwrites the last one, as they all get
the same name...

The solution is to pass an additional (optional) argument saveFileName
to idSessionLocal::SaveGame(), and for autosaves pass the mapname
(which is the filename without .map; yes, it might contain slashes,
but the scrubber will turn them into _) instead of the translated name
as saveFileName.
2020-08-02 03:48:25 +02:00