EXPERIMENTAL: make the pseudo compiler able to output a .bsp file:

q3map2 -game xonotic -convert -format xonotic filename.map
note that this is a quite bad compile (no tjunctions, no models, nothing, but lightning fast)
This commit is contained in:
Rudolf Polzer 2010-10-09 21:22:22 +02:00
parent af9f1a2e22
commit 6980df0b21

View File

@ -1434,11 +1434,12 @@ int ScaleBSPMain( int argc, char **argv )
PseudoCompileBSP() PseudoCompileBSP()
a stripped down ProcessModels a stripped down ProcessModels
*/ */
void PseudoCompileBSP() void PseudoCompileBSP(qboolean need_tree)
{ {
int models; int models;
char modelValue[10]; char modelValue[10];
entity_t *entity; entity_t *entity;
face_t *faces;
tree_t *tree; tree_t *tree;
node_t *node; node_t *node;
brush_t *brush; brush_t *brush;
@ -1471,10 +1472,19 @@ void PseudoCompileBSP()
entity->firstDrawSurf = numMapDrawSurfs; entity->firstDrawSurf = numMapDrawSurfs;
node = AllocNode(); if(mapEntityNum == 0 && need_tree)
node->planenum = PLANENUM_LEAF; {
tree = AllocTree(); faces = MakeStructuralBSPFaceList(entities[0].brushes);
tree->headnode = node; tree = FaceBSP(faces);
node = tree->headnode;
}
else
{
node = AllocNode();
node->planenum = PLANENUM_LEAF;
tree = AllocTree();
tree->headnode = node;
}
/* a minimized ClipSidesIntoTree */ /* a minimized ClipSidesIntoTree */
for( brush = entity->brushes; brush; brush = brush->next ) for( brush = entity->brushes; brush; brush = brush->next )
@ -1486,12 +1496,17 @@ void PseudoCompileBSP()
side = &brush->sides[ i ]; side = &brush->sides[ i ];
if( side->winding == NULL ) if( side->winding == NULL )
continue; continue;
/* shader? */
if( side->shaderInfo == NULL )
continue;
/* save this winding as a visible surface */ /* save this winding as a visible surface */
DrawSurfaceForSide(entity, brush, side, side->winding); DrawSurfaceForSide(entity, brush, side, side->winding);
} }
} }
FilterDrawsurfsIntoTree(entity, tree); FilterDrawsurfsIntoTree(entity, tree);
FilterStructuralBrushesIntoTree(entity, tree);
FilterDetailBrushesIntoTree(entity, tree);
EmitBrushes(entity->brushes, &entity->firstBrush, &entity->numBrushes ); EmitBrushes(entity->brushes, &entity->firstBrush, &entity->numBrushes );
EndModel(entity, node); EndModel(entity, node);
@ -1550,7 +1565,7 @@ int ConvertBSPMain( int argc, char **argv )
else else
{ {
convertGame = GetGame( argv[ i ] ); convertGame = GetGame( argv[ i ] );
map_allowed = qfalse; map_allowed = qtrue;
if( convertGame == NULL ) if( convertGame == NULL )
Sys_Printf( "Unknown conversion format \"%s\". Defaulting to ASE.\n", argv[ i ] ); Sys_Printf( "Unknown conversion format \"%s\". Defaulting to ASE.\n", argv[ i ] );
} }
@ -1581,8 +1596,8 @@ int ConvertBSPMain( int argc, char **argv )
StripExtension(source); StripExtension(source);
DefaultExtension(source, ".map"); DefaultExtension(source, ".map");
Sys_Printf("Loading %s\n", source); Sys_Printf("Loading %s\n", source);
LoadMapFile(source, qfalse, qtrue); LoadMapFile(source, qfalse, convertGame == NULL);
PseudoCompileBSP(); PseudoCompileBSP(convertGame != NULL);
} }
else else
{ {