Commit Graph

71 Commits

Author SHA1 Message Date
Bill Currie ed8e09608a Fix the negative fractions coming from edge_portal_dist().
I have a better fix in the works, but I wanted edge_portal_dist() to be
correct.
2011-12-04 12:11:27 +09:00
Bill Currie eb5d2720e4 Avoid a segfault when there's no split plane. 2011-12-04 10:55:46 +09:00
Bill Currie 55eb88b52c Create some tests for MOD_HullContents. 2011-12-03 22:18:43 +09:00
Bill Currie 9ad298a716 Check whether the portal and box intersect.
Now on to creating tests for MOD_HullContents :)
2011-12-03 19:59:12 +09:00
Bill Currie d9a641c600 Avoid a segfault when the hull hasn't been portalized.
Serves me right for forgetting to test the main engine :P
2011-12-03 09:06:57 +09:00
Bill Currie 27642a080a Avoid infinite recursion. 2011-12-01 12:57:06 +09:00
Bill Currie f9d56f2941 Add MOD_HullContents().
If trace is null or point type, or the hull doesn't have portals, or the
first node is a leaf, MOD_HullContents operates in point mode (exactly the
same way as SV_HullPointContents()). However, in box mode, all leafs
touched by the trace are checked for their contents. The contents field of
trace (a bit field) will indicate the contents type of all touched leafs.
The returned contents value indicates the most important contents:

    solid > lava > slime > water > empty

The one's complement value of the contents type is the bit number of the
contents bit field. I'm not sure how useful this will be as getting the
amount of overlap is currently not supported.
2011-12-01 12:26:33 +09:00
Bill Currie 7ee31dd475 Allow the trace start to be in multiple leafs.
This fixes a couple of in-solid tests, but something better is needed.
2011-11-28 20:56:21 +09:00
Bill Currie 50b08c98fa Add some snug-fit tests and fix the uncovered bugs.
The tests involve the box fitting into a hole with zero slop (this would be
impossible with point clipping).
2011-11-28 20:56:21 +09:00
Bill Currie 985667ecba Fix plane touching box backsideness.
Because a box has size, even when touching a plane, the side on which the
box is can be determined (unlike a point).
2011-11-28 20:56:21 +09:00
Bill Currie 2c9b07b257 Scale the box edge vectors.
Now they represent the lengths of the edges as expected by the edge/polygon
code.
2011-11-28 20:56:20 +09:00
Bill Currie 60dbc0e342 Fix the last few bugs breaking the distance code.
The code itself seems to work now. There are still some problems: the box
faces are using unit vectors for the edges, or I should go back to unit
vectors for the portal edges; starting in a solid corner won't always work;
etc. However, that's just mopping up: the main algorithm seems to be
working.
2011-11-28 20:56:20 +09:00
Bill Currie 996859c367 Correct the projection code.
That needed to be the intersection of two coplanar lines.
2011-11-28 20:56:20 +09:00
Bill Currie 2abff68089 Fix some more silly bugs.
The target test now works, but some others have broken due to getting
negative fractions.
2011-11-28 20:56:20 +09:00
Bill Currie a1da8ecdd0 Fix some silly errors that broke most of the box tests.
Uninitialized variables and crossed signs. Oops :/
2011-11-28 20:56:20 +09:00
Bill Currie 8fc99566ab Add code to clip the motion of the box to the leaf's portals.
Unfortunately, something is broken (all box tests fail due to 0 fraction).
2011-11-28 20:56:20 +09:00
Bill Currie 73b93ffd74 Clean up the in_leaf test line. 2011-11-28 20:54:35 +09:00
Bill Currie e3d8394b7a Use the split_plane for the in-leaf test.
This seems to work better (all previously working tests pass again), but
the target test is still broken.
2011-11-28 20:54:35 +09:00
Bill Currie 7b59eaf0cd Use the correct vector for the plane distance.
Oops :)
2011-11-28 20:54:35 +09:00
Bill Currie fd5aee1d5e Use the portals to check leaf validity.
If the trace hits a portal on the plane that brought us to the leaf, then
we actually are in the leaf (otherwise, we shouldn't be here and thus
should ignore the leaf). At least, that's my thinking.

Many point tests fail (but they're really using box clipping with a zero
sized box) and two box tests fail.
2011-11-28 20:54:35 +09:00
Bill Currie e41da2f579 Store the start fraction and position in the right stack slot.
Oops. Yay, valgrind.
2011-11-28 20:54:35 +09:00
Bill Currie 91e65b6c80 Rename mplane_t to plane_t and clean up the mess.
I got rather tired of there being multiple definitions of mostly compatible
plane types (and I need a common type anyway). dplane_t still exists for
now because I want to be careful when messing with the actual bsp format.
2011-11-28 20:54:34 +09:00
Bill Currie 7a1faee460 Bail out when the trace advances past the nearest collision. 2011-11-28 20:54:34 +09:00
Bill Currie a943cdf2c4 Handle dual collisions.
When the trace collides with something on both sides of a plane, the nearer
collision is required. The code now correctly checks both sides and keeps
the nearer collision.
2011-11-28 20:54:34 +09:00
Bill Currie 0cf5dec5bb Fix the covered step tests.
However,  there is still a problem with moves where the box is always cut
by the plane: both sides need to be tested (done), but when the first side
checked allows longer motion than the second, but still collides, only the
first side is checked. The shorter motion is required.
2011-11-28 20:54:34 +09:00
Bill Currie 8cc320b7ef Move the start point to the near side of the crossed plane.
I'm not sure the end point needs to be moved at all, but I'll leave it
alone for now. I have a couple of failing test cases that seem to be caused
by not handling moves where the box is always cut by the plane.
2011-11-28 20:54:34 +09:00
Bill Currie fa6390a46a Correct the sign for the shift in frac.
However, this is not entirely correct as the new start point when testing
the other side of the plane also needs to be calculated.
2011-11-28 20:54:34 +09:00
Bill Currie b82d9f5894 Another test, another bug.
Fix an incorrect test using offset (forgot to negate).
2011-11-28 20:54:34 +09:00
Bill Currie 9984a2e87a Fix some missing usages of offset.
This fixes my one failing box clip test. Now I need to find more broken
cases. At least now, they should be real tests.
2011-11-28 20:54:33 +09:00
Bill Currie 03abb3b27d Add support for ellipsoids.
Not that boxes work yet, but the fix is the same.
2011-11-28 20:54:33 +09:00
Bill Currie b4da9241f6 Make a fresh start on box clipping.
I even have a failing test to fix :)
2011-11-28 20:54:33 +09:00
Bill Currie a356ce6572 Assume the trace will be allsolid.
Rather than setting allsolid when the trace fails to leave solid space,
clear it when the trace enters non-solid space. This is necessary because
the trace might visit only one node and thus the failure to leave solid
space will not be detected. This fixes the problem with hipnotic's bobbing
water.
2011-09-27 17:14:42 +09:00
Bill Currie 9daa0b7bde Rename the empty and solid flags, and use them correctly.
seen_empty and seen_solid much better reflect their meanings, and also use
them correctly (eg, visiting an empty node does not clear seen_solid).
Hipnotic's bobbing water is still broken, though.
2011-09-27 12:33:50 +09:00
Bill Currie 981622f969 Make MOD_TraceLine behave "correctly".
MOD_TraceLine now behaves the same as id's SV_RecursiveHullCheck (from
WinQuake). This means that even if the trace would escape from solid space
into non-solid space, the trace is treated as allsolid if it crosses from
one solid space to another before hitting the empty space.

trace-id.c is used only for establishing the behaviour of id's code.
2010-12-06 15:30:56 +09:00
Bill Currie c2af7896bd Revert "make droptofloor continue the trace if it starts solid"
This reverts commit 10232acdfe.

The problem was really in the trace code, but it got fixed by "accident"
when I had similar problems in hipnotic a couple of years later. Now to
figure out just what the trace could really should be doing.
2010-12-05 14:56:32 +09:00
Bill Currie 31640dd1b9 Clean out the last traces of my boxclip code.
I've been experiencing funny trace issues while playing Soul of Evil. While
I think the boxclip dregs shouldn't be causing problems, it's probably best
to clean them out properly before trying to fix anything.
2010-12-05 14:52:20 +09:00
Bill Currie 8831a109a4 Create and use mclipnode_t.
I didn't realize this was a critical part of fitzquake's large map
support. This should fix the non-solid brush entities in Conflagrant
Rodent.
2010-11-29 09:36:21 +09:00
Bill Currie 8c4fe2f844 Rename Sys_DPrintf to Sys_MaskPrintf.
We now have finer runtime control over what gets printed. Need to do a
SYS_DEV audit, creating new masks as apropriate.
2010-11-26 16:19:26 +09:00
Bill Currie 2185a3dcd0 Remove almost all of my boxclip developement.
This is to prevent others accidently getting headaches from my code.
2010-08-20 14:13:23 +09:00
Bill Currie 51932ee433 --enable-boxclip configure option and some more tweaks, I guess (been too long) 2009-12-19 04:45:01 +00:00
Bill Currie a26cd68ea9 more tests, more progress. just need to fix a regression that popped up while fixing the new test (18) 2009-03-22 00:31:44 +00:00
Bill Currie 384ad30df8 correct the last 4 edges. all existing testcases now pass. 2009-03-20 11:38:04 +00:00
Bill Currie fea4189150 complete rewrite of validate_solid. also, put the trace points on the other side of the split plane. Just one more set of related tests to fix. 2009-03-20 11:20:59 +00:00
Bill Currie 0ff4165149 why didn't I do this earlier? 2009-03-20 03:40:30 +00:00
Bill Currie f59f2dc7b9 some more progress with box clipping and much a saner test harness 2009-03-20 03:33:03 +00:00
Bill Currie e992edaf31 that fixed the test case (why isn't sgn a standard function? :P) 2009-03-19 04:56:44 +00:00
Bill Currie 3be88c3e1d still disabled since it's still broken, but progress has been made. Fortunately, some of the breakage shows up as a regression in the testcases. 2009-03-19 03:16:24 +00:00
Bill Currie d66934942d nuke Con_Printf and Con_DPrintf and use Sys_* instead 2007-11-06 10:17:14 +00:00
Bill Currie e15fae264a well, it finally seems to work, but q1 maps (especially start's ramp to e3) are not such that they're particulary playable due to being designed for point clipping. so still disabled until something can be sorted out. 2007-09-29 23:28:41 +00:00
Bill Currie 0ee9e1cf3e more accurate expects and don't recurse for non-crossings 2007-09-23 08:33:26 +00:00