mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-12 08:08:02 +00:00
engine: client: split the sprites indices only when loading new sprite. Scan the whole array when searching.
Fixes incorrect sprite loading in XDM
This commit is contained in:
parent
13aab4e59c
commit
93ceb0e4ed
@ -1235,11 +1235,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
|||||||
{
|
{
|
||||||
char name[MAX_QPATH];
|
char name[MAX_QPATH];
|
||||||
model_t *mod;
|
model_t *mod;
|
||||||
int i;
|
int i, start;
|
||||||
|
|
||||||
// use high indices for client sprites
|
|
||||||
// for GoldSrc bug-compatibility
|
|
||||||
const int start = type != SPR_HUDSPRITE ? MAX_CLIENT_SPRITES / 2 : 0;
|
|
||||||
|
|
||||||
if( !COM_CheckString( filename ))
|
if( !COM_CheckString( filename ))
|
||||||
{
|
{
|
||||||
@ -1250,7 +1246,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
|||||||
Q_strncpy( name, filename, sizeof( name ));
|
Q_strncpy( name, filename, sizeof( name ));
|
||||||
COM_FixSlashes( name );
|
COM_FixSlashes( name );
|
||||||
|
|
||||||
for( i = 0, mod = clgame.sprites + start; i < MAX_CLIENT_SPRITES / 2; i++, mod++ )
|
for( i = 0, mod = clgame.sprites; i < MAX_CLIENT_SPRITES; i++, mod++ )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( mod->name, name ))
|
if( !Q_stricmp( mod->name, name ))
|
||||||
{
|
{
|
||||||
@ -1267,8 +1263,15 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find a free model slot spot
|
// find a free model slot spot
|
||||||
for( i = 0, mod = clgame.sprites + start; i < MAX_CLIENT_SPRITES / 2; i++, mod++ )
|
// use low indices only for HUD sprites
|
||||||
if( !mod->name[0] ) break; // this is a valid spot
|
// for GoldSrc bug compatibility
|
||||||
|
start = type == SPR_HUDSPRITE ? 0 : MAX_CLIENT_SPRITES / 2;
|
||||||
|
|
||||||
|
for( i = 0, mod = &clgame.sprites[start]; i < MAX_CLIENT_SPRITES / 2; i++, mod++ )
|
||||||
|
{
|
||||||
|
if( !mod->name[0] )
|
||||||
|
break; // this is a valid spot
|
||||||
|
}
|
||||||
|
|
||||||
if( i == MAX_CLIENT_SPRITES / 2 )
|
if( i == MAX_CLIENT_SPRITES / 2 )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user