remove global error prone char name[ 1024 ]
This commit is contained in:
parent
b6d60fb17c
commit
82d038f6d1
|
|
@ -582,7 +582,7 @@ void ProcessModels( void ){
|
|||
this is probably broken unless teamed with a radiant version that preserves entity order
|
||||
*/
|
||||
|
||||
void OnlyEnts( void ){
|
||||
void OnlyEnts( const char *filename ){
|
||||
/* note it */
|
||||
Sys_Printf( "--- OnlyEnts ---\n" );
|
||||
|
||||
|
|
@ -597,7 +597,7 @@ void OnlyEnts( void ){
|
|||
entities.clear();
|
||||
|
||||
LoadShaderInfo();
|
||||
LoadMapFile( name, false, false );
|
||||
LoadMapFile( filename, false, false );
|
||||
SetModelNumbers();
|
||||
SetLightStyles();
|
||||
|
||||
|
|
@ -883,19 +883,20 @@ int BSPMain( Args& args ){
|
|||
remove( StringOutputStream( 256 )( source, ".lin" ) );
|
||||
//% remove( StringOutputStream( 256 )( source, ".srf" ) ); /* ydnar */
|
||||
|
||||
/* expand mapname */
|
||||
strcpy( name, ExpandArg( fileName ) );
|
||||
if ( !path_extension_is( name, "reg" ) ) { /* not .reg */
|
||||
/* if we are doing a full map, delete the last saved region map */
|
||||
/* if we are doing a full map, delete the last saved region map */
|
||||
if ( !path_extension_is( fileName, "reg" ) )
|
||||
remove( StringOutputStream( 256 )( source, ".reg" ) );
|
||||
if ( !onlyents || !path_extension_is( name, "ent" ) ) {
|
||||
path_set_extension( name, ".map" ); /* .reg and .ent are ok too */
|
||||
}
|
||||
}
|
||||
|
||||
/* expand mapname */
|
||||
StringOutputStream mapFileName( 256 );
|
||||
if ( path_extension_is( fileName, "reg" ) || ( onlyents && path_extension_is( fileName, "ent" ) ) )
|
||||
mapFileName << ExpandArg( fileName );
|
||||
else
|
||||
mapFileName << PathExtensionless( ExpandArg( fileName ) ) << ".map";
|
||||
|
||||
/* if onlyents, just grab the entites and resave */
|
||||
if ( onlyents ) {
|
||||
OnlyEnts();
|
||||
OnlyEnts( mapFileName );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -907,7 +908,7 @@ int BSPMain( Args& args ){
|
|||
LoadMapFile( tempSource, false, g_autocaulk );
|
||||
}
|
||||
else{
|
||||
LoadMapFile( name, false, g_autocaulk );
|
||||
LoadMapFile( mapFileName, false, g_autocaulk );
|
||||
}
|
||||
|
||||
/* div0: inject command line parameters */
|
||||
|
|
|
|||
|
|
@ -2676,11 +2676,6 @@ int LightMain( Args& args ){
|
|||
strcpy( source, ExpandArg( fileName ) );
|
||||
path_set_extension( source, ".bsp" );
|
||||
|
||||
strcpy( name, ExpandArg( fileName ) );
|
||||
if ( !path_extension_is( name, "reg" ) ) { /* not .reg */
|
||||
path_set_extension( name, ".map" );
|
||||
}
|
||||
|
||||
/* ydnar: set default sample size */
|
||||
SetDefaultSampleSize( sampleSize );
|
||||
|
||||
|
|
@ -2705,7 +2700,11 @@ int LightMain( Args& args ){
|
|||
|
||||
/* load map file */
|
||||
if ( !entities[ 0 ].boolForKey( "_keepLights" ) ) {
|
||||
LoadMapFile( name, true, false );
|
||||
char *mapFileName = ExpandArg( fileName );
|
||||
if ( !path_extension_is( fileName, "reg" ) ) /* not .reg */
|
||||
path_set_extension( mapFileName, ".map" );
|
||||
|
||||
LoadMapFile( CopiedString( mapFileName ).c_str(), true, false );
|
||||
}
|
||||
|
||||
/* set the entity/model origins and init yDrawVerts */
|
||||
|
|
|
|||
|
|
@ -1668,7 +1668,7 @@ static bool ParseMapEntity( bool onlyLights, bool noCollapseGroups ){
|
|||
loads a map file into a list of entities
|
||||
*/
|
||||
|
||||
void LoadMapFile( char *filename, bool onlyLights, bool noCollapseGroups ){
|
||||
void LoadMapFile( const char *filename, bool onlyLights, bool noCollapseGroups ){
|
||||
FILE *file;
|
||||
int oldNumEntities = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ static void make_brush_sides( const Plane3f plane, const Plane3f (&p)[3], const
|
|||
buildBrush.sides[4].planenum = FindFloatPlane( reverse, 0, NULL );
|
||||
}
|
||||
|
||||
static void ClipModel( int spawnFlags, float clipDepth, shaderInfo_t *si, const mapDrawSurface_t *ds ){
|
||||
static void ClipModel( int spawnFlags, float clipDepth, shaderInfo_t *si, const mapDrawSurface_t *ds, const char *modelName ){
|
||||
const int spf = ( spawnFlags & ( eClipFlags & ~eClipModel ) );
|
||||
|
||||
/* ydnar: giant hack land: generate clipping brushes for model triangles */
|
||||
|
|
@ -592,7 +592,7 @@ static void ClipModel( int spawnFlags, float clipDepth, shaderInfo_t *si, const
|
|||
const double lengthsSquared = vector3_length_squared( d1 ) * vector3_length_squared( d2 );
|
||||
if ( lengthsSquared == 0 || ( vector3_length_squared( normal ) / lengthsSquared ) < 1e-8 ) {
|
||||
Sys_Warning( "triangle (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) of %s was not autoclipped: points on line\n",
|
||||
points[0][0], points[0][1], points[0][2], points[1][0], points[1][1], points[1][2], points[2][0], points[2][1], points[2][2], name );
|
||||
points[0][0], points[0][1], points[0][2], points[1][0], points[1][1], points[1][2], points[2][0], points[2][1], points[2][2], modelName );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -935,7 +935,7 @@ static void ClipModel( int spawnFlags, float clipDepth, shaderInfo_t *si, const
|
|||
else
|
||||
{
|
||||
Sys_Warning( "triangle (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) of %s was not autoclipped\n",
|
||||
points[0][0], points[0][1], points[0][2], points[1][0], points[1][1], points[1][2], points[2][0], points[2][1], points[2][2], name );
|
||||
points[0][0], points[0][1], points[0][2], points[1][0], points[1][1], points[1][2], points[2][0], points[2][1], points[2][2], modelName );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -975,7 +975,7 @@ default_CLIPMODEL:
|
|||
}
|
||||
else{
|
||||
Sys_Warning( "triangle (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) (%6.0f %6.0f %6.0f) of %s was not autoclipped\n",
|
||||
points[0][0], points[0][1], points[0][2], points[1][0], points[1][1], points[1][2], points[2][0], points[2][1], points[2][2], name );
|
||||
points[0][0], points[0][1], points[0][2], points[1][0], points[1][1], points[1][2], points[2][0], points[2][1], points[2][2], modelName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1255,7 +1255,7 @@ void InsertModel( const char *name, int skin, int frame, const Matrix4& transfor
|
|||
/* set cel shader */
|
||||
ds->celShader = celShader;
|
||||
|
||||
ClipModel( spawnFlags, clipDepth, si, ds );
|
||||
ClipModel( spawnFlags, clipDepth, si, ds, name );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1559,7 +1559,7 @@ void PutMeshOnCurve( mesh_t in );
|
|||
|
||||
|
||||
/* map.c */
|
||||
void LoadMapFile( char *filename, bool onlyLights, bool noCollapseGroups );
|
||||
void LoadMapFile( const char *filename, bool onlyLights, bool noCollapseGroups );
|
||||
int FindFloatPlane( const Plane3f& plane, int numPoints, const Vector3 *points );
|
||||
inline int FindFloatPlane( const Vector3& normal, float dist, int numPoints, const Vector3 *points ){
|
||||
return FindFloatPlane( Plane3f( normal, dist ), numPoints, points );
|
||||
|
|
@ -1972,7 +1972,6 @@ inline int blockSize[ 3 ] = { 1024, 1024, 1024 }; /* sh
|
|||
|
||||
Q_EXTERN CopiedString g_enginePath;
|
||||
|
||||
Q_EXTERN char name[ 1024 ];
|
||||
Q_EXTERN char source[ 1024 ];
|
||||
|
||||
Q_EXTERN int sampleSize Q_ASSIGN( DEFAULT_LIGHTMAP_SAMPLE_SIZE ); /* lightmap sample size in units */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user