Browse Source

Fix things that framerate unlock will expose

Hoikas pointed these out to me
https://github.com/H-uru/Plasma/pull/503
https://github.com/H-uru/Plasma/pull/505
tickets/08/8/1
John Johns 4 years ago
parent
commit
4550451ae5
  1. 2
      Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp
  2. 14
      Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp

2
Sources/Plasma/PubUtilLib/plInterp/hsInterp.cpp

@ -404,7 +404,7 @@ void hsInterp::GetBoundaryKeyFrames(hsScalar time, UInt32 numKeys, void *keys, U
{ {
hsAssert(numKeys>1, "Must have more than 1 keyframe"); hsAssert(numKeys>1, "Must have more than 1 keyframe");
int k1, k2; int k1, k2;
UInt16 frame = (UInt16)(time * MAX_FRAMES_PER_SEC); float frame = (time * MAX_FRAMES_PER_SEC);
// boundary case, past end // boundary case, past end
if (frame > GetKey(numKeys-1, keys, size)->fFrame) if (frame > GetKey(numKeys-1, keys, size)->fFrame)

14
Sources/Plasma/PubUtilLib/plInterp/plAnimTimeConvert.cpp

@ -557,11 +557,16 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs)
{ {
if (secs > fLoopEnd) if (secs > fLoopEnd)
{ {
secs = fmodf(secs - fLoopBegin, fLoopEnd - fLoopBegin) + fLoopBegin; float result = fmodf(secs - fLoopBegin, fLoopEnd - fLoopBegin) + fLoopBegin;
// if fLoopBegin == fLoopEnd == 0, result will not be a number
if (!isnan(result))
{
secs = result;
wrapped = true; wrapped = true;
} }
} }
} }
}
else else
{ {
if (IGetLatestState()->fStartAnimTime < fLoopBegin) if (IGetLatestState()->fStartAnimTime < fLoopBegin)
@ -576,11 +581,16 @@ hsScalar plAnimTimeConvert::WorldToAnimTime(double wSecs)
{ {
if (secs < fLoopBegin) if (secs < fLoopBegin)
{ {
secs = fLoopEnd - fmodf(fLoopEnd - secs, fLoopEnd - fLoopBegin); float result = fLoopEnd - fmodf(fLoopEnd - secs, fLoopEnd - fLoopBegin);
// if fLoopBegin == fLoopEnd == 0, result will not be a number
if (!isnan(result))
{
secs = result;
wrapped = true; wrapped = true;
} }
} }
} }
}
if (fFlags & kWrap) if (fFlags & kWrap)
{ {

Loading…
Cancel
Save