28 Aug 2018

This commit is contained in:
g-cont 2018-08-28 00:00:00 +03:00 committed by Alibek Omarov
parent 3368434b67
commit 4ff34d3c2b
10 changed files with 37 additions and 45 deletions

View File

@ -216,8 +216,8 @@ typedef struct render_api_s
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
const struct ref_overview_s *( *GetOverviewParms )( void );
const char *( *GetFileByIndex )( int fileindex );
void (*R_Reserved1)( void ); // for potential interface expansion without broken compatibility
void (*R_Reserved2)( void );
void (*R_Reserved0)( void ); // for potential interface expansion without broken compatibility
void (*R_Reserved1)( void );
// static allocations
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );

View File

@ -456,7 +456,7 @@ static size_t GL_CalcTextureSize( GLenum format, int width, int height, int dept
size = width * height * depth * 2;
break;
case GL_DEPTH_COMPONENT24:
size = width * height * depth * 4;
size = width * height * depth * 3;
break;
case GL_DEPTH_COMPONENT32F:
size = width * height * depth * 4;
@ -1920,7 +1920,7 @@ static void GL_CreateInternalTextures( void )
{
dy = y - 8;
d = 255 - 35 * sqrt( dx2 + dy * dy );
pic->buffer[( y*16 + x ) * 4 + 3] = bound( 0, d, 255 );
pic->buffer[( y * 16 + x ) * 4 + 3] = bound( 0, d, 255 );
}
}
@ -1938,12 +1938,13 @@ static void GL_CreateInternalTextures( void )
((uint *)pic->buffer)[x] = 0xFF7F7F7F;
tr.grayTexture = GL_LoadTextureInternal( "*gray", pic, TF_COLORMAP );
// black texture
pic = GL_FakeImage( 4, 4, 1, IMAGE_HAS_COLOR );
for( x = 0; x < 16; x++ )
((uint *)pic->buffer)[x] = 0xFF000000;
tr.blackTexture = GL_LoadTextureInternal( "*black", pic, TF_COLORMAP );
// cinematic
// cinematic dummy
pic = GL_FakeImage( 640, 100, 1, IMAGE_HAS_COLOR );
tr.cinTexture = GL_LoadTextureInternal( "*cintexture", pic, TF_NOMIPMAP|TF_CLAMP );
}

View File

@ -202,7 +202,7 @@ void R_ParseTexFilters( const char *filename )
tf->filter = filter;
}
MsgDev( D_INFO, "%i texture filters parsed\n", num_texfilters );
Con_Reportf( "%i texture filters parsed\n", num_texfilters );
Mem_Free( afile );
}

View File

@ -1005,6 +1005,11 @@ static qboolean FS_ParseLiblistGam( const char *filename, const char *gamedir, g
pfile = COM_ParseFile( pfile, token );
GameInfo->size = Q_atoi( token );
}
else if( !Q_stricmp( token, "edicts" ))
{
pfile = COM_ParseFile( pfile, token );
GameInfo->max_edicts = Q_atoi( token );
}
else if( !Q_stricmp( token, "mpentity" ))
{
pfile = COM_ParseFile( pfile, GameInfo->mp_entity );

View File

@ -47,16 +47,6 @@ static const suffix_t skybox_qv2[6] =
static const suffix_t cubemap_v1[6] =
{
{ "posx", 0, CB_HINT_POSX },
{ "negx", 0, CB_HINT_NEGX },
{ "posy", 0, CB_HINT_POSY },
{ "negy", 0, CB_HINT_NEGY },
{ "posz", 0, CB_HINT_POSZ },
{ "negz", 0, CB_HINT_NEGZ },
};
static const suffix_t cubemap_v2[6] =
{
{ "px", 0, CB_HINT_POSX },
{ "nx", 0, CB_HINT_NEGX },
{ "py", 0, CB_HINT_POSY },
@ -75,8 +65,7 @@ static const cubepack_t load_cubemap[] =
{
{ "3Ds Sky1", skybox_qv1 },
{ "3Ds Sky2", skybox_qv2 },
{ "3Ds Cube", cubemap_v2 },
{ "Tenebrae", cubemap_v1 },
{ "3Ds Cube", cubemap_v1 },
{ NULL, NULL },
};
@ -230,8 +219,8 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
const cubepack_t *cmap;
byte *f;
Image_Reset(); // clear old image
Q_strncpy( loadname, filename, sizeof( loadname ));
Image_Reset(); // clear old image
if( Q_stricmp( ext, "" ))
{
@ -260,6 +249,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
Q_sprintf( path, format->formatstring, loadname, "", format->ext );
image.hint = format->hint;
f = FS_LoadFile( path, &filesize, false );
if( f && filesize > 0 )
{
if( format->loadfunc( path, f, filesize ))
@ -267,7 +257,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
Mem_Free( f ); // release buffer
return ImagePack(); // loaded
}
else Mem_Free(f); // release buffer
else Mem_Free( f ); // release buffer
}
}
}
@ -391,7 +381,7 @@ qboolean FS_SaveImage( const char *filename, rgbdata_t *pix )
if( pix->flags & IMAGE_SKYBOX )
box = skybox_qv1;
else if( pix->flags & IMAGE_CUBEMAP )
box = cubemap_v2;
box = cubemap_v1;
else
{
// clear any force flags

View File

@ -245,15 +245,14 @@ int inxsearch( int r, int g, int b )
// Search for biased BGR values
int contest( int r, int g, int b )
{
// finds closest neuron (min dist) and updates freq
// finds best neuron (min dist-bias) and returns position
// for frequently chosen neurons, freq[i] is high and bias[i] is negative
// bias[i] = gamma * ((1 / netsize) - freq[i])
register int *p, *f, *n;
register int i, dist, a, biasdist, betafreq;
int bestpos, bestbiaspos, bestd, bestbiasd;
// finds closest neuron (min dist) and updates freq
// finds best neuron (min dist-bias) and returns position
// for frequently chosen neurons, freq[i] is high and bias[i] is negative
// bias[i] = gamma * ((1 / netsize) - freq[i])
bestd = ~(1<<31);
bestbiasd = bestd;
bestpos = -1;

View File

@ -309,7 +309,6 @@ void Image_SetPalette( const byte *pal, uint *d_table )
rgba[3] = i;
d_table[i] = *(uint *)rgba;
}
// d_table[0] = 0x00808080;
break;
case LUMP_MASKED:
for( i = 0; i < 255; i++ )
@ -741,7 +740,7 @@ void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *
if( yi != oldy )
{
inrow = (byte *)indata + inwidth4 * yi;
if (yi == oldy+1) memcpy( resamplerow1, resamplerow2, outwidth4 );
if( yi == oldy + 1 ) memcpy( resamplerow1, resamplerow2, outwidth4 );
else Image_Resample32LerpLine( inrow, resamplerow1, inwidth, outwidth );
Image_Resample32LerpLine( inrow + inwidth4, resamplerow2, inwidth, outwidth );
oldy = yi;
@ -806,7 +805,7 @@ void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *
{
if( yi != oldy )
{
inrow = (byte *)indata + inwidth4*yi;
inrow = (byte *)indata + inwidth4 * yi;
if( yi == oldy + 1 ) memcpy( resamplerow1, resamplerow2, outwidth4 );
else Image_Resample32LerpLine( inrow, resamplerow1, inwidth, outwidth);
oldy = yi;
@ -1105,9 +1104,9 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t
word width = *srcwidth;
word height = *srcheight;
int samples = PFDesc[type].bpp;
qboolean flip_x = ( flags & IMAGE_FLIP_X ) ? true : false;
qboolean flip_y = ( flags & IMAGE_FLIP_Y ) ? true : false;
qboolean flip_i = ( flags & IMAGE_ROT_90 ) ? true : false;
qboolean flip_x = FBitSet( flags, IMAGE_FLIP_X ) ? true : false;
qboolean flip_y = FBitSet( flags, IMAGE_FLIP_Y ) ? true : false;
qboolean flip_i = FBitSet( flags, IMAGE_ROT_90 ) ? true : false;
int row_inc = ( flip_y ? -samples : samples ) * width;
int col_inc = ( flip_x ? -samples : samples );
int row_ofs = ( flip_y ? ( height - 1 ) * width * samples : 0 );

View File

@ -384,13 +384,13 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
// NOTE: decals with 'blue base' can be interpret as colored decals
if( !Image_CheckFlag( IL_LOAD_DECAL ) || ( pal[765] == 0 && pal[766] == 0 && pal[767] == 255 ))
{
SetBits( image.flags, IMAGE_ONEBIT_ALPHA );
rendermode = LUMP_MASKED;
image.flags |= IMAGE_ONEBIT_ALPHA;
}
else
{
// classic gradient decals
image.flags |= IMAGE_COLORINDEX;
SetBits( image.flags, IMAGE_COLORINDEX );
rendermode = LUMP_GRADIENT;
}
@ -405,8 +405,8 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
// this is a good reason for using fullbright pixels
pal_type = Image_ComparePalette( pal );
// check for luma pixels (but ignore liquid textures, this a Xash3D limitation)
if( mip.name[0] != '!' && pal_type == PAL_QUAKE1 )
// check for luma pixels (but ignore liquid textures because they have no lightmap)
if( mip.name[0] != '*' && mip.name[0] != '!' && pal_type == PAL_QUAKE1 )
{
for( i = 0; i < image.width * image.height; i++ )
{
@ -440,11 +440,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
{
if( fin[i] > 224 && fin[i] != 255 )
{
// don't apply luma to water surfaces because
// we use glpoly->next for store luma chain each frame
// and can't modify glpoly_t because many-many HL mods
// expected unmodified glpoly_t and can crashes on changed struct
// water surfaces uses glpoly->next as pointer to subdivided surfaces (as q1)
// don't apply luma to water surfaces because they have no lightmap
if( mip.name[0] != '*' && mip.name[0] != '!' )
image.flags |= IMAGE_HAS_LUMA;
break;
@ -503,8 +499,9 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
// calc the decal reflectivity
image.fogParams[3] = VectorAvg( image.fogParams );
}
else if( pal != NULL )// calc texture reflectivity
else if( pal != NULL )
{
// calc texture reflectivity
for( i = 0; i < 256; i++ )
{
reflectivity[0] += pal[i*3+0];

View File

@ -1049,7 +1049,7 @@ static void Mod_CalcSurfaceExtents( msurface_t *surf )
info->lightextents[i] = surf->extents[i];
}
if( !FBitSet( tex->flags, TEX_SPECIAL ) && surf->extents[i] > 4096 )
if( !FBitSet( tex->flags, TEX_SPECIAL ) && surf->extents[i] > 16384 )
MsgDev( D_ERROR, "Bad surface extents %i\n", surf->extents[i] );
}
}
@ -2712,7 +2712,7 @@ qboolean Mod_LoadBmodelLumps( const byte *mod_base, qboolean isworld )
if( COM_CheckString( wadvalue ))
{
wadvalue[Q_strlen( wadvalue ) - 2] = '\0'; // kill the last semicolon
Con_DPrintf( "Wad files required to run the map: \"%s\"\n", wadvalue );
Con_Reportf( "Wad files required to run the map: \"%s\"\n", wadvalue );
}
return true;

View File

@ -248,7 +248,8 @@ void SV_MapBackground_f( void )
if( SV_Active() && !sv.background )
{
MsgDev( D_ERROR, "can't set background map while game is active\n" );
if( GameState->nextstate == STATE_RUNFRAME )
Con_Printf( S_ERROR "can't set background map while game is active\n" );
return;
}