{
// 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)
{
/*
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;
}
*/
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)
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);
}
// 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
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);
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;
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;
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)
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);
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;
/*
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)
{
}
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;
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;
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);
{
float conwidth, conheight;
- VID_GetWindowSize (&vid.realx, &vid.realy, &vid.realwidth, &vid.realheight);
-
VID_UpdateGamma(false);
conwidth = bound(320, vid_conwidth.value, 2048);
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();
}
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)
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;
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;
// 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;
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
}
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)
{
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;
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;
}
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);
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);
}
}
- 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);
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 != ' ')
{
{
// 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);
// 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);
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);
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
}
// 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
}
// 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));
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);
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);
R_BlendView();
R_TimeReport("blendview");
- GL_Scissor(0, 0, vid.realwidth, vid.realheight);
+ GL_Scissor(0, 0, vid.width, vid.height);
GL_ScissorTest(false);
}
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;
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;
}
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);
}
/*
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);
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);
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);
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;
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;
#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)
{
// 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;
}
{
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 ();
// 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);
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);
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;
}
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);
}
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);
}
}
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++;
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);
}
/*
// 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;
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;
{
// 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])
}
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)
{
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)
{
}
- 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);
}
}
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);
}
//=============================================================================
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);
}
// 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
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);
}
}
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);
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);
}
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
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);
static int win_x, win_y;
-static int scr_width, scr_height;
-
static XF86VidModeModeInfo **vidmodes;
static int num_vidmodes;
static qboolean vid_isfullscreen = false;
// 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
{
}
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);
{
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;
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);
}
}
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;
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);
#endif
}
-void VID_GetWindowSize (int *x, int *y, int *width, int *height)
-{
- *x = *y = 0;
- *width = 1;
- *height = 1;
-}
-
void VID_Finish (void)
{
}
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;
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);
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();
//====================================
-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);
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;
case WM_MOVE:
window_x = (int) LOWORD(lParam);
window_y = (int) HIWORD(lParam);
- VID_UpdateWindowStatus ();
+ IN_Activate(false);
break;
case WM_KEYDOWN:
// 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;
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
vid_isfullscreen = false;
}
-
-/*
-===========
-IN_Activate
-===========
-*/
static void IN_Activate (qboolean grab)
{
if (!mouseinitialized)
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);
}
else
{
GetCursorPos (¤t_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));
}
}