metaforce/Runtime/Character/CCharAnimTime.hpp

207 lines
4.1 KiB
C++
Raw Normal View History

2016-02-13 09:02:47 +00:00
#ifndef __PSHAG_CCHARANIMTIME_HPP__
#define __PSHAG_CCHARANIMTIME_HPP__
2015-08-18 05:54:43 +00:00
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-18 05:54:43 +00:00
{
class CCharAnimTime
{
2016-02-27 06:03:39 +00:00
float m_time = 0.f;
int m_unk = 2; // enum?
public:
2016-02-27 06:03:39 +00:00
CCharAnimTime() = default;
CCharAnimTime(float time)
: m_time(time),
2016-02-27 06:03:39 +00:00
m_unk(m_time != 0.f ? 0 : 2)
{
}
2016-02-27 06:03:39 +00:00
bool EqualsZero() const
{
if (m_unk == 1 || m_unk == 2 || m_unk == 3)
return false;
2016-02-27 06:03:39 +00:00
return (m_time == 0.f);
}
2016-02-27 06:03:39 +00:00
bool GreaterThanZero() const
{
if (EqualsZero())
return false;
2016-02-27 06:03:39 +00:00
return (m_time > 0.f);
}
2016-02-27 06:03:39 +00:00
#if 1
bool operator ==(const CCharAnimTime& other) const
{
return false;
}
bool operator !=(const CCharAnimTime& other) const
{
return !(*this == other);
}
bool operator>=(const CCharAnimTime& other)
{
if (*this == other)
return true;
return (*this > other);
}
2015-08-18 05:54:43 +00:00
bool operator<=(const CCharAnimTime& other)
{
if (*this == other)
return true;
return (*this < other);
}
2016-02-27 06:03:39 +00:00
bool operator >(const CCharAnimTime& other) const
{
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);
2016-02-27 06:03:39 +00:00
int type = -1;
if (m_unk != 3)
{
if (m_unk != 2)
type = 1;
else
type = 0;
}
2016-02-27 06:03:39 +00:00
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;
2016-02-27 06:03:39 +00:00
}
CCharAnimTime operator*(const float& other)
{
return CCharAnimTime();
}
2016-02-27 06:03:39 +00:00
float operator/(const CCharAnimTime& other)
{
if (other.EqualsZero())
return 0.f;
return m_time / other.m_time;
}
#endif
};
2015-08-18 05:54:43 +00:00
}
2016-02-13 09:02:47 +00:00
#endif // __PSHAG_CCHARANIMTIME_HPP__