diff --git a/libs/models/test/testclip.c b/libs/models/test/testclip.c index f56a0176e..5992d3563 100644 --- a/libs/models/test/testclip.c +++ b/libs/models/test/testclip.c @@ -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])) diff --git a/libs/models/trace.c b/libs/models/trace.c index c78c566c5..1cb02d00a 100644 --- a/libs/models/trace.c +++ b/libs/models/trace.c @@ -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