-/*
-ScaleBSPMain()
-amaze and confuse your enemies with wierd scaled maps!
-*/
-
-int ScaleBSPMain( int argc, char **argv )
-{
- int i;
- float f, scale;
- vec3_t vec;
- char str[ 1024 ];
-
-
- /* arg checking */
- if( argc < 2 )
- {
- Sys_Printf( "Usage: q3map -scale <value> [-v] <mapname>\n" );
- return 0;
- }
-
- /* get scale */
- scale = atof( argv[ argc - 2 ] );
- if( scale == 0.0f )
- {
- Sys_Printf( "Usage: q3map -scale <value> [-v] <mapname>\n" );
- Sys_Printf( "Non-zero scale value required.\n" );
- return 0;
- }
-
- /* do some path mangling */
- strcpy( source, ExpandArg( argv[ argc - 1 ] ) );
- StripExtension( source );
- DefaultExtension( source, ".bsp" );
-
- /* load the bsp */
- Sys_Printf( "Loading %s\n", source );
- LoadBSPFile( source );
- ParseEntities();
-
- /* note it */
- Sys_Printf( "--- ScaleBSP ---\n" );
- Sys_FPrintf( SYS_VRB, "%9d entities\n", numEntities );
-
- /* scale entity keys */
- for( i = 0; i < numBSPEntities && i < numEntities; i++ )
- {
- /* scale origin */
- GetVectorForKey( &entities[ i ], "origin", vec );
- if( (vec[ 0 ] + vec[ 1 ] + vec[ 2 ]) )
- {
- VectorScale( vec, scale, vec );
- sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] );
- SetKeyValue( &entities[ i ], "origin", str );
- }
-
- /* scale door lip */
- f = FloatForKey( &entities[ i ], "lip" );
- if( f )
- {
- f *= scale;
- sprintf( str, "%f", f );
- SetKeyValue( &entities[ i ], "lip", str );
- }
- }
-
- /* scale models */
- for( i = 0; i < numBSPModels; i++ )
- {
- VectorScale( bspModels[ i ].mins, scale, bspModels[ i ].mins );
- VectorScale( bspModels[ i ].maxs, scale, bspModels[ i ].maxs );