diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 9696750d7..de37e9cde 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -556,7 +556,7 @@ typedef struct s_equation { typedef struct s_point2d { float x, y; } _point2d; -int32_t wallvisible(int16_t wallnum); +int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum); #define STATUS2DSIZ 144 #define STATUS2DSIZ2 26 diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 608da35de..408f6b8ab 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -5970,7 +5970,7 @@ static inline _equation equation(float x1, float y1, float x2, float y2) return (ret); } -int32_t wallvisible(int16_t wallnum) +int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum) { // 1 if wall is in front of player 0 otherwise int32_t a1, a2; @@ -5979,8 +5979,8 @@ int32_t wallvisible(int16_t wallnum) w1 = &wall[wallnum]; w2 = &wall[w1->point2]; - a1 = getangle(w1->x - globalposx, w1->y - globalposy); - a2 = getangle(w2->x - globalposx, w2->y - globalposy); + a1 = getangle(w1->x - x, w1->y - y); + a2 = getangle(w2->x - x, w2->y - y); //if ((wallnum == 23) || (wallnum == 9)) // OSD_Printf("Wall %d : %d - sector %d - x %d - y %d.\n", wallnum, (a2 + (2048 - a1)) & 2047, globalcursectnum, globalposx, globalposy); diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 2cc6789e9..ac6d6743f 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -1180,7 +1180,7 @@ static void polymer_displayrooms(int16_t dacursectnum) while (i < sec->wallnum) { if ((wall[sec->wallptr + i].nextsector != -1) && - (wallvisible(sec->wallptr + i)) && + (wallvisible(globalposx, globalposy, sec->wallptr + i)) && (polymer_planeinfrustum(&prwalls[sec->wallptr + i]->mask, frustum))) { if ((prwalls[sec->wallptr + i]->mask.vertcount == 4) && @@ -4244,7 +4244,8 @@ static inline void polymer_culllight(char lightindex) if (w->over.drawn) light->isinview = 1; } - if (polymer_planeinlight(&w->mask, light)) { + if (wallvisible(light->x, light->y, sec->wallptr + i) && + polymer_planeinlight(&w->mask, light)) { if ((w->mask.vertcount == 4) && (w->mask.buffer[(0 * 5) + 1] >= w->mask.buffer[(3 * 5) + 1]) && (w->mask.buffer[(1 * 5) + 1] >= w->mask.buffer[(2 * 5) + 1]))