Commit Graph

494 Commits

Author SHA1 Message Date
Kevin Shanahan 75666712e7 common: create logprint_silent to replace qbsp's msgFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:59:37 +09:30
Kevin Shanahan b1650d0036 common: temporary hack for Error() definition in threads.c
Qbsp now uses exactly the same Error() function spec, so just hack
around clashes in the cmdlib.h header for now by defining Error()
locally and removing the cmdlib.h include.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:46:15 +09:30
Kevin Shanahan bbbb3ff859 common: use stdbool in threads.c, log.c so cmdlib isn't needed
The only thing used by log.c was the qboolean definition, so just use
stdbool internally instead.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:44:14 +09:30
Kevin Shanahan bf9bc549d2 qbsp: remove unneccessary extern from function declarations
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:41:54 +09:30
Kevin Shanahan c3bf54e494 common: add printf attribute to Error() declaration in cmdlib.h
Fix a number of warnings now generated as a result.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 14:39:44 +09:30
Kevin Shanahan 37f87a28be vis, qbsp: improve robustness of ClipWinding/DivideWinding
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>
2013-04-23 14:00:31 +09:30
Kevin Shanahan dddae057d6 TyrUtils v0.8
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-23 09:40:05 +09:30
Kevin Shanahan 347020879d qbsp: rename Error_() to Error()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 20:21:17 +09:30
Kevin Shanahan 51bed53570 qbsp: remove remaining enum errors
Remove the enum Error() function and global error strings as well.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 20:15:09 +09:30
Kevin Shanahan ea5e46f9df qbsp: replace error enums in surfaces.c, solidbsp.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 19:16:53 +09:30
Kevin Shanahan b9fa895988 qbsp: replace enum errors in portals.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:47:36 +09:30
Kevin Shanahan 15da0d818a qbsp: replace enum errors in parser.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:40:13 +09:30
Kevin Shanahan 0e586916b1 qbsp: replace error enums in outside.c, merge.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:32:52 +09:30
Kevin Shanahan c01397ed5b qbsp: replace enum errors in file.c and wad.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:23:24 +09:30
Kevin Shanahan 02e81df39b qbsp: replace error enums in csg4.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:20:02 +09:30
Kevin Shanahan 58b33cc3d4 qbsp: remplace error enums in bspfile.c
Overlapped with outside.c and portals.c for some of the file errors.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:15:38 +09:30
Kevin Shanahan 7203d3407b qbsp: replace enum errors in brush.c
One shared message in surfaces.c replaced as well.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 17:59:36 +09:30
Kevin Shanahan d5adbcd8ca qbsp: replace enum errors in qbsp.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 17:39:56 +09:30
Kevin Shanahan 30caae09e5 qbsp: re-factor ParseBrush into smaller pieces
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>
2013-04-22 17:33:16 +09:30
Kevin Shanahan 5082e3ffaa light: reduce "no model has face" to a warning
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>
2013-04-22 13:11:22 +09:30
Kevin Shanahan 4a49552904 bsputil: add missing stdint.h include
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 12:51:33 +09:30
Kevin Shanahan 39ccae145a qbsp: create an Error() function similar to the other tools
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>
2013-04-22 11:40:22 +09:30
Kevin Shanahan bb02e6d20a qbsp: fix portal generation mixed water/empty detail clusters
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>
2013-04-21 13:05:11 +09:30
Kevin Shanahan d3a75f6c1a vis: use uintptr for FreeStackWinding index check
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>
2013-04-21 10:17:40 +09:30
Kevin Shanahan 97371bc6ab vis: allocate extra dist/sides slot in ClipStackWinding
We use one extra to simplify checking when an edge crosses the split
plane.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-21 10:14:54 +09:30
Kevin Shanahan ba88986462 vis: fix portal stack corruption in ClipStackWinding
Need to re-check numpoints before we add a split point.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-21 10:13:27 +09:30
Kevin Shanahan 186ca8863b vis: fix stack separator cache overflow check
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-21 10:10:13 +09:30
Kevin Shanahan fa93a21598 qbsp: fix surfedge corruption when using skip surfaces
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>
2013-04-21 10:05:17 +09:30
Kevin Shanahan 195f5869e2 bsputil: add --check option to check internal consistency
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>
2013-04-20 21:11:21 +09:30
Kevin Shanahan 264f613760 bsputil: pass bspdata_t into ExportWad
No longer require the bspfile globals.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 17:22:10 +09:30
Kevin Shanahan b484603871 trivial: remove old comment about removing plane type
On disk formats are pretty final at this point...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 16:58:54 +09:30
Kevin Shanahan d14793f7ab common: make LoadBSPFile take a bspdata struct
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>
2013-04-20 16:51:45 +09:30
Kevin Shanahan 35024bfa7d common: make dtexdata a union
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>
2013-04-20 16:34:30 +09:30
Kevin Shanahan 37a3a98eff common: make WriteBSPFile take a bspdata struct as input
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 15:52:31 +09:30
Kevin Shanahan 6bf97a2cb0 common: convert PrintBSPFileSizes to use the bspdata struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 13:27:25 +09:30
Kevin Shanahan 3e660b291a common: zero the bsp structure before calling CopyLump
Stops CopyLump from trying to free using random pointers.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 13:24:09 +09:30
Kevin Shanahan bc0de585ff common: fix use after free in LoadBSPFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 13:23:34 +09:30
Kevin Shanahan 23d938a822 common: fix reference to plane data in SwapBSPFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 13:22:31 +09:30
Kevin Shanahan d4aba2ce58 common: convert LoadBSPFile to work on a bspdata struct internally
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 12:44:48 +09:30
Kevin Shanahan 00850d9db8 common: convert SwapBSPFile to work on a bspdata_t struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 12:02:09 +09:30
Kevin Shanahan 89074e10e9 common: create a struct for instanced bsp data
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>
2013-04-20 12:00:07 +09:30
Kevin Shanahan 0258b441c1 common: use a swap type enum for SwapBSPFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 11:25:18 +09:30
Kevin Shanahan 5943c71c98 common: pass file handle and header into AddLump
Instead of passing parameters via globals.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 10:53:34 +09:30
Kevin Shanahan d7611d6b1b common: change loadfile argument to avoid casts in callers
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 10:26:08 +09:30
Kevin Shanahan df0aa44310 common: create a lumpspec structure with lump data names/sizes
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>
2013-04-20 10:21:53 +09:30
Kevin Shanahan 9580d04f45 common: minor cleanups in SwapBSPFile
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-20 07:43:24 +09:30
Kevin Shanahan 4b10bd23d9 qbsp: remove global progress counter for MakeFaceEdges
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 16:53:54 +09:30
Kevin Shanahan 022b927d79 trivial: fix typo in error message
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 15:08:55 +09:30
Kevin Shanahan 207f5c6386 common: interrupt thread progress before printing error
Still racy, but better than printing on the same line as the progress
indicator line...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 15:00:21 +09:30
Kevin Shanahan 4275149cee light: improve "bad surface extents" error info
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 14:59:35 +09:30