- Rename PlayerHorizon private members in preparation for replacement work.

This commit is contained in:
Mitchell Richters 2022-11-25 16:41:51 +11:00 committed by Christoph Oelckers
parent 9ab8db04db
commit b38f9a8779
2 changed files with 16 additions and 16 deletions

View file

@ -359,14 +359,14 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w,
{
arc("horiz", w.ZzHORIZON)
("horizoff", w.ZzHORIZOFF)
("inputdisabled", w.inputdisabled)
("inputdisabled", w.legacyDisabledPitch)
.EndObject();
if (arc.isReading())
{
w.ZzOLDHORIZON = w.ZzHORIZON;
w.ZzOHORIZOFF = w.ZzHORIZOFF;
w.inputdisabled = w.inputdisabled;
w.legacyDisabledPitch = w.legacyDisabledPitch;
w.resetAdjustmentPitch();
}
}

View file

@ -34,20 +34,20 @@ struct PlayerHorizon
DAngle horizLERPSUM(double const interpfrac) { return interpolatedvalue(horizOLDSUM(), horizSUM(), interpfrac); }
// Ticrate playsim adjustment helpers.
void resetAdjustmentPitch() { adjustment = nullAngle; }
bool targetedPitch() { return target.Sgn(); }
void resetAdjustmentPitch() { legacyAdjustmentPitch = nullAngle; }
bool targetedPitch() { return legacyTargetPitch.Sgn(); }
// Input locking helpers.
void lockPitch() { inputdisabled = true; }
void unlockPitch() { inputdisabled = false; }
bool lockedPitch() { return targetedPitch() || inputdisabled; }
void lockPitch() { legacyDisabledPitch = true; }
void unlockPitch() { legacyDisabledPitch = false; }
bool lockedPitch() { return targetedPitch() || legacyDisabledPitch; }
// Ticrate playsim adjustment setters and processor.
void addPitch(DAngle const value)
{
if (!SyncInput())
{
adjustment += value;
legacyAdjustmentPitch += value;
}
else
{
@ -62,7 +62,7 @@ struct PlayerHorizon
if (!SyncInput() && !backup)
{
target = value.Sgn() ? value : minAngle;
legacyTargetPitch = value.Sgn() ? value : minAngle;
}
else
{
@ -75,7 +75,7 @@ struct PlayerHorizon
{
if (targetedPitch())
{
auto delta = deltaangle(ZzHORIZON, target);
auto delta = deltaangle(ZzHORIZON, legacyTargetPitch);
if (abs(delta).Degrees() > 0.45)
{
@ -83,19 +83,19 @@ struct PlayerHorizon
}
else
{
ZzHORIZON = target;
target = nullAngle;
ZzHORIZON = legacyTargetPitch;
legacyTargetPitch = nullAngle;
}
}
else if (adjustment.Sgn())
else if (legacyAdjustmentPitch.Sgn())
{
ZzHORIZON += adjustment * scaleAdjust;
ZzHORIZON += legacyAdjustmentPitch * scaleAdjust;
}
}
private:
DAngle target, adjustment;
bool inputdisabled;
DAngle legacyTargetPitch, legacyAdjustmentPitch;
bool legacyDisabledPitch;
};
struct PlayerAngle