2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 03:47:43 +00:00

Various imps and stubs

This commit is contained in:
2016-09-13 22:45:46 -07:00
parent 8b23c0538e
commit c20eb76189
26 changed files with 479 additions and 134 deletions

View File

@@ -9,36 +9,36 @@ namespace urde
CCharAnimTime CCharAnimTime::Infinity()
{
CCharAnimTime ret(1.f);
ret.m_type = Type::Infinity;
ret.x4_type = EType::Infinity;
return ret;
}
bool CCharAnimTime::EqualsZero() const
{
if (m_type == Type::ZeroIncreasing || m_type == Type::ZeroSteady || m_type == Type::ZeroDecreasing)
if (x4_type == EType::ZeroIncreasing || x4_type == EType::ZeroSteady || x4_type == EType::ZeroDecreasing)
return false;
return (m_time == 0.f);
return (x0_time == 0.f);
}
bool CCharAnimTime::EpsilonZero() const
{
return (std::fabs(m_time) < FLT_EPSILON);
return (std::fabs(x0_time) < FLT_EPSILON);
}
bool CCharAnimTime::GreaterThanZero() const
{
if (EqualsZero())
return false;
return (m_time > 0.f);
return (x0_time > 0.f);
}
bool CCharAnimTime::operator ==(const CCharAnimTime& other) const
{
if (m_type == Type::NonZero)
if (x4_type == EType::NonZero)
{
if (other.m_type == Type::NonZero)
return m_time == other.m_time;
if (other.x4_type == EType::NonZero)
return x0_time == other.x0_time;
return !other.EqualsZero();
}
@@ -47,18 +47,18 @@ bool CCharAnimTime::operator ==(const CCharAnimTime& other) const
if (other.EqualsZero())
{
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@@ -69,8 +69,8 @@ bool CCharAnimTime::operator ==(const CCharAnimTime& other) const
return false;
}
if (other.m_type == Type::Infinity)
return m_time * other.m_time < 0.f;
if (other.x4_type == EType::Infinity)
return x0_time * other.x0_time < 0.f;
return false;
}
@@ -103,14 +103,14 @@ bool CCharAnimTime::operator >(const CCharAnimTime& other) const
bool CCharAnimTime::operator <(const CCharAnimTime& other) const
{
if (m_type == Type::NonZero)
if (x4_type == EType::NonZero)
{
if (other.m_type == Type::NonZero)
return m_time < other.m_time;
if (other.x4_type == EType::NonZero)
return x0_time < other.x0_time;
if (other.EqualsZero())
return m_time < 0.f;
return x0_time < 0.f;
else
return other.m_time > 0.f;
return other.x0_time > 0.f;
}
if (EqualsZero())
@@ -118,18 +118,18 @@ bool CCharAnimTime::operator <(const CCharAnimTime& other) const
if (other.EqualsZero())
{
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@@ -138,15 +138,15 @@ bool CCharAnimTime::operator <(const CCharAnimTime& other) const
return type < otherType;
}
if (other.m_type == Type::NonZero)
return other.m_time > 0.f;
return other.m_time < 0.f;
if (other.x4_type == EType::NonZero)
return other.x0_time > 0.f;
return other.x0_time < 0.f;
}
else
{
if (m_type == Type::Infinity)
return m_time < 0.f && other.m_time > 0.f;
return m_time < other.m_time;
if (x4_type == EType::Infinity)
return x0_time < 0.f && other.x0_time > 0.f;
return x0_time < other.x0_time;
}
}
@@ -164,33 +164,33 @@ CCharAnimTime& CCharAnimTime::operator+=(const CCharAnimTime& other)
CCharAnimTime CCharAnimTime::operator+(const CCharAnimTime& other)
{
if (m_type == Type::Infinity && other.m_type == Type::Infinity)
if (x4_type == EType::Infinity && other.x4_type == EType::Infinity)
{
if (other.m_time != m_time)
if (other.x0_time != x0_time)
return CCharAnimTime();
return *this;
}
else if (m_type == Type::Infinity)
else if (x4_type == EType::Infinity)
return *this;
else if (other.m_type == Type::Infinity)
else if (other.x4_type == EType::Infinity)
return other;
if (!EqualsZero() || !other.EqualsZero())
return CCharAnimTime(m_time + other.m_time);
return CCharAnimTime(x0_time + other.x0_time);
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@@ -201,11 +201,11 @@ CCharAnimTime CCharAnimTime::operator+(const CCharAnimTime& other)
CCharAnimTime ret;
if (otherType == -1)
ret.m_type = Type::ZeroDecreasing;
ret.x4_type = EType::ZeroDecreasing;
else if (otherType == 0)
ret.m_type = Type::ZeroSteady;
ret.x4_type = EType::ZeroSteady;
else
ret.m_type = Type::ZeroIncreasing;
ret.x4_type = EType::ZeroIncreasing;
return ret;
}
@@ -218,37 +218,37 @@ CCharAnimTime& CCharAnimTime::operator-=(const CCharAnimTime& other)
CCharAnimTime CCharAnimTime::operator-(const CCharAnimTime& other)
{
if (m_type == Type::Infinity && other.m_type == Type::Infinity)
if (x4_type == EType::Infinity && other.x4_type == EType::Infinity)
{
if (other.m_time == m_time)
if (other.x0_time == x0_time)
return CCharAnimTime();
return *this;
}
else if (m_type == Type::Infinity)
else if (x4_type == EType::Infinity)
return *this;
else if (other.m_type == Type::Infinity)
else if (other.x4_type == EType::Infinity)
{
CCharAnimTime ret(-other.m_time);
ret.m_type = Type::Infinity;
CCharAnimTime ret(-other.x0_time);
ret.x4_type = EType::Infinity;
return ret;
}
if (!EqualsZero() || !other.EqualsZero())
return CCharAnimTime(m_time - other.m_time);
return CCharAnimTime(x0_time - other.x0_time);
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@@ -257,44 +257,44 @@ CCharAnimTime CCharAnimTime::operator-(const CCharAnimTime& other)
CCharAnimTime ret;
type -= otherType;
if (type == -1)
ret.m_type = Type::ZeroDecreasing;
ret.x4_type = EType::ZeroDecreasing;
else if (type == 0)
ret.m_type = Type::ZeroSteady;
ret.x4_type = EType::ZeroSteady;
else
ret.m_type = Type::ZeroIncreasing;
ret.x4_type = EType::ZeroIncreasing;
return ret;
}
CCharAnimTime CCharAnimTime::operator*(const CCharAnimTime& other)
{
if (m_type == Type::Infinity && other.m_type == Type::Infinity)
if (x4_type == EType::Infinity && other.x4_type == EType::Infinity)
{
if (other.m_time != m_time)
if (other.x0_time != x0_time)
return CCharAnimTime();
return *this;
}
else if (m_type == Type::Infinity)
else if (x4_type == EType::Infinity)
return *this;
else if (other.m_type == Type::Infinity)
else if (other.x4_type == EType::Infinity)
return other;
if (!EqualsZero() || !other.EqualsZero())
return CCharAnimTime(m_time * other.m_time);
return CCharAnimTime(x0_time * other.x0_time);
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@@ -305,11 +305,11 @@ CCharAnimTime CCharAnimTime::operator*(const CCharAnimTime& other)
CCharAnimTime ret;
if (otherType == -1)
ret.m_type = Type::ZeroDecreasing;
ret.x4_type = EType::ZeroDecreasing;
else if (otherType == 0)
ret.m_type = Type::ZeroSteady;
ret.x4_type = EType::ZeroSteady;
else
ret.m_type = Type::ZeroIncreasing;
ret.x4_type = EType::ZeroIncreasing;
return ret;
}
@@ -320,14 +320,14 @@ CCharAnimTime CCharAnimTime::operator*(const float& other)
return ret;
if (!EqualsZero())
return CCharAnimTime(m_time * other);
return CCharAnimTime(x0_time * other);
if (other > 0.f)
return *this;
else if (other == 0.f)
return ret;
ret.m_type = m_type;
ret.x4_type = x4_type;
return ret;
}
@@ -336,7 +336,7 @@ float CCharAnimTime::operator/(const CCharAnimTime& other)
if (other.EqualsZero())
return 0.f;
return m_time / other.m_time;
return x0_time / other.x0_time;
}
}