Commit Graph

645 Commits

Author SHA1 Message Date
Kevin Shanahan 221d6ca2a3 qbsp: make sure to add animating texture frames in order
We take care of adding extra animation frames during loading of the map
file to ensure that we add lower-numbered texture frames before the higher
numbered frames.  Most Quake engines will choke on a BSP if the texture
frames are presented out of order (including the original).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-13 16:27:05 +09:30
Kevin Shanahan 7a2f4383ff build: use single call to wildcard for depfiles
Provides a modest speedup on Windows, where this operation is ridiculously
slow.  Not a huge number of files on this project, but the speedup is
measurable.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-06 16:29:21 +09:30
Kevin Shanahan 272816d24f qbsp: increase MAXTOKEN to 1024 to cope with long "wad" keys
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-05 10:08:49 +09:30
Kevin Shanahan 23591535b4 light: show face area for bad texture axis error
Often these errors are caused by super small faces on brushes, show the
area of the offending face to make it more obvious if that is the case.
Kind of lost in the diff, but moved the TriArea, etc. functions up and
added FaceArea() and then augmented the error message.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-03 16:47:15 +09:30
Kevin Shanahan c94414f288 light: allocate one extra lightmap to simplify handling overflow
Rather than allocating the overflow map within each function and
having to handle it as a special case in each, we always allocate the
extra lightmap in the base LightFace function and use common helper
functions to handle allocation and warning on overflow.

We lose a tiny bit of debugging info here about the specific light
that made the surface overflow MAXLIGHTSTYLES, but that never gave us
all the sources, only the last one encountered.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-10 13:47:58 +09:30
Kevin Shanahan 35bf3f4232 light: factor out adding and clamping of light samples
Simple functions, but just helps to tidy up the bodies of the other
LightFace functions and makes sure we're handling light & colours
consistently across each (we weren't in the case of coloured local
minlights, previously).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-08 15:42:50 +09:30
Kevin Shanahan e09c1f8e2a light: rename FixMinLight -> LightFace_Min
Move away from the "Fix" naming ~ it's not a fix, we're applying the
minimum lighting values as requested.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-08 13:30:38 +09:30
Kevin Shanahan 23f8f1a35e light: unify allocation of new face light styles
Factor out the allocation of new light styles - slightly increases the
code size, but we get two benefits; first is that we now don't
allocate the style 0 lightmap unless we actually need it; second, we
get warnings if sunlight or minlight is unable to be applied due to
lack of a style 0 lightmap.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-04 14:29:47 +09:30
Kevin Shanahan f498ed5ec3 light: pass the sun direction vector into LightFace_Sky
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 16:32:03 +09:30
Kevin Shanahan ca78568cae light: rename SkyLightFace -> LightFace_Sky
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 14:55:56 +09:30
Kevin Shanahan 7abfeb35da light: rename SingleLightFace -> LightFace_Entity
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 14:54:21 +09:30
Kevin Shanahan 12e24085c1 light: always calculate color values for light samples
Simplify the code by removing the if (colored) conditionals from the
code path.  CPU cost is insignificant compared to tracing the rays.
As before, only write the lit file if colored lights are detected or
the use explicity requests it.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 13:03:27 +09:30
Kevin Shanahan a0fc4cab3e light: remove (now) unused MAXLIGHTS define
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-07-03 11:49:07 +09:30
Kevin Shanahan e3a5b57ba4 qbsp: add "-forcegoodtree" command line option
Normally we build a fast, unoptimized bsp tree for the world before
culling outside surfaces.  This command line switch forces the use of
the more expensive algorithm for this processing stage.  Seems to have
a positive effect on the final BSP in terms of reduced marksurfaces
and smaller file size, at the expense of longer processing time.

Marked experimental for now, as it may be removed later (either by
making this behaviour the default or removing it altogether).

Credit to Rebb from func_msgboard for implementing this tweak first in
his qbsp util.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-25 13:59:24 +09:30
Kevin Shanahan 463ded9c14 update changelog
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-25 13:24:54 +09:30
Kevin Shanahan 7882af13a9 qbsp: replace global face list with local in tjunc_fix_r
Explicitly pass the face list around to be added to as needed instead
of implicit reference to the global 'newlist'.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-25 11:00:24 +09:30
Kevin Shanahan 06166f43d8 qbsp: allocate the superface for tjunc fixes dynamically
Remove the global static buffer and allocate the superface when
processing tjuncs.  Also check that we are not overflowing the buffer
before adding more vertices - probably something went wrong if this
ever overflows, so better to crash with a definite error than scribble
random memory.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-25 10:39:00 +09:30
Kevin Shanahan 53a340ff04 qbsp: trivial typo in comment
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-24 14:04:23 +09:30
Kevin Shanahan 83b54b90f7 qbsp: improve calculation of allocation for dmiptexlump
Use offsetof for the count/offsets and tidy up the local comments
while we're at it.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-24 14:00:58 +09:30
Kevin Shanahan 7a65efbc00 qbsp: define offsetof to builtin if not defined
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-24 13:58:58 +09:30
Kevin Shanahan ff9bb3eab0 qbsp: tweak T_EPSILON to be greater than EQUAL_EPSILON
The way wedge_t and wvert_t were hashed and compared was resulting in
FixFaceEdges being able to get stuck in a loop adding verticies to a face
if two consecutive verticies were very close to EQUAL_EPSILON apart.
Avoid these problems by tweaking T_EPSILON to be slightly wider than
EQUAL_EPSILON.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 14:22:13 +09:30
Kevin Shanahan 6d6a787185 qbsp: comment wvert_t and wedge_t structures
Took me some time to work out what this was all representing and that t
was the parameter to the parametric equations of the edge's line in 3-d
space.  May as well make it easier for others and my future self.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 14:20:54 +09:30
Kevin Shanahan 3cfc4a27cc qbsp: access f->w through local pointer in SplitFaceForTjunc
No functional changes, just making the previous cleanup more consistent.
Pointer is non-const now, but no matter.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 14:19:50 +09:30
Kevin Shanahan 91ae3d16d9 qbsp: cleanups in SplitFaceForTjunc
Mainly tidy up long lines and rename dir/test variables to edgevec[2]
since these are the edge vectors we are testing the angles between.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 11:37:40 +09:30
Kevin Shanahan 72fd4caab7 qbsp: rename wedge_t locals from 'w' to 'edge'
Since 'w' is commonly used for a winding variable, this makes the code
harder to read.  Use the name 'edge' instead for these tjunc local types.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 11:35:28 +09:30
Kevin Shanahan 523f927b8e qbsp: trivial cleanups in FaceSide
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-23 10:56:41 +09:30
Kevin Shanahan 550b883de2 qbsp: more tjunc cleanups; braces and comments
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-22 20:59:42 +09:30
Kevin Shanahan 46c990c617 qbsp: trivial cleanups in SplitFaceForTjunc
Rename 'v' local to 'angle' and re-format some comments.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-06-22 20:58:31 +09:30
Kevin Shanahan e4367bc970 Merge branch 'master' of ssh://tuon.disenchant.net/~/scm/tyrutils 2013-05-08 11:34:58 +09:30
Kevin Shanahan 31cdb99ac6 vis: make leaf recursion a warning in LeafFlow
Make CheckStack return an error code if we have recursed and print
some information about the offending leaf/portals before continuing.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-08 11:33:35 +09:30
Kevin Shanahan 9ea5aaa1db vis: tidy up definitions of LogLeaf/LogWinding
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-08 11:32:57 +09:30
Kevin Shanahan c0d03cba32 vis: constify source argument to copy winding
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-05-08 11:32:12 +09:30
Kevin Shanahan 8939d1f6db qbsp: fix adding animated textures for alt-anim textured brushes
If brushes in the map are textured with alt-animations, and the second
character (i.e. the 'a' in +abutton) is lower case then we have the
lowercase texture name in the miptex list, but when we add alt textures we
use the uppercase, so it gets duplicated.  Duplicated animating textures
cause most engines to exit with an error.

Since the map file could use uppercase texture names as well, really we
should either be normalizing texture names to upper or lower case, or we
need to do case-insensitive matching - so I just changed to
case-insensitive matching.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 21:43:59 +09:30
Kevin Shanahan 59f53cf2fa bump version post-release
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 21:43:32 +09:30
Kevin Shanahan 2e74b15a08 TyrUtils v0.10
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 08:13:09 +09:30
Kevin Shanahan 54e0e55113 vis: fix missing vertex on clipped portals (argh!!!)
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-25 07:58:43 +09:30
Kevin Shanahan 7caeafb714 trivial: pad counts to 8 digits, sizes to 10 in output
Also do a quick sweep of the source and consistently use %d instead of
%i (no real difference, but just pick one).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 15:18:01 +09:30
Kevin Shanahan 414d3dda51 qbsp: add fflush back for msgScree
Otherwise progress output doesn't show on unix terminals.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 15:05:07 +09:30
Kevin Shanahan 47d2b9841b qbsp: use 5 spaces instead of tab to pad msgStat
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 15:04:35 +09:30
Kevin Shanahan a78115fa2c doc: add documentation for bspinfo and bsputil
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 14:29:12 +09:30
Kevin Shanahan a9cfbbc3dc trivial: fix missing newline at end of usage output
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 14:26:21 +09:30
Kevin Shanahan 0ad7bac1d3 build: only move tar archive to target name on success
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 12:22:06 +09:30
Kevin Shanahan 45fa5a6e39 build: add a target for building source tarball from git
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 11:37:51 +09:30
Kevin Shanahan fc38e25074 post-release version bump
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 09:33:57 +09:30
Kevin Shanahan d42b6a062c TyrUtils v0.9
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 09:05:15 +09:30
Kevin Shanahan 723a3f140e common: fix missing stdarg include in log.h
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 09:02:20 +09:30
Kevin Shanahan 280df62f55 qbsp: fix MidpointWinding bug, which fixes the bad leak lines!
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 08:54:26 +09:30
Kevin Shanahan 653daa111a qbsp: invert sense of fillnode side initialisation
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 07:02:38 +09:30
Kevin Shanahan 1e39a7e614 qbsp: factor out leafnode intersection from LineIntersect_r
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 07:01:37 +09:30
Kevin Shanahan 4543817f59 qbsp: use a memset to simplify leakstate initialization
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-24 07:00:34 +09:30