diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 9974ddbbb..5428bb7e1 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -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)); diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 2af02b96b..d3e908150 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -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)) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index ba0063acb..80f2aa30c 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -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; } } } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 10c073a6b..946cab7d2 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -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; } } } diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 9eee52579..647652630 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -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; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 07b52765b..3e0051613 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -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; diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index fdfcd136a..09cd26e47 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -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; diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index e546a6c79..52c84d5fd 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -1007,7 +1007,7 @@ void spawneffector(DDukeActor* actor, TArray* 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; } diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 162794c7c..975f6577f 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -657,7 +657,7 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* { 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; } diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 9d53200d5..5947953af 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -663,7 +663,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* { 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; } diff --git a/source/games/exhumed/src/fish.cpp b/source/games/exhumed/src/fish.cpp index c0656c0e3..9b3edfcbc 100644 --- a/source/games/exhumed/src/fish.cpp +++ b/source/games/exhumed/src/fish.cpp @@ -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 diff --git a/source/games/exhumed/src/lion.cpp b/source/games/exhumed/src/lion.cpp index a5f7947a1..861a84747 100644 --- a/source/games/exhumed/src/lion.cpp +++ b/source/games/exhumed/src/lion.cpp @@ -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; diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 2f232bdf3..b0b4242ce 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -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; } diff --git a/source/games/exhumed/src/mummy.cpp b/source/games/exhumed/src/mummy.cpp index 61ac066de..fbaca8b01 100644 --- a/source/games/exhumed/src/mummy.cpp +++ b/source/games/exhumed/src/mummy.cpp @@ -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) diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 02c6310fb..a92dbc0fe 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -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) { diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index ff7cfe95b..48c358bba 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -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); diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index e12c3bb77..e8ec900e3 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -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) { diff --git a/source/games/exhumed/src/wasp.cpp b/source/games/exhumed/src/wasp.cpp index c48554325..ee79023d4 100644 --- a/source/games/exhumed/src/wasp.cpp +++ b/source/games/exhumed/src/wasp.cpp @@ -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; } diff --git a/source/games/sw/src/actor.cpp b/source/games/sw/src/actor.cpp index 148e317bc..bd7b202d2 100644 --- a/source/games/sw/src/actor.cpp +++ b/source/games/sw/src/actor.cpp @@ -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); } diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index d68a331c1..d11c49d38 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -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); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 3849a7916..5e6aae978 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -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);