engine: always add .wad extension to wadlist names to simplify how it's being used

This commit is contained in:
Alibek Omarov 2024-11-23 14:01:09 +03:00
parent b94446161e
commit e7f939c87b
3 changed files with 6 additions and 13 deletions

View file

@ -417,7 +417,7 @@ static int Mod_FindTextureInWadList( wadlist_t *list, const char *name, char *ds
{ {
char path[MAX_VA_STRING]; char path[MAX_VA_STRING];
Q_snprintf( path, sizeof( path ), "%s.wad/%s.mip", list->wadnames[i], name ); Q_snprintf( path, sizeof( path ), "%s/%s.mip", list->wadnames[i], name );
if( FS_FileExists( path, false )) if( FS_FileExists( path, false ))
{ {
@ -1929,7 +1929,6 @@ static int Mod_LoadEntities_splitstr_handler( char *prev, char *next, void *user
{ {
int num = wadlist->count++; int num = wadlist->count++;
Q_strncpy( wadlist->wadnames[num], wad, sizeof( wadlist->wadnames[0] )); Q_strncpy( wadlist->wadnames[num], wad, sizeof( wadlist->wadnames[0] ));
COM_StripExtension( wadlist->wadnames[num] );
wadlist->wadusage[num] = 0; wadlist->wadusage[num] = 0;
} }
@ -3569,16 +3568,12 @@ static qboolean Mod_LoadBmodelLumps( model_t *mod, const byte *mod_base, qboolea
for( i = 0; i < world.wadlist.count; i++ ) for( i = 0; i < world.wadlist.count; i++ )
{ {
string wadname;
if( !world.wadlist.wadusage[i] ) if( !world.wadlist.wadusage[i] )
continue; continue;
Q_snprintf( wadname, sizeof( wadname ), "%s.wad", world.wadlist.wadnames[i] );
if( !wadlist_warn ) if( !wadlist_warn )
{ {
ret = Q_snprintf( &wadvalue[len], sizeof( wadvalue ), "%s; ", wadname ); ret = Q_snprintf( &wadvalue[len], sizeof( wadvalue ), "%s; ", world.wadlist.wadnames[i] );
if( ret == -1 ) if( ret == -1 )
{ {
Con_DPrintf( S_WARN "Too many wad files for output!\n" ); Con_DPrintf( S_WARN "Too many wad files for output!\n" );

View file

@ -85,9 +85,9 @@ typedef struct
typedef struct wadlist_s typedef struct wadlist_s
{ {
char wadnames[MAX_MAP_WADS][32]; char wadnames[MAX_MAP_WADS][36]; // including .wad extension
int wadusage[MAX_MAP_WADS]; int wadusage[MAX_MAP_WADS];
int count; int count;
} wadlist_t; } wadlist_t;
typedef struct world_static_s typedef struct world_static_s

View file

@ -376,9 +376,7 @@ static void SV_CreateGenericResources( void )
{ {
if( world.wadlist.wadusage[i] > 0 ) if( world.wadlist.wadusage[i] > 0 )
{ {
string wadname; SV_GenericIndex( world.wadlist.wadnames[i] );
Q_snprintf( wadname, sizeof( wadname ), "%s.wad", world.wadlist.wadnames[i] );
SV_GenericIndex( wadname );
} }
} }
} }