- added ZeroVelocity function to DBloodActor.

This commit is contained in:
Christoph Oelckers 2022-08-23 21:25:05 +02:00
parent a5a3669238
commit 18a445aee5
8 changed files with 23 additions and 24 deletions

View file

@ -2387,7 +2387,7 @@ static void actInitThings()
act->spr.flags = thingInfo[nType].flags;
if (act->spr.flags & kPhysGravity) act->spr.flags |= kPhysFalling;
act->vel.X = act->vel.Y = act->vel.Z = 0;
act->ZeroVelocity();
switch (act->spr.type)
{
@ -2489,7 +2489,7 @@ static void actInitDudes()
act->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL;
#endif
act->vel.X = act->vel.Y = act->vel.Z = 0;
act->ZeroVelocity();
#ifdef NOONE_EXTENSIONS
// add a way to set custom hp for every enemy - should work only if map just started and not loaded.
@ -2718,9 +2718,7 @@ static void actNapalmMove(DBloodActor* actor)
spawnparam[0] = actor->xspr.data4 >> 1;
spawnparam[1] = actor->xspr.data4 - spawnparam[0];
int ang = actor->int_ang();
actor->vel.X = 0;
actor->vel.Y = 0;
actor->vel.Z = 0;
actor->ZeroVelocity();
for (int i = 0; i < 2; i++)
{
int t1 = Random(0x33333) + 0x33333;
@ -5493,7 +5491,7 @@ void actExplodeSprite(DBloodActor* actor)
GibSprite(actor, GIBTYPE_5, nullptr, nullptr);
break;
}
actor->vel.X = actor->vel.Y = actor->vel.Z = 0;
actor->ZeroVelocity();
actPostSprite(actor, kStatExplosion);
actor->spr.xrepeat = actor->spr.yrepeat = explodeInfo[nType].repeat;

View file

@ -728,7 +728,7 @@ static void unicultThinkChase(DBloodActor* actor)
const EXPLOSION* pExpl = &explodeInfo[nType];
if (CheckProximity(actor, target->spr.pos, target->sector(), pExpl->radius >> 1))
{
actor->vel.X = actor->vel.Y = actor->vel.Z = 0;
actor->ZeroVelocity();
if (doExplosion(actor, nType) && actor->xspr.health > 0)
actDamageSprite(actor, actor, kDamageExplode, 65535);
}

View file

@ -118,6 +118,11 @@ public:
{
return spr.type >= kItemAmmoBase && spr.type < kItemAmmoMax;
}
void ZeroVelocity()
{
vel = { 0,0,0 };
}
bool isActive()
{

View file

@ -291,7 +291,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9
actor->spr.type = actor->spr.inittype;
actor->SetOwner(nullptr);
actor->spr.flags &= ~kHitagRespawn;
actor->vel.X = actor->vel.Y = actor->vel.Z = 0;
actor->ZeroVelocity();
actor->xspr.respawnPending = 0;
actor->xspr.burnTime = 0;
actor->xspr.isTriggered = 0;
@ -556,7 +556,7 @@ void fxBouncingSleeve(DBloodActor* actor, sectortype*) // 16
void sleeveStopBouncing(DBloodActor* actor)
{
actor->vel.X = actor->vel.Y = actor->vel.Z = 0;
actor->ZeroVelocity();
if (actor->hasX()) seqKill(actor);
sfxKill3DSound(actor, -1, -1);
@ -712,7 +712,7 @@ void sub_76A08(DBloodActor* actor, DBloodActor* actor2, PLAYER* pPlayer) // ???
actor->spr.angle = actor2->spr.angle;
ChangeActorSect(actor, actor2->sector());
sfxPlay3DSound(actor2, 201, -1, 0);
actor->vel.X = actor->vel.Y = actor->vel.Z = 0;
actor->ZeroVelocity();
viewBackupSpriteLoc(actor);
if (pPlayer)
{

View file

@ -2651,7 +2651,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
else flags &= ~(kPhysGravity | kPhysFalling);
targetactor->spr.flags &= ~(kPhysMove | kPhysGravity | kPhysFalling);
targetactor->vel.X = targetactor->vel.Y = targetactor->vel.Z = 0;
targetactor->ZeroVelocity();
targetactor->xspr.restState = targetactor->xspr.state;
}
@ -2764,7 +2764,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
{
if (oldFlags == 0)
targetactor->vel.X = targetactor->vel.Y = targetactor->vel.Z = 0;
targetactor->ZeroVelocity();
if (nIndex != -1)
{
@ -2800,7 +2800,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
{
targetactor->xspr.physAttr = flags;
targetactor->vel.X = targetactor->vel.Y = targetactor->vel.Z = 0;
targetactor->ZeroVelocity();
if (targetactor->spr.lotag >= kThingBase && targetactor->spr.lotag < kThingMax)
ChangeActorStat(targetactor, kStatThing); // if it was a thing - restore statnum
}
@ -3279,7 +3279,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
if (sourceactor->xspr.data3 == 1)
{
actor->vel.X = actor->vel.Y = actor->vel.Z = 0;
actor->ZeroVelocity();
}
else if (sourceactor->xspr.data3 > 0)
{

View file

@ -855,7 +855,7 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->throwPower = 0;
pPlayer->deathTime = 0;
pPlayer->nextWeapon = kWeapNone;
actor->vel.X = actor->vel.Y = actor->vel.Z = 0;
actor->ZeroVelocity();
pInput->avel = 0;
pInput->actions = 0;
pInput->fvel = 0;

View file

@ -1639,7 +1639,7 @@ void OperateTeleport(sectortype* pSector)
actor->spr.angle = destactor->spr.angle;
ChangeActorSect(actor, destactor->sector());
sfxPlay3DSound(destactor, 201, -1, 0);
actor->vel.X = actor->vel.Y = actor->vel.Z = 0;
actor->ZeroVelocity();
actor->interpolated = false;
viewBackupSpriteLoc(actor);
if (pPlayer)

View file

@ -4096,10 +4096,8 @@ void OffMotorcycle(player_struct *p)
p->VBumpTarget = 0;
p->VBumpNow = 0;
p->TurbCount = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->vel.X -= p->angle.ang.Cos() * (1 << 7);
p->vel.Y -= p->angle.ang.Sin() * (1 << 7);
p->vel.X = 0 - p->angle.ang.Cos() * (1 << 7);
p->vel.Y = 0 - p->angle.ang.Sin() * (1 << 7);
p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBIKE);
if (spawned)
@ -4163,10 +4161,8 @@ void OffBoat(player_struct *p)
p->VBumpTarget = 0;
p->VBumpNow = 0;
p->TurbCount = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->vel.X -= p->angle.ang.Cos() * (1 << 7);
p->vel.Y -= p->angle.ang.Sin() * (1 << 7);
p->vel.X = 0 - p->angle.ang.Cos() * (1 << 7);
p->vel.Y = 0 - p->angle.ang.Sin() * (1 << 7);
p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBOAT);
if (spawned)