metaforce/Runtime/Character/CCharAnimTime.hpp

66 lines
1.8 KiB
C++
Raw Normal View History

2016-04-13 06:07:23 +00:00
#ifndef __URDE_CCHARANIMTIME_HPP__
#define __URDE_CCHARANIMTIME_HPP__
2015-08-18 05:54:43 +00:00
2016-04-11 07:10:28 +00:00
#include "IOStreams.hpp"
2016-04-11 03:59:54 +00:00
2017-12-30 01:09:45 +00:00
#undef min
#undef max
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-18 05:54:43 +00:00
{
class CCharAnimTime
{
2016-09-14 05:45:46 +00:00
public:
enum class EType
2016-04-11 03:59:54 +00:00
{
NonZero,
ZeroIncreasing,
ZeroSteady,
ZeroDecreasing,
Infinity
2016-09-14 05:45:46 +00:00
};
private:
float x0_time = 0.f;
EType x4_type = EType::ZeroSteady;
public:
2016-02-27 06:03:39 +00:00
CCharAnimTime() = default;
2016-04-11 07:10:28 +00:00
CCharAnimTime(CInputStream& in)
2016-09-14 05:45:46 +00:00
: x0_time(in.readFloatBig()),
x4_type(EType(in.readUint32Big())) {}
CCharAnimTime(float time)
2016-09-14 05:45:46 +00:00
: x0_time(time),
x4_type(x0_time != 0.f ? EType::NonZero : EType::ZeroSteady) {}
CCharAnimTime(EType type, const float& t)
: x0_time(t)
, x4_type(type)
{
}
2016-04-11 03:59:54 +00:00
static CCharAnimTime Infinity();
2017-07-10 04:55:51 +00:00
float GetSeconds() const { return x0_time; }
2016-04-11 03:59:54 +00:00
bool EqualsZero() const;
2016-08-21 20:39:18 +00:00
bool EpsilonZero() const;
2016-04-11 03:59:54 +00:00
bool GreaterThanZero() const;
bool operator ==(const CCharAnimTime& other) const;
bool operator !=(const CCharAnimTime& other) const;
2017-07-10 04:55:51 +00:00
bool operator>=(const CCharAnimTime& other) const;
bool operator<=(const CCharAnimTime& other) const;
2016-04-11 03:59:54 +00:00
bool operator >(const CCharAnimTime& other) const;
bool operator <(const CCharAnimTime& other) const;
CCharAnimTime& operator*=(const CCharAnimTime& other);
CCharAnimTime& operator+=(const CCharAnimTime& other);
2017-07-10 04:55:51 +00:00
CCharAnimTime operator+(const CCharAnimTime& other) const;
2016-04-11 03:59:54 +00:00
CCharAnimTime& operator-=(const CCharAnimTime& other);
2017-07-10 04:55:51 +00:00
CCharAnimTime operator-(const CCharAnimTime& other) const;
CCharAnimTime operator*(const CCharAnimTime& other) const;
CCharAnimTime operator*(const float& other) const;
float operator/(const CCharAnimTime& other) const;
};
2015-08-18 05:54:43 +00:00
}
2016-04-13 06:07:23 +00:00
#endif // __URDE_CCHARANIMTIME_HPP__