Factor out some of the processing involved with parsing a brush. When
checking for duplicate planes, use the same "PlaneEqual" functions as
used in brush.c.
Replace the enum style errors with the new Error_ function for all of
map.c so the error string is at the call site.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Since the newskip.exe tool leaves the faces in the bsp but removes
references, we will just skip over lighting such faces.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Call it Error_() for now while I work on transitioning away from the
arrays of global strings hidden away by error enums.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
We don't want to terminate the recursion in ClusterContents when we reach
a non-detail separator because we need to know the contents of the leafs!
This was working okay for simple cases but fails when the detail clusters
become more complex.
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>
Don't count skip surface verticies at all in CountData_r because this
count actually gets used as the surfedge count and we need that to be
precise.
Don't try to save memory be allocating less verticies than edges, even
though many will probably be shared. The saving is not that significant
anyway.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
First pass, checks most of the data structures actually reference within
the valid ranges. Will add more soon...
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
No longer update the globals in this function - make the callers do it
instead.
bspinfo no longer refers to the globals at all.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Just having one base pointer was kind of annoying because you have to cast
to get to the lump offsets, then cast to byte * to find the miptex, etc.
Now we can access the same pointer using the correct types in each case.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
I'd like to be able to control visibility of the global bsp data as well
as having the ability to load two bsp files and do comparisons, etc. Set
up a structure to hold all the bsp data and a couple of helper functions
to enable a smooth transition for the utils.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Copylump now doesn't need the size passed in, just the type. Also, pass
the file header into CopyLump while we're at it.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
We still end up short if we just discard these counts - still don't
need faces for them, but every edge could be real unless it's shared
with another skip face.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
Removes the MAX_MAP_ENTITIES and MAX_MAP_ENTSTRING limitations by
counting how much space we will need before parsing/writing.
Now that I look at it, I'm not sure why we should even be re-writing
the entity string in the new bsp file, but I'll leave that behaviour
alone... for now.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
The old assumption about unique verticies is sometimes untrue when
skip faces are included in the map. Be more generous with the vertex
memory allocation. This is not an area of peak memory usage anyway, so
shouldn't be a big deal.
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>