Commit graph

307 commits

Author SHA1 Message Date
Daniel Gibson
a9a6042a04 Remove usage of long type from idlib/
Apart from some minor stuff, this changes the signature of some methods
of Parser and Token classes and of the (unused) Random2 class.
That no problem though, because the calling code uses normal ints
anyway.
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
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
Daniel Gibson
d51c05c768 Fix idMatX::IsOrthonormal()
The original implementation was pretty broken (but not used anyway),
it is now fixed and improved a bit (got rid of one inner loop).
This (at least part of the problem) was detected by PVS-Studio,
see http://www.viva64.com/en/b/0120/ Fragment 3
2018-08-20 01:46:33 +02:00
dhewg
5199d8ea65 Add the build target "Profile" suitable for profiling 2018-08-20 01:46:32 +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
5b49b7242b Get rid of unused defines in Licensee.h 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
a6796cb444 CMake: Detect libcurl and use it when found
Move ID_ENABLE_CURL to config.h
2018-08-20 01:46:32 +02:00
dhewg
6dfe95e732 CMake: Create config.h
Use config.h for configure time settings.
2018-08-20 01:46:32 +02:00
dhewg
9ee84519fa CMake: Use CMAKE_SOURCE_DIR
Instead of CMAKE_CURRENT_SOURCE_DIR.
2018-08-20 01:46:32 +02:00
dhewg
c7d406835e Get rid of ID_OPENAL
This is always required for clients.
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
b8f1a3e38c Port EAX to EFX
First attempt at porting the EAX reverb code to EFX.
This only works when the ALC_EXT_EFX extension is supported by
the OpenAL vendor (which is not the case for the OSX supplied
framework, use OpenAL soft instead).

The current stable version of OpenAL Soft (v1.13 as of this
writing) can barely handle this additional workload, current
master is highly recommended when using this feature.
2018-08-20 01:46:32 +02:00
dhewg
b87bd8040f Get rid of memory status functions
Unused.
2018-08-20 01:46:32 +02:00
dhewg
cdefb2ba7a Always allow multiple instances 2018-08-20 01:46:32 +02:00
dhewg
a1fe69f429 Get rid of Sys_DefaultCDPath()
Stub on all platforms.
2018-08-20 01:46:32 +02:00
dhewg
a5d6a76961 Get rid of ID_MCHECK
mcheck() is not thread safe, use MALLOC_CHECK_ or TCMalloc
instead.
2018-08-20 01:46:31 +02:00
spiral
f9af2c0153 Remove hard-wired -framework OpenAL
We already link to OPENAL_LIBRARY further down.

Log some debug OpenAL info, mainly so OSX users can check they are not
using Apple's OpenAL. OpenAL Soft is recommended as it fixes many
issues.

I specify it as follows:

cmake -DOPENAL_LIBRARY=/usr/local/lib/libopenal.dylib -DOPENAL_INCLUDE_DIR=/usr/local/include -GXcode ../neo/

(because FindOpenAL.cmake prefers the /System frameworks)
2018-08-20 01:46:31 +02:00
dhewg
4be94a8ff5 Move jpeg_memory_src()
Found another copy in renderer/Cinematic.cpp. Move the
newer implementation from renderer/Image_files.cpp in its
own file and use the libjpeg v8c license blob (which is where
this code comes from).

Adapt README too with the v8c license.
2018-08-20 01:46:31 +02:00
dhewg
f5db1e5dcf Disable a few MSVC warnings
These just spam the console. Some are useless, some need to be
looked at at some point.
2018-08-20 01:46:31 +02:00
dhewg
a1430d546f Add SDL_win32_main.c
Don't link against SDLmain.[a|lib], always compile it.
We can use pure C MinGW cross compiled libraries with MSVC, and
this is the only static library used.
2018-08-20 01:46:31 +02:00
dhewg
568ab14658 Add support for the doom3-libs repo
Single CMake variable "DOOM3LIBS" to point to the repo of
binaries to make CMake find libraries from there.
2018-08-20 01:46:31 +02:00
dhewg
d0846bdae8 Include malloc.h for alloca for MinGW
Newer versions of MinGW do not seem to require this, but older
ones do.
2018-08-20 01:46:31 +02:00
dhewg
7d5c0e1fd7 Rename FILE_[EXEC|OPEN] due to conflict
Some MinGW versions already define it.
2018-08-20 01:46:31 +02:00
spiral
4740b5b2be Generate an .app bundle for OSX
Add missing SDLMain and icon/resource files to generated .xcodeproj

Now builds on Lion in XCode4 with the 10.6 SDK using LLVM-GCC4.2.

Also tested on WinXP in VS 9 2008 Professional, I don't appear to have
broken anything there, stuff like MACOSX_BUNDLE_INFO_PLIST is
effectively ignored.
2018-08-20 01:46:31 +02:00
scottWakeling
0d01f4f90b Fix semi-colons being inserted into ldflags
It is causing clang++ to error when linking game{cpu}.dylib
2018-08-20 01:46:31 +02:00
dhewg
16e2bf160d OSX .dylib's do not get a CPU suffix 2018-08-20 01:46:31 +02:00
dhewg
eab62d8ef3 Rename game${cpu}-d3xp to d3xp${cpu} 2018-08-20 01:46:31 +02:00
dhewg
8e1fab5a5b Drop the cpu suffix on binaries 2018-08-20 01:46:31 +02:00
dhewg
11eb754b41 Get rid of Sys_DoPreferences()
The OSX backend was the only one utilizing this to set CVars
for the video mode.
Not required anymore since its now based on SDL.
2018-08-20 01:46:31 +02:00
dhewg
f29a3d936f Don't link against X11 libraries
Not required anymore. All backends use SDL based implementations
now.
2018-08-20 01:46:31 +02:00
dhewg
8473a83ae9 Use SDL GLimp and input implementations on OSX 2018-08-20 01:46:31 +02:00
dhewg
0993ec8760 Move OSX ATI_fragment_shader functions
Move the software implementation to
sys/glimp_ati_fragment_shader.cpp in preparation to move to
the SDL based GLimp and events.
2018-08-20 01:46:31 +02:00
dhewg
15f23f48ac Get rid of dead code in the OSX backend
Not used by anything.
2018-08-20 01:46:31 +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
d2b2285345 Use SDL_opengl.h
That already contains an up to date glext.h.
2018-08-20 01:46:30 +02:00
dhewg
f54253d966 Don't use a console lock on Windows or OSX builds
Sync with Linux.
2018-08-20 01:46:30 +02:00
dhewg
5fa6e06748 Use SDL GLimp and input implementations on Windows
The DirectX SDK is not required anymore.
2018-08-20 01:46:30 +02:00
dhewg
7dd30d9db6 Make Sys_GetScanTable() only available on Windows
Sys_GetScanTable() and MapKey() are only used by the Windows backend
or the Windows-only tools.
Rename to Win_GetScanTable() and move MapKey() as Win_MapKey() to
win_input.cpp.
2018-08-20 01:46:30 +02:00
dhewg
3c5c70eba2 Port Linux events to SDL
New CVar "in_kbd" to set the layout for the keyboard. SDL 1.2
doesn't offer any way to determine it, and we need this feature
to use the same key for toggling the console independent of the
keyboard layout.
The old "in_nograb" from the Linux backend is still supported.
2018-08-20 01:46:30 +02:00
dhewg
4dbf6d2329 Rename Posix_ConsoleInput() to Sys_ConsoleInput()
Sync with Windows implementation and add it to sys_public.h in
preparation to move the event queue to SDL.
2018-08-20 01:46:30 +02:00
dhewg
ff36277408 Port Linux GLimp to SDL
Use SDL to set video modes, get a GL context and detect the
amount of VRAM.
As with the Linux GLimp implementation, sys_videoRam can be used
in case the SDL detection fails.
2018-08-20 01:46:30 +02:00
dhewg
1597e6c3b3 Always link the Windows binaries against OpenGL
Just as with every other platform.
2018-08-20 01:46:30 +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