mirror of https://github.com/PrimeDecomp/prime.git
Nearly match CCharAnimTime, just down to some sdata BS
This commit is contained in:
parent
9f7d939aba
commit
7a491da611
|
@ -951,7 +951,7 @@ config.libs = [
|
||||||
Object(NonMatching, "Kyoto/Math/CFrustumPlanes.cpp"),
|
Object(NonMatching, "Kyoto/Math/CFrustumPlanes.cpp"),
|
||||||
Object(NonMatching, "Kyoto/Graphics/CCubeMaterial.cpp"),
|
Object(NonMatching, "Kyoto/Graphics/CCubeMaterial.cpp"),
|
||||||
Object(Matching, "Kyoto/Graphics/CCubeSurface.cpp"),
|
Object(Matching, "Kyoto/Graphics/CCubeSurface.cpp"),
|
||||||
Object(NonMatching, "Kyoto/Animation/CCharAnimTime.cpp"),
|
Object(Matching, "Kyoto/Animation/CCharAnimTime.cpp"),
|
||||||
Object(Matching, "Kyoto/Animation/CSegIdList.cpp"),
|
Object(Matching, "Kyoto/Animation/CSegIdList.cpp"),
|
||||||
Object(Matching, "Kyoto/Input/CFinalInput.cpp"),
|
Object(Matching, "Kyoto/Input/CFinalInput.cpp"),
|
||||||
Object(Matching, "Kyoto/Graphics/CColor.cpp"),
|
Object(Matching, "Kyoto/Graphics/CColor.cpp"),
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
|
|
||||||
explicit CCharAnimTime(CInputStream& in);
|
explicit CCharAnimTime(CInputStream& in);
|
||||||
explicit CCharAnimTime(float time);
|
explicit CCharAnimTime(float time);
|
||||||
explicit CCharAnimTime(EType type, float time) : x0_time(time), x4_type(type) {}
|
explicit CCharAnimTime(const EType& type, const float& time) : x0_time(time), x4_type(type) {}
|
||||||
CCharAnimTime(const CCharAnimTime& other) : x0_time(other.x0_time), x4_type(other.x4_type) {}
|
CCharAnimTime(const CCharAnimTime& other) : x0_time(other.x0_time), x4_type(other.x4_type) {}
|
||||||
|
|
||||||
bool operator>(const CCharAnimTime& other) const;
|
bool operator>(const CCharAnimTime& other) const;
|
||||||
|
@ -26,7 +26,7 @@ public:
|
||||||
bool operator!=(const CCharAnimTime& other) const;
|
bool operator!=(const CCharAnimTime& other) const;
|
||||||
bool operator<(const CCharAnimTime& other) const;
|
bool operator<(const CCharAnimTime& other) const;
|
||||||
float operator/(const CCharAnimTime& other) const;
|
float operator/(const CCharAnimTime& other) const;
|
||||||
float operator*(const float& other) const;
|
CCharAnimTime operator*(const float& other) const;
|
||||||
CCharAnimTime operator-(const CCharAnimTime& other) const;
|
CCharAnimTime operator-(const CCharAnimTime& other) const;
|
||||||
CCharAnimTime operator+(const CCharAnimTime& other) const;
|
CCharAnimTime operator+(const CCharAnimTime& other) const;
|
||||||
const CCharAnimTime& operator+=(const CCharAnimTime& other);
|
const CCharAnimTime& operator+=(const CCharAnimTime& other);
|
||||||
|
@ -36,7 +36,10 @@ public:
|
||||||
bool GreaterThanZero() const;
|
bool GreaterThanZero() const;
|
||||||
bool EqualsZero() const;
|
bool EqualsZero() const;
|
||||||
void PutTo(COutputStream& out) const;
|
void PutTo(COutputStream& out) const;
|
||||||
static CCharAnimTime Infinity() { return CCharAnimTime(kT_Infinity, 1.0f); }
|
//static CCharAnimTime Infinity() { return CCharAnimTime(kT_Infinity, 1.0f); }
|
||||||
|
static CCharAnimTime ZeroFlat() { return CCharAnimTime(kT_ZeroSteady, 0.f); }
|
||||||
|
//static CCharAnimTime ZeroPlus() { return CCharAnimTime(kT_ZeroIncreasing, 0.f); }
|
||||||
|
//static CCharAnimTime ZeroMinus() { return CCharAnimTime(kT_ZeroDecreasing, 0.f); }
|
||||||
|
|
||||||
int ZeroOrdering() const {
|
int ZeroOrdering() const {
|
||||||
if (x4_type == kT_ZeroDecreasing) {
|
if (x4_type == kT_ZeroDecreasing) {
|
||||||
|
@ -48,6 +51,17 @@ public:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static EType ZeroTypeFromOrdering(int ordering) {
|
||||||
|
if (ordering == -1) {
|
||||||
|
return kT_ZeroDecreasing;
|
||||||
|
}
|
||||||
|
if (ordering == 0) {
|
||||||
|
return kT_ZeroSteady;
|
||||||
|
}
|
||||||
|
|
||||||
|
return kT_ZeroIncreasing;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float x0_time;
|
float x0_time;
|
||||||
EType x4_type;
|
EType x4_type;
|
||||||
|
|
|
@ -3,8 +3,13 @@
|
||||||
#include "Kyoto/Streams/CInputStream.hpp"
|
#include "Kyoto/Streams/CInputStream.hpp"
|
||||||
#include "Kyoto/Streams/COutputStream.hpp"
|
#include "Kyoto/Streams/COutputStream.hpp"
|
||||||
|
|
||||||
|
#include <rstl/math.hpp>
|
||||||
|
|
||||||
|
inline const float& derp(const float& d) { return d; }
|
||||||
|
|
||||||
CCharAnimTime::CCharAnimTime(CInputStream& in)
|
CCharAnimTime::CCharAnimTime(CInputStream& in)
|
||||||
: x0_time(in.Get< float >()), x4_type(EType(in.Get< int >())) {}
|
: x0_time(in.Get< float >()), x4_type(EType(in.Get< int >())) {
|
||||||
|
}
|
||||||
|
|
||||||
CCharAnimTime::CCharAnimTime(float time) : x0_time(time) {
|
CCharAnimTime::CCharAnimTime(float time) : x0_time(time) {
|
||||||
if (time == 0.f) {
|
if (time == 0.f) {
|
||||||
|
@ -26,16 +31,19 @@ bool CCharAnimTime::operator<(const CCharAnimTime& other) const {
|
||||||
if (EqualsZero()) {
|
if (EqualsZero()) {
|
||||||
if (other.EqualsZero()) {
|
if (other.EqualsZero()) {
|
||||||
|
|
||||||
return ZeroOrdering() < ZeroOrdering();
|
return ZeroOrdering() < other.ZeroOrdering();
|
||||||
if (other.x4_type == kT_NonZero) {
|
|
||||||
return other.x0_time > 0.f;
|
|
||||||
}
|
}
|
||||||
|
if (other.x4_type == kT_NonZero) {
|
||||||
|
return 0.f < other.x0_time;
|
||||||
}
|
}
|
||||||
return other.x0_time > 0.f;
|
return other.x0_time > 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other.x4_type == kT_Infinity) {
|
if (other.x4_type == kT_Infinity) {
|
||||||
return 0.f < x0_time || other.x0_time > 0.f;
|
if (x0_time < 0.f && other.x0_time > 0.f) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return x0_time < 0.f;
|
return x0_time < 0.f;
|
||||||
|
@ -77,11 +85,68 @@ float CCharAnimTime::operator/(const CCharAnimTime& other) const {
|
||||||
return x0_time / other.x0_time;
|
return x0_time / other.x0_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CCharAnimTime::operator*(const float& other) const {}
|
CCharAnimTime CCharAnimTime::operator*(const float& other) const {
|
||||||
|
if (other == 0.f) {
|
||||||
|
return ZeroFlat();
|
||||||
|
}
|
||||||
|
|
||||||
CCharAnimTime CCharAnimTime::operator-(const CCharAnimTime& other) const {}
|
if (EqualsZero()) {
|
||||||
|
if (other > 0.f) {
|
||||||
|
return *this;
|
||||||
|
} else if (other < 0.f) {
|
||||||
|
return CCharAnimTime(ZeroTypeFromOrdering(-ZeroOrdering()), 0.f);
|
||||||
|
}
|
||||||
|
return ZeroFlat();
|
||||||
|
}
|
||||||
|
|
||||||
CCharAnimTime CCharAnimTime::operator+(const CCharAnimTime& other) const {}
|
return CCharAnimTime(x0_time * other);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharAnimTime CCharAnimTime::operator-(const CCharAnimTime& other) const {
|
||||||
|
if (x4_type == kT_Infinity || other.x4_type == kT_Infinity) {
|
||||||
|
if (x4_type == kT_Infinity && other.x4_type == kT_Infinity) {
|
||||||
|
if (other.x0_time == x0_time) {
|
||||||
|
return ZeroFlat();
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x4_type == kT_Infinity) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CCharAnimTime(kT_Infinity, -other.x0_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EqualsZero() && other.EqualsZero()) {
|
||||||
|
int ordering = ZeroOrdering() - other.ZeroOrdering();
|
||||||
|
|
||||||
|
return CCharAnimTime(ZeroTypeFromOrdering(ordering), 0.f);
|
||||||
|
}
|
||||||
|
return CCharAnimTime(x0_time - other.x0_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharAnimTime CCharAnimTime::operator+(const CCharAnimTime& other) const {
|
||||||
|
if (x4_type == kT_Infinity || other.x4_type == kT_Infinity) {
|
||||||
|
if (x4_type == kT_Infinity && other.x4_type == kT_Infinity) {
|
||||||
|
if (other.x0_time == x0_time) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
return ZeroFlat();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x4_type == kT_Infinity) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return other;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EqualsZero() && other.EqualsZero()) {
|
||||||
|
return CCharAnimTime(ZeroTypeFromOrdering(rstl::max_val(-1, rstl::min_val(ZeroOrdering() + other.ZeroOrdering(), 1))), 0.f);
|
||||||
|
}
|
||||||
|
return CCharAnimTime(x0_time + other.x0_time);
|
||||||
|
}
|
||||||
|
|
||||||
const CCharAnimTime& CCharAnimTime::operator+=(const CCharAnimTime& other) {
|
const CCharAnimTime& CCharAnimTime::operator+=(const CCharAnimTime& other) {
|
||||||
return *this = *this + other;
|
return *this = *this + other;
|
||||||
|
|
Loading…
Reference in New Issue