Light pathing tweak.

git-svn-id: https://svn.eduke32.com/eduke32@1394 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2009-05-31 18:10:09 +00:00
parent 4e5bde3a79
commit 2997d1e0f5
3 changed files with 7 additions and 6 deletions

View file

@ -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

View file

@ -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);

View file

@ -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]))