q3map2/game_quake3.h
q3map2/game_quakelive.h
q3map2/game_reaction.h
+ q3map2/game_smokinguns.h
q3map2/game_sof2.h
q3map2/game_tenebrae.h
q3map2/game_tremulous.h
0, /* max lightmapped surface verts */
0, /* max surface verts */
0, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
NULL, /* default flare shader */
qfalse, /* wolf lighting model? */
999, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
1024, /* max lightmapped surface verts */
1024, /* max surface verts */
6144, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qtrue, /* flares */
"gfx/misc/flare", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qtrue, /* flares */
"gfx/misc/flare", /* default flare shader */
qfalse, /* wolf lighting model? */
999, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
65535, /* max lightmapped surface verts */
65535, /* max surface verts */
393210, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
/* -------------------------------------------------------------------------------
- Copyright (C) 1999-2007 id Software, Inc. and contributors.
- For a list of contributors, see the accompanying CONTRIBUTORS file.
+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.
+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 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.
+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
+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."
+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."
- ------------------------------------------------------------------------------- */
+------------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------------
-content and surface flags
+content and surface flags - also uses defines from game_quake3.h
------------------------------------------------------------------------------- */
/* game flags */
-// Support content making dynamite explodes and molotov burns
-#define Q_CONT_EXPLOSIVE 2
-#define Q_CONT_FLAMMABLE 4
-#define Q_CONT_BURNING_SOLID Q_CONT_SOLID|Q_CONT_EXPLOSIVE|Q_CONT_FLAMMABLE
+// support content making dynamite explodes and molotov burns
+#define SG_CONT_EXPLOSIVE 2
+#define SG_CONT_FLAMMABLE 4
+#define SG_CONT_BURNING_SOLID (Q_CONT_SOLID | SG_CONT_EXPLOSIVE | SG_CONT_FLAMMABLE )
+
+// see q3map2.h for tex surface flags
/* -------------------------------------------------------------------------------
------------------------------------------------------------------------------- */
{
- "smokinguns", /* -game x */
- "smokinguns", /* default base game data dir */
- ".smokinguns", /* unix home sub-dir */
- "smokinguns", /* magic path word */
- "scripts", /* shader directory */
- 64, /* max lightmapped surface verts */
- 999, /* max surface verts */
- 6000, /* max surface indexes */
- qfalse, /* flares */
- "flareshader", /* default flare shader */
- qfalse, /* wolf lighting model? */
- 128, /* lightmap width/height */
- 1.0f, /* lightmap gamma */
- 1.0f, /* lightmap compensate */
- "IBSP", /* bsp file prefix */
- 46, /* bsp file version */
- qfalse, /* cod-style lump len/ofs order */
- LoadIBSPFile, /* bsp load function */
- WriteIBSPFile, /* bsp write function */
+ "smokinguns", /* -game x */
+ "smokinguns", /* default base game data dir */
+ ".smokinguns", /* unix home sub-dir */
+ "smokinguns", /* magic path word */
+ "scripts", /* shader directory */
+ 1048575, /* max lightmapped surface verts */
+ 1048575, /* max surface verts */
+ 1048575, /* max surface indexes */
+ qtrue, /* enable per shader prefix surface flags and .tex file */
+ qfalse, /* flares */
+ "flareshader", /* default flare shader */
+ qfalse, /* wolf lighting model? */
+ 128, /* lightmap width/height */
+ 1.0f, /* lightmap gamma */
+ qfalse, /* lightmap sRGB */
+ qfalse, /* texture sRGB */
+ qfalse, /* color sRGB */
+ 0.0f, /* lightmap exposure */
+ 1.0f, /* lightmap compensate */
+ 1.0f, /* lightgrid scale */
+ 1.0f, /* lightgrid ambient scale */
+ qfalse, /* light angle attenuation uses half-lambert curve */
+ qfalse, /* disable shader lightstyles hack */
+ qtrue, /* keep light entities on bsp */
+ 8, /* default patchMeta subdivisions tolerance */
+ qfalse, /* patch casting enabled */
+ qfalse, /* compile deluxemaps */
+ 0, /* deluxemaps default mode */
+ 512, /* minimap size */
+ 1.0f, /* minimap sharpener */
+ 0.0f, /* minimap border */
+ qtrue, /* minimap keep aspect */
+ MINIMAP_MODE_WHITE, /* minimap mode */
+ "../minimaps/%s.tga", /* minimap name format */
+ "IBSP", /* bsp file prefix */
+ 46, /* bsp file version */
+ qfalse, /* cod-style lump len/ofs order */
+ LoadIBSPFile, /* bsp load function */
+ WriteIBSPFile, /* bsp write function */
{
/* name contentFlags contentFlagsClear surfaceFlags surfaceFlagsClear compileFlags compileFlagsClear */
{ "water", Q_CONT_WATER, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
{ "slime", Q_CONT_SLIME, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
- { "lava", Q_CONT_LAVA, Q_CONT_BURNING_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
+ { "lava", Q_CONT_LAVA, SG_CONT_BURNING_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
{ "playerclip", Q_CONT_PLAYERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
{ "monsterclip", Q_CONT_MONSTERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
{ "dust", 0, 0, Q_SURF_DUST, 0, 0, 0 },
/* materials */
- { "metal", 0, 0, Q_SURF_METALSTEPS, 0, 0, 0 },
- { "wood", 0, 0, Q_SURF_WOOD, 0, 0, 0 },
- { "cloth", 0, 0, Q_SURF_CLOTH, 0, 0, 0 },
- { "dirt", 0, 0, Q_SURF_DIRT, 0, 0, 0 },
- { "glass", 0, 0, Q_SURF_GLASS, 0, 0, 0 },
- { "plant", 0, 0, Q_SURF_PLANT, 0, 0, 0 },
- { "sand", 0, 0, Q_SURF_SAND, 0, 0, 0 },
- { "snow", 0, 0, Q_SURF_SNOW, 0, 0, 0 },
- { "stone", 0, 0, Q_SURF_STONE, 0, 0, 0 },
- { "water", 0, 0, Q_SURF_WATER, 0, 0, 0 },
- { "grass", 0, 0, Q_SURF_GRASS, 0, 0, 0 },
+ { "metal", 0, 0, TEX_SURF_METAL, 0, 0, 0 },
+ { "wood", 0, 0, TEX_SURF_WOOD, 0, 0, 0 },
+ { "cloth", 0, 0, TEX_SURF_CLOTH, 0, 0, 0 },
+ { "dirt", 0, 0, TEX_SURF_DIRT, 0, 0, 0 },
+ { "glass", 0, 0, TEX_SURF_GLASS, 0, 0, 0 },
+ { "plant", 0, 0, TEX_SURF_PLANT, 0, 0, 0 },
+ { "sand", 0, 0, TEX_SURF_SAND, 0, 0, 0 },
+ { "snow", 0, 0, TEX_SURF_SNOW, 0, 0, 0 },
+ { "stone", 0, 0, TEX_SURF_STONE, 0, 0, 0 },
+ { "water", 0, 0, TEX_SURF_WATER, 0, 0, 0 },
+ { "grass", 0, 0, TEX_SURF_GRASS, 0, 0, 0 },
/* null */
{ NULL, 0, 0, 0, 0, 0, 0 }
}
}
-
-
/* end marker */
#endif
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qtrue, /* flares */
"gfx/misc/lens_flare", /* default flare shader */
qfalse, /* wolf lighting model? */
1024, /* max lightmapped surface verts */
1024, /* max surface verts */
6144, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
1048575, /* max lightmapped surface verts */
1048575, /* max surface verts */
1048575, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
64, /* max lightmapped surface verts */
999, /* max surface verts */
6000, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qtrue, /* wolf lighting model? */
1024, /* max lightmapped surface verts */
1024, /* max surface verts */
6144, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qtrue, /* wolf lighting model? */
1048575, /* max lightmapped surface verts */
1048575, /* max surface verts */
1048575, /* max surface indexes */
+ qfalse, /* enable per shader prefix surface flags and .tex file */
qfalse, /* flares */
"flareshader", /* default flare shader */
qfalse, /* wolf lighting model? */
-#ifdef SMOKINGUNS
-//added by spoon to get back the changed surfaceflags
-void LoadSurfaceFlags(char *filename){
+/*
+ LoadSurfaceFlags()
+ added by spoon to get back the changed surfaceflags
+ from tex file
+*/
+
+void LoadSurfaceFlags( char *filename ) {
int i;
- for(i=0; i<numBSPShaders;i++){
- shaderInfo_t *si;
+ for( i = 0; i < numBSPShaders; i++ ) {
+ shaderInfo_t *si;
si = ShaderInfoForShader( bspShaders[i].shader );
- bspShaders[i].surfaceFlags = si->surfaceFlags;
+ bspShaders[ i ].surfaceFlags = si->surfaceFlags;
}
}
-#endif
}
/* ydnar: otherwise create a bsp */
- else{
-#ifdef SMOKINGUNS
+ else {
+ /* used to write Smokin'Guns like tex file */
compile_map = qtrue;
-#endif
+
r = BSPMain( argc, argv );
}
#define C_DETAIL 0x08000000 /* THIS MUST BE THE SAME AS IN RADIANT! */
-#ifdef SMOKINGUNS
-// new Smokin'Guns surface flags
-#define Q_SURF_METAL 0x00001000
-#define Q_SURF_WOOD 0x00080000
-#define Q_SURF_CLOTH 0x00100000
-#define Q_SURF_DIRT 0x00200000
-#define Q_SURF_GLASS 0x00400000
-#define Q_SURF_PLANT 0x00800000
-#define Q_SURF_SAND 0x01000000
-#define Q_SURF_SNOW 0x02000000
-#define Q_SURF_STONE 0x04000000
-#define Q_SURF_WATER 0x08000000
-#define Q_SURF_GRASS 0x10000000
-#define Q_SURF_BREAKABLE 0x20000000
-#endif
+/* new tex surface flags, like Smokin'Guns */
+#define TEX_SURF_METAL 0x00001000
+#define TEX_SURF_WOOD 0x00080000
+#define TEX_SURF_CLOTH 0x00100000
+#define TEX_SURF_DIRT 0x00200000
+#define TEX_SURF_GLASS 0x00400000
+#define TEX_SURF_PLANT 0x00800000
+#define TEX_SURF_SAND 0x01000000
+#define TEX_SURF_SNOW 0x02000000
+#define TEX_SURF_STONE 0x04000000
+#define TEX_SURF_WATER 0x08000000
+#define TEX_SURF_GRASS 0x10000000
+#define TEX_SURF_BREAKABLE 0x20000000
/* shadow flags */
int maxLMSurfaceVerts; /* default maximum meta surface verts */
int maxSurfaceVerts; /* default maximum surface verts */
int maxSurfaceIndexes; /* default maximum surface indexes (tris * 3) */
+ qboolean texFile; /* enable per shader prefix surface flags and .tex file */
qboolean emitFlares; /* when true, emit flare surfaces */
char *flareShader; /* default flare shader (MUST BE SET) */
qboolean wolfLight; /* when true, lights work like wolf q3map */
void WriteBSPFile( const char *filename );
void PrintBSPFileSizes( void );
-#ifdef SMOKINGUNS
-void WriteTexFile(char *name);
-void LoadSurfaceFlags(char *filename);
-int GetSurfaceParm(const char *tex);
-void RestoreSurfaceFlags(char *filename);
-#endif
+void WriteTexFile( char *name );
+void LoadSurfaceFlags( char *filename );
+int GetSurfaceParm( const char *tex );
+void RestoreSurfaceFlags( char *filename );
epair_t *ParseEPair( void );
void ParseEntities( void );
#include "game_qfusion.h" /* qfusion game */
,
#include "game_reaction.h" /* must be after game_quake3.h */
-#ifdef SMOKINGUNS
,
- #include "game_smokinguns.h" /* Smokin'Guns */
-#endif
+ #include "game_smokinguns.h" /* must be after game_quake3.h */
,
#include "game_darkplaces.h" /* vortex: darkplaces q1 engine */
,
Q_EXTERN int numBSPAds Q_ASSIGN( 0 );
Q_EXTERN bspAdvertisement_t bspAds[ MAX_MAP_ADVERTISEMENTS ];
-#ifdef SMOKINGUNS
-// Smokin'Guns globals
-Q_EXTERN qboolean compile_map;
-#endif
+// Used for tex file support, Smokin'Guns globals
+Q_EXTERN qboolean compile_map;
#define AUTOEXPAND_BY_REALLOC( ptr, reqitem, allocated, def ) \
do \
Sys_Printf( "Loading %s\n", source );
LoadBSPFile( source );
-#ifdef SMOKINGUNS
- StripExtension (source);
- strcat (source, ".tex");
- LoadSurfaceFlags(source);
- StripExtension (source);
- strcat (source, ".bsp");
-#endif
+ if ( game->texFile )
+ {
+ // smokinguns-like tex file
+ StripExtension( source );
+ strcat( source, ".tex" );
+ LoadSurfaceFlags( source );
+ StripExtension( source );
+ strcat( source, ".bsp" );
+ }
/* load the portal file */
if (!portalFilePath[0]) {
remove( portalFilePath );
}
-#ifdef SMOKINGUNS
- StripExtension (source);
- WriteTexFile(source);
- DefaultExtension (source, ".bsp");
-#endif
+ if ( game->texFile )
+ {
+ // smokinguns-like tex file
+ StripExtension( source );
+ WriteTexFile( source );
+ DefaultExtension( source, ".bsp" );
+ }
/* write the bsp file */
Sys_Printf( "Writing %s\n", source );
/* dependencies */
#include "q3map2.h"
-#ifdef SMOKINGUNS
-#define NUM_PREFIXINFO 11 //very important
+
//prefixInfo-stats
typedef struct {
int surfaceFlags;
} prefixInfo_t;
-
static prefixInfo_t prefixInfo[] = {
- { "metal", Q_SURF_METAL},
- { "wood", Q_SURF_WOOD},
- { "cloth", Q_SURF_CLOTH},
- { "dirt", Q_SURF_DIRT},
- { "glass", Q_SURF_GLASS},
- { "plant", Q_SURF_PLANT},
- { "sand", Q_SURF_SAND},
- { "snow", Q_SURF_SNOW},
- { "stone", Q_SURF_STONE},
- { "water", Q_SURF_WATER},
- { "grass", Q_SURF_GRASS},
+ { "metal", TEX_SURF_METAL},
+ { "wood", TEX_SURF_WOOD},
+ { "cloth", TEX_SURF_CLOTH},
+ { "dirt", TEX_SURF_DIRT},
+ { "glass", TEX_SURF_GLASS},
+ { "plant", TEX_SURF_PLANT},
+ { "sand", TEX_SURF_SAND},
+ { "snow", TEX_SURF_SNOW},
+ { "stone", TEX_SURF_STONE},
+ { "water", TEX_SURF_WATER},
+ { "grass", TEX_SURF_GRASS},
};
+#define NUM_PREFIXINFO 11 /* very important */
+
//Added by Spoon to recognize surfaceparms by shadernames
int GetSurfaceParm(const char *tex){
char surf[MAX_QPATH], tex2[MAX_QPATH];
strcpy(tex2, tex);
- //find last dir
+ /* find last dir */
for(i = 0; i < 64 && tex2[i] != '\0'; i++){
if(tex2[i] == '\\' || tex2[i] == '/')
j=i+1;
}
surf[i] = '\0';
- //Sys_Printf("%s\n", surf);
+ /* Sys_Printf("%s\n", surf); */
for(i=0; i < NUM_PREFIXINFO; i++){
if(!Q_stricmp(surf, prefixInfo[i].name)){
}
return 0;
}
-#endif
/* try to find an existing shader */
for ( i = 0; i < numBSPShaders; i++ )
{
- /* ydnar: handle custom surface/content flags */
-#ifndef SMOKINGUNS
- if ( surfaceFlags != NULL && bspShaders[ i ].surfaceFlags != *surfaceFlags ) {
- continue;
- }
- if ( contentFlags != NULL && bspShaders[ i ].contentFlags != *contentFlags ) {
- continue;
+ /* if not Smokin'Guns like tex file */
+ if ( !game->texFile )
+ {
+ /* ydnar: handle custom surface/content flags */
+ if ( surfaceFlags != NULL && bspShaders[ i ].surfaceFlags != *surfaceFlags ) {
+ continue;
+ }
+ if ( contentFlags != NULL && bspShaders[ i ].contentFlags != *contentFlags ) {
+ continue;
+ }
}
-#endif
/* compare name */
if ( !Q_stricmp( shader, bspShaders[ i ].shader ) ) {
numBSPShaders++;
strcpy( bspShaders[ i ].shader, shader );
bspShaders[ i ].surfaceFlags = si->surfaceFlags;
-#ifdef SMOKINGUNS
- bspShaders[ i ].surfaceFlags |= GetSurfaceParm(si->shader);
-#endif
- bspShaders[ i ].contentFlags = si->contentFlags;
- /* handle custom content/surface flags */
-#ifndef SMOKINGUNS
- if ( surfaceFlags != NULL ) {
- bspShaders[ i ].surfaceFlags = *surfaceFlags;
+ if ( game->texFile )
+ {
+ /* Smokin'Guns like tex file */
+ bspShaders[ i ].surfaceFlags |= GetSurfaceParm(si->shader);
}
- if ( contentFlags != NULL ) {
- bspShaders[ i ].contentFlags = *contentFlags;
+
+ bspShaders[ i ].contentFlags = si->contentFlags;
+
+ /* if not Smokin'Guns like tex file */
+ if ( !game->texFile )
+ {
+ /* handle custom content/surface flags */
+ if ( surfaceFlags != NULL ) {
+ bspShaders[ i ].surfaceFlags = *surfaceFlags;
+ }
+ if ( contentFlags != NULL ) {
+ bspShaders[ i ].contentFlags = *contentFlags;
+ }
}
-#endif
/* recursively emit any damage shaders */
if ( si->damageShader != NULL && si->damageShader[ 0 ] != '\0' ) {
-#ifdef SMOKINGUNS
-//added by spoon to get back the changed surfaceflags
-void RestoreSurfaceFlags(char *filename){
+/*
+ RestoreSurfaceFlags()
+ read Smokin'Guns like tex file
+ added by spoon to get back the changed surfaceflags
+ */
+
+void RestoreSurfaceFlags( char *filename ) {
int i;
- FILE *texfile;
- int surfaceFlags[MAX_MAP_DRAW_SURFS];
- int numTexInfos;
+ FILE *texfile;
+ int surfaceFlags[ MAX_MAP_DRAW_SURFS ];
+ int numTexInfos;
+
+ /* first parse the tex file */
+ texfile = fopen( filename, "r" );
- //first parse the tex-file
- texfile = fopen(filename, "r");
- if(texfile){
- fscanf( texfile, "TEXFILE\n%i\n", &numTexInfos);
- //Sys_Printf("%i\n", numTexInfos);
+ if ( texfile ) {
+ fscanf( texfile, "TEXFILE\n%i\n", &numTexInfos );
- for(i=0; i<numTexInfos; i++){
+ /* Sys_Printf( "%i\n", numTexInfos ); */
+
+ for ( i = 0; i < numTexInfos; i++ ) {
vec3_t color;
- fscanf( texfile, "%i %f %f %f\n", &surfaceFlags[i],
- &color[0], &color[1], &color[2]);
- bspShaders[i].surfaceFlags = surfaceFlags[i];
- //Sys_Printf("%i\n", surfaceFlags[i]);
+
+ fscanf( texfile, "%i %f %f %f\n", &surfaceFlags[ i ],
+ &color[ 0 ], &color[ 1 ], &color[ 2 ]);
+
+ bspShaders[ i ].surfaceFlags = surfaceFlags[ i ];
+
+ /* Sys_Printf( "%i\n", surfaceFlags[ i ] ); */
}
- } else
+ } else {
Sys_Printf("couldn't find %s not tex-file is now writed without surfaceFlags!\n", filename);
+ }
}
-void WriteTexFile( char* name){
- FILE *texfile;
- char filename[1024];
- int i;
- sprintf (filename, "%s.tex", name);
- if(!compile_map){
- RestoreSurfaceFlags(filename);
+/*
+ WriteTexFile()
+ write Smokin'Guns like tex file
+ added by spoon
+ */
+
+void WriteTexFile( char* filename ) {
+ FILE *texfile;
+ int i;
+
+ if ( !compile_map ) {
+ RestoreSurfaceFlags( filename );
}
- Sys_Printf("Writing %s ...\n", filename);
- texfile = fopen (filename, "w");
+ Sys_Printf( "Writing %s ...\n", filename );
- fprintf( texfile, "TEXFILE\n");
+ texfile = fopen ( filename, "w" );
- fprintf( texfile, "%i\n", numBSPShaders);
- for ( i = 0 ; i < numBSPShaders ; i++ ) {
- shaderInfo_t *se = ShaderInfoForShader(bspShaders[i].shader);
+ fprintf( texfile, "TEXFILE\n" );
+
+ fprintf( texfile, "%i\n", numBSPShaders );
- fprintf( texfile, "\n%i %f %f %f", bspShaders[i].surfaceFlags,
- se->color[0], se->color[1], se->color[2]);
+ for ( i = 0 ; i < numBSPShaders ; i++ ) {
+ shaderInfo_t *se = ShaderInfoForShader( bspShaders[ i ].shader );
+ fprintf( texfile, "\n%i %f %f %f", bspShaders[ i ].surfaceFlags,
+ se->color[ 0 ], se->color[ 1 ], se->color[ 2 ] );
- bspShaders[i].surfaceFlags = i;
+ bspShaders[ i ].surfaceFlags = i;
}
- fclose(texfile);
+
+ fclose( texfile );
}
-#endif
/* write the surface extra file */
WriteSurfaceExtraFile( surfaceFilePath );
-#ifdef SMOKINGUNS
- //only create tex file if it is the first compile
- WriteTexFile (source);
-#endif
+ if ( game->texFile )
+ {
+ char basename[ 1024 ];
+ char filename[ 1024 ];
+ strncpy( basename, BSPFilePath, sizeof(basename) );
+ sprintf( filename, "%s.tex", basename );
+
+ /* only create tex file if it is the first compile */
+ WriteTexFile( filename );
+ }
/* write the bsp */
Sys_Printf( "Writing %s\n", BSPFilePath );