- removed the mul vel wrappers

This commit is contained in:
Christoph Oelckers 2022-09-03 10:04:16 +02:00
parent 6fd8dae380
commit 3e76d49b6e
21 changed files with 42 additions and 65 deletions

View file

@ -128,11 +128,6 @@ public:
vel.Z += v * zinttoworld;
}
void mul_int_zvel(double v)
{
vel.Z *= v;
}
// Note: Both Duke and SW use Q12.4 for this, Exhumed doesn't seem to treat horizontal velocity with a fixed factor.
int int_xvel() const
{
@ -149,11 +144,6 @@ public:
vel.X += v * inttoworld;
}
void mul_int_xvel(double v)
{
vel.X *= v;
}
// Only used this way by Exhumed.
int int_yvel() const
{
@ -170,11 +160,6 @@ public:
vel.Y += v * inttoworld;
}
void mul_int_yvel(double v)
{
vel.Y *= v;
}
vec3_t int_vel() const
{
return vec3_t(FloatToFixed(vel.X), FloatToFixed(vel.Y), FloatToFixed(vel.Z));

View file

@ -1718,7 +1718,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
if (l <= 1524)
{
a = actor->int_ang();
actor->mul_int_xvel(0.5);
actor->vel.X *= 0.5;
}
else a = getangle(Owner->spr.pos.XY() - actor->spr.pos.XY());
@ -2214,7 +2214,7 @@ bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool f
{
if (actor->vel.Z < 4)
actor->add_int_zvel( 48);
else actor->set_int_zvel(1024);
else actor->vel.Z = 4;
}
else actor->add_int_zvel( gs.gravity - 50);
}
@ -2429,7 +2429,7 @@ void glasspieces(DDukeActor* actor)
{
actor->set_int_zvel(-((3 - actor->temp_data[0]) << 8) - (krand() & 511));
if (sectp->lotag == 2)
actor->mul_int_zvel(0.5);
actor->vel.Z *= 0.5;
actor->spr.xrepeat >>= 1;
actor->spr.yrepeat >>= 1;
if (rnd(96))

View file

@ -2584,7 +2584,7 @@ static void heavyhbomb(DDukeActor *actor)
S_PlayActorSound(PIPEBOMB_BOUNCE, actor);
actor->set_int_zvel(-((4 - actor->spr.yint) << 8));
if (actor->sector()->lotag == 2)
actor->mul_int_zvel(0.25);
actor->vel.Z *= 0.25;
actor->spr.yint++;
}
if (actor->spr.pos.Z < actor->ceilingz) // && sectp->lotag != 2 )
@ -2643,7 +2643,7 @@ static void heavyhbomb(DDukeActor *actor)
int k = getangle(wal->delta());
actor->set_int_ang(((k << 1) - actor->int_ang()) & 2047);
actor->mul_int_xvel(0.5);
actor->vel.X *= 0.5;
}
DETONATEB:
@ -3618,7 +3618,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (actor->spr.pos.Z < c + 66)
{
actor->spr.pos.Z = c + 66;
actor->mul_int_zvel(0.5);
actor->vel.Z *= 0.5;
}
}
}

View file

@ -2364,7 +2364,7 @@ static void heavyhbomb(DDukeActor *actor)
}
actor->set_int_zvel(-((4 - actor->spr.yint) << 8));
if (actor->sector()->lotag == 2)
actor->mul_int_zvel(0.25);
actor->vel.Z *= 0.25;
actor->spr.yint++;
}
if (actor->spr.picnum != CHEERBOMB && actor->spr.pos.Z < actor->ceilingz + 16 && sectp->lotag != 2)
@ -2441,7 +2441,7 @@ static void heavyhbomb(DDukeActor *actor)
goto DETONATEB;
}
actor->set_int_ang(((k << 1) - actor->int_ang()) & 2047);
actor->mul_int_xvel(0.5);
actor->vel.X *= 0.5;
}
DETONATEB:
@ -3666,7 +3666,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (actor->spr.pos.Z < c + 66)
{
actor->spr.pos.Z = c + 66;
actor->mul_int_zvel(0.5);
actor->vel.Z *= 0.5;
}
}
}

View file

@ -2231,9 +2231,8 @@ static void operateweapon(int snum, ESyncBits actions)
k = hits(pact);
if (k < 512)
{
spawned->add_int_ang(1024);
spawned->mul_int_zvel(1./3.);
spawned->mul_int_xvel(1./3.);
spawned->spr.angle += DAngle180;
spawned->vel *= 1./3.;
}
p->hbomb_on = 1;

View file

@ -2762,9 +2762,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
k = hits(p->GetActor());
if (k < 512)
{
spawned->add_int_ang(1024);
spawned->mul_int_zvel(1./3.);
spawned->mul_int_xvel(1./3.);
spawned->spr.angle += DAngle180;
spawned->vel *= 1./3.;
}
p->hbomb_on = 1;

View file

@ -366,9 +366,8 @@ void operateweapon_ww(int snum, ESyncBits actions)
k = hits(p->GetActor());
if (k < 512)
{
j->add_int_ang(1024);
j->mul_int_zvel(1./3.);
j->mul_int_xvel(1./3.);
j->spr.angle += DAngle180;
j->vel *= 1./3.;
}
p->hbomb_on = 1;

View file

@ -1007,7 +1007,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
if (actor->spr.shade == sectp->floorshade) //UP
actor->set_int_zvel(-256);
else
actor->set_int_zvel(256);
actor->vel.Z = 1;
actor->spr.shade = 0;
}

View file

@ -657,7 +657,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
{
act->spr.xrepeat = actj->spr.xrepeat;
act->spr.yrepeat = actj->spr.yrepeat;
act->set_int_zvel(128);
act->vel.Z = 0.5;
if (act->sector()->lotag != 2)
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
}

View file

@ -663,7 +663,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
{
act->spr.xrepeat = actj->spr.xrepeat;
act->spr.yrepeat = actj->spr.yrepeat;
act->set_int_zvel(128);
act->vel.Z = 0.5;
if (act->sector()->lotag != 2)
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
}

View file

@ -114,7 +114,7 @@ void AIFishLimb::Tick(RunListEvent* ev)
}
else if ((pActor->spr.pos.Z - FloorZ) > 0)
{
pActor->set_int_zvel(1024);
pActor->vel.Z = 4;
}
}
else

View file

@ -364,8 +364,8 @@ void AILion::Tick(RunListEvent* ev)
if (nMov.exbits & kHitAux2)
{
pActor->mul_int_xvel(0.5);
pActor->mul_int_yvel(0.5);
pActor->vel.X *= 0.5;
pActor->vel.Y *= 0.5;
}
return;

View file

@ -1320,9 +1320,9 @@ DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial)
if (bSpecial)
{
pActor->mul_int_xvel(4);
pActor->mul_int_yvel(4);
pActor->mul_int_zvel(2);
pActor->vel.X *= 4;
pActor->vel.Y *= 4;
pActor->vel.Z *= 2;
}
pActor->spr.xrepeat = 64;
@ -1379,8 +1379,8 @@ void AICreatureChunk::Tick(RunListEvent* ev)
{
if (nVal.exbits & kHitAux1)
{
pActor->mul_int_xvel(0.5);
pActor->mul_int_yvel(0.5);
pActor->vel.X *= 0.5;
pActor->vel.Y *= 0.5;
pActor->set_int_zvel(-pActor->int_zvel());
return;
}

View file

@ -373,8 +373,8 @@ void AIMummy::Tick(RunListEvent* ev)
{
if (nMov.exbits)
{
pActor->mul_int_xvel(0.5);
pActor->mul_int_yvel(0.5);
pActor->vel.X *= 0.5;
pActor->vel.Y *= 0.5;
}
if (bVal)

View file

@ -2031,15 +2031,11 @@ void AIObject::RadialDamage(RunListEvent* ev)
if (pActor->spr.statnum == kStatExplodeTarget)
{
pActor->vel.X = 0;
pActor->vel.Y = 0;
pActor->vel.Z = 0;
pActor->ZeroVelocity();
}
else if (pActor->spr.statnum != kStatAnubisDrum)
{
pActor->mul_int_xvel(0.5);
pActor->mul_int_yvel(0.5);
pActor->mul_int_zvel(0.5);
pActor->vel *= 0.5;
}
if (pActor->nHealth > 0) {

View file

@ -969,8 +969,7 @@ void AIPlayer::Tick(RunListEvent* ev)
if (zVel >= 6500)
{
pPlayerActor->mul_int_xvel(0.25);
pPlayerActor->mul_int_yvel(0.25);
pPlayerActor->vel.XY() *= 0.25;
runlist_DamageEnemy(pPlayerActor, nullptr, ((zVel - 6500) >> 7) + 10);

View file

@ -394,8 +394,8 @@ void AISet::Tick(RunListEvent* ev)
if (pActor->nIndex2)
{
pActor->mul_int_xvel(2);
pActor->mul_int_yvel(2);
pActor->vel.X *= 2;
pActor->vel.Y *= 2;
}
if (nMov.type == kHitWall)
@ -546,8 +546,8 @@ void AISet::Tick(RunListEvent* ev)
case 9:
{
pActor->mul_int_xvel(0.5);
pActor->mul_int_yvel(0.5);
pActor->vel.X *= 0.5;
pActor->vel.Y *= 0.5;
if (bVal)
{

View file

@ -174,7 +174,7 @@ void AIWasp::Damage(RunListEvent* ev)
SetWaspVel(pActor);
pActor->set_int_zvel(512);
pActor->vel.Z = 2;
nCreaturesKilled++;
}
@ -322,7 +322,7 @@ void AIWasp::Tick(RunListEvent* ev)
{
pActor->vel.X = 0;
pActor->vel.Y = 0;
pActor->set_int_zvel(1024);
pActor->vel.Z = 4;
pActor->nAction = 5;
pActor->nFrame = 0;
}

View file

@ -125,7 +125,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
case COOLIE_RUN_R0:
ChangeState(actor, actor->user.StateEnd);
actor->user.RotNum = 0;
actor->mul_int_xvel(2);
actor->vel.X *= 2;
actor->user.ActorActionFunc = nullptr;
actor->spr.angle += DAngle180;
break;
@ -199,7 +199,7 @@ int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath)
// Rippers still gotta jump or they fall off walls weird
if (actor->user.ID == RIPPER_RUN_R0 || actor->user.ID == RIPPER2_RUN_R0)
{
actor->mul_int_xvel(2);
actor->vel.X *= 2;
actor->user.jump_speed = -100 - RandomRange(250);
DoActorBeginJump(actor);
}

View file

@ -3160,7 +3160,7 @@ bool ActorTrackDecide(TRACK_POINT* tpoint, DSWActor* actor)
if (actor->user.ActorActionSet->DeathJump)
{
actor->user.Flags |= (SPR_DEAD);
actor->mul_int_xvel(2);
actor->vel.X *= 2;
actor->user.jump_speed = -495;
DoActorBeginJump(actor);
NewStateGroup(actor, actor->user.ActorActionSet->DeathJump);

View file

@ -3910,7 +3910,7 @@ int DoShrapDamage(DSWActor* actor)
{
actor->user.Flags |= (SPR_BOUNCE);
actor->user.jump_speed = -300;
actor->mul_int_xvel(0.25);
actor->vel.X *= 0.25;
DoBeginJump(actor);
return 0;
}
@ -16602,7 +16602,7 @@ DSWActor* SpawnBubble(DSWActor* actor)
actorNew->user.floor_dist = 1;
actorNew->spr.shade = actor->sector()->floorshade - 10;
actorNew->user.WaitTics = 120 * 120;
actorNew->set_int_zvel(512);
actorNew->vel.Z = 2;
actorNew->spr.clipdist = 12 >> 2;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
actorNew->user.Flags |= (SPR_UNDERWATER);