Commit graph

392 commits

Author SHA1 Message Date
dhewg
29013ff57d Use SDL for r_swapInterval
Enables vsync support for more platforms than just Windows.
2012-01-02 15:44:28 -05:00
dhewg
c0d625685d Gracefully shut down SDL on exit 2012-01-02 15:44:25 -05:00
dhewg
cd1561ac57 Implement alt+tab for toggling fullscreen mode 2012-01-02 15:44:22 -05:00
dhewg
ba3ae581ab Implement SDL_QUIT event
Shut down gracefully upon WM quit event.
2012-01-02 15:44:19 -05:00
dhewg
79aea4082f 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.
2012-01-02 15:44:16 -05:00
dhewg
5d69699edf 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.
2012-01-02 15:44:16 -05:00
dhewg
502aaa6fe2 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.
2012-01-02 15:44:09 -05:00
dhewg
1ecf98416c Get rid of GLW_WM_CREATE
Another stub.
2012-01-02 15:44:05 -05:00
dhewg
73779eca39 Get rid of unused GLW_InitExtensions()
Unused forward declaration.
2012-01-02 15:44:02 -05:00
dhewg
32530bf7a2 Get rid of GLimp_EnableLogging
Only stubs left.
2012-01-02 15:44:00 -05:00
dhewg
3be7fae15c Always link the Windows binaries against OpenGL
Just as with every other platform.
2012-01-02 15:43:59 -05:00
dhewg
21f6eeaaeb Move wgl* function pointers
Most are only used in the unused draw_exp.cpp, move them there.
2012-01-02 15:43:56 -05:00
dhewg
e6d8509752 Remove wglGetExtensionsStringARB from win_local.h
It's only used in win_glimp.cpp
2012-01-02 15:43:50 -05:00
dhewg
1afe61cc8d Get rid of dead render thread code
The Windows backend had some preparing code for this feature,
but there is no support at all for this in renderer/.
2012-01-02 15:43:48 -05:00
dhewg
475f49dad2 Get rid of the redundant com_shuttingDown
Not required anymore since 7865e432, the timer is stopped
gracefully when shutting down.
2012-01-02 15:43:47 -05:00
dhewg
57dc097fb0 Use correct idStr::Append() while saving event strings
Used the wrong Append() in fad99572, we want to stop at a
terminating null char.
2012-01-02 15:43:44 -05:00
dhewg
239b165798 Use com_ticNumber for the async timer
This yields much more precise updates and stable fps.

Reported by kaan.
2011-12-27 21:27:27 +01:00
dhewg
fad995722c 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.
2011-12-27 21:27:27 +01:00
spiral
1507a657d4 Add ID_GAME_API for dllexport/attribute(visibility)
Delete obsolete Game.def exports files
2011-12-23 13:24:47 +01:00
spiral
d214a0f819 VS Pro doesn't choose the right default like Express, so be explicit 2011-12-23 13:06:05 +01:00
spiral
13bab7a7e5 Remove MWERKS stuff 2011-12-23 13:04:21 +01:00
dhewg
826dfb0e5b 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.
2011-12-22 18:51:17 +01:00
dhewg
9e715ba7cc 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.
2011-12-22 14:10:29 +01:00
dhewg
2c1186dc1b 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.
2011-12-22 12:33:27 +01:00
dhewg
acdfb93552 Fix compiler checks for newer gcc versions
Use CXX instead of C checks - newer gcc versions refuse some
C++ flags when compiling C.
2011-12-22 12:33:27 +01:00
dhewg
6997848645 Use HUGE_VAL instead of HUGE
This is more portable, and older MinGW versions actually
don't know about HUGE.

Reported by serpentine.
2011-12-22 12:33:21 +01:00
dhewg
d37fe69f85 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.
2011-12-22 12:32:39 +01:00
dhewg
469031be21 Remove win32 special case in idSession::Frame()
Since 1a25b165 not required anymore, all platforms behave the
same.
2011-12-22 11:43:24 +01:00
dhewg
cdf6fa3702 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.
2011-12-22 11:21:55 +01:00
spiral
540bbae490 CMake support for MSVC
Use the WIN32 flag for add_executable.
2011-12-22 11:21:54 +01:00
spiral
7e5795dd56 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
2011-12-22 11:07:01 +01:00
dhewg
ca04dd36d8 Get rid of the unused Sys_FPU_ClearStack 2011-12-22 11:07:01 +01:00
dhewg
6e0c766d14 Unify all Sys_GetProcessorId()
Use SDL functions whenever possible.
2011-12-22 11:07:00 +01:00
dhewg
d4281b56bf 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.
2011-12-22 10:38:40 +01:00
dhewg
4150029322 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.
2011-12-22 10:38:40 +01:00
dhewg
acfe2489e4 Get rid of unused CPUID flags 2011-12-22 10:38:40 +01:00
dhewg
e2b46a5a34 Get rid of Sys_GetClockticks() and Sys_ClockTicksPerSecond()
Now unused.
2011-12-22 10:38:39 +01:00
dhewg
2e3653ce9f Get rid of CPU speed check in SetMachineSpec()
This is a non portable x86 and x86_64 check.
2011-12-22 10:38:39 +01:00
dhewg
280c95b52c 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.
2011-12-22 10:38:39 +01:00
dhewg
a99971f44c Add GetMilliseconds to idSys
To be used for the overhauled idTimer in idlib/.
2011-12-22 10:38:38 +01:00
dhewg
c994974ffc 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.
2011-12-22 10:38:38 +01:00
dhewg
317e63887c Port Sys_Sleep() to SDL 2011-12-22 10:38:38 +01:00
dhewg
e7482b4957 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.
2011-12-22 10:38:37 +01:00
dhewg
7865e432a7 Port the async thread to a SDL timer
SDL implements timers via threads and it lets us easily aim at
a 60Hz frequency.
2011-12-21 17:50:39 +01:00
dhewg
5a052e846f Move MAX_THREADS as define to BuildDefines.h 2011-12-21 17:50:39 +01:00
dhewg
1a25b165b0 Port critical sections and events to SDL
Use SDL mutexes and conditions.
One new critical section CRITICAL_SECTION_SYS for events.
2011-12-21 17:50:35 +01:00
dhewg
0f3c2ebf52 Use SDL for everything endian 2011-12-21 17:40:38 +01:00
dhewg
005677494f 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().
2011-12-21 17:40:05 +01:00
dhewg
efc71124b1 TypeInfoGen is standalone, don't compile/link it
Same change for scons as 8ca99602 for CMake.
2011-12-21 17:39:01 +01:00
dhewg
45566d9727 Fix compilation via scons
Add the include path to the root directory, overlooked in
736ec20d.
2011-12-21 13:53:36 +01:00