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:
Ozkan Sezer 2011-12-30 14:00:28 +00:00
parent e9c1920bfc
commit 17a4f90bb2
7 changed files with 281 additions and 297 deletions

View file

@ -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;

View file

@ -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;
static int numgltextures;
static gltexture_t *active_gltextures, *free_gltextures;
gltexture_t *notexture, *nulltexture;
int numgltextures;
unsigned int d_8to24table[256];
unsigned int d_8to24table_fbright[256];
@ -58,7 +57,7 @@ typedef struct
int minfilter;
const char *name;
} glmode_t;
glmode_t modes[] = {
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"},
@ -74,7 +73,7 @@ int gl_texturemode = 5; // bilinear
TexMgr_DescribeTextureModes_f -- report available texturemodes
===============
*/
void TexMgr_DescribeTextureModes_f (void)
static void TexMgr_DescribeTextureModes_f (void)
{
int 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;
@ -138,11 +137,13 @@ void TexMgr_TextureMode_f (void)
if (arg[0] == 'G' || arg[0] == 'g')
{
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;
}
@ -181,9 +182,8 @@ 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));
@ -197,12 +197,11 @@ 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)
{
@ -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;
@ -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)
{
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;
}
@ -306,9 +306,11 @@ gltexture_t *TexMgr_FindTexture (model_t *owner, const char *name)
if (name)
{
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");
}
@ -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,7 +661,7 @@ 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;
byte *out, *in;
@ -680,7 +685,7 @@ 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;
byte *out, *in;
@ -690,6 +695,7 @@ unsigned *TexMgr_MipMapH (unsigned *data, int width, int height)
width<<=2;
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;
@ -697,6 +703,7 @@ unsigned *TexMgr_MipMapH (unsigned *data, int width, int height)
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;
@ -768,9 +775,11 @@ 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;
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++)
@ -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;
@ -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;
@ -893,7 +902,7 @@ 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;
@ -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;
@ -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;
@ -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;
@ -1274,19 +1282,27 @@ invalid:
shirt = glt->shirt * 16;
if (shirt < 128)
{
for (i = 0; i < 16; i++)
translation[TOP_RANGE+i] = shirt + i;
}
else
{
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;
}
else
{
for (i = 0; i < 16; i++)
translation[BOTTOM_RANGE+i] = pants+15-i;
}
//translate texture
size = glt->width * glt->height;
@ -1355,7 +1371,7 @@ void TexMgr_ReloadNobrightImages (void)
================================================================================
*/
GLuint currenttexture = (GLuint)-1; // to avoid unnecessary texture sets
static GLuint currenttexture = (GLuint)-1; // to avoid unnecessary texture sets
GLenum TEXTURE0, TEXTURE1; //johnfitz
qboolean mtexenabled = false;
@ -1364,7 +1380,7 @@ 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;

View file

@ -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);

View file

@ -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 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;
glvert_t glv;
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
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
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,46 +138,50 @@ 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");
}
}
/*
================
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");
}
}
/*
================
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,7 +478,7 @@ void VID_Unlock (void)
VID_UpdateWindowStatus
================
*/
void VID_UpdateWindowStatus (void)
static void VID_UpdateWindowStatus (void)
{
// 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 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
@ -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;

View file

@ -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
@ -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,12 +151,11 @@ 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
extern qboolean mtexenabled;
extern qboolean gl_mtexable;
#define TEXTURE0_SGIS 0x835E
#define TEXTURE1_SGIS 0x835F
//johnfitz -- modified multitexture support
@ -180,6 +167,8 @@ extern GLenum TEXTURE0, TEXTURE1;
//johnfitz -- anisotropic filtering
#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

View file

@ -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

View file

@ -60,19 +60,17 @@ typedef struct
unsigned conheight;
int maxwarpwidth;
int maxwarpheight;
pixel_t *direct; // direct drawing to framebuffer, if not
// NULL
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);