]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/common/scriplib.c
Merge commit '19992696033a496e5c0925e950a29dc23de49b47' into master-merge
[xonotic/netradiant.git] / tools / quake3 / common / scriplib.c
index e17124eb6506a59f077227bbd485e22c9100912d..3caa6879111b777558dcd348c71fd66777bea49f 100644 (file)
@@ -101,7 +101,35 @@ void LoadScriptFile( const char *filename, int index ){
        endofscript = qfalse;
        tokenready = qfalse;
 }
+/* &unload current; for autopacker */
+void SilentLoadScriptFile( const char *filename, int index ){
+       int size;
+
+       if ( script->buffer != NULL && !endofscript ) {
+               free( script->buffer );
+               script->buffer = NULL;
+       }
+
+       script = scriptstack;
+
+       script++;
+       if ( script == &scriptstack[MAX_INCLUDES] ) {
+               Error( "script file exceeded MAX_INCLUDES" );
+       }
+       strcpy( script->filename, ExpandPath( filename ) );
 
+       size = vfsLoadFile( script->filename, (void **)&script->buffer, index );
+
+       if ( size == -1 ) {
+               Sys_Printf( "Script file %s was not found\n", script->filename );
+       }
+       script->line = 1;
+       script->script_p = script->buffer;
+       script->end_p = script->buffer + size;
+
+       endofscript = qfalse;
+       tokenready = qfalse;
+}
 
 /*
    ==============