Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gecko0307 committed Jul 5, 2024
1 parent 5aa7488 commit a9003ef
Showing 1 changed file with 30 additions and 21 deletions.
51 changes: 30 additions & 21 deletions extensions/iqm/src/dagon/ext/iqm.d
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ class Actor: Owner, Drawable
animation.firstFrame = startFrame;
animation.numFrames = numFrames;
state.currentFrame = animation.firstFrame;
state.nextFrame = state.currentFrame + 1;
if (numFrames > 0)
state.nextFrame = state.currentFrame + 1;
else
state.nextFrame = state.currentFrame;
state.t = 0.0f;
}
}
Expand Down Expand Up @@ -277,17 +280,20 @@ class Actor: Owner, Drawable
if (state.t >= 1.0f)
{
state.t = 0.0f;
state.currentFrame++;
state.nextFrame++;

if (state.currentFrame == animation.firstFrame + animation.numFrames - 1)
if (state.nextFrame != state.currentFrame)
{
state.nextFrame = animation.firstFrame;
}
else if (state.currentFrame == animation.firstFrame + animation.numFrames)
{
state.currentFrame = animation.firstFrame;
state.nextFrame = state.currentFrame + 1;
state.currentFrame++;
state.nextFrame++;

if (state.currentFrame == animation.firstFrame + animation.numFrames - 1)
{
state.nextFrame = animation.firstFrame;
}
else if (state.currentFrame == animation.firstFrame + animation.numFrames)
{
state.currentFrame = animation.firstFrame;
state.nextFrame = state.currentFrame + 1;
}
}
}

Expand All @@ -300,17 +306,20 @@ class Actor: Owner, Drawable
if (nextState.t >= 1.0f)
{
nextState.t = 0.0f;
nextState.currentFrame++;
nextState.nextFrame++;

if (nextState.currentFrame == nextAnimation.numFrames - 1)
{
nextState.nextFrame = nextAnimation.firstFrame;
}
else if (nextState.currentFrame == nextAnimation.numFrames)
if (nextState.nextFrame != nextState.currentFrame)
{
nextState.currentFrame = nextAnimation.firstFrame;
nextState.nextFrame = nextState.currentFrame + 1;
nextState.currentFrame++;
nextState.nextFrame++;

if (nextState.currentFrame == nextAnimation.numFrames - 1)
{
nextState.nextFrame = nextAnimation.firstFrame;
}
else if (nextState.currentFrame == nextAnimation.numFrames)
{
nextState.currentFrame = nextAnimation.firstFrame;
nextState.nextFrame = nextState.currentFrame + 1;
}
}
}

Expand Down

0 comments on commit a9003ef

Please sign in to comment.