mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
more screen size cleanup
This commit is contained in:
parent
0647a156e3
commit
28601c8ea4
12 changed files with 38 additions and 56 deletions
|
@ -783,9 +783,9 @@ Draw_FadeScreen (void)
|
||||||
qfglBegin (GL_QUADS);
|
qfglBegin (GL_QUADS);
|
||||||
|
|
||||||
qfglVertex2f (0, 0);
|
qfglVertex2f (0, 0);
|
||||||
qfglVertex2f (vid.width, 0);
|
qfglVertex2f (vid.conwidth, 0);
|
||||||
qfglVertex2f (vid.width, vid.height);
|
qfglVertex2f (vid.conwidth, vid.conheight);
|
||||||
qfglVertex2f (0, vid.height);
|
qfglVertex2f (0, vid.conheight);
|
||||||
|
|
||||||
qfglEnd ();
|
qfglEnd ();
|
||||||
qfglColor3ubv (color_white);
|
qfglColor3ubv (color_white);
|
||||||
|
@ -806,7 +806,7 @@ GL_Set2D (void)
|
||||||
|
|
||||||
qfglMatrixMode (GL_PROJECTION);
|
qfglMatrixMode (GL_PROJECTION);
|
||||||
qfglLoadIdentity ();
|
qfglLoadIdentity ();
|
||||||
qfglOrtho (0, vid.width, vid.height, 0, -99999, 99999);
|
qfglOrtho (0, vid.conwidth, vid.conheight, 0, -99999, 99999);
|
||||||
|
|
||||||
qfglMatrixMode (GL_MODELVIEW);
|
qfglMatrixMode (GL_MODELVIEW);
|
||||||
qfglLoadIdentity ();
|
qfglLoadIdentity ();
|
||||||
|
|
|
@ -205,7 +205,7 @@ Draw_Character (int x, int y, unsigned int chr)
|
||||||
if (y <= -8)
|
if (y <= -8)
|
||||||
return; // totally off screen
|
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;
|
return;
|
||||||
if (chr < 0 || chr > 255)
|
if (chr < 0 || chr > 255)
|
||||||
return;
|
return;
|
||||||
|
@ -360,8 +360,8 @@ Draw_Pic (int x, int y, qpic_t *pic)
|
||||||
byte *dest, *source, tbyte;
|
byte *dest, *source, tbyte;
|
||||||
int v, u;
|
int v, u;
|
||||||
|
|
||||||
if (x < 0 || (unsigned int) (x + pic->width) > vid.width || y < 0 ||
|
if (x < 0 || (unsigned int) (x + pic->width) > vid.conwidth || y < 0 ||
|
||||||
(unsigned int) (y + pic->height) > vid.height) {
|
(unsigned int) (y + pic->height) > vid.conheight) {
|
||||||
Sys_Error ("Draw_Pic: bad coordinates");
|
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;
|
byte *dest, *source, tbyte;
|
||||||
int u, v;
|
int u, v;
|
||||||
|
|
||||||
if ((x < 0) || (x + width > (int) vid.width)
|
if ((x < 0) || (x + width > (int) vid.conwidth)
|
||||||
|| (y < 0) || (y + height > (int) vid.height)) {
|
|| (y < 0) || (y + height > (int) vid.conheight)) {
|
||||||
Sys_Error ("Draw_SubPic: bad coordinates");
|
Sys_Error ("Draw_SubPic: bad coordinates");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,8 +606,8 @@ Draw_Fill (int x, int y, int w, int h, int c)
|
||||||
byte *dest;
|
byte *dest;
|
||||||
int u, v;
|
int u, v;
|
||||||
|
|
||||||
if (x < 0 || x + w > (int) vid.width
|
if (x < 0 || x + w > (int) vid.conwidth
|
||||||
|| y < 0 || y + h > (int) vid.height) {
|
|| y < 0 || y + h > (int) vid.conheight) {
|
||||||
Sys_Printf ("Bad Draw_Fill(%d, %d, %d, %d, %c)\n", x, y, w, h, c);
|
Sys_Printf ("Bad Draw_Fill(%d, %d, %d, %d, %c)\n", x, y, w, h, c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -629,13 +629,13 @@ Draw_FadeScreen (void)
|
||||||
S_ExtraUpdate ();
|
S_ExtraUpdate ();
|
||||||
VID_LockBuffer ();
|
VID_LockBuffer ();
|
||||||
|
|
||||||
for (y = 0; y < vid.height; y++) {
|
for (y = 0; y < vid.conheight; y++) {
|
||||||
unsigned int t;
|
unsigned int t;
|
||||||
|
|
||||||
pbuf = ((byte *)vid.buffer) + vid.rowbytes * y;
|
pbuf = ((byte *)vid.buffer) + vid.rowbytes * y;
|
||||||
t = (y & 1) << 1;
|
t = (y & 1) << 1;
|
||||||
|
|
||||||
for (x = 0; x < vid.width; x++) {
|
for (x = 0; x < vid.conwidth; x++) {
|
||||||
if ((x & 3) != t)
|
if ((x & 3) != t)
|
||||||
pbuf[x] = 0;
|
pbuf[x] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ Draw_Character (int x, int y, unsigned int chr)
|
||||||
if (y <= -8)
|
if (y <= -8)
|
||||||
return; // totally off screen
|
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;
|
return;
|
||||||
if (chr < 0 || chr > 255)
|
if (chr < 0 || chr > 255)
|
||||||
return;
|
return;
|
||||||
|
@ -433,8 +433,8 @@ Draw_Pic (int x, int y, qpic_t *pic)
|
||||||
byte *source, tbyte;
|
byte *source, tbyte;
|
||||||
int v, u;
|
int v, u;
|
||||||
|
|
||||||
if (x < 0 || (unsigned int) (x + pic->width) > vid.width || y < 0 ||
|
if (x < 0 || (unsigned int) (x + pic->width) > vid.conwidth || y < 0 ||
|
||||||
(unsigned int) (y + pic->height) > vid.height) {
|
(unsigned int) (y + pic->height) > vid.conheight) {
|
||||||
Sys_Error ("Draw_Pic: bad coordinates");
|
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;
|
byte *source, tbyte;
|
||||||
int v, u;
|
int v, u;
|
||||||
|
|
||||||
if ((x < 0) || (x + width > (int) vid.width)
|
if ((x < 0) || (x + width > (int) vid.conwidth)
|
||||||
|| (y < 0) || (y + height > (int) vid.height)) {
|
|| (y < 0) || (y + height > (int) vid.conheight)) {
|
||||||
Sys_Error ("Draw_SubPic: bad coordinates");
|
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;
|
int u, v;
|
||||||
|
|
||||||
if (x < 0 || x + w > (int) vid.width
|
if (x < 0 || x + w > (int) vid.conwidth
|
||||||
|| y < 0 || y + h > (int) vid.height) {
|
|| y < 0 || y + h > (int) vid.conheight) {
|
||||||
Sys_Printf ("Bad Draw_Fill(%d, %d, %d, %d, %c)\n", x, y, w, h, c);
|
Sys_Printf ("Bad Draw_Fill(%d, %d, %d, %d, %c)\n", x, y, w, h, c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1071,12 +1071,12 @@ Draw_FadeScreen (void)
|
||||||
switch(r_pixbytes) {
|
switch(r_pixbytes) {
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
for (y = 0; y < vid.height; y++) {
|
for (y = 0; y < vid.conheight; y++) {
|
||||||
unsigned int t;
|
unsigned int t;
|
||||||
byte *pbuf = (byte *) ((byte *) vid.buffer + vid.rowbytes * y);
|
byte *pbuf = (byte *) ((byte *) vid.buffer + vid.rowbytes * y);
|
||||||
t = (y & 1) << 1;
|
t = (y & 1) << 1;
|
||||||
|
|
||||||
for (x = 0; x < vid.width; x++) {
|
for (x = 0; x < vid.conwidth; x++) {
|
||||||
if ((x & 3) != t)
|
if ((x & 3) != t)
|
||||||
pbuf[x] = 0;
|
pbuf[x] = 0;
|
||||||
}
|
}
|
||||||
|
@ -1085,21 +1085,21 @@ Draw_FadeScreen (void)
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
for (y = 0; y < vid.height; y++) {
|
for (y = 0; y < vid.conheight; y++) {
|
||||||
unsigned short *pbuf = (unsigned short *)
|
unsigned short *pbuf = (unsigned short *)
|
||||||
((byte *) vid.buffer + vid.rowbytes * y);
|
((byte *) vid.buffer + vid.rowbytes * y);
|
||||||
pbuf = (unsigned short *) vid.buffer + (vid.rowbytes >> 1) * 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;
|
pbuf[x] = (pbuf[x] >>= 1) & 0x7BEF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
for (y = 0; y < vid.height; y++) {
|
for (y = 0; y < vid.conheight; y++) {
|
||||||
unsigned int *pbuf = (unsigned int *)
|
unsigned int *pbuf = (unsigned int *)
|
||||||
((byte *) vid.buffer + vid.rowbytes * y);
|
((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;
|
pbuf[x] = (pbuf[x] >>= 1) & 0x7F7F7F7F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,10 +304,6 @@ VID_Init (unsigned char *palette)
|
||||||
attribs[4] = 1;
|
attribs[4] = 1;
|
||||||
attribs[5] = FXMESA_NONE;
|
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
|
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 (&scr_width, &scr_height),
|
||||||
|
|
|
@ -44,6 +44,10 @@ VID_InitBuffers (void)
|
||||||
{
|
{
|
||||||
int buffersize, zbuffersize, cachesize = 1;
|
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
|
// Calculate the sizes we want first
|
||||||
buffersize = vid.rowbytes * vid.height;
|
buffersize = vid.rowbytes * vid.height;
|
||||||
zbuffersize = vid.width * vid.height * sizeof (*vid.zbuffer);
|
zbuffersize = vid.width * vid.height * sizeof (*vid.zbuffer);
|
||||||
|
|
|
@ -208,6 +208,10 @@ VID_InitBuffers (void)
|
||||||
{
|
{
|
||||||
int buffersize, zbuffersize, cachesize = 1;
|
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
|
// Calculate the sizes we want first
|
||||||
buffersize = vid.rowbytes * vid.height;
|
buffersize = vid.rowbytes * vid.height;
|
||||||
zbuffersize = vid.width * vid.height * sizeof (*vid.zbuffer);
|
zbuffersize = vid.width * vid.height * sizeof (*vid.zbuffer);
|
||||||
|
|
|
@ -208,10 +208,6 @@ VID_Init (unsigned char *palette)
|
||||||
vid.colormap8 = vid_colormap;
|
vid.colormap8 = vid_colormap;
|
||||||
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));
|
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
|
Con_CheckResize (); // Now that we have a window size, fix console
|
||||||
|
|
||||||
X11_OpenDisplay ();
|
X11_OpenDisplay ();
|
||||||
|
|
|
@ -108,8 +108,8 @@ VID_Init (unsigned char *palette)
|
||||||
VID_SetPalette (vid.palette);
|
VID_SetPalette (vid.palette);
|
||||||
|
|
||||||
// now know everything we need to know about the buffer
|
// now know everything we need to know about the buffer
|
||||||
VGA_width = vid.conwidth = vid.width;
|
VGA_width = vid.width;
|
||||||
VGA_height = vid.conheight = vid.height;
|
VGA_height = vid.height;
|
||||||
Con_CheckResize (); // Now that we have a window size, fix console
|
Con_CheckResize (); // Now that we have a window size, fix console
|
||||||
vid.numpages = 1;
|
vid.numpages = 1;
|
||||||
vid.colormap8 = vid_colormap;
|
vid.colormap8 = vid_colormap;
|
||||||
|
|
|
@ -149,8 +149,8 @@ VID_Init (unsigned char *palette)
|
||||||
}
|
}
|
||||||
|
|
||||||
// now we know everything we need to know about the buffer
|
// now we know everything we need to know about the buffer
|
||||||
VGA_width = vid.conwidth = vid.width;
|
VGA_width = vid.width;
|
||||||
VGA_height = vid.conheight = vid.height;
|
VGA_height = vid.height;
|
||||||
Con_CheckResize (); // Now that we have a window size, fix console
|
Con_CheckResize (); // Now that we have a window size, fix console
|
||||||
vid.numpages = 1;
|
vid.numpages = 1;
|
||||||
if (vid_colormap)
|
if (vid_colormap)
|
||||||
|
|
|
@ -117,17 +117,6 @@ VID_Init (unsigned char *palette)
|
||||||
vid.colormap8 = vid_colormap;
|
vid.colormap8 = vid_colormap;
|
||||||
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));
|
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
|
// Check if we want fullscreen
|
||||||
if (vid_fullscreen->int_val) {
|
if (vid_fullscreen->int_val) {
|
||||||
flags |= SDL_FULLSCREEN;
|
flags |= SDL_FULLSCREEN;
|
||||||
|
@ -176,9 +165,6 @@ VID_Init (unsigned char *palette)
|
||||||
SDL_Quit ();
|
SDL_Quit ();
|
||||||
|
|
||||||
success:
|
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
|
Con_CheckResize (); // Now that we have a window size, fix console
|
||||||
|
|
||||||
vid.numpages = 2;
|
vid.numpages = 2;
|
||||||
|
|
|
@ -307,8 +307,6 @@ VID_SetMode (int modenum, unsigned char *palette)
|
||||||
vid.colormap8 = (byte *) vid_colormap;
|
vid.colormap8 = (byte *) vid_colormap;
|
||||||
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));
|
vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048));
|
||||||
vid.conrowbytes = vid.rowbytes;
|
vid.conrowbytes = vid.rowbytes;
|
||||||
vid.conwidth = vid.width;
|
|
||||||
vid.conheight = vid.height;
|
|
||||||
vid.numpages = 1;
|
vid.numpages = 1;
|
||||||
|
|
||||||
// alloc screen buffer, z-buffer, and surface cache
|
// alloc screen buffer, z-buffer, and surface cache
|
||||||
|
|
|
@ -383,8 +383,6 @@ x11_init_buffers (void)
|
||||||
}
|
}
|
||||||
vid.conbuffer = vid.buffer;
|
vid.conbuffer = vid.buffer;
|
||||||
|
|
||||||
vid.conwidth = vid.width;
|
|
||||||
vid.conheight = vid.height;
|
|
||||||
vid.conrowbytes = vid.rowbytes;
|
vid.conrowbytes = vid.rowbytes;
|
||||||
Con_CheckResize (); // Now that we have a window size, fix console
|
Con_CheckResize (); // Now that we have a window size, fix console
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue