Particle/C*EPulse: Fix implementations

This commit is contained in:
Luke Street 2020-04-12 05:31:00 -04:00
parent 3c9fef492a
commit 5e748a0d7f
5 changed files with 42 additions and 45 deletions

View File

@ -123,17 +123,16 @@ bool CCEPulse::GetValue(int frame, zeus::CColor& valOut) const {
int a, b;
x4_aDuration->GetValue(frame, a);
x8_bDuration->GetValue(frame, b);
int cv = zeus::max(1, a + b + 1);
int cv = a + b + 1;
if (cv < 0) {
cv = 1;
}
if (b >= 1) {
int cv2 = frame % cv;
if (cv2 >= a)
x10_bVal->GetValue(frame, valOut);
else
xc_aVal->GetValue(frame, valOut);
} else
if (b < 1 || frame % cv <= a) {
xc_aVal->GetValue(frame, valOut);
} else {
x10_bVal->GetValue(frame, valOut);
}
return false;
}

View File

@ -158,17 +158,16 @@ bool CIEPulse::GetValue(int frame, int& valOut) const {
int a, b;
x4_aDuration->GetValue(frame, a);
x8_bDuration->GetValue(frame, b);
int cv = std::max(1, a + b + 1);
int cv = a + b + 1;
if (cv < 0) {
cv = 1;
}
if (b >= 1) {
int cv2 = frame % cv;
if (cv2 >= a)
x10_bVal->GetValue(frame, valOut);
else
xc_aVal->GetValue(frame, valOut);
} else
if (b < 1 || frame % cv <= a) {
xc_aVal->GetValue(frame, valOut);
} else {
x10_bVal->GetValue(frame, valOut);
}
return false;
}

View File

@ -202,17 +202,16 @@ bool CMVEPulse::GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos
int a, b;
x4_aDuration->GetValue(frame, a);
x8_bDuration->GetValue(frame, b);
int cv = std::max(1, a + b + 1);
int cv = a + b + 1;
if (cv < 0) {
cv = 1;
}
if (b >= 1) {
int cv2 = frame % cv;
if (cv2 >= a)
x10_bVal->GetValue(frame, pVel, pPos);
else
xc_aVal->GetValue(frame, pVel, pPos);
} else
if (b < 1 || frame % cv <= a) {
xc_aVal->GetValue(frame, pVel, pPos);
} else {
x10_bVal->GetValue(frame, pVel, pPos);
}
return false;
}

View File

@ -137,17 +137,18 @@ bool CREPulse::GetValue(int frame, float& valOut) const {
int a, b;
x4_aDuration->GetValue(frame, a);
x8_bDuration->GetValue(frame, b);
int cv = std::max(1, a + b + 1);
int cv = a + b + 1;
if (cv < 0) {
cv = 1;
}
if (b >= 1) {
int cv2 = frame % cv;
if (cv2 >= a)
x10_valB->GetValue(frame, valOut);
else
xc_valA->GetValue(frame, valOut);
} else
// CREPulse is an outlier here, the other
// IElement classes use <= instead of <.
if (b < 1 || frame % cv < a) {
xc_valA->GetValue(frame, valOut);
} else {
x10_valB->GetValue(frame, valOut);
}
return false;
}

View File

@ -227,17 +227,16 @@ bool CVEPulse::GetValue(int frame, zeus::CVector3f& valOut) const {
int a, b;
x4_aDuration->GetValue(frame, a);
x8_bDuration->GetValue(frame, b);
int cv = std::max(1, a + b + 1);
int cv = a + b + 1;
if (cv < 0) {
cv = 1;
}
if (b >= 1) {
int cv2 = frame % cv;
if (cv2 >= a)
x10_bVal->GetValue(frame, valOut);
else
xc_aVal->GetValue(frame, valOut);
} else
if (b < 1 || frame % cv <= a) {
xc_aVal->GetValue(frame, valOut);
} else {
x10_bVal->GetValue(frame, valOut);
}
return false;
}