more screen size cleanup

This commit is contained in:
Bill Currie 2009-12-22 13:12:03 +00:00 committed by Jeff Teunissen
parent 0647a156e3
commit 28601c8ea4
12 changed files with 38 additions and 56 deletions

View file

@ -783,9 +783,9 @@ Draw_FadeScreen (void)
qfglBegin (GL_QUADS);
qfglVertex2f (0, 0);
qfglVertex2f (vid.width, 0);
qfglVertex2f (vid.width, vid.height);
qfglVertex2f (0, vid.height);
qfglVertex2f (vid.conwidth, 0);
qfglVertex2f (vid.conwidth, vid.conheight);
qfglVertex2f (0, vid.conheight);
qfglEnd ();
qfglColor3ubv (color_white);
@ -806,7 +806,7 @@ GL_Set2D (void)
qfglMatrixMode (GL_PROJECTION);
qfglLoadIdentity ();
qfglOrtho (0, vid.width, vid.height, 0, -99999, 99999);
qfglOrtho (0, vid.conwidth, vid.conheight, 0, -99999, 99999);
qfglMatrixMode (GL_MODELVIEW);
qfglLoadIdentity ();

View file

@ -205,7 +205,7 @@ Draw_Character (int x, int y, unsigned int chr)
if (y <= -8)
return; // totally off screen
if (y > (int) vid.height - 8 || x < 0 || x > (int) vid.width - 8)
if (y > (int) vid.conheight - 8 || x < 0 || x > (int) vid.conwidth - 8)
return;
if (chr < 0 || chr > 255)
return;
@ -360,8 +360,8 @@ Draw_Pic (int x, int y, qpic_t *pic)
byte *dest, *source, tbyte;
int v, u;
if (x < 0 || (unsigned int) (x + pic->width) > vid.width || y < 0 ||
(unsigned int) (y + pic->height) > vid.height) {
if (x < 0 || (unsigned int) (x + pic->width) > vid.conwidth || y < 0 ||
(unsigned int) (y + pic->height) > vid.conheight) {
Sys_Error ("Draw_Pic: bad coordinates");
}
@ -412,8 +412,8 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
byte *dest, *source, tbyte;
int u, v;
if ((x < 0) || (x + width > (int) vid.width)
|| (y < 0) || (y + height > (int) vid.height)) {
if ((x < 0) || (x + width > (int) vid.conwidth)
|| (y < 0) || (y + height > (int) vid.conheight)) {
Sys_Error ("Draw_SubPic: bad coordinates");
}
@ -606,8 +606,8 @@ Draw_Fill (int x, int y, int w, int h, int c)
byte *dest;
int u, v;
if (x < 0 || x + w > (int) vid.width
|| y < 0 || y + h > (int) vid.height) {
if (x < 0 || x + w > (int) vid.conwidth
|| y < 0 || y + h > (int) vid.conheight) {
Sys_Printf ("Bad Draw_Fill(%d, %d, %d, %d, %c)\n", x, y, w, h, c);
return;
}
@ -629,13 +629,13 @@ Draw_FadeScreen (void)
S_ExtraUpdate ();
VID_LockBuffer ();
for (y = 0; y < vid.height; y++) {
for (y = 0; y < vid.conheight; y++) {
unsigned int t;
pbuf = ((byte *)vid.buffer) + vid.rowbytes * y;
t = (y & 1) << 1;
for (x = 0; x < vid.width; x++) {
for (x = 0; x < vid.conwidth; x++) {
if ((x & 3) != t)
pbuf[x] = 0;
}

View file

@ -204,7 +204,7 @@ Draw_Character (int x, int y, unsigned int chr)
if (y <= -8)
return; // totally off screen
if (y > (int) vid.height - 8 || x < 0 || x > (int) vid.width - 8)
if (y > (int) vid.conheight - 8 || x < 0 || x > (int) vid.conwidth - 8)
return;
if (chr < 0 || chr > 255)
return;
@ -433,8 +433,8 @@ Draw_Pic (int x, int y, qpic_t *pic)
byte *source, tbyte;
int v, u;
if (x < 0 || (unsigned int) (x + pic->width) > vid.width || y < 0 ||
(unsigned int) (y + pic->height) > vid.height) {
if (x < 0 || (unsigned int) (x + pic->width) > vid.conwidth || y < 0 ||
(unsigned int) (y + pic->height) > vid.conheight) {
Sys_Error ("Draw_Pic: bad coordinates");
}
@ -525,8 +525,8 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
byte *source, tbyte;
int v, u;
if ((x < 0) || (x + width > (int) vid.width)
|| (y < 0) || (y + height > (int) vid.height)) {
if ((x < 0) || (x + width > (int) vid.conwidth)
|| (y < 0) || (y + height > (int) vid.conheight)) {
Sys_Error ("Draw_SubPic: bad coordinates");
}
@ -1018,8 +1018,8 @@ Draw_Fill (int x, int y, int w, int h, int c)
{
int u, v;
if (x < 0 || x + w > (int) vid.width
|| y < 0 || y + h > (int) vid.height) {
if (x < 0 || x + w > (int) vid.conwidth
|| y < 0 || y + h > (int) vid.conheight) {
Sys_Printf ("Bad Draw_Fill(%d, %d, %d, %d, %c)\n", x, y, w, h, c);
return;
}
@ -1071,12 +1071,12 @@ Draw_FadeScreen (void)
switch(r_pixbytes) {
case 1:
{
for (y = 0; y < vid.height; y++) {
for (y = 0; y < vid.conheight; y++) {
unsigned int t;
byte *pbuf = (byte *) ((byte *) vid.buffer + vid.rowbytes * y);
t = (y & 1) << 1;
for (x = 0; x < vid.width; x++) {
for (x = 0; x < vid.conwidth; x++) {
if ((x & 3) != t)
pbuf[x] = 0;
}
@ -1085,21 +1085,21 @@ Draw_FadeScreen (void)
break;
case 2:
{
for (y = 0; y < vid.height; y++) {
for (y = 0; y < vid.conheight; y++) {
unsigned short *pbuf = (unsigned short *)
((byte *) vid.buffer + vid.rowbytes * y);
pbuf = (unsigned short *) vid.buffer + (vid.rowbytes >> 1) * y;
for (x = 0; x < vid.width; x++)
for (x = 0; x < vid.conwidth; x++)
pbuf[x] = (pbuf[x] >>= 1) & 0x7BEF;
}
}
break;
case 4:
{
for (y = 0; y < vid.height; y++) {
for (y = 0; y < vid.conheight; y++) {
unsigned int *pbuf = (unsigned int *)
((byte *) vid.buffer + vid.rowbytes * y);
for (x = 0; x < vid.width; x++)
for (x = 0; x < vid.conwidth; x++)
pbuf[x] = (pbuf[x] >>= 1) & 0x7F7F7F7F;
}
}

View file

@ -304,10 +304,6 @@ VID_Init (unsigned char *palette)
attribs[4] = 1;
attribs[5] = FXMESA_NONE;
vid.width = vid.conwidth = min (vid.conwidth, (unsigned int) scr_width);
vid.height = vid.conheight = min (vid.conheight,
(unsigned int) scr_height);
Con_CheckResize (); // Now that we have a window size, fix console
fc = qf_fxMesaCreateContext (0, findres (&scr_width, &scr_height),

View file

@ -44,6 +44,10 @@ VID_InitBuffers (void)
{
int buffersize, zbuffersize, cachesize = 1;
// No console scaling in the sw renderer
vid.conwidth = vid.width;
vid.conheight = vid.height;
// Calculate the sizes we want first
buffersize = vid.rowbytes * vid.height;
zbuffersize = vid.width * vid.height * sizeof (*vid.zbuffer);

View file

@ -208,6 +208,10 @@ VID_InitBuffers (void)
{
int buffersize, zbuffersize, cachesize = 1;
// No console scaling in the sw renderer
vid.conwidth = vid.width;
vid.conheight = vid.height;
// Calculate the sizes we want first
buffersize = vid.rowbytes * vid.height;
zbuffersize = vid.width * vid.height * sizeof (*vid.zbuffer);

View file

@ -208,10 +208,6 @@ VID_Init (unsigned char *palette)
vid.colormap8 = vid_colormap;
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));
vid.height = vid.conheight = min (vid.conheight,
(unsigned int) scr_height);
vid.width = vid.conwidth = min (vid.conwidth, (unsigned int) scr_width);
Con_CheckResize (); // Now that we have a window size, fix console
X11_OpenDisplay ();

View file

@ -108,8 +108,8 @@ VID_Init (unsigned char *palette)
VID_SetPalette (vid.palette);
// now know everything we need to know about the buffer
VGA_width = vid.conwidth = vid.width;
VGA_height = vid.conheight = vid.height;
VGA_width = vid.width;
VGA_height = vid.height;
Con_CheckResize (); // Now that we have a window size, fix console
vid.numpages = 1;
vid.colormap8 = vid_colormap;

View file

@ -149,8 +149,8 @@ VID_Init (unsigned char *palette)
}
// now we know everything we need to know about the buffer
VGA_width = vid.conwidth = vid.width;
VGA_height = vid.conheight = vid.height;
VGA_width = vid.width;
VGA_height = vid.height;
Con_CheckResize (); // Now that we have a window size, fix console
vid.numpages = 1;
if (vid_colormap)

View file

@ -117,17 +117,6 @@ VID_Init (unsigned char *palette)
vid.colormap8 = vid_colormap;
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));
vid.conwidth &= 0xfff8; // make it a multiple of eight
if (vid.conwidth < 320)
vid.conwidth = 320;
// pick a conheight that matches with correct aspect
vid.conheight = (vid.conwidth * 3) / 4;
i = COM_CheckParm ("-conheight");
if (i != 0) // Set console height, no smaller than 200
vid.conheight = max (atoi (com_argv[i + 1]), 200);
// Check if we want fullscreen
if (vid_fullscreen->int_val) {
flags |= SDL_FULLSCREEN;
@ -176,9 +165,6 @@ VID_Init (unsigned char *palette)
SDL_Quit ();
success:
vid.height = vid.conheight = min (vid.conheight,
(unsigned int) scr_height);
vid.width = vid.conwidth = min (vid.conwidth, (unsigned int) scr_width);
Con_CheckResize (); // Now that we have a window size, fix console
vid.numpages = 2;

View file

@ -307,8 +307,6 @@ VID_SetMode (int modenum, unsigned char *palette)
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;
// alloc screen buffer, z-buffer, and surface cache

View file

@ -383,8 +383,6 @@ x11_init_buffers (void)
}
vid.conbuffer = vid.buffer;
vid.conwidth = vid.width;
vid.conheight = vid.height;
vid.conrowbytes = vid.rowbytes;
Con_CheckResize (); // Now that we have a window size, fix console
}