metaforce/Runtime/Character/CCharAnimTime.hpp

46 lines
1.6 KiB
C++
Raw Permalink Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2015-08-18 05:54:43 +00:00
#include "Runtime/IOStreams.hpp"
2016-04-11 03:59:54 +00:00
2017-12-30 01:09:45 +00:00
#undef min
#undef max
2021-04-10 08:42:06 +00:00
namespace metaforce {
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:
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) {}
explicit CCharAnimTime(CInputStream& in) : x0_time(in.readFloatBig()), x4_type(EType(in.readUint32Big())) {}
2018-12-08 05:30:43 +00:00
static constexpr CCharAnimTime Infinity() { return {EType::Infinity, 1.0f}; }
2018-12-08 05:30:43 +00: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;
};
2021-04-10 08:42:06 +00:00
} // namespace metaforce