]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
EXPERIMENTAL: make the pseudo compiler able to output a .bsp file:
authorRudolf Polzer <divverent@alientrap.org>
Sat, 9 Oct 2010 19:22:22 +0000 (21:22 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 9 Oct 2010 19:22:22 +0000 (21:22 +0200)
q3map2 -game xonotic -convert -format xonotic filename.map
note that this is a quite bad compile (no tjunctions, no models, nothing, but lightning fast)

tools/quake3/q3map2/main.c

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