- handle zvel multiplications with a wrapper.

This completes wrapping of zvel.
This commit is contained in:
Christoph Oelckers 2022-09-01 00:42:06 +02:00
parent 231107921e
commit 8946a66350
10 changed files with 16 additions and 11 deletions

View file

@ -125,6 +125,11 @@ public:
{
spr.zvel += v;
}
void mul_int_zvel(double v)
{
spr.zvel = int(spr.zvel * v);
}
// 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)

View file

@ -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->spr.zvel >>= 1;
actor->mul_int_zvel(0.5);
actor->spr.xrepeat >>= 1;
actor->spr.yrepeat >>= 1;
if (rnd(96))

View file

@ -2586,7 +2586,7 @@ static void heavyhbomb(DDukeActor *actor)
S_PlayActorSound(PIPEBOMB_BOUNCE, actor);
actor->set_int_zvel(-((4 - actor->spr.yvel) << 8));
if (actor->sector()->lotag == 2)
actor->spr.zvel >>= 2;
actor->mul_int_zvel(0.25);
actor->spr.yvel++;
}
if (actor->spr.pos.Z < actor->ceilingz) // && sectp->lotag != 2 )
@ -3620,7 +3620,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (actor->spr.pos.Z < c + 66)
{
actor->spr.pos.Z = c + 66;
actor->spr.zvel >>= 1;
actor->mul_int_zvel(0.5);
}
}
}

View file

@ -2364,7 +2364,7 @@ static void heavyhbomb(DDukeActor *actor)
}
actor->set_int_zvel(-((4 - actor->spr.yvel) << 8));
if (actor->sector()->lotag == 2)
actor->spr.zvel >>= 2;
actor->mul_int_zvel(0.25);
actor->spr.yvel++;
}
if (actor->spr.picnum != CHEERBOMB && actor->spr.pos.Z < actor->ceilingz + 16 && sectp->lotag != 2)
@ -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->spr.zvel >>= 1;
actor->mul_int_zvel(0.5);
}
}
}

View file

@ -2226,7 +2226,7 @@ static void operateweapon(int snum, ESyncBits actions)
if (k < 512)
{
spawned->add_int_ang(1024);
spawned->spr.zvel /= 3;
spawned->mul_int_zvel(1./3.);
spawned->spr.xvel /= 3;
}

View file

@ -2763,7 +2763,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (k < 512)
{
spawned->add_int_ang(1024);
spawned->spr.zvel /= 3;
spawned->mul_int_zvel(1./3.);
spawned->spr.xvel /= 3;
}

View file

@ -367,7 +367,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
if (k < 512)
{
j->add_int_ang(1024);
j->spr.zvel /= 3;
j->mul_int_zvel(1./3.);
j->spr.xvel /= 3;
}

View file

@ -1322,7 +1322,7 @@ DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial)
{
pActor->spr.xvel *= 4;
pActor->spr.yvel *= 4;
pActor->spr.zvel *= 2;
pActor->mul_int_zvel(2);
}
pActor->spr.xrepeat = 64;

View file

@ -2039,7 +2039,7 @@ void AIObject::RadialDamage(RunListEvent* ev)
{
pActor->spr.xvel >>= 1;
pActor->spr.yvel >>= 1;
pActor->spr.zvel >>= 1;
pActor->mul_int_zvel(0.5);
}
if (pActor->nHealth > 0) {

View file

@ -619,7 +619,7 @@ void AIQueenEgg::Tick(RunListEvent* ev)
if (nMov.exbits & kHitAux2)
{
pActor->set_int_zvel(-(pActor->int_vel() - 256));
pActor->set_int_zvel(-(pActor->int_zvel() - 256));
if (pActor->int_zvel() < -512)
{
pActor->set_int_zvel(0);