metaforce/Runtime/Character/CCharAnimTime.hpp

47 lines
1.5 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
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
2018-12-08 05:30:43 +00:00
namespace urde {
2015-08-18 05:54:43 +00:00
2018-12-08 05:30:43 +00:00
class CCharAnimTime {
2016-09-14 05:45:46 +00:00
public:
2018-12-08 05:30:43 +00:00
enum class EType { NonZero, ZeroIncreasing, ZeroSteady, ZeroDecreasing, Infinity };
2016-09-14 05:45:46 +00:00
private:
2018-12-08 05:30:43 +00:00
float x0_time = 0.f;
EType x4_type = EType::ZeroSteady;
2017-07-10 04:55:51 +00:00
2018-12-08 05:30:43 +00:00
public:
CCharAnimTime() = default;
CCharAnimTime(CInputStream& in) : x0_time(in.readFloatBig()), x4_type(EType(in.readUint32Big())) {}
CCharAnimTime(float time) : 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) {}
static CCharAnimTime Infinity();
float GetSeconds() const { return x0_time; }
bool EqualsZero() const;
bool EpsilonZero() const;
bool GreaterThanZero() const;
bool operator==(const CCharAnimTime& other) const;
bool operator!=(const CCharAnimTime& other) const;
bool operator>=(const CCharAnimTime& other) const;
bool operator<=(const CCharAnimTime& other) const;
bool operator>(const CCharAnimTime& other) const;
bool operator<(const CCharAnimTime& other) const;
CCharAnimTime& operator*=(const CCharAnimTime& other);
CCharAnimTime& operator+=(const CCharAnimTime& other);
CCharAnimTime operator+(const CCharAnimTime& other) const;
CCharAnimTime& operator-=(const CCharAnimTime& other);
CCharAnimTime operator-(const CCharAnimTime& other) const;
CCharAnimTime operator*(const CCharAnimTime& other) const;
CCharAnimTime operator*(const float& other) const;
float operator/(const CCharAnimTime& other) const;
};
2018-12-08 05:30:43 +00:00
} // namespace urde