Skip to content

Commit

Permalink
quick fix for interpolation, TODO better fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 committed Sep 13, 2024
1 parent 7f9cf48 commit 545064f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/playsim/p_actionfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5176,9 +5176,23 @@ void SetAnimationInternal(AActor * self, FName animName, double framerate, int s
return;
}


if(self->modelData->curAnim.startTic > tic)
{ // force instant switch if interpolating
flags |= SAF_INSTANT;
}

if(!(flags & SAF_INSTANT))
{
self->modelData->prevAnim = self->modelData->curAnim;

bool looped = false;
self->modelData->prevAnim.startFrame = getCurrentFrame(self->modelData->prevAnim, tic, &looped);

if(!looped)
{
self->modelData->prevAnim.flags &= ~ANIMOVERRIDE_LOOP;
}
}

int animEnd = mdl->FindLastFrame(animName);
Expand Down Expand Up @@ -5218,14 +5232,6 @@ void SetAnimationInternal(AActor * self, FName animName, double framerate, int s

if(!(flags & SAF_INSTANT))
{
bool looped = false;
self->modelData->prevAnim.startFrame = getCurrentFrame(self->modelData->prevAnim, tic, &looped);

if(!looped)
{
self->modelData->prevAnim.flags &= ~ANIMOVERRIDE_LOOP;
}

int startTic = floor(tic) + interpolateTics;
self->modelData->curAnim.startTic = startTic;
self->modelData->curAnim.switchOffset = startTic - tic;
Expand Down

0 comments on commit 545064f

Please sign in to comment.