numEntities = 0;
LoadShaderInfo();
- LoadMapFile( name, qfalse );
+ LoadMapFile( name, qfalse, qfalse );
SetModelNumbers();
SetLightStyles();
/* load original file from temp spot in case it was renamed by the editor on the way in */
if( strlen( tempSource ) > 0 )
- LoadMapFile( tempSource, qfalse );
+ LoadMapFile( tempSource, qfalse, qfalse );
else
- LoadMapFile( name, qfalse );
+ LoadMapFile( name, qfalse, qfalse );
/* div0: inject command line parameters */
InjectCommandLine(argv, 1, argc - 1);
/* load map file */
value = ValueForKey( &entities[ 0 ], "_keepLights" );
if( value[ 0 ] != '1' )
- LoadMapFile( mapSource, qtrue );
+ LoadMapFile( mapSource, qtrue, qfalse );
/* set the entity/model origins and init yDrawVerts */
SetEntityOrigins();
}
+void PseudoCompileBSP()
+{
+ // a stripped down ProcessModels
+ BeginBSPFile();
+ for( mapEntityNum = 0; mapEntityNum < numEntities; mapEntityNum++ )
+ {
+ /* get entity */
+ entity = &entities[ mapEntityNum ];
+ if( entity->brushes == NULL && entity->patches == NULL )
+ continue;
+
+ /* process the model */
+ Sys_FPrintf( SYS_VRB, "############### model %i ###############\n", numBSPModels );
+ BeginModel();
+ entity>firstDrawSurf = 0;
+ EmitBrushes(entity->brushes, &entity>firstBrush, &entity>numBrushes );
+ EndModel(entity, NULL);
+ }
+}
/*
ConvertBSPMain()
int i;
int (*convertFunc)( char * );
game_t *convertGame;
+ qboolean map_allowed;
+ char ext[1024];
/* set default */
convertFunc = ConvertBSPToASE;
convertGame = NULL;
+ map_allowed = qfalse;
/* arg checking */
if( argc < 1 )
{
i++;
if( !Q_stricmp( argv[ i ], "ase" ) )
+ {
convertFunc = ConvertBSPToASE;
+ }
else if( !Q_stricmp( argv[ i ], "map_bp" ) )
+ {
convertFunc = ConvertBSPToMap_BP;
+ map_allowed = qtrue;
+ }
else if( !Q_stricmp( argv[ i ], "map" ) )
+ {
convertFunc = ConvertBSPToMap;
+ map_allowed = qtrue;
+ }
else
{
convertGame = GetGame( argv[ i ] );
else if( !strcmp( argv[ i ], "-shadersasbitmap" ) )
shadersAsBitmap = qtrue;
}
-
- /* clean up map name */
- strcpy( source, ExpandArg( argv[ i ] ) );
- StripExtension( source );
- DefaultExtension( source, ".bsp" );
-
+
LoadShaderInfo();
- Sys_Printf( "Loading %s\n", source );
-
- /* ydnar: load surface file */
- //% LoadSurfaceExtraFile( source );
-
- LoadBSPFile( source );
-
- /* parse bsp entities */
- ParseEntities();
+ /* clean up map name */
+ strcpy(source, ExpandArg(argv[i]));
+ ExtractFileExtension(source, ext);
+ if(!Q_stricmp(ext, "map") && map_allowed)
+ {
+ StripExtension(source);
+ DefaultExtension(source, ".map");
+ Sys_Printf("Loading %s\n", source);
+ LoadMapFile(name, qfalse, qtrue);
+ ParseEntities();
+ PseudoCompileBSP();
+ }
+ else
+ {
+ StripExtension(source);
+ DefaultExtension(source, ".bsp");
+ Sys_Printf("Loading %s\n", source);
+ LoadBSPFile(source);
+ ParseEntities();
+ }
/* bsp format convert? */
if( convertGame != NULL )
parses a single entity out of a map file
*/
-static qboolean ParseMapEntity( qboolean onlyLights )
+static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
{
epair_t *ep;
const char *classname, *value;
AdjustBrushesForOrigin( mapEnt );
/* group_info entities are just for editor grouping (fixme: leak!) */
- if( !Q_stricmp( "group_info", classname ) )
+ if( !noCollapseGroups && !Q_stricmp( "group_info", classname ) )
{
numEntities--;
return qtrue;
}
/* group entities are just for editor convenience, toss all brushes into worldspawn */
- if( funcGroup )
+ if( !noCollapseGroups && funcGroup )
{
MoveBrushesToWorld( mapEnt );
numEntities--;
loads a map file into a list of entities
*/
-void LoadMapFile( char *filename, qboolean onlyLights )
+void LoadMapFile( char *filename, qboolean onlyLights, qboolean noCollapseGroups )
{
FILE *file;
brush_t *b;
buildBrush = AllocBrush( MAX_BUILD_SIDES );
/* parse the map file */
- while( ParseMapEntity( onlyLights ) );
+ while( ParseMapEntity( onlyLights, noCollapseGroups ) );
/* light loading */
if( onlyLights )
/* map.c */
-void LoadMapFile( char *filename, qboolean onlyLights );
+void LoadMapFile( char *filename, qboolean onlyLights, qboolean noCollapseGroups );
int FindFloatPlane( vec3_t normal, vec_t dist, int numPoints, vec3_t *points );
int PlaneTypeForNormal( vec3_t normal );
void AddBrushBevels( void );
/* emit the bsp */
mod = &bspModels[ numBSPModels ];
- EmitDrawNode_r( headnode );
+ if(headnode)
+ EmitDrawNode_r( headnode );
/* set surfaces and brushes */
mod->numBSPSurfaces = numBSPDrawSurfaces - mod->firstBSPSurface;