Almost match CPlayerGun::TakeDamage

Former-commit-id: fbfdc6cd09
This commit is contained in:
Henrique Gemignani Passos Lima
2022-10-10 22:15:26 +03:00
parent 3b463154be
commit ac0ac6abb4
10 changed files with 94 additions and 10 deletions

View File

@@ -33,6 +33,17 @@ public:
static CRelAngle FromDegrees(float deg) { return CRelAngle(deg * (M_PIF / 180.f)); }
static CRelAngle FromRadians(float rad) { return CRelAngle(rad); }
// Relative
static float MakeRelativeAngle(float angle) {
float ret = angle - ((float)(int)(angle * (1.f / (2.f * M_PIF)))) * (2.f * M_PIF);
if (ret < 0.f)
ret += 2.f * M_PIF;
return ret;
}
CRelAngle AsRelative() const { return CRelAngle(MakeRelativeAngle(x0_angle)); }
private:
CRelAngle(float rad) : x0_angle(rad) {}