2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

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
This commit is contained in:
John Johns
2021-07-02 17:57:23 -07:00
parent d0f1e6f3e7
commit 4550451ae5
2 changed files with 15 additions and 5 deletions

View File

@ -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)

View File

@ -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;
}
} }
} }
} }