* -pk3 autopackager: alternative way to write
This commit is contained in:
Garux 2017-08-01 13:53:05 +03:00
parent eef3995202
commit 66d12fc237
3 changed files with 117 additions and 115 deletions

View File

@ -247,7 +247,7 @@ void vfsInitDirectory( const char *path ){
// lists all .shader files // lists all .shader files
void vfsListShaderFiles( char list[512][64], int *num ){ void vfsListShaderFiles( char* list, int *num ){
//char filename[PATH_MAX]; //char filename[PATH_MAX];
char *dirlist; char *dirlist;
GDir *dir; GDir *dir;
@ -275,9 +275,9 @@ void vfsListShaderFiles( char list[512][64], int *num ){
} }
for ( k = 0; k < *num; k++ ){ for ( k = 0; k < *num; k++ ){
if ( !stricmp( list[k], dirlist ) ) goto shISdouplicate; if ( !stricmp( list + k*65, dirlist ) ) goto shISdouplicate;
} }
strcpy( list[*num], dirlist ); strcpy( list + (*num)*65, dirlist );
(*num)++; (*num)++;
shISdouplicate: shISdouplicate:
g_free( dirlist ); g_free( dirlist );
@ -302,9 +302,9 @@ shISdouplicate:
ext++; ext++;
for ( k = 0; k < *num; k++ ){ for ( k = 0; k < *num; k++ ){
if ( !stricmp( list[k], ext ) ) goto shISdouplicate2; if ( !stricmp( list + k*65, ext ) ) goto shISdouplicate2;
} }
strcpy( list[*num], ext ); strcpy( list + (*num)*65, ext );
(*num)++; (*num)++;
shISdouplicate2: shISdouplicate2:
continue; continue;

View File

@ -51,7 +51,7 @@ void vfsInitDirectory( const char *path );
void vfsShutdown(); void vfsShutdown();
int vfsGetFileCount( const char *filename ); int vfsGetFileCount( const char *filename );
int vfsLoadFile( const char *filename, void **buffer, int index ); int vfsLoadFile( const char *filename, void **buffer, int index );
void vfsListShaderFiles( char list[512][64], int *num ); void vfsListShaderFiles( char* list, int *num );
qboolean vfsPackFile( const char *filename, const char *packname ); qboolean vfsPackFile( const char *filename, const char *packname );
extern char g_strForbiddenDirs[VFS_MAXDIRS][PATH_MAX + 1]; extern char g_strForbiddenDirs[VFS_MAXDIRS][PATH_MAX + 1];

View File

@ -1662,18 +1662,18 @@ void FixDOSName( char *src ){
/* /*
Check if newcoming texture is unique and not excluded Check if newcoming texture is unique and not excluded
*/ */
void tex2list( char texlist[512][MAX_QPATH], int *texnum, char EXtex[2048][MAX_QPATH], int *EXtexnum ){ void tex2list( char* texlist, int *texnum, char* EXtex, int *EXtexnum ){
int i; int i;
if ( token[0] == '\0') return; if ( token[0] == '\0') return;
StripExtension( token ); StripExtension( token );
FixDOSName( token ); FixDOSName( token );
for ( i = 0; i < *texnum; i++ ){ for ( i = 0; i < *texnum; i++ ){
if ( !stricmp( texlist[i], token ) ) return; if ( !stricmp( texlist + i*65, token ) ) return;
} }
for ( i = 0; i < *EXtexnum; i++ ){ for ( i = 0; i < *EXtexnum; i++ ){
if ( !stricmp( EXtex[i], token ) ) return; if ( !stricmp( EXtex + i*65, token ) ) return;
} }
strcpy ( texlist[*texnum], token ); strcpy ( texlist + (*texnum)*65, token );
(*texnum)++; (*texnum)++;
return; return;
} }
@ -1682,17 +1682,17 @@ void tex2list( char texlist[512][MAX_QPATH], int *texnum, char EXtex[2048][MAX_Q
/* /*
Check if newcoming res is unique Check if newcoming res is unique
*/ */
void res2list( char data[512][MAX_QPATH], int *num ){ void res2list( char* data, int *num ){
int i; int i;
if ( data[*num][0] == '\0') return; if ( *( data + (*num)*65 ) == '\0') return;
for ( i = 0; i < *num; i++ ){ for ( i = 0; i < *num; i++ ){
if ( !stricmp( data[i], data[*num] ) ) return; if ( !stricmp( data + i*65, data + (*num)*65 ) ) return;
} }
(*num)++; (*num)++;
return; return;
} }
void parseEXblock ( char data[512][MAX_QPATH], int *num, const char *exName ){ void parseEXblock ( char* data, int *num, const char *exName ){
if ( !GetToken( qtrue ) || strcmp( token, "{" ) ) { if ( !GetToken( qtrue ) || strcmp( token, "{" ) ) {
Error( "ReadExclusionsFile: %s, line %d: { not found", exName, scriptline ); Error( "ReadExclusionsFile: %s, line %d: { not found", exName, scriptline );
} }
@ -1709,7 +1709,7 @@ void parseEXblock ( char data[512][MAX_QPATH], int *num, const char *exName ){
} }
/* add to list */ /* add to list */
strcpy( data[*num], token ); strcpy( data + (*num)*65, token );
(*num)++; (*num)++;
} }
return; return;
@ -1722,7 +1722,7 @@ char q3map2path[1024];
*/ */
int pk3BSPMain( int argc, char **argv ){ int pk3BSPMain( int argc, char **argv ){
int i, j; int i, j, len;
qboolean dbg = qfalse, png = qfalse; qboolean dbg = qfalse, png = qfalse;
/* process arguments */ /* process arguments */
@ -1735,8 +1735,6 @@ int pk3BSPMain( int argc, char **argv ){
} }
} }
/* do some path mangling */ /* do some path mangling */
strcpy( source, ExpandArg( argv[ argc - 1 ] ) ); strcpy( source, ExpandArg( argv[ argc - 1 ] ) );
StripExtension( source ); StripExtension( source );
@ -1748,10 +1746,7 @@ int pk3BSPMain( int argc, char **argv ){
ParseEntities(); ParseEntities();
char packname[ 1024 ], base[ 1024 ], nameOFmap[ 1024 ]; char packname[ 1024 ], base[ 1024 ], nameOFmap[ 1024 ], temp[ 1024 ];
int len;
strcpy( packname, EnginePath );
/* copy map name */ /* copy map name */
strcpy( base, source ); strcpy( base, source );
@ -1764,83 +1759,96 @@ int pk3BSPMain( int argc, char **argv ){
strcpy( nameOFmap, &base[ len + 1 ] ); strcpy( nameOFmap, &base[ len + 1 ] );
qboolean dsSHs[512] = {qfalse}; qboolean drawsurfSHs[1024] = { qfalse };
for ( i = 0; i < numBSPDrawSurfaces; i++ ){ for ( i = 0; i < numBSPDrawSurfaces; i++ ){
/* can't exclude nodraw patches here (they want shaders :0!) */ /* can't exclude nodraw patches here (they want shaders :0!) */
//if ( !( bspDrawSurfaces[i].surfaceType == 2 && bspDrawSurfaces[i].numIndexes == 0 ) ) dsSHs[bspDrawSurfaces[i].shaderNum] = qtrue; //if ( !( bspDrawSurfaces[i].surfaceType == 2 && bspDrawSurfaces[i].numIndexes == 0 ) ) drawsurfSHs[bspDrawSurfaces[i].shaderNum] = qtrue;
dsSHs[bspDrawSurfaces[i].shaderNum] = qtrue; drawsurfSHs[ bspDrawSurfaces[i].shaderNum ] = qtrue;
//Sys_Printf( "%s\n", bspShaders[bspDrawSurfaces[i].shaderNum].shader ); //Sys_Printf( "%s\n", bspShaders[bspDrawSurfaces[i].shaderNum].shader );
} }
int pk3ShadersN = 0; int pk3ShadersN = 0;
char pk3Shaders[512][MAX_QPATH]; char* pk3Shaders;
pk3Shaders = (char *)calloc( 1024*65, sizeof( char ) );
int pk3SoundsN = 0; int pk3SoundsN = 0;
char pk3Sounds[512][MAX_QPATH]; char* pk3Sounds;
pk3Sounds = (char *)calloc( 1024*65, sizeof( char ) );
int pk3ShaderfilesN = 0; int pk3ShaderfilesN = 0;
char pk3Shaderfiles[512][MAX_QPATH]; char* pk3Shaderfiles;
pk3Shaderfiles = (char *)calloc( 1024*65, sizeof( char ) );
int pk3TexturesN = 0; int pk3TexturesN = 0;
char pk3Textures[512][MAX_QPATH]; char* pk3Textures;
pk3Textures = (char *)calloc( 1024*65, sizeof( char ) );
int pk3VideosN = 0; int pk3VideosN = 0;
char pk3Videos[512][MAX_QPATH]; char* pk3Videos;
pk3Videos = (char *)calloc( 1024*65, sizeof( char ) );
for ( i = 0; i < numBSPShaders; i++ ){ for ( i = 0; i < numBSPShaders; i++ ){
if ( dsSHs[i] ){ if ( drawsurfSHs[i] ){
strcpy( pk3Shaders[pk3ShadersN], bspShaders[i].shader ); strcpy( pk3Shaders + pk3ShadersN*65, bspShaders[i].shader );
res2list( pk3Shaders, &pk3ShadersN ); res2list( pk3Shaders, &pk3ShadersN );
//pk3ShadersN++; //pk3ShadersN++;
//Sys_Printf( "%s\n", bspShaders[i].shader ); //Sys_Printf( "%s\n", bspShaders[i].shader );
} }
} }
//ent keys /* Ent keys */
epair_t *ep; epair_t *ep;
for ( ep = entities[0].epairs; ep != NULL; ep = ep->next ) for ( ep = entities[0].epairs; ep != NULL; ep = ep->next )
{ {
if ( !strnicmp( ep->key, "vertexremapshader", 17 ) ) { if ( !strnicmp( ep->key, "vertexremapshader", 17 ) ) {
sscanf( ep->value, "%*[^;] %*[;] %s", pk3Shaders[pk3ShadersN] ); sscanf( ep->value, "%*[^;] %*[;] %s", pk3Shaders + pk3ShadersN*65 );
res2list( pk3Shaders, &pk3ShadersN ); res2list( pk3Shaders, &pk3ShadersN );
} }
} }
strcpy( pk3Sounds[pk3SoundsN], ValueForKey( &entities[0], "music" ) ); strcpy( pk3Sounds + pk3SoundsN*65, ValueForKey( &entities[0], "music" ) );
if ( *( pk3Sounds + pk3SoundsN*65 ) != '\0' ){
FixDOSName( pk3Sounds + pk3SoundsN*65 );
DefaultExtension( pk3Sounds + pk3SoundsN*65, ".wav" );
res2list( pk3Sounds, &pk3SoundsN ); res2list( pk3Sounds, &pk3SoundsN );
}
for ( i = 0; i < numBSPEntities && i < numEntities; i++ ) for ( i = 0; i < numBSPEntities && i < numEntities; i++ )
{ {
strcpy( pk3Sounds[pk3SoundsN], ValueForKey( &entities[i], "noise" ) ); strcpy( pk3Sounds + pk3SoundsN*65, ValueForKey( &entities[i], "noise" ) );
if ( pk3Sounds[pk3SoundsN][0] != '*' ) res2list( pk3Sounds, &pk3SoundsN ); if ( *( pk3Sounds + pk3SoundsN*65 ) != '\0' && *( pk3Sounds + pk3SoundsN*65 ) != '*' ){
FixDOSName( pk3Sounds + pk3SoundsN*65 );
DefaultExtension( pk3Sounds + pk3SoundsN*65, ".wav" );
res2list( pk3Sounds, &pk3SoundsN );
}
if ( !stricmp( ValueForKey( &entities[i], "classname" ), "func_plat" ) ){ if ( !stricmp( ValueForKey( &entities[i], "classname" ), "func_plat" ) ){
strcpy( pk3Sounds[pk3SoundsN], "sound/movers/plats/pt1_strt.wav"); strcpy( pk3Sounds + pk3SoundsN*65, "sound/movers/plats/pt1_strt.wav");
res2list( pk3Sounds, &pk3SoundsN ); res2list( pk3Sounds, &pk3SoundsN );
strcpy( pk3Sounds[pk3SoundsN], "sound/movers/plats/pt1_end.wav"); strcpy( pk3Sounds + pk3SoundsN*65, "sound/movers/plats/pt1_end.wav");
res2list( pk3Sounds, &pk3SoundsN ); res2list( pk3Sounds, &pk3SoundsN );
} }
if ( !stricmp( ValueForKey( &entities[i], "classname" ), "target_push" ) ){ if ( !stricmp( ValueForKey( &entities[i], "classname" ), "target_push" ) ){
if ( !(IntForKey( &entities[i], "spawnflags") & 1) ){ if ( !(IntForKey( &entities[i], "spawnflags") & 1) ){
strcpy( pk3Sounds[pk3SoundsN], "sound/misc/windfly.wav"); strcpy( pk3Sounds + pk3SoundsN*65, "sound/misc/windfly.wav");
res2list( pk3Sounds, &pk3SoundsN ); res2list( pk3Sounds, &pk3SoundsN );
} }
} }
strcpy( pk3Shaders[pk3ShadersN], ValueForKey( &entities[i], "targetShaderNewName" ) ); strcpy( pk3Shaders + pk3ShadersN*65, ValueForKey( &entities[i], "targetShaderNewName" ) );
res2list( pk3Shaders, &pk3ShadersN ); res2list( pk3Shaders, &pk3ShadersN );
} }
//levelshot //levelshot
sprintf( pk3Shaders[ pk3ShadersN ], "levelshots/%s", nameOFmap ); sprintf( pk3Shaders + pk3ShadersN*65, "levelshots/%s", nameOFmap );
res2list( pk3Shaders, &pk3ShadersN ); res2list( pk3Shaders, &pk3ShadersN );
if( dbg ){ if( dbg ){
Sys_Printf( "\tDrawsurface+ent calls....%i\n", pk3ShadersN ); Sys_Printf( "\tDrawsurface+ent calls....%i\n", pk3ShadersN );
for ( i = 0; i < pk3ShadersN; i++ ){ for ( i = 0; i < pk3ShadersN; i++ ){
Sys_Printf( "%s\n", pk3Shaders[i] ); Sys_Printf( "%s\n", pk3Shaders + i*65 );
} }
Sys_Printf( "\tSounds....%i\n", pk3SoundsN ); Sys_Printf( "\tSounds....%i\n", pk3SoundsN );
for ( i = 0; i < pk3SoundsN; i++ ){ for ( i = 0; i < pk3SoundsN; i++ ){
Sys_Printf( "%s\n", pk3Sounds[i] ); Sys_Printf( "%s\n", pk3Sounds + i*65 );
} }
} }
@ -1849,22 +1857,27 @@ int pk3BSPMain( int argc, char **argv ){
if( dbg ){ if( dbg ){
Sys_Printf( "\tSchroider fileses.....%i\n", pk3ShaderfilesN ); Sys_Printf( "\tSchroider fileses.....%i\n", pk3ShaderfilesN );
for ( i = 0; i < pk3ShaderfilesN; i++ ){ for ( i = 0; i < pk3ShaderfilesN; i++ ){
Sys_Printf( "%s\n", pk3Shaderfiles[i] ); Sys_Printf( "%s\n", pk3Shaderfiles + i*65 );
} }
} }
/* load exclusions file */ /* load exclusions file */
int EXpk3TexturesN = 0; int EXpk3TexturesN = 0;
char EXpk3Textures[2048][MAX_QPATH]; char* EXpk3Textures;
EXpk3Textures = (char *)calloc( 4096*65, sizeof( char ) );
int EXpk3ShadersN = 0; int EXpk3ShadersN = 0;
char EXpk3Shaders[2048][MAX_QPATH]; char* EXpk3Shaders;
EXpk3Shaders = (char *)calloc( 4096*65, sizeof( char ) );
int EXpk3SoundsN = 0; int EXpk3SoundsN = 0;
char EXpk3Sounds[2048][MAX_QPATH]; char* EXpk3Sounds;
EXpk3Sounds = (char *)calloc( 4096*65, sizeof( char ) );
int EXpk3ShaderfilesN = 0; int EXpk3ShaderfilesN = 0;
char EXpk3Shaderfiles[512][MAX_QPATH]; char* EXpk3Shaderfiles;
EXpk3Shaderfiles = (char *)calloc( 4096*65, sizeof( char ) );
int EXpk3VideosN = 0; int EXpk3VideosN = 0;
char EXpk3Videos[512][MAX_QPATH]; char* EXpk3Videos;
EXpk3Videos = (char *)calloc( 4096*65, sizeof( char ) );
char exName[ 1024 ]; char exName[ 1024 ];
byte *buffer; byte *buffer;
@ -1878,7 +1891,6 @@ int pk3BSPMain( int argc, char **argv ){
goto skipEXfile; goto skipEXfile;
} }
if ( cut2 > cut ) cut = cut2; if ( cut2 > cut ) cut = cut2;
//cut++;
cut[1] = '\0'; cut[1] = '\0';
strcat( exName, game->arg ); strcat( exName, game->arg );
strcat( exName, ".exclude" ); strcat( exName, ".exclude" );
@ -1893,11 +1905,6 @@ int pk3BSPMain( int argc, char **argv ){
/* parse the file */ /* parse the file */
ParseFromMemory( (char *) buffer, size ); ParseFromMemory( (char *) buffer, size );
/* blocks pointers */
//int *exptrN;
//char *exptr[512][64];
/* tokenize it */ /* tokenize it */
while ( 1 ) while ( 1 )
{ {
@ -1934,29 +1941,25 @@ skipEXfile:
if( dbg ){ if( dbg ){
Sys_Printf( "\tEXpk3Textures....%i\n", EXpk3TexturesN ); Sys_Printf( "\tEXpk3Textures....%i\n", EXpk3TexturesN );
for ( i = 0; i < EXpk3TexturesN; i++ ) Sys_Printf( "%s\n", EXpk3Textures[i] ); for ( i = 0; i < EXpk3TexturesN; i++ ) Sys_Printf( "%s\n", EXpk3Textures + i*65 );
Sys_Printf( "\tEXpk3Shaders....%i\n", EXpk3ShadersN ); Sys_Printf( "\tEXpk3Shaders....%i\n", EXpk3ShadersN );
for ( i = 0; i < EXpk3ShadersN; i++ ) Sys_Printf( "%s\n", EXpk3Shaders[i] ); for ( i = 0; i < EXpk3ShadersN; i++ ) Sys_Printf( "%s\n", EXpk3Shaders + i*65 );
Sys_Printf( "\tEXpk3Shaderfiles....%i\n", EXpk3ShaderfilesN ); Sys_Printf( "\tEXpk3Shaderfiles....%i\n", EXpk3ShaderfilesN );
for ( i = 0; i < EXpk3ShaderfilesN; i++ ) Sys_Printf( "%s\n", EXpk3Shaderfiles[i] ); for ( i = 0; i < EXpk3ShaderfilesN; i++ ) Sys_Printf( "%s\n", EXpk3Shaderfiles + i*65 );
Sys_Printf( "\tEXpk3Sounds....%i\n", EXpk3SoundsN ); Sys_Printf( "\tEXpk3Sounds....%i\n", EXpk3SoundsN );
for ( i = 0; i < EXpk3SoundsN; i++ ) Sys_Printf( "%s\n", EXpk3Sounds[i] ); for ( i = 0; i < EXpk3SoundsN; i++ ) Sys_Printf( "%s\n", EXpk3Sounds + i*65 );
Sys_Printf( "\tEXpk3Videos....%i\n", EXpk3VideosN ); Sys_Printf( "\tEXpk3Videos....%i\n", EXpk3VideosN );
for ( i = 0; i < EXpk3VideosN; i++ ) Sys_Printf( "%s\n", EXpk3Videos[i] ); for ( i = 0; i < EXpk3VideosN; i++ ) Sys_Printf( "%s\n", EXpk3Videos + i*65 );
} }
char temp[ 1024 ];
//Parse Shader Files //Parse Shader Files
for ( i = 0; i < pk3ShaderfilesN; i++ ){ for ( i = 0; i < pk3ShaderfilesN; i++ ){
qboolean wantShader = qfalse; qboolean wantShader = qfalse, wantShaderFile = qfalse;
qboolean wantShaderFile = qfalse; char shadername[ 1024 ], lastwantedShader[ 1024 ];
char shadername[ 1024 ];
char lastwantedShader[ 1024 ];
/* load the shader */ /* load the shader */
sprintf( temp, "%s/%s", game->shaderPath, pk3Shaderfiles[ i ] ); sprintf( temp, "%s/%s", game->shaderPath, pk3Shaderfiles + i*65 );
LoadScriptFile( temp, 0 ); LoadScriptFile( temp, 0 );
/* tokenize it */ /* tokenize it */
@ -1972,9 +1975,9 @@ skipEXfile:
/* do wanna le shader? */ /* do wanna le shader? */
wantShader = qfalse; wantShader = qfalse;
for ( j = 0; j < pk3ShadersN; j++ ){ for ( j = 0; j < pk3ShadersN; j++ ){
if ( !stricmp( pk3Shaders[j], token) ){ if ( !stricmp( pk3Shaders + j*65, token) ){
strcpy ( shadername, pk3Shaders[j] ); strcpy ( shadername, pk3Shaders + j*65 );
pk3Shaders[j][0] = '\0'; *(pk3Shaders + j*65) = '\0';
wantShader = qtrue; wantShader = qtrue;
break; break;
} }
@ -2014,6 +2017,7 @@ skipEXfile:
if ( !strcmp( token, "}" ) ) { if ( !strcmp( token, "}" ) ) {
break; break;
} }
/* skip the shader */
if ( !wantShader ) continue; if ( !wantShader ) continue;
/* digest any images */ /* digest any images */
@ -2042,23 +2046,23 @@ skipEXfile:
strcpy( token, temp ); strcpy( token, temp );
} }
for ( j = 0; j < pk3VideosN; j++ ){ for ( j = 0; j < pk3VideosN; j++ ){
if ( !stricmp( pk3Videos[j], token ) ){ if ( !stricmp( pk3Videos + j*65, token ) ){
goto away; goto away;
} }
} }
for ( j = 0; j < EXpk3VideosN; j++ ){ for ( j = 0; j < EXpk3VideosN; j++ ){
if ( !stricmp( EXpk3Videos[j], token ) ){ if ( !stricmp( EXpk3Videos + j*65, token ) ){
goto away; goto away;
} }
} }
strcpy ( pk3Videos[pk3VideosN], token ); strcpy ( pk3Videos + pk3VideosN*65, token );
pk3VideosN++; pk3VideosN++;
away: away:
j = 0; j = 0;
} }
} }
} }
/* skip to the next shader */ /* skip the shader */
else if ( !wantShader ) continue; else if ( !wantShader ) continue;
/* ----------------------------------------------------------------- /* -----------------------------------------------------------------
@ -2102,7 +2106,7 @@ skipEXfile:
//exclude shader //exclude shader
if ( wantShader ){ if ( wantShader ){
for ( j = 0; j < EXpk3ShadersN; j++ ){ for ( j = 0; j < EXpk3ShadersN; j++ ){
if ( !stricmp( EXpk3Shaders[j], shadername ) ){ if ( !stricmp( EXpk3Shaders + j*65, shadername ) ){
wantShader = qfalse; wantShader = qfalse;
break; break;
} }
@ -2110,7 +2114,7 @@ skipEXfile:
/* shouldnt make shaders for shipped with the game textures aswell */ /* shouldnt make shaders for shipped with the game textures aswell */
if ( wantShader ){ if ( wantShader ){
for ( j = 0; j < EXpk3TexturesN; j++ ){ for ( j = 0; j < EXpk3TexturesN; j++ ){
if ( !stricmp( EXpk3Textures[j], shadername ) ){ if ( !stricmp( EXpk3Textures + j*65, shadername ) ){
wantShader = qfalse; wantShader = qfalse;
break; break;
} }
@ -2125,15 +2129,15 @@ skipEXfile:
//exclude shader file //exclude shader file
if ( wantShaderFile ){ if ( wantShaderFile ){
for ( j = 0; j < EXpk3ShaderfilesN; j++ ){ for ( j = 0; j < EXpk3ShaderfilesN; j++ ){
if ( !stricmp( EXpk3Shaderfiles[j], pk3Shaderfiles[ i ] ) ){ if ( !stricmp( EXpk3Shaderfiles + j*65, pk3Shaderfiles + i*65 ) ){
Sys_Printf( "WARNING: excluded shader %s, since it was located in restricted shader file: %s\n", lastwantedShader, pk3Shaderfiles[i] ); Sys_Printf( "WARNING: excluded shader %s, since it was located in restricted shader file: %s\n", lastwantedShader, pk3Shaderfiles + i*65 );
pk3Shaderfiles[ i ][0] = '\0'; *( pk3Shaderfiles + i*65 ) = '\0';
break; break;
} }
} }
} }
else { else {
pk3Shaderfiles[ i ][0] = '\0'; *( pk3Shaderfiles + i*65 ) = '\0';
} }
} }
@ -2143,18 +2147,18 @@ skipEXfile:
/* exclude stuff */ /* exclude stuff */
//pure textures (shader ones are done) //pure textures (shader ones are done)
for ( i = 0; i < pk3ShadersN; i++ ){ for ( i = 0; i < pk3ShadersN; i++ ){
if ( pk3Shaders[i][0] != '\0' ){ if ( *( pk3Shaders + i*65 ) != '\0' ){
FixDOSName( pk3Shaders[i] ); FixDOSName( pk3Shaders + i*65 );
for ( j = 0; j < pk3TexturesN; j++ ){ for ( j = 0; j < pk3TexturesN; j++ ){
if ( !stricmp( pk3Shaders[i], pk3Textures[j] ) ){ if ( !stricmp( pk3Shaders + i*65, pk3Textures + j*65 ) ){
pk3Shaders[i][0] = '\0'; *( pk3Shaders + i*65 ) = '\0';
break; break;
} }
} }
if ( pk3Shaders[i][0] == '\0' ) continue; if ( *( pk3Shaders + i*65 ) == '\0' ) continue;
for ( j = 0; j < EXpk3TexturesN; j++ ){ for ( j = 0; j < EXpk3TexturesN; j++ ){
if ( !stricmp( pk3Shaders[i], EXpk3Textures[j] ) ){ if ( !stricmp( pk3Shaders + i*65, EXpk3Textures + j*65 ) ){
pk3Shaders[i][0] = '\0'; *( pk3Shaders + i*65 ) = '\0';
break; break;
} }
} }
@ -2163,10 +2167,9 @@ skipEXfile:
//snds //snds
for ( i = 0; i < pk3SoundsN; i++ ){ for ( i = 0; i < pk3SoundsN; i++ ){
FixDOSName( pk3Sounds[i] );
for ( j = 0; j < EXpk3SoundsN; j++ ){ for ( j = 0; j < EXpk3SoundsN; j++ ){
if ( !stricmp( pk3Sounds[i], EXpk3Sounds[j] ) ){ if ( !stricmp( pk3Sounds + i*65, EXpk3Sounds + j*65 ) ){
pk3Sounds[i][0] = '\0'; *( pk3Sounds + i*65 ) = '\0';
break; break;
} }
} }
@ -2175,20 +2178,19 @@ skipEXfile:
if( dbg ){ if( dbg ){
Sys_Printf( "\tShader referenced textures....%i\n", pk3TexturesN ); Sys_Printf( "\tShader referenced textures....%i\n", pk3TexturesN );
for ( i = 0; i < pk3TexturesN; i++ ){ for ( i = 0; i < pk3TexturesN; i++ ){
Sys_Printf( "%s\n", pk3Textures[i] ); Sys_Printf( "%s\n", pk3Textures + i*65 );
} }
Sys_Printf( "\tShader files....\n" ); Sys_Printf( "\tShader files....\n" );
for ( i = 0; i < pk3ShaderfilesN; i++ ){ for ( i = 0; i < pk3ShaderfilesN; i++ ){
if ( pk3Shaderfiles[i][0] != '\0' ) Sys_Printf( "%s\n", pk3Shaderfiles[i] ); if ( *( pk3Shaderfiles + i*65 ) != '\0' ) Sys_Printf( "%s\n", pk3Shaderfiles + i*65 );
} }
Sys_Printf( "\tPure textures....\n" ); Sys_Printf( "\tPure textures....\n" );
for ( i = 0; i < pk3ShadersN; i++ ){ for ( i = 0; i < pk3ShadersN; i++ ){
if ( pk3Shaders[i][0] != '\0' ) Sys_Printf( "%s\n", pk3Shaders[i] ); if ( *( pk3Shaders + i*65 ) != '\0' ) Sys_Printf( "%s\n", pk3Shaders + i*65 );
} }
} }
sprintf( packname, "%s/%s_autopacked.pk3", EnginePath, nameOFmap ); sprintf( packname, "%s/%s_autopacked.pk3", EnginePath, nameOFmap );
remove( packname ); remove( packname );
@ -2198,83 +2200,83 @@ skipEXfile:
for ( i = 0; i < pk3TexturesN; i++ ){ for ( i = 0; i < pk3TexturesN; i++ ){
if ( png ){ if ( png ){
sprintf( temp, "%s.png", pk3Textures[i] ); sprintf( temp, "%s.png", pk3Textures + i*65 );
if ( vfsPackFile( temp, packname ) ){ if ( vfsPackFile( temp, packname ) ){
Sys_Printf( "++%s\n", temp ); Sys_Printf( "++%s\n", temp );
continue; continue;
} }
} }
sprintf( temp, "%s.tga", pk3Textures[i] ); sprintf( temp, "%s.tga", pk3Textures + i*65 );
if ( vfsPackFile( temp, packname ) ){ if ( vfsPackFile( temp, packname ) ){
Sys_Printf( "++%s\n", temp ); Sys_Printf( "++%s\n", temp );
continue; continue;
} }
sprintf( temp, "%s.jpg", pk3Textures[i] ); sprintf( temp, "%s.jpg", pk3Textures + i*65 );
if ( vfsPackFile( temp, packname ) ){ if ( vfsPackFile( temp, packname ) ){
Sys_Printf( "++%s\n", temp ); Sys_Printf( "++%s\n", temp );
continue; continue;
} }
Sys_Printf( " !FAIL! %s\n", pk3Textures[i] ); Sys_Printf( " !FAIL! %s\n", pk3Textures + i*65 );
} }
Sys_Printf( "\n\tPure textures....\n" ); Sys_Printf( "\n\tPure textures....\n" );
for ( i = 0; i < pk3ShadersN; i++ ){ for ( i = 0; i < pk3ShadersN; i++ ){
if ( pk3Shaders[i][0] != '\0' ){ if ( *( pk3Shaders + i*65 ) != '\0' ){
if ( png ){ if ( png ){
sprintf( temp, "%s.png", pk3Shaders[i] ); sprintf( temp, "%s.png", pk3Shaders + i*65 );
if ( vfsPackFile( temp, packname ) ){ if ( vfsPackFile( temp, packname ) ){
Sys_Printf( "++%s\n", temp ); Sys_Printf( "++%s\n", temp );
continue; continue;
} }
} }
sprintf( temp, "%s.tga", pk3Shaders[i] ); sprintf( temp, "%s.tga", pk3Shaders + i*65 );
if ( vfsPackFile( temp, packname ) ){ if ( vfsPackFile( temp, packname ) ){
Sys_Printf( "++%s\n", temp ); Sys_Printf( "++%s\n", temp );
continue; continue;
} }
sprintf( temp, "%s.jpg", pk3Shaders[i] ); sprintf( temp, "%s.jpg", pk3Shaders + i*65 );
if ( vfsPackFile( temp, packname ) ){ if ( vfsPackFile( temp, packname ) ){
Sys_Printf( "++%s\n", temp ); Sys_Printf( "++%s\n", temp );
continue; continue;
} }
Sys_Printf( " !FAIL! %s\n", pk3Shaders[i] ); Sys_Printf( " !FAIL! %s\n", pk3Shaders + i*65 );
} }
} }
Sys_Printf( "\n\tShaizers....\n" ); Sys_Printf( "\n\tShaizers....\n" );
for ( i = 0; i < pk3ShaderfilesN; i++ ){ for ( i = 0; i < pk3ShaderfilesN; i++ ){
if ( pk3Shaderfiles[i][0] != '\0' ){ if ( *( pk3Shaderfiles + i*65 ) != '\0' ){
sprintf( temp, "%s/%s", game->shaderPath, pk3Shaderfiles[ i ] ); sprintf( temp, "%s/%s", game->shaderPath, pk3Shaderfiles + i*65 );
if ( vfsPackFile( temp, packname ) ){ if ( vfsPackFile( temp, packname ) ){
Sys_Printf( "++%s\n", temp ); Sys_Printf( "++%s\n", temp );
continue; continue;
} }
Sys_Printf( " !FAIL! %s\n", pk3Shaders[i] ); Sys_Printf( " !FAIL! %s\n", pk3Shaders + i*65 );
} }
} }
Sys_Printf( "\n\tSounds....\n" ); Sys_Printf( "\n\tSounds....\n" );
for ( i = 0; i < pk3SoundsN; i++ ){ for ( i = 0; i < pk3SoundsN; i++ ){
if ( pk3Sounds[i][0] != '\0' ){ if ( *( pk3Sounds + i*65 ) != '\0' ){
if ( vfsPackFile( pk3Sounds[ i ], packname ) ){ if ( vfsPackFile( pk3Sounds + i*65, packname ) ){
Sys_Printf( "++%s\n", pk3Sounds[ i ] ); Sys_Printf( "++%s\n", pk3Sounds + i*65 );
continue; continue;
} }
Sys_Printf( " !FAIL! %s\n", pk3Sounds[i] ); Sys_Printf( " !FAIL! %s\n", pk3Sounds + i*65 );
} }
} }
Sys_Printf( "\n\tVideos....\n" ); Sys_Printf( "\n\tVideos....\n" );
for ( i = 0; i < pk3VideosN; i++ ){ for ( i = 0; i < pk3VideosN; i++ ){
if ( vfsPackFile( pk3Videos[i], packname ) ){ if ( vfsPackFile( pk3Videos + i*65, packname ) ){
Sys_Printf( "++%s\n", pk3Videos[i] ); Sys_Printf( "++%s\n", pk3Videos + i*65 );
continue; continue;
} }
Sys_Printf( " !FAIL! %s\n", pk3Videos[i] ); Sys_Printf( " !FAIL! %s\n", pk3Videos + i*65 );
} }
Sys_Printf( "\n\t.\n" ); Sys_Printf( "\n\t.\n" );