RetroPie-Setup/scriptmodules/ports/eduke32/0006-e4m4-water-bug.patch
s1eve-mcdichae1 5e9d997797 eduke32.sh - patch a gameplay bug in e4m4
combined r8241 and r8247 to fix instant death when going underwater.

7bfa754762

1ad61337a8
2025-03-27 18:34:35 -07:00

29 lines
1.1 KiB
Diff

diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp
index 24eb02368..1a7b57bb5 100644
--- a/source/build/src/clip.cpp
+++ b/source/build/src/clip.cpp
@@ -945,14 +945,22 @@ static int get_floorspr_clipyou(vec2_t const v1, vec2_t const v2, vec2_t const v
return clipyou;
}
-static void clipupdatesector(vec2_t const pos, int16_t * const sectnum, int const walldist)
+static void clipupdatesector(vec2_t const pos, int16_t * const sectnum, int walldist)
{
if (inside_p(pos.x, pos.y, *sectnum))
return;
+ int16_t nsecs = min<int16_t>(getsectordist(pos, *sectnum), INT16_MAX);
+
+ if (nsecs > (walldist + 8))
+ {
+ OSD_Printf("%s():%d shortest distance between origin point (%d, %d) and sector %d is %d. Sector may be corrupt!\n",
+ EDUKE32_FUNCTION, __LINE__, pos.x, pos.y, *sectnum, nsecs);
+ walldist = 0x7fff;
+ }
+
static int16_t sectlist[MAXSECTORS];
static uint8_t sectbitmap[(MAXSECTORS+7)>>3];
- int16_t nsecs;
bfirst_search_init(sectlist, sectbitmap, &nsecs, MAXSECTORS, *sectnum);