From e6cfb165f84c03488e8c00b6175e2fc6937d1fce Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 25 Sep 2022 20:57:28 +0200 Subject: [PATCH] - converted all remaining add_int_bvel* calls. --- source/core/coreactor.h | 15 --------------- source/games/blood/src/actor.cpp | 28 ++++++++++++---------------- 2 files changed, 12 insertions(+), 31 deletions(-) diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 758bfcd80..ea1c9690f 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -118,21 +118,6 @@ public: vel .Z = FixedToFloat(x); } - void add_int_bvel_x(int x) - { - vel .X += FixedToFloat(x); - } - - void add_int_bvel_y(int x) - { - vel .Y += FixedToFloat(x); - } - - void add_int_bvel_z(int x) - { - vel .Z += FixedToFloat(x); - } - void ZeroVelocityXY() { vel .X = vel .Y = 0; diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index af7090425..b76d9cc65 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -5631,17 +5631,16 @@ static void actCheckThings() GetActorExtents(actor, &top, &bottom); if (getflorzofslopeptr(pSector, actor->spr.pos) <= bottom) { - int angle = pXSector->panAngle.Buildang(); - int speed = 0; + DAngle angle = pXSector->panAngle; + double speed = 0; if (pXSector->panAlways || pXSector->state || pXSector->busy) { - speed = pXSector->panVel << 9; - if (!pXSector->panAlways && pXSector->busy) speed = MulScale(speed, pXSector->busy, 16); + speed = pXSector->panVel / 128.; + if (!pXSector->panAlways && pXSector->busy) speed = MulScaleF(speed, pXSector->busy, 16); } - if (pSector->floorstat & CSTAT_SECTOR_ALIGN) angle = (angle + GetWallAngle(pSector->firstWall()) + 512) & 2047; + if (pSector->floorstat & CSTAT_SECTOR_ALIGN) angle += pSector->firstWall()->normalAngle(); - actor->add_int_bvel_x(MulScale(speed, Cos(angle), 30)); - actor->add_int_bvel_y(MulScale(speed, Sin(angle), 30)); + actor->vel += angle.ToVector() * speed; } } actAirDrag(actor, 128); @@ -6056,20 +6055,17 @@ static void actCheckDudes() GetActorExtents(actor, &top, &bottom); if (getflorzofslopeptr(pSector, actor->spr.pos) <= bottom) { - int angle = pXSector->panAngle.Buildang(); - int speed = 0; + DAngle angle = pXSector->panAngle; + double speed = 0; if (pXSector->panAlways || pXSector->state || pXSector->busy) { - speed = pXSector->panVel << 9; + speed = pXSector->panVel / 128.; if (!pXSector->panAlways && pXSector->busy) - speed = MulScale(speed, pXSector->busy, 16); + speed = MulScaleF(speed, pXSector->busy, 16); } if (pSector->floorstat & CSTAT_SECTOR_ALIGN) - angle = (angle + GetWallAngle(pSector->firstWall()) + 512) & 2047; - int dx = MulScale(speed, Cos(angle), 30); - int dy = MulScale(speed, Sin(angle), 30); - actor->add_int_bvel_x(dx); - actor->add_int_bvel_y(dy); + angle += pSector->firstWall()->normalAngle(); + actor->vel += angle.ToVector() * speed; } } if (pXSector && pXSector->Underwater) actAirDrag(actor, 5376);