- Duke: Wrap calls that add to player_struct::PlayerNowPosition.

* The only adds were from DVector2 objects.
This commit is contained in:
Mitchell Richters 2022-11-21 13:26:06 +11:00 committed by Christoph Oelckers
parent 58381c6eca
commit a6a4cefa6c
3 changed files with 12 additions and 4 deletions

View file

@ -2209,7 +2209,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
auto psp = ps[p].GetActor();
if (psp->sector() == actor->sector())
{
ps[p].PlayerNowPosition += vect;
ps[p].posAdd(vect);
if (numplayers > 1)
{
@ -2336,7 +2336,7 @@ void handle_se02(DDukeActor* actor)
for (int p = connecthead; p >= 0; p = connectpoint2[p])
if (ps[p].cursector == actor->sector() && ps[p].on_ground)
{
ps[p].PlayerNowPosition += vect;
ps[p].posAdd(vect);
ps[p].bobpos += vect;
}
@ -3346,7 +3346,7 @@ void handle_se20(DDukeActor* actor)
for (int p = connecthead; p >= 0; p = connectpoint2[p])
if (ps[p].cursector == actor->sector() && ps[p].on_ground)
{
ps[p].PlayerNowPosition += vec;
ps[p].posAdd(vec);
ps[p].backupxy();
SetActor(ps[p].GetActor(), ps[p].PlayerNowPosition.plusZ(gs.playerheight));

View file

@ -388,6 +388,14 @@ struct player_struct
{
PlayerNowPosition = val;
}
void posAdd(const DVector3& val)
{
PlayerNowPosition += val;
}
void posAdd(const DVector2& val)
{
PlayerNowPosition.XY() += val;
}
};
struct Cycler

View file

@ -718,7 +718,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, setpos, dukeplayer_setpos)
void dukeplayer_addpos(player_struct* self, double x, double y, double z)
{
self->pos += { x, y, z };
self->posAdd({ x, y, z });
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addpos, dukeplayer_addpos)