From: Thomas Debesse Date: Mon, 25 May 2020 19:22:53 +0000 (+0200) Subject: Merge commit 'bf6dd1f2d186c799adf11f1e744a1ff57aa8d335' into garux-merge X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=84881a66140ad93d0b6cd4d55efbbb459bd91f48;hp=020d0244e4239b21dc804d630edff926386ea34f;p=xonotic%2Fnetradiant.git Merge commit 'bf6dd1f2d186c799adf11f1e744a1ff57aa8d335' into garux-merge --- diff --git a/tools/quake3/common/scriplib.c b/tools/quake3/common/scriplib.c index d726c04b..7a5079ea 100644 --- a/tools/quake3/common/scriplib.c +++ b/tools/quake3/common/scriplib.c @@ -175,7 +175,7 @@ void UnGetToken( void ){ qboolean EndOfScript( qboolean crossline ){ if ( !crossline ) { - Error( "Line %i is incomplete\n",scriptline ); + Error( "Line %i is incomplete\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } if ( !strcmp( script->filename, "memory buffer" ) ) { @@ -234,7 +234,7 @@ skipspace: } if ( *script->script_p++ == '\n' ) { if ( !crossline ) { - Error( "Line %i is incomplete\n",scriptline ); + Error( "Line %i is incomplete\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } script->line++; scriptline = script->line; @@ -249,7 +249,7 @@ skipspace: if ( *script->script_p == ';' || *script->script_p == '#' || ( script->script_p[0] == '/' && script->script_p[1] == '/' ) ) { if ( !crossline ) { - Error( "Line %i is incomplete\n",scriptline ); + Error( "Line %i is incomplete\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } while ( *script->script_p++ != '\n' ) if ( script->script_p >= script->end_p ) { @@ -263,7 +263,7 @@ skipspace: // /* */ comments if ( script->script_p[0] == '/' && script->script_p[1] == '*' ) { if ( !crossline ) { - Error( "Line %i is incomplete\n",scriptline ); + Error( "Line %i is incomplete\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } script->script_p += 2; while ( script->script_p[0] != '*' && script->script_p[1] != '/' ) @@ -296,7 +296,7 @@ skipspace: break; } if ( token_p == &token[MAXTOKEN] ) { - Error( "Token too large on line %i\n",scriptline ); + Error( "Token too large on line %i\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } } script->script_p++; @@ -309,7 +309,7 @@ skipspace: break; } if ( token_p == &token[MAXTOKEN] ) { - Error( "Token too large on line %i\n",scriptline ); + Error( "Token too large on line %i\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } } } diff --git a/tools/quake3/common/vfs.c b/tools/quake3/common/vfs.c index e8648e81..362bffe1 100644 --- a/tools/quake3/common/vfs.c +++ b/tools/quake3/common/vfs.c @@ -59,6 +59,7 @@ typedef struct { + char* unzFilePath; char* name; unzFile zipfile; unz_file_pos zippos; @@ -75,6 +76,7 @@ static int g_numDirs; char g_strForbiddenDirs[VFS_MAXDIRS][PATH_MAX + 1]; int g_numForbiddenDirs = 0; static gboolean g_bUsePak = TRUE; +char g_strLoadedFileLocation[1024]; // ============================================================================= // Static functions @@ -124,6 +126,8 @@ static void vfsInitPakFile( const char *filename ){ } unzGoToFirstFile( uf ); + char* unzFilePath = strdup( filename ); + for ( i = 0; i < gi.number_entry; i++ ) { char filename_inzip[NAME_MAX]; @@ -151,6 +155,7 @@ static void vfsInitPakFile( const char *filename ){ file->name = strdup( filename_lower ); file->size = file_info.uncompressed_size; file->zipfile = uf; + file->unzFilePath = unzFilePath; file->zippos = pos; if ( ( i + 1 ) < gi.number_entry ) { @@ -334,6 +339,7 @@ void vfsShutdown(){ while ( g_pakFiles ) { VFS_PAKFILE* file = (VFS_PAKFILE*)g_pakFiles->data; + free( file->unzFilePath ); free( file->name ); free( file ); g_pakFiles = g_slist_remove( g_pakFiles, file ); @@ -381,6 +387,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){ // filename is a full path if ( index == -1 ) { + strcpy( g_strLoadedFileLocation, filename ); long len; FILE *f; @@ -422,6 +429,8 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){ strcat( tmp, filename ); if ( access( tmp, R_OK ) == 0 ) { if ( count == index ) { + strcpy( g_strLoadedFileLocation, tmp ); + long len; FILE *f; @@ -465,6 +474,10 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){ } if ( count == index ) { + strcpy( g_strLoadedFileLocation, file->unzFilePath ); + strcat( g_strLoadedFileLocation, " :: " ); + strcat( g_strLoadedFileLocation, filename ); + if ( unzGoToFilePos( file->zipfile, &file->zippos ) != UNZ_OK ) { return -1; diff --git a/tools/quake3/common/vfs.h b/tools/quake3/common/vfs.h index f39a2d78..019bfed7 100644 --- a/tools/quake3/common/vfs.h +++ b/tools/quake3/common/vfs.h @@ -62,5 +62,6 @@ qboolean vfsPackFile_Absolute_Path( const char *filepath, const char *filename, extern char g_strForbiddenDirs[VFS_MAXDIRS][PATH_MAX + 1]; extern int g_numForbiddenDirs; +extern char g_strLoadedFileLocation[1024]; #endif // _VFS_H_ diff --git a/tools/quake3/q3map2/bspfile_abstract.c b/tools/quake3/q3map2/bspfile_abstract.c index 33583126..a42ba5ed 100644 --- a/tools/quake3/q3map2/bspfile_abstract.c +++ b/tools/quake3/q3map2/bspfile_abstract.c @@ -395,8 +395,7 @@ void PartialLoadBSPFile( const char *filename ){ PartialLoadIBSPFile( filename ); /* PartialSwapBSPFile() */ - int i, j; - shaderInfo_t *si; + int i; /* shaders (don't swap the name) */ for ( i = 0; i < numBSPShaders ; i++ ) diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index 50eac5af..bfcd53ad 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -683,8 +683,8 @@ skipEXfile: break; } if ( strcmp( token, "{" ) ) { - Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s", - temp, scriptline, token ); + Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s\nFile location be: %s", + temp, scriptline, token, g_strLoadedFileLocation ); } while ( 1 ) @@ -737,8 +737,8 @@ skipEXfile: break; } if ( strcmp( token, "{" ) ) { - Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s", - temp, scriptline, token ); + Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s\nFile location be: %s", + temp, scriptline, token, g_strLoadedFileLocation ); } qboolean hasmap = qfalse; @@ -1685,8 +1685,8 @@ skipEXrefile: break; } if ( strcmp( token, "{" ) ) { - Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s", - temp, scriptline, token ); + Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s\nFile location be: %s", + temp, scriptline, token, g_strLoadedFileLocation ); } strcat( shaderText, "\n{" ); qboolean hasmap = qfalse; diff --git a/tools/quake3/q3map2/shaders.c b/tools/quake3/q3map2/shaders.c index 10b2b414..0f8b56b4 100644 --- a/tools/quake3/q3map2/shaders.c +++ b/tools/quake3/q3map2/shaders.c @@ -947,17 +947,17 @@ void Parse1DMatrixAppend( char *buffer, int x, vec_t *m ){ if ( !GetTokenAppend( buffer, qtrue ) || strcmp( token, "(" ) ) { - Error( "Parse1DMatrixAppend(): line %d: ( not found!", scriptline ); + Error( "Parse1DMatrixAppend(): line %d: ( not found!\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } for ( i = 0; i < x; i++ ) { if ( !GetTokenAppend( buffer, qfalse ) ) { - Error( "Parse1DMatrixAppend(): line %d: Number not found!", scriptline ); + Error( "Parse1DMatrixAppend(): line %d: Number not found!\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } m[ i ] = atof( token ); } if ( !GetTokenAppend( buffer, qtrue ) || strcmp( token, ")" ) ) { - Error( "Parse1DMatrixAppend(): line %d: ) not found!", scriptline ); + Error( "Parse1DMatrixAppend(): line %d: ) not found!\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } } @@ -1019,12 +1019,12 @@ static void ParseShaderFile( const char *filename ){ } if ( strcmp( token, "{" ) ) { if ( si != NULL ) { - Error( "ParseShaderFile(): %s, line %d: { not found!\nFound instead: %s\nLast known shader: %s", - filename, scriptline, token, si->shader ); + Error( "ParseShaderFile(): %s, line %d: { not found!\nFound instead: %s\nLast known shader: %s\nFile location be: %s\n", + filename, scriptline, token, si->shader, g_strLoadedFileLocation ); } else{ - Error( "ParseShaderFile(): %s, line %d: { not found!\nFound instead: %s", - filename, scriptline, token ); + Error( "ParseShaderFile(): %s, line %d: { not found!\nFound instead: %s\nFile location be: %s\n", + filename, scriptline, token, g_strLoadedFileLocation ); } }