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>
Precalculate the distance at which lights will fade to zero brightness.
For lights with inverse falloff, use the gate value to determine the
cut-off distance. Use this value to cull samples and avoid the ray
tracing overhead.
Hopefully not too controversially, I am going to default this to "on" with
a gate value of 0.001. Unless you have > 1000 lights contributing
fractional light values across your map, this is not going to make any
visible difference.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
May as well keep dist as the actual distance and just call ScaledDistance
twice (poor function name, btw - it's effectively the equivalent of the
"fade gate" stuff)
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Rename member lightmapcolors -> colormaps
Remove unused member surfnum
Re-order things so the data lumps are together at the end.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>