Commit Graph

459 Commits

Author SHA1 Message Date
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
Kevin Shanahan 2a93375e0e qbsp: small cleanup in MakeFaceEdges
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 14:43:35 +09:30
Kevin Shanahan 683a894290 qbsp: trivial cleanups in GrowNodeRegion_r
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 11:28:54 +09:30
Kevin Shanahan 8e57b7c9e6 qbsp: factor out special texture name recognition
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 11:28:11 +09:30
Kevin Shanahan 3dc06c6f21 qbsp: add a -noskip option for troubleshooting skip related problems
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-19 09:48:43 +09:30
Kevin Shanahan 7e6474c03d qbsp: keep verticies from skip/hint faces in vertex count
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>
2013-04-18 12:58:46 +09:30
Kevin Shanahan f20033fdd7 light: dynamically allocate entities and entstring
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>
2013-04-18 09:45:52 +09:30
Kevin Shanahan cd188ebc99 qbsp: increase unique vertex estimate to cope with skip faces
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>
2013-04-18 08:21:27 +09:30
Ozkan Sezer 828a34a959 common: fix undefined array reference behavior in SwapBSPFile
Thanks to a -Waggressive-loop-optimizations warning from gcc-4.8:

common/bspfile.c: In function 'SwapBSPFile':
common/bspfile.c:121:41: warning: iteration 4u invokes undefined behavior [-Waggressive-loop-optimizations]
      texinfo[i].vecs[0][j] = LittleFloat(texinfo[i].vecs[0][j]);
                                         ^
common/bspfile.c:120:2: note: containing loop
  for (j = 0; j < 8; j++)
  ^

Signed-off-by: Ozkan Sezer <sezero@users.sourceforge.net>
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-14 09:12:31 +09:30
Kevin Shanahan 99d9bccb4e Merge branch 'master' of ssh://tuon/~/scm/tyrutils 2013-04-14 09:06:49 +09:30
Ozkan Sezer 3eff2401a9 common: fix parsing quoted strings when EOF is reached mid-string
Signed-off-by: Ozkan Sezer <sezero@users.sourceforge.net>
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-14 09:05:58 +09:30
Ozkan Sezer 4a80c38081 common: add support for C-style /*..*/ comments
Signed-off-by: Ozkan Sezer <sezero@users.sourceforge.net>
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-14 09:03:54 +09:30
Kevin Shanahan 4220341252 build: create build version file and dependencies
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-10 16:10:26 +09:30
Kevin Shanahan 02e1f44f51 build: clean the dist directory too
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-10 16:02:46 +09:30
Kevin Shanahan daa2d4c868 post-release version update
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-10 16:02:25 +09:30
Kevin Shanahan 2539b73868 TyrUtils v0.7
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-10 14:39:52 +09:30
Kevin Shanahan a8348418e6 Merge branch 'master' of ssh://tuon/~/scm/tyrutils 2013-04-10 14:33:07 +09:30
Kevin Shanahan af9caf4048 build: set up snapshot targets for Win32 and OSX
Pull in some of the techniques from my TyrQuake Makefile and build OSX
fat binaries in one invocation of 'make'.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-10 14:21:59 +09:30
Kevin Shanahan c193c18d5b make -gate affect linear falloff lights as well
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-06 13:25:11 +10:30
Kevin Shanahan ee2dc38f71 light: make command line set sun anglescale as well
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-06 08:35:38 +10:30
Kevin Shanahan 4625245b09 light: implement the -addmin command line parameter
Makes minlight additive rather than just bringing low levels up to the
minimum.  Not entirely identical to the bjp implementation as it seems to
treat local minlights in some strange ways, but in most cases the
behaviour should be identical.

Added missing help text for -anglescale|-anglesense parameters too.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-04 15:55:58 +10:30
Kevin Shanahan 4021c06852 build: fix ghetto unix2dos conversion to work on msys
The only thing that seems to be able to convert \n to \r\n is awk, so use
that everywhere.

I don't understand why, but echoing the verbose command on OSX echos a
literal \r and messes up the output. Adding an extra \ escape fixes it
there, but then Linux/Msys echo the extra \... I think the OSX behaviour
might be broken here, oh well...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-04 14:30:09 +10:30
Kevin Shanahan dec714eac9 qbsp: add hintskip texture support
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-04 13:30:47 +10:30
Kevin Shanahan f1396045c6 qbsp: support *waterskip, *slimeskip and *lavaskip
Extend skip support to recognise the liquid skip texturenames the same as
metlslime's "newskip" utility.  Add documentation and describe hint
surfaces (briefly) as well.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-04 12:59:09 +10:30
Kevin Shanahan dce122ea3a qbsp: fix loading func_group/detail brushes into worldspawn
The old logic did not deal properly with the case where the source entity
did not add any brushes.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-04 10:18:39 +10:30
Kevin Shanahan 9b5868ad6d build: tag builds with uncommitted changes as dirty
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-28 10:00:57 +10:30
Kevin Shanahan 9c8cbfd601 vis: add the -noambient* options to disable auto ambient sounds
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-28 08:28:47 +10:30
Kevin Shanahan f0af8eac91 build: fix for text documentation generation
Fix the date/version tags in the man pages also.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-20 10:42:55 +10:30
Kevin Shanahan f369c97f68 build: fix directory names properly in fatbin rules
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-18 15:52:48 +10:30
Kevin Shanahan 2c4f898bbf build: insert the date/version into the man pages
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-18 15:38:04 +10:30
Kevin Shanahan 08408888bc build: small tidy up to documentation generation
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-18 14:11:41 +10:30
Kevin Shanahan 2da19f77f9 build: small tidy up to version number generation
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-18 14:08:23 +10:30
Kevin Shanahan f24a94eab5 build: improve man2txt and man2html rules
* Output to temp file and only move to final location upon success
* Fix echo of command in verbose mode (requires quotes)
* Don't use $(call ...) to invoke the groff command
* Use printf to generate the \r for the sed "unix2dos" replacement

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-18 13:59:45 +10:30
Kevin Shanahan b4ff9663cc build: add ability to compile for WIN64 using MinGW64
Fix a few minor int<->pointer size warnings.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-15 21:49:16 +10:30
Kevin Shanahan 636a94f260 light: implemented _anglescale key (AKA "_angelsense")
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-15 21:27:14 +10:30
Kevin Shanahan 4abc7d31b7 light: remove the old -compress option
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-15 20:43:12 +10:30