- Blood: Floatified ActionScan().

This commit is contained in:
Mitchell Richters 2022-09-25 22:02:47 +10:00 committed by Christoph Oelckers
parent b8b5fe9162
commit ef03e64025
2 changed files with 8 additions and 9 deletions

View file

@ -41,6 +41,10 @@ inline int HitScan(DBloodActor* pSprite, double z, int dx, int dy, int dz, unsig
{
return HitScan(pSprite, int(z * zworldtoint), dx, dy, dz, nMask, a8);
}
inline int HitScan(DBloodActor* pSprite, double z, const DVector3& pos, unsigned int nMask, int a8)
{
return HitScan(pSprite, int(z * zworldtoint), int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * worldtoint), nMask, a8);
}
int VectorScan(DBloodActor* pSprite, int nOffset, int nZOffset, int dx, int dy, int dz, int nRange, int ac);
void GetZRange(DBloodActor* pSprite, int* ceilZ, Collision* ceilHit, int* floorZ, Collision* floorHit, int nDist, unsigned int nMask, unsigned int nClipParallax = 0);
void GetZRange(DBloodActor* pSprite, double* ceilZ, Collision* ceilHit, double* floorZ, Collision* floorHit, int nDist, unsigned int nMask, unsigned int nClipParallax = 0)

View file

@ -1419,11 +1419,9 @@ int ActionScan(PLAYER* pPlayer, HitInfo* out)
{
auto plActor = pPlayer->actor;
*out = {};
int x = bcos(plActor->int_ang());
int y = bsin(plActor->int_ang());
int z = pPlayer->slope;
int hit = HitScan(pPlayer->actor, pPlayer->zView, x, y, z, 0x10000040, 128);
int hitDist = (int)(plActor->spr.pos.XY() - gHitInfo.hitpos.XY()).Length();
auto pos = DVector3(plActor->spr.angle.ToVector() * 1024., pPlayer->slope * inttoworld);
int hit = HitScan(pPlayer->actor, pPlayer->zView, pos, 0x10000040, 128);
double hitDist = (plActor->spr.pos.XY() - gHitInfo.hitpos.XY()).Length();
if (hitDist < 64)
{
switch (hit)
@ -1450,10 +1448,7 @@ int ActionScan(PLAYER* pPlayer, HitInfo* out)
int nMass = getDudeInfo(hitactor->spr.type)->mass;
if (nMass)
{
int t2 = DivScale(0xccccc, nMass, 8);
hitactor->add_int_bvel_x(MulScale(x, t2, 16));
hitactor->add_int_bvel_y(MulScale(y, t2, 16));
hitactor->add_int_bvel_z(MulScale(z, t2, 16));
hitactor->spr.pos += pos * (FixedToFloat<8>(0xccccc) / nMass);
}
if (hitactor->xspr.Push && !hitactor->xspr.state && !hitactor->xspr.isTriggered)
trTriggerSprite(hitactor, kCmdSpritePush);