- replaced AActor::vel and player_t::Vel with a floating point version.

- Converted P_MovePlayer and all associated variables to floating point because this wasn't working well with a mixture between float and fixed.

Like the angle commit this has just been patched up to compile, the bulk of work is yet to be done.
This commit is contained in:
Christoph Oelckers 2016-03-20 00:54:18 +01:00
commit 51b05d331d
140 changed files with 2406 additions and 2403 deletions

View file

@ -351,10 +351,10 @@ void AActor::UnlinkFromWorld ()
bool AActor::FixMapthingPos()
{
sector_t *secstart = P_PointInSectorBuggy(X(), Y());
sector_t *secstart = P_PointInSectorBuggy(_f_X(), _f_Y());
int blockx = GetSafeBlockX(X() - bmaporgx);
int blocky = GetSafeBlockY(Y() - bmaporgy);
int blockx = GetSafeBlockX(_f_X() - bmaporgx);
int blocky = GetSafeBlockY(_f_Y() - bmaporgy);
bool success = false;
if ((unsigned int)blockx < (unsigned int)bmapwidth &&
@ -380,10 +380,10 @@ bool AActor::FixMapthingPos()
}
// Not inside the line's bounding box
if (X() + radius <= ldef->bbox[BOXLEFT]
|| X() - radius >= ldef->bbox[BOXRIGHT]
|| Y() + radius <= ldef->bbox[BOXBOTTOM]
|| Y() - radius >= ldef->bbox[BOXTOP])
if (_f_X() + radius <= ldef->bbox[BOXLEFT]
|| _f_X() - radius >= ldef->bbox[BOXRIGHT]
|| _f_Y() + radius <= ldef->bbox[BOXBOTTOM]
|| _f_Y() - radius >= ldef->bbox[BOXTOP])
continue;
// Get the exact distance to the line
@ -392,8 +392,8 @@ bool AActor::FixMapthingPos()
P_MakeDivline(ldef, &dll);
dlv.x = X();
dlv.y = Y();
dlv.x = _f_X();
dlv.y = _f_Y();
dlv.dx = FixedDiv(dll.dy, linelen);
dlv.dy = -FixedDiv(dll.dx, linelen);
@ -402,7 +402,7 @@ bool AActor::FixMapthingPos()
if (distance < radius)
{
DPrintf("%s at (%d,%d) lies on %s line %td, distance = %f\n",
this->GetClass()->TypeName.GetChars(), X() >> FRACBITS, Y() >> FRACBITS,
this->GetClass()->TypeName.GetChars(), _f_X() >> FRACBITS, _f_Y() >> FRACBITS,
ldef->dx == 0 ? "vertical" : ldef->dy == 0 ? "horizontal" : "diagonal",
ldef - lines, FIXED2DBL(distance));
angle_t finean = R_PointToAngle2(0, 0, ldef->dx, ldef->dy);
@ -418,7 +418,7 @@ bool AActor::FixMapthingPos()
// Get the distance we have to move the object away from the wall
distance = radius - distance;
SetXY(X() + FixedMul(distance, finecosine[finean]), Y() + FixedMul(distance, finesine[finean]));
SetXY(_f_X() + FixedMul(distance, finecosine[finean]), _f_Y() + FixedMul(distance, finesine[finean]));
ClearInterpolation();
success = true;
}
@ -446,16 +446,16 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
{
if (!spawningmapthing || numgamenodes == 0)
{
sector = P_PointInSector(X(), Y());
sector = P_PointInSector(_f_X(), _f_Y());
}
else
{
sector = P_PointInSectorBuggy(X(), Y());
sector = P_PointInSectorBuggy(_f_X(), _f_Y());
}
}
Sector = sector;
subsector = R_PointInSubsector(X(), Y()); // this is from the rendering nodes, not the gameplay nodes!
subsector = R_PointInSubsector(_f_X(), _f_Y()); // this is from the rendering nodes, not the gameplay nodes!
if (!(flags & MF_NOSECTOR))
{
@ -482,7 +482,7 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
// When a node is deleted, its sector links (the links starting
// at sector_t->touching_thinglist) are broken. When a node is
// added, new sector links are created.
P_CreateSecNodeList(this, X(), Y());
P_CreateSecNodeList(this, _f_X(), _f_Y());
touching_sectorlist = sector_list; // Attach to thing
sector_list = NULL; // clear for next time
}
@ -493,11 +493,11 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
{
FPortalGroupArray check(FPortalGroupArray::PGA_NoSectorPortals);
P_CollectConnectedGroups(Sector->PortalGroup, Pos(), Top(), radius, check);
P_CollectConnectedGroups(Sector->PortalGroup, _f_Pos(), _f_Top(), radius, check);
for (int i = -1; i < (int)check.Size(); i++)
{
fixedvec3 pos = i==-1? Pos() : PosRelative(check[i]);
fixedvec3 pos = i==-1? _f_Pos() : PosRelative(check[i]);
int x1 = GetSafeBlockX(pos.x - radius - bmaporgx);
int x2 = GetSafeBlockX(pos.x + radius - bmaporgx);
@ -737,8 +737,8 @@ line_t *FBlockLinesIterator::Next()
FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, AActor *origin, fixed_t checkradius)
: checklist(check)
{
checkpoint = origin->Pos();
if (!check.inited) P_CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist);
checkpoint = origin->_f_Pos();
if (!check.inited) P_CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->_f_Top(), checkradius, checklist);
checkpoint.z = checkradius == -1? origin->radius : checkradius;
basegroup = origin->Sector->PortalGroup;
startsector = origin->Sector;
@ -1007,8 +1007,8 @@ AActor *FBlockThingsIterator::Next(bool centeronly)
fixed_t blocktop = blockbottom + MAPBLOCKSIZE;
// only return actors with the center in this block
if (me->X() >= blockleft && me->X() < blockright &&
me->Y() >= blockbottom && me->Y() < blocktop)
if (me->_f_X() >= blockleft && me->_f_X() < blockright &&
me->_f_Y() >= blockbottom && me->_f_Y() < blocktop)
{
return me;
}
@ -1072,8 +1072,8 @@ AActor *FBlockThingsIterator::Next(bool centeronly)
FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, AActor *origin, fixed_t checkradius, bool ignorerestricted)
: checklist(check)
{
checkpoint = origin->Pos();
if (!check.inited) P_CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist);
checkpoint = origin->_f_Pos();
if (!check.inited) P_CollectConnectedGroups(origin->Sector->PortalGroup, checkpoint, origin->_f_Top(), checkradius, checklist);
checkpoint.z = checkradius == -1? origin->radius : checkradius;
basegroup = origin->Sector->PortalGroup;
Reset();
@ -1260,29 +1260,29 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it
switch (i)
{
case 0: // Top edge
line.x = thing->X() + thing->radius;
line.y = thing->Y() + thing->radius;
line.x = thing->_f_X() + thing->radius;
line.y = thing->_f_Y() + thing->radius;
line.dx = -thing->radius * 2;
line.dy = 0;
break;
case 1: // Right edge
line.x = thing->X() + thing->radius;
line.y = thing->Y() - thing->radius;
line.x = thing->_f_X() + thing->radius;
line.y = thing->_f_Y() - thing->radius;
line.dx = 0;
line.dy = thing->radius * 2;
break;
case 2: // Bottom edge
line.x = thing->X() - thing->radius;
line.y = thing->Y() - thing->radius;
line.x = thing->_f_X() - thing->radius;
line.y = thing->_f_Y() - thing->radius;
line.dx = thing->radius * 2;
line.dy = 0;
break;
case 3: // Left edge
line.x = thing->X() - thing->radius;
line.y = thing->Y() + thing->radius;
line.x = thing->_f_X() - thing->radius;
line.y = thing->_f_Y() + thing->radius;
line.dx = 0;
line.dy = thing->radius * -2;
break;
@ -1363,19 +1363,19 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it
// check a corner to corner crossection for hit
if (tracepositive)
{
x1 = thing->X() - thing->radius;
y1 = thing->Y() + thing->radius;
x1 = thing->_f_X() - thing->radius;
y1 = thing->_f_Y() + thing->radius;
x2 = thing->X() + thing->radius;
y2 = thing->Y() - thing->radius;
x2 = thing->_f_X() + thing->radius;
y2 = thing->_f_Y() - thing->radius;
}
else
{
x1 = thing->X() - thing->radius;
y1 = thing->Y() - thing->radius;
x1 = thing->_f_X() - thing->radius;
y1 = thing->_f_Y() - thing->radius;
x2 = thing->X() + thing->radius;
y2 = thing->Y() + thing->radius;
x2 = thing->_f_X() + thing->radius;
y2 = thing->_f_Y() + thing->radius;
}
s1 = P_PointOnDivlineSide (x1, y1, &trace);
@ -1725,8 +1725,8 @@ AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, in
int count;
AActor *target;
startX = GetSafeBlockX(mo->X()-bmaporgx);
startY = GetSafeBlockY(mo->Y()-bmaporgy);
startX = GetSafeBlockX(mo->_f_X()-bmaporgx);
startY = GetSafeBlockY(mo->_f_Y()-bmaporgy);
validcount++;
if (startX >= 0 && startX < bmapwidth && startY >= 0 && startY < bmapheight)