From 44c34072f98b44835b753f9bb1615ee6fc27b5ad Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 9 Dec 2022 13:16:10 -0800 Subject: [PATCH] Implement all simple operators in CCharAnimTime --- include/Kyoto/Animation/CCharAnimTime.hpp | 4 ++-- src/Kyoto/Animation/CCharAnimTime.cpp | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/include/Kyoto/Animation/CCharAnimTime.hpp b/include/Kyoto/Animation/CCharAnimTime.hpp index d8efe96a..bc2aad72 100644 --- a/include/Kyoto/Animation/CCharAnimTime.hpp +++ b/include/Kyoto/Animation/CCharAnimTime.hpp @@ -25,8 +25,8 @@ public: bool operator==(const CCharAnimTime& other) const; bool operator!=(const CCharAnimTime& other) const; bool operator<(const CCharAnimTime& other) const; - CCharAnimTime operator/(const CCharAnimTime& other) const; - CCharAnimTime operator*(const float& other) const; + float operator/(const CCharAnimTime& other) const; + float operator*(const float& other) const; CCharAnimTime operator-(const CCharAnimTime& other) const; CCharAnimTime operator+(const CCharAnimTime& other) const; const CCharAnimTime& operator+=(const CCharAnimTime& other); diff --git a/src/Kyoto/Animation/CCharAnimTime.cpp b/src/Kyoto/Animation/CCharAnimTime.cpp index 02fd7b37..7b401728 100644 --- a/src/Kyoto/Animation/CCharAnimTime.cpp +++ b/src/Kyoto/Animation/CCharAnimTime.cpp @@ -9,22 +9,29 @@ CCharAnimTime::CCharAnimTime(CInputStream& in) CCharAnimTime::CCharAnimTime(float time) : x0_time(time) { if (time == 0.f) { x4_type = kT_ZeroSteady; - return; + } else { + x4_type = kT_NonZero; } - x4_type = kT_NonZero; } bool CCharAnimTime::operator<(const CCharAnimTime& other) const {} bool CCharAnimTime::operator==(const CCharAnimTime& other) const {} -bool CCharAnimTime::operator!=(const CCharAnimTime& other) const {} +bool CCharAnimTime::operator!=(const CCharAnimTime& other) const { return !(*this == other); } -bool CCharAnimTime::operator>(const CCharAnimTime& other) const {} +bool CCharAnimTime::operator>(const CCharAnimTime& other) const { + return !(*this == other) && !(*this < other); +} -CCharAnimTime CCharAnimTime::operator/(const CCharAnimTime& other) const {} +float CCharAnimTime::operator/(const CCharAnimTime& other) const { + if (EqualsZero()) + return 0.f; -CCharAnimTime CCharAnimTime::operator*(const float& other) const {} + return x0_time / other.x0_time; +} + +float CCharAnimTime::operator*(const float& other) const {} CCharAnimTime CCharAnimTime::operator-(const CCharAnimTime& other) const {}