Commit graph

631 commits

Author SHA1 Message Date
raynorpat
bd37c3f91a Some additional LONG to LONG_PTR fixes for the tools as well as some warning fixes 2021-05-07 16:06:06 -04:00
raynorpat
d4c3d4a9df Resolve Win32-isms trying to build tools with x64 MSVC 2021-05-06 03:31:56 +02:00
Daniel Gibson
409dd8e3d9 Fix crash if both image_useCache and image_downSize are 1
the commented out code clamped the loaded filesize of affected .dds
images (crash observed with dds/guis/assets/splash/pdtempa.dds) to
200KB - but then later tries to load it and skip the first mipmap,
resuling in reading invalid memory (> 200KB into the file).
No idea what this was supposed to achieve, but it's disabled now
and the crash (at startup) is gone.

fixes #374
2021-04-28 00:04:24 +02:00
Daniel Gibson
5f346c7355 Add s_alReverbGain CVar to reduce intensity of reverb effects, fix #365
It can be set to a value between 0.0 and 1.0.
1.0 sounds like it did before introducing this cvar; as many people
found the the effect way to strong, I made 0.5 the default value
2021-04-27 20:08:59 +02:00
Daniel Gibson
954ff88759 Properly pause sounds when entering menu, fixes #330
Otherwise especially looped sounds continue playing while the menu
is open, especially noticeable when opening the menu while firing
the chaingun (the whirring sound continues playing).
2021-04-27 20:08:59 +02:00
Daniel Gibson
1b61053c53 idSoundSample::Load() uses s_decompressionLimit for oggs again
The code to decompress OGG files directly on load if they're shorter
than s_decompressionLimit seconds (usually 6) accidentally got broken
when removing the non-OpenAL soundbackends:
`if ( objectInfo.wFormatTag == WAVE_FORMAT_TAG_OGG )` slipped into the
`if ( objectInfo.wFormatTag == WAVE_FORMAT_TAG_PCM )` block - obviously
both can't be true at the same time so the OGG case was never executed.
Now it's in its own block again. I put it into a {} scope so it doesn't
have to be re-indented (=> more useful with git blame)
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
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