fix C++11 -Wliteral-suffix warnings. fix -Wnarrowing errors/warnings.

fix the detestable in_sdl.c/SDL2 int-to-enum conversion failure errors
from g++.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1302 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2016-04-29 20:00:50 +00:00
parent f3af6bf791
commit f07ac29c0b
4 changed files with 12 additions and 10 deletions

View File

@ -1439,7 +1439,7 @@ void TexMgr_ReloadNobrightImages (void)
================================================================================
*/
static GLuint currenttexture[3] = {-1, -1, -1}; // to avoid unnecessary texture sets
static GLuint currenttexture[3] = {GL_UNUSED_TEXTURE, GL_UNUSED_TEXTURE, GL_UNUSED_TEXTURE}; // to avoid unnecessary texture sets
static GLenum currenttarget = GL_TEXTURE0_ARB;
qboolean mtexenabled = false;
@ -1517,9 +1517,9 @@ static void GL_DeleteTexture (gltexture_t *texture)
{
glDeleteTextures (1, &texture->texnum);
if (texture->texnum == currenttexture[0]) currenttexture[0] = -1;
if (texture->texnum == currenttexture[1]) currenttexture[1] = -1;
if (texture->texnum == currenttexture[2]) currenttexture[2] = -1;
if (texture->texnum == currenttexture[0]) currenttexture[0] = GL_UNUSED_TEXTURE;
if (texture->texnum == currenttexture[1]) currenttexture[1] = GL_UNUSED_TEXTURE;
if (texture->texnum == currenttexture[2]) currenttexture[2] = GL_UNUSED_TEXTURE;
texture->texnum = 0;
}
@ -1538,6 +1538,6 @@ void GL_ClearBindings(void)
int i;
for (i = 0; i < 3; i++)
{
currenttexture[i] = -1;
currenttexture[i] = GL_UNUSED_TEXTURE;
}
}

View File

@ -30,6 +30,8 @@ void GL_Set2D (void);
extern int glx, gly, glwidth, glheight;
#define GL_UNUSED_TEXTURE (~(GLuint)0)
// r_local.h -- private refresh defs
#define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0)

View File

@ -221,7 +221,7 @@ void Host_Version_f (void)
{
Con_Printf ("Quake Version %1.2f\n", VERSION);
Con_Printf ("QuakeSpasm Version %1.2f.%d\n", QUAKESPASM_VERSION, QUAKESPASM_VER_PATCH);
Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_Printf ("Exe: " __TIME__ " " __DATE__ "\n");
}
/* cvar callback functions : */
@ -845,7 +845,7 @@ void Host_Init (void)
NET_Init ();
SV_Init ();
Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
Con_Printf ("Exe: " __TIME__ " " __DATE__ "\n");
Con_Printf ("%4.1f megabyte heap\n", host_parms->memsize/ (1024*1024.0));
if (cls.state != ca_dedicated)

View File

@ -598,18 +598,18 @@ void IN_Commands (void)
// emit key events for controller buttons
for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++)
{
qboolean newstate = SDL_GameControllerGetButton(joy_active_controller, i);
qboolean newstate = SDL_GameControllerGetButton(joy_active_controller, (SDL_GameControllerButton)i);
qboolean oldstate = joy_buttonstate.buttondown[i];
joy_buttonstate.buttondown[i] = newstate;
// NOTE: This can cause a reentrant call of IN_Commands, via SCR_ModalMessage when confirming a new game.
IN_JoyKeyEvent(oldstate, newstate, IN_KeyForControllerButton(i), &joy_buttontimer[i]);
IN_JoyKeyEvent(oldstate, newstate, IN_KeyForControllerButton((SDL_GameControllerButton)i), &joy_buttontimer[i]);
}
for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; i++)
{
newaxisstate.axisvalue[i] = SDL_GameControllerGetAxis(joy_active_controller, i) / 32768.0f;
newaxisstate.axisvalue[i] = SDL_GameControllerGetAxis(joy_active_controller, (SDL_GameControllerAxis)i) / 32768.0f;
}
// emit emulated arrow keys so the analog sticks can be used in the menu