Commit graph

311 commits

Author SHA1 Message Date
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
dhewg
f1a7b426fe Port all thread related functions to SDL
Setting thread priorities has been dropped (it is not portable).
The background download thread now exits gracefully.
g_threads is not public anymore.
2018-08-20 01:46:29 +02:00
dhewg
3c2c603cf4 Move MAX_THREADS as define to BuildDefines.h 2018-08-20 01:46:29 +02:00
dhewg
efbd47f4bc Port critical sections and events to SDL
Use SDL mutexes and conditions.
One new critical section CRITICAL_SECTION_SYS for events.
2018-08-20 01:46:29 +02:00
dhewg
f41d2347b1 Use SDL for everything endian 2018-08-20 01:46:29 +02:00
dhewg
0a945baff1 Initial SDL setup
Use SDL_main on all platforms.
Fix main() for non-const argv so it matches with the SDL
prototype.
Adapt win32 WinMain() to main() and get rid of the win32 special
case in Common::Init().
2018-08-20 01:46:28 +02:00
dhewg
980937db1a Link MinGW binaries with -mwindows
mingw-w64 requires this when linking gui applications.
2018-08-20 01:46:28 +02:00
dhewg
c476c0b168 Get rid of -Wno-unknown-pragmas
Not required anymore.
2018-08-20 01:46:28 +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
c63e63b234 Move constants from AsyncNetwork.h
Make those defines in BuildDefines.h instead to reduce header
dependencies.
2018-08-20 01:46:27 +02:00
dhewg
4df3236c3e Adapt structs for easy forward declarations
Get rid of the tag namespace.
2018-08-20 01:46:27 +02:00
dhewg
8f4d16fd1b Move BuildDefines.h include to platform.h 2018-08-20 01:46:27 +02:00
dhewg
7a40472c5b Include cstddef for ptrdiff_t in platform.h 2018-08-20 01:46:27 +02:00
dhewg
487406d861 Move idlib typedefs to platform.h 2018-08-20 01:46:27 +02:00
dhewg
e522e719dd Move common includes from precompiled.h to platform.h 2018-08-20 01:46:27 +02:00
dhewg
7d52a803ab Split platform specific code from precompiled.h
New header sys/platform.h.
2018-08-20 01:46:27 +02:00
dhewg
11b2cea993 Only compile idlib once
Build one static idlib and link the binaries against it.
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
a2586ebb52 Get rid of ID_ALLOW_D3XP
There're no second class citizens.
2018-08-20 01:46:27 +02:00
dhewg
e8965eb6fb Move the game include directory to the build system
Don't include based on a preprocessor symbol, let the build
system make the correct decision.
2018-08-20 01:46:27 +02:00
dhewg
e9c9835bdf TypeInfoGen is standalone, don't compile/link it
Neither the core or the game libraries need it.
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
260ddac543 Fix compilation of demo binaries
invalid conversion from ‘const char*’ to ‘char*’

There are no demo pk4 files available compatible to this 1.3.1
codebase. Add a note about it.
2018-08-20 01:46:27 +02:00
dhewg
4f90a1db12 Partly restore behaviour from c17b80e9
The subtraction was inverted, but change back the behaviour too:
Hardcode offsets and check via asserts() in Debug builds.
2018-08-20 01:46:27 +02:00
dhewg
a7b3b9fb0b Overwrite CMake default C[XX]FLAGS
CMake sets default flags for the standard build types.
We want to replace them, not merge them.

Reported by azalyn.
2018-08-20 01:46:27 +02:00
dhewg
e3f2666f32 Delete redundant files 2018-08-20 01:46:27 +02:00