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.
This commit is contained in:
Bill Currie 2011-09-27 17:14:42 +09:00
parent 9c6693d567
commit a356ce6572
2 changed files with 11 additions and 4 deletions

View file

@ -146,6 +146,8 @@ test_t tests[] = {
{0, &point, &hull1, { 0, 0, 0}, { 40, 0, 0}, { 1, 0, 1, 1, 0}},
{0, &point, &hull1, { 40, 0, 0}, {-88, 0, 0}, {0.0625, 0, 0, 1, 0}},
{0, &point, &hull1, { 0, 0, 0}, { 64, 0, 0}, { 0.75, 0, 1, 1, 0}},
{0, &point, &hull1, { 0, 0, 0}, { 0, 8, 0}, { 1, 1, 1, 0, 0}},
{0, &point, &hull1, { 40, 0, 0}, { 40, 8, 0}, { 1, 0, 0, 1, 0}},
{0, &point, &hull2, {-64, 0, 0}, { 64, 0, 0}, { 1, 1, 1, 0, 0}},
{0, &point, &hull2, { 0, 0, 0}, { 40, 0, 0}, { 1, 0, 1, 1, 0}},
@ -156,6 +158,9 @@ test_t tests[] = {
{0, &point, &hull3, { 0, 0, 0}, { 40, 0, 0}, { 1, 0, 0, 1, 1}},
{0, &point, &hull3, { 40, 0, 0}, {-88, 0, 0}, {0.5625, 0, 0, 1, 1}},
{0, &point, &hull3, { 0, 0, 0}, { 64, 0, 0}, { 0.75, 0, 0, 1, 1}},
{0, &point, &hull3, { 0, 0, 0}, { 0, 8, 0}, { 1, 0, 0, 1, 0}},
{0, &point, &hull3, { 40, 0, 0}, { 40, 8, 0}, { 1, 0, 0, 0, 1}},
{0, &point, &hull3, { 0, 0, 0}, { 40, 0, 0}, { 1, 0, 0, 1, 1}},
};
#define num_tests (sizeof (tests) / sizeof (tests[0]))

View file

@ -109,7 +109,7 @@ MOD_TraceLine (hull_t *hull, int num,
seen_solid = 0;
split_plane = 0;
trace->allsolid = false;
trace->allsolid = true;
trace->startsolid = false;
trace->inopen = false;
trace->inwater = false;
@ -122,9 +122,10 @@ MOD_TraceLine (hull_t *hull, int num,
// this is the first leaf visited, thus the start leaf
trace->startsolid = seen_solid = true;
} else if (!seen_empty && seen_solid) {
// if crossing from one solid leaf to another, treat the
// whole trace as solid (this is what id does)
trace->allsolid = true;
// If crossing from one solid leaf to another, treat the
// whole trace as solid (this is what id does).
// However, since allsolid is initialized to true, no need
// to do anything.
return;
} else {
// crossing from an empty leaf to a solid leaf: the trace
@ -134,6 +135,7 @@ MOD_TraceLine (hull_t *hull, int num,
}
} else {
seen_empty = true;
trace->allsolid = false;
if (num == CONTENTS_EMPTY)
trace->inopen = true;
else