Commit graph

43 commits

Author SHA1 Message Date
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
Daniel Gibson
ca4b20eb08 Fix several bugs from iodoom3 bugtracker
rhyskidd@gmail.com found them (with PVS studio IIRC), reported them and posted
patches.
Some of the patches were incorrect so I rewrote them.
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
a8b4f9e5f6 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.
2018-08-20 01:46:31 +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
dhewg
27c5fd76ff Fix -Woverloaded-virtual warnings
We want to use the SIMD functions of the base class if the
deriving class does not implement every overloaded variant.

Added missing idLight::SetColor(idVec3) which is declared in
idEntity.
2018-08-20 01:46:29 +02:00
dhewg
79ad74d779 Use idSys::GetMilliseconds() for idTimer
The class is only used for debugging and statistical purposes.
The precision is now reduced to milliseconds, but that's only
relevant for fine grained debug timings - where the old code
was inaccurate at anyway.
2018-08-20 01:46:29 +02:00
dhewg
afebd7e1e5 Untangle the epic precompiled.h mess
Don't include the lazy precompiled.h everywhere, only what's
required for the compilation unit.
platform.h needs to be included instead to provide all essential
defines and types.
All includes use the relative path to the neo or the game
specific root.
Move all idlib related includes from idlib/Lib.h to precompiled.h.
precompiled.h still exists for the MFC stuff in tools/.
Add some missing header guards.
2018-08-20 01:46:28 +02:00
dhewg
b96309c22b Split Game_local.h
New header GameBase.h with all the defines from Game_local.h and
gameError() to reduce header dependencies.
2018-08-20 01:46:27 +02:00
dhewg
d76358afc2 Move the virtual abstract idGame to framework/Game.h
This is game independent and code outside of game/ and d3xp/
doesn't need to know about anything game specific.
2018-08-20 01:46:27 +02:00
dhewg
c647c61d4a Mark unused variable in a non-debug build as such
Forgot this one in be40e9d6
2018-08-20 01:46:27 +02:00
dhewg
e03c6fcb59 Disable sound backend entry in the option menu
"Reverse channels", woooo
2018-08-20 01:46:27 +02:00
dhewg
5c716c569f Fix binary op fail in idTarget_WaitForButton::Think 2018-08-20 01:46:25 +02:00
dhewg
4cfc2d87a5 Fix compilation for *BSD
Change most __linux__ defines to __unix__ for all UNIX like systems.
2018-08-20 01:46:25 +02:00
dhewg
471f51ef9b Fix -Wformat and -Wformat-extra-args warnings
Fix format specifiers and use the C99 %zd for types of size_t and
alike.
2018-08-20 01:46:25 +02:00
dhewg
f8efcf5e90 Fix script interpreter stack for x86_64
Alot of stack and event variables are pointers. Align the size of
all script and event variable types to sizeof(intptr_t) so that
the CPU needs only one fetch insn on 64bit archs.

Tested on x86 and x86_64 and found no different script behaviours
compared to the binary from id.
Savegames on x86_64 do work, but are not compatible to x86 and vice
versa (among other issues, the stack is written to file as-is).
x86 builds can still load savegames from the official binary and
vice versa.
2018-08-20 01:46:24 +02:00
dhewg
17dd12384c Fix shared library loading for x86_64
Library handles are "void *" on posix.
2018-08-20 01:46:24 +02:00
dhewg
30dd372efa Fix event callbacks for x86_64
Fix remaining event related code for the new intptr_t value type.
Regenerated game/gamesys/Callbacks.cpp via CREATE_EVENT_CODE.
2018-08-20 01:46:24 +02:00
dhewg
379ab902bb Fix idEventArg for x86_64
Pointers are passed through events; change the event value type to
intptr_t to provide enough bits.
2018-08-20 01:46:24 +02:00
dhewg
ba1adc839f Trivial pointer cast fixes for x86_64 2018-08-20 01:46:24 +02:00
dhewg
fc5f9ed56b Mark unused variables in a non-debug build as such
Variables which are only used in assert().
2018-08-20 01:46:24 +02:00
dhewg
f4f5d9c914 Fix -Wparentheses warnings
suggest explicit braces to avoid ambiguous ‘else’
suggest parentheses around ‘&&’ within ‘||’
suggest parentheses around ‘-’ in operand of ‘&’
suggest parentheses around arithmetic in operand of ‘|’
equality comparison with extraneous parentheses

Functional change:
Proper HELLTIME check in Playerview due to missing parentheses.
2018-08-20 01:46:24 +02:00
dhewg
06a5468d4d Fix -Wuninitialized warnings
may be used uninitialized in this function
2018-08-20 01:46:23 +02:00
dhewg
6ff59d90bf Fix -Wunused-value warnings
value computed is not used
left operand of comma operator has no effect
right operand of comma operator has no effect
2018-08-20 01:46:23 +02:00
dhewg
74f7302c71 Fix -Wunused-but-set-variable warnings
variable set but not used

Removes some CollisionModel code under _DEBUG which was probably a
leftover, since it was completely useless (its done later anyways).
2018-08-20 01:46:23 +02:00
dhewg
6f0fc9fcc1 Fix -Wunused-variable warnings
unused variable
2018-08-20 01:46:23 +02:00
dhewg
d72b17f3a2 Fix -Wunused-function warnings
defined but not used
2018-08-20 01:46:23 +02:00
dhewg
98fbe07684 Fix -Wpointer-arith warnings
NULL used in arithmetic
2018-08-20 01:46:23 +02:00
dhewg
c155107ba9 Fix -Wconversion-null warnings
converting to non-pointer type ‘int’ from NULL
2018-08-20 01:46:23 +02:00
dhewg
64df913412 Fix -Wwrite-strings warnings
deprecated conversion from string constant to ‘char*’

Constify lots of "char *".
2018-08-20 01:46:22 +02:00
dhewg
d83cf21bde Fix -Wchar-subscripts warnings
array subscript has type ‘char’
2018-08-20 01:46:22 +02:00
dhewg
c7c187e4dc Fix all whitespace errors
Excluding 3rd party files.
2018-08-20 01:46:22 +02:00
dhewg
eac3112d2d Fix quoting in GPL headers 2018-08-20 01:46:21 +02:00
Timothee 'TTimo' Besset
aa3dbca015 hello world 2011-11-22 15:28:15 -06:00