From f9e866d32d43fe7619192520ad753dc4615104a1 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 18 Apr 2019 17:24:05 +0000 Subject: [PATCH] Rename clipwalldist() to getwalldist() and move both it and sectoradjacent() to engine.cpp git-svn-id: https://svn.eduke32.com/eduke32@7586 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/build.h | 2 ++ source/build/include/clip.h | 2 -- source/build/src/clip.cpp | 21 +-------------------- source/build/src/engine.cpp | 19 +++++++++++++++++++ 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 88e775c74..0ff85d2ae 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -1166,6 +1166,8 @@ int32_t try_facespr_intersect(uspritetype const * const spr, const vec3_t *refpo int32_t vx, int32_t vy, int32_t vz, vec3_t *intp, int32_t strictly_smaller_than_p); +bool sectoradjacent(int sect1, int sect2); +int32_t getwalldist(vec2_t const &p, int const w); extern const int16_t *chsecptr_onextwall; int32_t checksectorpointer(int16_t i, int16_t sectnum); diff --git a/source/build/include/clip.h b/source/build/include/clip.h index d071b8b4b..579f03f71 100644 --- a/source/build/include/clip.h +++ b/source/build/include/clip.h @@ -75,8 +75,6 @@ extern int16_t clipsectorlist[MAXCLIPSECTORS]; int clipinsidebox(vec2_t *vect, int wallnum, int walldist); int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist); -int sectoradjacent(int sect1, int sect2); - extern int32_t clipmoveboxtracenum; int32_t clipmove(vec3_t *const pos, int16_t *const sectnum, int32_t xvect, int32_t yvect, int32_t const walldist, int32_t const ceildist, diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index c4032db01..dc47ae598 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -908,25 +908,6 @@ static int32_t get_floorspr_clipyou(int32_t x1, int32_t x2, int32_t x3, int32_t return clipyou; } -int sectoradjacent(int sect1, int sect2) -{ - if (sector[sect1].wallnum > sector[sect2].wallnum) - swaplong(§1, §2); - - for (int i = 0; i < sector[sect1].wallnum; i++) - if (wall[sector[sect1].wallptr+i].nextsector == sect2) - return 1; - - return 0; -} - -static inline int32_t clipwalldist(vec2_t const &p, int const w) -{ - int32_t closestx, closesty; - yax_getclosestpointonwall(w, &closestx, &closesty); - return klabs(closestx - p.x) + klabs(closesty - p.y); -} - static void clipupdatesector(vec2_t const &p, int16_t * const sectnum, int const walldist) { if (inside_p(p.x, p.y, *sectnum)) @@ -970,7 +951,7 @@ static void clipupdatesector(vec2_t const &p, int16_t * const sectnum, int const // check floor curbs here? for (int j = startwall; j < endwall; j++) - if (wall[j].nextsector >= 0 && clipwalldist(p, j) <= walldist) + if (wall[j].nextsector >= 0 && getwalldist(p, j) <= walldist) bfirst_search_try(sectlist, sectbitmap, &nsecs, wall[j].nextsector); } diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 0fe3f4c76..3ccf5c144 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -10977,6 +10977,25 @@ static inline bool inside_z_p(int32_t const x, int32_t const y, int32_t const z, return (z >= cz && z <= fz && inside_p(x, y, sectnum)); } +bool sectoradjacent(int sect1, int sect2) +{ + if (sector[sect1].wallnum > sector[sect2].wallnum) + swaplong(§1, §2); + + for (int i = 0; i < sector[sect1].wallnum; i++) + if (wall[sector[sect1].wallptr + i].nextsector == sect2) + return 1; + + return 0; +} + +int32_t getwalldist(vec2_t const &p, int const w) +{ + int32_t closestx, closesty; + yax_getclosestpointonwall(w, &closestx, &closesty); + return klabs(closestx - p.x) + klabs(closesty - p.y); +} + // // updatesector[z] //