mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- wrapped all velocity access in Blood, except the places where an address of vel is taken
This commit is contained in:
parent
7a7a2cdb39
commit
c45ecdae73
5 changed files with 19 additions and 17 deletions
|
@ -261,6 +261,13 @@ public:
|
|||
__int_vel .X = __int_vel .Y = 0;
|
||||
}
|
||||
|
||||
void ZeroVelocity()
|
||||
{
|
||||
__int_vel = { 0,0,0 };
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Same as above but with inverted y and z axes to match the renderer's coordinate system.
|
||||
|
||||
double interpolatedx(double const smoothratio, int const scale = 16)
|
||||
|
|
|
@ -4661,7 +4661,7 @@ static Collision MoveThing(DBloodActor* actor)
|
|||
{
|
||||
actor->hit.ceilhit = ceilColl;
|
||||
actor->add_int_z(ClipLow(ceilZ - top, 0));
|
||||
if (actor->__int_vel.Z < 0)
|
||||
if (actor->int_vel().Z < 0)
|
||||
{
|
||||
actor->set_int_bvel_x(MulScale(actor->int_vel().X, 0xc000, 16));
|
||||
actor->set_int_bvel_y(MulScale(actor->int_vel().Y, 0xc000, 16));
|
||||
|
@ -4908,7 +4908,7 @@ void MoveDude(DBloodActor* actor)
|
|||
actor->add_int_bvel_z(vc);
|
||||
}
|
||||
}
|
||||
if (pPlayer && actor->__int_vel.Z > 0x155555 && !pPlayer->fallScream && actor->xspr.height > 0)
|
||||
if (pPlayer && actor->int_vel().Z > 0x155555 && !pPlayer->fallScream && actor->xspr.height > 0)
|
||||
{
|
||||
const bool playerAlive = (actor->xspr.health > 0) || VanillaMode(); // only trigger falling scream if player is alive or vanilla mode
|
||||
if (playerAlive)
|
||||
|
@ -5164,7 +5164,7 @@ void MoveDude(DBloodActor* actor)
|
|||
actor->hit.ceilhit = ceilColl;
|
||||
actor->add_int_z(ClipLow(ceilZ - top, 0));
|
||||
|
||||
if (actor->__int_vel.Z <= 0 && (actor->spr.flags & 4))
|
||||
if (actor->int_vel().Z <= 0 && (actor->spr.flags & 4))
|
||||
actor->set_int_bvel_z(MulScale(-actor->int_vel().Z, 0x2000, 16));
|
||||
}
|
||||
else
|
||||
|
@ -6140,7 +6140,7 @@ void actCheckFlares()
|
|||
pos.Y += mulscale30r(Sin(actor->xspr.goalAng + target->int_ang()), target->spr.clipdist * 2) * inttoworld;
|
||||
pos.Z += actor->xspr.TargetPos.Z;
|
||||
SetActor(actor, pos);
|
||||
actor->__int_vel = target->__int_vel;
|
||||
actor->set_int_bvel(target->int_vel());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6206,7 +6206,7 @@ DBloodActor* actSpawnSprite(DBloodActor* source, int nStat)
|
|||
DBloodActor* actor = InsertSprite(source->sector(), nStat);
|
||||
|
||||
actor->spr.pos = source->spr.pos;
|
||||
actor->__int_vel = source->__int_vel;
|
||||
actor->set_int_bvel(source->int_vel());
|
||||
actor->spr.flags = 0;
|
||||
actor->addX();
|
||||
actor->hit.florhit.setNone();
|
||||
|
|
|
@ -118,11 +118,6 @@ public:
|
|||
return spr.type >= kItemAmmoBase && spr.type < kItemAmmoMax;
|
||||
}
|
||||
|
||||
void ZeroVelocity()
|
||||
{
|
||||
__int_vel = { 0,0,0 };
|
||||
}
|
||||
|
||||
bool isActive()
|
||||
{
|
||||
if (!hasX())
|
||||
|
|
|
@ -216,7 +216,7 @@ void CFX::fxProcess(void)
|
|||
actAirDrag(actor, pFXData->drag);
|
||||
actor->add_int_pos({ actor->int_vel().X >> 12, actor->int_vel().Y >> 12, actor->int_vel().Z >> 8 });
|
||||
// Weird...
|
||||
if (actor->int_vel().X != 0 || (actor->__int_vel.Y && actor->spr.pos.Z >= actor->sector()->floorz))
|
||||
if (actor->int_vel().X != 0 || (actor->int_vel().Y != 0 && actor->spr.pos.Z >= actor->sector()->floorz))
|
||||
{
|
||||
updatesector(actor->spr.pos, &pSector);
|
||||
if (pSector == nullptr)
|
||||
|
|
|
@ -1054,13 +1054,13 @@ static void windGenDoVerticalWind(int factor, sectortype* pSector)
|
|||
if (maxZfound && actor->int_pos().Z <= maxZ)
|
||||
{
|
||||
zdiff = actor->int_pos().Z - maxZ;
|
||||
if (actor->__int_vel.Z < 0) actor->add_int_bvel_z(MulScale(actor->int_vel().Z >> 4, zdiff, 16));
|
||||
if (actor->int_vel().Z < 0) actor->add_int_bvel_z(MulScale(actor->int_vel().Z >> 4, zdiff, 16));
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
val = -MulScale(factor * 64, 0x10000, 16);
|
||||
if (actor->__int_vel.Z >= 0) actor->add_int_bvel_z(val);
|
||||
if (actor->int_vel().Z >= 0) actor->add_int_bvel_z(val);
|
||||
else actor->set_int_bvel_z(val);
|
||||
|
||||
actor->add_int_z(actor->int_vel().Z >> 12);
|
||||
|
@ -1353,7 +1353,7 @@ void nnExtProcessSuperSprites()
|
|||
if ((uwater = spriteIsUnderwater(debrisactor)) == false) evKillActor(debrisactor, kCallbackEnemeyBubble);
|
||||
else if (Chance(0x1000 - mass))
|
||||
{
|
||||
if (debrisactor->__int_vel.Z > 0x100) debrisBubble(debrisactor);
|
||||
if (debrisactor->int_vel().Z > 0x100) debrisBubble(debrisactor);
|
||||
if (ang == debrisactor->xspr.goalAng)
|
||||
{
|
||||
debrisactor->xspr.goalAng = (debrisactor->int_ang() + Random3(kAng60)) & 2047;
|
||||
|
@ -1831,7 +1831,7 @@ void debrisMove(int listIndex)
|
|||
{
|
||||
actor->hit.ceilhit = moveHit = ceilColl;
|
||||
actor->add_int_z(ClipLow(ceilZ - top, 0));
|
||||
if (actor->__int_vel.Z <= 0 && (actor->xspr.physAttr & kPhysFalling))
|
||||
if (actor->int_vel().Z <= 0 && (actor->xspr.physAttr & kPhysFalling))
|
||||
actor->set_int_bvel_z(MulScale(-actor->int_vel().Z, 0x2000, 16));
|
||||
|
||||
}
|
||||
|
@ -1848,7 +1848,7 @@ void debrisMove(int listIndex)
|
|||
trTriggerSprite(actor, kCmdToggle, actor);
|
||||
}
|
||||
|
||||
if (!actor->__int_vel.X && !actor->int_vel().Y) return;
|
||||
if (actor->int_vel().X == 0 && actor->int_vel().Y == 0) return;
|
||||
else if (floorColl.type == kHitSprite)
|
||||
{
|
||||
|
||||
|
@ -2782,7 +2782,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
|
|||
if (targetactor->spr.statnum == kStatThing) ChangeActorStat(targetactor, 0);
|
||||
|
||||
// set random goal ang for swimming so they start turning
|
||||
if ((flags & kPhysDebrisSwim) && !targetactor->__int_vel.X && !targetactor->__int_vel.Y && !targetactor->int_vel().Z)
|
||||
if ((flags & kPhysDebrisSwim) && targetactor->int_vel().X ==0 && targetactor->int_vel().Y == 0 && targetactor->int_vel().Z == 0)
|
||||
targetactor->xspr.goalAng = (targetactor->int_ang() + Random3(kAng45)) & 2047;
|
||||
|
||||
if (targetactor->xspr.physAttr & kPhysDebrisVector)
|
||||
|
|
Loading…
Reference in a new issue