- floatified a bit more of nnExtProcessSuperSprites

This commit is contained in:
Christoph Oelckers 2022-09-25 15:56:21 +02:00
parent fd5bbbedaf
commit 044b9e555b
3 changed files with 13 additions and 16 deletions

View file

@ -426,6 +426,7 @@ struct walltype
walltype* point2Wall() const;
DVector2 delta() const { return point2Wall()->pos - pos; }
DVector2 center() const { return(point2Wall()->pos + pos) / 2; }
DAngle normalAngle() const { return delta().Angle() + DAngle90; }
bool twoSided() const { return nextsector >= 0; }
double Length();
void calcLength(); // this is deliberately not inlined and stored in a file where it can't be found at compile time.

View file

@ -34,7 +34,7 @@ enum {
bool CheckProximity(DBloodActor* pSprite, const DVector3& pos, sectortype* pSector, int nDist);
bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
int GetWallAngle(walltype* pWall);
[[deprecated]] int GetWallAngle(walltype* pWall);
bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int x2, int y2, int z2, int* ix, int* iy, int* iz);
int HitScan(DBloodActor* pSprite, int z, int dx, int dy, int dz, unsigned int nMask, int a8);
inline int HitScan(DBloodActor* pSprite, double z, int dx, int dy, int dz, unsigned int nMask, int a8)

View file

@ -1301,19 +1301,17 @@ void nnExtProcessSuperSprites()
if ((uwater = pXSector->Underwater) != 0) airVel <<= 6;
if (pXSector->panVel != 0 && getflorzofslopeptr(debrisactor->sector(), debrisactor->spr.pos) <= bottom)
{
int angle = pXSector->panAngle.Buildang(); int speed = 0;
DAngle angle = pXSector->panAngle;
double speed = 0;
if (pXSector->panAlways || pXSector->state || pXSector->busy)
{
speed = pXSector->panVel << 9;
speed = pXSector->panVel / 128.;
if (!pXSector->panAlways && pXSector->busy)
speed = MulScale(speed, pXSector->busy, 16);
speed = MulScaleF(speed, pXSector->busy, 16);
}
if (debrisactor->sector()->floorstat & CSTAT_SECTOR_ALIGN)
angle = (angle + GetWallAngle(debrisactor->sector()->firstWall()) + 512) & 2047;
int dx = MulScale(speed, Cos(angle), 30);
int dy = MulScale(speed, Sin(angle), 30);
debrisactor->add_int_bvel_x(dx);
debrisactor->add_int_bvel_y(dy);
angle += debrisactor->sector()->firstWall()->normalAngle();
debrisactor->vel += angle.ToVector() * speed;
}
}
@ -1329,22 +1327,20 @@ void nnExtProcessSuperSprites()
if (pact && pact->hit.hit.type == kHitSprite && pact->hit.hit.actor() == debrisactor)
{
int nSpeed = approxDist(pact->int_vel().X, pact->int_vel().Y);
nSpeed = ClipLow(nSpeed - MulScale(nSpeed, mass, 6), 0x9000 - (mass << 3));
debrisactor->add_int_bvel_x(MulScale(nSpeed, Cos(pPlayer->actor->int_ang()), 30));
debrisactor->add_int_bvel_y(MulScale(nSpeed, Sin(pPlayer->actor->int_ang()), 30));
double nSpeed = pact->vel.XY().Length();
nSpeed = max<double>(nSpeed - MulScaleF(nSpeed, mass, 6), FixedToFloat(0x9000 - (mass << 3))); // very messy math (TM)...
debrisactor->vel += pPlayer->actor->spr.angle.ToVector() * nSpeed;
debrisactor->hit.hit.setSprite(pPlayer->actor);
}
}
}
if (debrisactor->xspr.physAttr & kPhysGravity) debrisactor->xspr.physAttr |= kPhysFalling;
if ((debrisactor->xspr.physAttr & kPhysFalling) || debrisactor->vel.X != 0 || debrisactor->vel.Y != 0 || debrisactor->vel.Z != 0 || debrisactor->sector()->velFloor || debrisactor->sector()->velCeil)
if ((debrisactor->xspr.physAttr & kPhysFalling) || !debrisactor->vel.isZero() || debrisactor->sector()->velFloor || debrisactor->sector()->velCeil)
debrisMove(i);
if (debrisactor->vel.X != 0 || debrisactor->int_vel().Y)
if (!debrisactor->vel.XY().isZero())
debrisactor->xspr.goalAng = VecToAngle(debrisactor->vel);
debrisactor->norm_ang();