- wrapped access to the current 'move' values read from CON.

This commit is contained in:
Christoph Oelckers 2022-12-17 09:49:11 +01:00
parent c76c511da2
commit 94b676bd7c
5 changed files with 24 additions and 12 deletions

View file

@ -3256,10 +3256,10 @@ void alterang(int ang, DDukeActor* actor, int playernum)
aang = actor->spr.Angles.Yaw;
actor->vel.X += (moveptr[0] / 16 - actor->vel.X) / 5;
actor->vel.X += (actor->GetMoveX() - actor->vel.X) / 5;
if (actor->vel.Z < (648 / 256.))
{
actor->vel.Z += (moveptr[1] / 16 - actor->vel.Z) / 5;
actor->vel.Z += (actor->GetMoveZ() - actor->vel.Z) / 5;
}
if (isRRRA() && (ang & windang))

View file

@ -1195,10 +1195,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
return;
}
auto moveptr = &ScriptCode[actor->temp_data[1]];
if (a & geth) actor->vel.X += (moveptr[0] / 16. - actor->vel.X) * 0.5;
if (a & getv) actor->vel.Z += (moveptr[1] / 16. - actor->vel.Z) * 0.5;
if (a & geth) actor->vel.X += (actor->GetMoveX() - actor->vel.X) * 0.5;
if (a & getv) actor->vel.Z += (actor->GetMoveZ() - actor->vel.Z) * 0.5;
if (a & dodgebullet)
dodge(actor);
@ -1295,7 +1293,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
}
else if (!(actor->flags2 & SFLAG2_FLOATING))
{
if (!*(moveptr + 1))
if (actor->GetMoveZ() == 0)
{
if (actor->opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{

View file

@ -1346,10 +1346,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
return;
}
auto moveptr = &ScriptCode[actor->temp_data[1]];
if (a & geth) actor->vel.X += (moveptr[0] / 16. - actor->vel.X) * 0.5;
if (a & getv) actor->vel.Z += (moveptr[1] / 16. - actor->vel.Z) * 0.5;
if (a & geth) actor->vel.X += (actor->GetMoveX() - actor->vel.X) * 0.5;
if (a & getv) actor->vel.Z += (actor->GetMoveZ() - actor->vel.Z) * 0.5;
if (a & dodgebullet)
dodge(actor);
@ -1422,7 +1420,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
}
else if (!(actor->flags2 & SFLAG2_FLOATING))
{
if (!*(moveptr + 1))
if (actor->GetMoveZ() == 0)
{
if (actor->opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
{

View file

@ -314,6 +314,18 @@ inline void processinputvel(int snum)
p->sync.svel = (float)velvect.Y;
}
inline double DDukeActor::GetMoveX() const
{
auto moveptr = &ScriptCode[temp_data[1]];
return moveptr[0] / 16.;
}
inline double DDukeActor::GetMoveZ() const
{
auto moveptr = &ScriptCode[temp_data[1]];
return moveptr[1] / 16.;
}
inline void setPlayerActorViewZOffset(DDukeActor* const pact)
{
if (!PlayClock)

View file

@ -135,6 +135,10 @@ public:
clipdist = spr.scale.X * tex->GetDisplayWidth() * 0.125;
}
// Wrappers around CON data.
double GetMoveX() const;
double GetMoveZ() const;
};
// subclassed to add a game specific actor() method