From 193d20bb4d71ef9bd97708e0b273a43810e2e146 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 1 Sep 2022 20:49:35 +0200 Subject: [PATCH] - wrapped more xvels --- source/core/coreactor.h | 2 +- source/games/blood/src/actor.cpp | 42 ++++++++++++------------- source/games/blood/src/callback.cpp | 2 +- source/games/blood/src/nnexts.cpp | 48 ++++++++++++++--------------- source/games/blood/src/player.cpp | 6 ++-- 5 files changed, 50 insertions(+), 50 deletions(-) diff --git a/source/core/coreactor.h b/source/core/coreactor.h index fb9c74839..ec40caa3d 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -213,7 +213,7 @@ public: DVector3 fVel() const { - return { FixedToFloat(__int_vel.X), FixedToFloat(__int_vel.Y), FixedToFloat(int_vel().Z) }; + return { FixedToFloat(int_vel().X), FixedToFloat(int_vel().Y), FixedToFloat(int_vel().Z) }; } vec3_t int_vel() const diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index d31b9b242..2f2818b3a 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -4090,7 +4090,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) static void actKickObject(DBloodActor* kicker, DBloodActor* kicked) { - int nSpeed = ClipLow(approxDist(kicker->__int_vel.X, kicker->__int_vel.Y) * 2, 0xaaaaa); + int nSpeed = ClipLow(approxDist(kicker->int_vel().X, kicker->int_vel().Y) * 2, 0xaaaaa); kicked->__int_vel.X = MulScale(nSpeed, Cos(kicker->int_ang() + Random2(85)), 30); kicked->__int_vel.Y = MulScale(nSpeed, Sin(kicker->int_ang() + Random2(85)), 30); kicked->__int_vel.Z = MulScale(nSpeed, -0x2000, 14); @@ -4272,7 +4272,7 @@ static void checkHit(DBloodActor* actor) { actKickObject(actor, actor2); sfxPlay3DSound(actor, 357, -1, 1); - int dmg = (mass1 - mass2) + abs(FixedToInt(actor->__int_vel.X)); + int dmg = (mass1 - mass2) + abs(FixedToInt(actor->int_vel().X)); if (dmg > 0) actDamageSprite(actor, actor2, (Chance(0x2000)) ? kDamageFall : kDamageBullet, dmg); } } @@ -4501,9 +4501,9 @@ void actAirDrag(DBloodActor* actor, int a2) wind_y = MulScale(wind, Sin(pXSector->windAng), 30); } } - actor->__int_vel.X += MulScale(wind_x - actor->__int_vel.X, a2, 16); - actor->__int_vel.Y += MulScale(wind_y - actor->__int_vel.Y, a2, 16); - actor->__int_vel.Z -= MulScale(actor->__int_vel.Z, a2, 16); + actor->__int_vel.X += MulScale(wind_x - actor->int_vel().X, a2, 16); + actor->__int_vel.Y += MulScale(wind_y - actor->int_vel().Y, a2, 16); + actor->__int_vel.Z -= MulScale(actor->int_vel().Z, a2, 16); } //--------------------------------------------------------------------------- @@ -4525,7 +4525,7 @@ static Collision MoveThing(DBloodActor* actor) lhit.setNone(); GetActorExtents(actor, &top, &bottom); const int bakCompat = enginecompatibility_mode; - if (actor->__int_vel.X || actor->__int_vel.Y) + if (actor->__int_vel.X || actor->int_vel().Y) { auto bakCstat = actor->spr.cstat; actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; @@ -4663,9 +4663,9 @@ static Collision MoveThing(DBloodActor* actor) actor->add_int_z(ClipLow(ceilZ - top, 0)); if (actor->__int_vel.Z < 0) { - actor->__int_vel.X = MulScale(actor->__int_vel.X, 0xc000, 16); - actor->__int_vel.Y = MulScale(actor->__int_vel.Y, 0xc000, 16); - actor->__int_vel.Z = MulScale(-actor->__int_vel.Z, 0x4000, 16); + actor->__int_vel.X = MulScale(actor->int_vel().X, 0xc000, 16); + actor->__int_vel.Y = MulScale(actor->int_vel().Y, 0xc000, 16); + actor->__int_vel.Z = MulScale(-actor->int_vel().Z, 0x4000, 16); switch (actor->spr.type) { @@ -4688,7 +4688,7 @@ static Collision MoveThing(DBloodActor* actor) if (bottom >= floorZ) { - int nVel = approxDist(actor->__int_vel.X, actor->__int_vel.Y); + int nVel = approxDist(actor->int_vel().X, actor->int_vel().Y); int nVelClipped = ClipHigh(nVel, 0x11111); Collision& coll = floorColl; @@ -4705,12 +4705,12 @@ static Collision MoveThing(DBloodActor* actor) if (nVel > 0) { int t = DivScale(nVelClipped, nVel, 16); - actor->__int_vel.X -= MulScale(t, actor->__int_vel.X, 16); - actor->__int_vel.Y -= MulScale(t, actor->__int_vel.Y, 16); + actor->__int_vel.X -= MulScale(t, actor->int_vel().X, 16); + actor->__int_vel.Y -= MulScale(t, actor->int_vel().Y, 16); } } - if (actor->__int_vel.X || actor->__int_vel.Y) - actor->spr.angle = VecToAngle(actor->__int_vel.X, actor->__int_vel.Y); + if (actor->__int_vel.X || actor->int_vel().Y) + actor->spr.angle = VecToAngle(actor->int_vel().X, actor->int_vel().Y); return lhit; } @@ -4741,7 +4741,7 @@ void MoveDude(DBloodActor* actor) assert(pSector); - if (actor->__int_vel.X || actor->__int_vel.Y) + if (actor->__int_vel.X || actor->int_vel().Y) { if (pPlayer && gNoClip) { @@ -5165,7 +5165,7 @@ void MoveDude(DBloodActor* actor) actor->add_int_z(ClipLow(ceilZ - top, 0)); if (actor->__int_vel.Z <= 0 && (actor->spr.flags & 4)) - actor->__int_vel.Z = MulScale(-actor->__int_vel.Z, 0x2000, 16); + actor->__int_vel.Z = MulScale(-actor->int_vel().Z, 0x2000, 16); } else actor->hit.ceilhit.setNone(); @@ -5173,7 +5173,7 @@ void MoveDude(DBloodActor* actor) GetActorExtents(actor, &top, &bottom); actor->xspr.height = ClipLow(floorZ - bottom, 0) >> 8; - if (actor->__int_vel.X || actor->__int_vel.Y) + if (actor->__int_vel.X || actor->int_vel().Y) { if (floorColl.type == kHitSprite) { @@ -5192,10 +5192,10 @@ void MoveDude(DBloodActor* actor) int nDrag = gDudeDrag; if (actor->xspr.height > 0) nDrag -= Scale(gDudeDrag, actor->xspr.height, 0x100); - actor->__int_vel.X -= mulscale16r(actor->__int_vel.X, nDrag); - actor->__int_vel.Y -= mulscale16r(actor->__int_vel.Y, nDrag); + actor->__int_vel.X -= mulscale16r(actor->int_vel().X, nDrag); + actor->__int_vel.Y -= mulscale16r(actor->int_vel().Y, nDrag); - if (approxDist(actor->__int_vel.X, actor->__int_vel.Y) < 0x1000) + if (approxDist(actor->int_vel().X, actor->int_vel().Y) < 0x1000) actor->__int_vel.X = actor->__int_vel.Y = 0; } } @@ -6054,7 +6054,7 @@ static void actCheckDudes() else pPlayer->chokeEffect = 0; - if (actor->__int_vel.X || actor->__int_vel.Y) + if (actor->__int_vel.X || actor->int_vel().Y) sfxPlay3DSound(actor, 709, 100, 2); pPlayer->bubbleTime = ClipLow(pPlayer->bubbleTime - 4, 0); diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index 5147f70c9..eddc42382 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -87,7 +87,7 @@ void Remove(DBloodActor* actor, sectortype*) // 1 void FlareBurst(DBloodActor* actor, sectortype*) // 2 { if (!actor) return; - int nAngle = getangle(actor->__int_vel.X, actor->__int_vel.Y); + int nAngle = getangle(actor->int_vel().X, actor->int_vel().Y); int nRadius = 0x55555; for (int i = 0; i < 8; i++) { diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 0e6b09085..1a26f5586 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1331,7 +1331,7 @@ void nnExtProcessSuperSprites() if (pact && pact->hit.hit.type == kHitSprite && pact->hit.hit.actor() == debrisactor) { - int nSpeed = approxDist(pact->__int_vel.X, pact->__int_vel.Y); + int nSpeed = approxDist(pact->int_vel().X, pact->int_vel().Y); nSpeed = ClipLow(nSpeed - MulScale(nSpeed, mass, 6), 0x9000 - (mass << 3)); debrisactor->__int_vel.X += MulScale(nSpeed, Cos(pPlayer->actor->int_ang()), 30); @@ -1346,8 +1346,8 @@ void nnExtProcessSuperSprites() if ((debrisactor->xspr.physAttr & kPhysFalling) || debrisactor->__int_vel.X || debrisactor->__int_vel.Y || debrisactor->__int_vel.Z || debrisactor->sector()->velFloor || debrisactor->sector()->velCeil) debrisMove(i); - if (debrisactor->__int_vel.X || debrisactor->__int_vel.Y) - debrisactor->xspr.goalAng = getangle(debrisactor->__int_vel.X, debrisactor->__int_vel.Y) & 2047; + if (debrisactor->__int_vel.X || debrisactor->int_vel().Y) + debrisactor->xspr.goalAng = getangle(debrisactor->int_vel().X, debrisactor->int_vel().Y) & 2047; int ang = debrisactor->int_ang() & 2047; if ((uwater = spriteIsUnderwater(debrisactor)) == false) evKillActor(debrisactor, kCallbackEnemeyBubble); @@ -1361,7 +1361,7 @@ void nnExtProcessSuperSprites() } } - int angStep = ClipLow(mulscale8(1, ((abs(debrisactor->__int_vel.X) + abs(debrisactor->__int_vel.Y)) >> 5)), (uwater) ? 1 : 0); + int angStep = ClipLow(mulscale8(1, ((abs(debrisactor->int_vel().X) + abs(debrisactor->int_vel().Y)) >> 5)), (uwater) ? 1 : 0); if (ang < debrisactor->xspr.goalAng) debrisactor->set_int_ang(ClipHigh(ang + angStep, debrisactor->xspr.goalAng)); else if (ang > debrisactor->xspr.goalAng) debrisactor->set_int_ang(ClipLow(ang - angStep, debrisactor->xspr.goalAng)); @@ -1662,7 +1662,7 @@ void debrisMove(int listIndex) uwater = true; } - if (actor->__int_vel.X || actor->__int_vel.Y) + if (actor->__int_vel.X || actor->int_vel().Y) { auto oldcstat = actor->spr.cstat; @@ -1832,7 +1832,7 @@ void debrisMove(int listIndex) actor->hit.ceilhit = moveHit = ceilColl; actor->add_int_z(ClipLow(ceilZ - top, 0)); if (actor->__int_vel.Z <= 0 && (actor->xspr.physAttr & kPhysFalling)) - actor->__int_vel.Z = MulScale(-actor->__int_vel.Z, 0x2000, 16); + actor->__int_vel.Z = MulScale(-actor->int_vel().Z, 0x2000, 16); } else @@ -1848,7 +1848,7 @@ void debrisMove(int listIndex) trTriggerSprite(actor, kCmdToggle, actor); } - if (!actor->__int_vel.X && !actor->__int_vel.Y) return; + if (!actor->__int_vel.X && !actor->int_vel().Y) return; else if (floorColl.type == kHitSprite) { @@ -1868,9 +1868,9 @@ void debrisMove(int listIndex) if (actor->xspr.height > 0) nDrag -= Scale(nDrag, actor->xspr.height, 0x100); - actor->__int_vel.X -= mulscale16r(actor->__int_vel.X, nDrag); - actor->__int_vel.Y -= mulscale16r(actor->__int_vel.Y, nDrag); - if (approxDist(actor->__int_vel.X, actor->__int_vel.Y) < 0x1000) + actor->__int_vel.X -= mulscale16r(actor->int_vel().X, nDrag); + actor->__int_vel.Y -= mulscale16r(actor->int_vel().Y, nDrag); + if (approxDist(actor->int_vel().X, actor->int_vel().Y) < 0x1000) actor->__int_vel.X = actor->__int_vel.Y = 0; } @@ -4609,17 +4609,17 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH) { if (arg1 == 0) { - if ((var = condCmp(objActor->__int_vel.X, arg1, arg2, cmpOp)) == true) return var; - if ((var = condCmp(objActor->__int_vel.Y, arg1, arg2, cmpOp)) == true) return var; - if ((var = condCmp(objActor->__int_vel.Z, arg1, arg2, cmpOp)) == true) return var; + if ((var = condCmp(objActor->int_vel().X, arg1, arg2, cmpOp)) == true) return var; + if ((var = condCmp(objActor->int_vel().Y, arg1, arg2, cmpOp)) == true) return var; + if ((var = condCmp(objActor->int_vel().Z, arg1, arg2, cmpOp)) == true) return var; } - else if (arg1 == 1) return condCmp(objActor->__int_vel.X, arg1, arg2, cmpOp); - else if (arg1 == 2) return condCmp(objActor->__int_vel.Y, arg1, arg2, cmpOp); - else if (arg1 == 3) return condCmp(objActor->__int_vel.Z, arg1, arg2, cmpOp); + else if (arg1 == 1) return condCmp(objActor->int_vel().X, arg1, arg2, cmpOp); + else if (arg1 == 2) return condCmp(objActor->int_vel().Y, arg1, arg2, cmpOp); + else if (arg1 == 3) return condCmp(objActor->int_vel().Z, arg1, arg2, cmpOp); } else if (arg1 == 0) return (objActor->__int_vel.X || objActor->__int_vel.Y || objActor->int_vel().Z); - else if (arg1 == 1) return (objActor->__int_vel.X); - else if (arg1 == 2) return (objActor->__int_vel.Y); + else if (arg1 == 1) return (objActor->int_vel().X); + else if (arg1 == 2) return (objActor->int_vel().Y); else if (arg1 == 3) return (objActor->int_vel().Z); break; case 30: @@ -7724,7 +7724,7 @@ void nnExtAiSetDirection(DBloodActor* actor, int a3) assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax); int vc = getincangle(actor->int_ang(), a3); - int t1 = DMulScale(actor->__int_vel.X, Cos(actor->int_ang()), actor->__int_vel.Y, Sin(actor->int_ang()), 30); + int t1 = DMulScale(actor->int_vel().X, Cos(actor->int_ang()), actor->int_vel().Y, Sin(actor->int_ang()), 30); int vsi = ((t1 * 15) >> 12) / 2; int v8 = 341; @@ -8205,7 +8205,7 @@ void aiPatrolMove(DBloodActor* actor) if (hitactor->hasX() && hitactor->xspr.health) { hitactor->xspr.dodgeDir = (actor->xspr.dodgeDir > 0) ? -1 : 1; - if (hitactor->__int_vel.X || hitactor->__int_vel.Y) + if (hitactor->__int_vel.X || hitactor->int_vel().Y) aiMoveDodge(hitactor); } } @@ -8228,8 +8228,8 @@ void aiPatrolMove(DBloodActor* actor) } vel = MulScale(vel, approxDist(dx, dy) << 6, 16); - actor->__int_vel.X = ClipRange(actor->__int_vel.X, -vel, vel); - actor->__int_vel.Y = ClipRange(actor->__int_vel.Y, -vel, vel); + actor->__int_vel.X = ClipRange(actor->int_vel().X, -vel, vel); + actor->__int_vel.Y = ClipRange(actor->int_vel().Y, -vel, vel); } //--------------------------------------------------------------------------- @@ -8576,7 +8576,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor) DBloodActor* act = pPlayer->actor; itCanHear = (!deaf && (nDist < hearDist || hearChance > 0)); if (act && itCanHear && nDist < feelDist && (act->__int_vel.X || act->__int_vel.Y || act->int_vel().Z)) - hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->__int_vel.X) + abs(act->__int_vel.Y) + abs(act->int_vel().Z))) >> 6, 0)), 0); + hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->int_vel().X) + abs(act->int_vel().Y) + abs(act->int_vel().Z))) >> 6, 0)), 0); } if (seeDist) @@ -9192,7 +9192,7 @@ void callbackUniMissileBurst(DBloodActor* actor, sectortype*) // 22 { if (!actor) return; if (actor->spr.statnum != kStatProjectile) return; - int nAngle = getangle(actor->__int_vel.X, actor->__int_vel.Y); + int nAngle = getangle(actor->int_vel().X, actor->int_vel().Y); int nRadius = 0x55555; for (int i = 0; i < 8; i++) diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 05bb7d7ad..12ecf5746 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -1862,15 +1862,15 @@ void playerProcess(PLAYER* pPlayer) } } ProcessInput(pPlayer); - int nSpeed = approxDist(actor->__int_vel.X, actor->__int_vel.Y); - pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->__int_vel.Z, 0x7000); + int nSpeed = approxDist(actor->int_vel().X, actor->int_vel().Y); + pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->int_vel().Z, 0x7000); int dz = pPlayer->actor->int_pos().Z - pPosture->eyeAboveZ - pPlayer->zView; if (dz > 0) pPlayer->zViewVel += MulScale(dz << 8, 0xa000, 16); else pPlayer->zViewVel += MulScale(dz << 8, 0x1800, 16); pPlayer->zView += pPlayer->zViewVel >> 8; - pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->__int_vel.Z, 0x5000); + pPlayer->zWeaponVel = interpolatedvalue(pPlayer->zWeaponVel, actor->int_vel().Z, 0x5000); dz = pPlayer->actor->int_pos().Z - pPosture->weaponAboveZ - pPlayer->zWeapon; if (dz > 0) pPlayer->zWeaponVel += MulScale(dz << 8, 0x8000, 16);