Fix C build and build on Linux/SDL2.

- for the first point: 'struct glattribs sdlayer_gl_attributes[]' was defined
  at file scope, but 'glmultisample > 0' is not a compile-time constant.
- for the second point: r4749 changed the meaning of some conditional
  compilation (supposedly, unintentionally). I'm reverting it to pre-r4749
  but keeping the rewritten style. It's concerned with mouse thumb buttons.

git-svn-id: https://svn.eduke32.com/eduke32@4755 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-11-22 18:37:16 +00:00
parent c77c69d488
commit 9907e79a0b
2 changed files with 22 additions and 22 deletions

View File

@ -75,22 +75,6 @@ static SDL_Texture *sdl_texture=NULL;
static SDL_Renderer *sdl_renderer=NULL;
#endif
struct glattribs
{
SDL_GLattr attr;
int32_t value;
} sdlayer_gl_attributes [] =
{
{ SDL_GL_DOUBLEBUFFER, 1 },
{ SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 },
{ SDL_GL_MULTISAMPLESAMPLES, glmultisample },
{ SDL_GL_STENCIL_SIZE, 1 },
{ SDL_GL_ACCELERATED_VISUAL, 1 },
#if SDL_MAJOR_VERSION == 1
{ SDL_GL_SWAP_CONTROL, vsync_render },
#endif
};
int32_t xres=-1, yres=-1, bpp=0, fullscreen=0, bytesperline;
intptr_t frameplace=0;
int32_t lockcount=0;
@ -1339,6 +1323,21 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
#ifdef _WIN32
win_setvideomode(c);
#endif
struct glattribs
{
SDL_GLattr attr;
int32_t value;
} sdlayer_gl_attributes [] =
{
{ SDL_GL_DOUBLEBUFFER, 1 },
{ SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 },
{ SDL_GL_MULTISAMPLESAMPLES, glmultisample },
{ SDL_GL_STENCIL_SIZE, 1 },
{ SDL_GL_ACCELERATED_VISUAL, 1 },
#if SDL_MAJOR_VERSION == 1
{ SDL_GL_SWAP_CONTROL, vsync_render },
#endif
};
do
{
@ -1722,19 +1721,20 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
case SDL_BUTTON_RIGHT: j = 1; break;
case SDL_BUTTON_MIDDLE: j = 2; break;
#if !defined _WIN32 || SDL_MAJOR_VERSION == 1
#ifndef _WIN32
#if SDL_MAJOR_VERSION == 1
case SDL_BUTTON_WHEELUP: // 4
case SDL_BUTTON_WHEELDOWN: // 5
j = ev->button.button;
break;
#endif
// NOTE: SDL1 does have SDL_BUTTON_X1, but that's not what is
// generated. Neither with SDL2 on Linux. (Other OSs: not tested.)
/* Thumb buttons. */
#if SDL_MAJOR_VERSION==1 || !defined _WIN32
// NOTE: SDL1 does have SDL_BUTTON_X1, but that's not what is
// generated. Neither with SDL2 on Linux. (Other OSs: not tested.)
case 8: j = 3; break;
case 9: j = 6; break;
#else
// On SDL2/Windows, everything is as it should be.
// On SDL2/Windows, everything is as it should be.
case SDL_BUTTON_X1: j = 3; break;
case SDL_BUTTON_X2: j = 6; break;
#endif

View File

@ -50,7 +50,7 @@ enum GamevarFlags_t {
#if !defined LUNATIC
// Alignments for per-player and per-across variables.
// Alignments for per-player and per-actor variables.
#define PLAYER_VAR_ALIGNMENT (sizeof(intptr_t))
#define ACTOR_VAR_ALIGNMENT 16