03 Jan 2014
This commit is contained in:
parent
cbfb0218d4
commit
a80249ae70
|
@ -133,7 +133,7 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
|
|||
byte *fin;
|
||||
size_t pixels;
|
||||
mstudiotexture_t *pin;
|
||||
int i, flags;
|
||||
int flags;
|
||||
|
||||
pin = (mstudiotexture_t *)buffer;
|
||||
flags = pin->flags;
|
||||
|
@ -145,7 +145,7 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
|
|||
|
||||
if( !Image_ValidSize( name )) return false;
|
||||
|
||||
if( image.hint != IL_HINT_Q1 && !( flags & STUDIO_NF_QUAKESKIN ))
|
||||
if( image.hint == IL_HINT_HL )
|
||||
{
|
||||
if( filesize < ( sizeof( *pin ) + pixels + 768 ))
|
||||
return false;
|
||||
|
@ -162,24 +162,6 @@ qboolean Image_LoadMDL( const char *name, const byte *buffer, size_t filesize )
|
|||
}
|
||||
else Image_GetPaletteLMP( fin + pixels, LUMP_NORMAL );
|
||||
}
|
||||
else if( image.hint != IL_HINT_HL && flags & STUDIO_NF_QUAKESKIN )
|
||||
{
|
||||
if( filesize < ( sizeof( *pin ) + pixels ))
|
||||
return false;
|
||||
|
||||
// alias models setup
|
||||
Image_GetPaletteQ1();
|
||||
|
||||
// check for luma pixels
|
||||
for( i = 0; i < pixels; i++ )
|
||||
{
|
||||
if( fin[i] > 224 )
|
||||
{
|
||||
image.flags |= IMAGE_HAS_LUMA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( image.hint == IL_HINT_NO )
|
||||
|
|
|
@ -1596,7 +1596,7 @@ static void Mod_ConvertSurface( mextrasurf_t *info, msurface_t *surf )
|
|||
msurfmesh_t *poly, *next, *mesh;
|
||||
float *outSTcoords, *outLMcoords;
|
||||
float *outVerts, *outNorms;
|
||||
word numElems, numVerts;
|
||||
int numElems, numVerts;
|
||||
word *outIndexes;
|
||||
int i, bufSize;
|
||||
byte *buffer;
|
||||
|
@ -1615,10 +1615,15 @@ static void Mod_ConvertSurface( mextrasurf_t *info, msurface_t *surf )
|
|||
bufSize = sizeof( msurfmesh_t ) + numVerts * ( sizeof( vec3_t ) + sizeof( vec3_t ) + sizeof( vec4_t )) + numElems * sizeof( word );
|
||||
bufSize += numVerts * sizeof( rgba_t ); // color array
|
||||
|
||||
// unsigned short limit
|
||||
if( numVerts >= 65536 ) Host_Error( "Mod_ConvertSurface: vertex count %i exceeds 65535\n", numVerts );
|
||||
if( numElems >= 65536 ) Host_Error( "Mod_ConvertSurface: index count %i exceeds 65535\n", numElems );
|
||||
|
||||
buffer = Mem_Alloc( loadmodel->mempool, bufSize );
|
||||
|
||||
mesh = (msurfmesh_t *)buffer;
|
||||
buffer += sizeof( msurfmesh_t );
|
||||
|
||||
mesh->numVerts = numVerts;
|
||||
mesh->numElems = numElems;
|
||||
|
||||
|
@ -1661,12 +1666,11 @@ static void Mod_ConvertSurface( mextrasurf_t *info, msurface_t *surf )
|
|||
outIndexes = mesh->indices + numElems;
|
||||
numElems += (poly->numVerts - 2) * 3;
|
||||
|
||||
for( i = 2; i < poly->numVerts; i++ )
|
||||
for( i = 0; i < poly->numVerts - 2; i++ )
|
||||
{
|
||||
outIndexes[0] = numVerts;
|
||||
outIndexes[1] = numVerts + i - 1;
|
||||
outIndexes[2] = numVerts + i;
|
||||
outIndexes += 3;
|
||||
outIndexes[i*3+0] = numVerts;
|
||||
outIndexes[i*3+1] = numVerts + i + 1;
|
||||
outIndexes[i*3+2] = numVerts + i + 2;
|
||||
}
|
||||
|
||||
for( i = 0; i < poly->numVerts; i++ )
|
||||
|
|
|
@ -65,12 +65,10 @@ Studio models are position independent, so the cache manager can move them.
|
|||
#define STUDIO_NF_CHROME 0x0002
|
||||
#define STUDIO_NF_FULLBRIGHT 0x0004
|
||||
#define STUDIO_NF_COLORMAP 0x0008 // can changed by colormap command
|
||||
#define STUDIO_NF_ALPHA 0x0010 // rendering as semitransparent
|
||||
#define STUDIO_NF_ALPHA 0x0010 // rendering as transparent texture
|
||||
#define STUDIO_NF_ADDITIVE 0x0020 // rendering with additive mode
|
||||
#define STUDIO_NF_TRANSPARENT 0x0040 // use texture with alpha channel
|
||||
|
||||
#define STUDIO_NF_QUAKESKIN 0x8000 // special hack for determine alias skins
|
||||
|
||||
// motion flags
|
||||
#define STUDIO_X 0x0001
|
||||
#define STUDIO_Y 0x0002
|
||||
|
@ -311,7 +309,8 @@ typedef struct
|
|||
typedef struct mstudiotex_s
|
||||
{
|
||||
char name[64];
|
||||
int flags;
|
||||
unsigned short flags;
|
||||
unsigned short unused; // lower 16 bit is a user area
|
||||
int width;
|
||||
int height;
|
||||
int index;
|
||||
|
|
Reference in New Issue