mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
nuke scr_width and scr_height
This commit is contained in:
parent
a2fa2d425b
commit
f2004abecc
8 changed files with 24 additions and 25 deletions
|
@ -85,7 +85,6 @@ extern viddef_t vid; // global video state
|
||||||
extern unsigned short d_8to16table[256];
|
extern unsigned short d_8to16table[256];
|
||||||
extern unsigned int d_8to24table[256];
|
extern unsigned int d_8to24table[256];
|
||||||
|
|
||||||
extern int scr_width, scr_height;
|
|
||||||
extern byte gammatable[256];
|
extern byte gammatable[256];
|
||||||
extern struct cvar_s *vid_gamma;
|
extern struct cvar_s *vid_gamma;
|
||||||
extern qboolean vid_gamma_avail;
|
extern qboolean vid_gamma_avail;
|
||||||
|
|
|
@ -322,7 +322,8 @@ check_mouse_event (Display *disp, XEvent *ev, XPointer arg)
|
||||||
XMotionEvent *me = &ev->xmotion;
|
XMotionEvent *me = &ev->xmotion;
|
||||||
if (ev->type != MotionNotify)
|
if (ev->type != MotionNotify)
|
||||||
return False;
|
return False;
|
||||||
if (me->x != scr_width / 2 || me->y != scr_height / 2)
|
if ((unsigned) me->x != vid.width / 2
|
||||||
|
|| (unsigned) me->y != vid.height / 2)
|
||||||
return False;
|
return False;
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
@ -333,8 +334,8 @@ X11_SetMouse (void)
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, 0, 0);
|
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, 0, 0);
|
||||||
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, scr_width / 2,
|
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0,
|
||||||
scr_height / 2);
|
vid.width / 2, vid.height / 2);
|
||||||
XPeekIfEvent (x_disp, &ev, check_mouse_event, 0);
|
XPeekIfEvent (x_disp, &ev, check_mouse_event, 0);
|
||||||
x_mouse_time = ev.xmotion.time;
|
x_mouse_time = ev.xmotion.time;
|
||||||
}
|
}
|
||||||
|
@ -418,8 +419,8 @@ X11_SetVidMode (int width, int height)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nummodes; i++) {
|
for (i = 0; i < nummodes; i++) {
|
||||||
if ((vidmodes[i]->hdisplay == scr_width) &&
|
if ((vidmodes[i]->hdisplay == vid.width) &&
|
||||||
(vidmodes[i]->vdisplay == scr_height)) {
|
(vidmodes[i]->vdisplay == vid.height)) {
|
||||||
found_mode = true;
|
found_mode = true;
|
||||||
best_mode = i;
|
best_mode = i;
|
||||||
break;
|
break;
|
||||||
|
@ -427,8 +428,8 @@ X11_SetVidMode (int width, int height)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found_mode) {
|
if (found_mode) {
|
||||||
Sys_DPrintf ("VID: Chose video mode: %dx%d\n", scr_width,
|
Sys_DPrintf ("VID: Chose video mode: %dx%d\n",
|
||||||
scr_height);
|
vid.width, vid.height);
|
||||||
|
|
||||||
XF86VidModeSwitchToMode (x_disp, x_screen,
|
XF86VidModeSwitchToMode (x_disp, x_screen,
|
||||||
vidmodes[best_mode]);
|
vidmodes[best_mode]);
|
||||||
|
@ -436,7 +437,7 @@ X11_SetVidMode (int width, int height)
|
||||||
X11_SetScreenSaver ();
|
X11_SetScreenSaver ();
|
||||||
} else {
|
} else {
|
||||||
Sys_Printf ("VID: Mode %dx%d can't go fullscreen.\n",
|
Sys_Printf ("VID: Mode %dx%d can't go fullscreen.\n",
|
||||||
scr_width, scr_height);
|
vid.width, vid.height);
|
||||||
vidmode_avail = vidmode_active = false;
|
vidmode_avail = vidmode_active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,7 +466,7 @@ X11_UpdateFullscreen (cvar_t *fullscreen)
|
||||||
window_y = pos_y;
|
window_y = pos_y;
|
||||||
window_saved = 1;
|
window_saved = 1;
|
||||||
|
|
||||||
X11_SetVidMode (scr_width, scr_height);
|
X11_SetVidMode (vid.width, vid.height);
|
||||||
|
|
||||||
if (!vidmode_active) {
|
if (!vidmode_active) {
|
||||||
window_saved = 0;
|
window_saved = 0;
|
||||||
|
|
|
@ -59,7 +59,6 @@ qboolean vid_gamma_avail; // hardware gamma availability
|
||||||
VISIBLE unsigned int d_8to24table[256];
|
VISIBLE unsigned int d_8to24table[256];
|
||||||
|
|
||||||
/* Screen size */
|
/* Screen size */
|
||||||
int scr_width, scr_height;
|
|
||||||
cvar_t *vid_width;
|
cvar_t *vid_width;
|
||||||
cvar_t *vid_height;
|
cvar_t *vid_height;
|
||||||
|
|
||||||
|
@ -110,12 +109,12 @@ VID_GetWindowSize (int def_w, int def_h)
|
||||||
Cvar_SetFlags (vid_width, vid_width->flags | CVAR_ROM);
|
Cvar_SetFlags (vid_width, vid_width->flags | CVAR_ROM);
|
||||||
Cvar_SetFlags (vid_height, vid_height->flags | CVAR_ROM);
|
Cvar_SetFlags (vid_height, vid_height->flags | CVAR_ROM);
|
||||||
|
|
||||||
scr_width = vid.width = vid_width->int_val;
|
vid.width = vid_width->int_val;
|
||||||
scr_height = vid.height = vid_height->int_val;
|
vid.height = vid_height->int_val;
|
||||||
|
|
||||||
vid.aspect = (4.0 * vid.height) / (3.0 * vid.width);
|
vid.aspect = (4.0 * vid.height) / (3.0 * vid.width);
|
||||||
|
|
||||||
con_width = Cvar_Get ("con_width", va ("%d", scr_width), CVAR_NONE, NULL,
|
con_width = Cvar_Get ("con_width", va ("%d", vid.width), CVAR_NONE, NULL,
|
||||||
"console effective width (GL only)");
|
"console effective width (GL only)");
|
||||||
if ((pnum = COM_CheckParm ("-conwidth"))) {
|
if ((pnum = COM_CheckParm ("-conwidth"))) {
|
||||||
if (pnum >= com_argc - 1)
|
if (pnum >= com_argc - 1)
|
||||||
|
|
|
@ -306,7 +306,7 @@ VID_Init (unsigned char *palette)
|
||||||
|
|
||||||
Con_CheckResize (); // Now that we have a window size, fix console
|
Con_CheckResize (); // Now that we have a window size, fix console
|
||||||
|
|
||||||
fc = qf_fxMesaCreateContext (0, findres (&scr_width, &scr_height),
|
fc = qf_fxMesaCreateContext (0, findres (&vid.width, &vid.height),
|
||||||
GR_REFRESH_75Hz, attribs);
|
GR_REFRESH_75Hz, attribs);
|
||||||
if (!fc)
|
if (!fc)
|
||||||
Sys_Error ("Unable to create 3DFX context.");
|
Sys_Error ("Unable to create 3DFX context.");
|
||||||
|
@ -327,7 +327,7 @@ VID_Init (unsigned char *palette)
|
||||||
|
|
||||||
vid.initialized = true;
|
vid.initialized = true;
|
||||||
|
|
||||||
Sys_DPrintf ("Video mode %dx%d initialized.\n", scr_width, scr_height);
|
Sys_DPrintf ("Video mode %dx%d initialized.\n", vid.width, vid.height);
|
||||||
|
|
||||||
vid.recalc_refdef = 1; // force a surface cache flush
|
vid.recalc_refdef = 1; // force a surface cache flush
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,8 +617,8 @@ VISIBLE void
|
||||||
GL_BeginRendering (int *x, int *y, int *width, int *height)
|
GL_BeginRendering (int *x, int *y, int *width, int *height)
|
||||||
{
|
{
|
||||||
*x = *y = 0;
|
*x = *y = 0;
|
||||||
*width = scr_width;
|
*width = vid.width;
|
||||||
*height = scr_height;
|
*height = vid.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
VISIBLE qboolean
|
VISIBLE qboolean
|
||||||
|
|
|
@ -410,8 +410,8 @@ VID_Init (unsigned char *palette)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (COM_CheckParm ("-novideo")) {
|
if (COM_CheckParm ("-novideo")) {
|
||||||
scr_width = vid.width = 320;
|
vid.width = 320;
|
||||||
scr_height = vid.height = 200;
|
vid.height = 200;
|
||||||
vid.rowbytes = 320;
|
vid.rowbytes = 320;
|
||||||
vid.aspect = ((float) vid.height / (float) vid.width) * (4.0 / 3.0);
|
vid.aspect = ((float) vid.height / (float) vid.width) * (4.0 / 3.0);
|
||||||
vid.colormap8 = (byte *) vid_colormap;
|
vid.colormap8 = (byte *) vid_colormap;
|
||||||
|
|
|
@ -218,8 +218,8 @@ VID_Init (unsigned char *palette)
|
||||||
}
|
}
|
||||||
x_vis = x_visinfo->visual;
|
x_vis = x_visinfo->visual;
|
||||||
|
|
||||||
X11_SetVidMode (scr_width, scr_height);
|
X11_SetVidMode (vid.width, vid.height);
|
||||||
X11_CreateWindow (scr_width, scr_height);
|
X11_CreateWindow (vid.width, vid.height);
|
||||||
X11_CreateNullCursor (); // hide mouse pointer
|
X11_CreateNullCursor (); // hide mouse pointer
|
||||||
|
|
||||||
XSync (x_disp, 0);
|
XSync (x_disp, 0);
|
||||||
|
@ -238,7 +238,7 @@ VID_Init (unsigned char *palette)
|
||||||
VID_Init8bitPalette ();
|
VID_Init8bitPalette ();
|
||||||
VID_SetPalette (vid.palette);
|
VID_SetPalette (vid.palette);
|
||||||
|
|
||||||
Sys_DPrintf ("Video mode %dx%d initialized.\n", scr_width, scr_height);
|
Sys_DPrintf ("Video mode %dx%d initialized.\n", vid.width, vid.height);
|
||||||
|
|
||||||
vid.initialized = true;
|
vid.initialized = true;
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ VID_Init (unsigned char *palette)
|
||||||
for (j = 0; j < 5; j++) {
|
for (j = 0; j < 5; j++) {
|
||||||
for (k = 32; k >= 16; k -= 8) {
|
for (k = 32; k >= 16; k -= 8) {
|
||||||
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, k);
|
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, k);
|
||||||
if ((screen = SDL_SetVideoMode (scr_width, scr_height,
|
if ((screen = SDL_SetVideoMode (vid.width, vid.height,
|
||||||
color[j], flags)))
|
color[j], flags)))
|
||||||
goto success;
|
goto success;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ success:
|
||||||
VID_SetPalette (vid.palette);
|
VID_SetPalette (vid.palette);
|
||||||
VID_Init8bitPalette (); // Check for 3DFX Extensions and initialize them.
|
VID_Init8bitPalette (); // Check for 3DFX Extensions and initialize them.
|
||||||
|
|
||||||
Sys_DPrintf ("Video mode %dx%d initialized.\n", scr_width, scr_height);
|
Sys_DPrintf ("Video mode %dx%d initialized.\n", vid.width, vid.height);
|
||||||
|
|
||||||
vid.initialized = true;
|
vid.initialized = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue