q3map2: inject the invocation commandline into keys of the worldspawn entity (to allow easier recompiling of the map)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@181 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
parent
af88b4208b
commit
3aca84b7e5
|
|
@ -613,7 +613,7 @@ this is probably broken unless teamed with a radiant version that preserves enti
|
|||
void OnlyEnts( void )
|
||||
{
|
||||
char out[ 1024 ];
|
||||
|
||||
// TODO save and restore _q3map2_cmdline when doing this
|
||||
|
||||
/* note it */
|
||||
Sys_Printf( "--- OnlyEnts ---\n" );
|
||||
|
|
@ -913,6 +913,9 @@ int BSPMain( int argc, char **argv )
|
|||
else
|
||||
LoadMapFile( name, qfalse );
|
||||
|
||||
/* div0: inject command line parameters */
|
||||
InjectCommandLine(argv, 1, argc - 1);
|
||||
|
||||
/* ydnar: decal setup */
|
||||
ProcessDecals();
|
||||
|
||||
|
|
|
|||
|
|
@ -578,7 +578,44 @@ void ParseEntities( void )
|
|||
numBSPEntities = numEntities;
|
||||
}
|
||||
|
||||
/*
|
||||
* must be called before UnparseEntities
|
||||
*/
|
||||
void InjectCommandLine(char **argv, int beginArgs, int endArgs)
|
||||
{
|
||||
const char *previousCommandLine;
|
||||
char newCommandLine[1024];
|
||||
const char *inpos;
|
||||
char *outpos = newCommandLine;
|
||||
char *sentinel = newCommandLine + sizeof(newCommandLine) - 1;
|
||||
int i;
|
||||
|
||||
previousCommandLine = ValueForKey(&entities[0], "_q3map2_cmdline");
|
||||
if(previousCommandLine && *previousCommandLine)
|
||||
{
|
||||
inpos = previousCommandLine;
|
||||
while(outpos != sentinel && *inpos)
|
||||
*outpos++ = *inpos++;
|
||||
if(outpos != sentinel)
|
||||
*outpos++ = ';';
|
||||
if(outpos != sentinel)
|
||||
*outpos++ = ' ';
|
||||
}
|
||||
|
||||
for(i = beginArgs; i < endArgs; ++i)
|
||||
{
|
||||
if(outpos != sentinel && i != beginArgs)
|
||||
*outpos++ = ' ';
|
||||
inpos = argv[i];
|
||||
while(outpos != sentinel && *inpos)
|
||||
if(*inpos != '\\' && *inpos != '"' && *inpos != ';' && (unsigned char) *inpos >= ' ')
|
||||
*outpos++ = *inpos++;
|
||||
}
|
||||
|
||||
*outpos = 0;
|
||||
SetKeyValue(&entities[0], "_q3map2_cmdline", newCommandLine);
|
||||
SetKeyValue(&entities[0], "_q3map2_version", Q3MAP_VERSION);
|
||||
}
|
||||
|
||||
/*
|
||||
UnparseEntities()
|
||||
|
|
|
|||
|
|
@ -1750,6 +1750,7 @@ void LightWorld( void )
|
|||
{
|
||||
/* store off the bsp between bounces */
|
||||
StoreSurfaceLightmaps();
|
||||
UnparseEntities();
|
||||
Sys_Printf( "Writing %s\n", source );
|
||||
WriteBSPFile( source );
|
||||
|
||||
|
|
@ -2369,6 +2370,9 @@ int LightMain( int argc, char **argv )
|
|||
/* parse bsp entities */
|
||||
ParseEntities();
|
||||
|
||||
/* inject command line parameters */
|
||||
InjectCommandLine(argv, 0, argc - 1);
|
||||
|
||||
/* load map file */
|
||||
value = ValueForKey( &entities[ 0 ], "_keepLights" );
|
||||
if( value[ 0 ] != '1' )
|
||||
|
|
|
|||
|
|
@ -474,6 +474,9 @@ int ScaleBSPMain( int argc, char **argv )
|
|||
sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] );
|
||||
SetKeyValue( &entities[ 0 ], "gridsize", str );
|
||||
|
||||
/* inject command line parameters */
|
||||
InjectCommandLine(argv, 0, argc - 1);
|
||||
|
||||
/* write the bsp */
|
||||
UnparseEntities();
|
||||
StripExtension( source );
|
||||
|
|
|
|||
|
|
@ -1811,6 +1811,8 @@ vec_t FloatForKey( const entity_t *ent, const char *key );
|
|||
void GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec );
|
||||
entity_t *FindTargetEntity( const char *target );
|
||||
void GetEntityShadowFlags( const entity_t *ent, const entity_t *ent2, int *castShadows, int *recvShadows );
|
||||
void InjectCommandLine(char **argv, int beginArgs, int endArgs);
|
||||
|
||||
|
||||
|
||||
/* bspfile_ibsp.c */
|
||||
|
|
|
|||
|
|
@ -1107,6 +1107,10 @@ int VisMain (int argc, char **argv)
|
|||
/* ydnar: for getting far plane */
|
||||
ParseEntities();
|
||||
|
||||
/* inject command line parameters */
|
||||
InjectCommandLine(argv, 0, argc - 1);
|
||||
UnparseEntities();
|
||||
|
||||
if( mergevis )
|
||||
{
|
||||
MergeLeaves();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user