Skip to content

Commit

Permalink
FINALLY match and link CCharAnimTime
Browse files Browse the repository at this point in the history
  • Loading branch information
Antidote committed Mar 20, 2024
1 parent 1e7dc88 commit fb1a193
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ def Rel(lib_name, objects):
Object(NonMatching, "Kyoto/Math/CFrustumPlanes.cpp"),
Object(NonMatching, "Kyoto/Graphics/CCubeMaterial.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/Input/CFinalInput.cpp"),
Object(Matching, "Kyoto/Graphics/CColor.cpp"),
Expand Down
15 changes: 12 additions & 3 deletions include/Kyoto/Animation/CCharAnimTime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class CCharAnimTime {
bool GreaterThanZero() const;
bool EqualsZero() 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); }
static CCharAnimTime ZeroPlus() { return CCharAnimTime(kT_ZeroIncreasing, 0.f); }
static CCharAnimTime ZeroMinus() { return CCharAnimTime(kT_ZeroDecreasing, 0.f); }

int ZeroOrdering() const {
if (x4_type == kT_ZeroDecreasing) {
Expand All @@ -62,6 +62,15 @@ class CCharAnimTime {
return kT_ZeroIncreasing;
}

CCharAnimTime ZeroSignScale(float other) const {
if (other > 0.f) {
return *this;
} else if (other < 0.f) {
return CCharAnimTime(ZeroTypeFromOrdering(-ZeroOrdering()), 0.f);
}
return ZeroFlat();
}

private:
float x0_time;
EType x4_type;
Expand Down
7 changes: 1 addition & 6 deletions src/Kyoto/Animation/CCharAnimTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ CCharAnimTime CCharAnimTime::operator*(const float& other) const {
}

if (EqualsZero()) {
if (other > 0.f) {
return *this;
} else if (other < 0.f) {
return CCharAnimTime(ZeroTypeFromOrdering(-ZeroOrdering()), 0.f);
}
return ZeroFlat();
return ZeroSignScale(other);
}

return CCharAnimTime(x0_time * other);
Expand Down

0 comments on commit fb1a193

Please sign in to comment.