Don't un-grab mouse when taking screenshots (fixes #18)

On windows un-grabbing (or possibly re-grabbing) the mouse seems to
mess up the view angly (view is centered afterwards), see
https://github.com/dhewm/dhewm3/issues/18
That's fixed by not releasing the mouse (there is no reason to do that
anyway).
Unset key modifiers when regaining focus to unset ALT

There used to be a bug (discussed in #40), that ALT was still set after
using ALT-Tab. Thus when next pressing enter fullscreen was toggled.
This should now be fixed by unsetting the modifiers when focus is
regained (SDL_ACTIVEEVENT or SDL_WINDOWEVENT_FOCUS_GAINED).
Remove duplicate functions from openal_stub.cpp + extern C

Some functions were duplicated, the only difference was a const in one
parameter. The definitions in the header were with const, so I kept
those versions.
Also, the functions in the header are pure C, so add extern "C",
this fixes issues with MSVC and the formerly duplicated functions.
Fix dedicated server for Windows

* the OpenAL function definitions mustn't include __declspec(dllimport)
  => fixed by pretending to compile OpenAL statically
* glimp.cpp shouldn't be used in dedicated-only mode (as it was already
  the case on Linux and OSX)
  => No special handling for ID_DEDICATED needed in glimp.cpp, as it's not
   used anyway
* add APIENTRY to every gl function in stub_gl.cpp for compatibility
  with windows headers and MSVC
* remove GL/gl.h #include from win_local.h as it's not needed
* in qgl.h, when building dedicated server for windows, redefine WINGDIAPI
  to nothing for SDL_opengl.h #include to get rid off __declspec(dllimport)
  by using #pragma push_macro and pop_macro, because our stub is no dll.

Fixes https://github.com/dhewm/dhewm3/issues/39
Fix freezing of dedicated server window on Windows

The code was donated by motorsep, thanks!
Win32: Statically link libgcc and libstdc++

Else one needs to copy those files from mingw32.. and I see no reason
not to statically link them.
Load base game's gamelib if mod has no own gamelib

Some mods/mappacks have their own game dir (fs_game) but no own gamelib.
Doom3 defaulted to the base game dll (I think), so we should do the same.

Fixes #44
On Linux/Unix, return EXE-path as base-path if BUILD_DATADIR fails

Using this path was the old behavior and is expected by many users.
Add support for norwegian keyboard layout

via "in_kbd norwegian". It's the '|' and '§' chars (124, 167)

Fixes #33
Make console history persistent

The console history is saved to a file on quit and restored after
starting the game.
So the commands entered in the console the last times the game was run
are still available in the console-history, just like commands that
were just entered.
Don't save duplicate consecutive commands to history

If the entered command is the same as the last command, don't save
it to history.
Get rid of some compiler warnings

GCC had shitloads of superfluous warnings wherever List.h and Str.h were
included.. get rid of them by using #pragma GCC diagnostic at some places
in List.h and Str.h.
Also add some casts, initialize some variables for other warnings
Use current type for BT_CLOSED enum

doesn't really make a difference code-wise, but removes one compiler warning.
List.h needs sys/platform.h for ID_INLINE

Everytime List.h is included in a new file (and sys/platform.h isn't)
there are confusing compiler-errors..
So just #include sys/platform.h in List.h directly, because it uses
ID_INLINE which is defined there
Add a new cvar "r_waylandcompat"

Commit 9e158470 set the SDL OpenGL attribut SDL_GL_ALPHA_SIZE to 0 since
the alpha channel is used by Wayland. But for X11 the GLX 1.4 specification
clearly states: "If the requested number of bits in attrib_list for a
particular color component is 0 or GLX_DONT_CARE, then the number of
bits for that component is not considered." So if SDL_GL_ALPHA_SIZE is
0 a framebuffer without an alpha channel is created. This is no problem
on the default GLX module due to a non standard implementation but
manifests with Nvidias GLX module. The consequence are render mistakes
like in game display showing static or the flashlight looking weird.
Fix freeze when quitting the game during timedemo

When one tries to quit the game (via quit in console) while a timedemo
is running, the game freezes indefinitely while displaying the timedemo
results.
This happens because the MessageBox used for that waits for a an event
normally triggered by a timer - but it seems like that does not happen
anymore during Shutdown()

The fix makes sure that this message box isn't displayed.
Guess x/y FOV/aspectratio from resolution

Added r_aspectratio -1 which means "auto" (as new default).
This mode sets fov_x and fov_y according to screen-width/height.
=> No need to set r_aspectratio manually anymore (assuming your display's
   pixels are about square).

The standard aspect ratios can still be enforced as before, though.
CD-Key check for internet-games can now be disabled

with ID_ENFORCE_KEY_CLIENT 0

This patch is from Kot-in-Action Creative Artel

Fixes #55
math.h should #include sys/platform.h

Similar to f317b05
upstream