diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index c8031e559..a30a87fac 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1285,7 +1285,7 @@ int PlayerInitChemBomb(PLAYER* pp) if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew)) actorNew->user.Flags |= (SPR_UNDERWATER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF); double oclipdist = plActor->clipdist; plActor->clipdist = 0; @@ -1655,7 +1655,7 @@ int PlayerInitCaltrops(PLAYER* pp) if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew)) actorNew->user.Flags |= (SPR_UNDERWATER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF); double oclipdist = plActor->clipdist; plActor->clipdist = 0; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 77f253c77..5a0c4042f 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -11521,7 +11521,7 @@ int DoRing(DSWActor* actor) // put it out there actor->spr.pos += actor->spr.Angles.Yaw.ToVector() * actor->user.Dist; - if (pp) actor->spr.pos.Z -= actor->user.Dist * pp->actor->spr.Angles.Pitch.Tan() * 2.; // horizon math sucks... + if (pp) actor->spr.pos.Z -= actor->user.Dist * pp->Angles.getPitchWithView().Tan() * 2.; // horizon math sucks... SetActor(actor, actor->spr.pos); @@ -11599,7 +11599,7 @@ void InitSpellRing(PLAYER* pp) // put it out there actorNew->spr.pos += actorNew->spr.Angles.Yaw.ToVector() * actorNew->user.Dist; - actorNew->spr.pos.Z += pp->actor->getOffsetZ() + 20 - (actorNew->user.Dist * pp->actor->spr.Angles.Pitch.Tan() * 2.); // horizon math sucks... + actorNew->spr.pos.Z += pp->actor->getOffsetZ() + 20 - (actorNew->user.Dist * pp->Angles.getPitchWithView().Tan() * 2.); // horizon math sucks... actorNew->spr.Angles.Yaw += DAngle90; @@ -11971,7 +11971,7 @@ void InitSpellNapalm(PLAYER* pp) actor->spr.shade = -40; actor->spr.scale = DVector2(0.5, 0.5); actor->clipdist = 0; - setFreeAimVelocity(actor->vel.X, actor->vel.Z, pp->actor->spr.Angles.Pitch, HORIZ_MULTF); + setFreeAimVelocity(actor->vel.X, actor->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF); actor->spr.cstat |= (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actor->user.Flags2 |= (SPR2_BLUR_TAPER_FAST); @@ -12101,7 +12101,7 @@ int InitSpellMirv(PLAYER* pp) actorNew->spr.shade = -40; actorNew->spr.scale = DVector2(1.125, 1.125); actorNew->clipdist = 2; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF); actorNew->spr.cstat |= (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_YCENTER); actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); @@ -12236,7 +12236,7 @@ int InitSwordAttack(PLAYER* pp) double dax = 1024., daz = 0; DAngle daang = pp->actor->spr.Angles.Yaw; - setFreeAimVelocity(dax, daz, pp->actor->spr.Angles.Pitch, 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.)); + setFreeAimVelocity(dax, daz, pp->Angles.getPitchWithView(), 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.)); FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3(pp->actor->spr.Angles.Yaw.ToVector() * dax, daz), hit, CLIPMASK_MISSILE); if (hit.hitSector == nullptr) @@ -12414,7 +12414,7 @@ int InitFistAttack(PLAYER* pp) HitInfo hit{}; double dax = 1024., daz = 0; auto daang = pp->actor->spr.Angles.Yaw; - setFreeAimVelocity(dax, daz, pp->actor->spr.Angles.Pitch, 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.)); + setFreeAimVelocity(dax, daz, pp->Angles.getPitchWithView(), 1000. - (RandomRangeF(24000 / 256.) - 12000 / 256.)); FAFhitscan(pp->actor->getPosWithOffsetZ(), pp->cursector, DVector3(pp->actor->spr.Angles.Yaw.ToVector() * dax, daz), hit, CLIPMASK_MISSILE); if (hit.hitSector == nullptr) @@ -12975,7 +12975,7 @@ int InitStar(PLAYER* pp) actorNew->clipdist = 2; // zvel was overflowing with this calculation - had to move to a local long var double zvel = 0; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->actor->spr.Angles.Pitch, (HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + STAR_HORIZ_ADJ) * 0.5); actorNew->user.ceiling_dist = (1); actorNew->user.floor_dist = (1); @@ -13075,7 +13075,7 @@ void InitHeartAttack(PLAYER* pp) actorNew->spr.shade = -10; actorNew->spr.scale = DVector2(0.8125, 0.8125); actorNew->clipdist = 0; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF); actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actorNew->user.Flags2 |= (SPR2_DONT_TARGET_OWNER); actorNew->spr.cstat |= (CSTAT_SPRITE_INVISIBLE); @@ -13217,7 +13217,7 @@ int InitShotgun(PLAYER* pp) DAngle daang = DAngle22_5 * 0.5; if (WeaponAutoAimHitscan(pp->actor, &daz, &daang, false) == nullptr) { - setFreeAimVelocity(dax, daz, pp->actor->spr.Angles.Pitch, 1000.); + setFreeAimVelocity(dax, daz, pp->Angles.getPitchWithView(), 1000.); daang = pp->actor->spr.Angles.Yaw; } @@ -13379,7 +13379,7 @@ int InitLaser(PLAYER* pp) actorNew->clipdist = 4; // the slower the missile travels the less of a zvel it needs - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, 16.); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), 16.); actorNew->user.WeaponNum = actor->user.WeaponNum; actorNew->user.Radius = 200; @@ -13474,7 +13474,7 @@ int InitRail(PLAYER* pp) SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(0.8125, 0.8125); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->actor->spr.Angles.Pitch, (HORIZ_MULT + 17) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + 17) * 0.5); actorNew->user.RotNum = 5; NewStateGroup(actorNew, &sg_Rail[0]); @@ -13638,7 +13638,7 @@ int InitRocket(PLAYER* pp) SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(1.40626, 1.40625); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->actor->spr.Angles.Pitch, (HORIZ_MULT + 35) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + 35) * 0.5); actorNew->clipdist = 4; @@ -13745,7 +13745,7 @@ int InitBunnyRocket(PLAYER* pp) SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(1, 1); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->actor->spr.Angles.Pitch, (HORIZ_MULT + 35) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + 35) * 0.5); actorNew->clipdist = 4; @@ -13847,7 +13847,7 @@ int InitNuke(PLAYER* pp) SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(2, 2); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->actor->spr.Angles.Pitch, (HORIZ_MULT + 36) * 0.5); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), (HORIZ_MULT + 36) * 0.5); actorNew->clipdist = 4; // Set to red palette @@ -14003,7 +14003,7 @@ int InitMicro(PLAYER* pp) return 0; double vel = 75., zvel = 0; - setFreeAimVelocity(vel, zvel, pp->actor->spr.Angles.Pitch, HORIZ_MULTF); + setFreeAimVelocity(vel, zvel, pp->Angles.getPitchWithView(), HORIZ_MULTF); for (i = 0; i < MAX_MICRO; i++) { @@ -15208,7 +15208,7 @@ int InitTracerUzi(PLAYER* pp) static const short lat_dist[] = {800,-800}; - double nz = 8 + (pp->actor->spr.Angles.Pitch.Tan() * 36.); + double nz = 8 + (pp->Angles.getPitchWithView().Tan() * 36.); // Spawn a shot // Inserting and setting up variables @@ -15247,7 +15247,7 @@ int InitTracerUzi(PLAYER* pp) return 0; } - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, actorNew->vel.X); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), actorNew->vel.X); plActor->clipdist = oclipdist; @@ -15512,7 +15512,7 @@ int InitUzi(PLAYER* pp) else { daang = pp->actor->spr.Angles.Yaw + mapangle(RandomRange(24) - 12); - setFreeAimVelocity(dax, daz, pp->actor->spr.Angles.Pitch, 1000. - (RandomRangeF(24000/256.) - 12000/256.)); + setFreeAimVelocity(dax, daz, pp->Angles.getPitchWithView(), 1000. - (RandomRangeF(24000/256.) - 12000/256.)); } DVector3 vect(daang.ToVector() * dax, daz); @@ -15684,7 +15684,7 @@ int InitTankShell(DSWActor* actor, PLAYER* pp) actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER); actorNew->spr.cstat |= (CSTAT_SPRITE_INVISIBLE); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, actorNew->vel.X); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), actorNew->vel.X); WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false); // a bit of randomness @@ -15752,7 +15752,7 @@ int InitTurretMicro(DSWActor* actor, PLAYER* pp) SetOwner(plActor, actorNew); actorNew->spr.scale = DVector2(0.375, 0.375); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, HORIZ_MULTF - RandomRangeF(8) + 5); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF - RandomRangeF(8) + 5); actorNew->clipdist = 4; @@ -15821,7 +15821,7 @@ int InitTurretRocket(DSWActor* actor, PLAYER* pp) actorNew->user.Flags2 |= (SPR2_SO_MISSILE); actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, actorNew->vel.X); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), actorNew->vel.X); WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false); // a bit of randomness @@ -15860,7 +15860,7 @@ int InitTurretFireball(DSWActor* actor, PLAYER* pp) actorNew->user.Flags2 |= (SPR2_SO_MISSILE); actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, actorNew->vel.X); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), actorNew->vel.X); WeaponAutoAim(actor, actorNew, DAngle22_5 / 2, false); // a bit of randomness @@ -15897,7 +15897,7 @@ int InitTurretRail(DSWActor* actor, PLAYER* pp) SetOwner(pp->actor, actorNew); actorNew->spr.scale = DVector2(0.8125, 0.8125); actorNew->spr.shade = -15; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF); actorNew->user.RotNum = 5; NewStateGroup(actorNew, &sg_Rail[0]); @@ -15944,7 +15944,7 @@ int InitTurretLaser(DSWActor* actor, PLAYER* pp) actorNew->spr.shade = -15; // the slower the missile travels the less of a zvel it needs - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, 16.); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), 16.); actorNew->user.Radius = 200; actorNew->user.ceiling_dist = (1); @@ -15983,7 +15983,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYER* pp) double daz = npos.Z; if (RANDOM_P2(1024) < 200) - InitTracerTurret(actor, pp->actor, pp->actor->spr.Angles.Pitch); + InitTracerTurret(actor, pp->actor, pp->Angles.getPitchWithView()); DAngle daang = DAngle22_5 / 2; if (WeaponAutoAimHitscan(actor, &daz, &daang, false) != nullptr) @@ -15992,7 +15992,7 @@ int InitSobjMachineGun(DSWActor* actor, PLAYER* pp) } else { - setFreeAimVelocity(dax, daz, DAngle::fromDeg(min(pp->actor->spr.Angles.Pitch.Degrees(), 11.0515)), 1000 - RandomRangeF(80) + 40); + setFreeAimVelocity(dax, daz, DAngle::fromDeg(min(pp->Angles.getPitchWithView().Degrees(), 11.0515)), 1000 - RandomRangeF(80) + 40); daang = actor->spr.Angles.Yaw; } @@ -16682,7 +16682,7 @@ int InitGrenade(PLAYER* pp) if (pp->Flags & (PF_DIVING) || SpriteInUnderwaterArea(actorNew)) actorNew->user.Flags |= (SPR_UNDERWATER); - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF); auto oclipdist = actor->clipdist; actor->clipdist = 0; @@ -16798,7 +16798,7 @@ int InitMine(PLAYER* pp) actorNew->spr.scale = DVector2(0.5, 0.5); actorNew->spr.shade = -15; actorNew->clipdist = 8; - setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->actor->spr.Angles.Pitch, HORIZ_MULTF); + setFreeAimVelocity(actorNew->vel.X, actorNew->vel.Z, pp->Angles.getPitchWithView(), HORIZ_MULTF); actorNew->user.WeaponNum = actor->user.WeaponNum; actorNew->user.Radius = 200; actorNew->user.ceiling_dist = (5); @@ -16933,7 +16933,7 @@ int InitFireball(PLAYER* pp) actorNew->user.ceiling_dist = (6); actorNew->user.floor_dist = (6); double zvel = 0.; - setFreeAimVelocity(actorNew->vel.X, zvel, pp->actor->spr.Angles.Pitch, 120.); + setFreeAimVelocity(actorNew->vel.X, zvel, pp->Angles.getPitchWithView(), 120.); // at certain angles the clipping box was big enough to block the // initial positioning of the fireball.