]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_screen.c
some const fixes and type fixes found by gcc -combine
[xonotic/darkplaces.git] / cl_screen.c
index 3074054af0686b8340d51a92a2ad26aca12a6c16..52d93d4564ffb6d0ad339be4a4c88c9f65a9e9ac 100644 (file)
@@ -90,7 +90,7 @@ Called for important messages that should stay in the center of the screen
 for a few moments
 ==============
 */
-void SCR_CenterPrint(char *str)
+void SCR_CenterPrint(const char *str)
 {
        strlcpy (scr_centerstring, str, sizeof (scr_centerstring));
        scr_centertime_off = scr_centertime.value;
@@ -337,7 +337,7 @@ void SCR_DrawTurtle (void)
        if (count < 3)
                return;
 
-       DrawQ_Pic (0, 0, Draw_CachePic("gfx/turtle", true), 0, 0, 1, 1, 1, 1, 0);
+       DrawQ_Pic (0, 0, Draw_CachePic ("gfx/turtle"), 0, 0, 1, 1, 1, 1, 0);
 }
 
 /*
@@ -354,7 +354,7 @@ void SCR_DrawNet (void)
        if (cls.demoplayback)
                return;
 
-       DrawQ_Pic (64, 0, Draw_CachePic("gfx/net", true), 0, 0, 1, 1, 1, 1, 0);
+       DrawQ_Pic (64, 0, Draw_CachePic ("gfx/net"), 0, 0, 1, 1, 1, 1, 0);
 }
 
 /*
@@ -375,7 +375,7 @@ void SCR_DrawPause (void)
        if (!cl.paused)
                return;
 
-       pic = Draw_CachePic ("gfx/pause", true);
+       pic = Draw_CachePic ("gfx/pause");
        DrawQ_Pic ((vid_conwidth.integer - pic->width)/2, (vid_conheight.integer - pic->height)/2, pic, 0, 0, 1, 1, 1, 1, 0);
 }
 
@@ -392,7 +392,7 @@ void SCR_DrawBrand (void)
        if (!scr_showbrand.value)
                return;
 
-       pic = Draw_CachePic ("gfx/brand", true);
+       pic = Draw_CachePic ("gfx/brand");
 
        switch ((int)scr_showbrand.value)
        {
@@ -1722,6 +1722,7 @@ static void R_Envmap_f (void)
        r_refdef.view.height = size;
        r_refdef.view.depth = 1;
        r_refdef.view.useperspective = true;
+       r_refdef.view.isoverlay = false;
 
        r_refdef.view.frustum_x = tan(90 * M_PI / 360.0);
        r_refdef.view.frustum_y = tan(90 * M_PI / 360.0);
@@ -1811,7 +1812,7 @@ void SHOWLMP_drawall(void)
        int i;
        for (i = 0;i < cl.num_showlmps;i++)
                if (cl.showlmps[i].isactive)
-                       DrawQ_Pic(cl.showlmps[i].x, cl.showlmps[i].y, Draw_CachePic(cl.showlmps[i].pic, true), 0, 0, 1, 1, 1, 1, 0);
+                       DrawQ_Pic(cl.showlmps[i].x, cl.showlmps[i].y, Draw_CachePic (cl.showlmps[i].pic), 0, 0, 1, 1, 1, 1, 0);
 }
 
 /*
@@ -2036,6 +2037,9 @@ void SCR_UpdateLoadingScreen (qboolean clear)
        // don't do anything if not initialized yet
        if (vid_hidden || !scr_refresh.integer)
                return;
+       // release mouse grab while loading
+       if (!vid.fullscreen)
+               VID_SetMouse(false, false, false);
        CHECKGLERROR
        qglViewport(0, 0, vid.width, vid.height);CHECKGLERROR
        //qglDisable(GL_SCISSOR_TEST);CHECKGLERROR
@@ -2054,7 +2058,7 @@ void SCR_UpdateLoadingScreen (qboolean clear)
        R_Mesh_Start();
        R_Mesh_Matrix(&identitymatrix);
        // draw the loading plaque
-       pic = Draw_CachePic("gfx/loading", true);
+       pic = Draw_CachePic ("gfx/loading");
        x = (vid_conwidth.integer - pic->width)/2;
        y = (vid_conheight.integer - pic->height)/2;
        GL_Color(1,1,1,1);
@@ -2080,19 +2084,19 @@ void SCR_UpdateLoadingScreen (qboolean clear)
        if (vid.stereobuffer)
        {
                qglDrawBuffer(GL_FRONT_LEFT);
-               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
+               R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
                qglDrawBuffer(GL_FRONT_RIGHT);
-               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
+               R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
        }
        else
        {
                qglDrawBuffer(GL_FRONT);
-               R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
+               R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
        }
        R_Mesh_Finish();
        // refresh
        // not necessary when rendering to GL_FRONT buffers
-       //VID_Finish(false);
+       //VID_Finish();
        // however this IS necessary on Windows Vista
        qglFinish();
 }
@@ -2110,22 +2114,25 @@ void CL_UpdateScreen(void)
        double rendertime1;
        float conwidth, conheight;
 
-       // play a bit with the palette
-       palette_rgb_pantscolormap[15][0] = 128 + 127 * sin(cl.time / exp(1) + 0*M_PI/3);
-       palette_rgb_pantscolormap[15][1] = 128 + 127 * sin(cl.time / exp(1) + 2*M_PI/3);
-       palette_rgb_pantscolormap[15][2] = 128 + 127 * sin(cl.time / exp(1) + 4*M_PI/3);
-       palette_rgb_shirtcolormap[15][0] = 128 + 127 * sin(cl.time /  M_PI  + 5*M_PI/3);
-       palette_rgb_shirtcolormap[15][1] = 128 + 127 * sin(cl.time /  M_PI  + 3*M_PI/3);
-       palette_rgb_shirtcolormap[15][2] = 128 + 127 * sin(cl.time /  M_PI  + 1*M_PI/3);
-       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));
+       if (!scr_initialized || !con_initialized)
+               return;                         // not initialized yet
+
+       if(gamemode == GAME_NEXUIZ)
+       {
+               // play a bit with the palette (experimental)
+               palette_rgb_pantscolormap[15][0] = 128 + 127 * sin(cl.time / exp(1) + 0*M_PI/3);
+               palette_rgb_pantscolormap[15][1] = 128 + 127 * sin(cl.time / exp(1) + 2*M_PI/3);
+               palette_rgb_pantscolormap[15][2] = 128 + 127 * sin(cl.time / exp(1) + 4*M_PI/3);
+               palette_rgb_shirtcolormap[15][0] = 128 + 127 * sin(cl.time /  M_PI  + 5*M_PI/3);
+               palette_rgb_shirtcolormap[15][1] = 128 + 127 * sin(cl.time /  M_PI  + 3*M_PI/3);
+               palette_rgb_shirtcolormap[15][2] = 128 + 127 * sin(cl.time /  M_PI  + 1*M_PI/3);
+               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));
+       }
 
        if (vid_hidden || !scr_refresh.integer)
                return;
 
-       if (!scr_initialized || !con_initialized)
-               return;                         // not initialized yet
-
        rendertime1 = Sys_DoubleTime();
 
        conwidth = bound(320, vid_conwidth.value, 2048);
@@ -2185,6 +2192,7 @@ void CL_UpdateScreen(void)
        qglClearColor(0,0,0,0);CHECKGLERROR
        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);
 
        if(scr_stipple.integer)
@@ -2264,7 +2272,18 @@ void CL_UpdateScreen(void)
        else
                cl_updatescreen_quality = 1;
 
-       VID_Finish(true);
+       if (!vid_activewindow)
+               VID_SetMouse(false, false, false);
+       else if (key_consoleactive)
+               VID_SetMouse(vid.fullscreen, false, false);
+       else if (key_dest == key_menu_grabbed)
+               VID_SetMouse(true, !in_client_mouse, true);
+       else if (key_dest == key_menu)
+               VID_SetMouse(vid.fullscreen, !in_client_mouse, true);
+       else
+               VID_SetMouse(vid.fullscreen, vid_mouse.integer && !cls.demoplayback && !cl.csqc_wantsmousemove, true);
+
+       VID_Finish();
 }
 
 void CL_Screen_NewMap(void)