]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
replaced all references to vid.conwidth and vid.conheight with vid_conwidth.integer...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 13 May 2005 23:41:24 +0000 (23:41 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 13 May 2005 23:41:24 +0000 (23:41 +0000)
replaced all references to vid.realx/vid.realy with 0
replaced all references to vid.realwidth and vid.realheight with vid.width and vid.height
replaced current_vid_* variables with vid. fields (vid.width, vid.height, vid.bitsperpixel, vid.fullscreen)
vid_glx.c: replaced scr_width/height with vid.width/height
vid_wgl.c: replaced window_center_x/y with calculations as needed, and replaced window_width/height with vid.width/height, and some other minor cleanups
removed VID_GetWindowSize function

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5284 d7cf8633-e32d-0410-b094-e92efae38249

19 files changed:
cl_input.c
cl_screen.c
cl_video.c
console.c
gl_backend.c
gl_draw.c
gl_rmain.c
keys.c
menu.c
prvm_cmds.c
r_crosshairs.c
r_shadow.c
sbar.c
vid.h
vid_glx.c
vid_null.c
vid_sdl.c
vid_shared.c
vid_wgl.c

index 9012907d6604de4fba0d966ea824ffddcfa6b0d6..3ab19f32b196671ab7e7e359548e0e692d422b26 100644 (file)
@@ -401,8 +401,8 @@ void CL_Move (void)
                {
                        // mouse interacting with the scene, mostly stationary view
                        V_StopPitchDrift();
-                       cl.cmd.cursor_screen[0] += in_mouse_x * sensitivity.value / vid.realwidth;
-                       cl.cmd.cursor_screen[1] += in_mouse_y * sensitivity.value / vid.realheight;
+                       cl.cmd.cursor_screen[0] += in_mouse_x * sensitivity.value / vid.width;
+                       cl.cmd.cursor_screen[1] += in_mouse_y * sensitivity.value / vid.height;
                }
                else if (in_strafe.state & 1)
                {
@@ -448,22 +448,22 @@ void CL_UpdatePrydonCursor(void)
        /*
        if (cl.cmd.cursor_screen[0] < -1)
        {
-               cl.viewangles[YAW] -= m_yaw.value * (cl.cmd.cursor_screen[0] - -1) * vid.realwidth * sensitivity.value * cl.viewzoom;
+               cl.viewangles[YAW] -= m_yaw.value * (cl.cmd.cursor_screen[0] - -1) * vid.width * sensitivity.value * cl.viewzoom;
                cl.cmd.cursor_screen[0] = -1;
        }
        if (cl.cmd.cursor_screen[0] > 1)
        {
-               cl.viewangles[YAW] -= m_yaw.value * (cl.cmd.cursor_screen[0] - 1) * vid.realwidth * sensitivity.value * cl.viewzoom;
+               cl.viewangles[YAW] -= m_yaw.value * (cl.cmd.cursor_screen[0] - 1) * vid.width * sensitivity.value * cl.viewzoom;
                cl.cmd.cursor_screen[0] = 1;
        }
        if (cl.cmd.cursor_screen[1] < -1)
        {
-               cl.viewangles[PITCH] += m_pitch.value * (cl.cmd.cursor_screen[1] - -1) * vid.realheight * sensitivity.value * cl.viewzoom;
+               cl.viewangles[PITCH] += m_pitch.value * (cl.cmd.cursor_screen[1] - -1) * vid.height * sensitivity.value * cl.viewzoom;
                cl.cmd.cursor_screen[1] = -1;
        }
        if (cl.cmd.cursor_screen[1] > 1)
        {
-               cl.viewangles[PITCH] += m_pitch.value * (cl.cmd.cursor_screen[1] - 1) * vid.realheight * sensitivity.value * cl.viewzoom;
+               cl.viewangles[PITCH] += m_pitch.value * (cl.cmd.cursor_screen[1] - 1) * vid.height * sensitivity.value * cl.viewzoom;
                cl.cmd.cursor_screen[1] = 1;
        }
        */
index 3c2268b01f12e86d5f5cfa55397b80211f6d119b..7ccced756461997a95e89382103ffc63d1ecec2b 100644 (file)
@@ -102,17 +102,17 @@ void SCR_DrawCenterString (void)
        start = scr_centerstring;
 
        if (scr_center_lines <= 4)
-               y = vid.conheight*0.35;
+               y = vid_conheight.integer*0.35;
        else
                y = 48;
 
        do
        {
        // scan the width of the line
-               for (l=0 ; l<vid.conwidth/8 ; l++)
+               for (l=0 ; l<vid_conwidth.integer/8 ; l++)
                        if (start[l] == '\n' || !start[l])
                                break;
-               x = (vid.conwidth - l*8)/2;
+               x = (vid_conwidth.integer - l*8)/2;
                if (l > 0)
                {
                        if (remaining < l)
@@ -217,7 +217,7 @@ void SCR_DrawPause (void)
                return;
 
        pic = Draw_CachePic ("gfx/pause", true);
-       DrawQ_Pic ((vid.conwidth - pic->width)/2, (vid.conheight - pic->height)/2, "gfx/pause", 0, 0, 1, 1, 1, 1, 0);
+       DrawQ_Pic ((vid_conwidth.integer - pic->width)/2, (vid_conheight.integer - pic->height)/2, "gfx/pause", 0, 0, 1, 1, 1, 1, 0);
 }
 
 
@@ -246,7 +246,7 @@ void SCR_SetUpToDrawConsole (void)
 
 // decide on the height of the console
        if (key_consoleactive & KEY_CONSOLEACTIVE_USER)
-               conlines = vid.conheight/2;     // half screen
+               conlines = vid_conheight.integer/2;     // half screen
        else
                conlines = 0;                           // none visible
 
@@ -280,7 +280,7 @@ void SCR_DrawConsole (void)
        if (key_consoleactive & KEY_CONSOLEACTIVE_FORCED)
        {
                // full screen
-               Con_DrawConsole (vid.conheight);
+               Con_DrawConsole (vid_conheight.integer);
        }
        else if (scr_con_current)
                Con_DrawConsole (scr_con_current);
@@ -329,7 +329,7 @@ void R_TimeReport(char *desc)
        while (length < 20)
                tempbuf[length++] = ' ';
        tempbuf[length] = 0;
-       if (speedstringcount + length > (vid.conwidth / 8))
+       if (speedstringcount + length > (vid_conwidth.integer / 8))
        {
                strcat(r_speeds_string, "\n");
                speedstringcount = 0;
@@ -406,9 +406,9 @@ void R_TimeReport_End(void)
                for (i = 0;r_speeds_string[i];i++)
                        if (r_speeds_string[i] == '\n')
                                lines++;
-               y = vid.conheight - sb_lines - lines * 8;
+               y = vid_conheight.integer - sb_lines - lines * 8;
                i = j = 0;
-               DrawQ_Fill(0, y, vid.conwidth, lines * 8, 0, 0, 0, 0.5, 0);
+               DrawQ_Fill(0, y, vid_conwidth.integer, lines * 8, 0, 0, 0, 0.5, 0);
                while (r_speeds_string[i])
                {
                        j = i;
@@ -509,7 +509,7 @@ void DrawQ_String_Real(float x, float y, const char *string, int maxlen, float s
        for (;len > 0 && string[len - 1] == ' ';len--);
        if (len < 1)
                return;
-       if (x >= vid.conwidth || y >= vid.conheight || x < (-scalex * len) || y < (-scaley))
+       if (x >= vid_conwidth.integer || y >= vid_conheight.integer || x < (-scalex * len) || y < (-scaley))
                return;
        size = sizeof(*dq) + ((len + 1 + 3) & ~3);
        if (r_refdef.drawqueuesize + size > r_refdef.maxdrawqueuesize)
@@ -692,11 +692,11 @@ void SCR_ScreenShot_f (void)
 
        sprintf(filename, "%s%06d.%s", base, shotnumber, jpeg ? "jpg" : "tga");
 
-       buffer1 = Mem_Alloc(tempmempool, vid.realwidth * vid.realheight * 3);
-       buffer2 = Mem_Alloc(tempmempool, vid.realwidth * vid.realheight * 3);
-       buffer3 = Mem_Alloc(tempmempool, vid.realwidth * vid.realheight * 3 + 18);
+       buffer1 = Mem_Alloc(tempmempool, vid.width * vid.height * 3);
+       buffer2 = Mem_Alloc(tempmempool, vid.width * vid.height * 3);
+       buffer3 = Mem_Alloc(tempmempool, vid.width * vid.height * 3 + 18);
 
-       if (SCR_ScreenShot (filename, buffer1, buffer2, buffer3, vid.realx, vid.realy, vid.realwidth, vid.realheight, false, false, false, jpeg, true))
+       if (SCR_ScreenShot (filename, buffer1, buffer2, buffer3, 0, 0, vid.width, vid.height, false, false, false, jpeg, true))
                Con_Printf("Wrote %s\n", filename);
        else
                Con_Printf("unable to write %s\n", filename);
@@ -743,7 +743,7 @@ void SCR_CaptureVideo_BeginVideo(void)
        cl_capturevideo_framerate = bound(1, cl_capturevideo_fps.value, 1000);
        cl_capturevideo_soundrate = 0;
        cl_capturevideo_frame = 0;
-       cl_capturevideo_buffer = Mem_Alloc(tempmempool, vid.realwidth * vid.realheight * (3+3+3) + 18);
+       cl_capturevideo_buffer = Mem_Alloc(tempmempool, vid.width * vid.height * (3+3+3) + 18);
        gamma = 1.0/scr_screenshot_gamma.value;
 
        /*
@@ -881,11 +881,11 @@ void SCR_CaptureVideo_EndVideo(void)
 
 qboolean SCR_CaptureVideo_VideoFrame(int newframenum)
 {
-       int x = vid.realx, y = vid.realy, width = vid.realwidth, height = vid.realheight;
+       int x = 0, y = 0, width = vid.width, height = vid.height;
        unsigned char *b, *out;
        char filename[32];
        int outoffset = (width/2)*(height/2);
-       //return SCR_ScreenShot(filename, cl_capturevideo_buffer, cl_capturevideo_buffer + vid.realwidth * vid.realheight * 3, cl_capturevideo_buffer + vid.realwidth * vid.realheight * 6, vid.realx, vid.realy, vid.realwidth, vid.realheight, false, false, false, jpeg, true);
+       //return SCR_ScreenShot(filename, cl_capturevideo_buffer, cl_capturevideo_buffer + vid.width * vid.height * 3, cl_capturevideo_buffer + vid.width * vid.height * 6, 0, 0, vid.width, vid.height, false, false, false, jpeg, true);
        // speed is critical here, so do saving as directly as possible
        switch (cl_capturevideo_format)
        {
@@ -950,7 +950,7 @@ qboolean SCR_CaptureVideo_VideoFrame(int newframenum)
                }
                return true;
        case CAPTUREVIDEOFORMAT_TARGA:
-               //return Image_WriteTGARGB_preflipped (filename, width, height, cl_capturevideo_buffer, cl_capturevideo_buffer + vid.realwidth * vid.realheight * 3, );
+               //return Image_WriteTGARGB_preflipped (filename, width, height, cl_capturevideo_buffer, cl_capturevideo_buffer + vid.width * vid.height * 3, );
                memset (cl_capturevideo_buffer, 0, 18);
                cl_capturevideo_buffer[2] = 2;          // uncompressed type
                cl_capturevideo_buffer[12] = (width >> 0) & 0xFF;
@@ -1075,7 +1075,7 @@ static void R_Envmap_f (void)
                Con_Print("envmap: size must be one of 128, 256, 512, or 1024\n");
                return;
        }
-       if (size > vid.realwidth || size > vid.realheight)
+       if (size > vid.width || size > vid.height)
        {
                Con_Print("envmap: your resolution is not big enough to render that size\n");
                return;
@@ -1103,7 +1103,7 @@ static void R_Envmap_f (void)
                R_Mesh_Start();
                R_RenderView();
                R_Mesh_Finish();
-               SCR_ScreenShot(filename, buffer1, buffer2, buffer3, vid.realx, vid.realy + vid.realheight - (r_refdef.y + r_refdef.height), size, size, envmapinfo[j].flipx, envmapinfo[j].flipy, envmapinfo[j].flipdiagonaly, false, false);
+               SCR_ScreenShot(filename, buffer1, buffer2, buffer3, 0, vid.height - (r_refdef.y + r_refdef.height), size, size, envmapinfo[j].flipx, envmapinfo[j].flipy, envmapinfo[j].flipdiagonaly, false, false);
        }
 
        Mem_Free (buffer1);
@@ -1200,8 +1200,6 @@ void CL_SetupScreenSize(void)
 {
        float conwidth, conheight;
 
-       VID_GetWindowSize (&vid.realx, &vid.realy, &vid.realwidth, &vid.realheight);
-
        VID_UpdateGamma(false);
 
        conwidth = bound(320, vid_conwidth.value, 2048);
@@ -1211,16 +1209,8 @@ void CL_SetupScreenSize(void)
        if (vid_conheight.value != conheight)
                Cvar_SetValue("vid_conheight", conheight);
 
-       vid.conwidth = vid_conwidth.integer;
-       vid.conheight = vid_conheight.integer;
-
-/*     if (vid.realheight > 240)
-       {
-               vid.conheight = (vid.realheight - 240) * scr_2dresolution.value + 240;
-               vid.conheight = bound(240, vid.conheight, vid.realheight);
-       }
-       else
-               vid.conheight = 240;*/
+       vid_conwidth.integer = vid_conwidth.integer;
+       vid_conheight.integer = vid_conheight.integer;
 
        SCR_SetUpToDrawConsole();
 }
index e7858ac340fef0c91fffc9174cf5dbe3dafa024b..692dc9410425ae467e22e9af84a511aa77e8be44 100644 (file)
@@ -239,7 +239,7 @@ int cl_videoplaying = false; // old, but still supported
 void CL_DrawVideo(void)
 {
        if (cl_videoplaying)
-               DrawQ_Pic(0, 0, videoarray->cpif.name, vid.conwidth, vid.conheight, 1, 1, 1, 1, 0);
+               DrawQ_Pic(0, 0, videoarray->cpif.name, vid_conwidth.integer, vid_conheight.integer, 1, 1, 1, 1, 0);
 }
 
 void CL_VideoStart(char *filename)
index d5a1b31029ea1f61c9f517b7b28f5d81277fe675..97c2bd224b0aa5d1a2cd1ea1c582521811e0a7a8 100644 (file)
--- a/console.c
+++ b/console.c
@@ -325,7 +325,7 @@ void Con_CheckResize (void)
        int i, j, width, oldwidth, oldtotallines, numlines, numchars;
        char tbuf[CON_TEXTSIZE];
 
-       width = (vid.conwidth >> 3);
+       width = (vid_conwidth.integer >> 3);
 
        if (width == con_linewidth)
                return;
@@ -839,7 +839,7 @@ void Con_DrawNotify (void)
                        int linewidth;
 
                        for (linewidth = con_linewidth; linewidth && text[linewidth-1] == ' '; linewidth--);
-                       x = (vid.conwidth - linewidth * 8) / 2;
+                       x = (vid_conwidth.integer - linewidth * 8) / 2;
                } else
                        x = 0;
 
@@ -891,10 +891,10 @@ void Con_DrawConsole (int lines)
 
 // draw the background
        if (scr_conbrightness.value >= 0.01f)
-               DrawQ_Pic(0, lines - vid.conheight, "gfx/conback", vid.conwidth, vid.conheight, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, scr_conalpha.value, 0);
+               DrawQ_Pic(0, lines - vid_conheight.integer, "gfx/conback", vid_conwidth.integer, vid_conheight.integer, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, scr_conalpha.value, 0);
        else
-               DrawQ_Fill(0, lines - vid.conheight, vid.conwidth, vid.conheight, 0, 0, 0, scr_conalpha.value, 0);
-       DrawQ_String(vid.conwidth - strlen(engineversion) * 8 - 8, lines - 8, engineversion, 0, 8, 8, 1, 0, 0, 1, 0);
+               DrawQ_Fill(0, lines - vid_conheight.integer, vid_conwidth.integer, vid_conheight.integer, 0, 0, 0, scr_conalpha.value, 0);
+       DrawQ_String(vid_conwidth.integer - strlen(engineversion) * 8 - 8, lines - 8, engineversion, 0, 8, 8, 1, 0, 0, 1, 0);
 
 // draw the text
        con_vislines = lines;
index 62aa182d08b56c28dbd01d0a316d4e3b9cec7efc..e766db65a222ec7d5c2a09707c281e87dd767e61 100644 (file)
@@ -709,7 +709,7 @@ void GL_LockArrays(int first, int count)
 void GL_Scissor (int x, int y, int width, int height)
 {
        CHECKGLERROR
-       qglScissor(x, vid.realheight - (y + height),width,height);
+       qglScissor(x, vid.height - (y + height),width,height);
        CHECKGLERROR
 }
 
@@ -1719,19 +1719,19 @@ void SCR_DrawScreen (void)
 
                        if (r_stereo_sidebyside.integer)
                        {
-                               r_refdef.width = vid.realwidth * size / 2.5;
-                               r_refdef.height = vid.realheight * size / 2.5 * (1 - bound(0, r_letterbox.value, 100) / 100);
-                               r_refdef.x = (vid.realwidth - r_refdef.width * 2.5) * 0.5;
-                               r_refdef.y = (vid.realheight - r_refdef.height)/2;
+                               r_refdef.width = vid.width * size / 2.5;
+                               r_refdef.height = vid.height * size / 2.5 * (1 - bound(0, r_letterbox.value, 100) / 100);
+                               r_refdef.x = (vid.width - r_refdef.width * 2.5) * 0.5;
+                               r_refdef.y = (vid.height - r_refdef.height)/2;
                                if (r_stereo_side)
                                        r_refdef.x += r_refdef.width * 1.5;
                        }
                        else
                        {
-                               r_refdef.width = vid.realwidth * size;
-                               r_refdef.height = vid.realheight * size * (1 - bound(0, r_letterbox.value, 100) / 100);
-                               r_refdef.x = (vid.realwidth - r_refdef.width)/2;
-                               r_refdef.y = (vid.realheight - r_refdef.height)/2;
+                               r_refdef.width = vid.width * size;
+                               r_refdef.height = vid.height * size * (1 - bound(0, r_letterbox.value, 100) / 100);
+                               r_refdef.x = (vid.width - r_refdef.width)/2;
+                               r_refdef.y = (vid.height - r_refdef.height)/2;
                        }
 
                        // LordHavoc: viewzoom (zoom in for sniper rifles, etc)
@@ -1744,9 +1744,9 @@ void SCR_DrawScreen (void)
                        {
                                float sizex = bound(10, scr_zoomwindow_viewsizex.value, 100) / 100.0;
                                float sizey = bound(10, scr_zoomwindow_viewsizey.value, 100) / 100.0;
-                               r_refdef.width = vid.realwidth * sizex;
-                               r_refdef.height = vid.realheight * sizey;
-                               r_refdef.x = (vid.realwidth - r_refdef.width)/2;
+                               r_refdef.width = vid.width * sizex;
+                               r_refdef.height = vid.height * sizey;
+                               r_refdef.x = (vid.width - r_refdef.width)/2;
                                r_refdef.y = 0;
                                r_refdef.fov_x = scr_zoomwindow_fov.value * r_refdef.fovscale_x;
                                r_refdef.fov_y = CalcFov(scr_zoomwindow_fov.value, r_refdef.width, r_refdef.height) * r_refdef.fovscale_y;
@@ -1757,8 +1757,8 @@ void SCR_DrawScreen (void)
 
                if (!r_stereo_sidebyside.integer)
                {
-                       r_refdef.width = vid.realwidth;
-                       r_refdef.height = vid.realheight;
+                       r_refdef.width = vid.width;
+                       r_refdef.height = vid.height;
                        r_refdef.x = 0;
                        r_refdef.y = 0;
                }
@@ -1783,9 +1783,8 @@ void SCR_UpdateLoadingScreen (void)
        if (vid_hidden)
                return;
        r_showtrispass = 0;
-       VID_GetWindowSize(&vid.realx, &vid.realy, &vid.realwidth, &vid.realheight);
        VID_UpdateGamma(false);
-       qglViewport(0, 0, vid.realwidth, vid.realheight);
+       qglViewport(0, 0, vid.width, vid.height);
        //qglDisable(GL_SCISSOR_TEST);
        //qglDepthMask(1);
        qglColorMask(1,1,1,1);
@@ -1848,7 +1847,7 @@ void SCR_UpdateScreen (void)
                Cvar_SetValueQuick(&gl_combine, 0);
 
        CHECKGLERROR
-       qglViewport(0, 0, vid.realwidth, vid.realheight);
+       qglViewport(0, 0, vid.width, vid.height);
        qglDisable(GL_SCISSOR_TEST);
        qglDepthMask(1);
        qglColorMask(1,1,1,1);
index 7ae8700738f4a0bc3f104db4813e62ab63d1ec58..135cac695bd347c4f7d3c32c8c7c72fd5c779fbd 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -478,19 +478,19 @@ void R_DrawQueue(void)
                }
        }
 
-       r_view_width = bound(0, r_refdef.width, vid.realwidth);
-       r_view_height = bound(0, r_refdef.height, vid.realheight);
+       r_view_width = bound(0, r_refdef.width, vid.width);
+       r_view_height = bound(0, r_refdef.height, vid.height);
        r_view_depth = 1;
-       r_view_x = bound(0, r_refdef.x, vid.realwidth - r_refdef.width);
-       r_view_y = bound(0, r_refdef.y, vid.realheight - r_refdef.height);
+       r_view_x = bound(0, r_refdef.x, vid.width - r_refdef.width);
+       r_view_y = bound(0, r_refdef.y, vid.height - r_refdef.height);
        r_view_z = 0;
        r_view_fov_x = bound(0.1, r_refdef.fov_x, 170);
        r_view_fov_y = bound(0.1, r_refdef.fov_y, 170);
        r_view_matrix = r_refdef.viewentitymatrix;
        GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 1);
 
-       qglViewport(r_view_x, vid.realheight - (r_view_y + r_view_height), r_view_width, r_view_height);
-       GL_SetupView_Mode_Ortho(0, 0, vid.conwidth, vid.conheight, -10, 100);
+       qglViewport(r_view_x, vid.height - (r_view_y + r_view_height), r_view_width, r_view_height);
+       GL_SetupView_Mode_Ortho(0, 0, vid_conwidth.integer, vid_conheight.integer, -10, 100);
        qglDepthFunc(GL_LEQUAL);
        R_Mesh_Matrix(&r_identitymatrix);
 
@@ -544,7 +544,7 @@ void R_DrawQueue(void)
                        R_Mesh_State(&m);
                        at = varray_texcoord2f[0];
                        av = varray_vertex3f;
-                       while ((num = *str++) && x < vid.conwidth)
+                       while ((num = *str++) && x < vid_conwidth.integer)
                        {
                                if (num != ' ')
                                {
@@ -599,11 +599,11 @@ void R_DrawQueue(void)
                        {
                                // We have to convert the con coords into real coords
                                int x , y, width, height;
-                               x = dq->x * ((float)vid.realwidth / vid.conwidth);
+                               x = dq->x * ((float)vid.width / vid_conwidth.integer);
                                // OGL uses top to bottom
-                               y = dq->y * ((float) vid.realheight / vid.conheight);
-                               width = dq->scalex * ((float)vid.realwidth / vid.conwidth);
-                               height = dq->scaley * ((float)vid.realheight / vid.conheight);
+                               y = dq->y * ((float) vid.height / vid_conheight.integer);
+                               width = dq->scalex * ((float)vid.width / vid_conwidth.integer);
+                               height = dq->scaley * ((float)vid.height / vid_conheight.integer);
 
                                GL_Scissor(x, y, width, height);
 
index 8d5a193f024de9aec01c063aa6adc6b7428381b9..63a395e7965bcfcd3f957bf8f4edfd4fab7cdaa9 100644 (file)
@@ -814,8 +814,8 @@ static void R_BlendView(void)
                // set the (poorly named) screenwidth and screenheight variables to
                // a power of 2 at least as large as the screen, these will define the
                // size of the texture to allocate
-               for (screenwidth = 1;screenwidth < vid.realwidth;screenwidth *= 2);
-               for (screenheight = 1;screenheight < vid.realheight;screenheight *= 2);
+               for (screenwidth = 1;screenwidth < vid.width;screenwidth *= 2);
+               for (screenheight = 1;screenheight < vid.height;screenheight *= 2);
                // allocate textures as needed
                if (!r_bloom_texture_screen)
                        r_bloom_texture_screen = R_LoadTexture2D(r_main_texturepool, "screen", screenwidth, screenheight, NULL, TEXTYPE_RGBA, TEXF_FORCENEAREST | TEXF_CLAMP | TEXF_ALWAYSPRECACHE, NULL);
@@ -852,14 +852,14 @@ static void R_BlendView(void)
                R_Mesh_State(&m);
                // copy view into the full resolution screen image texture
                GL_ActiveTexture(0);
-               qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.realheight - (r_view_y + r_view_height), r_view_width, r_view_height);
+               qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + r_view_height), r_view_width, r_view_height);
                c_bloomcopies++;
                c_bloomcopypixels += r_view_width * r_view_height;
                // now scale it down to the bloom size and raise to a power of itself
                // to darken it (this leaves the really bright stuff bright, and
                // everything else becomes very dark)
                // TODO: optimize with multitexture or GLSL
-               qglViewport(r_view_x, vid.realheight - (r_view_y + bloomheight), bloomwidth, bloomheight);
+               qglViewport(r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight);
                GL_BlendFunc(GL_ONE, GL_ZERO);
                GL_Color(1, 1, 1, 1);
                R_Mesh_Draw(0, 4, 2, polygonelements);
@@ -881,7 +881,7 @@ static void R_BlendView(void)
                m.pointer_texcoord[0] = varray_texcoord2f[2];
                R_Mesh_State(&m);
                GL_ActiveTexture(0);
-               qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.realheight - (r_view_y + bloomheight), bloomwidth, bloomheight);
+               qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight);
                c_bloomcopies++;
                c_bloomcopypixels += bloomwidth * bloomheight;
                // blend on at multiple vertical offsets to achieve a vertical blur
@@ -915,7 +915,7 @@ static void R_BlendView(void)
                }
                // copy the vertically blurred bloom view to a texture
                GL_ActiveTexture(0);
-               qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.realheight - (r_view_y + bloomheight), bloomwidth, bloomheight);
+               qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight);
                c_bloomcopies++;
                c_bloomcopypixels += bloomwidth * bloomheight;
                // blend the vertically blurred image at multiple offsets horizontally
@@ -950,11 +950,11 @@ static void R_BlendView(void)
                }
                // copy the blurred bloom view to a texture
                GL_ActiveTexture(0);
-               qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.realheight - (r_view_y + bloomheight), bloomwidth, bloomheight);
+               qglCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r_view_x, vid.height - (r_view_y + bloomheight), bloomwidth, bloomheight);
                c_bloomcopies++;
                c_bloomcopypixels += bloomwidth * bloomheight;
                // go back to full view area
-               qglViewport(r_view_x, vid.realheight - (r_view_y + r_view_height), r_view_width, r_view_height);
+               qglViewport(r_view_x, vid.height - (r_view_y + r_view_height), r_view_width, r_view_height);
                // put the original screen image back in place and blend the bloom
                // texture on it
                memset(&m, 0, sizeof(m));
@@ -1022,11 +1022,11 @@ void R_RenderView(void)
        if (!r_refdef.entities/* || !r_refdef.worldmodel*/)
                return; //Host_Error ("R_RenderView: NULL worldmodel");
 
-       r_view_width = bound(0, r_refdef.width, vid.realwidth);
-       r_view_height = bound(0, r_refdef.height, vid.realheight);
+       r_view_width = bound(0, r_refdef.width, vid.width);
+       r_view_height = bound(0, r_refdef.height, vid.height);
        r_view_depth = 1;
-       r_view_x = bound(0, r_refdef.x, vid.realwidth - r_refdef.width);
-       r_view_y = bound(0, r_refdef.y, vid.realheight - r_refdef.height);
+       r_view_x = bound(0, r_refdef.x, vid.width - r_refdef.width);
+       r_view_y = bound(0, r_refdef.y, vid.height - r_refdef.height);
        r_view_z = 0;
        r_view_fov_x = bound(1, r_refdef.fov_x, 170);
        r_view_fov_y = bound(1, r_refdef.fov_y, 170);
@@ -1039,7 +1039,7 @@ void R_RenderView(void)
        r_lightmapintensity = r_rtworld ? r_shadow_realtime_world_lightmaps.value : 1;
 
        // GL is weird because it's bottom to top, r_view_y is top to bottom
-       qglViewport(r_view_x, vid.realheight - (r_view_y + r_view_height), r_view_width, r_view_height);
+       qglViewport(r_view_x, vid.height - (r_view_y + r_view_height), r_view_width, r_view_height);
        GL_Scissor(r_view_x, r_view_y, r_view_width, r_view_height);
        GL_ScissorTest(true);
        GL_DepthMask(true);
@@ -1061,7 +1061,7 @@ void R_RenderView(void)
        R_BlendView();
        R_TimeReport("blendview");
 
-       GL_Scissor(0, 0, vid.realwidth, vid.realheight);
+       GL_Scissor(0, 0, vid.width, vid.height);
        GL_ScissorTest(false);
 }
 
diff --git a/keys.c b/keys.c
index ffaabf8e9bf1d527ad6b247ab757f45a1f8224d1..74ef648a291ef2ca284ed815a695f146e44a2572 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -414,15 +414,15 @@ Key_Console (int key, char ascii)
 
        if (key == K_PGUP || key == K_KP_PGUP || key == K_MWHEELUP)
        {
-               con_backscroll += ((int) vid.conheight >> 5);
-               if (con_backscroll > con_totallines - (vid.conheight>>3) - 1)
-                       con_backscroll = con_totallines - (vid.conheight>>3) - 1;
+               con_backscroll += ((int) vid_conheight.integer >> 5);
+               if (con_backscroll > con_totallines - (vid_conheight.integer>>3) - 1)
+                       con_backscroll = con_totallines - (vid_conheight.integer>>3) - 1;
                return;
        }
 
        if (key == K_PGDN || key == K_KP_PGDN || key == K_MWHEELDOWN)
        {
-               con_backscroll -= ((int) vid.conheight >> 5);
+               con_backscroll -= ((int) vid_conheight.integer >> 5);
                if (con_backscroll < 0)
                        con_backscroll = 0;
                return;
@@ -430,7 +430,7 @@ Key_Console (int key, char ascii)
 
        if (key == K_HOME || key == K_KP_HOME)
        {
-               con_backscroll = con_totallines - (vid.conheight>>3) - 1;
+               con_backscroll = con_totallines - (vid_conheight.integer>>3) - 1;
                return;
        }
 
diff --git a/menu.c b/menu.c
index a83f1a1fc2b45118c620755a59d87e55b73b5ef7..130d5bdf1e5f72961f70fc6fca8bdc604b4e787b 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -163,12 +163,12 @@ float menu_x, menu_y, menu_width, menu_height;
 
 void M_Background(int width, int height)
 {
-       menu_width = bound(1, width, vid.conwidth);
-       menu_height = bound(1, height, vid.conheight);
-       menu_x = (vid.conwidth - menu_width) * 0.5;
-       menu_y = (vid.conheight - menu_height) * 0.5;
+       menu_width = bound(1, width, vid_conwidth.integer);
+       menu_height = bound(1, height, vid_conheight.integer);
+       menu_x = (vid_conwidth.integer - menu_width) * 0.5;
+       menu_y = (vid_conheight.integer - menu_height) * 0.5;
        //DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0);
-       DrawQ_Fill(0, 0, vid.conwidth, vid.conheight, 0, 0, 0, 0.5, 0);
+       DrawQ_Fill(0, 0, vid_conwidth.integer, vid_conheight.integer, 0, 0, 0, 0.5, 0);
 }
 
 /*
@@ -1645,7 +1645,7 @@ void M_Options_Draw (void)
        int visible;
        cachepic_t      *p;
 
-       M_Background(320, bound(200, 32 + OPTIONS_ITEMS * 8, vid.conheight));
+       M_Background(320, bound(200, 32 + OPTIONS_ITEMS * 8, vid_conheight.integer));
 
        M_DrawPic(16, 4, "gfx/qplaque.lmp");
        p = Draw_CachePic("gfx/p_option.lmp", false);
@@ -1844,7 +1844,7 @@ void M_Options_Effects_Draw (void)
        int visible;
        cachepic_t      *p;
 
-       M_Background(320, bound(200, 32 + OPTIONS_EFFECTS_ITEMS * 8, vid.conheight));
+       M_Background(320, bound(200, 32 + OPTIONS_EFFECTS_ITEMS * 8, vid_conheight.integer));
 
        M_DrawPic(16, 4, "gfx/qplaque.lmp");
        p = Draw_CachePic("gfx/p_option.lmp", false);
@@ -1983,7 +1983,7 @@ void M_Options_Graphics_Draw (void)
        int visible;
        cachepic_t      *p;
 
-       M_Background(320, bound(200, 32 + OPTIONS_GRAPHICS_ITEMS * 8, vid.conheight));
+       M_Background(320, bound(200, 32 + OPTIONS_GRAPHICS_ITEMS * 8, vid_conheight.integer));
 
        M_DrawPic(16, 4, "gfx/qplaque.lmp");
        p = Draw_CachePic("gfx/p_option.lmp", false);
@@ -2198,8 +2198,8 @@ void M_Options_ColorControl_Draw (void)
 
        opty += 4;
        DrawQ_Fill(menu_x, menu_y + opty, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);opty += 4;
-       s = (float) 312 / 2 * vid.realwidth / vid.conwidth;
-       t = (float) 4 / 2 * vid.realheight / vid.conheight;
+       s = (float) 312 / 2 * vid.width / vid_conwidth.integer;
+       t = (float) 4 / 2 * vid.height / vid_conheight.integer;
        DrawQ_SuperPic(menu_x + 4, menu_y + opty, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0);opty += 4;
        DrawQ_SuperPic(menu_x + 4, menu_y + opty, NULL                                , 312, 4, 0,0, 0,0,0,1, 1,0, 1,0,0,1, 0,1, 0,0,0,1, 1,1, 1,0,0,1, 0);opty += 4;
        DrawQ_SuperPic(menu_x + 4, menu_y + opty, "gfx/colorcontrol/ditherpattern.tga", 312, 4, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0);opty += 4;
@@ -2210,8 +2210,8 @@ void M_Options_ColorControl_Draw (void)
        DrawQ_SuperPic(menu_x + 4, menu_y + opty, NULL                                , 312, 4, 0,0, 0,0,0,1, 1,0, 1,1,1,1, 0,1, 0,0,0,1, 1,1, 1,1,1,1, 0);opty += 4;
 
        c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
-       s = (float) 48 / 2 * vid.realwidth / vid.conwidth;
-       t = (float) 48 / 2 * vid.realheight / vid.conheight;
+       s = (float) 48 / 2 * vid.width / vid_conwidth.integer;
+       t = (float) 48 / 2 * vid.height / vid_conheight.integer;
        u = s * 0.5;
        v = t * 0.5;
        opty += 8;
@@ -2729,11 +2729,6 @@ unsigned short video_resolutions[][2] = {{320,240}, {400,300}, {512,384}, {640,4
 #define VID_RES_COUNT ((int)(sizeof(video_resolutions) / sizeof(video_resolutions[0])) - 1)
 int video_resolution;
 
-extern int current_vid_fullscreen;
-extern int current_vid_width;
-extern int current_vid_height;
-extern int current_vid_bitsperpixel;
-
 
 void M_Menu_Video_f (void)
 {
@@ -2744,8 +2739,8 @@ void M_Menu_Video_f (void)
        // Look for the current resolution
        for (video_resolution = 0; video_resolution < VID_RES_COUNT; video_resolution++)
        {
-               if (video_resolutions[video_resolution][0] == current_vid_width &&
-                       video_resolutions[video_resolution][1] == current_vid_height)
+               if (video_resolutions[video_resolution][0] == vid.width &&
+                       video_resolutions[video_resolution][1] == vid.height)
                        break;
        }
 
@@ -2839,10 +2834,10 @@ void M_Video_Key (int key, char ascii)
        {
                case K_ESCAPE:
                        // vid_shared.c has a copy of the current video config. We restore it
-                       Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen);
-                       Cvar_SetValueQuick(&vid_width, current_vid_width);
-                       Cvar_SetValueQuick(&vid_height, current_vid_height);
-                       Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
+                       Cvar_SetValueQuick(&vid_fullscreen, vid.fullscreen);
+                       Cvar_SetValueQuick(&vid_width, vid.width);
+                       Cvar_SetValueQuick(&vid_height, vid.height);
+                       Cvar_SetValueQuick(&vid_bitsperpixel, vid.bitsperpixel);
 
                        S_LocalSound ("sound/misc/menu1.wav");
                        M_Menu_Options_f ();
@@ -4167,9 +4162,9 @@ void M_ServerList_Draw (void)
 
        // use as much vertical space as available
        if (gamemode == GAME_TRANSFUSION)
-               M_Background(640, vid.conheight - 80);
+               M_Background(640, vid_conheight.integer - 80);
        else
-               M_Background(640, vid.conheight);
+               M_Background(640, vid_conheight.integer);
        // scroll the list as the cursor moves
        s = va("%i/%i masters %i/%i servers", masterreplycount, masterquerycount, serverreplycount, serverquerycount);
        M_PrintRed((640 - strlen(s) * 8) / 2, 32, s);
@@ -4439,13 +4434,13 @@ void M_Draw (void)
                        cachepic_t      *p;
                        int g, scale_x, scale_y, scale_y_repeat, top_offset;
                        float scale_y_rate;
-                       scale_y_repeat = vid.conheight * 2;
+                       scale_y_repeat = vid_conheight.integer * 2;
                        g = (int)(realtime * 64)%96;
                        scale_y_rate = (float)(g+1) / 96;
                        top_offset = (g+12)/12;
                        p = Draw_CachePic (va("gfx/blooddrip%i", top_offset), false);
-                       for (scale_x = 0; scale_x <= vid.conwidth; scale_x += p->width) {
-                               for (scale_y = -scale_y_repeat; scale_y <= vid.conheight; scale_y += scale_y_repeat) {
+                       for (scale_x = 0; scale_x <= vid_conwidth.integer; scale_x += p->width) {
+                               for (scale_y = -scale_y_repeat; scale_y <= vid_conheight.integer; scale_y += scale_y_repeat) {
                                        DrawQ_Pic (scale_x + 21, scale_y_repeat * .5 + scale_y + scale_y_rate * scale_y_repeat, "gfx/blooddrop3", 0, 0, 1, 1, 1, 1, 0);
                                        DrawQ_Pic (scale_x +  116, scale_y_repeat + scale_y + scale_y_rate * scale_y_repeat, "gfx/blooddrop1", 0, 0, 1, 1, 1, 1, 0);
                                        DrawQ_Pic (scale_x + 180, scale_y_repeat * .275 + scale_y + scale_y_rate * scale_y_repeat, "gfx/blooddrop3", 0, 0, 1, 1, 1, 1, 0);
index b09b92a2b5df1bb56bd50c73772f6b098a39a25b..1e82ccbb870c88fb83a02242d4d6a4ae92558f81 100644 (file)
@@ -2241,8 +2241,8 @@ void VM_getmousepos(void)
 
        VM_SAFEPARMCOUNT(0,VM_getmousepos);
 
-       PRVM_G_VECTOR(OFS_RETURN)[0] = in_mouse_x * vid.conwidth / vid.realwidth;
-       PRVM_G_VECTOR(OFS_RETURN)[1] = in_mouse_y * vid.conheight / vid.realheight;
+       PRVM_G_VECTOR(OFS_RETURN)[0] = in_mouse_x * vid_conwidth.integer / vid.width;
+       PRVM_G_VECTOR(OFS_RETURN)[1] = in_mouse_y * vid_conheight.integer / vid.height;
        PRVM_G_VECTOR(OFS_RETURN)[2] = 0;
 }
 
@@ -2789,10 +2789,10 @@ void VM_drawsetcliparea(void)
        float x,y,w,h;
        VM_SAFEPARMCOUNT(4,VM_drawsetcliparea);
 
-       x = bound(0, PRVM_G_FLOAT(OFS_PARM0), vid.conwidth);
-       y = bound(0, PRVM_G_FLOAT(OFS_PARM1), vid.conheight);
-       w = bound(0, PRVM_G_FLOAT(OFS_PARM2) + PRVM_G_FLOAT(OFS_PARM0) - x, (vid.conwidth  - x));
-       h = bound(0, PRVM_G_FLOAT(OFS_PARM3) + PRVM_G_FLOAT(OFS_PARM1) - y, (vid.conheight - y));
+       x = bound(0, PRVM_G_FLOAT(OFS_PARM0), vid_conwidth.integer);
+       y = bound(0, PRVM_G_FLOAT(OFS_PARM1), vid_conheight.integer);
+       w = bound(0, PRVM_G_FLOAT(OFS_PARM2) + PRVM_G_FLOAT(OFS_PARM0) - x, (vid_conwidth.integer  - x));
+       h = bound(0, PRVM_G_FLOAT(OFS_PARM3) + PRVM_G_FLOAT(OFS_PARM1) - y, (vid_conheight.integer - y));
 
        DrawQ_SetClipArea(x, y, w, h);
 }
index 1af462721a73e0e2a233e909c8dc358dd36b57ce..a6dca4b20bb3b90efd1e4c435a7cf3df15d0d1d8 100644 (file)
@@ -111,7 +111,7 @@ void R_Draw2DCrosshair(void)
        if (pic)
        {
                R_GetCrosshairColor(color);
-               DrawQ_Pic((vid.conwidth - pic->width * crosshair_size.value) * 0.5f, (vid.conheight - pic->height * crosshair_size.value) * 0.5f, pic->name, pic->width * crosshair_size.value, pic->height * crosshair_size.value, color[0], color[1], color[2], color[3], 0);
+               DrawQ_Pic((vid_conwidth.integer - pic->width * crosshair_size.value) * 0.5f, (vid_conheight.integer - pic->height * crosshair_size.value) * 0.5f, pic->name, pic->width * crosshair_size.value, pic->height * crosshair_size.value, color[0], color[1], color[2], color[3], 0);
        }
 }
 
index 45de930d4cb99fd54ab88c156f260de0fd0deda3..9603b03cfb3e114034f60fbb88491ac22ada5034 100644 (file)
@@ -1368,7 +1368,7 @@ qboolean R_Shadow_ScissorForBBox(const float *mins, const float *maxs)
                return true;
 
        // the light area is visible, set up the scissor rectangle
-       GL_Scissor(ix1, vid.realheight - iy2, ix2 - ix1, iy2 - iy1);
+       GL_Scissor(ix1, vid.height - iy2, ix2 - ix1, iy2 - iy1);
        //qglScissor(ix1, iy1, ix2 - ix1, iy2 - iy1);
        //qglEnable(GL_SCISSOR_TEST);
        c_rt_scissored++;
diff --git a/sbar.c b/sbar.c
index 6855471b2dc3be260ffd883ed8302742d76464d3..0aedcd9cbbd7882e0bd92af339fae3f503f4b8e0 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -533,11 +533,11 @@ static void Sbar_DrawWeapon(int nr, float fade, int active)
        const int w_width = 300, w_height = 100, w_space = 10;
        const float w_scale = 0.4;
 
-       DrawQ_Pic(vid.conwidth - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, sb_weapons[0][nr]->name, w_width * w_scale, w_height * w_scale, (active) ? 1 : 0.6, active ? 1 : 0.6, active ? 1 : 1, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
-       //DrawQ_String(vid.conwidth - (w_space + font_size ), (w_height + w_space) * w_scale * nr + w_space, va("%i",nr+1), 0, font_size, font_size, 1, 0, 0, fade, 0);
+       DrawQ_Pic(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, sb_weapons[0][nr]->name, w_width * w_scale, w_height * w_scale, (active) ? 1 : 0.6, active ? 1 : 0.6, active ? 1 : 1, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
+       //DrawQ_String(vid_conwidth.integer - (w_space + font_size ), (w_height + w_space) * w_scale * nr + w_space, va("%i",nr+1), 0, font_size, font_size, 1, 0, 0, fade, 0);
 
        if (active)
-               DrawQ_Fill(vid.conwidth - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, w_width * w_scale, w_height * w_scale, 0.3, 0.3, 0.3, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
+               DrawQ_Fill(vid_conwidth.integer - (w_width + w_space) * w_scale, (w_height + w_space) * w_scale * nr + w_space, w_width * w_scale, w_height * w_scale, 0.3, 0.3, 0.3, fade * sbar_alpha_fg.value, DRAWFLAG_ADDITIVE);
 }
 
 /*
@@ -760,9 +760,9 @@ void Sbar_DrawFace (void)
                // draw background
                Sbar_DrawPic (112, 0, rsb_teambord);
                c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8];
-               DrawQ_Fill (sbar_x + 113, vid.conheight-SBAR_HEIGHT+3, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
+               DrawQ_Fill (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+3, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
                c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8];
-               DrawQ_Fill (sbar_x + 113, vid.conheight-SBAR_HEIGHT+12, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
+               DrawQ_Fill (sbar_x + 113, vid_conheight.integer-SBAR_HEIGHT+12, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f) * sbar_alpha_fg.value, 0);
 
                // draw number
                f = s->frags;
@@ -867,26 +867,26 @@ void Sbar_ShowFPS(void)
                fps_scalex = 12;
                fps_scaley = 12;
                fps_height = fps_scaley * ((fpsstring[0] != 0) + (timestring[0] != 0) + (datestring[0] != 0));
-               //fps_y = vid.conheight - sb_lines; // yes this may draw over the sbar
-               //fps_y = bound(0, fps_y, vid.conheight - fps_height);
-               fps_y = vid.conheight - fps_height;
+               //fps_y = vid_conheight.integer - sb_lines; // yes this may draw over the sbar
+               //fps_y = bound(0, fps_y, vid_conheight.integer - fps_height);
+               fps_y = vid_conheight.integer - fps_height;
                if (fpsstring[0])
                {
-                       fps_x = vid.conwidth - fps_scalex * strlen(fpsstring);
+                       fps_x = vid_conwidth.integer - fps_scalex * strlen(fpsstring);
                        DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(fpsstring), fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
                        fps_y += fps_scaley;
                }
                if (timestring[0])
                {
-                       fps_x = vid.conwidth - fps_scalex * strlen(timestring);
+                       fps_x = vid_conwidth.integer - fps_scalex * strlen(timestring);
                        DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(timestring), fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String(fps_x, fps_y, timestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
                        fps_y += fps_scaley;
                }
                if (datestring[0])
                {
-                       fps_x = vid.conwidth - fps_scalex * strlen(datestring);
+                       fps_x = vid_conwidth.integer - fps_scalex * strlen(datestring);
                        DrawQ_Fill(fps_x, fps_y, fps_scalex * strlen(datestring), fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String(fps_x, fps_y, datestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0);
                        fps_y += fps_scaley;
@@ -920,7 +920,7 @@ void Sbar_Draw (void)
                {
                        // this is the top left of the sbar area
                        sbar_x = 0;
-                       sbar_y = vid.conheight - 24*3;
+                       sbar_y = vid_conheight.integer - 24*3;
 
                        // armor
                        if (cl.stats[STAT_ARMOR])
@@ -954,8 +954,8 @@ void Sbar_Draw (void)
        }
        else if (gamemode == GAME_NEXUIZ)
        {
-               sbar_y = vid.conheight - 47;
-               sbar_x = (vid.conwidth - 640)/2;
+               sbar_y = vid_conheight.integer - 47;
+               sbar_x = (vid_conwidth.integer - 640)/2;
 
                if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
                {
@@ -1032,16 +1032,16 @@ void Sbar_Draw (void)
                                DrawQ_Pic(sbar_x,sbar_y,sb_sbar_overlay->name,0,0,1,1,1,1,DRAWFLAG_MODULATE);
                }
 
-               //if (vid.conwidth > 320 && cl.gametype == GAME_DEATHMATCH)
+               //if (vid_conwidth.integer > 320 && cl.gametype == GAME_DEATHMATCH)
                //      Sbar_MiniDeathmatchOverlay (0, 17);
        }
        else // Quake and others
        {
-               sbar_y = vid.conheight - SBAR_HEIGHT;
+               sbar_y = vid_conheight.integer - SBAR_HEIGHT;
                if (cl.gametype == GAME_DEATHMATCH && gamemode != GAME_TRANSFUSION)
                        sbar_x = 0;
                else
-                       sbar_x = (vid.conwidth - 320)/2;
+                       sbar_x = (vid_conwidth.integer - 320)/2;
 
                if (sb_lines > 24)
                {
@@ -1143,12 +1143,12 @@ void Sbar_Draw (void)
 
                }
 
-               if (vid.conwidth > 320 && cl.gametype == GAME_DEATHMATCH)
+               if (vid_conwidth.integer > 320 && cl.gametype == GAME_DEATHMATCH)
                {
                        if (gamemode == GAME_TRANSFUSION)
                                Sbar_MiniDeathmatchOverlay (0, 0);
                        else
-                               Sbar_MiniDeathmatchOverlay (324, vid.conheight - sb_lines);
+                               Sbar_MiniDeathmatchOverlay (324, vid_conheight.integer - sb_lines);
                }
        }
 
@@ -1157,7 +1157,7 @@ void Sbar_Draw (void)
        R_Draw2DCrosshair();
 
        if (cl_prydoncursor.integer)
-               DrawQ_Pic((cl.cmd.cursor_screen[0] + 1) * 0.5 * vid.conwidth, (cl.cmd.cursor_screen[1] + 1) * 0.5 * vid.conheight, va("gfx/prydoncursor%03i", cl_prydoncursor.integer), 0, 0, 1, 1, 1, 1, 0);
+               DrawQ_Pic((cl.cmd.cursor_screen[0] + 1) * 0.5 * vid_conwidth.integer, (cl.cmd.cursor_screen[1] + 1) * 0.5 * vid_conheight.integer, va("gfx/prydoncursor%03i", cl_prydoncursor.integer), 0, 0, 1, 1, 1, 1, 0);
 }
 
 //=============================================================================
@@ -1187,14 +1187,14 @@ void Sbar_DeathmatchOverlay (void)
        cachepic_t *pic;
 
        pic = Draw_CachePic ("gfx/ranking", true);
-       DrawQ_Pic ((vid.conwidth - pic->width)/2, 8, "gfx/ranking", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+       DrawQ_Pic ((vid_conwidth.integer - pic->width)/2, 8, "gfx/ranking", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
 
        // scores
        Sbar_SortFrags ();
        // draw the text
-       x = (vid.conwidth - (6 + 15) * 8) / 2;
+       x = (vid_conwidth.integer - (6 + 15) * 8) / 2;
        y = 40;
-       for (i = 0;i < scoreboardlines && y < vid.conheight;i++)
+       for (i = 0;i < scoreboardlines && y < vid_conheight.integer;i++)
                y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
 }
 
@@ -1210,12 +1210,12 @@ void Sbar_MiniDeathmatchOverlay (int x, int y)
 
        // decide where to print
        if (gamemode == GAME_TRANSFUSION)
-               numlines = (vid.conwidth - x + 127) / 128;
+               numlines = (vid_conwidth.integer - x + 127) / 128;
        else
-               numlines = (vid.conheight - y + 7) / 8;
+               numlines = (vid_conheight.integer - y + 7) / 8;
 
        // give up if there isn't room
-       if (x >= vid.conwidth || y >= vid.conheight || numlines < 1)
+       if (x >= vid_conwidth.integer || y >= vid_conheight.integer || numlines < 1)
                return;
 
        // scores
@@ -1233,12 +1233,12 @@ void Sbar_MiniDeathmatchOverlay (int x, int y)
 
        if (gamemode == GAME_TRANSFUSION)
        {
-               for (;i < scoreboardlines && x < vid.conwidth;i++)
+               for (;i < scoreboardlines && x < vid_conwidth.integer;i++)
                        x += 128 + Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
        }
        else
        {
-               for (;i < scoreboardlines && y < vid.conheight;i++)
+               for (;i < scoreboardlines && y < vid_conheight.integer;i++)
                        y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
        }
 }
@@ -1260,8 +1260,8 @@ void Sbar_IntermissionOverlay (void)
                return;
        }
 
-       sbar_x = (vid.conwidth - 320) >> 1;
-       sbar_y = (vid.conheight - 200) >> 1;
+       sbar_x = (vid_conwidth.integer - 320) >> 1;
+       sbar_y = (vid_conheight.integer - 200) >> 1;
 
        DrawQ_Pic (sbar_x + 64, sbar_y + 24, "gfx/complete", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
        DrawQ_Pic (sbar_x + 0, sbar_y + 56, "gfx/inter", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
@@ -1299,6 +1299,6 @@ void Sbar_FinaleOverlay (void)
        cachepic_t      *pic;
 
        pic = Draw_CachePic ("gfx/finale", true);
-       DrawQ_Pic((vid.conwidth - pic->width)/2, 16, "gfx/finale", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
+       DrawQ_Pic((vid_conwidth.integer - pic->width)/2, 16, "gfx/finale", 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
 }
 
diff --git a/vid.h b/vid.h
index e8cb35a544de77efe6442778049e9634e0d17fe0..48fc9602d7089281ea495b3408ca89074cf7d607 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -26,14 +26,11 @@ extern int cl_available;
 
 typedef struct
 {
-       // these are set with VID_GetWindowSize and can change from frame to frame
-       int realx;
-       int realy;
-       int realwidth;
-       int realheight;
-
-       int conwidth;
-       int conheight;
+       // these are set by VID_Mode
+       int width;
+       int height;
+       int bitsperpixel;
+       int fullscreen;
 } viddef_t;
 
 // global video state
@@ -134,8 +131,6 @@ int VID_GetGamma (unsigned short *ramps);
 void VID_UpdateGamma(qboolean force);
 void VID_RestoreSystemGamma(void);
 
-void VID_GetWindowSize (int *x, int *y, int *width, int *height);
-
 void VID_Finish (void);
 
 void VID_Restart_f(void);
index 64fa66c7191bad153529ba154d1b9c2282153a9f..b5646101d425bb830d01eb6410e3d3057896897b 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -103,8 +103,6 @@ qboolean vidmode_ext = false;
 
 static int win_x, win_y;
 
-static int scr_width, scr_height;
-
 static XF86VidModeModeInfo **vidmodes;
 static int num_vidmodes;
 static qboolean vid_isfullscreen = false;
@@ -276,7 +274,7 @@ static void IN_Activate (qboolean grab)
                                        // unable to query, probably not supported
                                        Con_Print( "Failed to detect XF86DGA Mouse\n" );
                                        Cvar_SetValueQuick(&vid_dga, 0);
-                                       XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, scr_width / 2, scr_height / 2);
+                                       XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, vid.width / 2, vid.height / 2);
                                }
                                else
                                {
@@ -286,7 +284,7 @@ static void IN_Activate (qboolean grab)
                        }
                        else
 #endif
-                               XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, scr_width / 2, scr_height / 2);
+                               XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, vid.width / 2, vid.height / 2);
 
                        XGrabKeyboard(vidx11_display, win, False, GrabModeAsync, GrabModeAsync, CurrentTime);
 
@@ -363,7 +361,7 @@ static void HandleEvents(void)
                                        {
                                                mouse_x += event.xmotion.x - p_mouse_x;
                                                mouse_y += event.xmotion.y - p_mouse_y;
-                                               if (abs(scr_width/2 - event.xmotion.x) > scr_width / 4 || abs(scr_height/2 - event.xmotion.y) > scr_height / 4)
+                                               if (abs(vid.width/2 - event.xmotion.x) > vid.width / 4 || abs(vid.height/2 - event.xmotion.y) > vid.height / 4)
                                                        dowarp = true;
                                        }
                                        p_mouse_x = event.xmotion.x;
@@ -519,8 +517,8 @@ static void HandleEvents(void)
        if (dowarp)
        {
                /* move the mouse to the window center again */
-               p_mouse_x = scr_width / 2;
-               p_mouse_y = scr_height / 2;
+               p_mouse_x = vid.width / 2;
+               p_mouse_y = vid.height / 2;
                XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, p_mouse_x, p_mouse_y);
        }
 }
@@ -611,18 +609,6 @@ void InitSig(void)
        signal(SIGTERM, signal_handler);
 }
 
-/*
-=================
-VID_GetWindowSize
-=================
-*/
-void VID_GetWindowSize (int *x, int *y, int *width, int *height)
-{
-       *x = *y = 0;
-       *width = scr_width;
-       *height = scr_height;
-}
-
 void VID_Finish (void)
 {
        vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable;
@@ -850,9 +836,6 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp)
 
        XSync(vidx11_display, False);
 
-       scr_width = width;
-       scr_height = height;
-
        if ((qglGetString = GL_GetProcAddress("glGetString")) == NULL)
                Sys_Error("glGetString not found in %s", gl_driver);
 
index a4c2f46b32d2e92a0c7a1f798fac0d341a0d4e44..2ce3321c7bbc916be3f19a3d7c849e8da5937f81 100644 (file)
@@ -49,13 +49,6 @@ void InitSig(void)
 #endif
 }
 
-void VID_GetWindowSize (int *x, int *y, int *width, int *height)
-{
-       *x = *y = 0;
-       *width = 1;
-       *height = 1;
-}
-
 void VID_Finish (void)
 {
 }
index 42dbd46a83736164bb5aa0b805796b18ad8bc10f..241255a0db73435b3ada4412314d8f5c89dad28a 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -460,13 +460,6 @@ int VID_GetGamma (unsigned short *ramps)
        return !SDL_GetGammaRamp( ramps, ramps + 256, ramps + 512);
 }
 
-void VID_GetWindowSize (int *x, int *y, int *width, int *height)
-{
-       *x = *y = 0;
-       *width = screen->w;
-       *height = screen->h;
-}
-
 void VID_Finish (void)
 {
        Uint8 appstate;
index 6488195178c413a1bad4603eaab6dca52ffcff62..31b9f93798d994fd482bbbab2703fc2c57575f9b 100644 (file)
@@ -887,19 +887,15 @@ void VID_Shared_Init(void)
                Cvar_Set("gl_combine", "0");
 }
 
-int current_vid_fullscreen;
-int current_vid_width;
-int current_vid_height;
-int current_vid_bitsperpixel;
 int VID_Mode(int fullscreen, int width, int height, int bpp)
 {
        Con_Printf("Video: %s %dx%dx%d\n", fullscreen ? "fullscreen" : "window", width, height, bpp);
        if (VID_InitMode(fullscreen, width, height, bpp))
        {
-               current_vid_fullscreen = fullscreen;
-               current_vid_width = width;
-               current_vid_height = height;
-               current_vid_bitsperpixel = bpp;
+               vid.fullscreen = fullscreen;
+               vid.width = width;
+               vid.height = height;
+               vid.bitsperpixel = bpp;
                Cvar_SetValueQuick(&vid_fullscreen, fullscreen);
                Cvar_SetValueQuick(&vid_width, width);
                Cvar_SetValueQuick(&vid_height, height);
@@ -931,14 +927,14 @@ void VID_Restart_f(void)
                return;
 
        Con_Printf("VID_Restart: changing from %s %dx%dx%dbpp, to %s %dx%dx%dbpp.\n",
-               current_vid_fullscreen ? "fullscreen" : "window", current_vid_width, current_vid_height, current_vid_bitsperpixel,
+               vid.fullscreen ? "fullscreen" : "window", vid.width, vid.height, vid.bitsperpixel,
                vid_fullscreen.integer ? "fullscreen" : "window", vid_width.integer, vid_height.integer, vid_bitsperpixel.integer);
        VID_CloseSystems();
        VID_Shutdown();
        if (!VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer))
        {
                Con_Print("Video mode change failed\n");
-               if (!VID_Mode(current_vid_fullscreen, current_vid_width, current_vid_height, current_vid_bitsperpixel))
+               if (!VID_Mode(vid.fullscreen, vid.width, vid.height, vid.bitsperpixel))
                        Sys_Error("Unable to restore to last working video mode\n");
        }
        VID_OpenSystems();
index d4412c32cfef9933231636ee5896d087132412d4..11eea0e26b890a9a54a7751134116f72c03d2725 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -102,8 +102,7 @@ static qboolean vid_isfullscreen;
 
 //====================================
 
-static int window_x, window_y, window_width, window_height;
-static int window_center_x, window_center_y;
+static int window_x, window_y;
 
 static void IN_Activate (qboolean grab);
 
@@ -256,44 +255,9 @@ static void Joy_AdvancedUpdate_f (void);
 static void IN_JoyMove (void);
 static void IN_StartupMouse (void);
 
-/*
-================
-VID_UpdateWindowStatus
-================
-*/
-static void VID_UpdateWindowStatus (void)
-{
-       window_center_x = window_x + window_width / 2;
-       window_center_y = window_y + window_height / 2;
-
-       if (mouseinitialized && vid_usingmouse && !dinput_acquired)
-       {
-               RECT window_rect;
-               window_rect.left = window_x;
-               window_rect.top = window_y;
-               window_rect.right = window_x + window_width;
-               window_rect.bottom = window_y + window_height;
-               ClipCursor (&window_rect);
-       }
-}
-
 
 //====================================
 
-/*
-=================
-VID_GetWindowSize
-=================
-*/
-void VID_GetWindowSize (int *x, int *y, int *width, int *height)
-{
-       *x = 0;
-       *y = 0;
-       *width = window_width;
-       *height = window_height;
-}
-
-
 void VID_Finish (void)
 {
        vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable;
@@ -527,7 +491,7 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
                case WM_MOVE:
                        window_x = (int) LOWORD(lParam);
                        window_y = (int) HIWORD(lParam);
-                       VID_UpdateWindowStatus ();
+                       IN_Activate(false);
                        break;
 
                case WM_KEYDOWN:
@@ -855,8 +819,6 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp)
        // x and y may be changed by WM_MOVE messages
        window_x = CenterX;
        window_y = CenterY;
-       window_width = width;
-       window_height = height;
        rect.left += CenterX;
        rect.right += CenterX;
        rect.top += CenterY;
@@ -878,8 +840,6 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp)
        ShowWindow (mainwindow, SW_SHOWDEFAULT);
        UpdateWindow (mainwindow);
 
-       VID_UpdateWindowStatus ();
-
        // now we try to make sure we get the focus on the mode switch, because
        // sometimes in some systems we don't.  We grab the foreground, then
        // finish setting up, pump all our messages, and sleep for a little while
@@ -1015,12 +975,6 @@ void VID_Shutdown (void)
        vid_isfullscreen = false;
 }
 
-
-/*
-===========
-IN_Activate
-===========
-*/
 static void IN_Activate (qboolean grab)
 {
        if (!mouseinitialized)
@@ -1042,11 +996,11 @@ static void IN_Activate (qboolean grab)
                                RECT window_rect;
                                window_rect.left = window_x;
                                window_rect.top = window_y;
-                               window_rect.right = window_x + window_width;
-                               window_rect.bottom = window_y + window_height;
+                               window_rect.right = window_x + vid.width;
+                               window_rect.bottom = window_y + vid.height;
                                if (mouseparmsvalid)
                                        restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0);
-                               SetCursorPos (window_center_x, window_center_y);
+                               SetCursorPos ((window_x + vid.width / 2), (window_y + vid.height / 2));
                                SetCapture (mainwindow);
                                ClipCursor (&window_rect);
                        }
@@ -1306,15 +1260,15 @@ static void IN_MouseMove (void)
        else
        {
                GetCursorPos (&current_pos);
-               mx = current_pos.x - window_center_x;
-               my = current_pos.y - window_center_y;
+               mx = current_pos.x - (window_x + vid.width / 2);
+               my = current_pos.y - (window_y + vid.height / 2);
 
                in_mouse_x = mx;
                in_mouse_y = my;
 
                // if the mouse has moved, force it to the center, so there's room to move
                if (mx || my)
-                       SetCursorPos (window_center_x, window_center_y);
+                       SetCursorPos ((window_x + vid.width / 2), (window_y + vid.height / 2));
        }
 }