* Add QBSP - the BSP2-esque variant to Q2BSP - to bspinfo, and all of its accompanying structures.
* pass around ident, since Q2 needs it - admittedly it's a bit ugly, but it works for now.
conversion for QBSP
* Fix light
* _qbsp_ -> _qbism_
* Introduced bspversion_t, a struct that holds pertinent information about different BSP versions and also acts as a tagged pointer type for direct comparisons. This makes a lot of code paths simpler. I'm not entirely set on the wordings or usages yet, and maybe we can stuff boolean flags inside of them for different behaviors (for instance Q2, QBism and HL would have the "colored lightmap" boolean set to true, which replaces the check-for-all-three in the lightmapper)
Swapped arguments to ConvertBSPFormat to have the conversion target last instead of first
Finished rename of qbsp -> qbism
Tested:
- bspinfo on various BSPs I had laying around (Q1, Q2, Qbism)
- bsputil converting between Q2 and Qbism, and that they loaded in engine/roundtripped properly
Not tested:
- vis/rad on anything major (I still can't run rad due to embree being weird)
- bsputil conversion of Q1-esque maps
* Q2 VIS
Almost working, just in-game is not 100% functional
* PHS! Q2 VIS!
* Fix missing loadversion assignment
Fix missing \n
* Implement q2bsp -> mbsp visdata copy
fix sky lighting to use arghrad compat
* Add QBSP - the BSP2-esque variant to Q2BSP - to bspinfo, and all of its accompanying structures.
* pass around ident, since Q2 needs it - admittedly it's a bit ugly, but it works for now.
conversion for QBSP
* Fix light
* _qbsp_ -> _qbism_
* Introduced bspversion_t, a struct that holds pertinent information about different BSP versions and also acts as a tagged pointer type for direct comparisons. This makes a lot of code paths simpler. I'm not entirely set on the wordings or usages yet, and maybe we can stuff boolean flags inside of them for different behaviors (for instance Q2, QBism and HL would have the "colored lightmap" boolean set to true, which replaces the check-for-all-three in the lightmapper)
Swapped arguments to ConvertBSPFormat to have the conversion target last instead of first
Finished rename of qbsp -> qbism
Tested:
- bspinfo on various BSPs I had laying around (Q1, Q2, Qbism)
- bsputil converting between Q2 and Qbism, and that they loaded in engine/roundtripped properly
Not tested:
- vis/rad on anything major (I still can't run rad due to embree being weird)
- bsputil conversion of Q1-esque maps
Add BSP2 support to the remaining utils. Since these share the common
bspfile.[ch] files, it was more effort than is justifiable to break this
into multiple staged patches - so you just get this disgustingly big
commit instead. Here is basically what was done:
* Modify the bspdata_t struct with a union of the two bsp formats
* Modify the tools to use bsp2_t for all internal processing
* Split out the byte swapping routines for the different bsp data types
* Add simple (although verbose) code to convert bsp29 <-> bsp2
Hundreds of lines added to bspfile.c, but mostly trivial stuff. The tools
internally had little modification except to substitute the bsp2 type
names.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Transition all tools to access the BSP data via the bspdata struct instead
of the shared globals. Remove the compatibility code from bspfile which
copied the global values to/from the instanced bspdata struct.
Mostly the changes just involved passing along the bspdata struct to the
various functions which needed to reference the data. TraceLine and
MakeTNodes in light got some extra changes so that we cache the node
dplane pointer and remove the need to pass the bspdata struct to every
trace operation!
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Rename the default bsp29 data types and add the bsp2 data types to
the common bspfile.h. Propogate the bsp29 names into the other tools as
simple renames for now.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Make CheckStack return an error code if we have recursed and print
some information about the offending leaf/portals before continuing.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Carry over some correctness fixes from recent changes to vis into the
qbsp versions of ClipWinding and make the implementations more
consistent overall.
Most importantly:
* Ensure we always have allocated one extra dists/sides slot for wrap around
* Check we have space for a new vertex every time we try to add one
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Just in case unsigned long isn't big enough to capture the pointer
offsets. Also, cast STACK_WINDINGS to the correct type before doing the
comparison.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>