mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-17 01:21:12 +00:00
Benenne alle GL_ Funktionen in gl_images.c in R_ um
This commit is contained in:
parent
3989b43035
commit
7563c221f4
14 changed files with 145 additions and 143 deletions
1
TODO
1
TODO
|
@ -3,6 +3,7 @@ Allgemein:
|
||||||
- ====InitGame=== in allen Spielen ändern
|
- ====InitGame=== in allen Spielen ändern
|
||||||
|
|
||||||
- Header in unix/ und system/ mit Guards ausstatten
|
- Header in unix/ und system/ mit Guards ausstatten
|
||||||
|
- Alle anderen auf Guards prüfen
|
||||||
|
|
||||||
- Dateien im Refresher umbenennen
|
- Dateien im Refresher umbenennen
|
||||||
- Im Refresher für Funktionen konstant R_* statt GL_*
|
- Im Refresher für Funktionen konstant R_* statt GL_*
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "../header/local.h"
|
#include "../header/local.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
Mod_LoadAliasModel ( model_t *mod, void *buffer )
|
LoadMD2 ( model_t *mod, void *buffer )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
dmdl_t *pinmodel, *pheader;
|
dmdl_t *pinmodel, *pheader;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
extern int modfilelen;
|
extern int modfilelen;
|
||||||
|
|
||||||
void
|
void
|
||||||
Mod_LoadSpriteModel ( model_t *mod, void *buffer )
|
LoadSP2 ( model_t *mod, void *buffer )
|
||||||
{
|
{
|
||||||
dsprite_t *sprin, *sprout;
|
dsprite_t *sprin, *sprout;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "../header/local.h"
|
#include "../header/local.h"
|
||||||
|
|
||||||
image_t *
|
image_t *
|
||||||
R_LoadWal ( char *name )
|
LoadWal ( char *name )
|
||||||
{
|
{
|
||||||
miptex_t *mt;
|
miptex_t *mt;
|
||||||
int width, height, ofs;
|
int width, height, ofs;
|
||||||
|
|
|
@ -39,8 +39,8 @@ cvar_t *intensity;
|
||||||
|
|
||||||
unsigned d_8to24table [ 256 ];
|
unsigned d_8to24table [ 256 ];
|
||||||
|
|
||||||
qboolean GL_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sky );
|
qboolean R_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sky );
|
||||||
qboolean GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap );
|
qboolean R_Upload32 ( unsigned *data, int width, int height, qboolean mipmap );
|
||||||
|
|
||||||
int gl_solid_format = 3;
|
int gl_solid_format = 3;
|
||||||
int gl_alpha_format = 4;
|
int gl_alpha_format = 4;
|
||||||
|
@ -51,8 +51,9 @@ int gl_tex_alpha_format = 4;
|
||||||
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
|
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
|
||||||
int gl_filter_max = GL_LINEAR;
|
int gl_filter_max = GL_LINEAR;
|
||||||
|
|
||||||
image_t * R_LoadWal ( char *name );
|
image_t * LoadWal ( char *name );
|
||||||
void LoadTGA ( char *name, byte **pic, int *width, int *height );
|
void LoadTGA ( char *name, byte **pic, int *width, int *height );
|
||||||
|
int Draw_GetPalette ( void );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -127,7 +128,7 @@ int upload_width, upload_height;
|
||||||
qboolean uploaded_paletted;
|
qboolean uploaded_paletted;
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_TexEnv ( GLenum mode )
|
R_TexEnv ( GLenum mode )
|
||||||
{
|
{
|
||||||
static int lastmodes [ 2 ] = { -1, -1 };
|
static int lastmodes [ 2 ] = { -1, -1 };
|
||||||
|
|
||||||
|
@ -139,7 +140,7 @@ GL_TexEnv ( GLenum mode )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_Bind ( int texnum )
|
R_Bind ( int texnum )
|
||||||
{
|
{
|
||||||
extern image_t *draw_chars;
|
extern image_t *draw_chars;
|
||||||
|
|
||||||
|
@ -158,7 +159,7 @@ GL_Bind ( int texnum )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_MBind ( GLenum target, int texnum )
|
R_MBind ( GLenum target, int texnum )
|
||||||
{
|
{
|
||||||
if ( target == QGL_TEXTURE0 )
|
if ( target == QGL_TEXTURE0 )
|
||||||
{
|
{
|
||||||
|
@ -175,11 +176,11 @@ GL_MBind ( GLenum target, int texnum )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Bind( texnum );
|
R_Bind( texnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_TextureMode ( char *string )
|
R_TextureMode ( char *string )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
image_t *glt;
|
image_t *glt;
|
||||||
|
@ -206,7 +207,7 @@ GL_TextureMode ( char *string )
|
||||||
{
|
{
|
||||||
if ( ( glt->type != it_pic ) && ( glt->type != it_sky ) )
|
if ( ( glt->type != it_pic ) && ( glt->type != it_sky ) )
|
||||||
{
|
{
|
||||||
GL_Bind( glt->texnum );
|
R_Bind( glt->texnum );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
||||||
}
|
}
|
||||||
|
@ -214,7 +215,7 @@ GL_TextureMode ( char *string )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_TextureAlphaMode ( char *string )
|
R_TextureAlphaMode ( char *string )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -236,7 +237,7 @@ GL_TextureAlphaMode ( char *string )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_TextureSolidMode ( char *string )
|
R_TextureSolidMode ( char *string )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -258,7 +259,7 @@ GL_TextureSolidMode ( char *string )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_ImageList_f ( void )
|
R_ImageList_f ( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
image_t *image;
|
image_t *image;
|
||||||
|
@ -375,7 +376,7 @@ R_FloodFillSkin ( byte *skin, int skinwidth, int skinheight )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight )
|
R_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned *inrow, *inrow2;
|
unsigned *inrow, *inrow2;
|
||||||
|
@ -427,7 +428,7 @@ GL_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, in
|
||||||
* lighting range
|
* lighting range
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
GL_LightScaleTexture ( unsigned *in, int inwidth, int inheight, qboolean only_gamma )
|
R_LightScaleTexture ( unsigned *in, int inwidth, int inheight, qboolean only_gamma )
|
||||||
{
|
{
|
||||||
if ( only_gamma )
|
if ( only_gamma )
|
||||||
{
|
{
|
||||||
|
@ -467,7 +468,7 @@ GL_LightScaleTexture ( unsigned *in, int inwidth, int inheight, qboolean only_ga
|
||||||
* Operates in place, quartering the size of the texture
|
* Operates in place, quartering the size of the texture
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
GL_MipMap ( byte *in, int width, int height )
|
R_MipMap ( byte *in, int width, int height )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
byte *out;
|
byte *out;
|
||||||
|
@ -492,7 +493,7 @@ GL_MipMap ( byte *in, int width, int height )
|
||||||
* Returns has_alpha
|
* Returns has_alpha
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
GL_BuildPalettedTexture ( unsigned char *paletted_texture, unsigned char *scaled, int scaled_width, int scaled_height )
|
R_BuildPalettedTexture ( unsigned char *paletted_texture, unsigned char *scaled, int scaled_width, int scaled_height )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -513,7 +514,7 @@ GL_BuildPalettedTexture ( unsigned char *paletted_texture, unsigned char *scaled
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
R_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
||||||
{
|
{
|
||||||
int samples;
|
int samples;
|
||||||
unsigned scaled [ 256 * 256 ];
|
unsigned scaled [ 256 * 256 ];
|
||||||
|
@ -575,7 +576,7 @@ GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
||||||
|
|
||||||
if ( scaled_width * scaled_height > sizeof ( scaled ) / 4 )
|
if ( scaled_width * scaled_height > sizeof ( scaled ) / 4 )
|
||||||
{
|
{
|
||||||
ri.Sys_Error( ERR_DROP, "GL_Upload32: too big" );
|
ri.Sys_Error( ERR_DROP, "R_Upload32: too big" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scan the texture for any non-255 alpha */
|
/* scan the texture for any non-255 alpha */
|
||||||
|
@ -620,10 +621,10 @@ GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GL_ResampleTexture( data, width, height, scaled, scaled_width, scaled_height );
|
R_ResampleTexture( data, width, height, scaled, scaled_width, scaled_height );
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_LightScaleTexture( scaled, scaled_width, scaled_height, !mipmap );
|
R_LightScaleTexture( scaled, scaled_width, scaled_height, !mipmap );
|
||||||
qglTexImage2D( GL_TEXTURE_2D, 0, comp, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled );
|
qglTexImage2D( GL_TEXTURE_2D, 0, comp, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled );
|
||||||
|
|
||||||
if ( mipmap )
|
if ( mipmap )
|
||||||
|
@ -634,7 +635,7 @@ GL_Upload32 ( unsigned *data, int width, int height, qboolean mipmap )
|
||||||
|
|
||||||
while ( scaled_width > 1 || scaled_height > 1 )
|
while ( scaled_width > 1 || scaled_height > 1 )
|
||||||
{
|
{
|
||||||
GL_MipMap( (byte *) scaled, scaled_width, scaled_height );
|
R_MipMap( (byte *) scaled, scaled_width, scaled_height );
|
||||||
scaled_width >>= 1;
|
scaled_width >>= 1;
|
||||||
scaled_height >>= 1;
|
scaled_height >>= 1;
|
||||||
|
|
||||||
|
@ -673,7 +674,7 @@ done:
|
||||||
* Returns has_alpha
|
* Returns has_alpha
|
||||||
*/
|
*/
|
||||||
qboolean
|
qboolean
|
||||||
GL_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sky )
|
R_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sky )
|
||||||
{
|
{
|
||||||
unsigned trans [ 512 * 256 ];
|
unsigned trans [ 512 * 256 ];
|
||||||
int i, s;
|
int i, s;
|
||||||
|
@ -683,7 +684,7 @@ GL_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sk
|
||||||
|
|
||||||
if ( s > sizeof ( trans ) / 4 )
|
if ( s > sizeof ( trans ) / 4 )
|
||||||
{
|
{
|
||||||
ri.Sys_Error( ERR_DROP, "GL_Upload8: too large" );
|
ri.Sys_Error( ERR_DROP, "R_Upload8: too large" );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0; i < s; i++ )
|
for ( i = 0; i < s; i++ )
|
||||||
|
@ -723,14 +724,14 @@ GL_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( GL_Upload32( trans, width, height, mipmap ) );
|
return ( R_Upload32( trans, width, height, mipmap ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is also used as an entry point for the generated r_notexture
|
* This is also used as an entry point for the generated r_notexture
|
||||||
*/
|
*/
|
||||||
image_t *
|
image_t *
|
||||||
GL_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int bits )
|
R_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int bits )
|
||||||
{
|
{
|
||||||
image_t *image;
|
image_t *image;
|
||||||
int i;
|
int i;
|
||||||
|
@ -814,16 +815,16 @@ GL_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int
|
||||||
nonscrap:
|
nonscrap:
|
||||||
image->scrap = false;
|
image->scrap = false;
|
||||||
image->texnum = TEXNUM_IMAGES + ( image - gltextures );
|
image->texnum = TEXNUM_IMAGES + ( image - gltextures );
|
||||||
GL_Bind( image->texnum );
|
R_Bind( image->texnum );
|
||||||
|
|
||||||
if ( bits == 8 )
|
if ( bits == 8 )
|
||||||
{
|
{
|
||||||
image->has_alpha = GL_Upload8( pic, width, height, ( image->type != it_pic && image->type != it_sky ),
|
image->has_alpha = R_Upload8( pic, width, height, ( image->type != it_pic && image->type != it_sky ),
|
||||||
image->type == it_sky );
|
image->type == it_sky );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image->has_alpha = GL_Upload32( (unsigned *) pic, width, height, ( image->type != it_pic && image->type != it_sky ) );
|
image->has_alpha = R_Upload32( (unsigned *) pic, width, height, ( image->type != it_pic && image->type != it_sky ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
image->upload_width = upload_width; /* after power of 2 and scales */
|
image->upload_width = upload_width; /* after power of 2 and scales */
|
||||||
|
@ -842,7 +843,7 @@ GL_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int
|
||||||
* Finds or loads the given image
|
* Finds or loads the given image
|
||||||
*/
|
*/
|
||||||
image_t *
|
image_t *
|
||||||
GL_FindImage ( char *name, imagetype_t type )
|
R_FindImage ( char *name, imagetype_t type )
|
||||||
{
|
{
|
||||||
image_t *image;
|
image_t *image;
|
||||||
int i, len;
|
int i, len;
|
||||||
|
@ -891,11 +892,11 @@ GL_FindImage ( char *name, imagetype_t type )
|
||||||
return ( NULL );
|
return ( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
image = GL_LoadPic( name, pic, width, height, type, 8 );
|
image = R_LoadPic( name, pic, width, height, type, 8 );
|
||||||
}
|
}
|
||||||
else if ( !strcmp( name + len - 4, ".wal" ) )
|
else if ( !strcmp( name + len - 4, ".wal" ) )
|
||||||
{
|
{
|
||||||
image = R_LoadWal( name );
|
image = LoadWal( name );
|
||||||
}
|
}
|
||||||
else if ( !strcmp( name + len - 4, ".tga" ) )
|
else if ( !strcmp( name + len - 4, ".tga" ) )
|
||||||
{
|
{
|
||||||
|
@ -906,7 +907,7 @@ GL_FindImage ( char *name, imagetype_t type )
|
||||||
return ( NULL );
|
return ( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
image = GL_LoadPic( name, pic, width, height, type, 32 );
|
image = R_LoadPic( name, pic, width, height, type, 32 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -929,7 +930,7 @@ GL_FindImage ( char *name, imagetype_t type )
|
||||||
struct image_s *
|
struct image_s *
|
||||||
R_RegisterSkin ( char *name )
|
R_RegisterSkin ( char *name )
|
||||||
{
|
{
|
||||||
return ( GL_FindImage( name, it_skin ) );
|
return ( R_FindImage( name, it_skin ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -938,7 +939,7 @@ R_RegisterSkin ( char *name )
|
||||||
* will be freed.
|
* will be freed.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
GL_FreeUnusedImages ( void )
|
R_FreeUnusedImages ( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
image_t *image;
|
image_t *image;
|
||||||
|
@ -970,43 +971,8 @@ GL_FreeUnusedImages ( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
Draw_GetPalette ( void )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int r, g, b;
|
|
||||||
unsigned v;
|
|
||||||
byte *pic, *pal;
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
/* get the palette */
|
|
||||||
LoadPCX( "pics/colormap.pcx", &pic, &pal, &width, &height );
|
|
||||||
|
|
||||||
if ( !pal )
|
|
||||||
{
|
|
||||||
ri.Sys_Error( ERR_FATAL, "Couldn't load pics/colormap.pcx" );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( i = 0; i < 256; i++ )
|
|
||||||
{
|
|
||||||
r = pal [ i * 3 + 0 ];
|
|
||||||
g = pal [ i * 3 + 1 ];
|
|
||||||
b = pal [ i * 3 + 2 ];
|
|
||||||
|
|
||||||
v = ( 255 << 24 ) + ( r << 0 ) + ( g << 8 ) + ( b << 16 );
|
|
||||||
d_8to24table [ i ] = LittleLong( v );
|
|
||||||
}
|
|
||||||
|
|
||||||
d_8to24table [ 255 ] &= LittleLong( 0xffffff ); /* 255 is transparent */
|
|
||||||
|
|
||||||
free( pic );
|
|
||||||
free( pal );
|
|
||||||
|
|
||||||
return ( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_InitImages ( void )
|
R_InitImages ( void )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
float g = vid_gamma->value;
|
float g = vid_gamma->value;
|
||||||
|
@ -1075,7 +1041,7 @@ GL_InitImages ( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GL_ShutdownImages ( void )
|
R_ShutdownImages ( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
image_t *image;
|
image_t *image;
|
||||||
|
|
|
@ -732,12 +732,12 @@ R_DrawAliasModel ( entity_t *e )
|
||||||
skin = r_notexture; /* fallback... */
|
skin = r_notexture; /* fallback... */
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Bind( skin->texnum );
|
R_Bind( skin->texnum );
|
||||||
|
|
||||||
/* draw it */
|
/* draw it */
|
||||||
qglShadeModel( GL_SMOOTH );
|
qglShadeModel( GL_SMOOTH );
|
||||||
|
|
||||||
GL_TexEnv( GL_MODULATE );
|
R_TexEnv( GL_MODULATE );
|
||||||
|
|
||||||
if ( currententity->flags & RF_TRANSLUCENT )
|
if ( currententity->flags & RF_TRANSLUCENT )
|
||||||
{
|
{
|
||||||
|
@ -769,7 +769,7 @@ R_DrawAliasModel ( entity_t *e )
|
||||||
|
|
||||||
GL_DrawAliasFrameLerp( paliashdr, currententity->backlerp );
|
GL_DrawAliasFrameLerp( paliashdr, currententity->backlerp );
|
||||||
|
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
qglShadeModel( GL_FLAT );
|
qglShadeModel( GL_FLAT );
|
||||||
|
|
||||||
qglPopMatrix();
|
qglPopMatrix();
|
||||||
|
|
|
@ -466,7 +466,7 @@ Mod_LoadTexinfo ( lump_t *l )
|
||||||
|
|
||||||
Com_sprintf( name, sizeof ( name ), "textures/%s.wal", in->texture );
|
Com_sprintf( name, sizeof ( name ), "textures/%s.wal", in->texture );
|
||||||
|
|
||||||
out->image = GL_FindImage( name, it_wall );
|
out->image = R_FindImage( name, it_wall );
|
||||||
|
|
||||||
if ( !out->image )
|
if ( !out->image )
|
||||||
{
|
{
|
||||||
|
@ -988,7 +988,7 @@ R_RegisterModel ( char *name )
|
||||||
|
|
||||||
for ( i = 0; i < sprout->numframes; i++ )
|
for ( i = 0; i < sprout->numframes; i++ )
|
||||||
{
|
{
|
||||||
mod->skins [ i ] = GL_FindImage( sprout->frames [ i ].name, it_sprite );
|
mod->skins [ i ] = R_FindImage( sprout->frames [ i ].name, it_sprite );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( mod->type == mod_alias )
|
else if ( mod->type == mod_alias )
|
||||||
|
@ -997,7 +997,7 @@ R_RegisterModel ( char *name )
|
||||||
|
|
||||||
for ( i = 0; i < pheader->num_skins; i++ )
|
for ( i = 0; i < pheader->num_skins; i++ )
|
||||||
{
|
{
|
||||||
mod->skins [ i ] = GL_FindImage( (char *) pheader + pheader->ofs_skins + i * MAX_SKINNAME, it_skin );
|
mod->skins [ i ] = R_FindImage( (char *) pheader + pheader->ofs_skins + i * MAX_SKINNAME, it_skin );
|
||||||
}
|
}
|
||||||
|
|
||||||
mod->numframes = pheader->num_frames;
|
mod->numframes = pheader->num_frames;
|
||||||
|
@ -1034,7 +1034,7 @@ R_EndRegistration ( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_FreeUnusedImages();
|
R_FreeUnusedImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -217,9 +217,9 @@ R_DrawSpriteModel ( entity_t *e )
|
||||||
|
|
||||||
qglColor4f( 1, 1, 1, alpha );
|
qglColor4f( 1, 1, 1, alpha );
|
||||||
|
|
||||||
GL_Bind( currentmodel->skins [ e->frame ]->texnum );
|
R_Bind( currentmodel->skins [ e->frame ]->texnum );
|
||||||
|
|
||||||
GL_TexEnv( GL_MODULATE );
|
R_TexEnv( GL_MODULATE );
|
||||||
|
|
||||||
if ( alpha == 1.0 )
|
if ( alpha == 1.0 )
|
||||||
{
|
{
|
||||||
|
@ -255,7 +255,7 @@ R_DrawSpriteModel ( entity_t *e )
|
||||||
qglEnd();
|
qglEnd();
|
||||||
|
|
||||||
qglDisable( GL_ALPHA_TEST );
|
qglDisable( GL_ALPHA_TEST );
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
|
|
||||||
if ( alpha != 1.0F )
|
if ( alpha != 1.0F )
|
||||||
{
|
{
|
||||||
|
@ -421,10 +421,10 @@ GL_DrawParticles ( int num_particles, const particle_t particles[], const unsign
|
||||||
float scale;
|
float scale;
|
||||||
byte color [ 4 ];
|
byte color [ 4 ];
|
||||||
|
|
||||||
GL_Bind( r_particletexture->texnum );
|
R_Bind( r_particletexture->texnum );
|
||||||
qglDepthMask( GL_FALSE ); /* no z buffering */
|
qglDepthMask( GL_FALSE ); /* no z buffering */
|
||||||
qglEnable( GL_BLEND );
|
qglEnable( GL_BLEND );
|
||||||
GL_TexEnv( GL_MODULATE );
|
R_TexEnv( GL_MODULATE );
|
||||||
qglBegin( GL_TRIANGLES );
|
qglBegin( GL_TRIANGLES );
|
||||||
|
|
||||||
VectorScale( vup, 1.5, up );
|
VectorScale( vup, 1.5, up );
|
||||||
|
@ -469,7 +469,7 @@ GL_DrawParticles ( int num_particles, const particle_t particles[], const unsign
|
||||||
qglDisable( GL_BLEND );
|
qglDisable( GL_BLEND );
|
||||||
qglColor4f( 1, 1, 1, 1 );
|
qglColor4f( 1, 1, 1, 1 );
|
||||||
qglDepthMask( 1 ); /* back to normal Z buffering */
|
qglDepthMask( 1 ); /* back to normal Z buffering */
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -988,7 +988,7 @@ R_Register ( void )
|
||||||
gl_customwidth = ri.Cvar_Get( "gl_customwidth", "1024", CVAR_ARCHIVE );
|
gl_customwidth = ri.Cvar_Get( "gl_customwidth", "1024", CVAR_ARCHIVE );
|
||||||
gl_customheight = ri.Cvar_Get( "gl_customheight", "768", CVAR_ARCHIVE );
|
gl_customheight = ri.Cvar_Get( "gl_customheight", "768", CVAR_ARCHIVE );
|
||||||
|
|
||||||
ri.Cmd_AddCommand( "imagelist", GL_ImageList_f );
|
ri.Cmd_AddCommand( "imagelist", R_ImageList_f );
|
||||||
ri.Cmd_AddCommand( "screenshot", GL_ScreenShot_f );
|
ri.Cmd_AddCommand( "screenshot", GL_ScreenShot_f );
|
||||||
ri.Cmd_AddCommand( "modellist", Mod_Modellist_f );
|
ri.Cmd_AddCommand( "modellist", Mod_Modellist_f );
|
||||||
ri.Cmd_AddCommand( "gl_strings", GL_Strings_f );
|
ri.Cmd_AddCommand( "gl_strings", GL_Strings_f );
|
||||||
|
@ -1156,7 +1156,7 @@ R_Init ( void *hinstance, void *hWnd )
|
||||||
|
|
||||||
GL_SetDefaultState();
|
GL_SetDefaultState();
|
||||||
|
|
||||||
GL_InitImages();
|
R_InitImages();
|
||||||
Mod_Init();
|
Mod_Init();
|
||||||
R_InitParticleTexture();
|
R_InitParticleTexture();
|
||||||
Draw_InitLocal();
|
Draw_InitLocal();
|
||||||
|
@ -1181,7 +1181,7 @@ R_Shutdown ( void )
|
||||||
|
|
||||||
Mod_FreeAll();
|
Mod_FreeAll();
|
||||||
|
|
||||||
GL_ShutdownImages();
|
R_ShutdownImages();
|
||||||
|
|
||||||
/* shut down OS specific OpenGL stuff like contexts, etc. */
|
/* shut down OS specific OpenGL stuff like contexts, etc. */
|
||||||
GLimp_Shutdown();
|
GLimp_Shutdown();
|
||||||
|
@ -1261,19 +1261,19 @@ R_BeginFrame ( float camera_separation )
|
||||||
/* texturemode stuff */
|
/* texturemode stuff */
|
||||||
if ( gl_texturemode->modified )
|
if ( gl_texturemode->modified )
|
||||||
{
|
{
|
||||||
GL_TextureMode( gl_texturemode->string );
|
R_TextureMode( gl_texturemode->string );
|
||||||
gl_texturemode->modified = false;
|
gl_texturemode->modified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( gl_texturealphamode->modified )
|
if ( gl_texturealphamode->modified )
|
||||||
{
|
{
|
||||||
GL_TextureAlphaMode( gl_texturealphamode->string );
|
R_TextureAlphaMode( gl_texturealphamode->string );
|
||||||
gl_texturealphamode->modified = false;
|
gl_texturealphamode->modified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( gl_texturesolidmode->modified )
|
if ( gl_texturesolidmode->modified )
|
||||||
{
|
{
|
||||||
GL_TextureSolidMode( gl_texturesolidmode->string );
|
R_TextureSolidMode( gl_texturesolidmode->string );
|
||||||
gl_texturesolidmode->modified = false;
|
gl_texturesolidmode->modified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ R_InitParticleTexture ( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r_particletexture = GL_LoadPic( "***particle***", (byte *) data, 8, 8, it_sprite, 32 );
|
r_particletexture = R_LoadPic( "***particle***", (byte *) data, 8, 8, it_sprite, 32 );
|
||||||
|
|
||||||
/* also use this for bad textures, but without alpha */
|
/* also use this for bad textures, but without alpha */
|
||||||
for ( x = 0; x < 8; x++ )
|
for ( x = 0; x < 8; x++ )
|
||||||
|
@ -74,7 +74,7 @@ R_InitParticleTexture ( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r_notexture = GL_LoadPic( "***r_notexture***", (byte *) data, 8, 8, it_wall, 32 );
|
r_notexture = R_LoadPic( "***r_notexture***", (byte *) data, 8, 8, it_wall, 32 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -171,9 +171,9 @@ GL_SetDefaultState ( void )
|
||||||
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
||||||
qglShadeModel( GL_FLAT );
|
qglShadeModel( GL_FLAT );
|
||||||
|
|
||||||
GL_TextureMode( gl_texturemode->string );
|
R_TextureMode( gl_texturemode->string );
|
||||||
GL_TextureAlphaMode( gl_texturealphamode->string );
|
R_TextureAlphaMode( gl_texturealphamode->string );
|
||||||
GL_TextureSolidMode( gl_texturesolidmode->string );
|
R_TextureSolidMode( gl_texturesolidmode->string );
|
||||||
|
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
||||||
|
@ -183,7 +183,7 @@ GL_SetDefaultState ( void )
|
||||||
|
|
||||||
qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||||
|
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
|
|
||||||
if ( qglPointParameterfEXT )
|
if ( qglPointParameterfEXT )
|
||||||
{
|
{
|
||||||
|
|
|
@ -273,7 +273,7 @@ R_BlendLightmaps ( void )
|
||||||
c_visible_lightmaps++;
|
c_visible_lightmaps++;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Bind( gl_state.lightmap_textures + i );
|
R_Bind( gl_state.lightmap_textures + i );
|
||||||
|
|
||||||
for ( surf = gl_lms.lightmap_surfaces [ i ]; surf != 0; surf = surf->lightmapchain )
|
for ( surf = gl_lms.lightmap_surfaces [ i ]; surf != 0; surf = surf->lightmapchain )
|
||||||
{
|
{
|
||||||
|
@ -290,7 +290,7 @@ R_BlendLightmaps ( void )
|
||||||
{
|
{
|
||||||
LM_InitBlock();
|
LM_InitBlock();
|
||||||
|
|
||||||
GL_Bind( gl_state.lightmap_textures + 0 );
|
R_Bind( gl_state.lightmap_textures + 0 );
|
||||||
|
|
||||||
if ( currentmodel == r_worldmodel )
|
if ( currentmodel == r_worldmodel )
|
||||||
{
|
{
|
||||||
|
@ -385,24 +385,24 @@ R_RenderBrushPoly ( msurface_t *fa )
|
||||||
|
|
||||||
if ( fa->flags & SURF_DRAWTURB )
|
if ( fa->flags & SURF_DRAWTURB )
|
||||||
{
|
{
|
||||||
GL_Bind( image->texnum );
|
R_Bind( image->texnum );
|
||||||
|
|
||||||
/* warp texture, no lightmaps */
|
/* warp texture, no lightmaps */
|
||||||
GL_TexEnv( GL_MODULATE );
|
R_TexEnv( GL_MODULATE );
|
||||||
qglColor4f( gl_state.inverse_intensity,
|
qglColor4f( gl_state.inverse_intensity,
|
||||||
gl_state.inverse_intensity,
|
gl_state.inverse_intensity,
|
||||||
gl_state.inverse_intensity,
|
gl_state.inverse_intensity,
|
||||||
1.0F );
|
1.0F );
|
||||||
EmitWaterPolys( fa );
|
EmitWaterPolys( fa );
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GL_Bind( image->texnum );
|
R_Bind( image->texnum );
|
||||||
|
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fa->texinfo->flags & SURF_FLOWING )
|
if ( fa->texinfo->flags & SURF_FLOWING )
|
||||||
|
@ -450,7 +450,7 @@ R_RenderBrushPoly ( msurface_t *fa )
|
||||||
R_BuildLightMap( fa, (void *) temp, smax * 4 );
|
R_BuildLightMap( fa, (void *) temp, smax * 4 );
|
||||||
R_SetCacheState( fa );
|
R_SetCacheState( fa );
|
||||||
|
|
||||||
GL_Bind( gl_state.lightmap_textures + fa->lightmaptexturenum );
|
R_Bind( gl_state.lightmap_textures + fa->lightmaptexturenum );
|
||||||
|
|
||||||
qglTexSubImage2D( GL_TEXTURE_2D, 0,
|
qglTexSubImage2D( GL_TEXTURE_2D, 0,
|
||||||
fa->light_s, fa->light_t,
|
fa->light_s, fa->light_t,
|
||||||
|
@ -489,7 +489,7 @@ R_DrawAlphaSurfaces ( void )
|
||||||
qglLoadMatrixf( r_world_matrix );
|
qglLoadMatrixf( r_world_matrix );
|
||||||
|
|
||||||
qglEnable( GL_BLEND );
|
qglEnable( GL_BLEND );
|
||||||
GL_TexEnv( GL_MODULATE );
|
R_TexEnv( GL_MODULATE );
|
||||||
|
|
||||||
/* the textures are prescaled up for a better lighting range,
|
/* the textures are prescaled up for a better lighting range,
|
||||||
so scale it back down */
|
so scale it back down */
|
||||||
|
@ -497,7 +497,7 @@ R_DrawAlphaSurfaces ( void )
|
||||||
|
|
||||||
for ( s = r_alpha_surfaces; s; s = s->texturechain )
|
for ( s = r_alpha_surfaces; s; s = s->texturechain )
|
||||||
{
|
{
|
||||||
GL_Bind( s->texinfo->image->texnum );
|
R_Bind( s->texinfo->image->texnum );
|
||||||
c_brush_polys++;
|
c_brush_polys++;
|
||||||
|
|
||||||
if ( s->texinfo->flags & SURF_TRANS33 )
|
if ( s->texinfo->flags & SURF_TRANS33 )
|
||||||
|
@ -527,7 +527,7 @@ R_DrawAlphaSurfaces ( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
qglColor4f( 1, 1, 1, 1 );
|
qglColor4f( 1, 1, 1, 1 );
|
||||||
qglDisable( GL_BLEND );
|
qglDisable( GL_BLEND );
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ DrawTextureChains ( void )
|
||||||
image->texturechain = NULL;
|
image->texturechain = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -596,7 +596,7 @@ R_DrawInlineBModel ( void )
|
||||||
{
|
{
|
||||||
qglEnable( GL_BLEND );
|
qglEnable( GL_BLEND );
|
||||||
qglColor4f( 1, 1, 1, 0.25 );
|
qglColor4f( 1, 1, 1, 0.25 );
|
||||||
GL_TexEnv( GL_MODULATE );
|
R_TexEnv( GL_MODULATE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw texture */
|
/* draw texture */
|
||||||
|
@ -632,7 +632,7 @@ R_DrawInlineBModel ( void )
|
||||||
{
|
{
|
||||||
qglDisable( GL_BLEND );
|
qglDisable( GL_BLEND );
|
||||||
qglColor4f( 1, 1, 1, 1 );
|
qglColor4f( 1, 1, 1, 1 );
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,8 +697,8 @@ R_DrawBrushModel ( entity_t *e )
|
||||||
e->angles [ 0 ] = -e->angles [ 0 ];
|
e->angles [ 0 ] = -e->angles [ 0 ];
|
||||||
e->angles [ 2 ] = -e->angles [ 2 ];
|
e->angles [ 2 ] = -e->angles [ 2 ];
|
||||||
|
|
||||||
GL_TexEnv( GL_REPLACE );
|
R_TexEnv( GL_REPLACE );
|
||||||
GL_TexEnv( GL_MODULATE );
|
R_TexEnv( GL_MODULATE );
|
||||||
|
|
||||||
R_DrawInlineBModel();
|
R_DrawInlineBModel();
|
||||||
|
|
||||||
|
@ -983,7 +983,7 @@ LM_UploadBlock ( qboolean dynamic )
|
||||||
texture = gl_lms.current_lightmap_texture;
|
texture = gl_lms.current_lightmap_texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Bind( gl_state.lightmap_textures + texture );
|
R_Bind( gl_state.lightmap_textures + texture );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||||
|
|
||||||
|
@ -1209,7 +1209,7 @@ GL_BeginBuildingLightmaps ( model_t *m )
|
||||||
gl_lms.internal_format = gl_tex_solid_format;
|
gl_lms.internal_format = gl_tex_solid_format;
|
||||||
|
|
||||||
/* initialize the dynamic lightmap texture */
|
/* initialize the dynamic lightmap texture */
|
||||||
GL_Bind( gl_state.lightmap_textures + 0 );
|
R_Bind( gl_state.lightmap_textures + 0 );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||||
qglTexImage2D( GL_TEXTURE_2D,
|
qglTexImage2D( GL_TEXTURE_2D,
|
||||||
|
|
|
@ -88,8 +88,8 @@ void
|
||||||
Scrap_Upload ( void )
|
Scrap_Upload ( void )
|
||||||
{
|
{
|
||||||
scrap_uploads++;
|
scrap_uploads++;
|
||||||
GL_Bind( TEXNUM_SCRAPS );
|
R_Bind( TEXNUM_SCRAPS );
|
||||||
GL_Upload8( scrap_texels [ 0 ], BLOCK_WIDTH, BLOCK_HEIGHT, false, false );
|
R_Upload8( scrap_texels [ 0 ], BLOCK_WIDTH, BLOCK_HEIGHT, false, false );
|
||||||
scrap_dirty = false;
|
scrap_dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -663,7 +663,7 @@ R_DrawSkyBox ( void )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Bind( sky_images [ skytexorder [ i ] ]->texnum );
|
R_Bind( sky_images [ skytexorder [ i ] ]->texnum );
|
||||||
|
|
||||||
qglBegin( GL_QUADS );
|
qglBegin( GL_QUADS );
|
||||||
MakeSkyVec( skymins [ 0 ] [ i ], skymins [ 1 ] [ i ], i );
|
MakeSkyVec( skymins [ 0 ] [ i ], skymins [ 1 ] [ i ], i );
|
||||||
|
@ -690,7 +690,7 @@ R_SetSky ( char *name, float rotate, vec3_t axis )
|
||||||
{
|
{
|
||||||
Com_sprintf( pathname, sizeof ( pathname ), "env/%s%s.tga", skyname, suf [ i ] );
|
Com_sprintf( pathname, sizeof ( pathname ), "env/%s%s.tga", skyname, suf [ i ] );
|
||||||
|
|
||||||
sky_images [ i ] = GL_FindImage( pathname, it_sky );
|
sky_images [ i ] = R_FindImage( pathname, it_sky );
|
||||||
|
|
||||||
if ( !sky_images [ i ] )
|
if ( !sky_images [ i ] )
|
||||||
{
|
{
|
||||||
|
|
|
@ -238,9 +238,9 @@ extern int c_visible_textures;
|
||||||
extern float r_world_matrix [ 16 ];
|
extern float r_world_matrix [ 16 ];
|
||||||
|
|
||||||
void R_TranslatePlayerSkin ( int playernum );
|
void R_TranslatePlayerSkin ( int playernum );
|
||||||
void GL_Bind ( int texnum );
|
void R_Bind ( int texnum );
|
||||||
void GL_MBind ( GLenum target, int texnum );
|
void R_MBind ( GLenum target, int texnum );
|
||||||
void GL_TexEnv ( GLenum value );
|
void R_TexEnv ( GLenum value );
|
||||||
|
|
||||||
void R_LightPoint ( vec3_t p, vec3_t color );
|
void R_LightPoint ( vec3_t p, vec3_t color );
|
||||||
void R_PushDlights ( void );
|
void R_PushDlights ( void );
|
||||||
|
@ -294,23 +294,23 @@ void R_SetPalette ( const unsigned char *palette );
|
||||||
|
|
||||||
int Draw_GetPalette ( void );
|
int Draw_GetPalette ( void );
|
||||||
|
|
||||||
void GL_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight );
|
void R_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight );
|
||||||
|
|
||||||
struct image_s *R_RegisterSkin ( char *name );
|
struct image_s *R_RegisterSkin ( char *name );
|
||||||
|
|
||||||
void LoadPCX ( char *filename, byte **pic, byte **palette, int *width, int *height );
|
void LoadPCX ( char *filename, byte **pic, byte **palette, int *width, int *height );
|
||||||
image_t *GL_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int bits );
|
image_t *R_LoadPic ( char *name, byte *pic, int width, int height, imagetype_t type, int bits );
|
||||||
image_t *GL_FindImage ( char *name, imagetype_t type );
|
image_t *R_FindImage ( char *name, imagetype_t type );
|
||||||
void GL_TextureMode ( char *string );
|
void R_TextureMode ( char *string );
|
||||||
void GL_ImageList_f ( void );
|
void R_ImageList_f ( void );
|
||||||
|
|
||||||
void GL_InitImages ( void );
|
void R_InitImages ( void );
|
||||||
void GL_ShutdownImages ( void );
|
void R_ShutdownImages ( void );
|
||||||
|
|
||||||
void GL_FreeUnusedImages ( void );
|
void R_FreeUnusedImages ( void );
|
||||||
|
|
||||||
void GL_TextureAlphaMode ( char *string );
|
void R_TextureAlphaMode ( char *string );
|
||||||
void GL_TextureSolidMode ( char *string );
|
void R_TextureSolidMode ( char *string );
|
||||||
int Scrap_AllocBlock ( int w, int h, int *x, int *y );
|
int Scrap_AllocBlock ( int w, int h, int *x, int *y );
|
||||||
|
|
||||||
/* GL extension emulation functions */
|
/* GL extension emulation functions */
|
||||||
|
|
|
@ -36,8 +36,8 @@ void
|
||||||
Draw_InitLocal ( void )
|
Draw_InitLocal ( void )
|
||||||
{
|
{
|
||||||
/* load console characters (don't bilerp characters) */
|
/* load console characters (don't bilerp characters) */
|
||||||
draw_chars = GL_FindImage( "pics/conchars.pcx", it_pic );
|
draw_chars = R_FindImage( "pics/conchars.pcx", it_pic );
|
||||||
GL_Bind( draw_chars->texnum );
|
R_Bind( draw_chars->texnum );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ Draw_Char ( int x, int y, int num )
|
||||||
fcol = col * 0.0625;
|
fcol = col * 0.0625;
|
||||||
size = 0.0625;
|
size = 0.0625;
|
||||||
|
|
||||||
GL_Bind( draw_chars->texnum );
|
R_Bind( draw_chars->texnum );
|
||||||
|
|
||||||
qglBegin( GL_QUADS );
|
qglBegin( GL_QUADS );
|
||||||
qglTexCoord2f( fcol, frow );
|
qglTexCoord2f( fcol, frow );
|
||||||
|
@ -95,11 +95,11 @@ Draw_FindPic ( char *name )
|
||||||
if ( ( name [ 0 ] != '/' ) && ( name [ 0 ] != '\\' ) )
|
if ( ( name [ 0 ] != '/' ) && ( name [ 0 ] != '\\' ) )
|
||||||
{
|
{
|
||||||
Com_sprintf( fullname, sizeof ( fullname ), "pics/%s.pcx", name );
|
Com_sprintf( fullname, sizeof ( fullname ), "pics/%s.pcx", name );
|
||||||
gl = GL_FindImage( fullname, it_pic );
|
gl = R_FindImage( fullname, it_pic );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gl = GL_FindImage( name + 1, it_pic );
|
gl = R_FindImage( name + 1, it_pic );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( gl );
|
return ( gl );
|
||||||
|
@ -140,7 +140,7 @@ Draw_StretchPic ( int x, int y, int w, int h, char *pic )
|
||||||
Scrap_Upload();
|
Scrap_Upload();
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Bind( gl->texnum );
|
R_Bind( gl->texnum );
|
||||||
qglBegin( GL_QUADS );
|
qglBegin( GL_QUADS );
|
||||||
qglTexCoord2f( gl->sl, gl->tl );
|
qglTexCoord2f( gl->sl, gl->tl );
|
||||||
qglVertex2f( x, y );
|
qglVertex2f( x, y );
|
||||||
|
@ -171,7 +171,7 @@ Draw_Pic ( int x, int y, char *pic )
|
||||||
Scrap_Upload();
|
Scrap_Upload();
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Bind( gl->texnum );
|
R_Bind( gl->texnum );
|
||||||
qglBegin( GL_QUADS );
|
qglBegin( GL_QUADS );
|
||||||
qglTexCoord2f( gl->sl, gl->tl );
|
qglTexCoord2f( gl->sl, gl->tl );
|
||||||
qglVertex2f( x, y );
|
qglVertex2f( x, y );
|
||||||
|
@ -202,7 +202,7 @@ Draw_TileClear ( int x, int y, int w, int h, char *pic )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Bind( image->texnum );
|
R_Bind( image->texnum );
|
||||||
qglBegin( GL_QUADS );
|
qglBegin( GL_QUADS );
|
||||||
qglTexCoord2f( x / 64.0, y / 64.0 );
|
qglTexCoord2f( x / 64.0, y / 64.0 );
|
||||||
qglVertex2f( x, y );
|
qglVertex2f( x, y );
|
||||||
|
@ -283,7 +283,7 @@ Draw_StretchRaw ( int x, int y, int w, int h, int cols, int rows, byte *data )
|
||||||
int row;
|
int row;
|
||||||
float t;
|
float t;
|
||||||
|
|
||||||
GL_Bind( 0 );
|
R_Bind( 0 );
|
||||||
|
|
||||||
if ( rows <= 256 )
|
if ( rows <= 256 )
|
||||||
{
|
{
|
||||||
|
@ -375,3 +375,38 @@ Draw_StretchRaw ( int x, int y, int w, int h, int cols, int rows, byte *data )
|
||||||
qglEnd();
|
qglEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Draw_GetPalette ( void )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int r, g, b;
|
||||||
|
unsigned v;
|
||||||
|
byte *pic, *pal;
|
||||||
|
int width, height;
|
||||||
|
|
||||||
|
/* get the palette */
|
||||||
|
LoadPCX( "pics/colormap.pcx", &pic, &pal, &width, &height );
|
||||||
|
|
||||||
|
if ( !pal )
|
||||||
|
{
|
||||||
|
ri.Sys_Error( ERR_FATAL, "Couldn't load pics/colormap.pcx" );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( i = 0; i < 256; i++ )
|
||||||
|
{
|
||||||
|
r = pal [ i * 3 + 0 ];
|
||||||
|
g = pal [ i * 3 + 1 ];
|
||||||
|
b = pal [ i * 3 + 2 ];
|
||||||
|
|
||||||
|
v = ( 255 << 24 ) + ( r << 0 ) + ( g << 8 ) + ( b << 16 );
|
||||||
|
d_8to24table [ i ] = LittleLong( v );
|
||||||
|
}
|
||||||
|
|
||||||
|
d_8to24table [ 255 ] &= LittleLong( 0xffffff ); /* 255 is transparent */
|
||||||
|
|
||||||
|
free( pic );
|
||||||
|
free( pal );
|
||||||
|
|
||||||
|
return ( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue