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. 18
      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)

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

@ -557,8 +557,13 @@ 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;
wrapped = true; // if fLoopBegin == fLoopEnd == 0, result will not be a number
if (!isnan(result))
{
secs = result;
wrapped = true;
}
} }
} }
} }
@ -576,8 +581,13 @@ 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);
wrapped = true; // if fLoopBegin == fLoopEnd == 0, result will not be a number
if (!isnan(result))
{
secs = result;
wrapped = true;
}
} }
} }
} }

Loading…
Cancel
Save