Commit graph

19 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
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
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
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
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
6f0fc9fcc1 Fix -Wunused-variable warnings
unused variable
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