Since minlight is an integer, need to either cast to float or ensure
promotion by writing the 255 constants as 255.0f. Not all of these are
needed, but just be consistent across the code.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Collect the appropriate keys from the models at load time and pass them
into the minlighting function (if > world minlight).
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Not much point worrying about the offset of each face when it's only
per-model. This sets us up for using other per-model info...
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
New version returns the list of copied faces. This was the last user of
the inside and outside globals outside of CSGFaces, so they now move onto
the local stack there.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
The list onto which to save the faces is now passed in instead of
implicitly using the global outside list.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Only used in two places and not a whole lot of calls, so just allocate the
map while it's needed and free it afterwards. There is no relationship
between the two users, so no need to share a common block of memory.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
We pass in the face list and the plane map to link the faces to. Update
the comments to make it clearer what the function actually does.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
At load time we defaulted to CONTENTS_EMPTY, but if part or all of the
brush lies underwater, then inherit the water contents type.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Check that the hint face would actually get split before we discount the
candidate split plane...
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Similar to the skip texture handling, add miptex flags, handle
appropriately in CSGFaces and SolidBSP, then remove the surfaces before
writing out the bsp.
Lightly tested, but seems to do all the right things.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
FreeInside was a strange name, since depending on the arguments we
actually wanted to keep the faces.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Now consolidate the leak state into a single leakstate_t struct. Rename
the leaks/numleaks/maxleaks members as portals/numportals/maxportals for
improved clarity. What was numportals previously is now numwritten.
Outleafs is now returned from the FillOutside_r function instead of
passing in a struct or int to be incremented by the function.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Finding leaks carries a lot more state which is not needed for the final
outside fill stage, so let's separate the two. Get rid of fillparms_t
since the only thing left was the fillmark.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
It seems clearer now that the numportals parameter is actually used to
check that the number of leak portals we accumulate doesn't exceed the
allocated memory. Update the structs to reflect that.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Move the 'firstone' global into the bspleak state as a flag to indicate
whether the header has been written yet, since that's why the flag exists.
Move numportals and hit_occupied (renamed to "entity") in there as well to
keep leak related data all together.
MarkLeakTrail now directly increments bspleak->numportals so doesn't need
to return a value indicating what was written.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Was showing up as blah.prt.por because we had messed with the filename to
remove the prt file previously.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Previously, leak files would only be written for a leak in hull 2. This is
actually pretty bad because a small leak in hull 0 or 1 might not show up
in hull 2 and you would never get a leak file to chase it down.
Place a flag in the global mapdata to indicate whether we have written a
leak file or not so we only write for the first hull that leaks. Hullnum
is no longer needed as a parameter to RecursiveFillOutside, so remove
that from the fillparms struct.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Remove the (file) global fillmark from outside.c and place into the global
mapadata. Pass the fillmark into RecursiveFillOutside as a read-only
parameter instead.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This is not a yes/no flag it's an integer mark to see if we have visited
the node within the same fill pass.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Makes it kind of obvious now that there is a bug here - if we have a small
leak in hull 0 or 1 which is sealed in hull 2 (due to brush expansion), then
we won't get a leak trail!
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
The TEX_SKIP flag isn't needed and although it *shouldn't* upset any
engines, better to not write it out at all.
Well, even better to not write anything about the skip texture to the BSP
file, but need to re-organise things a bit more before that can happen.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>