- 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->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);
}
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)
{
x2 += x1;
y2 += y2;
y2 += y1;
}
x1 -= bmaporgx;
@ -1469,10 +1469,10 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags,
xt2 = x2 / MAPBLOCKUNITS;
yt2 = y2 / MAPBLOCKUNITS;
mapx = int(xt1);
mapy = int(yt1);
int mapex = int(xt2);
int mapey = int(yt2);
mapx = xs_FloorToInt(xt1);
mapy = xs_FloorToInt(yt1);
int mapex = xs_FloorToInt(xt2);
int mapey = xs_FloorToInt(yt2);
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.
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!
count = 100; // Stop traversing, because somebody screwed up.

View file

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