]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
split fixaas stuff from q3map2
authorThomas Debesse <dev@illwieckz.net>
Tue, 21 Jul 2015 01:41:24 +0000 (03:41 +0200)
committerThomas Debesse <dev@illwieckz.net>
Wed, 13 Apr 2016 23:00:15 +0000 (01:00 +0200)
Makefile
tools/quake3/q3map2/fixaas.c [new file with mode: 0644]
tools/quake3/q3map2/main.c
tools/quake3/q3map2/q3map2.h

index 9310854720ad417b541159126ec7431bdb61d321..2ad7c0a84f3f5fc0d806302721b3ba89532b8483 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -510,6 +510,7 @@ $(INSTALLDIR)/q3map2.$(EXE): \
        tools/quake3/q3map2/convert_map.o \
        tools/quake3/q3map2/decals.o \
        tools/quake3/q3map2/facebsp.o \
        tools/quake3/q3map2/convert_map.o \
        tools/quake3/q3map2/decals.o \
        tools/quake3/q3map2/facebsp.o \
+       tools/quake3/q3map2/fixaas.o \
        tools/quake3/q3map2/fog.o \
        tools/quake3/q3map2/help.o \
        tools/quake3/q3map2/image.o \
        tools/quake3/q3map2/fog.o \
        tools/quake3/q3map2/help.o \
        tools/quake3/q3map2/image.o \
diff --git a/tools/quake3/q3map2/fixaas.c b/tools/quake3/q3map2/fixaas.c
new file mode 100644 (file)
index 0000000..e08cd13
--- /dev/null
@@ -0,0 +1,110 @@
+/* -------------------------------------------------------------------------------
+
+   Copyright (C) 1999-2007 id Software, Inc. and contributors.
+   For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+   This file is part of GtkRadiant.
+
+   GtkRadiant is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   GtkRadiant is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GtkRadiant; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+   -------------------------------------------------------------------------------
+
+   This code has been altered significantly from its original form, to support
+   several games based on the Quake III Arena engine, in the form of "Q3Map2."
+
+   ------------------------------------------------------------------------------- */
+
+
+
+/* dependencies */
+#include "q3map2.h"
+
+
+
+/*
+   MD4BlockChecksum()
+   calculates an md4 checksum for a block of data
+ */
+
+static int MD4BlockChecksum( void *buffer, int length ){
+       return Com_BlockChecksum( buffer, length );
+}
+
+/*
+   FixAASMain()
+   resets an aas checksum to match the given BSP
+ */
+
+int FixAASMain( int argc, char **argv ){
+       int length, checksum;
+       void        *buffer;
+       FILE        *file;
+       char aas[ 1024 ], **ext;
+       char        *exts[] =
+       {
+               ".aas",
+               "_b0.aas",
+               "_b1.aas",
+               NULL
+       };
+
+
+       /* arg checking */
+       if ( argc < 2 ) {
+               Sys_Printf( "Usage: q3map -fixaas [-v] <mapname>\n" );
+               return 0;
+       }
+
+       /* do some path mangling */
+       strcpy( source, ExpandArg( argv[ argc - 1 ] ) );
+       StripExtension( source );
+       DefaultExtension( source, ".bsp" );
+
+       /* note it */
+       Sys_Printf( "--- FixAAS ---\n" );
+
+       /* load the bsp */
+       Sys_Printf( "Loading %s\n", source );
+       length = LoadFile( source, &buffer );
+
+       /* create bsp checksum */
+       Sys_Printf( "Creating checksum...\n" );
+       checksum = LittleLong( MD4BlockChecksum( buffer, length ) );
+
+       /* write checksum to aas */
+       ext = exts;
+       while ( *ext )
+       {
+               /* mangle name */
+               strcpy( aas, source );
+               StripExtension( aas );
+               strcat( aas, *ext );
+               Sys_Printf( "Trying %s\n", aas );
+               ext++;
+
+               /* fix it */
+               file = fopen( aas, "r+b" );
+               if ( !file ) {
+                       continue;
+               }
+               if ( fwrite( &checksum, 4, 1, file ) != 1 ) {
+                       Error( "Error writing checksum to %s", aas );
+               }
+               fclose( file );
+       }
+
+       /* return to sender */
+       return 0;
+}
index 20161484e690534b664df76794f6570782631e94..c106c91bbd177ed88e6dbc4df8e1beffece8b7e1 100644 (file)
@@ -92,82 +92,6 @@ static void ExitQ3Map( void ){
        }
 }
 
        }
 }
 
-/*
-   MD4BlockChecksum()
-   calculates an md4 checksum for a block of data
- */
-
-static int MD4BlockChecksum( void *buffer, int length ){
-       return Com_BlockChecksum( buffer, length );
-}
-
-/*
-   FixAAS()
-   resets an aas checksum to match the given BSP
- */
-
-int FixAAS( int argc, char **argv ){
-       int length, checksum;
-       void        *buffer;
-       FILE        *file;
-       char aas[ 1024 ], **ext;
-       char        *exts[] =
-       {
-               ".aas",
-               "_b0.aas",
-               "_b1.aas",
-               NULL
-       };
-
-
-       /* arg checking */
-       if ( argc < 2 ) {
-               Sys_Printf( "Usage: q3map -fixaas [-v] <mapname>\n" );
-               return 0;
-       }
-
-       /* do some path mangling */
-       strcpy( source, ExpandArg( argv[ argc - 1 ] ) );
-       StripExtension( source );
-       DefaultExtension( source, ".bsp" );
-
-       /* note it */
-       Sys_Printf( "--- FixAAS ---\n" );
-
-       /* load the bsp */
-       Sys_Printf( "Loading %s\n", source );
-       length = LoadFile( source, &buffer );
-
-       /* create bsp checksum */
-       Sys_Printf( "Creating checksum...\n" );
-       checksum = LittleLong( MD4BlockChecksum( buffer, length ) );
-
-       /* write checksum to aas */
-       ext = exts;
-       while ( *ext )
-       {
-               /* mangle name */
-               strcpy( aas, source );
-               StripExtension( aas );
-               strcat( aas, *ext );
-               Sys_Printf( "Trying %s\n", aas );
-               ext++;
-
-               /* fix it */
-               file = fopen( aas, "r+b" );
-               if ( !file ) {
-                       continue;
-               }
-               if ( fwrite( &checksum, 4, 1, file ) != 1 ) {
-                       Error( "Error writing checksum to %s", aas );
-               }
-               fclose( file );
-       }
-
-       /* return to sender */
-       return 0;
-}
-
 /*
    main()
    q3map mojo...
 /*
    main()
    q3map mojo...
@@ -283,7 +207,7 @@ int main( int argc, char **argv ){
 
        /* fixaas */
        if ( !strcmp( argv[ 1 ], "-fixaas" ) ) {
 
        /* fixaas */
        if ( !strcmp( argv[ 1 ], "-fixaas" ) ) {
-               r = FixAAS( argc - 1, argv + 1 );
+               r = FixAASMain( argc - 1, argv + 1 );
        }
 
        /* analyze */
        }
 
        /* analyze */
index 5f9c9de6aa0caecb5f20ade7a756feea42ecb893..53bb60dac2502eae5ed8da79c8b0b1398dc44547 100644 (file)
@@ -1523,6 +1523,8 @@ void                        HelpMain(const char* arg);
 game_t                      *GetGame( char *arg );
 void                        InitPaths( int *argc, char **argv );
 
 game_t                      *GetGame( char *arg );
 void                        InitPaths( int *argc, char **argv );
 
+/* fixaas.c */
+int                         FixAASMain( int argc, char **argv );
 
 /* bsp.c */
 int                         BSPMain( int argc, char **argv );
 
 /* bsp.c */
 int                         BSPMain( int argc, char **argv );
@@ -1552,7 +1554,6 @@ int                         ConvertBSPToASE( char *bspName );
 /* convert_obj.c */
 int                         ConvertBSPToOBJ( char *bspName );
 
 /* convert_obj.c */
 int                         ConvertBSPToOBJ( char *bspName );
 
-
 /* brush.c */
 sideRef_t                   *AllocSideRef( side_t *side, sideRef_t *next );
 int                         CountBrushList( brush_t *brushes );
 /* brush.c */
 sideRef_t                   *AllocSideRef( side_t *side, sideRef_t *next );
 int                         CountBrushList( brush_t *brushes );