Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Simon 2023-02-04 14:33:56 +00:00
commit 4012183cf1
239 changed files with 78 additions and 107 deletions

View file

@ -230,7 +230,7 @@ struct TVector2
// Vector length
vec_t Length() const
{
return (vec_t)g_sqrt (X*X + Y*Y);
return (vec_t)g_sqrt (LengthSquared());
}
vec_t LengthSquared() const
@ -613,7 +613,7 @@ struct TVector3
// Vector length
double Length() const
{
return g_sqrt (X*X + Y*Y + Z*Z);
return g_sqrt (LengthSquared());
}
double LengthSquared() const
@ -928,7 +928,7 @@ struct TVector4
// Vector length
double Length() const
{
return g_sqrt(X*X + Y*Y + Z*Z + W*W);
return g_sqrt(LengthSquared());
}
double LengthSquared() const
@ -1450,7 +1450,7 @@ public:
double Tan() const
{
auto bam = BAMs();
const auto bam = BAMs();
return g_sinbam(bam) / g_cosbam(bam);
}
@ -1487,7 +1487,7 @@ inline TAngle<T> deltaangle(const TAngle<T> &a1, const TAngle<T> &a2)
template<class T>
inline TAngle<T> absangle(const TAngle<T> &a1, const TAngle<T> &a2)
{
return fabs((a1 - a2).Normalized180());
return fabs(deltaangle(a2, a1));
}
template<class T>
@ -1528,7 +1528,7 @@ TAngle<T> TVector3<T>::Angle() const
template<class T>
TAngle<T> TVector3<T>::Pitch() const
{
return -VecToAngle(TVector2<T>(X, Y).Length(), Z);
return -VecToAngle(XY().Length(), Z);
}
template<class T>
@ -1694,13 +1694,10 @@ struct TRotator
};
// Create a forward vector from a rotation (ignoring roll)
template<class T>
inline TVector3<T>::TVector3 (const TRotator<T> &rot)
{
double pcos = rot.Pitch.Cos();
X = pcos * rot.Yaw.Cos();
Y = pcos * rot.Yaw.Sin();
XY() = rot.Pitch.Cos() * rot.Yaw.ToVector();
Z = rot.Pitch.Sin();
}

View file

@ -103,11 +103,6 @@ public:
return interpolatedvalue(PrevAngles.Yaw, spr.Angles.Yaw, interpfrac);
}
DRotator interpolatedangles(double const interpfrac)
{
return interpolatedvalue(PrevAngles, spr.Angles, interpfrac);
}
void backupz()
{
opos.Z = spr.pos.Z;

View file

@ -71,13 +71,17 @@ static inline DAngle getscaledangle(const DAngle angle, const double scale, cons
return (angle.Normalized180() * getTicrateScale(scale)) + push;
}
static inline void scaletozero(DAngle& angle, const double scale, const DAngle push = DAngle::fromDeg(32. / 465.))
static inline bool scaletozero(DAngle& angle, const double scale, const DAngle push = DAngle::fromDeg(32. / 465.))
{
if (auto sgn = angle.Sgn())
{
angle -= getscaledangle(angle, scale, push * sgn);
if (sgn != angle.Sgn()) angle = nullAngle;
if (sgn != (angle -= getscaledangle(angle, scale, push * sgn)).Sgn())
{
angle = nullAngle;
return true;
}
}
return false;
}
@ -203,12 +207,14 @@ void PlayerAngles::doPitchKeys(ESyncBits* actions, const bool stopcentering)
{
const auto pitch = abs(pActor->spr.Angles.Pitch);
const auto scale = pitch > PITCH_CNTRSINEOFFSET ? (pitch - PITCH_CNTRSINEOFFSET).Cos() : 1.;
scaletozero(pActor->spr.Angles.Pitch, PITCH_CENTERSPEED * scale);
if (!pActor->spr.Angles.Pitch.Sgn()) *actions &= ~SB_CENTERVIEW;
if (scaletozero(pActor->spr.Angles.Pitch, PITCH_CENTERSPEED * scale))
*actions &= ~SB_CENTERVIEW;
}
// clamp before we finish, even if it's clamped in the drawer.
pActor->spr.Angles.Pitch = ClampViewPitch(pActor->spr.Angles.Pitch);
// clamp before we finish, factoring in the player's view pitch offset.
const auto maximum = GetMaxPitch() - ViewAngles.Pitch * (ViewAngles.Pitch < nullAngle);
const auto minimum = GetMinPitch() - ViewAngles.Pitch * (ViewAngles.Pitch > nullAngle);
pActor->spr.Angles.Pitch = clamp(pActor->spr.Angles.Pitch, maximum, minimum);
}
@ -259,7 +265,7 @@ void PlayerAngles::doViewPitch(const DVector2& pos, DAngle const ang, bool const
if (aimmode && canslopetilt) // If the floor is sloped
{
// Get a point, 512 (64 for Blood) units ahead of player's position
auto rotpt = pos + ang.ToVector() * (isBlood() ? 4 : 32);
auto rotpt = pos + ang.ToVector() * (!isBlood() ? 32 : 4);
auto tempsect = cursectnum;
updatesector(rotpt, &tempsect);
@ -285,7 +291,8 @@ void PlayerAngles::doViewPitch(const DVector2& pos, DAngle const ang, bool const
if (climbing)
{
// tilt when climbing but you can't even really tell it.
if (ViewAngles.Pitch > PITCH_HORIZOFFCLIMB) ViewAngles.Pitch += getscaledangle(deltaangle(ViewAngles.Pitch, PITCH_HORIZOFFCLIMB), PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH);
if (ViewAngles.Pitch > PITCH_HORIZOFFCLIMB)
ViewAngles.Pitch += getscaledangle(deltaangle(ViewAngles.Pitch, PITCH_HORIZOFFCLIMB), PITCH_HORIZOFFSPEED, PITCH_HORIZOFFPUSH);
}
else
{

View file

@ -28,7 +28,7 @@ struct PlayerAngles
// General methods.
void initialize(DCoreActor* const actor, const DAngle viewyaw = nullAngle)
{
if ((pActor = actor)) RenderAngles = PrevLerpAngles = pActor->spr.Angles;
if (pActor = actor) RenderAngles = PrevLerpAngles = pActor->spr.Angles;
PrevViewAngles.Yaw = ViewAngles.Yaw = viewyaw;
}
DAngle getPitchWithView()
@ -37,21 +37,17 @@ struct PlayerAngles
}
// Render angle functions.
DRotator lerpViewAngles(const double interpfrac)
{
return interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
}
DRotator getRenderAngles(const double interpfrac)
{
// Get angles and return with clamped off pitch.
auto angles = RenderAngles + lerpViewAngles(interpfrac);
auto angles = RenderAngles + interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
angles.Pitch = ClampViewPitch(angles.Pitch);
return angles;
}
void updateRenderAngles(const double interpfrac)
{
// Apply the current interpolated angle state to the render angles.
const auto lerpAngles = pActor->interpolatedangles(interpfrac);
const auto lerpAngles = interpolatedvalue(pActor->PrevAngles, pActor->spr.Angles, interpfrac);
RenderAngles += lerpAngles - PrevLerpAngles;
PrevLerpAngles = lerpAngles;
}
@ -66,14 +62,9 @@ struct PlayerAngles
// Draw code helpers.
auto getCrosshairOffsets(const double interpfrac)
{
// Set up angles.
const auto viewAngles = lerpViewAngles(interpfrac);
const auto rotTangent = viewAngles.Roll.Tan();
const auto yawTangent = clamp(viewAngles.Yaw, -DAngle90, DAngle90).Tan();
const auto fovTangent = tan(r_fov * pi::pi() / 360.);
// Return as pair with roll as the 2nd object since all callers inevitably need it.
return std::make_pair(DVector2(160, 120 * -rotTangent) * -yawTangent / fovTangent, viewAngles.Roll);
// Set up angles and return as pair with roll as the 2nd object since all callers inevitably need it.
const auto viewAngles = interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
return std::make_pair(DVector2(160, 120 * -viewAngles.Roll.Tan()) * -viewAngles.Yaw.Tan() / tan(r_fov * pi::pi() / 360.), viewAngles.Roll);
}
auto getWeaponOffsets(const double interpfrac)
{

View file

@ -1128,10 +1128,6 @@ int HWWall::CheckWallSprite(tspritetype* spr, tspritetype* last)
void HWWall::ProcessWallSprite(HWDrawInfo* di, tspritetype* spr, sectortype* sector)
{
if (spr->time == 1373)
{
int a = 0;
}
auto tex = TexMan.GetGameTexture(spr->spritetexture());
if (!tex || !tex->isValid()) return;

View file

@ -54,15 +54,11 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
ApplyGlobalInput(gInput, hidInput);
processMovement(&input, &gInput, hidInput, scaleAdjust);
if (!SyncInput() && gamestate == GS_LEVEL)
// Perform unsynchronised angle/horizon if not dead.
if (!SyncInput() && gamestate == GS_LEVEL && pPlayer->actor->xspr.health != 0)
{
// Perform unsynchronised angle/horizon if not dead.
if (pPlayer->actor->xspr.health != 0)
{
pPlayer->Angles.RenderAngles.Yaw += DAngle::fromDeg(input.avel);
//Set the pitch directly
pPlayer->Angles.RenderAngles.Pitch = DAngle::fromDeg(input.horz);
}
pPlayer->Angles.RenderAngles.Yaw += DAngle::fromDeg(input.avel);
pPlayer->Angles.RenderAngles.Pitch = DAngle::fromDeg(input.horz);
}
if (packet)

View file

@ -489,7 +489,7 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DRotator& cAngles, sector
{
cPos.Z += bobHeight;
}
cPos.Z -= interpolatedvalue(0., 10., cAngles.Pitch / DAngle90);
cPos.Z -= 10. * (cAngles.Pitch / DAngle90);
}
else
{

View file

@ -231,7 +231,7 @@ void displayweapon_d(int snum, double interpfrac)
auto offpair = p->Angles.getWeaponOffsets(interpfrac);
auto offsets = offpair.first;
auto pitchoffset = interpolatedvalue(0., 16., p->Angles.getRenderAngles(interpfrac).Pitch / DAngle90);
auto pitchoffset = 16. * (p->Angles.getRenderAngles(interpfrac).Pitch / DAngle90);
auto yawinput = getavel(snum) * (1. / 16.);
auto angle = offpair.second;
auto weapon_xoffset = 160 - 90 - (BobVal(512 + weapon_sway * 0.5) * (16384. / 1536.)) - 58 - p->weapon_ang;

View file

@ -838,15 +838,10 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
FinalizeInput(p, input);
if (!SyncInput())
if (!SyncInput() && p->GetActor()->spr.extra > 0)
{
if (p->GetActor()->spr.extra > 0)
{
// Do these in the same order as the old code.
p->Angles.RenderAngles.Yaw += p->adjustavel(input.avel);
//Set pitch directly
p->Angles.RenderAngles.Pitch = DAngle::fromDeg(input.horz);
}
p->Angles.RenderAngles.Yaw += p->adjustavel(input.avel);
p->Angles.RenderAngles.Pitch = DAngle::fromDeg(input.horz);
}
if (packet)

View file

@ -376,8 +376,6 @@ void GameInterface::Ticker()
PlayerList[nLocalPlayer].Angles.resetRenderAngles();
UpdatePlayerSpriteAngle(&PlayerList[nLocalPlayer]);
inita = inita.Normalized360();
// disable synchronised input if set by game.
resetForcedSyncInput();

View file

@ -82,18 +82,14 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
sPlayerInput[nLocalPlayer].vel.Zero();
}
if (!SyncInput() && gamestate == GS_LEVEL)
if (!SyncInput() && gamestate == GS_LEVEL && !nFreeze)
{
if (!nFreeze)
{
pPlayer->Angles.RenderAngles.Yaw += DAngle::fromDeg(input.avel);
//Set pitch directly
pPlayer->Angles.RenderAngles.Pitch = DAngle::fromDeg(input.horz);
pPlayer->Angles.RenderAngles.Yaw += DAngle::fromDeg(input.avel);
pPlayer->Angles.RenderAngles.Pitch = DAngle::fromDeg(input.horz);
if (input.horz)
{
pPlayer->bPlayerPan = pPlayer->bLockPan = true;
}
if (input.horz)
{
pPlayer->bPlayerPan = pPlayer->bLockPan = true;
}
UpdatePlayerSpriteAngle(pPlayer);

View file

@ -666,7 +666,7 @@ static void pickupMessage(int no)
void UpdatePlayerSpriteAngle(Player* pPlayer)
{
if (pPlayer->pActor) inita = pPlayer->pActor->spr.Angles.Yaw;
if (pPlayer->pActor) inita = pPlayer->pActor->spr.Angles.Yaw.Normalized360();
}
//---------------------------------------------------------------------------

View file

@ -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;

View file

@ -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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more