diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 830faef57db7d2c37edf70854290ef05e124057e..d84322dfda647d5ae34bbd09d8cd715ff906fbc5 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2671,45 +2671,31 @@ fixed_t *hwbbox; static void HWR_RenderBSPNode(INT32 bspnum) { - node_t *bsp = &nodes[bspnum]; - - // Decide which side the view point is on + node_t *bsp; INT32 side; ps_numbspcalls.value.i++; - // Found a subsector? - if (bspnum & NF_SUBSECTOR) + while (!(bspnum & NF_SUBSECTOR)) // Found a subsector? { - if (bspnum == -1) - { - //*(gl_drawsubsector_p++) = 0; - HWR_Subsector(0); - } - else - { - //*(gl_drawsubsector_p++) = bspnum&(~NF_SUBSECTOR); - HWR_Subsector(bspnum&(~NF_SUBSECTOR)); - } - return; - } + bsp = &nodes[bspnum]; - // Decide which side the view point is on. - side = R_PointOnSide(viewx, viewy, bsp); + // Decide which side the view point is on. + side = R_PointOnSide(viewx, viewy, bsp); + // BP: big hack for a test in lighning ref : 1249753487AB + hwbbox = bsp->bbox[side]; + // Recursively divide front space. + HWR_RenderBSPNode(bsp->children[side]); - // BP: big hack for a test in lighning ref : 1249753487AB - hwbbox = bsp->bbox[side]; + // Possibly divide back space. - // Recursively divide front space. - HWR_RenderBSPNode(bsp->children[side]); + if (!HWR_CheckBBox(bsp->bbox[side^1])) + return; - // Possibly divide back space. - if (HWR_CheckBBox(bsp->bbox[side^1])) - { - // BP: big hack for a test in lighning ref : 1249753487AB - hwbbox = bsp->bbox[side^1]; - HWR_RenderBSPNode(bsp->children[side^1]); + bspnum = bsp->children[side^1]; } + + HWR_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR); } // ==========================================================================