- fixed some issues with the PathTraverse and sight checking code:

* typo in calculating end position from a trace vector
 * must use floor to convert from floating point block coordinate to block index to account for running off the negative side of the blockmap. (Int cast always rounds toward zero which is wrong here.)
 * bad calculation of sight checking slopes - they has the actor's z coordinate duplicated.

- fixed scaling of automap markers.
This commit is contained in:
Christoph Oelckers 2016-04-02 12:14:56 +02:00
parent b3659305ce
commit 931774ab38
3 changed files with 14 additions and 13 deletions

View File

@ -3011,7 +3011,7 @@ void AM_drawAuthorMarkers ()
marked->subsector->flags & SSECF_DRAWN : marked->subsector->flags & SSECF_DRAWN :
marked->Sector->MoreFlags & SECF_DRAWN))) marked->Sector->MoreFlags & SECF_DRAWN)))
{ {
DrawMarker (tex, marked->X(), marked->Y(), 0, flip, mark->Scale.X, mark->Scale.Y, mark->Translation, DrawMarker (tex, marked->X(), marked->Y(), 0, flip, mark->Scale.X*16, mark->Scale.Y*16, mark->Translation,
mark->Alpha, mark->fillcolor, mark->RenderStyle); mark->Alpha, mark->fillcolor, mark->RenderStyle);
} }
marked = mark->args[0] != 0 ? it.Next() : NULL; marked = mark->args[0] != 0 ? it.Next() : NULL;

View File

@ -1456,7 +1456,7 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags,
if (flags & PT_DELTA) if (flags & PT_DELTA)
{ {
x2 += x1; x2 += x1;
y2 += y2; y2 += y1;
} }
x1 -= bmaporgx; x1 -= bmaporgx;
@ -1469,10 +1469,10 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags,
xt2 = x2 / MAPBLOCKUNITS; xt2 = x2 / MAPBLOCKUNITS;
yt2 = y2 / MAPBLOCKUNITS; yt2 = y2 / MAPBLOCKUNITS;
mapx = int(xt1); mapx = xs_FloorToInt(xt1);
mapy = int(yt1); mapy = xs_FloorToInt(yt1);
int mapex = int(xt2); int mapex = xs_FloorToInt(xt2);
int mapey = int(yt2); int mapey = xs_FloorToInt(yt2);
if (mapex > mapx) if (mapex > mapx)
@ -1563,7 +1563,7 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags,
} }
// [RH] Handle corner cases properly instead of pretending they don't exist. // [RH] Handle corner cases properly instead of pretending they don't exist.
switch (((int(yintercept) == mapy) << 1) | (int(xintercept) == mapx)) switch (((xs_FloorToInt(yintercept) == mapy) << 1) | (xs_FloorToInt(xintercept) == mapx))
{ {
case 0: // neither xintercept nor yintercept match! case 0: // neither xintercept nor yintercept match!
count = 100; // Stop traversing, because somebody screwed up. count = 100; // Stop traversing, because somebody screwed up.

View File

@ -642,10 +642,11 @@ bool SightCheck::P_SightPathTraverse ()
xt2 = x2 / MAPBLOCKUNITS; xt2 = x2 / MAPBLOCKUNITS;
yt2 = y2 / MAPBLOCKUNITS; yt2 = y2 / MAPBLOCKUNITS;
mapx = int(xt1); mapx = xs_FloorToInt(xt1);
mapy = int(yt1); mapy = xs_FloorToInt(yt1);
int mapex = int(xt2); int mapex = xs_FloorToInt(xt2);
int mapey = int(yt2); int mapey = xs_FloorToInt(yt2);
if (mapex > mapx) if (mapex > mapx)
{ {
@ -731,7 +732,7 @@ bool SightCheck::P_SightPathTraverse ()
if (res == -1 || (mapxstep | mapystep) == 0) if (res == -1 || (mapxstep | mapystep) == 0)
break; break;
switch (((int(yintercept) == mapy) << 1) | (int(xintercept) == mapx)) switch (((xs_FloorToInt(yintercept) == mapy) << 1) | (xs_FloorToInt(xintercept) == mapx))
{ {
case 0: // neither xintercept nor yintercept match! case 0: // neither xintercept nor yintercept match!
sightcounts[5]++; sightcounts[5]++;
@ -872,7 +873,7 @@ sightcounts[0]++;
double lookheight = t1->Center(); double lookheight = t1->Center();
t1->GetPortalTransition(lookheight, &sec); t1->GetPortalTransition(lookheight, &sec);
double bottomslope = t2->Z() - (t1->Z() + lookheight); double bottomslope = t2->Z() - lookheight;
double topslope = bottomslope + t2->Height; double topslope = bottomslope + t2->Height;
SightTask task = { 0, topslope, bottomslope, -1, sec->PortalGroup }; SightTask task = { 0, topslope, bottomslope, -1, sec->PortalGroup };