diff --git a/src/actor.h b/src/actor.h index 846d1f0d9..137687e66 100644 --- a/src/actor.h +++ b/src/actor.h @@ -588,6 +588,36 @@ enum AMETA_BloodType3, // AxeBlood replacement type }; +struct fixedvec3 +{ + fixed_t x, y, z; + + operator FVector3() + { + return FVector3(FIXED2FLOAT(x), FIXED2FLOAT(y), FIXED2FLOAT(z)); + } + + operator TVector3() + { + return TVector3(FIXED2DBL(x), FIXED2DBL(y), FIXED2DBL(z)); + } +}; + +struct fixedvec2 +{ + fixed_t x, y; + + operator FVector2() + { + return FVector2(FIXED2FLOAT(x), FIXED2FLOAT(y)); + } + + operator TVector2() + { + return TVector2(FIXED2DBL(x), FIXED2DBL(y)); + } +}; + struct FDropItem { FName Name; @@ -909,6 +939,18 @@ public: return R_PointToAngle2(myx, myy, other->x, other->y); } + fixedvec2 Vec2To(AActor *other) const + { + fixedvec2 ret = { other->x - x, other->y - y }; + return ret; + } + + fixedvec3 Vec3To(AActor *other) const + { + fixedvec3 ret = { other->x - x, other->y - y, other->z - z }; + return ret; + } + inline void SetFriendPlayer(player_t *player); bool IsVisibleToPlayer() const;