Skip to content

Commit

Permalink
- Rename PlayerHorizon::horizoff in preparation for replacement work.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjr4077au committed Nov 26, 2022
1 parent 1fd6d25 commit d55ac0a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions source/core/gameinput.cpp
Expand Up @@ -300,24 +300,24 @@ void PlayerHorizon::calcviewpitch(const DVector2& pos, DAngle const ang, bool co
// accordingly
if (cursectnum == tempsect || (!isBlood() && abs(getflorzofslopeptr(tempsect, rotpt) - k) <= 4))
{
horizoff -= maphoriz(scaleAdjust * ((j - k) * (!isBlood() ? 0.625 : 5.5)));
ZzHORIZOFF -= maphoriz(scaleAdjust * ((j - k) * (!isBlood() ? 0.625 : 5.5)));
}
}
}

if (climbing)
{
// tilt when climbing but you can't even really tell it.
if (horizoff > PITCH_HORIZOFFCLIMB) horizoff -= getscaledangle(PITCH_HORIZOFFSPEED, scaleAdjust, deltaangle(horizoff, PITCH_HORIZOFFCLIMB), PITCH_HORIZOFFPUSH);
if (ZzHORIZOFF > PITCH_HORIZOFFCLIMB) ZzHORIZOFF -= getscaledangle(PITCH_HORIZOFFSPEED, scaleAdjust, deltaangle(ZzHORIZOFF, PITCH_HORIZOFFCLIMB), PITCH_HORIZOFFPUSH);
}
else
{
// Make horizoff grow towards 0 since horizoff is not modified when you're not on a slope.
scaletozero(horizoff, PITCH_HORIZOFFSPEED, scaleAdjust, PITCH_HORIZOFFPUSH);
scaletozero(ZzHORIZOFF, PITCH_HORIZOFFSPEED, scaleAdjust, PITCH_HORIZOFFPUSH);
}

// Clamp off against the maximum allowed pitch.
horizoff = ClampViewPitch(horizoff);
ZzHORIZOFF = ClampViewPitch(ZzHORIZOFF);
}
}

Expand Down Expand Up @@ -356,14 +356,14 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w,
if (arc.BeginObject(keyname))
{
arc("horiz", w.ZzHORIZON)
("horizoff", w.horizoff)
("horizoff", w.ZzHORIZOFF)
("inputdisabled", w.inputdisabled)
.EndObject();

if (arc.isReading())
{
w.ZzOLDHORIZON = w.ZzHORIZON;
w.ohorizoff = w.horizoff;
w.ohorizoff = w.ZzHORIZOFF;
w.inputdisabled = w.inputdisabled;
w.resetadjustment();
}
Expand Down
8 changes: 4 additions & 4 deletions source/core/gameinput.h
Expand Up @@ -8,7 +8,7 @@

struct PlayerHorizon
{
DAngle ZzHORIZON, ZzOLDHORIZON, horizoff, ohorizoff;
DAngle ZzHORIZON, ZzOLDHORIZON, ZzHORIZOFF, ohorizoff;

friend FSerializer& Serialize(FSerializer& arc, const char* keyname, PlayerHorizon& w, PlayerHorizon* def);

Expand All @@ -20,17 +20,17 @@ struct PlayerHorizon
void backup()
{
ZzOLDHORIZON = ZzHORIZON;
ohorizoff = horizoff;
ohorizoff = ZzHORIZOFF;
}
void restore()
{
ZzHORIZON = ZzOLDHORIZON;
horizoff = ohorizoff;
ZzHORIZOFF = ohorizoff;
}

// Commonly used getters.
DAngle osum() { return ZzOLDHORIZON + ohorizoff; }
DAngle sum() { return ZzHORIZON + horizoff; }
DAngle sum() { return ZzHORIZON + ZzHORIZOFF; }
DAngle interpolatedsum(double const interpfrac) { return interpolatedvalue(osum(), sum(), interpfrac); }

// Ticrate playsim adjustment helpers.
Expand Down
2 changes: 1 addition & 1 deletion source/games/blood/src/player.cpp
Expand Up @@ -821,7 +821,7 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->actor->xspr.health = pDudeInfo->startHealth << 4;
pPlayer->actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
pPlayer->bloodlust = 0;
pPlayer->horizon.ZzHORIZON = pPlayer->horizon.horizoff = nullAngle;
pPlayer->horizon.ZzHORIZON = pPlayer->horizon.ZzHORIZOFF = nullAngle;
pPlayer->slope = 0;
pPlayer->fragger = nullptr;
pPlayer->underwaterTime = 1200;
Expand Down
6 changes: 3 additions & 3 deletions source/games/duke/src/gameexec.cpp
Expand Up @@ -354,8 +354,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;

case PLAYER_HORIZOFF:
if (bSet) ps[iPlayer].horizon.horizoff = maphoriz(-lValue);
else SetGameVarID(lVar2, int(ps[iPlayer].horizon.horizoff.Tan() * -128.), sActor, sPlayer);
if (bSet) ps[iPlayer].horizon.ZzHORIZOFF = maphoriz(-lValue);
else SetGameVarID(lVar2, int(ps[iPlayer].horizon.ZzHORIZOFF.Tan() * -128.), sActor, sPlayer);
break;

case PLAYER_OHORIZOFF:
Expand Down Expand Up @@ -2250,7 +2250,7 @@ int ParseState::parse(void)
ps[g_p].horizon.ZzOLDHORIZON = ps[g_p].horizon.ZzHORIZON = nullAngle;
ps[g_p].on_crane = nullptr;
ps[g_p].frag_ps = g_p;
ps[g_p].horizon.ohorizoff = ps[g_p].horizon.horizoff = nullAngle;
ps[g_p].horizon.ohorizoff = ps[g_p].horizon.ZzHORIZOFF = nullAngle;
ps[g_p].opyoff = 0;
ps[g_p].wackedbyactor = nullptr;
ps[g_p].shield_amount = gs.max_armour_amount;
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/player.cpp
Expand Up @@ -622,7 +622,7 @@ void playerisdead(int snum, int psectlotag, double floorz, double ceilingz)

backupplayer(p);

p->horizon.horizoff = p->horizon.ZzHORIZON = nullAngle;
p->horizon.ZzHORIZOFF = p->horizon.ZzHORIZON = nullAngle;

updatesector(p->GetActor()->getPosWithOffsetZ(), &p->cursector);

Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/prediction.cpp
Expand Up @@ -55,7 +55,7 @@ void resetmys()
myxvel = myyvel = myzvel = 0;
myang = ps[myconnectindex].angle.ang;
myhoriz = omyhoriz = ps[myconnectindex].horizon.ZzHORIZON;
myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff;
myhorizoff = omyhorizoff = ps[myconnectindex].horizon.ZzHORIZOFF;
mycursectnum = sectindex(ps[myconnectindex].cursector);
myjumpingcounter = ps[myconnectindex].jumping_counter;
myjumpingtoggle = ps[myconnectindex].jumping_toggle;
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/premap.cpp
Expand Up @@ -126,7 +126,7 @@ void resetplayerstats(int snum)
p->footprintshade = 0;
p->jumping_toggle = 0;
p->horizon.ZzOLDHORIZON = p->horizon.ZzHORIZON = DAngle::fromDeg(-17.354);
p->horizon.ohorizoff = p->horizon.horizoff = nullAngle;
p->horizon.ohorizoff = p->horizon.ZzHORIZOFF = nullAngle;
p->bobcounter = 0;
p->on_ground = 0;
p->player_par = 0;
Expand Down
2 changes: 1 addition & 1 deletion source/games/sw/src/player.cpp
Expand Up @@ -7083,7 +7083,7 @@ void InitAllPlayers(void)
pp->FadeAmt = 0;
pp->FadeTics = 0;
pp->StartColor = 0;
pp->horizon.horizoff = nullAngle;
pp->horizon.ZzHORIZOFF = nullAngle;

INITLIST(&pp->PanelSpriteList);
}
Expand Down

0 comments on commit d55ac0a

Please sign in to comment.