More CCharAnimTime RE

This commit is contained in:
Phillip Stephens 2016-02-26 22:03:39 -08:00
parent e1bcc64ba9
commit 45c76dc9c1
2 changed files with 164 additions and 15 deletions

View File

@ -0,0 +1,6 @@
#include "CCharAnimTime.hpp"
namespace pshag
{
}

View File

@ -6,30 +6,41 @@ namespace pshag
class CCharAnimTime class CCharAnimTime
{ {
float m_time; float m_time = 0.f;
int m_unk; // enum? int m_unk = 2; // enum?
public: public:
CCharAnimTime() = default;
CCharAnimTime(float time) CCharAnimTime(float time)
: m_time(time), : m_time(time),
m_unk(m_time != 0.0 ? 0 : 2) m_unk(m_time != 0.f ? 0 : 2)
{ {
} }
bool EqualsZero() bool EqualsZero() const
{ {
if (m_unk == 1 || m_unk == 2 || m_unk == 3) if (m_unk == 1 || m_unk == 2 || m_unk == 3)
return false; return false;
return (m_time == 0.0); return (m_time == 0.f);
} }
bool GreaterThanZero() bool GreaterThanZero() const
{ {
if (EqualsZero()) if (EqualsZero())
return false; return false;
return (m_time != 0.0); return (m_time > 0.f);
} }
#if 0 #if 1
bool operator ==(const CCharAnimTime& other) const
{
return false;
}
bool operator !=(const CCharAnimTime& other) const
{
return !(*this == other);
}
bool operator>=(const CCharAnimTime& other) bool operator>=(const CCharAnimTime& other)
{ {
if (*this == other) if (*this == other)
@ -46,15 +57,147 @@ public:
return (*this < other); return (*this < other);
} }
void operator*=(const CCharAnimTime& other) bool operator >(const CCharAnimTime& other) const
{ *this = *this * other; }
void operator+=(const CCharAnimTime& other)
{ *this = *this + other; }
void operator+(const CCharAnimTime& other)
{ {
return false;
} }
bool operator <(const CCharAnimTime& other) const
{
return false;
}
CCharAnimTime& operator*=(const CCharAnimTime& other)
{
*this = *this * other;
return *this;
}
CCharAnimTime& operator+=(const CCharAnimTime& other)
{
*this = *this + other;
return *this;
}
CCharAnimTime operator+(const CCharAnimTime& other)
{
if (m_unk == 4 && other.m_unk == 4)
{
if (other.m_time != m_time)
return CCharAnimTime();
return *this;
}
else if (m_unk == 4)
return *this;
else if (other.m_unk == 4)
return other;
if (!EqualsZero() || !other.EqualsZero())
return CCharAnimTime(m_time + other.m_time);
int type = -1;
if (m_unk != 3)
{
if (m_unk != 2)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_unk != 3)
{
if (other.m_unk != 2)
otherType = 1;
else
otherType = 0;
}
type += otherType;
if (type < 1)
otherType = 1;
else
otherType = type;
if (otherType < -1)
otherType = -1;
CCharAnimTime ret;
if (otherType == -1)
ret.m_unk = 3;
else if (otherType == 0)
ret.m_unk = 2;
else
ret.m_unk = 1;
return ret;
}
CCharAnimTime operator*(const CCharAnimTime& other)
{
if (m_unk == 4 && other.m_unk == 4)
{
if (other.m_time != m_time)
return CCharAnimTime();
return *this;
}
else if (m_unk == 4)
return *this;
else if (other.m_unk == 4)
return other;
if (!EqualsZero() || !other.EqualsZero())
return CCharAnimTime(m_time * other.m_time);
int type = -1;
if (m_unk != 3)
{
if (m_unk != 2)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_unk != 3)
{
if (other.m_unk != 2)
otherType = 1;
else
otherType = 0;
}
type += otherType;
if (type < 1)
otherType = 1;
else
otherType = type;
if (otherType < -1)
otherType = -1;
CCharAnimTime ret;
if (otherType == -1)
ret.m_unk = 3;
else if (otherType == 0)
ret.m_unk = 2;
else
ret.m_unk = 1;
}
CCharAnimTime operator*(const float& other)
{
return CCharAnimTime;
}
float operator/(const CCharAnimTime& other)
{
if (other.EqualsZero())
return 0.f;
return m_time / other.m_time;
}
#endif #endif
}; };
} }