From 7a673c2801897d5e21812c66ef227404912f5e07 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 22 Oct 2022 23:34:37 +0200 Subject: [PATCH] - removed the old wall checker code and all dependencies. Most importantly this eliminates all calls to deprecated utilities from clip.cpp and removes the actual functions from gamefuncs.h. --- source/build/src/clip.cpp | 71 ++++----------------------------------- 1 file changed, 6 insertions(+), 65 deletions(-) diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index e796a6edc..373916101 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -104,23 +104,6 @@ static void addclipline(int32_t dax1, int32_t day1, int32_t dax2, int32_t day2, clipnum++; } -inline void clipmove_tweak_pos(const vec3_t *pos, int32_t gx, int32_t gy, int32_t x1, int32_t y1, int32_t x2, - int32_t y2, double *daxptr, double *dayptr) -{ - double x = pos->X * inttoworld, y = pos->Y * inttoworld; - double result = InterceptLineSegments(x, y, gx * inttoworld, gy * inttoworld, x1 * inttoworld, y1 * inttoworld, (x2 - x1) * inttoworld, (y2 - y1) * inttoworld); - if (result > 0) - { - *daxptr = x + result * gx * inttoworld; - *dayptr = y + result * gy * inttoworld; - } - else - { - *daxptr = x; - *dayptr = y; - } -} - // // raytrace (internal) // @@ -262,58 +245,16 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, for (int j=startwall; jX * inttoworld, pos->Y * inttoworld, pos->Z * zinttoworld}; - DVector2 intersect; - int clipyou2 = checkClipWall(clip, wal); + int clipyou = checkClipWall(clip, wal); + if (clipyou == -1) continue; - auto const wal2 = wal->point2Wall(); - vec2_t p1 = wal->wall_int_pos(); - vec2_t p2 = wal2->wall_int_pos(); - - if ((p1.X < clipMin.X && p2.X < clipMin.X) || (p1.X > clipMax.X && p2.X > clipMax.X) || - (p1.Y < clipMin.Y && p2.Y < clipMin.Y) || (p1.Y > clipMax.Y && p2.Y > clipMax.Y)) - { - assert(clipyou2 != 1); - continue; - } - - vec2_t d = { p2.X-p1.X, p2.Y-p1.Y }; - - if (d.X * (pos->Y-p1.Y) < (pos->X-p1.X) * d.Y) - { - assert(clipyou2 != 1); - continue; - } - - vec2_t const r = { (d.Y > 0) ? clipMax.X : clipMin.X, (d.X > 0) ? clipMin.Y : clipMax.Y }; - vec2_t v = { d.X * (r.Y - p1.Y), d.Y * (r.X - p1.X) }; - - if (v.X >= v.Y) - { - assert(clipyou2 != 1); - continue; - } - - int clipyou = 0; - - if (wal->nextsector < 0 || (wal->cstat & EWallFlags::FromInt(dawalclipmask))) - { - clipyou = 1; - } - else - { - DVector2 ipos; - clipmove_tweak_pos(pos, diff.X, diff.Y, p1.X, p1.Y, p2.X, p2.Y, &ipos.X, &ipos.Y); - clipyou = checkOpening(ipos, pos->Z * zinttoworld, §or[dasect], wal->nextSector(), - ceildist * zinttoworld, flordist * zinttoworld, enginecompatibility_mode == ENGINECOMPATIBILITY_NONE); - v.X = int(ipos.X * worldtoint); - v.Y = int(ipos.Y * worldtoint); - } - - - assert(clipyou == clipyou2); if (clipyou) { + vec2_t p1 = wal->wall_int_pos(); + vec2_t p2 = wal->point2Wall()->wall_int_pos(); + vec2_t d = { p2.X - p1.X, p2.Y - p1.Y }; + CollisionBase objtype; objtype.setWall(j);