]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit 'bf6dd1f2d186c799adf11f1e744a1ff57aa8d335' into garux-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 25 May 2020 19:22:53 +0000 (21:22 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 25 May 2020 19:22:53 +0000 (21:22 +0200)
tools/quake3/common/scriplib.c
tools/quake3/common/vfs.c
tools/quake3/common/vfs.h
tools/quake3/q3map2/bspfile_abstract.c
tools/quake3/q3map2/main.c
tools/quake3/q3map2/shaders.c

index d726c04b072d3d3bc2cc461b77441c91f76dd2d7..7a5079ead40ee1d19a39da4b9bbd6c10135511f6 100644 (file)
@@ -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 );
                        }
                }
        }
index e8648e813fd25b95b0b95bff8ef85eff35244ddb..362bffe1e6499bfbb8bf0ac60a4ffa58b4bcca16 100644 (file)
@@ -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;
index f39a2d786da5600af2256b9d6917ab375ba4d30a..019bfed74df689c51ba0df6bf084c1ca430a8626 100644 (file)
@@ -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_
index 33583126e0c4ffbc8a72c4cf97205c5880842217..a42ba5ed01bd37ee5898930d23dc2ea8bc33b5c8 100644 (file)
@@ -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++ )
index 50eac5afe6792b19ff7c64f6ebc55e79ed08ee89..bfcd53adf65b75a4046e255381bb86fa708577ba 100644 (file)
@@ -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;
index 10b2b414fcf70181aaec69e0e10a3ead9ad1ddd8..0f8b56b47834a08321a46ee1db280433a934179f 100644 (file)
@@ -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 );
                        }
                }