2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2015-08-17 22:54:43 -07:00
|
|
|
|
2019-09-27 19:53:03 -07:00
|
|
|
#include "Runtime/IOStreams.hpp"
|
2016-04-10 20:59:54 -07:00
|
|
|
|
2017-12-29 17:09:45 -08:00
|
|
|
#undef min
|
|
|
|
#undef max
|
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2015-08-17 22:54:43 -07:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
class CCharAnimTime {
|
2016-09-13 22:45:46 -07:00
|
|
|
public:
|
2018-12-07 21:30:43 -08:00
|
|
|
enum class EType { NonZero, ZeroIncreasing, ZeroSteady, ZeroDecreasing, Infinity };
|
|
|
|
|
2016-09-13 22:45:46 -07:00
|
|
|
private:
|
2018-12-07 21:30:43 -08:00
|
|
|
float x0_time = 0.f;
|
|
|
|
EType x4_type = EType::ZeroSteady;
|
2017-07-09 21:55:51 -07:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
public:
|
2020-03-15 16:34:41 -07:00
|
|
|
constexpr CCharAnimTime() = default;
|
|
|
|
constexpr CCharAnimTime(float time) : x0_time(time), x4_type(x0_time != 0.f ? EType::NonZero : EType::ZeroSteady) {}
|
|
|
|
constexpr CCharAnimTime(EType type, float t) : x0_time(t), x4_type(type) {}
|
2022-02-17 23:37:54 -08:00
|
|
|
explicit CCharAnimTime(CInputStream& in) : x0_time(in.ReadFloat()), x4_type(EType(in.ReadLong())) {}
|
2018-12-07 21:30:43 -08:00
|
|
|
|
2020-03-15 16:34:41 -07:00
|
|
|
static constexpr CCharAnimTime Infinity() { return {EType::Infinity, 1.0f}; }
|
2018-12-07 21:30:43 -08:00
|
|
|
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;
|
2016-01-04 16:48:10 -08:00
|
|
|
};
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|