Commit graph

237 commits

Author SHA1 Message Date
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
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
f07999ecf2 VS Pro doesn't choose the right default like Express, so be explicit 2018-08-20 01:46:30 +02:00
spiral
3dc6127529 Remove MWERKS stuff 2018-08-20 01:46:29 +02:00
dhewg
01b5e365e8 Fix alignment issue with idBlockAlloc::Free()
Bug introduced with e97d3288. This doesn't work with MinGW, since
the struct members might not be aligned to the native pointer
size (in this case idSampleDecoderLocal was aligned to a 8 byte
boundary on win32).
Just switch the two members to avoid ugly code.
2018-08-20 01:46:29 +02:00
dhewg
22637272dc Check for jpeg_mem_src()
This function only exists starting with libjpeg8.
Check for existence and provide an implementation if necessary.
This allows libjpeg6 to be used.

Code borrowed from libjpeg8, adapt copyright in README
accordingly.
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
444da3574d Fix compiler checks for newer gcc versions
Use CXX instead of C checks - newer gcc versions refuse some
C++ flags when compiling C.
2018-08-20 01:46:29 +02:00
dhewg
a86defb0ca Change another _WIN32 to _MSC_VER for MinGW
Older MinGW versions do not know about __assume().
Change _WIN32 in comments too to match their opening #if.

Reported by serpentine.
2018-08-20 01:46:29 +02:00
dhewg
84d64029e5 New define IDSTR_NO_REDIRECT
The defines in idlib/Str.h won't be set to redirect the low
level c string functions to idStr when IDSTR_NO_REDIRECT is
set.

Fixes compilation for MSVC:
error C2761: 'Cmp' : member function redeclaration not allowed

Reported by spiral.
2018-08-20 01:46:29 +02:00
spiral
cceeb88948 CMake support for MSVC
Use the WIN32 flag for add_executable.
2018-08-20 01:46:29 +02:00
spiral
139726bc37 Add missing includes for MSVC
- MSVC doesn't provide C99 headers
- Default to min. req. 64Mb video mem if no COM present
- Move misplaced __attribute__((packed)) from MSVC to MinGW
2018-08-20 01:46:29 +02:00
dhewg
092059bd95 Get rid of the unused Sys_FPU_ClearStack 2018-08-20 01:46:29 +02:00
dhewg
cdeb7e7ff2 Get rid of Sys_GetProcessorString()
This was only used for a printf() and not implemented for all
the platforms we can now run on.
We also don't want to force a CPU type on Windows.
2018-08-20 01:46:29 +02:00
dhewg
975cda1637 Unify CPUID_FTZ and CPUID_DAZ
Get rid of the 2 CPUID flags and combine them with SSE in one
implementation.
SSE flags can now be set on all x86 and x86_64 platforms -
independent of -ffast-math.
Helper defines borrowed from STREFLOP.
2018-08-20 01:46:29 +02:00
dhewg
57b8d55db0 Get rid of unused CPUID flags 2018-08-20 01:46:29 +02:00
dhewg
a9e31c4225 Get rid of Sys_GetClockticks() and Sys_ClockTicksPerSecond()
Now unused.
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
d26cf44a29 Add GetMilliseconds to idSys
To be used for the overhauled idTimer in idlib/.
2018-08-20 01:46:29 +02:00
dhewg
ae551ee106 Port Sys_Milliseconds() to SDL
Sync with SDL and use unsigned int as return type.
Code outside of sys/ still uses signed ints to store the result.
2018-08-20 01:46:29 +02:00
dhewg
9101f2e5a0 Port Sys_Sleep() to SDL 2018-08-20 01:46:29 +02:00