fix errors and warnings in MSVC when compiling as C++
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 15 Sep 2009 13:09:09 +0000 (13:09 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 15 Sep 2009 13:09:09 +0000 (13:09 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9200 d7cf8633-e32d-0410-b094-e92efae38249

33 files changed:
cl_input.c
cl_parse.c
cl_particles.c
cl_screen.c
clvm_cmds.c
csprogs.c
curves.c
cvar.c
gl_backend.c
gl_draw.c
gl_rmain.c
gl_rsurf.c
keys.c
lhnet.c
libcurl.c
mathlib.h
menu.c
model_alias.c
model_brush.c
model_shared.c
model_sprite.c
mvm_cmds.c
netconn.c
prvm_cmds.c
prvm_edict.c
r_shadow.c
r_shadow.h
r_sprites.c
snd_main.c
snd_ogg.c
sv_user.c
vid.h
vid_shared.c

index 522eeee..020bfe4 100644 (file)
@@ -365,9 +365,9 @@ float CL_KeyState (kbutton_t *key)
        float           val;
        qboolean        impulsedown, impulseup, down;
 
-       impulsedown = key->state & 2;
-       impulseup = key->state & 4;
-       down = key->state & 1;
+       impulsedown = (key->state & 2) != 0;
+       impulseup = (key->state & 4) != 0;
+       down = (key->state & 1) != 0;
        val = 0;
 
        if (impulsedown && !impulseup)
@@ -1626,7 +1626,7 @@ void CL_SendMove(void)
                cl.cmd.msec = 100;
        cl.cmd.frametime = cl.cmd.msec * (1.0 / 1000.0);
 
-       cl.cmd.predicted = cl_movement.integer;
+       cl.cmd.predicted = cl_movement.integer != 0;
 
        // movement is set by input code (forwardmove/sidemove/upmove)
        // always dump the first two moves, because they may contain leftover inputs from the last level
index a9f82d2..c3fdf43 100644 (file)
@@ -2994,7 +2994,7 @@ qboolean CL_ExaminePrintString(const char *text)
        if (cl.parsingtextmode == CL_PARSETEXTMODE_PING)
        {
                // if anything goes wrong, we'll assume this is not a ping report
-               qboolean expected = cl.parsingtextexpectingpingforscores;
+               qboolean expected = cl.parsingtextexpectingpingforscores != 0;
                cl.parsingtextexpectingpingforscores = 0;
                cl.parsingtextmode = CL_PARSETEXTMODE_NONE;
                t = text;
@@ -3576,7 +3576,7 @@ void CL_ParseServerMessage(void)
                                break;
 
                        case qw_svc_setpause:
-                               cl.paused = MSG_ReadByte ();
+                               cl.paused = MSG_ReadByte () != 0;
                                if (cl.paused)
                                        CDAudio_Pause ();
                                else
@@ -3867,7 +3867,7 @@ void CL_ParseServerMessage(void)
                                break;
 
                        case svc_setpause:
-                               cl.paused = MSG_ReadByte ();
+                               cl.paused = MSG_ReadByte () != 0;
                                if (cl.paused)
                                        CDAudio_Pause ();
                                else
index ac186bb..e935cab 100644 (file)
@@ -252,6 +252,7 @@ void CL_Particles_ParseEffectInfo(const char *textstart, const char *textend)
 #define readfloats(array, n) checkparms(n+1);for (arrayindex = 0;arrayindex < argc - 1;arrayindex++) array[arrayindex] = atof(argv[1+arrayindex])
 #define readint(var) checkparms(2);var = strtol(argv[1], NULL, 0)
 #define readfloat(var) checkparms(2);var = atof(argv[1])
+#define readbool(var) checkparms(2);var = strtol(argv[1], NULL, 0) != 0
                if (!strcmp(argv[0], "effect"))
                {
                        int effectnameindex;
@@ -368,7 +369,7 @@ void CL_Particles_ParseEffectInfo(const char *textstart, const char *textend)
                else if (!strcmp(argv[0], "lightradiusfade")) {readfloat(info->lightradiusfade);}
                else if (!strcmp(argv[0], "lighttime")) {readfloat(info->lighttime);}
                else if (!strcmp(argv[0], "lightcolor")) {readfloats(info->lightcolor, 3);}
-               else if (!strcmp(argv[0], "lightshadow")) {readint(info->lightshadow);}
+               else if (!strcmp(argv[0], "lightshadow")) {readbool(info->lightshadow);}
                else if (!strcmp(argv[0], "lightcubemapnum")) {readint(info->lightcubemapnum);}
                else if (!strcmp(argv[0], "underwater")) {checkparms(1);info->flags |= PARTICLEEFFECT_UNDERWATER;}
                else if (!strcmp(argv[0], "notunderwater")) {checkparms(1);info->flags |= PARTICLEEFFECT_NOTUNDERWATER;}
index c3c1095..4144b59 100644 (file)
@@ -1969,6 +1969,7 @@ void CL_UpdateScreen(void)
 {
        double rendertime1;
        float conwidth, conheight;
+       float f;
 
        if (!scr_initialized || !con_initialized)
                return;                         // not initialized yet
@@ -1976,12 +1977,12 @@ void CL_UpdateScreen(void)
        if(gamemode == GAME_NEXUIZ)
        {
                // play a bit with the palette (experimental)
-               palette_rgb_pantscolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time / exp(1) + 0*M_PI/3));
-               palette_rgb_pantscolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time / exp(1) + 2*M_PI/3));
-               palette_rgb_pantscolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time / exp(1) + 4*M_PI/3));
-               palette_rgb_shirtcolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time /  M_PI  + 5*M_PI/3));
-               palette_rgb_shirtcolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time /  M_PI  + 3*M_PI/3));
-               palette_rgb_shirtcolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time /  M_PI  + 1*M_PI/3));
+               palette_rgb_pantscolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time / exp(1.0f) + 0.0f*M_PI/3.0f));
+               palette_rgb_pantscolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time / exp(1.0f) + 2.0f*M_PI/3.0f));
+               palette_rgb_pantscolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time / exp(1.0f) + 4.0f*M_PI/3.0f));
+               palette_rgb_shirtcolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time /  M_PI  + 5.0f*M_PI/3.0f));
+               palette_rgb_shirtcolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time /  M_PI  + 3.0f*M_PI/3.0f));
+               palette_rgb_shirtcolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time /  M_PI  + 1.0f*M_PI/3.0f));
                memcpy(palette_rgb_pantsscoreboard[15], palette_rgb_pantscolormap[15], sizeof(*palette_rgb_pantscolormap));
                memcpy(palette_rgb_shirtscoreboard[15], palette_rgb_shirtcolormap[15], sizeof(*palette_rgb_shirtcolormap));
        }
@@ -2049,7 +2050,8 @@ void CL_UpdateScreen(void)
        R_ClearScreen(false);
        r_refdef.view.clear = false;
        r_refdef.view.isoverlay = false;
-       r_refdef.view.quality = bound(cl_minfps_qualitymin.value, pow(cl_updatescreen_quality, cl_minfps_qualitypower.value) * cl_minfps_qualityscale.value, cl_minfps_qualitymax.value);
+       f = pow((float)cl_updatescreen_quality, cl_minfps_qualitypower.value) * cl_minfps_qualityscale.value;
+       r_refdef.view.quality = bound(cl_minfps_qualitymin.value, f, cl_minfps_qualitymax.value);
 
        if(scr_stipple.integer)
        {
index e107fb3..045f84e 100644 (file)
@@ -844,13 +844,13 @@ void VM_CL_R_SetView (void)
                CSQC_R_RecalcView();
                break;
        case VF_DRAWWORLD:
-               cl.csqc_vidvars.drawworld = k;
+               cl.csqc_vidvars.drawworld = k != 0;
                break;
        case VF_DRAWENGINESBAR:
-               cl.csqc_vidvars.drawenginesbar = k;
+               cl.csqc_vidvars.drawenginesbar = k != 0;
                break;
        case VF_DRAWCROSSHAIR:
-               cl.csqc_vidvars.drawcrosshair = k;
+               cl.csqc_vidvars.drawcrosshair = k != 0;
                break;
        case VF_CL_VIEWANGLES:
                VectorCopy(f, cl.viewangles);
@@ -1142,7 +1142,7 @@ static void VM_CL_getkeybind (void)
 static void VM_CL_setcursormode (void)
 {
        VM_SAFEPARMCOUNT(1, VM_CL_setcursormode);
-       cl.csqc_wantsmousemove = PRVM_G_FLOAT(OFS_PARM0);
+       cl.csqc_wantsmousemove = PRVM_G_FLOAT(OFS_PARM0) != 0;
        cl_ignoremousemoves = 2;
 }
 
index 1ee20b6..ae4151e 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -281,7 +281,7 @@ qboolean CL_VM_InputEvent (qboolean down, int key, int ascii)
                        PRVM_G_FLOAT(OFS_PARM1) = key;
                        PRVM_G_FLOAT(OFS_PARM2) = ascii;
                        PRVM_ExecuteProgram(prog->funcoffsets.CSQC_InputEvent, "QC function CSQC_InputEvent is missing");
-                       r = CSQC_RETURNVAL;
+                       r = CSQC_RETURNVAL != 0;
                }
        CSQC_END
        return r;
@@ -332,7 +332,7 @@ qboolean CL_VM_ConsoleCommand (const char *cmd)
                PRVM_G_INT(OFS_PARM0) = PRVM_SetTempString(cmd);
                PRVM_ExecuteProgram(prog->funcoffsets.CSQC_ConsoleCommand, "QC function CSQC_ConsoleCommand is missing");
                vm_tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
-               r = CSQC_RETURNVAL;
+               r = CSQC_RETURNVAL != 0;
        }
        CSQC_END
        return r;
@@ -351,7 +351,7 @@ qboolean CL_VM_Parse_TempEntity (void)
                prog->globals.client->time = cl.time;
                prog->globals.client->self = cl.csqc_server2csqcentitynumber[cl.playerentity];
                PRVM_ExecuteProgram(prog->funcoffsets.CSQC_Parse_TempEntity, "QC function CSQC_Parse_TempEntity is missing");
-               r = CSQC_RETURNVAL;
+               r = CSQC_RETURNVAL != 0;
                if(!r)
                {
                        msg_readcount = t;
@@ -550,7 +550,7 @@ qboolean CL_VM_Event_Sound(int sound_num, float volume, int channel, float atten
                        PRVM_G_FLOAT(OFS_PARM4) = attenuation;
                        VectorCopy(pos, PRVM_G_VECTOR(OFS_PARM5) );
                        PRVM_ExecuteProgram(prog->funcoffsets.CSQC_Event_Sound, "QC function CSQC_Event_Sound is missing");
-                       r = CSQC_RETURNVAL;
+                       r = CSQC_RETURNVAL != 0;
                }
                CSQC_END
        }
index 8946838..ba7e129 100644 (file)
--- a/curves.c
+++ b/curves.c
@@ -140,14 +140,14 @@ static int Q3PatchTesselation(float largestsquared3xcurvearea, float tolerance)
 {
        float f;
        // f is actually a squared 2x curve area... so the formula had to be adjusted to give roughly the same subdivisions
-       f = pow(largestsquared3xcurvearea / 64.0, 0.25) / tolerance;
+       f = pow(largestsquared3xcurvearea / 64.0f, 0.25f) / tolerance;
        //if(f < 0.25) // VERY flat patches
        if(f < 0.0001) // TOTALLY flat patches
                return 0;
        else if(f < 2)
                return 1;
        else
-               return (int) floor(log(f) / log(2)) + 1;
+               return (int) floor(log(f) / log(2.0f)) + 1;
                // this is always at least 2
                // maps [0.25..0.5[ to -1 (actually, 1 is returned)
                // maps [0.5..1[ to 0 (actually, 1 is returned)
diff --git a/cvar.c b/cvar.c
index 4dba58a..3db048c 100644 (file)
--- a/cvar.c
+++ b/cvar.c
@@ -234,7 +234,7 @@ void Cvar_SetQuick_Internal (cvar_t *var, const char *value)
        qboolean changed;
        size_t valuelen;
 
-       changed = strcmp(var->string, value);
+       changed = strcmp(var->string, value) != 0;
        // LordHavoc: don't reallocate when there is no change
        if (!changed)
                return;
index 9647420..1310985 100644 (file)
@@ -287,7 +287,7 @@ void GL_SetupView_Orientation_FromEntity(const matrix4x4_t *matrix)
        Matrix4x4_ConcatRotate(&basematrix, 90, 0, 0, 1);
        Matrix4x4_Concat(&backend_viewmatrix, &basematrix, &tempmatrix);
 
-       GL_SetMirrorState(v_flipped.integer);
+       GL_SetMirrorState(v_flipped.integer != 0);
        if(v_flipped_state)
        {
                Matrix4x4_Transpose(&basematrix, &backend_viewmatrix);
index d71e836..bb8745b 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -1121,7 +1121,7 @@ float DrawQ_String_Font(float startx, float starty, const char *text, size_t max
                else
                        colorindex = *outcolor;
 
-               DrawQ_GetTextColor(color, colorindex, basered, basegreen, baseblue, basealpha, shadow);
+               DrawQ_GetTextColor(color, colorindex, basered, basegreen, baseblue, basealpha, shadow != 0);
 
                x = startx;
                y = starty;
@@ -1143,7 +1143,7 @@ float DrawQ_String_Font(float startx, float starty, const char *text, size_t max
                                if (ch <= '9' && ch >= '0') // ^[0-9] found
                                {
                                        colorindex = ch - '0';
-                                       DrawQ_GetTextColor(color, colorindex, basered, basegreen, baseblue, basealpha, shadow);
+                                       DrawQ_GetTextColor(color, colorindex, basered, basegreen, baseblue, basealpha, shadow != 0);
                                        continue;
                                }
                                else if (ch == STRING_COLOR_RGB_TAG_CHAR && i+3 < maxlen ) // ^x found
@@ -1171,7 +1171,7 @@ float DrawQ_String_Font(float startx, float starty, const char *text, size_t max
                                                                colorindex = tempcolorindex | 0xf;
                                                                // ...done! now colorindex has rgba codes (1,rrrr,gggg,bbbb,aaaa)
                                                                //Con_Printf("^1colorindex:^7 %x\n", colorindex);
-                                                               DrawQ_GetTextColor(color, colorindex, basered, basegreen, baseblue, basealpha, shadow);
+                                                               DrawQ_GetTextColor(color, colorindex, basered, basegreen, baseblue, basealpha, shadow != 0);
                                                                i+=3;
                                                                continue;
                                                        }
index 32014b3..6463c80 100644 (file)
@@ -3998,7 +3998,7 @@ void R_UpdateVariables(void)
        r_refdef.shadowpolygonfactor = r_refdef.polygonfactor + r_shadow_polygonfactor.value * (r_shadow_frontsidecasting.integer ? 1 : -1);
        r_refdef.shadowpolygonoffset = r_refdef.polygonoffset + r_shadow_polygonoffset.value * (r_shadow_frontsidecasting.integer ? 1 : -1);
 
-       r_refdef.scene.rtworld = r_shadow_realtime_world.integer;
+       r_refdef.scene.rtworld = r_shadow_realtime_world.integer != 0;
        r_refdef.scene.rtworldshadows = r_shadow_realtime_world_shadows.integer && gl_stencil;
        r_refdef.scene.rtdlight = (r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer) && !gl_flashblend.integer && r_dynamic.integer;
        r_refdef.scene.rtdlightshadows = r_refdef.scene.rtdlight && r_shadow_realtime_dlight_shadows.integer && gl_stencil;
@@ -5080,7 +5080,8 @@ texture_t *R_GetCurrentTexture(texture_t *t)
        if (t->currentmaterialflags & MATERIALFLAG_WALL)
        {
                int layerflags = 0;
-               int blendfunc1, blendfunc2, depthmask;
+               int blendfunc1, blendfunc2;
+               qboolean depthmask;
                if (t->currentmaterialflags & MATERIALFLAG_ADD)
                {
                        blendfunc1 = GL_SRC_ALPHA;
@@ -5413,7 +5414,7 @@ void RSurf_PrepareVerticesForBatch(qboolean generatenormals, qboolean generateta
                        rsurface.normal3f = rsurface.modelnormal3f = rsurface.array_modelnormal3f;
                        rsurface.normal3f_bufferobject = rsurface.modelnormal3f_bufferobject = 0;
                        rsurface.normal3f_bufferoffset = rsurface.modelnormal3f_bufferoffset = 0;
-                       Mod_BuildNormals(0, rsurface.modelnum_vertices, rsurface.modelnum_triangles, rsurface.modelvertex3f, rsurface.modelelement3i, rsurface.array_modelnormal3f, r_smoothnormals_areaweighting.integer);
+                       Mod_BuildNormals(0, rsurface.modelnum_vertices, rsurface.modelnum_triangles, rsurface.modelvertex3f, rsurface.modelelement3i, rsurface.array_modelnormal3f, r_smoothnormals_areaweighting.integer != 0);
                }
                if (generatetangents && !rsurface.modelsvector3f)
                {
@@ -5423,7 +5424,7 @@ void RSurf_PrepareVerticesForBatch(qboolean generatenormals, qboolean generateta
                        rsurface.tvector3f = rsurface.modeltvector3f = rsurface.array_modeltvector3f;
                        rsurface.tvector3f_bufferobject = rsurface.modeltvector3f_bufferobject = 0;
                        rsurface.tvector3f_bufferoffset = rsurface.modeltvector3f_bufferoffset = 0;
-                       Mod_BuildTextureVectorsFromNormals(0, rsurface.modelnum_vertices, rsurface.modelnum_triangles, rsurface.modelvertex3f, rsurface.modeltexcoordtexture2f, rsurface.modelnormal3f, rsurface.modelelement3i, rsurface.array_modelsvector3f, rsurface.array_modeltvector3f, r_smoothnormals_areaweighting.integer);
+                       Mod_BuildTextureVectorsFromNormals(0, rsurface.modelnum_vertices, rsurface.modelnum_triangles, rsurface.modelvertex3f, rsurface.modeltexcoordtexture2f, rsurface.modelnormal3f, rsurface.modelelement3i, rsurface.array_modelsvector3f, rsurface.array_modeltvector3f, r_smoothnormals_areaweighting.integer != 0);
                }
        }
        rsurface.vertex3f  = rsurface.modelvertex3f;
@@ -5486,8 +5487,8 @@ void RSurf_PrepareVerticesForBatch(qboolean generatenormals, qboolean generateta
                                                VectorMAMAMAM(1, center, DotProduct(forward, v), newforward, DotProduct(right, v), newright, DotProduct(up, v), newup, rsurface.array_deformedvertex3f + (surface->num_firstvertex+i+j) * 3);
                                        }
                                }
-                               Mod_BuildNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformednormal3f, r_smoothnormals_areaweighting.integer);
-                               Mod_BuildTextureVectorsFromNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modeltexcoordtexture2f, rsurface.array_deformednormal3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformedsvector3f, rsurface.array_deformedtvector3f, r_smoothnormals_areaweighting.integer);
+                               Mod_BuildNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformednormal3f, r_smoothnormals_areaweighting.integer != 0);
+                               Mod_BuildTextureVectorsFromNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modeltexcoordtexture2f, rsurface.array_deformednormal3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformedsvector3f, rsurface.array_deformedtvector3f, r_smoothnormals_areaweighting.integer != 0);
                        }
                        rsurface.vertex3f = rsurface.array_deformedvertex3f;
                        rsurface.vertex3f_bufferobject = 0;
@@ -5617,8 +5618,8 @@ void RSurf_PrepareVerticesForBatch(qboolean generatenormals, qboolean generateta
                                                VectorMAMAM(1, v1, -f, right, f, newright, rsurface.array_deformedvertex3f + (surface->num_firstvertex+i+j) * 3);
                                        }
                                }
-                               Mod_BuildNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformednormal3f, r_smoothnormals_areaweighting.integer);
-                               Mod_BuildTextureVectorsFromNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modeltexcoordtexture2f, rsurface.array_deformednormal3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformedsvector3f, rsurface.array_deformedtvector3f, r_smoothnormals_areaweighting.integer);
+                               Mod_BuildNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformednormal3f, r_smoothnormals_areaweighting.integer != 0);
+                               Mod_BuildTextureVectorsFromNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modeltexcoordtexture2f, rsurface.array_deformednormal3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformedsvector3f, rsurface.array_deformedtvector3f, r_smoothnormals_areaweighting.integer != 0);
                        }
                        rsurface.vertex3f = rsurface.array_deformedvertex3f;
                        rsurface.vertex3f_bufferobject = 0;
@@ -5649,7 +5650,7 @@ void RSurf_PrepareVerticesForBatch(qboolean generatenormals, qboolean generateta
                                        normal[2] += deform->parms[0] * noise4f(196 + vertex[0], vertex[1], vertex[2], r_refdef.scene.time * deform->parms[1]);
                                        VectorNormalize(normal);
                                }
-                               Mod_BuildTextureVectorsFromNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modeltexcoordtexture2f, rsurface.array_deformednormal3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformedsvector3f, rsurface.array_deformedtvector3f, r_smoothnormals_areaweighting.integer);
+                               Mod_BuildTextureVectorsFromNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface.vertex3f, rsurface.modeltexcoordtexture2f, rsurface.array_deformednormal3f, rsurface.modelelement3i + surface->num_firsttriangle * 3, rsurface.array_deformedsvector3f, rsurface.array_deformedtvector3f, r_smoothnormals_areaweighting.integer != 0);
                        }
                        rsurface.svector3f = rsurface.array_deformedsvector3f;
                        rsurface.svector3f_bufferobject = 0;
@@ -6475,7 +6476,7 @@ static void R_DrawTextureSurfaceList_GL20(int texturenumsurfaces, msurface_t **t
                GL_Color(1, 1, 1, 1);
                R_Mesh_ColorPointer(NULL, 0, 0);
 
-               R_SetupSurfaceShader(vec3_origin, rsurface.texture->currentmaterialflags & MATERIALFLAG_MODELLIGHT, 1, 1, rsurface.texture->specularscale, RSURFPASS_BACKGROUND);
+               R_SetupSurfaceShader(vec3_origin, (rsurface.texture->currentmaterialflags & MATERIALFLAG_MODELLIGHT) != 0, 1, 1, rsurface.texture->specularscale, RSURFPASS_BACKGROUND);
                if (r_glsl_permutation)
                {
                        RSurf_PrepareVerticesForBatch(true, true, texturenumsurfaces, texturesurfacelist);
@@ -6498,7 +6499,7 @@ static void R_DrawTextureSurfaceList_GL20(int texturenumsurfaces, msurface_t **t
                R_Mesh_TexBind(GL20TU_REFLECTION, R_GetTexture(r_texture_white)); // changed per surface
        }
 
-       R_SetupSurfaceShader(vec3_origin, rsurface.texture->currentmaterialflags & MATERIALFLAG_MODELLIGHT, 1, 1, rsurface.texture->specularscale, RSURFPASS_BASE);
+       R_SetupSurfaceShader(vec3_origin, (rsurface.texture->currentmaterialflags & MATERIALFLAG_MODELLIGHT) != 0, 1, 1, rsurface.texture->specularscale, RSURFPASS_BASE);
        if (!r_glsl_permutation)
                return;
 
index 74ce706..787b280 100644 (file)
@@ -978,7 +978,7 @@ void R_Q1BSP_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, floa
                // optionally using svbsp for exact culling of compiled lights
                // (or if the user enables dlight svbsp culling, which is mostly for
                //  debugging not actual use)
-               R_Q1BSP_CallRecursiveGetLightInfo(&info, r_shadow_compilingrtlight ? r_shadow_realtime_world_compilesvbsp.integer : r_shadow_realtime_dlight_svbspculling.integer);
+               R_Q1BSP_CallRecursiveGetLightInfo(&info, (r_shadow_compilingrtlight ? r_shadow_realtime_world_compilesvbsp.integer : r_shadow_realtime_dlight_svbspculling.integer) != 0);
        }
 
        rsurface.entity = NULL; // used only by R_GetCurrentTexture and RSurf_ActiveWorldEntity/RSurf_ActiveModelEntity
diff --git a/keys.c b/keys.c
index ce220b4..879944f 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -711,10 +711,10 @@ Key_Console (int key, int ascii)
        {
                if(keydown[K_CTRL])
                {
-                       con_backscroll += (int)floor((vid_conheight.integer >> 2) / con_textsize.integer)-1;
+                       con_backscroll += ((vid_conheight.integer >> 2) / con_textsize.integer)-1;
                }
                else
-                       con_backscroll += (int)floor((vid_conheight.integer >> 1) / con_textsize.integer)-3;
+                       con_backscroll += ((vid_conheight.integer >> 1) / con_textsize.integer)-3;
                return;
        }
 
@@ -722,10 +722,10 @@ Key_Console (int key, int ascii)
        {
                if(keydown[K_CTRL])
                {
-                       con_backscroll -= (int)floor((vid_conheight.integer >> 2) / con_textsize.integer)-1;
+                       con_backscroll -= ((vid_conheight.integer >> 2) / con_textsize.integer)-1;
                }
                else
-                       con_backscroll -= (int)floor((vid_conheight.integer >> 1) / con_textsize.integer)-3;
+                       con_backscroll -= ((vid_conheight.integer >> 1) / con_textsize.integer)-3;
                return;
        }
  
@@ -734,7 +734,7 @@ Key_Console (int key, int ascii)
                if(keydown[K_CTRL])
                        con_backscroll += 1;
                else if(keydown[K_SHIFT])
-                       con_backscroll += (int)floor((vid_conheight.integer >> 2) / con_textsize.integer)-1;
+                       con_backscroll += ((vid_conheight.integer >> 2) / con_textsize.integer)-1;
                else
                        con_backscroll += 5;
                return;
@@ -745,7 +745,7 @@ Key_Console (int key, int ascii)
                if(keydown[K_CTRL])
                        con_backscroll -= 1;
                else if(keydown[K_SHIFT])
-                       con_backscroll -= (int)floor((vid_conheight.integer >> 2) / con_textsize.integer)-1;
+                       con_backscroll -= ((vid_conheight.integer >> 2) / con_textsize.integer)-1;
                else
                        con_backscroll -= 5;
                return;
diff --git a/lhnet.c b/lhnet.c
index 492074b..7da46a7 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -728,7 +728,7 @@ lhnetsocket_t *LHNET_OpenSocket_Connectionless(lhnetaddress_t *address)
                                                int ipv6_only = 1;
                                                if (address->addresstype != LHNETADDRESSTYPE_INET6
                                                        || setsockopt (lhnetsocket->inetsocket, IPPROTO_IPV6, IPV6_V6ONLY,
-                                                                                  (const void *)&ipv6_only, sizeof(ipv6_only)) == 0
+                                                                                  (const char *)&ipv6_only, sizeof(ipv6_only)) == 0
 #ifdef WIN32
                                                        // The Win32 API only supports IPV6_V6ONLY since Windows Vista, but fortunately
                                                        // the default value is what we want on Win32 anyway (IPV6_V6ONLY = true)
index a5ee17f..085dd41 100644 (file)
--- a/libcurl.c
+++ b/libcurl.c
@@ -263,7 +263,7 @@ Returns true if a download needed for the current game is running.
 */
 qboolean Curl_Have_forthismap(void)
 {
-       return numdownloads_added;
+       return numdownloads_added != 0;
 }
 
 void Curl_Register_predownload(void)
index ffabf2a..0b0855f 100644 (file)
--- a/mathlib.h
+++ b/mathlib.h
@@ -98,7 +98,7 @@ unsigned int CeilPowerOf2(unsigned int value);
 #define VectorNormalizeDouble(v) {double ilength = sqrt(DotProduct((v),(v)));if (ilength) ilength = 1.0 / ilength;(v)[0] *= ilength;(v)[1] *= ilength;(v)[2] *= ilength;}
 #define VectorDistance2(a, b) (((a)[0] - (b)[0]) * ((a)[0] - (b)[0]) + ((a)[1] - (b)[1]) * ((a)[1] - (b)[1]) + ((a)[2] - (b)[2]) * ((a)[2] - (b)[2]))
 #define VectorDistance(a, b) (sqrt(VectorDistance2(a,b)))
-#define VectorLength(a) (sqrt(DotProduct(a, a)))
+#define VectorLength(a) (sqrt((double)DotProduct(a, a)))
 #define VectorLength2(a) (DotProduct(a, a))
 #define VectorScale(in, scale, out) ((out)[0] = (in)[0] * (scale),(out)[1] = (in)[1] * (scale),(out)[2] = (in)[2] * (scale))
 #define VectorScaleCast(in, scale, outtype, out) ((out)[0] = (outtype) ((in)[0] * (scale)),(out)[1] = (outtype) ((in)[1] * (scale)),(out)[2] = (outtype) ((in)[2] * (scale)))
diff --git a/menu.c b/menu.c
index 96fc75e..ed17203 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -2824,19 +2824,19 @@ static void M_Menu_Video_FindResolution(int w, int h, float a)
        for (i = 1;i < menu_video_resolutions_count;i++)
        {
                // if the new mode would be a worse match in width, skip it
-               if (fabs(menu_video_resolutions[i].width - w) > fabs(menu_video_resolutions[menu_video_resolution].width - w))
+               if (abs(menu_video_resolutions[i].width - w) > abs(menu_video_resolutions[menu_video_resolution].width - w))
                        continue;
                // if it is equal in width, check height
                if (menu_video_resolutions[i].width == w && menu_video_resolutions[menu_video_resolution].width == w)
                {
                        // if the new mode would be a worse match in height, skip it
-                       if (fabs(menu_video_resolutions[i].height - h) > fabs(menu_video_resolutions[menu_video_resolution].height - h))
+                       if (abs(menu_video_resolutions[i].height - h) > abs(menu_video_resolutions[menu_video_resolution].height - h))
                                continue;
                        // if it is equal in width and height, check pixel aspect
                        if (menu_video_resolutions[i].height == h && menu_video_resolutions[menu_video_resolution].height == h)
                        {
                                // if the new mode would be a worse match in pixel aspect, skip it
-                               if (fabs(menu_video_resolutions[i].pixelheight - a) > fabs(menu_video_resolutions[menu_video_resolution].pixelheight - a))
+                               if (abs(menu_video_resolutions[i].pixelheight - a) > abs(menu_video_resolutions[menu_video_resolution].pixelheight - a))
                                        continue;
                                // if it is equal in everything, skip it (prefer earlier modes)
                                if (menu_video_resolutions[i].pixelheight == a && menu_video_resolutions[menu_video_resolution].pixelheight == a)
index 4b204ef..e0e7869 100644 (file)
@@ -623,7 +623,7 @@ static void Mod_Alias_MorphMesh_CompileFrames(void)
        {
                frameblend[0].subframe = i;
                loadmodel->AnimateVertices(loadmodel, frameblend, loadmodel->surfmesh.data_vertex3f, loadmodel->surfmesh.data_normal3f, NULL, NULL);
-               Mod_BuildTextureVectorsFromNormals(0, loadmodel->surfmesh.num_vertices, loadmodel->surfmesh.num_triangles, loadmodel->surfmesh.data_vertex3f, loadmodel->surfmesh.data_texcoordtexture2f, loadmodel->surfmesh.data_normal3f, loadmodel->surfmesh.data_element3i, loadmodel->surfmesh.data_svector3f, loadmodel->surfmesh.data_tvector3f, r_smoothnormals_areaweighting.integer);
+               Mod_BuildTextureVectorsFromNormals(0, loadmodel->surfmesh.num_vertices, loadmodel->surfmesh.num_triangles, loadmodel->surfmesh.data_vertex3f, loadmodel->surfmesh.data_texcoordtexture2f, loadmodel->surfmesh.data_normal3f, loadmodel->surfmesh.data_element3i, loadmodel->surfmesh.data_svector3f, loadmodel->surfmesh.data_tvector3f, r_smoothnormals_areaweighting.integer != 0);
                // encode the svector and tvector in 3 byte format for permanent storage
                for (j = 0;j < loadmodel->surfmesh.num_vertices;j++)
                {
index f9def07..667bc22 100644 (file)
@@ -4621,12 +4621,12 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump)
                ;
        // i is now 0 for 128, 1 for 256, etc
 
-       for (power = 1;power + i <= mod_q3bsp_lightmapmergepower.integer && (size << power) <= gl_max_texture_size && (1 << (power * 2)) < 4 * (count >> loadmodel->brushq3.deluxemapping); power++)
+       for (power = 1;power + i <= mod_q3bsp_lightmapmergepower.integer && (size << power) <= gl_max_texture_size && (1 << (power * 2)) < 4 * (count >> (loadmodel->brushq3.deluxemapping ? 1 : 0)); power++)
                loadmodel->brushq3.num_lightmapmergepower = power;
 
        loadmodel->brushq3.num_lightmapmerge = 1 << loadmodel->brushq3.num_lightmapmergepower;
 
-       loadmodel->brushq3.num_mergedlightmaps = ((count >> loadmodel->brushq3.deluxemapping) + (1 << (loadmodel->brushq3.num_lightmapmergepower * 2)) - 1) >> (loadmodel->brushq3.num_lightmapmergepower * 2);
+       loadmodel->brushq3.num_mergedlightmaps = ((count >> (loadmodel->brushq3.deluxemapping ? 1 : 0)) + (1 << (loadmodel->brushq3.num_lightmapmergepower * 2)) - 1) >> (loadmodel->brushq3.num_lightmapmergepower * 2);
        loadmodel->brushq3.data_lightmaps = (rtexture_t **)Mem_Alloc(loadmodel->mempool, loadmodel->brushq3.num_mergedlightmaps * sizeof(rtexture_t *));
        if (loadmodel->brushq3.deluxemapping)
                loadmodel->brushq3.data_deluxemaps = (rtexture_t **)Mem_Alloc(loadmodel->mempool, loadmodel->brushq3.num_mergedlightmaps * sizeof(rtexture_t *));
@@ -4660,7 +4660,7 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump)
                                // all be full size except the last one which may be smaller
                                // because it only needs to the remaining blocks, and it will often
                                // be odd sizes like 2048x512 due to only being 25% full or so.
-                               j = (count >> loadmodel->brushq3.deluxemapping) - (lightmapindex << power2);
+                               j = (count >> (loadmodel->brushq3.deluxemapping ? 1 : 0)) - (lightmapindex << power2);
                                for (mergewidth = 1;mergewidth < j && mergewidth < (1 << power);mergewidth *= 2)
                                        ;
                                for (mergeheight = 1;mergewidth*mergeheight < j && mergeheight < (1 << power);mergeheight *= 2)
@@ -4673,7 +4673,7 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump)
                        }
                        mergewidth = R_TextureWidth(loadmodel->brushq3.data_lightmaps[lightmapindex]) / size;
                        mergeheight = R_TextureHeight(loadmodel->brushq3.data_lightmaps[lightmapindex]) / size;
-                       j = (i >> loadmodel->brushq3.deluxemapping) & ((1 << power2) - 1);
+                       j = (i >> (loadmodel->brushq3.deluxemapping ? 1 : 0)) & ((1 << power2) - 1);
                        if (loadmodel->brushq3.deluxemapping && (i & 1))
                                R_UpdateTexture(loadmodel->brushq3.data_deluxemaps[lightmapindex], convertedpixels, (j % mergewidth) * size, (j / mergewidth) * size, size, size);
                        else
@@ -5120,7 +5120,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l)
                        if (cls.state != ca_dedicated && out->lightmaptexture)
                        {
                                // figure out which part of the merged lightmap this fits into
-                               int lightmapindex = LittleLong(in->lightmapindex) >> loadmodel->brushq3.deluxemapping;
+                               int lightmapindex = LittleLong(in->lightmapindex) >> (loadmodel->brushq3.deluxemapping ? 1 : 0);
                                int mergewidth = R_TextureWidth(out->lightmaptexture) / loadmodel->brushq3.lightmapsize;
                                int mergeheight = R_TextureHeight(out->lightmaptexture) / loadmodel->brushq3.lightmapsize;
                                lightmapindex &= mergewidth * mergeheight - 1;
index 3705359..7499518 100644 (file)
@@ -230,7 +230,7 @@ int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_parsegroups
                        if (!COM_ParseToken_Simple(&bufptr, true, false))
                                break;
                        if (strcmp(com_token, "\n"))
-                               loop = atoi(com_token);
+                               loop = atoi(com_token) != 0;
                        else
                                loop = true;
                }
index df70609..d944da3 100644 (file)
@@ -61,7 +61,8 @@ static void Mod_SpriteSetupTexture(texture_t *texture, skinframe_t *skinframe, q
 
 static void Mod_Sprite_SharedSetup(const unsigned char *datapointer, int version, const unsigned int *palette, qboolean additive)
 {
-       int                                     i, j, groupframes, realframes, x, y, origin[2], width, height, fullbright;
+       int                                     i, j, groupframes, realframes, x, y, origin[2], width, height;
+       qboolean                        fullbright;
        dspriteframetype_t      *pinframetype;
        dspriteframe_t          *pinframe;
        dspritegroup_t          *pingroup;
@@ -347,7 +348,8 @@ void Mod_IDSP_Load(dp_model_t *mod, void *buffer, void *bufferend)
 
 void Mod_IDS2_Load(dp_model_t *mod, void *buffer, void *bufferend)
 {
-       int i, version, fullbright;
+       int i, version;
+       qboolean fullbright;
        const dsprite2_t *pinqsprite;
        skinframe_t *skinframe;
        float modelradius;
index 9b832d7..3ae45ad 100644 (file)
@@ -452,7 +452,7 @@ void VM_M_setserverlistmasknumber( void )
                        mask->info.freeslots = number;
                        break;
                case SLIF_ISFAVORITE:
-                       mask->info.isfavorite = number;
+                       mask->info.isfavorite = number != 0;
                        break;
                default:
                        VM_Warning( "VM_M_setserverlistmasknumber: Bad field number %i passed!\n", field );
index 7a63528..b079a37 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -1914,7 +1914,7 @@ void NetConn_QueryQueueFrame(void)
 
        if(!net_slist_pause.integer && serverlist_paused)
                ServerList_RebuildViewList();
-       serverlist_paused = net_slist_pause.integer;
+       serverlist_paused = net_slist_pause.integer != 0;
 
        if (serverlist_querysleep)
                return;
index 7750c13..510f5e7 100644 (file)
@@ -3877,7 +3877,7 @@ void VM_bitshift (void)
        int n1, n2;
        VM_SAFEPARMCOUNT(2, VM_bitshift);
 
-       n1 = (int)fabs((int)PRVM_G_FLOAT(OFS_PARM0));
+       n1 = (int)fabs((float)((int)PRVM_G_FLOAT(OFS_PARM0)));
        n2 = (int)PRVM_G_FLOAT(OFS_PARM1);
        if(!n1)
                PRVM_G_FLOAT(OFS_RETURN) = n1;
index 456ffb5..dcda2ed 100644 (file)
@@ -2235,7 +2235,7 @@ void PRVM_InitProg(int prognr)
        prog->starttime = Sys_DoubleTime();
 
        prog->error_cmd = Host_Error;
-       prog->leaktest_active = prvm_leaktest.integer;
+       prog->leaktest_active = prvm_leaktest.integer != 0;
 }
 
 int PRVM_GetProgNr(void)
index 230b8d5..b96264f 100644 (file)
@@ -2596,7 +2596,7 @@ void R_Shadow_RenderLighting(int firstvertex, int numvertices, int firsttriangle
        }
 }
 
-void R_RTLight_Update(rtlight_t *rtlight, int isstatic, matrix4x4_t *matrix, vec3_t color, int style, const char *cubemapname, qboolean shadow, vec_t corona, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags)
+void R_RTLight_Update(rtlight_t *rtlight, int isstatic, matrix4x4_t *matrix, vec3_t color, int style, const char *cubemapname, int shadow, vec_t corona, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags)
 {
        matrix4x4_t tempmatrix = *matrix;
        Matrix4x4_Scale(&tempmatrix, r_shadow_lightradiusscale.value, 1);
index 111ba47..895a355 100644 (file)
@@ -64,7 +64,7 @@ void R_Shadow_UpdateWorldLightSelection(void);
 
 extern rtlight_t *r_shadow_compilingrtlight;
 
-void R_RTLight_Update(rtlight_t *rtlight, int isstatic, matrix4x4_t *matrix, vec3_t color, int style, const char *cubemapname, qboolean shadow, vec_t corona, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags);
+void R_RTLight_Update(rtlight_t *rtlight, int isstatic, matrix4x4_t *matrix, vec3_t color, int style, const char *cubemapname, int shadow, vec_t corona, vec_t coronasizescale, vec_t ambientscale, vec_t diffusescale, vec_t specularscale, int flags);
 void R_RTLight_Compile(rtlight_t *rtlight);
 void R_RTLight_Uncompile(rtlight_t *rtlight);
 
index bf5a8f9..1c632f7 100644 (file)
@@ -387,7 +387,7 @@ void R_Model_Sprite_Draw_TransparentCallback(const entity_render_t *ent, const r
 #endif
                        }
                        // FIXME: negate left and right in loader
-                       R_DrawSprite(texture->currentlayers[0].blendfunc1, texture->currentlayers[0].blendfunc2, texture->basetexture, texture->currentskinframe->fog, (texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST), (texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE), org, left, up, frame->left, frame->right, frame->down, frame->up, texture->currentlayers[0].color[0], texture->currentlayers[0].color[1], texture->currentlayers[0].color[2], ent->alpha * ent->frameblend[i].lerp);
+                       R_DrawSprite(texture->currentlayers[0].blendfunc1, texture->currentlayers[0].blendfunc2, texture->basetexture, texture->currentskinframe->fog, (texture->currentmaterialflags & MATERIALFLAG_NODEPTHTEST) != 0, (texture->currentmaterialflags & MATERIALFLAG_SHORTDEPTHRANGE) != 0, org, left, up, frame->left, frame->right, frame->down, frame->up, texture->currentlayers[0].color[0], texture->currentlayers[0].color[1], texture->currentlayers[0].color[2], ent->alpha * ent->frameblend[i].lerp);
                        if(edge)
                        {
 #if 0
index 83b0595..540a7f9 100644 (file)
@@ -150,7 +150,7 @@ static int current_swapstereo = false;
 static int current_channellayout = SND_CHANNELLAYOUT_AUTO;
 static int current_channellayout_used = SND_CHANNELLAYOUT_AUTO;
 
-static double spatialpower, spatialmin, spatialdiff, spatialoffset, spatialfactor;
+static float spatialpower, spatialmin, spatialdiff, spatialoffset, spatialfactor;
 typedef enum { SPATIAL_NONE, SPATIAL_LOG, SPATIAL_POW, SPATIAL_THRESH } spatialmethod_t;
 spatialmethod_t spatialmethod;
 
@@ -1359,7 +1359,8 @@ void SND_Spatialize(channel_t *ch, qboolean isstatic)
                                                VectorScale(source_vec, f, source_vec);
                                                break;
                                        case SPATIAL_POW:
-                                               f = spatialmin + spatialdiff * bound(0, (pow(dist, spatialpower) - spatialoffset) * spatialfactor, 1);
+                                               f = (pow(dist, spatialpower) - spatialoffset) * spatialfactor;
+                                               f = spatialmin + spatialdiff * bound(0, f, 1);
                                                VectorScale(source_vec, f, source_vec);
                                                break;
                                        case SPATIAL_THRESH:
index 2475273..17ddc1b 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -792,7 +792,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *sfx)
 
        if(peak)
        {
-               sfx->volume_mult = min(1 / peak, exp(gaindb * 0.05 * log(10)));
+               sfx->volume_mult = min(1.0f / peak, exp(gaindb * 0.05f * log(10.0f)));
                sfx->volume_peak = peak;
                if (developer_loading.integer >= 2)
                        Con_Printf ("Ogg sound file \"%s\" uses ReplayGain (gain %f, peak %f)\n", filename, sfx->volume_mult, sfx->volume_peak);
index 98f2814..4ea1916 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -392,7 +392,7 @@ void SV_ClientThink (void)
        if (host_client->edict->fields.server->movetype == MOVETYPE_NONE)
                return;
 
-       onground = (int)host_client->edict->fields.server->flags & FL_ONGROUND;
+       onground = ((int)host_client->edict->fields.server->flags & FL_ONGROUND) != 0;
 
        DropPunchAngle ();
 
diff --git a/vid.h b/vid.h
index ff9cddc..ba6d060 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -32,10 +32,10 @@ typedef struct viddef_s
        int width;
        int height;
        int bitsperpixel;
-       int fullscreen;
+       qboolean fullscreen;
        int refreshrate;
        qboolean userefreshrate;
-       int stereobuffer;
+       qboolean stereobuffer;
        int samples;
 } viddef_t;
 
index 7376fee..debd52e 100644 (file)
@@ -1193,14 +1193,14 @@ int VID_Mode(int fullscreen, int width, int height, int bpp, int refreshrate, in
        Con_Printf("Initializing Video Mode: %s %dx%dx%dx%dhz%s%s\n", fullscreen ? "fullscreen" : "window", width, height, bpp, refreshrate, stereobuffer ? " stereo" : "", samples > 1 ? va(" (%ix AA)", samples) : "");
        if (VID_InitMode(fullscreen, &width, &height, bpp, vid_userefreshrate.integer ? max(1, refreshrate) : 0, stereobuffer, samples))
        {
-               vid.fullscreen = fullscreen;
+               vid.fullscreen = fullscreen != 0;
                vid.width = width;
                vid.height = height;
                vid.bitsperpixel = bpp;
                vid.samples = samples;
                vid.refreshrate = refreshrate;
-               vid.stereobuffer = stereobuffer;
-               vid.userefreshrate = vid_userefreshrate.integer;
+               vid.stereobuffer = stereobuffer != 0;
+               vid.userefreshrate = vid_userefreshrate.integer != 0;
                Cvar_SetValueQuick(&vid_fullscreen, fullscreen);
                Cvar_SetValueQuick(&vid_width, width);
                Cvar_SetValueQuick(&vid_height, height);