|
|
@ -78,7 +78,7 @@ CL_CreateRawTextureFromPixels |
|
|
|
Convert texture_t struct into mstudiotexture_t prototype |
|
|
|
Convert texture_t struct into mstudiotexture_t prototype |
|
|
|
==================== |
|
|
|
==================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor, int bottomcolor ) |
|
|
|
static byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor, int bottomcolor ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
static mstudiotexture_t pin; |
|
|
|
static mstudiotexture_t pin; |
|
|
|
byte *pal; |
|
|
|
byte *pal; |
|
|
@ -111,7 +111,7 @@ CL_DuplicateTexture |
|
|
|
Dupliacte texture with remap pixels |
|
|
|
Dupliacte texture with remap pixels |
|
|
|
==================== |
|
|
|
==================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotexture_t *ptexture, int topcolor, int bottomcolor ) |
|
|
|
static void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotexture_t *ptexture, int topcolor, int bottomcolor ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const char *name; |
|
|
|
const char *name; |
|
|
|
texture_t *tx = NULL; |
|
|
|
texture_t *tx = NULL; |
|
|
@ -154,7 +154,7 @@ CL_UpdateStudioTexture |
|
|
|
Update texture top and bottom colors |
|
|
|
Update texture top and bottom colors |
|
|
|
==================== |
|
|
|
==================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptexture, int topcolor, int bottomcolor ) |
|
|
|
static void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptexture, int topcolor, int bottomcolor ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
rgbdata_t *pic; |
|
|
|
rgbdata_t *pic; |
|
|
|
texture_t *tx = NULL; |
|
|
|
texture_t *tx = NULL; |
|
|
@ -215,7 +215,7 @@ CL_UpdateAliasTexture |
|
|
|
Update texture top and bottom colors |
|
|
|
Update texture top and bottom colors |
|
|
|
==================== |
|
|
|
==================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int skinnum, int topcolor, int bottomcolor ) |
|
|
|
static void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int skinnum, int topcolor, int bottomcolor ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
char texname[MAX_QPATH]; |
|
|
|
char texname[MAX_QPATH]; |
|
|
|
rgbdata_t skin, *pic; |
|
|
|
rgbdata_t skin, *pic; |
|
|
@ -247,6 +247,68 @@ void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int sk |
|
|
|
ref.dllFuncs.GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor ); |
|
|
|
ref.dllFuncs.GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
CL_FreeRemapInfo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Release remap info per entity |
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
static void CL_FreeRemapInfo( remap_info_t *info ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert( info != NULL ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// release all colormap texture copies
|
|
|
|
|
|
|
|
for( i = 0; i < info->numtextures; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( info->ptexture != NULL ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP )) |
|
|
|
|
|
|
|
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( info->textures[i] != 0 ) |
|
|
|
|
|
|
|
ref.dllFuncs.GL_FreeTexture( info->textures[i] ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mem_Free( info ); // release struct
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
CL_UpdateRemapInfo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Update all remaps per entity |
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
static void CL_UpdateRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
remap_info_t *info; |
|
|
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number; |
|
|
|
|
|
|
|
info = clgame.remap_info[i]; |
|
|
|
|
|
|
|
if( !info ) return; // no remap info
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( info->topcolor == topcolor && info->bottomcolor == bottomcolor ) |
|
|
|
|
|
|
|
return; // values is valid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < info->numtextures; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( info->ptexture != NULL ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP )) |
|
|
|
|
|
|
|
CL_UpdateStudioTexture( entity, &info->ptexture[i], topcolor, bottomcolor ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else CL_UpdateAliasTexture( entity, &info->textures[i], i, topcolor, bottomcolor ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info->topcolor = topcolor; |
|
|
|
|
|
|
|
info->bottomcolor = bottomcolor; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
==================== |
|
|
|
==================== |
|
|
|
CL_AllocRemapInfo |
|
|
|
CL_AllocRemapInfo |
|
|
@ -255,7 +317,7 @@ Allocate new remap info per entity |
|
|
|
and make copy of remap textures |
|
|
|
and make copy of remap textures |
|
|
|
==================== |
|
|
|
==================== |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor ) |
|
|
|
static void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
remap_info_t *info; |
|
|
|
remap_info_t *info; |
|
|
|
studiohdr_t *phdr; |
|
|
|
studiohdr_t *phdr; |
|
|
@ -362,68 +424,6 @@ void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int b |
|
|
|
info->model = model; |
|
|
|
info->model = model; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
CL_UpdateRemapInfo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Update all remaps per entity |
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void CL_UpdateRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
remap_info_t *info; |
|
|
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number; |
|
|
|
|
|
|
|
info = clgame.remap_info[i]; |
|
|
|
|
|
|
|
if( !info ) return; // no remap info
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( info->topcolor == topcolor && info->bottomcolor == bottomcolor ) |
|
|
|
|
|
|
|
return; // values is valid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( i = 0; i < info->numtextures; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( info->ptexture != NULL ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP )) |
|
|
|
|
|
|
|
CL_UpdateStudioTexture( entity, &info->ptexture[i], topcolor, bottomcolor ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else CL_UpdateAliasTexture( entity, &info->textures[i], i, topcolor, bottomcolor ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
info->topcolor = topcolor; |
|
|
|
|
|
|
|
info->bottomcolor = bottomcolor; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
CL_FreeRemapInfo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Release remap info per entity |
|
|
|
|
|
|
|
==================== |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
void CL_FreeRemapInfo( remap_info_t *info ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert( info != NULL ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// release all colormap texture copies
|
|
|
|
|
|
|
|
for( i = 0; i < info->numtextures; i++ ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( info->ptexture != NULL ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP )) |
|
|
|
|
|
|
|
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( info->textures[i] != 0 ) |
|
|
|
|
|
|
|
ref.dllFuncs.GL_FreeTexture( info->textures[i] ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mem_Free( info ); // release struct
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
==================== |
|
|
|
==================== |
|
|
|
CL_ClearAllRemaps |
|
|
|
CL_ClearAllRemaps |
|
|
@ -446,3 +446,21 @@ void CL_ClearAllRemaps( void ) |
|
|
|
} |
|
|
|
} |
|
|
|
clgame.remap_info = NULL; |
|
|
|
clgame.remap_info = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
============= |
|
|
|
|
|
|
|
CL_EntitySetRemapColors |
|
|
|
|
|
|
|
============= |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
qboolean CL_EntitySetRemapColors( cl_entity_t *e, model_t *mod, int top, int bottom ) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CL_AllocRemapInfo( e, mod, top, bottom ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( CL_GetRemapInfoForEntity( e )) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CL_UpdateRemapInfo( e, top, bottom ); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|