mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- Preserve one legacy getter that's needed extensively in Duke.
This commit is contained in:
parent
cca36b8061
commit
a7a5d4b946
7 changed files with 33 additions and 30 deletions
|
@ -36,6 +36,10 @@ struct PlayerAngles
|
|||
void setActor(DCoreActor* const actor) { pActor = actor; }
|
||||
|
||||
// Angle getters.
|
||||
DAngle getPitchWithView()
|
||||
{
|
||||
return pActor->spr.Angles.Pitch + ViewAngles.Pitch;
|
||||
}
|
||||
DRotator lerpViewAngles(const double interpfrac)
|
||||
{
|
||||
return interpolatedvalue(PrevViewAngles, ViewAngles, interpfrac);
|
||||
|
@ -113,7 +117,6 @@ struct PlayerAngles
|
|||
|
||||
|
||||
// Legacy, to be removed.
|
||||
DAngle horizSUM(const double interpfrac = 1) { return ZzHORIZON() + interpolatedvalue(PrevViewAngles.Pitch, ViewAngles.Pitch, interpfrac); }
|
||||
DAngle horizLERPSUM(double const interpfrac) { return interpolatedvalue(ZzOLDHORIZON() + PrevViewAngles.Pitch, ZzHORIZON() + ViewAngles.Pitch, interpfrac); }
|
||||
DAngle angSUM(const double interpfrac) { return ZzANGLE() + angLERPLOOKANG(interpfrac); }
|
||||
DAngle angLERPSUM(double const interpfrac) { return interpolatedvalue(ZzOLDANGLE() + PrevViewAngles.Yaw, ZzANGLE() + ViewAngles.Yaw, interpfrac); }
|
||||
|
|
|
@ -230,7 +230,7 @@ void displayweapon_d(int snum, double interpfrac)
|
|||
|
||||
auto offpair = p->Angles.getWeaponOffsets(interpfrac);
|
||||
auto offsets = offpair.first;
|
||||
auto horiz = !SyncInput() ? p->Angles.horizSUM(interpfrac) : p->Angles.horizLERPSUM(interpfrac);
|
||||
auto horiz = !SyncInput() ? p->Angles.getPitchWithView(interpfrac) : p->Angles.horizLERPSUM(interpfrac);
|
||||
auto pitchoffset = interpolatedvalue(0., 16., horiz / DAngle90);
|
||||
auto yawinput = getavel(snum) * (1. / 16.);
|
||||
auto angle = -offpair.second;
|
||||
|
|
|
@ -247,7 +247,7 @@ DDukeActor* aim(DDukeActor* actor, int abase)
|
|||
if (plr->curr_weapon == PISTOL_WEAPON && !isWW2GI())
|
||||
{
|
||||
double vel = 1024, zvel = 0;
|
||||
setFreeAimVelocity(vel, zvel, plr->Angles.horizSUM(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, plr->Angles.getPitchWithView(), 16.);
|
||||
|
||||
HitInfo hit{};
|
||||
hitscan(plr->GetActor()->getPosWithOffsetZ().plusZ(4), actor->sector(), DVector3(actor->spr.Angles.Yaw.ToVector() * vel, zvel), hit, CLIPMASK1);
|
||||
|
@ -345,7 +345,7 @@ DDukeActor* aim(DDukeActor* actor, int abase)
|
|||
if (actor->isPlayer())
|
||||
{
|
||||
double checkval = (act->spr.pos.Z - actor->spr.pos.Z) * 1.25 / sdist;
|
||||
double horiz = ps[actor->PlayerIndex()].Angles.horizSUM().Tan();
|
||||
double horiz = ps[actor->PlayerIndex()].Angles.getPitchWithView().Tan();
|
||||
check = abs(checkval - horiz) < 0.78125;
|
||||
}
|
||||
else check = 1;
|
||||
|
|
|
@ -113,7 +113,7 @@ static void shootfireball(DDukeActor *actor, int p, DVector3 pos, DAngle ang)
|
|||
}
|
||||
else
|
||||
{
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 49.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 49.);
|
||||
pos += (ang + DAngle1 * 61.171875).ToVector() * (1024. / 448.);
|
||||
pos.Z += 3;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, DVector3 spos, DAng
|
|||
}
|
||||
else
|
||||
{
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 40.5);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 40.5);
|
||||
|
||||
// WTF???
|
||||
DAngle myang = DAngle90 - (DAngle180 - abs(abs((spos.XY() - ps[p].GetActor()->spr.pos.XY()).Angle() - sang) - DAngle180));
|
||||
|
@ -233,7 +233,7 @@ static void shootknee(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
|
|||
|
||||
if (p >= 0)
|
||||
{
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
||||
pos.Z += 6;
|
||||
ang += DAngle1 * 2.64;
|
||||
}
|
||||
|
@ -365,14 +365,14 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
|
|||
if (aimed == nullptr)
|
||||
{
|
||||
// no target
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
||||
}
|
||||
zvel += (zRange / 2) - krandf(zRange);
|
||||
}
|
||||
else if (aimed == nullptr)
|
||||
{
|
||||
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
||||
zvel += 0.5 - krandf(1);
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,7 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a
|
|||
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
|
||||
}
|
||||
else
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 49.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 49.);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -683,7 +683,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
|
|||
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
|
||||
}
|
||||
else
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 40.5);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 40.5);
|
||||
|
||||
if (atwith == RPG)
|
||||
S_PlayActorSound(RPG_SHOOT, actor);
|
||||
|
@ -822,7 +822,7 @@ static void shootlaser(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
|
|||
HitInfo hit{};
|
||||
|
||||
if (p >= 0)
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
||||
else zvel = 0;
|
||||
|
||||
hitscan(pos, sectp, DVector3(ang.ToVector() * vel, zvel * 64), hit, CLIPMASK1);
|
||||
|
@ -921,7 +921,7 @@ static void shootgrowspark(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
|
|||
else
|
||||
{
|
||||
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
||||
zvel += 0.5 - krandf(1);
|
||||
}
|
||||
|
||||
|
@ -1015,7 +1015,7 @@ static void shootshrinker(DDukeActor* actor, int p, const DVector3& pos, DAngle
|
|||
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
|
||||
}
|
||||
else
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 49.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 49.);
|
||||
}
|
||||
else if (actor->spr.statnum != 3)
|
||||
{
|
||||
|
@ -2010,7 +2010,7 @@ int operateTripbomb(int snum)
|
|||
auto p = &ps[snum];
|
||||
HitInfo hit{};
|
||||
double vel = 1024, zvel = 0;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 16.);
|
||||
|
||||
hitscan(p->GetActor()->getPosWithOffsetZ(), p->cursector, DVector3(p->Angles.ZzANGLE().ToVector() * vel, zvel), hit, CLIPMASK1);
|
||||
|
||||
|
@ -2200,12 +2200,12 @@ static void operateweapon(int snum, ESyncBits actions)
|
|||
if (p->on_ground && (actions & SB_CROUCH))
|
||||
{
|
||||
vel = 15/16.;
|
||||
zvel = p->Angles.horizSUM().Sin() * 10.;
|
||||
zvel = p->Angles.getPitchWithView().Sin() * 10.;
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = 140/16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
zvel -= 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int a
|
|||
|
||||
if (p >= 0)
|
||||
{
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
||||
pos.Z += 6;
|
||||
ang += DAngle1 * 2.64;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
|
|||
if (aimed == nullptr)
|
||||
{
|
||||
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
||||
zvel += 0.5 - krandf(1);
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
|
|||
ang += DAngle22_5 / 2 - randomAngle(22.5);
|
||||
else
|
||||
ang += DAngle22_5 / 8 - randomAngle(22.5 / 4);
|
||||
if (aimed == nullptr) setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 16.);
|
||||
if (aimed == nullptr) setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 16.);
|
||||
zvel += 0.5 - krandf(1);
|
||||
}
|
||||
pos.Z -= 2;
|
||||
|
@ -511,7 +511,7 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a
|
|||
}
|
||||
else
|
||||
{
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 49.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 49.);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -596,7 +596,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw
|
|||
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
|
||||
}
|
||||
else
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 40.5);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 40.5);
|
||||
|
||||
if (atwith == RPG)
|
||||
S_PlayActorSound(RPG_SHOOT, actor);
|
||||
|
@ -746,7 +746,7 @@ static void shootwhip(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int at
|
|||
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
|
||||
}
|
||||
else
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.horizSUM(), 49.);
|
||||
setFreeAimVelocity(vel, zvel, ps[p].Angles.getPitchWithView(), 49.);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2674,12 +2674,12 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
|
|||
if (p->on_ground && (actions & SB_CROUCH))
|
||||
{
|
||||
vel = 15 / 16.;
|
||||
zvel = p->Angles.horizSUM().Sin() * 10.;
|
||||
zvel = p->Angles.getPitchWithView().Sin() * 10.;
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = 140 / 16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
zvel -= 4;
|
||||
}
|
||||
|
||||
|
@ -3082,12 +3082,12 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
|
|||
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
|
||||
{
|
||||
vel = 15 / 16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = 2.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
zvel -= 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -333,12 +333,12 @@ void operateweapon_ww(int snum, ESyncBits actions)
|
|||
if (p->on_ground && (actions & SB_CROUCH))
|
||||
{
|
||||
vel = 15 / 16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = 140 / 16.;
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.horizSUM(), 10.);
|
||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 10.);
|
||||
zvel -= 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell)
|
|||
ang = ps[snum].Angles.ZzANGLE() - mapangle((krand() & 63) + 8); //Fine tune
|
||||
|
||||
act->temp_data[0] = krand() & 1;
|
||||
act->spr.pos.Z = 3 + ps[snum].GetActor()->getOffsetZ() + ps[snum].pyoff + (ps[snum].Angles.horizSUM().Tan() * 8.) + (!isshell ? 3 : 0);
|
||||
act->spr.pos.Z = 3 + ps[snum].GetActor()->getOffsetZ() + ps[snum].pyoff + (ps[snum].Angles.getPitchWithView().Tan() * 8.) + (!isshell ? 3 : 0);
|
||||
act->vel.Z = -krandf(1);
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue