Decouple Animations from Gamelogi (Smooth Animations for skipped Frames).
NewPlrAnim: Use default arguments instead of overloads StartPlrHit: Fix skippedAnimationFrames - Frames starts with 1 Add missing comment for StartPlrHit Fix GotHit-Animation: Skipping Frames corrected and adjusted _pAnimGameTicksSinceSequenceStarted for animations that don't start with a additional tick. Thanks @StephenCWills for the gothit skipping frame calculation logic :-) Update StartWalk: calculated numSkippedFrames in own line. Co-authored-by: Anders Jenbo <anders@jenbo.dk> StartPlrHit: always initialize skippedAnimationFrames Co-authored-by: Anders Jenbo <anders@jenbo.dk> Update nthread_GetProgressToNextGameTick comment Co-authored-by: Anders Jenbo <anders@jenbo.dk> fix spelling "lenght" instead of "length" Update NewPlrAnim comment Co-authored-by: Anders Jenbo <anders@jenbo.dk> GetFrameToUseForPlayerRendering: avoid one "else"
This commit is contained in:
parent
28ad9d43c5
commit
c7b9ffec1f
6 changed files with 159 additions and 29 deletions
|
|
@ -242,4 +242,21 @@ bool nthread_has_500ms_passed()
|
|||
return ticksElapsed >= 0;
|
||||
}
|
||||
|
||||
float nthread_GetProgressToNextGameTick()
|
||||
{
|
||||
if (!gbRunGame || PauseMode || (!gbIsMultiplayer && gmenu_is_active())) // if game is not running or paused there is no next gametick in the near future
|
||||
return 0.0f;
|
||||
int currentTickCount = SDL_GetTicks();
|
||||
int ticksElapsed = last_tick - currentTickCount;
|
||||
if (ticksElapsed <= 0)
|
||||
return 1.0f; // game tick is due
|
||||
int ticksAdvanced = gnTickDelay - ticksElapsed;
|
||||
float percent = (float)ticksAdvanced / (float)gnTickDelay;
|
||||
if (percent > 1.0f)
|
||||
return 1.0f;
|
||||
if (percent < 0.0f)
|
||||
return 0.0f;
|
||||
return percent;
|
||||
}
|
||||
|
||||
} // namespace devilution
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue