progress in cleaning up the screen size mess

This commit is contained in:
Bill Currie 2009-12-22 06:02:53 +00:00 committed by Jeff Teunissen
parent 4a7b8f8246
commit 5d15c70a0d
13 changed files with 24 additions and 50 deletions

View file

@ -189,7 +189,7 @@ Resize (old_console_t *con)
char tbuf[CON_TEXTSIZE];
int width, oldwidth, oldtotallines, numlines, numchars, i, j;
width = (vid.width >> 3) - 2;
width = (vid.conwidth >> 3) - 2;
if (width < 1) { // video hasn't been initialized yet
width = 38;
@ -673,7 +673,7 @@ draw_console (view_t *view)
if (con_data.force_commandline) {
alpha = 255;
} else {
float y = vid.height * con_size->value;
float y = vid.conheight * con_size->value;
alpha = 255 * con_alpha->value * view->ylen / y;
alpha = min (alpha, 255);
}
@ -736,9 +736,9 @@ setup_console (void)
float lines;
if (con_data.force_commandline) {
lines = con_data.lines = vid.height;
lines = con_data.lines = vid.conheight;
} else if (key_dest == key_console) {
lines = vid.height * bound (0.2, con_size->value, 1);
lines = vid.conheight * bound (0.2, con_size->value, 1);
} else {
lines = 0;
}
@ -750,7 +750,7 @@ setup_console (void)
con_data.lines += max (0.2, con_speed->value) * *con_data.frametime;
con_data.lines = min (con_data.lines, lines);
}
if (con_data.lines >= vid.height - r_lineadj)
if (con_data.lines >= vid.conheight - r_lineadj)
scr_copyeverything = 1;
}

View file

@ -113,6 +113,8 @@ VID_GetWindowSize (int def_w, int def_h)
scr_width = vid.width = vid_width->int_val;
scr_height = vid.height = vid_height->int_val;
vid.aspect = (4.0 * vid.height) / (3.0 * vid.width);
con_width = Cvar_Get ("con_width", va ("%d", scr_width), CVAR_NONE, NULL,
"console effective width (GL only)");
if ((pnum = COM_CheckParm ("-conwidth"))) {

View file

@ -304,18 +304,6 @@ VID_Init (unsigned char *palette)
attribs[4] = 1;
attribs[5] = FXMESA_NONE;
vid.conwidth &= 0xfff8; // make it a multiple of eight
vid.conwidth = max (vid.conwidth, 320);
// pick a conheight that matches with correct aspect
vid.conheight = (vid.conwidth * 3) / 4;
if ((i = COM_CheckParm ("-conheight")) != 0)
vid.conheight = atoi (com_argv[i + 1]);
vid.conheight = max (vid.conheight, 200);
vid.width = vid.conwidth = min (vid.conwidth, (unsigned int) scr_width);
vid.height = vid.conheight = min (vid.conheight,
(unsigned int) scr_height);
@ -329,7 +317,6 @@ VID_Init (unsigned char *palette)
qf_fxMesaMakeCurrent (fc);
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
vid.numpages = 2;
vid_gamma_avail = 1;

View file

@ -306,12 +306,9 @@ VID_SetMode (const char *name, unsigned char *palette)
vid.width = vmode->xres;
vid.height = vmode->yres;
vid.rowbytes = vmode->xres * (vmode->depth >> 3);
vid.aspect = ((float) vid.height / (float) vid.width) * (4.0 / 3.0);
vid.colormap8 = (byte *) vid_colormap;
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));
vid.conrowbytes = vid.rowbytes;
vid.conwidth = vid.width;
vid.conheight = vid.height;
vid.numpages = 1;
if (fb_map_addr) {

View file

@ -177,7 +177,6 @@ VID_Center_f (void)
void
VID_Init (unsigned char *palette)
{
int i;
int attrib[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
@ -209,10 +208,6 @@ VID_Init (unsigned char *palette)
vid.colormap8 = vid_colormap;
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));
if ((i = COM_CheckParm ("-conheight"))) // conheight no smaller than 200p
vid.conheight = atoi (com_argv[i + 1]);
vid.conheight = max (vid.conheight, 200);
vid.height = vid.conheight = min (vid.conheight,
(unsigned int) scr_height);
vid.width = vid.conwidth = min (vid.conwidth, (unsigned int) scr_width);
@ -237,7 +232,6 @@ VID_Init (unsigned char *palette)
qfglXMakeCurrent (x_disp, x_win, ctx);
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
vid.numpages = 2;
GL_Init ();

View file

@ -111,7 +111,6 @@ VID_Init (unsigned char *palette)
VGA_width = vid.conwidth = vid.width;
VGA_height = vid.conheight = vid.height;
Con_CheckResize (); // Now that we have a window size, fix console
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
vid.numpages = 1;
vid.colormap8 = vid_colormap;
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));

View file

@ -152,7 +152,6 @@ VID_Init (unsigned char *palette)
VGA_width = vid.conwidth = vid.width;
VGA_height = vid.conheight = vid.height;
Con_CheckResize (); // Now that we have a window size, fix console
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
vid.numpages = 1;
if (vid_colormap)
VID_MakeColormaps(256 - vid_colormap[16384], vid.palette);

View file

@ -181,7 +181,6 @@ success:
vid.width = vid.conwidth = min (vid.conwidth, (unsigned int) scr_width);
Con_CheckResize (); // Now that we have a window size, fix console
vid.aspect = ((float) vid.height / (float) vid.width) * (4.0 / 3.0);
vid.numpages = 2;
GL_Init ();

View file

@ -304,7 +304,6 @@ VID_SetMode (int modenum, unsigned char *palette)
vid.rowbytes = modes[current_mode].linewidth * 4;
}
vid.aspect = ((float) vid.height / (float) vid.width) * (4.0 / 3.0);
vid.colormap8 = (byte *) vid_colormap;
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));
vid.conrowbytes = vid.rowbytes;

View file

@ -387,8 +387,6 @@ x11_init_buffers (void)
vid.conheight = vid.height;
vid.conrowbytes = vid.rowbytes;
Con_CheckResize (); // Now that we have a window size, fix console
vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0);
}
static void

View file

@ -1009,7 +1009,7 @@ Sbar_Draw (void)
if ((sb_updates >= vid.numpages) && !headsup)
return;
if (con_module && con_module->data->console->lines == vid.height)
if (con_module && con_module->data->console->lines == vid.conheight)
return; // console is full screen
if (cls.state == ca_active
@ -1325,8 +1325,8 @@ init_sbar_views (void)
view->draw = draw_status;
view_add (sbar_view, view);
if (vid.width > 320) {
int l = (vid.width - 320) / 2;
if (vid.conwidth > 320) {
int l = (vid.conwidth - 320) / 2;
view = view_new (-l, 0, l, 48, grav_southwest);
view->draw = draw_tile;
@ -1431,8 +1431,8 @@ init_hipnotic_sbar_views (void)
view->draw = draw_hipnotic_status;
view_add (sbar_view, view);
if (vid.width > 320) {
int l = (vid.width - 320) / 2;
if (vid.conwidth > 320) {
int l = (vid.conwidth - 320) / 2;
view = view_new (-l, 0, l, 48, grav_southwest);
view->draw = draw_tile;
@ -1538,8 +1538,8 @@ init_rogue_sbar_views (void)
view->draw = draw_rogue_status;
view_add (sbar_view, view);
if (vid.width > 320) {
int l = (vid.width - 320) / 2;
if (vid.conwidth > 320) {
int l = (vid.conwidth - 320) / 2;
view = view_new (-l, 0, l, 48, grav_southwest);
view->draw = draw_tile;

View file

@ -59,8 +59,8 @@ CL_NetGraph (void)
if (!r_netgraph->int_val)
return;
x = hudswap ? vid.width - (NET_TIMINGS + 16): 0;
y = vid.height - sb_lines - 24 - r_graphheight->int_val - 1;
x = hudswap ? vid.conwidth - (NET_TIMINGS + 16): 0;
y = vid.conheight - sb_lines - 24 - r_graphheight->int_val - 1;
h = r_graphheight->int_val % 8;
@ -69,8 +69,8 @@ CL_NetGraph (void)
r_netgraph_alpha->value * 255);
lost = CL_CalcNet ();
x = hudswap ? vid.width - (NET_TIMINGS + 8) : 8;
y = vid.height - sb_lines - 9;
x = hudswap ? vid.conwidth - (NET_TIMINGS + 8) : 8;
y = vid.conheight - sb_lines - 9;
l = NET_TIMINGS;
if (l > r_refdef.vrect.width - 8)
@ -85,10 +85,10 @@ CL_NetGraph (void)
}
R_LineGraph (x, y, &packet_latency[a], l);
y = vid.height - sb_lines - 24 - r_graphheight->int_val + 7;
y = vid.conheight - sb_lines - 24 - r_graphheight->int_val + 7;
snprintf (st, sizeof (st), "%3i%% packet loss", lost);
if (hudswap) {
Draw_String (vid.width - ((strlen (st) * 8) + 8), y, st);
Draw_String (vid.conwidth - ((strlen (st) * 8) + 8), y, st);
} else {
Draw_String (8, y, st);
}

View file

@ -961,7 +961,7 @@ Sbar_Draw (void)
if ((sb_updates >= vid.numpages) && !headsup)
return;
if (con_module && con_module->data->console->lines == vid.height)
if (con_module && con_module->data->console->lines == vid.conheight)
return;
if (cls.state == ca_active
@ -1436,7 +1436,7 @@ Sbar_DeathmatchOverlay (view_t *view, int start)
int l, y;
int skip = 10;
if (vid.width < 244) // FIXME: magic number, gained through experimentation
if (vid.conwidth < 244) // FIXME: magic number, gained through experimentation
return;
if (largegame)
@ -1850,8 +1850,8 @@ init_sbar_views (void)
if (miniteam_view)
view_add (sbar_view, miniteam_view);
if (vid.width > 640) {
int l = (vid.width - 640) / 2;
if (vid.conwidth > 640) {
int l = (vid.conwidth - 640) / 2;
view = view_new (-l, 0, l, 48, grav_southwest);
view->draw = draw_tile;