- Duke: Reduce boilerplate from previous commit.

This commit is contained in:
Mitchell Richters 2023-03-16 22:24:34 +11:00
parent 9a17d33579
commit c4041affb1
3 changed files with 12 additions and 12 deletions

View file

@ -353,4 +353,14 @@ inline void processinputvel(int snum)
p->sync.svel = (float)velvect.Y;
}
inline void setPlayerActorViewZOffset(DDukeActor* const pact)
{
if (!PlayClock)
{
pact->spr.pos.Z += gs.playerheight;
pact->opos.Z += gs.playerheight;
pact->oviewzoffset = pact->viewzoffset = -gs.playerheight;
}
}
END_DUKE_NS

View file

@ -2620,12 +2620,7 @@ void processinput_d(int snum)
shrunk = (pact->spr.scale.Y < 0.5);
getzrange(p->GetActor()->getPosWithOffsetZ(), psectp, &ceilingz, chz, &floorz, clz, 10.1875, CLIPMASK0);
if (!PlayClock)
{
pact->spr.pos.Z += gs.playerheight;
pact->opos.Z += gs.playerheight;
pact->oviewzoffset = pact->viewzoffset = -gs.playerheight;
}
setPlayerActorViewZOffset(pact);
p->truefz = getflorzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());
p->truecz = getceilzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());

View file

@ -3244,12 +3244,7 @@ void processinput_r(int snum)
getzrange(p->GetActor()->getPosWithOffsetZ(), psectp, &ceilingz, chz, &floorz, clz, 0.25, CLIPMASK0);
}
if (!PlayClock)
{
pact->spr.pos.Z += gs.playerheight;
pact->opos.Z += gs.playerheight;
pact->oviewzoffset = pact->viewzoffset = -gs.playerheight;
}
setPlayerActorViewZOffset(pact);
p->truefz = getflorzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());
p->truecz = getceilzofslopeptr(psectp, p->GetActor()->getPosWithOffsetZ());