Skip to content

Commit

Permalink
- added position utilities to player_struct.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Aug 9, 2022
1 parent 32cac46 commit a219ed3
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions source/games/duke/src/types.h
Expand Up @@ -358,6 +358,43 @@ struct player_struct
return cursector != nullptr;
}

void backuppos()
{
__int_opos = __int_pos;
}

void restorepos()
{
__int_pos = __int_opos;
}

void backupxy()
{
__int_opos.X = __int_pos.X;
__int_opos.Y = __int_pos.Y;
}

void backupz()
{
__int_opos.Z = __int_pos.Z;
}

void setbobpos()
{
bobpos = __int_pos.vec2;
}

void getposfromactor(DCoreActor* actor, double addz = 0)
{
__int_pos = actor->int_pos();
if (addz) __int_pos.Z += int(addz * worldtoint);
}

void getxyfromactor(DCoreActor* actor)
{
__int_pos.X = actor->int_pos().X;
__int_pos.Y = actor->int_pos().Y;
}

vec3_t player_int_pos() const
{
Expand Down

0 comments on commit a219ed3

Please sign in to comment.