Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 2587e78

Browse files
committed
Fix-fix plus other animmode optimization for framecount = 2
1 parent de99f60 commit 2587e78

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Entities/MOSprite.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,7 @@ void MOSprite::Update()
477477
if (m_SpriteAnimTimer.GetElapsedSimTimeMS() > (m_SpriteAnimDuration / m_FrameCount))
478478
{
479479
// Quick switch to other frame if only two
480-
if (m_FrameCount == 2)
481-
m_Frame = m_Frame == 0 ? 1 : 0;
482-
else
480+
if (m_FrameCount == 2) { m_SpriteAnimMode = ALWAYSLOOP; }
483481
{
484482
int prevFrame = m_Frame;
485483
// Keep trying ot find a new frame
@@ -494,6 +492,7 @@ void MOSprite::Update()
494492
}
495493
else if (m_SpriteAnimMode == ALWAYSPINGPONG)
496494
{
495+
if (m_FrameCount == 2) { m_SpriteAnimMode = ALWAYSLOOP; }
497496
int realFrameCount = m_FrameCount - 1;
498497
float perFrameTime = ((m_SpriteAnimDuration / m_FrameCount) / 2);
499498
if (m_SpriteAnimTimer.IsPastSimMS(perFrameTime))

Entities/MOSprite.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,16 +587,14 @@ ENTITYALLOCATION(MOSprite)
587587
virtual void SetSpriteAnimDuration(int newDuration) { m_SpriteAnimDuration = newDuration; }
588588

589589

590-
/*
591590
//////////////////////////////////////////////////////////////////////////////////////////
592591
// Virtual method: Update
593592
//////////////////////////////////////////////////////////////////////////////////////////
594593
// Description: Updates this MovableObject. Supposed to be done every frame.
595594
// Arguments: None.
596595
// Return value: None.
597596

598-
virtual void Update() = 0;
599-
*/
597+
virtual void Update();
600598

601599

602600
//////////////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)