1 /* -------------------------------------------------------------------------------
3 Copyright (C) 1999-2013 id Software, Inc. and contributors.
4 For a list of contributors, see the accompanying CONTRIBUTORS file.
6 This file is part of GtkRadiant.
8 GtkRadiant is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 GtkRadiant is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GtkRadiant; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 ----------------------------------------------------------------------------------
24 This code has been altered significantly from its original form, to support
25 several games based on the Quake III Arena engine, in the form of "Q3Map2."
27 ------------------------------------------------------------------------------- */
42 /* -------------------------------------------------------------------------------
44 this file contains code that exports entities to a .ent file.
46 ------------------------------------------------------------------------------- */
50 exports the entities to a text file (.ent)
53 void ExportEntities( void ){
54 char filename[ 1024 ];
58 Sys_FPrintf( SYS_VRB, "--- ExportEntities ---\n" );
60 /* do some path mangling */
61 strcpy( filename, source );
62 StripExtension( filename );
63 strcat( filename, ".ent" );
66 if ( bspEntData == NULL || bspEntDataSize == 0 ) {
67 Sys_FPrintf( SYS_WRN, "WARNING: No BSP entity data. aborting...\n" );
72 Sys_Printf( "Writing %s\n", filename );
73 Sys_FPrintf( SYS_VRB, "(%d bytes)\n", bspEntDataSize );
74 file = fopen( filename, "w" );
77 Error( "Unable to open %s for writing", filename );
80 fprintf( file, "%s\n", bspEntData );
88 exports the entities to a text file (.ent)
91 int ExportEntitiesMain( int argc, char **argv ){
94 Sys_Printf( "Usage: q3map -exportents [-v] <mapname>\n" );
98 /* do some path mangling */
99 strcpy( source, ExpandArg( argv[ argc - 1 ] ) );
100 StripExtension( source );
101 DefaultExtension( source, ".bsp" );
104 Sys_Printf( "Loading %s\n", source );
105 LoadBSPFile( source );
107 /* export the lightmaps */
110 /* return to sender */