Commit graph

79 commits

Author SHA1 Message Date
Daniel Gibson
6be179db7c 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
2024-03-18 23:28:29 +01:00
Daniel Gibson
0afb7cc4f7 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
2024-03-18 23:28:29 +01:00
Daniel Gibson
4571556d9e Fix some ubsan warnings 2024-03-18 23:28:29 +01:00
Daniel Gibson
188752e15d 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)
2024-03-18 23:28:29 +01:00
Daniel Gibson
68f062ec38 Improve some messages in game code
- TestHugeTranslation() prints positions (and asserts only afterwards),
  from "Work around assertion in alphalabs4, fix #409"
- idCompiler::CompileFile() prints proper filename
  from "Fix usage of invalid pointer in idCompiler::CompileFile()"
2022-05-29 00:29:54 +02:00
Daniel Gibson
dfff91f607 Use idStr::Copynz() instead of strncpy()
to guarantee \0-termination
(only the applicable parts of that dhewm3 commit)
2022-05-29 00:29:54 +02:00
Daniel Gibson
0abcd40105 From dhewm3: Fix most (according to warnings) remaining 64bit issues in tool code
only the TypeInfo changes are applicable to the SDK
2022-05-29 00:29:54 +02:00
Daniel Gibson
09cb9cb322 Remove usage of C++11 nullptr 2022-05-29 00:29:54 +02:00
Daniel Gibson
a79217c471 make fitz run more stable 2021-02-22 06:03:07 +01:00
Daniel Gibson
1d3076166f 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-22 05:32:38 +01:00
Daniel Gibson
26b5803394 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-22 05:32:38 +01:00
Daniel Gibson
be607a43b9 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-22 05:32:38 +01:00
Daniel Gibson
5f749e985e 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.
2021-01-18 02:59:03 +01:00
Daniel Gibson
76e8488d39 Fix lingering messages in HUD after loading savegame
If you save, you get a message like "Game Saved..." which goes away
after a few seconds. This happens at the very end of idPlayer::Save():
    if ( hud ) {
        hud->SetStateString( "message", /* .. left out .. */ );
        hud->HandleNamedEvent( "Message" );
    }
And handled in hud.gui, "onNamedEvent Message { ..."

However, if you save again before it's gone, it'll be shown after
loading the savegame and not go away until you save again..
This works around that issue by setting an empty message after loading
a savegame.

The underlying problem (which is not fixed!) seems to be that the
transition GUI command (that's executed when hud.gui handles the
"Message" event that's used to show this message) is probably not
properly saved/restored so fading out the message isn't continued
after loading.
2021-01-18 02:59:03 +01:00
Daniel Gibson
114a99cf83 Add Code of Fitz Packerton
It's a short experimental standalone game based on the Doom3 Engine.

I got the source at http://blendogames.com/older.htm
You can get the game at https://teddydief.itch.io/fitz
2018-12-09 04:57:32 +01:00
Daniel Gibson
4dd278d6fb Make game dll names and compiler defines for mods configurable
so mod authors can tell cmake to call it mymod.dll instead of base.dll
or d3xp.dll

and the compiler defines are also easily configurable now

I also added a comment to EndLevel.cpp, which was released with the GPL
source (and in d3xp/ it already existed in the SDK), but has not been
used to build the dlls.
2018-08-26 04:47:00 +02:00
Daniel Gibson
53db277bae Make it build as SDK
I created this repo from the original dhewm3 repo, but I used
git filter-branch to kill all the files that are not needed to just
build base.dll and d3xp.dll (or .so or .dylib or whatever).
So this is basically just the files the original Doom3 SDK had, but
taken from dhewm3 instead (and thus GPL licensed and patched for
64bit-support etc) + some dhewm3 specific stuff + CMakeLists.txt
to build them.

The git filter-branch details:

filter-branch -f --prune-empty --tree-filter /tmp/killkill.sh @

## /tmp/killkill.sh:

#!/bin/sh

find . -exec /tmp/removeothers.sh {} \;

exit 0

## /tmp/removeothers.sh:

#!/bin/bash

FNAME="$1"

if [[ $FNAME == \./\.git* ]] || [[ $FNAME == \./d3xp/* ]] || [[ $FNAME == \./game/* ]]
then
	#echo "ignoring $FNAME"
	exit 0
fi

if ! grep -Fxq "$FNAME" /tmp/d3sdklist.txt
then
	#echo "REMOVING $FNAME"
	rm -rf "$FNAME"
fi

exit 0

## /tmp/d3sdklist.txt was is just a textfile with one path per line with
   all the files (and directories!) I wanted to keep, like:

.
..
./sys/platform.h
./framework/Game.h
./config.h.in
./CMakeLists.txt
## ... and all the relevant files from the SDK
2018-08-26 01:43:10 +02:00
Tobias Frost
84e5ef45bc Some spelling error fixes found during Debian build
- s/allready/already
- s/Uknown/Unknown
- s/thier/their
2018-08-20 01:46:40 +02:00
Daniel Gibson
86c634b55c Fix new[]/delete missmatches and memory leaks found by clang's ASAN
Sometimes memory was allocated with new[] but freed with delete instead
of delete[], which is wrong.
And there were some small memory leaks, too.
Furtunately clang's AddressSanitizer detected all that so I could easily
fix it.

(There seem to be some more small memory leaks which are harder to fix,
though)
2018-08-20 01:46:39 +02:00
Daniel Gibson
4ad1349113 Fix crash by assert in last RoE level (and maybe elsewhere)
The assertion in idBounds::operator-(const idBounds&) was triggered
from idWeapon::Event_LaunchProjectiles() (ownerBounds - projBounds)
It only happened when using the BFG.
So I added a check to make sure calling operator- is legal.

I guess this also caused #122
2018-08-20 01:46:39 +02:00
leffmann
a5a46de8f9 make d3xp build with Visual Studio 14 2018-08-20 01:46:39 +02:00
Daniel Gibson
34490bb875 Fix some compiler warnings (wrong types, superfluous checks, printf-fuckup) 2018-08-20 01:46:38 +02:00
Daniel Gibson
5e13e6f36f (Hopefully) fix crashes in MP if r_aspectRatio = -1, fix #70
While I couldn't reproduce the crash, according to the bugreport it
happens if renderSystem->GetScreenWidth()/Height() returned 0 - and
that is indeed the only plausible reason I can imagine for it.

So I check for that case and handle it gracefully by defaulting to
4:3 FOV values.
2018-08-20 01:46:38 +02:00
Tobias Frost
7b7c7a5238 Fixing some spelling errors: s/unkown/unknown, s/seperate/separate. (#107) 2018-08-20 01:46:38 +02:00
Zohar Malamant
5a9cdc2ed8 fixed potential bug. 2018-08-20 01:46:38 +02:00
Daniel Gibson
63aa4b1036 3c96e19610 for d3xp/ - fix miscompilation with gcc 4.5
idAnimator::GetJointLocalTransform() miscompiles with gcc 4.5 and
-ftree-vrp (implied by -O2).

Reorder code to avoid the compiler bug, no functional change.

The original commit was for game/ only, but d3xp/ will have the same
issues..
2018-08-20 01:46:37 +02:00
Daniel Gibson
385a1965e7 Guess x/y FOV/aspectratio from resolution
Added r_aspectratio -1 which means "auto" (as new default).
This mode sets fov_x and fov_y according to screen-width/height.
=> No need to set r_aspectratio manually anymore (assuming your display's
   pixels are about square).

The standard aspect ratios can still be enforced as before, though.
2018-08-20 01:46:37 +02:00
Daniel Gibson
ed1ffa8060 Fix several bugs from iodoom3 bugtracker
Apply 94cd0ee5 to d3xp as well.
2018-08-20 01:46:37 +02:00
dhewg
8275299d7e More logging cleanup 2018-08-20 01:46:36 +02:00
dhewg
49067a82aa Get rid of Sys_FPU_StackIsEmpty()
Same as with Sys_FPU_GetState().
2018-08-20 01:46:35 +02:00
dhewg
16871256f8 Get rid of Sys_FPU_GetState()
This was only implemented with MSVC style asm.
Comments suggest that it was used to help catch invalid FOV calculations,
which were probably only happening with ancient compiler bugs.
2018-08-20 01:46:35 +02:00
dhewg
5aa122978d Don't try to extract libraries from gamepaks. 2018-08-20 01:46:34 +02:00
dhewg
e632cd030b Get rid of ID_DEMO_BUILD
There are no demo pk4s compatible to this 1.3.1 codebase.
2018-08-20 01:46:34 +02:00
dhewg
16657c0ce3 Rename PVS vars to match their type 2018-08-20 01:46:33 +02:00
dhewg
8dfc6df02a s/ReadDeltaLong/ReadDeltaInt/
to match the argument type
2018-08-20 01:46:33 +02:00
dhewg
8cd1580d60 s/WriteDeltaLong/WriteDeltaInt/
to match the return type
2018-08-20 01:46:33 +02:00
dhewg
431415c51c s/ReadLong/ReadInt/ to match the return type 2018-08-20 01:46:33 +02:00
dhewg
814abb55b9 s/WriteLong/WriteInt/ to match the argument type 2018-08-20 01:46:33 +02:00
Daniel Gibson
ce87a8904c Remove longs from game/ and d3xp/
(Except for handling of longs in TypeInfo and win32-only Maya import stuff).

sizeof(long) == sizeof(int) on x86 and win64,
but not on 64bit (x86_64) linux/unix/osx/.. so they should be avoided.
2018-08-20 01:46:33 +02:00
Daniel Gibson
5c08cb0140 Fix PVS calculations on 64bit systems
Monsters got stuck in same places of d3xp because PVS calculations
returned that they were not in the players PVS.
This only happened on LP64 systems like Unix/Linux amd64 where
sizeof(long) == 8 - it did not happen on Win64 because it's LLP64, i.e.
sizeof(long) == 4 (like on x86 32bit).

Bit fiddling code in Pvs.cpp seemed to assume that sizeof(long) == 4
like on win32.

Fixes #7.
2018-08-20 01:46:33 +02:00
dhewg
c5c5762ae4 Fix "unreachable code" warnings 2018-08-20 01:46:32 +02:00
dhewg
9de64efa62 This is dhewm 3
Rename project, now at https://github.com/dhewm
2018-08-20 01:46:32 +02:00
dhewg
6b30d96d44 Get rid of CPU_EASYARGS
Never use the event callbacks with mismatching prototypes.
2018-08-20 01:46:32 +02:00
dhewg
151288e170 CMake: Use config.h for BUILD_OS and BUILD_CPU
This fixes, among others, FreeBSD 64bit builds where the build
system used a "amd64" suffix and runtime "x86_64".
2018-08-20 01:46:32 +02:00
dhewg
ac090883ac More fixes regarding event saving and restoring
Fix silly issue from 3d692b58 (sizeof(E_EVENT_SIZEOF_VEC)).
Align entity values of events to the native pointer size, which
is noticeably faster on x86_64 and fixes another assert() in
debug builds.

Past savegames with entities in events are not compatible.
2018-08-20 01:46:32 +02:00
dhewg
0fb3d2d37f Prevent assert() while saving and restoring events
The argument size of each event is checked in debug builds
and this change was missing from the x86_64 commits.

Surprisingly this didn't trigger yet with the original game,
only with the mod 'Classic Doom 3'.
2018-08-20 01:46:32 +02:00
dhewg
851bd5901d Use correct idStr::Append() while saving event strings
Used the wrong Append() in fad99572, we want to stop at a
terminating null char.
2018-08-20 01:46:30 +02:00
dhewg
92023f44ca Implement saving and restoring of event strings
Required for events with string arguments. On debug builds
an assert() is triggered when trying to save such an event,
while events could not be properly restored in any build.

This happens when going from map delta4 to hell1 and the
autosave feature kicks in. The trigger event 'selectWeapon'
with the string argument 'weapon_fists' is in the event queue.

With the binary from id a warning is issued:
WARNING: player1 is not carrying weapon ''
so the bug exists in there too, just that its a release build
and doesn't abort().

I also managed to trigger this while saving shortly after
activating an elevator switch.
2018-08-20 01:46:30 +02:00
spiral
85a3a7089a Add ID_GAME_API for dllexport/attribute(visibility)
Delete obsolete Game.def exports files
2018-08-20 01:46:30 +02:00
spiral
3dc6127529 Remove MWERKS stuff 2018-08-20 01:46:29 +02:00