mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
gl_texmgr.c, gl_vidsdl.c: made a lot of functions and variables static.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@584 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
e9c1920bfc
commit
17a4f90bb2
7 changed files with 281 additions and 297 deletions
|
@ -365,7 +365,6 @@ R_Clear -- johnfitz -- rewritten and gutted
|
|||
*/
|
||||
void R_Clear (void)
|
||||
{
|
||||
extern int gl_stencilbits;
|
||||
unsigned int clearbits;
|
||||
|
||||
clearbits = GL_DEPTH_BUFFER_BIT;
|
||||
|
|
|
@ -23,19 +23,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
extern qboolean gl_anisotropy_able;
|
||||
|
||||
cvar_t gl_texture_anisotropy = {"gl_texture_anisotropy", "1", CVAR_ARCHIVE};
|
||||
cvar_t gl_max_size = {"gl_max_size", "0", CVAR_NONE};
|
||||
cvar_t gl_picmip = {"gl_picmip", "0", CVAR_NONE};
|
||||
GLint gl_hardware_maxsize;
|
||||
const int gl_solid_format = 3;
|
||||
const int gl_alpha_format = 4;
|
||||
|
||||
static cvar_t gl_texture_anisotropy = {"gl_texture_anisotropy", "1", CVAR_ARCHIVE};
|
||||
static cvar_t gl_max_size = {"gl_max_size", "0", CVAR_NONE};
|
||||
static cvar_t gl_picmip = {"gl_picmip", "0", CVAR_NONE};
|
||||
static GLint gl_hardware_maxsize;
|
||||
|
||||
#define MAX_GLTEXTURES 2048
|
||||
gltexture_t *active_gltextures, *free_gltextures;
|
||||
gltexture_t *notexture, *nulltexture;
|
||||
int numgltextures;
|
||||
static int numgltextures;
|
||||
static gltexture_t *active_gltextures, *free_gltextures;
|
||||
gltexture_t *notexture, *nulltexture;
|
||||
|
||||
unsigned int d_8to24table[256];
|
||||
unsigned int d_8to24table_fbright[256];
|
||||
|
@ -58,11 +57,11 @@ typedef struct
|
|||
int minfilter;
|
||||
const char *name;
|
||||
} glmode_t;
|
||||
glmode_t modes[] = {
|
||||
{GL_NEAREST, GL_NEAREST, "GL_NEAREST"},
|
||||
static glmode_t modes[] = {
|
||||
{GL_NEAREST, GL_NEAREST, "GL_NEAREST"},
|
||||
{GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, "GL_NEAREST_MIPMAP_NEAREST"},
|
||||
{GL_NEAREST, GL_NEAREST_MIPMAP_LINEAR, "GL_NEAREST_MIPMAP_LINEAR"},
|
||||
{GL_LINEAR, GL_LINEAR, "GL_LINEAR"},
|
||||
{GL_LINEAR, GL_LINEAR, "GL_LINEAR"},
|
||||
{GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, "GL_LINEAR_MIPMAP_NEAREST"},
|
||||
{GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, "GL_LINEAR_MIPMAP_LINEAR"},
|
||||
};
|
||||
|
@ -74,11 +73,11 @@ int gl_texturemode = 5; // bilinear
|
|||
TexMgr_DescribeTextureModes_f -- report available texturemodes
|
||||
===============
|
||||
*/
|
||||
void TexMgr_DescribeTextureModes_f (void)
|
||||
static void TexMgr_DescribeTextureModes_f (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<NUM_GLMODES; i++)
|
||||
for (i = 0; i < NUM_GLMODES; i++)
|
||||
Con_SafePrintf (" %2i: %s\n", i + 1, modes[i].name);
|
||||
|
||||
Con_Printf ("%i modes\n", i);
|
||||
|
@ -89,7 +88,7 @@ void TexMgr_DescribeTextureModes_f (void)
|
|||
TexMgr_SetFilterModes
|
||||
===============
|
||||
*/
|
||||
void TexMgr_SetFilterModes (gltexture_t *glt)
|
||||
static void TexMgr_SetFilterModes (gltexture_t *glt)
|
||||
{
|
||||
GL_Bind (glt);
|
||||
|
||||
|
@ -122,7 +121,7 @@ void TexMgr_SetFilterModes (gltexture_t *glt)
|
|||
TexMgr_TextureMode_f
|
||||
===============
|
||||
*/
|
||||
void TexMgr_TextureMode_f (void)
|
||||
static void TexMgr_TextureMode_f (void)
|
||||
{
|
||||
gltexture_t *glt;
|
||||
const char *arg;
|
||||
|
@ -137,12 +136,14 @@ void TexMgr_TextureMode_f (void)
|
|||
arg = Cmd_Argv(1);
|
||||
if (arg[0] == 'G' || arg[0] == 'g')
|
||||
{
|
||||
for (i=0; i<NUM_GLMODES; i++)
|
||||
for (i = 0; i < NUM_GLMODES; i++)
|
||||
{
|
||||
if (!Q_strcasecmp (modes[i].name, arg))
|
||||
{
|
||||
gl_texturemode = i;
|
||||
goto stuff;
|
||||
}
|
||||
}
|
||||
Con_Printf ("\"%s\" is not a valid texturemode\n", arg);
|
||||
return;
|
||||
}
|
||||
|
@ -160,7 +161,7 @@ void TexMgr_TextureMode_f (void)
|
|||
Con_Printf ("\"%s\" is not a valid texturemode\n", arg);
|
||||
|
||||
stuff:
|
||||
for (glt=active_gltextures; glt; glt=glt->next)
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
TexMgr_SetFilterModes (glt);
|
||||
|
||||
Sbar_Changed (); //sbar graphics need to be redrawn with new filter mode
|
||||
|
@ -181,14 +182,13 @@ TexMgr_Anisotropy_f -- called when gl_texture_anisotropy changes
|
|||
FIXME: this is getting called twice (becuase of the recursive Cvar_SetValue call)
|
||||
===============
|
||||
*/
|
||||
void TexMgr_Anisotropy_f (cvar_t *var)
|
||||
static void TexMgr_Anisotropy_f (cvar_t *var)
|
||||
{
|
||||
extern float gl_max_anisotropy;
|
||||
gltexture_t *glt;
|
||||
|
||||
Cvar_SetValue ("gl_texture_anisotropy", CLAMP (1.0f, gl_texture_anisotropy.value, gl_max_anisotropy));
|
||||
|
||||
for (glt=active_gltextures; glt; glt=glt->next)
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
TexMgr_SetFilterModes (glt);
|
||||
}
|
||||
|
||||
|
@ -197,14 +197,13 @@ void TexMgr_Anisotropy_f (cvar_t *var)
|
|||
TexMgr_Imagelist_f -- report loaded textures
|
||||
===============
|
||||
*/
|
||||
void TexMgr_Imagelist_f (void)
|
||||
static void TexMgr_Imagelist_f (void)
|
||||
{
|
||||
float mb;
|
||||
float texels = 0;
|
||||
gltexture_t *glt;
|
||||
extern cvar_t vid_bpp;
|
||||
|
||||
for (glt=active_gltextures; glt; glt=glt->next)
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
{
|
||||
Con_SafePrintf (" %4i x%4i %s\n", glt->width, glt->height, glt->name);
|
||||
if (glt->flags & TEXPREF_MIPMAP)
|
||||
|
@ -213,7 +212,7 @@ void TexMgr_Imagelist_f (void)
|
|||
texels += (glt->width * glt->height);
|
||||
}
|
||||
|
||||
mb = texels * (vid_bpp.value / 8.0f) / 0x100000;
|
||||
mb = texels * (Cvar_VariableValue("vid_bpp") / 8.0f) / 0x100000;
|
||||
Con_Printf ("%i textures %i pixels %1.1f megabytes\n", numgltextures, (int)texels, mb);
|
||||
}
|
||||
|
||||
|
@ -222,7 +221,7 @@ void TexMgr_Imagelist_f (void)
|
|||
TexMgr_Imagedump_f -- dump all current textures to TGA files
|
||||
===============
|
||||
*/
|
||||
void TexMgr_Imagedump_f (void)
|
||||
static void TexMgr_Imagedump_f (void)
|
||||
{
|
||||
char tganame[MAX_OSPATH], tempname[MAX_OSPATH], dirname[MAX_OSPATH];
|
||||
gltexture_t *glt;
|
||||
|
@ -234,7 +233,7 @@ void TexMgr_Imagedump_f (void)
|
|||
Sys_mkdir (dirname);
|
||||
|
||||
//loop through textures
|
||||
for (glt=active_gltextures; glt; glt=glt->next)
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
{
|
||||
q_strlcpy (tempname, glt->name, sizeof(tempname));
|
||||
while ( (c = strchr(tempname, ':')) ) *c = '_';
|
||||
|
@ -271,9 +270,9 @@ float TexMgr_FrameUsage (void)
|
|||
float mb;
|
||||
float texels = 0;
|
||||
gltexture_t *glt;
|
||||
extern cvar_t vid_bpp;
|
||||
|
||||
for (glt=active_gltextures; glt; glt=glt->next)
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
{
|
||||
if (glt->visframe == r_framecount)
|
||||
{
|
||||
if (glt->flags & TEXPREF_MIPMAP)
|
||||
|
@ -281,8 +280,9 @@ float TexMgr_FrameUsage (void)
|
|||
else
|
||||
texels += (glt->width * glt->height);
|
||||
}
|
||||
}
|
||||
|
||||
mb = texels * (vid_bpp.value / 8.0f) / 0x100000;
|
||||
mb = texels * (Cvar_VariableValue("vid_bpp") / 8.0f) / 0x100000;
|
||||
return mb;
|
||||
}
|
||||
|
||||
|
@ -305,9 +305,11 @@ gltexture_t *TexMgr_FindTexture (model_t *owner, const char *name)
|
|||
|
||||
if (name)
|
||||
{
|
||||
for (glt=active_gltextures; glt; glt=glt->next)
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
{
|
||||
if (glt->owner == owner && !strcmp (glt->name, name))
|
||||
return glt;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -362,6 +364,7 @@ void TexMgr_FreeTexture (gltexture_t *kill)
|
|||
}
|
||||
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
{
|
||||
if (glt->next == kill)
|
||||
{
|
||||
glt->next = kill->next;
|
||||
|
@ -372,6 +375,7 @@ void TexMgr_FreeTexture (gltexture_t *kill)
|
|||
numgltextures--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Con_Printf ("TexMgr_FreeTexture: not found\n");
|
||||
}
|
||||
|
@ -443,7 +447,7 @@ void TexMgr_LoadPalette (void)
|
|||
//standard palette, 255 is transparent
|
||||
dst = (byte *)d_8to24table;
|
||||
src = pal;
|
||||
for (i=0; i<256; i++)
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
|
@ -455,14 +459,14 @@ void TexMgr_LoadPalette (void)
|
|||
//fullbright palette, 0-223 are black (for additive blending)
|
||||
src = pal + 224*3;
|
||||
dst = (byte *) &d_8to24table_fbright[224];
|
||||
for (i=224; i<256; i++)
|
||||
for (i = 224; i < 256; i++)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
*dst++ = 255;
|
||||
}
|
||||
for (i=0; i<224; i++)
|
||||
for (i = 0; i < 224; i++)
|
||||
{
|
||||
dst = (byte *) &d_8to24table_fbright[i];
|
||||
dst[3] = 255;
|
||||
|
@ -472,14 +476,14 @@ void TexMgr_LoadPalette (void)
|
|||
//nobright palette, 224-255 are black (for additive blending)
|
||||
dst = (byte *)d_8to24table_nobright;
|
||||
src = pal;
|
||||
for (i=0; i<256; i++)
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
*dst++ = 255;
|
||||
}
|
||||
for (i=224; i<256; i++)
|
||||
for (i = 224; i < 256; i++)
|
||||
{
|
||||
dst = (byte *) &d_8to24table_nobright[i];
|
||||
dst[3] = 255;
|
||||
|
@ -542,7 +546,7 @@ void TexMgr_RecalcWarpImageSize (void)
|
|||
mark = Hunk_LowMark();
|
||||
dummy = (byte *) Hunk_Alloc (gl_warpimagesize*gl_warpimagesize*4);
|
||||
|
||||
for (glt=active_gltextures; glt; glt=glt->next)
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
{
|
||||
if (glt->flags & TEXPREF_WARPIMAGE)
|
||||
{
|
||||
|
@ -572,7 +576,7 @@ void TexMgr_Init (void)
|
|||
// init texture list
|
||||
free_gltextures = (gltexture_t *) Hunk_AllocName (MAX_GLTEXTURES * sizeof(gltexture_t), "gltextures");
|
||||
active_gltextures = NULL;
|
||||
for (i=0; i<MAX_GLTEXTURES-1; i++)
|
||||
for (i = 0; i < MAX_GLTEXTURES - 1; i++)
|
||||
free_gltextures[i].next = &free_gltextures[i+1];
|
||||
free_gltextures[i].next = NULL;
|
||||
numgltextures = 0;
|
||||
|
@ -620,7 +624,8 @@ TexMgr_Pad -- return smallest power of two greater than or equal to s
|
|||
int TexMgr_Pad (int s)
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < s; i<<=1);
|
||||
for (i = 1; i < s; i<<=1)
|
||||
;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -656,15 +661,15 @@ int TexMgr_PadConditional (int s)
|
|||
TexMgr_MipMapW
|
||||
================
|
||||
*/
|
||||
unsigned *TexMgr_MipMapW (unsigned *data, int width, int height)
|
||||
static unsigned *TexMgr_MipMapW (unsigned *data, int width, int height)
|
||||
{
|
||||
int i, size;
|
||||
int i, size;
|
||||
byte *out, *in;
|
||||
|
||||
out = in = (byte *)data;
|
||||
size = (width*height)>>1;
|
||||
|
||||
for (i=0; i<size; i++, out+=4, in+=8)
|
||||
for (i = 0; i < size; i++, out += 4, in += 8)
|
||||
{
|
||||
out[0] = (in[0] + in[4])>>1;
|
||||
out[1] = (in[1] + in[5])>>1;
|
||||
|
@ -680,23 +685,25 @@ unsigned *TexMgr_MipMapW (unsigned *data, int width, int height)
|
|||
TexMgr_MipMapH
|
||||
================
|
||||
*/
|
||||
unsigned *TexMgr_MipMapH (unsigned *data, int width, int height)
|
||||
static unsigned *TexMgr_MipMapH (unsigned *data, int width, int height)
|
||||
{
|
||||
int i, j;
|
||||
int i, j;
|
||||
byte *out, *in;
|
||||
|
||||
out = in = (byte *)data;
|
||||
height>>=1;
|
||||
width<<=2;
|
||||
|
||||
for (i=0; i<height; i++, in+=width)
|
||||
for (j=0; j<width; j+=4, out+=4, in+=4)
|
||||
for (i = 0; i < height; i++, in += width)
|
||||
{
|
||||
for (j = 0; j < width; j += 4, out += 4, in += 4)
|
||||
{
|
||||
out[0] = (in[0] + in[width+0])>>1;
|
||||
out[1] = (in[1] + in[width+1])>>1;
|
||||
out[2] = (in[2] + in[width+2])>>1;
|
||||
out[3] = (in[3] + in[width+3])>>1;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -706,7 +713,7 @@ unsigned *TexMgr_MipMapH (unsigned *data, int width, int height)
|
|||
TexMgr_ResampleTexture -- bilinear resample
|
||||
================
|
||||
*/
|
||||
unsigned *TexMgr_ResampleTexture (unsigned *in, int inwidth, int inheight, qboolean alpha)
|
||||
static unsigned *TexMgr_ResampleTexture (unsigned *in, int inwidth, int inheight, qboolean alpha)
|
||||
{
|
||||
byte *nwpx, *nepx, *swpx, *sepx, *dest;
|
||||
unsigned xfrac, yfrac, x, y, modx, mody, imodx, imody, injump, outjump;
|
||||
|
@ -724,14 +731,14 @@ unsigned *TexMgr_ResampleTexture (unsigned *in, int inwidth, int inheight, qbool
|
|||
yfrac = ((inheight-1) << 16) / (outheight-1);
|
||||
y = outjump = 0;
|
||||
|
||||
for (i=0; i<outheight; i++)
|
||||
for (i = 0; i < outheight; i++)
|
||||
{
|
||||
mody = (y>>8) & 0xFF;
|
||||
imody = 256 - mody;
|
||||
injump = (y>>16) * inwidth;
|
||||
x = 0;
|
||||
|
||||
for (j=0; j<outwidth; j++)
|
||||
for (j = 0; j < outwidth; j++)
|
||||
{
|
||||
modx = (x>>8) & 0xFF;
|
||||
imodx = 256 - modx;
|
||||
|
@ -768,18 +775,20 @@ eliminate pink edges on sprites, etc.
|
|||
operates in place on 32bit data
|
||||
===============
|
||||
*/
|
||||
void TexMgr_AlphaEdgeFix (byte *data, int width, int height)
|
||||
static void TexMgr_AlphaEdgeFix (byte *data, int width, int height)
|
||||
{
|
||||
int i,j,n=0,b,c[3]={0,0,0},lastrow,thisrow,nextrow,lastpix,thispix,nextpix;
|
||||
byte *dest = data;
|
||||
int i, j, n = 0, b, c[3] = {0,0,0},
|
||||
lastrow, thisrow, nextrow,
|
||||
lastpix, thispix, nextpix;
|
||||
byte *dest = data;
|
||||
|
||||
for (i=0; i<height; i++)
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
lastrow = width * 4 * ((i == 0) ? height-1 : i-1);
|
||||
thisrow = width * 4 * i;
|
||||
nextrow = width * 4 * ((i == height-1) ? 0 : i+1);
|
||||
|
||||
for (j=0; j<width; j++, dest+=4)
|
||||
for (j = 0; j < width; j++, dest += 4)
|
||||
{
|
||||
if (dest[3]) //not transparent
|
||||
continue;
|
||||
|
@ -817,7 +826,7 @@ TexMgr_PadEdgeFixW -- special case of AlphaEdgeFix for textures that only need i
|
|||
operates in place on 32bit data, and expects unpadded height and width values
|
||||
===============
|
||||
*/
|
||||
void TexMgr_PadEdgeFixW (byte *data, int width, int height)
|
||||
static void TexMgr_PadEdgeFixW (byte *data, int width, int height)
|
||||
{
|
||||
byte *src, *dst;
|
||||
int i, padw, padh;
|
||||
|
@ -827,7 +836,7 @@ void TexMgr_PadEdgeFixW (byte *data, int width, int height)
|
|||
|
||||
//copy last full column to first empty column, leaving alpha byte at zero
|
||||
src = data + (width - 1) * 4;
|
||||
for (i=0; i<padh; i++)
|
||||
for (i = 0; i < padh; i++)
|
||||
{
|
||||
src[4] = src[0];
|
||||
src[5] = src[1];
|
||||
|
@ -838,7 +847,7 @@ void TexMgr_PadEdgeFixW (byte *data, int width, int height)
|
|||
//copy first full column to last empty column, leaving alpha byte at zero
|
||||
src = data;
|
||||
dst = data + (padw - 1) * 4;
|
||||
for (i=0; i<padh; i++)
|
||||
for (i = 0; i < padh; i++)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
|
@ -855,7 +864,7 @@ TexMgr_PadEdgeFixH -- special case of AlphaEdgeFix for textures that only need i
|
|||
operates in place on 32bit data, and expects unpadded height and width values
|
||||
===============
|
||||
*/
|
||||
void TexMgr_PadEdgeFixH (byte *data, int width, int height)
|
||||
static void TexMgr_PadEdgeFixH (byte *data, int width, int height)
|
||||
{
|
||||
byte *src, *dst;
|
||||
int i, padw, padh;
|
||||
|
@ -866,7 +875,7 @@ void TexMgr_PadEdgeFixH (byte *data, int width, int height)
|
|||
//copy last full row to first empty row, leaving alpha byte at zero
|
||||
dst = data + height * padw * 4;
|
||||
src = dst - padw * 4;
|
||||
for (i=0; i<padw; i++)
|
||||
for (i = 0; i < padw; i++)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
|
@ -878,7 +887,7 @@ void TexMgr_PadEdgeFixH (byte *data, int width, int height)
|
|||
//copy first full row to last empty row, leaving alpha byte at zero
|
||||
dst = data + (padh - 1) * padw * 4;
|
||||
src = data;
|
||||
for (i=0; i<padw; i++)
|
||||
for (i = 0; i < padw; i++)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
|
@ -893,14 +902,14 @@ void TexMgr_PadEdgeFixH (byte *data, int width, int height)
|
|||
TexMgr_8to32
|
||||
================
|
||||
*/
|
||||
unsigned *TexMgr_8to32 (byte *in, int pixels, unsigned int *usepal)
|
||||
static unsigned *TexMgr_8to32 (byte *in, int pixels, unsigned int *usepal)
|
||||
{
|
||||
int i;
|
||||
unsigned *out, *data;
|
||||
|
||||
out = data = (unsigned *) Hunk_Alloc(pixels*4);
|
||||
|
||||
for (i=0 ; i<pixels ; i++)
|
||||
for (i = 0; i < pixels; i++)
|
||||
*out++ = usepal[*in++];
|
||||
|
||||
return data;
|
||||
|
@ -911,7 +920,7 @@ unsigned *TexMgr_8to32 (byte *in, int pixels, unsigned int *usepal)
|
|||
TexMgr_PadImageW -- return image with width padded up to power-of-two dimentions
|
||||
================
|
||||
*/
|
||||
byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte)
|
||||
static byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte)
|
||||
{
|
||||
int i, j, outwidth;
|
||||
byte *out, *data;
|
||||
|
@ -923,11 +932,11 @@ byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte)
|
|||
|
||||
out = data = (byte *) Hunk_Alloc(outwidth*height);
|
||||
|
||||
for (i=0; i<height; i++)
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
for (j=0; j<width; j++)
|
||||
for (j = 0; j < width; j++)
|
||||
*out++ = *in++;
|
||||
for ( ; j<outwidth; j++)
|
||||
for ( ; j < outwidth; j++)
|
||||
*out++ = padbyte;
|
||||
}
|
||||
|
||||
|
@ -939,7 +948,7 @@ byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte)
|
|||
TexMgr_PadImageH -- return image with height padded up to power-of-two dimentions
|
||||
================
|
||||
*/
|
||||
byte *TexMgr_PadImageH (byte *in, int width, int height, byte padbyte)
|
||||
static byte *TexMgr_PadImageH (byte *in, int width, int height, byte padbyte)
|
||||
{
|
||||
int i, srcpix, dstpix;
|
||||
byte *data, *out;
|
||||
|
@ -952,9 +961,9 @@ byte *TexMgr_PadImageH (byte *in, int width, int height, byte padbyte)
|
|||
|
||||
out = data = (byte *) Hunk_Alloc(dstpix);
|
||||
|
||||
for (i=0; i<srcpix; i++)
|
||||
for (i = 0; i < srcpix; i++)
|
||||
*out++ = *in++;
|
||||
for ( ; i<dstpix; i++)
|
||||
for ( ; i < dstpix; i++)
|
||||
*out++ = padbyte;
|
||||
|
||||
return data;
|
||||
|
@ -965,7 +974,7 @@ byte *TexMgr_PadImageH (byte *in, int width, int height, byte padbyte)
|
|||
TexMgr_LoadImage32 -- handles 32bit source data
|
||||
================
|
||||
*/
|
||||
void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data)
|
||||
static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data)
|
||||
{
|
||||
int internalformat, miplevel, mipwidth, mipheight, picmip;
|
||||
|
||||
|
@ -1029,7 +1038,7 @@ void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data)
|
|||
TexMgr_LoadImage8 -- handles 8bit source data, then passes it to LoadImage32
|
||||
================
|
||||
*/
|
||||
void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
|
||||
static void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
|
||||
{
|
||||
extern cvar_t gl_fullbrights;
|
||||
qboolean padw = false, padh = false;
|
||||
|
@ -1038,7 +1047,9 @@ void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
|
|||
int i;
|
||||
|
||||
// HACK HACK HACK -- taken from tomazquake
|
||||
if (strstr(glt->name, "shot1sid") && glt->width==32 && glt->height==32 && CRC_Block(data, 1024) == 65393)
|
||||
if (strstr(glt->name, "shot1sid") &&
|
||||
glt->width == 32 && glt->height == 32 &&
|
||||
CRC_Block(data, 1024) == 65393)
|
||||
{
|
||||
// This texture in b_shell1.bsp has some of the first 32 pixels painted white.
|
||||
// They are invisible in software, but look really ugly in GL. So we just copy
|
||||
|
@ -1118,10 +1129,8 @@ void TexMgr_LoadImage8 (gltexture_t *glt, byte *data)
|
|||
TexMgr_LoadLightmap -- handles lightmap data
|
||||
================
|
||||
*/
|
||||
void TexMgr_LoadLightmap (gltexture_t *glt, byte *data)
|
||||
static void TexMgr_LoadLightmap (gltexture_t *glt, byte *data)
|
||||
{
|
||||
extern int gl_lightmap_format, lightmap_bytes;
|
||||
|
||||
// upload it
|
||||
GL_Bind (glt);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, glt->width, glt->height, 0, gl_lightmap_format, GL_UNSIGNED_BYTE, data);
|
||||
|
@ -1138,7 +1147,6 @@ TexMgr_LoadImage -- the one entry point for loading all textures
|
|||
gltexture_t *TexMgr_LoadImage (model_t *owner, const char *name, int width, int height, enum srcformat format,
|
||||
byte *data, const char *source_file, src_offset_t source_offset, unsigned flags)
|
||||
{
|
||||
extern int lightmap_bytes;
|
||||
unsigned short crc;
|
||||
gltexture_t *glt;
|
||||
int mark;
|
||||
|
@ -1149,17 +1157,17 @@ gltexture_t *TexMgr_LoadImage (model_t *owner, const char *name, int width, int
|
|||
// cache check
|
||||
switch (format)
|
||||
{
|
||||
case SRC_INDEXED:
|
||||
crc = CRC_Block(data, width * height);
|
||||
break;
|
||||
case SRC_LIGHTMAP:
|
||||
crc = CRC_Block(data, width * height * lightmap_bytes);
|
||||
break;
|
||||
case SRC_RGBA:
|
||||
crc = CRC_Block(data, width * height * 4);
|
||||
break;
|
||||
default: /* not reachable but avoids compiler warnings */
|
||||
crc = 0;
|
||||
case SRC_INDEXED:
|
||||
crc = CRC_Block(data, width * height);
|
||||
break;
|
||||
case SRC_LIGHTMAP:
|
||||
crc = CRC_Block(data, width * height * lightmap_bytes);
|
||||
break;
|
||||
case SRC_RGBA:
|
||||
crc = CRC_Block(data, width * height * 4);
|
||||
break;
|
||||
default: /* not reachable but avoids compiler warnings */
|
||||
crc = 0;
|
||||
}
|
||||
if ((flags & TEXPREF_OVERWRITE) && (glt = TexMgr_FindTexture (owner, name)))
|
||||
{
|
||||
|
@ -1189,15 +1197,15 @@ gltexture_t *TexMgr_LoadImage (model_t *owner, const char *name, int width, int
|
|||
|
||||
switch (glt->source_format)
|
||||
{
|
||||
case SRC_INDEXED:
|
||||
TexMgr_LoadImage8 (glt, data);
|
||||
break;
|
||||
case SRC_LIGHTMAP:
|
||||
TexMgr_LoadLightmap (glt, data);
|
||||
break;
|
||||
case SRC_RGBA:
|
||||
TexMgr_LoadImage32 (glt, (unsigned *)data);
|
||||
break;
|
||||
case SRC_INDEXED:
|
||||
TexMgr_LoadImage8 (glt, data);
|
||||
break;
|
||||
case SRC_LIGHTMAP:
|
||||
TexMgr_LoadLightmap (glt, data);
|
||||
break;
|
||||
case SRC_RGBA:
|
||||
TexMgr_LoadImage32 (glt, (unsigned *)data);
|
||||
break;
|
||||
}
|
||||
|
||||
Hunk_FreeToLowMark(mark);
|
||||
|
@ -1222,7 +1230,7 @@ void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants)
|
|||
{
|
||||
byte translation[256];
|
||||
byte *src, *dst, *data = NULL, *translated;
|
||||
int mark, size, i;
|
||||
int mark, size, i;
|
||||
//
|
||||
// get source data
|
||||
//
|
||||
|
@ -1269,31 +1277,39 @@ invalid:
|
|||
if (glt->shirt > -1 && glt->pants > -1)
|
||||
{
|
||||
//create new translation table
|
||||
for (i=0 ; i<256 ; i++)
|
||||
for (i = 0; i < 256; i++)
|
||||
translation[i] = i;
|
||||
|
||||
shirt = glt->shirt * 16;
|
||||
if (shirt < 128)
|
||||
for (i=0 ; i<16 ; i++)
|
||||
translation[TOP_RANGE+i] = shirt+i;
|
||||
{
|
||||
for (i = 0; i < 16; i++)
|
||||
translation[TOP_RANGE+i] = shirt + i;
|
||||
}
|
||||
else
|
||||
for (i=0 ; i<16 ; i++)
|
||||
{
|
||||
for (i = 0; i < 16; i++)
|
||||
translation[TOP_RANGE+i] = shirt+15-i;
|
||||
}
|
||||
|
||||
pants = glt->pants * 16;
|
||||
if (pants < 128)
|
||||
for (i=0 ; i<16 ; i++)
|
||||
translation[BOTTOM_RANGE+i] = pants+i;
|
||||
{
|
||||
for (i = 0; i < 16; i++)
|
||||
translation[BOTTOM_RANGE+i] = pants + i;
|
||||
}
|
||||
else
|
||||
for (i=0 ; i<16 ; i++)
|
||||
{
|
||||
for (i = 0; i < 16; i++)
|
||||
translation[BOTTOM_RANGE+i] = pants+15-i;
|
||||
}
|
||||
|
||||
//translate texture
|
||||
size = glt->width * glt->height;
|
||||
dst = translated = (byte *) Hunk_Alloc (size);
|
||||
src = data;
|
||||
|
||||
for (i=0; i<size; i++)
|
||||
for (i = 0; i < size; i++)
|
||||
*dst++ = translation[*src++];
|
||||
|
||||
data = translated;
|
||||
|
@ -1303,15 +1319,15 @@ invalid:
|
|||
//
|
||||
switch (glt->source_format)
|
||||
{
|
||||
case SRC_INDEXED:
|
||||
TexMgr_LoadImage8 (glt, data);
|
||||
break;
|
||||
case SRC_LIGHTMAP:
|
||||
TexMgr_LoadLightmap (glt, data);
|
||||
break;
|
||||
case SRC_RGBA:
|
||||
TexMgr_LoadImage32 (glt, (unsigned *)data);
|
||||
break;
|
||||
case SRC_INDEXED:
|
||||
TexMgr_LoadImage8 (glt, data);
|
||||
break;
|
||||
case SRC_LIGHTMAP:
|
||||
TexMgr_LoadLightmap (glt, data);
|
||||
break;
|
||||
case SRC_RGBA:
|
||||
TexMgr_LoadImage32 (glt, (unsigned *)data);
|
||||
break;
|
||||
}
|
||||
|
||||
Hunk_FreeToLowMark(mark);
|
||||
|
@ -1326,7 +1342,7 @@ void TexMgr_ReloadImages (void)
|
|||
{
|
||||
gltexture_t *glt;
|
||||
|
||||
for (glt=active_gltextures; glt; glt=glt->next)
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
{
|
||||
glGenTextures(1, &glt->texnum);
|
||||
TexMgr_ReloadImage (glt, -1, -1);
|
||||
|
@ -1342,7 +1358,7 @@ void TexMgr_ReloadNobrightImages (void)
|
|||
{
|
||||
gltexture_t *glt;
|
||||
|
||||
for (glt=active_gltextures; glt; glt=glt->next)
|
||||
for (glt = active_gltextures; glt; glt = glt->next)
|
||||
if (glt->flags & TEXPREF_NOBRIGHT)
|
||||
TexMgr_ReloadImage(glt, -1, -1);
|
||||
}
|
||||
|
@ -1355,16 +1371,16 @@ void TexMgr_ReloadNobrightImages (void)
|
|||
================================================================================
|
||||
*/
|
||||
|
||||
GLuint currenttexture = (GLuint)-1; // to avoid unnecessary texture sets
|
||||
GLenum TEXTURE0, TEXTURE1; //johnfitz
|
||||
qboolean mtexenabled = false;
|
||||
static GLuint currenttexture = (GLuint)-1; // to avoid unnecessary texture sets
|
||||
GLenum TEXTURE0, TEXTURE1; //johnfitz
|
||||
qboolean mtexenabled = false;
|
||||
|
||||
/*
|
||||
================
|
||||
GL_SelectTexture -- johnfitz -- rewritten
|
||||
================
|
||||
*/
|
||||
void GL_SelectTexture (GLenum target)
|
||||
static void GL_SelectTexture (GLenum target)
|
||||
{
|
||||
static GLenum currenttarget;
|
||||
static GLuint ct0, ct1;
|
||||
|
|
|
@ -97,8 +97,6 @@ int TexMgr_PadConditional (int s);
|
|||
|
||||
// TEXTURE BINDING & TEXTURE UNIT SWITCHING
|
||||
|
||||
extern qboolean gl_mtexable;
|
||||
|
||||
void GL_DisableMultitexture (void); //selects texture unit 0
|
||||
void GL_EnableMultitexture (void); //selects texture unit 1
|
||||
void GL_Bind (gltexture_t *texture);
|
||||
|
|
|
@ -52,25 +52,24 @@ typedef struct {
|
|||
char modedesc[17];
|
||||
} vmode_t;
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
int width;
|
||||
int height;
|
||||
} lmode_t;
|
||||
|
||||
lmode_t lowresmodes[] = {
|
||||
static lmode_t lowresmodes[] = {
|
||||
{320, 200},
|
||||
{320, 240},
|
||||
{400, 300},
|
||||
{512, 384},
|
||||
};
|
||||
#endif
|
||||
|
||||
const char *gl_vendor;
|
||||
const char *gl_renderer;
|
||||
const char *gl_version;
|
||||
const char *gl_extensions;
|
||||
|
||||
qboolean DDActive;
|
||||
qboolean scr_skipupdate;
|
||||
static const char *gl_vendor;
|
||||
static const char *gl_renderer;
|
||||
static const char *gl_version;
|
||||
static const char *gl_extensions;
|
||||
|
||||
static vmode_t modelist[MAX_MODE_LIST];
|
||||
static int nummodes;
|
||||
|
@ -80,41 +79,31 @@ static qboolean vid_initialized = false;
|
|||
static qboolean windowed;
|
||||
static qboolean vid_canalttab = false;
|
||||
static qboolean vid_toggle_works = true;
|
||||
extern qboolean mouseactive; // from in_win.c
|
||||
|
||||
SDL_Surface *draw_context;
|
||||
static SDL_Surface *draw_context;
|
||||
|
||||
int vid_modenum = NO_MODE;
|
||||
int vid_realmode;
|
||||
int vid_default = MODE_WINDOWED;
|
||||
unsigned char vid_curpal[256*3];
|
||||
static qboolean fullsbardraw = false;
|
||||
static qboolean vid_locked = false; //johnfitz
|
||||
static qboolean vid_changed = false;
|
||||
|
||||
static int vid_modenum = NO_MODE;
|
||||
static int vid_realmode;
|
||||
static int vid_default = MODE_WINDOWED;
|
||||
static qboolean fullsbardraw = false;
|
||||
|
||||
static void VID_Menu_Init (void); //johnfitz
|
||||
static void VID_Menu_f (void); //johnfitz
|
||||
static void VID_MenuDraw (void);
|
||||
static void VID_MenuKey (int key);
|
||||
|
||||
static const char *VID_GetModeDescription (int mode);
|
||||
static void ClearAllStates (void);
|
||||
static void VID_UpdateWindowStatus (void);
|
||||
static void GL_Init (void);
|
||||
static void GL_SetupState (void); //johnfitz
|
||||
|
||||
glvert_t glv;
|
||||
viddef_t vid; // global video state
|
||||
|
||||
//unsigned short d_8to16table[256]; //johnfitz -- never used
|
||||
//unsigned char d_15to8table[65536]; //johnfitz -- never used
|
||||
|
||||
modestate_t modestate = MODE_WINDOWED;
|
||||
|
||||
void VID_Menu_Init (void); //johnfitz
|
||||
void VID_Menu_f (void); //johnfitz
|
||||
void VID_MenuDraw (void);
|
||||
void VID_MenuKey (int key);
|
||||
|
||||
const char *VID_GetModeDescription (int mode);
|
||||
void ClearAllStates (void);
|
||||
void VID_UpdateWindowStatus (void);
|
||||
void GL_Init (void);
|
||||
|
||||
PFNGLARRAYELEMENTEXTPROC glArrayElementEXT = NULL;
|
||||
PFNGLCOLORPOINTEREXTPROC glColorPointerEXT = NULL;
|
||||
PFNGLTEXCOORDPOINTEREXTPROC glTexCoordPointerEXT = NULL;
|
||||
PFNGLVERTEXPOINTEREXTPROC glVertexPointerEXT = NULL;
|
||||
|
||||
PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz
|
||||
PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz
|
||||
qboolean scr_skipupdate;
|
||||
|
||||
qboolean isPermedia = false;
|
||||
qboolean isIntelVideo = false; //johnfitz -- intel video workarounds from Baker
|
||||
|
@ -124,23 +113,20 @@ qboolean gl_texture_env_add = false; //johnfitz
|
|||
qboolean gl_swap_control = false; //johnfitz
|
||||
qboolean gl_anisotropy_able = false; //johnfitz
|
||||
float gl_max_anisotropy; //johnfitz
|
||||
int gl_stencilbits; //johnfitz
|
||||
|
||||
int gl_stencilbits; //johnfitz
|
||||
|
||||
qboolean vid_locked = false; //johnfitz
|
||||
qboolean vid_changed = false;
|
||||
|
||||
void GL_SetupState (void); //johnfitz
|
||||
PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc = NULL; //johnfitz
|
||||
PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc = NULL; //johnfitz
|
||||
|
||||
//====================================
|
||||
|
||||
//johnfitz -- new cvars
|
||||
cvar_t vid_fullscreen = {"vid_fullscreen", "0", CVAR_ARCHIVE}; // QuakeSpasm, was "1"
|
||||
cvar_t vid_width = {"vid_width", "800", CVAR_ARCHIVE}; // QuakeSpasm, was 640
|
||||
cvar_t vid_height = {"vid_height", "600", CVAR_ARCHIVE}; // QuakeSpasm, was 480
|
||||
cvar_t vid_bpp = {"vid_bpp", "16", CVAR_ARCHIVE};
|
||||
//cvar_t vid_refreshrate = {"vid_refreshrate", "60", CVAR_ARCHIVE};
|
||||
cvar_t vid_vsync = {"vid_vsync", "0", CVAR_ARCHIVE};
|
||||
static cvar_t vid_fullscreen = {"vid_fullscreen", "0", CVAR_ARCHIVE}; // QuakeSpasm, was "1"
|
||||
static cvar_t vid_width = {"vid_width", "800", CVAR_ARCHIVE}; // QuakeSpasm, was 640
|
||||
static cvar_t vid_height = {"vid_height", "600", CVAR_ARCHIVE}; // QuakeSpasm, was 480
|
||||
static cvar_t vid_bpp = {"vid_bpp", "16", CVAR_ARCHIVE};
|
||||
//static cvar_t vid_refreshrate = {"vid_refreshrate", "60", CVAR_ARCHIVE};
|
||||
static cvar_t vid_vsync = {"vid_vsync", "0", CVAR_ARCHIVE};
|
||||
//johnfitz
|
||||
|
||||
cvar_t _windowed_mouse = {"_windowed_mouse","1", CVAR_ARCHIVE};
|
||||
|
@ -152,26 +138,28 @@ cvar_t vid_gamma = {"gamma", "1", CVAR_ARCHIVE}; //johnfitz -- moved here from
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
unsigned short vid_gamma_red[256];
|
||||
unsigned short vid_gamma_green[256];
|
||||
unsigned short vid_gamma_blue[256];
|
||||
static unsigned short vid_gamma_red[256];
|
||||
static unsigned short vid_gamma_green[256];
|
||||
static unsigned short vid_gamma_blue[256];
|
||||
|
||||
unsigned short vid_sysgamma_red[256];
|
||||
unsigned short vid_sysgamma_green[256];
|
||||
unsigned short vid_sysgamma_blue[256];
|
||||
static unsigned short vid_sysgamma_red[256];
|
||||
static unsigned short vid_sysgamma_green[256];
|
||||
static unsigned short vid_sysgamma_blue[256];
|
||||
|
||||
int vid_gammaworks;
|
||||
static int vid_gammaworks;
|
||||
|
||||
/*
|
||||
================
|
||||
VID_Gamma_SetGamma -- apply gamma correction
|
||||
================
|
||||
*/
|
||||
void VID_Gamma_SetGamma (void)
|
||||
static void VID_Gamma_SetGamma (void)
|
||||
{
|
||||
if (draw_context && vid_gammaworks)
|
||||
{
|
||||
if (SDL_SetGammaRamp(&vid_gamma_red[0], &vid_gamma_green[0], &vid_gamma_blue[0]) == -1)
|
||||
Con_Printf ("VID_Gamma_SetGamma: failed on SDL_SetGammaRamp\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -179,11 +167,13 @@ void VID_Gamma_SetGamma (void)
|
|||
VID_Gamma_Restore -- restore system gamma
|
||||
================
|
||||
*/
|
||||
void VID_Gamma_Restore (void)
|
||||
static void VID_Gamma_Restore (void)
|
||||
{
|
||||
if (draw_context && vid_gammaworks)
|
||||
{
|
||||
if (SDL_SetGammaRamp(&vid_sysgamma_red[0], &vid_sysgamma_green[0], &vid_sysgamma_blue[0]) == -1)
|
||||
Con_Printf ("VID_Gamma_Restore: failed on SDL_SetGammaRamp\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -191,7 +181,7 @@ void VID_Gamma_Restore (void)
|
|||
VID_Gamma_Shutdown -- called on exit
|
||||
================
|
||||
*/
|
||||
void VID_Gamma_Shutdown (void)
|
||||
static void VID_Gamma_Shutdown (void)
|
||||
{
|
||||
VID_Gamma_Restore ();
|
||||
}
|
||||
|
@ -201,7 +191,7 @@ void VID_Gamma_Shutdown (void)
|
|||
VID_Gamma_f -- callback when the cvar changes
|
||||
================
|
||||
*/
|
||||
void VID_Gamma_f (cvar_t *var)
|
||||
static void VID_Gamma_f (cvar_t *var)
|
||||
{
|
||||
static float oldgamma;
|
||||
int i;
|
||||
|
@ -227,7 +217,7 @@ void VID_Gamma_f (cvar_t *var)
|
|||
VID_Gamma_Init -- call on init
|
||||
================
|
||||
*/
|
||||
void VID_Gamma_Init (void)
|
||||
static void VID_Gamma_Init (void)
|
||||
{
|
||||
vid_gammaworks = false;
|
||||
|
||||
|
@ -243,7 +233,7 @@ void VID_Gamma_Init (void)
|
|||
VID_SetMode
|
||||
================
|
||||
*/
|
||||
int VID_SetMode (int modenum)
|
||||
static int VID_SetMode (int modenum)
|
||||
{
|
||||
int temp;
|
||||
Uint32 flags = SDL_DEFAULT_FLAGS;
|
||||
|
@ -355,7 +345,7 @@ static void VID_Changed_f (cvar_t *var)
|
|||
VID_Restart -- johnfitz -- change video modes on the fly
|
||||
===================
|
||||
*/
|
||||
void VID_Restart (void)
|
||||
static void VID_Restart (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -442,7 +432,7 @@ void VID_Restart (void)
|
|||
VID_Test -- johnfitz -- like vid_restart, but asks for confirmation after switching modes
|
||||
================
|
||||
*/
|
||||
void VID_Test (void)
|
||||
static void VID_Test (void)
|
||||
{
|
||||
vmode_t oldmode;
|
||||
|
||||
|
@ -472,7 +462,7 @@ void VID_Test (void)
|
|||
VID_Unlock -- johnfitz
|
||||
================
|
||||
*/
|
||||
void VID_Unlock (void)
|
||||
static void VID_Unlock (void)
|
||||
{
|
||||
vid_locked = false;
|
||||
|
||||
|
@ -488,9 +478,9 @@ void VID_Unlock (void)
|
|||
VID_UpdateWindowStatus
|
||||
================
|
||||
*/
|
||||
void VID_UpdateWindowStatus (void)
|
||||
static void VID_UpdateWindowStatus (void)
|
||||
{
|
||||
//IN_UpdateClipCursor ();
|
||||
// IN_UpdateClipCursor ();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
@ -504,20 +494,22 @@ void VID_UpdateWindowStatus (void)
|
|||
GL_MakeNiceExtensionsList -- johnfitz
|
||||
===============
|
||||
*/
|
||||
char *GL_MakeNiceExtensionsList (const char *in)
|
||||
static char *GL_MakeNiceExtensionsList (const char *in)
|
||||
{
|
||||
char *copy, *token, *out;
|
||||
int i, count;
|
||||
|
||||
//each space will be replaced by 4 chars, so count the spaces before we malloc
|
||||
for (i = 0, count = 1; i < (int) strlen(in); i++)
|
||||
{
|
||||
if (in[i] == ' ')
|
||||
count++;
|
||||
}
|
||||
|
||||
out = (char *) Z_Malloc (strlen(in) + count*3 + 1); //usually about 1-2k
|
||||
out[0] = 0;
|
||||
|
||||
copy = (char *) Z_Strdup(in);
|
||||
|
||||
for (token = strtok(copy, " "); token; token = strtok(NULL, " "))
|
||||
{
|
||||
strcat(out, "\n ");
|
||||
|
@ -533,7 +525,7 @@ char *GL_MakeNiceExtensionsList (const char *in)
|
|||
GL_Info_f -- johnfitz
|
||||
===============
|
||||
*/
|
||||
void GL_Info_f (void)
|
||||
static void GL_Info_f (void)
|
||||
{
|
||||
static char *gl_extensions_nice = NULL;
|
||||
|
||||
|
@ -551,7 +543,7 @@ void GL_Info_f (void)
|
|||
GL_CheckExtensions -- johnfitz
|
||||
===============
|
||||
*/
|
||||
void GL_CheckExtensions (void)
|
||||
static void GL_CheckExtensions (void)
|
||||
{
|
||||
int swap_control;
|
||||
|
||||
|
@ -714,7 +706,7 @@ does all the stuff from GL_Init that needs to be done every time a new GL render
|
|||
GL_Init will still do the stuff that only needs to be done once
|
||||
===============
|
||||
*/
|
||||
void GL_SetupState (void)
|
||||
static void GL_SetupState (void)
|
||||
{
|
||||
glClearColor (0.15,0.15,0.15,0); //johnfitz -- originally 1,0,0,0
|
||||
glCullFace(GL_BACK); //johnfitz -- glquake used CCW with backwards culling -- let's do it right
|
||||
|
@ -740,7 +732,7 @@ void GL_SetupState (void)
|
|||
GL_Init
|
||||
===============
|
||||
*/
|
||||
void GL_Init (void)
|
||||
static void GL_Init (void)
|
||||
{
|
||||
gl_vendor = (const char *) glGetString (GL_VENDOR);
|
||||
gl_renderer = (const char *) glGetString (GL_RENDERER);
|
||||
|
@ -805,10 +797,6 @@ void GL_EndRendering (void)
|
|||
Sbar_Changed();
|
||||
}
|
||||
|
||||
void VID_SetDefaultMode (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void VID_Shutdown (void)
|
||||
{
|
||||
|
@ -839,7 +827,7 @@ MAIN WINDOW
|
|||
ClearAllStates
|
||||
================
|
||||
*/
|
||||
void ClearAllStates (void)
|
||||
static void ClearAllStates (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -866,7 +854,7 @@ void ClearAllStates (void)
|
|||
VID_NumModes
|
||||
=================
|
||||
*/
|
||||
int VID_NumModes (void)
|
||||
static int VID_NumModes (void)
|
||||
{
|
||||
return nummodes;
|
||||
}
|
||||
|
@ -877,9 +865,8 @@ int VID_NumModes (void)
|
|||
VID_GetModePtr
|
||||
=================
|
||||
*/
|
||||
vmode_t *VID_GetModePtr (int modenum)
|
||||
static vmode_t *VID_GetModePtr (int modenum)
|
||||
{
|
||||
|
||||
if ((modenum >= 0) && (modenum < nummodes))
|
||||
return &modelist[modenum];
|
||||
else
|
||||
|
@ -892,7 +879,7 @@ vmode_t *VID_GetModePtr (int modenum)
|
|||
VID_GetModeDescription
|
||||
=================
|
||||
*/
|
||||
const char *VID_GetModeDescription (int mode)
|
||||
static const char *VID_GetModeDescription (int mode)
|
||||
{
|
||||
const char *pinfo;
|
||||
vmode_t *pv;
|
||||
|
@ -912,7 +899,7 @@ const char *VID_GetModeDescription (int mode)
|
|||
VID_GetExtModeDescription
|
||||
=================
|
||||
*/
|
||||
const char *VID_GetExtModeDescription (int mode)
|
||||
static const char *VID_GetExtModeDescription (int mode)
|
||||
{
|
||||
static char pinfo[40];
|
||||
vmode_t *pv;
|
||||
|
@ -941,7 +928,7 @@ const char *VID_GetExtModeDescription (int mode)
|
|||
VID_DescribeCurrentMode_f
|
||||
=================
|
||||
*/
|
||||
void VID_DescribeCurrentMode_f (void)
|
||||
static void VID_DescribeCurrentMode_f (void)
|
||||
{
|
||||
Con_Printf ("%s\n", VID_GetExtModeDescription (vid_modenum));
|
||||
}
|
||||
|
@ -951,14 +938,13 @@ void VID_DescribeCurrentMode_f (void)
|
|||
VID_DescribeModes_f -- johnfitz -- changed formatting, and added refresh rates after each mode.
|
||||
=================
|
||||
*/
|
||||
void VID_DescribeModes_f (void)
|
||||
static void VID_DescribeModes_f (void)
|
||||
{
|
||||
int i, lnummodes;
|
||||
vmode_t *pv;
|
||||
int lastwidth, lastheight, lastbpp, count;
|
||||
vmode_t *pv;
|
||||
int i, lnummodes;
|
||||
int lastwidth, lastheight, lastbpp, count;
|
||||
|
||||
lnummodes = VID_NumModes ();
|
||||
|
||||
lastwidth = lastheight = lastbpp = count = 0;
|
||||
|
||||
for (i = 1; i < lnummodes; i++)
|
||||
|
@ -989,7 +975,7 @@ void VID_DescribeModes_f (void)
|
|||
VID_InitDIB
|
||||
=================
|
||||
*/
|
||||
void VID_InitDIB (void)
|
||||
static void VID_InitDIB (void)
|
||||
{
|
||||
const SDL_VideoInfo *info;
|
||||
int i;
|
||||
|
@ -1044,7 +1030,7 @@ void VID_InitDIB (void)
|
|||
VID_InitFullDIB
|
||||
=================
|
||||
*/
|
||||
void VID_InitFullDIB (void)
|
||||
static void VID_InitFullDIB (void)
|
||||
{
|
||||
SDL_PixelFormat format;
|
||||
SDL_Rect **modes;
|
||||
|
@ -1086,7 +1072,7 @@ void VID_InitFullDIB (void)
|
|||
sprintf (modelist[nummodes].modedesc, "%dx%dx%d",
|
||||
modelist[nummodes].width,
|
||||
modelist[nummodes].height,
|
||||
modelist[nummodes].bpp); //johnfitz -- refreshrate
|
||||
modelist[nummodes].bpp);
|
||||
|
||||
// if the width is more than twice the height, reduce it by half because this
|
||||
// is probably a dual-screen monitor
|
||||
|
@ -1152,7 +1138,7 @@ void VID_Init (void)
|
|||
Cvar_SetCallback (&vid_width, VID_Changed_f);
|
||||
Cvar_SetCallback (&vid_height, VID_Changed_f);
|
||||
Cvar_SetCallback (&vid_bpp, VID_Changed_f);
|
||||
//Cvar_RegisterVariable (&vid_refreshrate); //johnfitz
|
||||
// Cvar_RegisterVariable (&vid_refreshrate); //johnfitz
|
||||
Cvar_RegisterVariable (&_windowed_mouse);
|
||||
|
||||
Cmd_AddCommand ("vid_unlock", VID_Unlock); //johnfitz
|
||||
|
@ -1410,28 +1396,31 @@ void VID_SyncCvars (void)
|
|||
//==========================================================================
|
||||
|
||||
#define VIDEO_OPTIONS_ITEMS 7
|
||||
int video_cursor_table[] = {48, 56, 64, 72, 80, 96, 104};
|
||||
int video_options_cursor = 0;
|
||||
static int video_cursor_table[] = {48, 56, 64, 72, 80, 96, 104};
|
||||
static int video_options_cursor = 0;
|
||||
|
||||
typedef struct {int width,height;} vid_menu_mode;
|
||||
typedef struct {
|
||||
int width,height;
|
||||
} vid_menu_mode;
|
||||
|
||||
//TODO: replace these fixed-length arrays with hunk_allocated buffers
|
||||
static vid_menu_mode vid_menu_modes[MAX_MODE_LIST];
|
||||
static int vid_menu_nummodes = 0;
|
||||
|
||||
vid_menu_mode vid_menu_modes[MAX_MODE_LIST];
|
||||
int vid_menu_nummodes=0;
|
||||
static int vid_menu_bpps[4];
|
||||
static int vid_menu_numbpps = 0;
|
||||
|
||||
int vid_menu_bpps[4];
|
||||
int vid_menu_numbpps=0;
|
||||
|
||||
int vid_menu_rates[20];
|
||||
int vid_menu_numrates=0;
|
||||
#if 0
|
||||
static int vid_menu_rates[20];
|
||||
static int vid_menu_numrates = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
VID_Menu_Init
|
||||
================
|
||||
*/
|
||||
void VID_Menu_Init (void)
|
||||
static void VID_Menu_Init (void)
|
||||
{
|
||||
int i, j, h, w;
|
||||
|
||||
|
@ -1463,7 +1452,7 @@ VID_Menu_RebuildBppList
|
|||
regenerates bpp list based on current vid_width and vid_height
|
||||
================
|
||||
*/
|
||||
void VID_Menu_RebuildBppList (void)
|
||||
static void VID_Menu_RebuildBppList (void)
|
||||
{
|
||||
int i, j, b;
|
||||
|
||||
|
@ -1515,7 +1504,7 @@ chooses next resolution in order, then updates vid_width and
|
|||
vid_height cvars, then updates bpp and refreshrate lists
|
||||
================
|
||||
*/
|
||||
void VID_Menu_ChooseNextMode (int dir)
|
||||
static void VID_Menu_ChooseNextMode (int dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1554,7 +1543,7 @@ VID_Menu_ChooseNextBpp
|
|||
chooses next bpp in order, then updates vid_bpp cvar, then updates refreshrate list
|
||||
================
|
||||
*/
|
||||
void VID_Menu_ChooseNextBpp (int dir)
|
||||
static void VID_Menu_ChooseNextBpp (int dir)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -1590,7 +1579,7 @@ VID_Menu_ChooseNextRate
|
|||
chooses next refresh rate in order, then updates vid_refreshrate cvar
|
||||
================
|
||||
*/
|
||||
void VID_Menu_ChooseNextRate (int dir)
|
||||
static void VID_Menu_ChooseNextRate (int dir)
|
||||
{
|
||||
#if 0 /* not implemented for SDL */
|
||||
int i;
|
||||
|
@ -1626,7 +1615,7 @@ void VID_Menu_ChooseNextRate (int dir)
|
|||
VID_MenuKey
|
||||
================
|
||||
*/
|
||||
void VID_MenuKey (int key)
|
||||
static void VID_MenuKey (int key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
|
@ -1745,7 +1734,7 @@ void VID_MenuKey (int key)
|
|||
VID_MenuDraw
|
||||
================
|
||||
*/
|
||||
void VID_MenuDraw (void)
|
||||
static void VID_MenuDraw (void)
|
||||
{
|
||||
int i = 0;
|
||||
qpic_t *p;
|
||||
|
@ -1808,7 +1797,7 @@ void VID_MenuDraw (void)
|
|||
VID_Menu_f
|
||||
================
|
||||
*/
|
||||
void VID_Menu_f (void)
|
||||
static void VID_Menu_f (void)
|
||||
{
|
||||
key_dest = key_menu;
|
||||
m_state = m_video;
|
||||
|
|
|
@ -27,17 +27,6 @@ void GL_BeginRendering (int *x, int *y, int *width, int *height);
|
|||
void GL_EndRendering (void);
|
||||
void GL_Set2D (void);
|
||||
|
||||
//johnfitz -- removed texture object stuff since they are standard in gl 1.1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float x, y, z;
|
||||
float s, t;
|
||||
float r, g, b;
|
||||
} glvert_t;
|
||||
|
||||
extern glvert_t glv;
|
||||
|
||||
extern int glx, gly, glwidth, glheight;
|
||||
|
||||
// r_local.h -- private refresh defs
|
||||
|
@ -64,28 +53,28 @@ typedef struct surfcache_s
|
|||
{
|
||||
struct surfcache_s *next;
|
||||
struct surfcache_s **owner; // NULL is an empty chunk of memory
|
||||
int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
|
||||
int dlight;
|
||||
int size; // including header
|
||||
unsigned width;
|
||||
unsigned height; // DEBUG only needed for debug
|
||||
float mipscale;
|
||||
int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
|
||||
int dlight;
|
||||
int size; // including header
|
||||
unsigned width;
|
||||
unsigned height; // DEBUG only needed for debug
|
||||
float mipscale;
|
||||
struct texture_s *texture; // checked for animating textures
|
||||
byte data[4]; // width*height elements
|
||||
byte data[4]; // width*height elements
|
||||
} surfcache_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pixel_t *surfdat; // destination for generated surface
|
||||
int rowbytes; // destination logical width in bytes
|
||||
int rowbytes; // destination logical width in bytes
|
||||
msurface_t *surf; // description for surface to generate
|
||||
fixed8_t lightadj[MAXLIGHTMAPS];
|
||||
// adjust for lightmap levels for dynamic lighting
|
||||
texture_t *texture; // corrected for animating textures
|
||||
int surfmip; // mipmapped ratio of surface texels / world pixels
|
||||
int surfwidth; // in mipmapped texels
|
||||
int surfheight; // in mipmapped texels
|
||||
int surfmip; // mipmapped ratio of surface texels / world pixels
|
||||
int surfwidth; // in mipmapped texels
|
||||
int surfheight; // in mipmapped texels
|
||||
} drawsurf_t;
|
||||
|
||||
|
||||
|
@ -113,8 +102,8 @@ typedef struct particle_s
|
|||
extern qboolean r_cache_thrash; // compatability
|
||||
extern vec3_t modelorg, r_entorigin;
|
||||
extern entity_t *currententity;
|
||||
extern int r_visframecount; // ??? what difs?
|
||||
extern int r_framecount;
|
||||
extern int r_visframecount; // ??? what difs?
|
||||
extern int r_framecount;
|
||||
extern mplane_t frustum[4];
|
||||
|
||||
//
|
||||
|
@ -155,7 +144,6 @@ extern cvar_t gl_polyblend;
|
|||
extern cvar_t gl_flashblend;
|
||||
extern cvar_t gl_nocolors;
|
||||
|
||||
extern cvar_t gl_max_size;
|
||||
extern cvar_t gl_playermip;
|
||||
|
||||
extern cvar_t gl_subdivide_size;
|
||||
|
@ -163,14 +151,13 @@ extern float load_subdivide_size; //johnfitz -- remember what subdivide_size val
|
|||
|
||||
extern float r_world_matrix[16];
|
||||
|
||||
extern const char *gl_vendor;
|
||||
extern const char *gl_renderer;
|
||||
extern const char *gl_version;
|
||||
extern const char *gl_extensions;
|
||||
extern int gl_stencilbits; //johnfitz
|
||||
|
||||
// Multitexture
|
||||
#define TEXTURE0_SGIS 0x835E
|
||||
#define TEXTURE1_SGIS 0x835F
|
||||
extern qboolean mtexenabled;
|
||||
extern qboolean gl_mtexable;
|
||||
#define TEXTURE0_SGIS 0x835E
|
||||
#define TEXTURE1_SGIS 0x835F
|
||||
//johnfitz -- modified multitexture support
|
||||
extern PFNGLMULTITEXCOORD2FARBPROC GL_MTexCoord2fFunc;
|
||||
extern PFNGLACTIVETEXTUREARBPROC GL_SelectTextureFunc;
|
||||
|
@ -178,8 +165,10 @@ extern GLenum TEXTURE0, TEXTURE1;
|
|||
//johnfitz
|
||||
|
||||
//johnfitz -- anisotropic filtering
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
||||
extern float gl_max_anisotropy;
|
||||
extern qboolean gl_anisotropy_able;
|
||||
//johnfitz
|
||||
|
||||
//johnfitz -- polygon offset
|
||||
|
@ -205,10 +194,9 @@ void GL_PolygonOffset (int);
|
|||
#define GL_SOURCE0_ALPHA_EXT 0x8588
|
||||
#define GL_SOURCE1_ALPHA_EXT 0x8589
|
||||
extern qboolean gl_texture_env_combine;
|
||||
extern qboolean gl_texture_env_add; // for GL_EXT_texture_env_add
|
||||
//johnfitz
|
||||
|
||||
extern qboolean gl_texture_env_add; //johnfitz -- for GL_EXT_texture_env_add
|
||||
|
||||
extern qboolean isIntelVideo; //johnfitz -- intel video workarounds from Baker
|
||||
|
||||
//johnfitz -- rendering statistics
|
||||
|
@ -242,6 +230,7 @@ extern overflowtimes_t dev_overflows; //this stores the last time overflow messa
|
|||
//johnfitz
|
||||
|
||||
//johnfitz -- moved here from r_brush.c
|
||||
extern int gl_lightmap_format, lightmap_bytes;
|
||||
#define MAX_LIGHTMAPS 256 //johnfitz -- was 64
|
||||
extern gltexture_t *lightmap_textures[MAX_LIGHTMAPS]; //johnfitz -- changed to an array
|
||||
//johnfitz
|
||||
|
|
|
@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "quakedef.h"
|
||||
|
||||
extern qboolean mtexenabled; //johnfitz
|
||||
extern cvar_t r_drawflat, gl_overbright_models, gl_fullbrights, r_lerpmodels, r_lerpmove; //johnfitz
|
||||
|
||||
//up to 16 color translated skins
|
||||
|
|
46
Quake/vid.h
46
Quake/vid.h
|
@ -38,41 +38,39 @@ typedef byte pixel_t;
|
|||
|
||||
typedef struct vrect_s
|
||||
{
|
||||
int x,y,width,height;
|
||||
int x, y, width, height;
|
||||
struct vrect_s *pnext;
|
||||
} vrect_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
pixel_t *buffer; // invisible buffer
|
||||
pixel_t *colormap; // 256 * VID_GRADES size
|
||||
pixel_t *buffer; // invisible buffer
|
||||
pixel_t *colormap; // 256 * VID_GRADES size
|
||||
unsigned short *colormap16; // 256 * VID_GRADES size
|
||||
int fullbright; // index of first fullbright color
|
||||
unsigned rowbytes; // may be > width if displayed in a window
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
float aspect; // width / height -- < 0 is taller than wide
|
||||
int numpages;
|
||||
int recalc_refdef; // if true, recalc vid-based stuff
|
||||
pixel_t *conbuffer;
|
||||
int conrowbytes;
|
||||
unsigned conwidth;
|
||||
unsigned conheight;
|
||||
int maxwarpwidth;
|
||||
int maxwarpheight;
|
||||
pixel_t *direct; // direct drawing to framebuffer, if not
|
||||
// NULL
|
||||
int type; // kristian
|
||||
int fullbright; // index of first fullbright color
|
||||
unsigned rowbytes; // may be > width if displayed in a window
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
float aspect; // width / height -- < 0 is taller than wide
|
||||
int numpages;
|
||||
int recalc_refdef; // if true, recalc vid-based stuff
|
||||
pixel_t *conbuffer;
|
||||
int conrowbytes;
|
||||
unsigned conwidth;
|
||||
unsigned conheight;
|
||||
int maxwarpwidth;
|
||||
int maxwarpheight;
|
||||
pixel_t *direct; // direct drawing to framebuffer, if not NULL
|
||||
|
||||
int type; // kristian
|
||||
} viddef_t;
|
||||
|
||||
extern viddef_t vid; // global video state
|
||||
//extern unsigned short d_8to16table[256]; //johnfitz -- never used
|
||||
|
||||
extern void (*vid_menudrawfn)(void);
|
||||
extern void (*vid_menukeyfn)(int key);
|
||||
extern void (*vid_menucmdfn)(void); //johnfitz
|
||||
|
||||
//johnfitz -- deleted VID_SetPalette and VID_ShiftPalette
|
||||
|
||||
void VID_Init (void); //johnfitz -- removed palette from argument list
|
||||
|
||||
void VID_Shutdown (void);
|
||||
|
@ -81,10 +79,6 @@ void VID_Shutdown (void);
|
|||
void VID_Update (vrect_t *rects);
|
||||
// flushes the given rectangles from the view buffer to the screen
|
||||
|
||||
int VID_SetMode (int modenum); //johnfitz -- removed palette from argument list
|
||||
// sets the mode; only used by the Quake engine for resetting to mode 0 (the
|
||||
// base mode) on memory allocation failures
|
||||
|
||||
void VID_SyncCvars (void);
|
||||
|
||||
void VID_Toggle (void);
|
||||
|
|
Loading…
Reference in a new issue