Commit Graph

3458 Commits (epoxy)

Author SHA1 Message Date
Günther Brammer d4634526fd GL: Switch from GLEW to Epoxy
Epoxy automatically fetches the extension functions on demand, including
the GLX context creation functions. This means that you can't test the
function pointers for NULL anymore, because they're always set to a
resolver function until the first call. Instead, you have to check for the
availability of an extension by the extension's name. Thanks to Isilkor for
catching these.

On windows, epoxy invalidates all extension function pointers when the
GL context changes. This means we need to have an active context at all
times we call an extension function (like wglGetPixelFormatAttribivARB)
or else the code will jump to an invalid pointer. On the other hand, we do
not need to make it reinitialize the pointers ourselves.

Epoxy automatically uses an alias for a function if the requested name is
not available, like glDebugMessageCallbackARB instead of
glDebugMessageCallback. It also does not have the problem with varying
parameter types for that function. So switch to it while removing
GLDEBUGPROCARB_USERPARAM_IS_CONST.
2016-02-06 16:50:47 +01:00
Günther Brammer 408dfff96e Fix indentation of the KeyCodeMap table
It used a mix of tabs and spaces for indentation, and tabs to separate the
columns, which doesn't work with variable tab sizes and variable column
widths. Use tabs for indentation and spaces for column separation.
2016-02-06 16:50:47 +01:00
Günther Brammer 934b519bb4 Update the SDL port to SDL2
SDL2 is a much closer match to the other platform code, and
allows the creation of OpenGL 3 core contexts, which is
now required.
2016-02-06 16:48:21 +01:00
Günther Brammer 1010732ba8 Fix the SDL build 2016-02-06 16:47:56 +01:00
Günther Brammer 59e5a327b2 gtk: Add support for microsoft windows 2016-02-06 16:47:44 +01:00
Günther Brammer 487277b58d WGL: Stop caching the window handle in the GL context 2016-02-06 15:54:47 +01:00
Sven Eberhardt 92e03d8fdd Remove unused variable in C4ControlScript::Execute() 2016-02-02 21:51:51 -05:00
Günther Brammer e5f75c5a44 Remove a bunch of dead code, mostly player control related 2016-02-03 03:17:23 +01:00
Günther Brammer 52de8900dd Script: Remove PlayerObjectCommand 2016-02-03 03:17:22 +01:00
Günther Brammer 70d25b0b91 gtk: Fold contents of C4AppGTKImpl.h into C4AppGTK.cpp
C4WindowGTK.cpp no longer needs anything from it.
2016-02-03 03:17:16 +01:00
Günther Brammer cc4da38f74 gtk: Remove unused C4X11AppImpl::gammasize 2016-02-03 03:08:53 +01:00
Günther Brammer d0fb24adda Merge epoxy preparation branch
Various changes to make the commit switching to epoxy smaller.
2016-02-02 03:35:13 +01:00
Nicolas Hake cd01561d65 Remove Config.Graphics.RenderInactiveEM 2016-02-02 00:25:57 +01:00
Nicolas Hake 301a088ebc StdColors: Remove several orphaned functions 2016-02-02 00:00:26 +01:00
Nicolas Hake e9cf0f6fdc Stop pretending we support 16 bit color
The GTK and OS X platforms already ignored the requested bit depth and
always used 32 bit. Windows and SDL would set a 16 bit color depth for
the screen, but still did all of the rendering short of the final
present in 32 bit.
2016-02-02 00:00:23 +01:00
Nicolas Hake 0c3811fe66 Keep rendering while unfocused (#1638)
In windowed mode, we shouldn't stop rendering just because we have lost
focus. However, we don't need to render at full framerate; throttling to
5 fps should be sufficient. Note though that we still have to calculate
game ticks at full speed so network games don't slow down when a player
tabs out of the game.
2016-02-01 20:48:17 +01:00
Nicolas Hake 98c966c7d1 Win32: Don't take/restore copies of all textures on app (de)activation
Even though we (might) change the resolution, that doesn't result in
loss of textures because we don't recreate the OpenGL context. Therefore
we also don't have to restore their data. I believe this code is a relic
from the DirectX renderer, which would lose textures when switching away
from a fullscreen window.
2016-02-01 20:48:17 +01:00
Maikel de Vries e7c296104f set controller of dig2material objects when the digger exists
This ensures correct kill tracing for example a piece of coal falling on an enemy after being dug out.
2016-02-01 20:20:26 +01:00
David Dormagen 6c5294a05f fixed invisible UI elements accepting player input
When an UI element was only visible to a player (via the Player property), it still allowed ALL players to click on buttons.
I am wondering why noone else noticed that bug before. It's possible that it didn't show when the visibility was set via the menu's Target (instead of the Player property).

Maybe this was the cause of the "clicks sometimes do nothing" bug?
2016-01-31 23:36:06 +01:00
Günther Brammer 03d11cd596 Merge script branch 2016-01-31 21:51:58 +01:00
Günther Brammer a6b1ee79e9 Fix assertion failure when rendering mesh with degenerate transform
It isn't enough to check the top-level mesh, because attached meshes also
get a transformation from script. At least cotton branches sometimes do
that.

So check the matrix directly before using it and skip rendering.
2016-01-31 21:51:50 +01:00
Sven Eberhardt 6e251832b8 Fix league signup with usernames containing non-ascii characters 2016-01-31 12:26:07 -05:00
Armin Burgmeier eb1750a7d3 Fix drawing of the FoW debug mode (#1659) 2016-01-30 11:49:20 -08:00
Günther Brammer d3428003a8 Fix navigation in player menus with more than one column/row 2016-01-30 16:03:22 +01:00
Günther Brammer 23acdc6060 Use the same team id in view update as in team join 2016-01-30 16:02:31 +01:00
Maikel de Vries 4bcdfc451e block construction sites based on Exclusive and not on planes (#1534)
This makes more sense, exclusive object block all other construction sites, irrespective of their planes.
2016-01-30 14:46:14 +01:00
Günther Brammer a1a6e36cde GL: Deduplicate the check for glObjectLabel 2016-01-29 18:37:32 +01:00
Nicolas Hake 506d116c42 WGL: Wrap the temporary context for OpenGL extension detection in a class
Unlike GLX, the OpenGL function pointers are context-dependant. Because we
need an extension function to create the context we're going to use, we
first need to create a temporary context. Since this is independent of the
library used to fetch the function pointers, decouple it from glewInit().
2016-01-29 18:37:32 +01:00
Günther Brammer 5e5d8dd49a GLX: Avoid exiting if glXCreateContextAttribsARB fails
It's not clear that the glXCreateNewContext fallback does anyone any good
because it can't create the Core Profile Context we need, but better a
fallback message followed by Shader compilation errors than an obscure
X11 protocoll error. Probably.
2016-01-29 17:12:44 +01:00
Günther Brammer fd534c430e GL: Move notification about debug context to common code 2016-01-29 16:55:36 +01:00
Günther Brammer 83cf09db1a GL: Replace CStdGLCtx::Reinitialize with parameter to Clear() 2016-01-29 16:52:36 +01:00
Sven Eberhardt 1f81b87c33 PlayAnimation: Delete previous animations in same slot if no weight is given.
This will simplify fixing several animation leaks.
2016-01-28 22:02:27 -05:00
Sven Eberhardt 80b8879805 Fix SolidMask DensityProvider to return C4M_Vehicle, not C4M_Solid.
Fixes attached movement of objects with increased contact density.
2016-01-28 22:00:41 -05:00
Nicolas Hake f12afbc43c Fix some frankly ridiculous indentation
I know you like to think of yourself as something of an artiste, but
this isn't likely to get into MoMA's permanent collection.
2016-01-28 17:26:09 +01:00
Sven Eberhardt 36489145b6 Fix automatic engine detection of melee-like scenarios to allow team selection. 2016-01-24 22:13:21 -05:00
Günther Brammer 79043c8424 Reset the size of a C4Set in Clear()
This bug manifested itself in mysteriously growing PropLists with nil keys.

Some usages of Clear were simply to clean the newly-allocated table, and
need to continue to do so.
2016-01-25 00:54:58 +01:00
Günther Brammer 88185a60f9 Script: Sort the result of GetProperties lexically
Also, deal with non-string values in the C4ValueArray properly.
2016-01-25 00:00:59 +01:00
Günther Brammer 5708ba2e72 Remove superfluous wrapper function C4AulStartTrace 2016-01-25 00:00:58 +01:00
Günther Brammer 9dadfba5af Move GlobalNamed.SetNameList call after Link() into Link()
It isn't clear whether that call is necessary since the C4AulScriptEngine
constructor already does this, but it is clear that duplicating the call
all over is a bad idea.
2016-01-25 00:00:58 +01:00
Günther Brammer 5be63d1e96 Use macros to reduce duplication in script engine definitions
While at it, make AddFunc take a C4PropList* instead of a C4AulScript*.
2016-01-25 00:00:58 +01:00
Günther Brammer 5287121d86 Use void instead of C4Void for engine functions that always return nil
This allows the removal of quite a few return C4Void();.

Also stop pretending that Nillable<void> is the same class as Nillable<T>.
Its only function was as an implementation detail for C4Void, which doesn't
need any implementation details anymore.
2016-01-25 00:00:58 +01:00
Günther Brammer f78d7712a5 Replace C4AulDefFuncHelper with template functions
This avoids duplication of code in C4AulObjectFunc and C4AulEngineFunc
at the cost of boilerplate code working around the lack of partial
function template spezializations.

Instead of ThisImpl and ExecImpl, we could have multiple C4AulEngineFunc
spezializations deriving from a common template, but that would require
even longer and duplicated boilerplate.
2016-01-25 00:00:58 +01:00
Günther Brammer 22113fd6fc Convert C4AulDefFunc* templates to variadic templates 2016-01-25 00:00:58 +01:00
Günther Brammer 68c436576e Simplify construction of C4AulParSets 2016-01-25 00:00:57 +01:00
Günther Brammer 0a8960f969 Reimplement C4AulParSet constructor as a variadic template
This allows the constructor to accept all types there is a C4Value
constructor for.
2016-01-25 00:00:57 +01:00
Günther Brammer ce2b8f45b8 Make FnSetPlrKnowledge(C4Player*) a C4Player member function
The overload with FnSetPlrKnowledge(C4PropList*) will get problematic.
2016-01-25 00:00:57 +01:00
Günther Brammer 6b514893f9 Replace C4ValueConv::ToC4V with C4Value constructors
Also don't rely on int32_t != long and drop now unnecessary MSVC workaround.
2016-01-25 00:00:57 +01:00
Günther Brammer b08f51372a Add more overloads of the C4Value constructor
This allows one to use the C4Value constructor instead of
C4ValueConv. To avoid unintended implicit conversions like
const char * to bool, add a private template constructor that
catches everything not in the list of intended constructors.
2016-01-25 00:00:57 +01:00
Sven Eberhardt 451ea87ab9 Fix another FoW crash 2016-01-24 17:23:20 -05:00
Sven Eberhardt 42d8885877 Fix crash in FoW rendering #1643 2016-01-24 14:44:00 -05:00