Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Core/GameEngine/Include/GameClient/GameWindowTransitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ class TransitionGroup
typedef std::list<TransitionWindow *> TransitionWindowList;
TransitionWindowList m_transitionWindowList;
Int m_directionMultiplier;
Int m_currentFrame; ///< maintain how long we've spent on this transition;
Real m_currentFrame; ///< maintain how long we've spent on this transition (in 30fps-equivalent frames);
Comment thread
Caball009 marked this conversation as resolved.
AsciiString m_name;
};

Expand Down
42 changes: 33 additions & 9 deletions Core/GameEngine/Source/GameClient/GUI/GameWindowTransitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "GameClient/GameWindowTransitions.h"
#include "GameClient/GameWindow.h"
#include "GameClient/GameWindowManager.h"
#include "Common/FramePacer.h"
//-----------------------------------------------------------------------------
// DEFINES ////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -239,7 +240,7 @@ Int TransitionWindow::getTotalFrames( void )
//-----------------------------------------------------------------------------
TransitionGroup::TransitionGroup( void )
{
m_currentFrame = 0;
m_currentFrame = 0.0f;
m_fireOnce = FALSE;
}

Expand All @@ -256,7 +257,7 @@ TransitionGroup::~TransitionGroup( void )

void TransitionGroup::init( void )
{
m_currentFrame = 0;
m_currentFrame = 0.0f;
m_directionMultiplier = 1;
TransitionWindowList::iterator it = m_transitionWindowList.begin();
while (it != m_transitionWindowList.end())
Expand All @@ -270,13 +271,36 @@ void TransitionGroup::init( void )

void TransitionGroup::update( void )
{
m_currentFrame += m_directionMultiplier; // we go forward or backwards depending.
TransitionWindowList::iterator it = m_transitionWindowList.begin();
while (it != m_transitionWindowList.end())
// TheSuperHackers @tweak bobtista GUI transition timing is now decoupled from the render update.
// Step every integer frame between the old and new accumulator value so discrete-state-machine
// transitions cannot skip a state when the render frame rate dips below the base rate.
const Real timeScale = TheFramePacer->getBaseOverUpdateFpsRatio();
const Int prevFrame = (Int)m_currentFrame;
m_currentFrame += m_directionMultiplier * timeScale;
const Int newFrame = (Int)m_currentFrame;

if( newFrame == prevFrame )
{
TransitionWindow *tWin = *it;
tWin->update(m_currentFrame);
it++;
return;
}

const Int step = (newFrame > prevFrame) ? 1 : -1;
for( Int frame = prevFrame + step; frame != newFrame + step; frame += step )
{
Bool isFinished = TRUE;
TransitionWindowList::iterator it = m_transitionWindowList.begin();
while (it != m_transitionWindowList.end())
{
TransitionWindow *tWin = *it;
tWin->update(frame);
isFinished &= tWin->isFinished();
it++;
}

if( isFinished )
{
break;
}
}
}

Expand Down Expand Up @@ -315,7 +339,7 @@ void TransitionGroup::reverse( void )
tWin->reverse(totalFrames);
it++;
}
m_currentFrame = totalFrames;
m_currentFrame = (Real)totalFrames;
// m_currentFrame ++;
}

Expand Down
41 changes: 20 additions & 21 deletions Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5504,6 +5504,9 @@ static const UnsignedInt FRAMES_BEFORE_EXPIRE_TO_FADE = LOGICFRAMES_PER_SECOND *
// ------------------------------------------------------------------------------------------------
void InGameUI::updateAndDrawWorldAnimations( void )
{
// TheSuperHackers @tweak bobtista World animation Z-rise is now decoupled from the render update.
const Real zRiseTimeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio();

// go through all animations
for( WorldAnimationListIterator it = m_worldAnimationList.begin();
it != m_worldAnimationList.end(); /*empty*/ )
Expand All @@ -5512,31 +5515,27 @@ void InGameUI::updateAndDrawWorldAnimations( void )
// get data
WorldAnimationData *wad = *it;

// update portion ... only when the game is in motion
if( TheGameLogic->isGamePaused() == FALSE )
//
// see if it's time to expire this animation based on animation type and options or
// the expire frame
//
if( TheGameLogic->getFrame() >= wad->m_expireFrame ||
(BitIsSet( wad->m_options, WORLD_ANIM_PLAY_ONCE_AND_DESTROY ) &&
BitIsSet( wad->m_anim->getStatus(), ANIM_2D_STATUS_COMPLETE )) )
{

//
// see if it's time to expire this animation based on animation type and options or
// the expire frame
//
if( TheGameLogic->getFrame() >= wad->m_expireFrame ||
(BitIsSet( wad->m_options, WORLD_ANIM_PLAY_ONCE_AND_DESTROY ) &&
BitIsSet( wad->m_anim->getStatus(), ANIM_2D_STATUS_COMPLETE )) )
{

// delete this element and continue
deleteInstance(wad->m_anim);
delete wad;
it = m_worldAnimationList.erase( it );
continue;

}
// delete this element and continue
deleteInstance(wad->m_anim);
delete wad;
it = m_worldAnimationList.erase( it );
continue;

// update the Z value
if( wad->m_zRisePerSecond )
wad->m_worldPos.z += wad->m_zRisePerSecond / LOGICFRAMES_PER_SECOND;
}

// update the Z value
if( wad->m_zRisePerSecond )
{
wad->m_worldPos.z += wad->m_zRisePerSecond / LOGICFRAMES_PER_SECOND * zRiseTimeScale;
}

//
Expand Down
41 changes: 20 additions & 21 deletions GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5677,6 +5677,9 @@ static const UnsignedInt FRAMES_BEFORE_EXPIRE_TO_FADE = LOGICFRAMES_PER_SECOND *
// ------------------------------------------------------------------------------------------------
void InGameUI::updateAndDrawWorldAnimations( void )
{
// TheSuperHackers @tweak bobtista World animation Z-rise is now decoupled from the render update.
const Real zRiseTimeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio();

// go through all animations
for( WorldAnimationListIterator it = m_worldAnimationList.begin();
it != m_worldAnimationList.end(); /*empty*/ )
Expand All @@ -5685,31 +5688,27 @@ void InGameUI::updateAndDrawWorldAnimations( void )
// get data
WorldAnimationData *wad = *it;

// update portion ... only when the game is in motion
if( TheGameLogic->isGamePaused() == FALSE )
//
// see if it's time to expire this animation based on animation type and options or
// the expire frame
//
if( TheGameLogic->getFrame() >= wad->m_expireFrame ||
(BitIsSet( wad->m_options, WORLD_ANIM_PLAY_ONCE_AND_DESTROY ) &&
BitIsSet( wad->m_anim->getStatus(), ANIM_2D_STATUS_COMPLETE )) )
{

//
// see if it's time to expire this animation based on animation type and options or
// the expire frame
//
if( TheGameLogic->getFrame() >= wad->m_expireFrame ||
(BitIsSet( wad->m_options, WORLD_ANIM_PLAY_ONCE_AND_DESTROY ) &&
BitIsSet( wad->m_anim->getStatus(), ANIM_2D_STATUS_COMPLETE )) )
{

// delete this element and continue
deleteInstance(wad->m_anim);
delete wad;
it = m_worldAnimationList.erase( it );
continue;

}
// delete this element and continue
deleteInstance(wad->m_anim);
delete wad;
it = m_worldAnimationList.erase( it );
continue;

// update the Z value
if( wad->m_zRisePerSecond )
wad->m_worldPos.z += wad->m_zRisePerSecond / LOGICFRAMES_PER_SECOND;
}

// update the Z value
if( wad->m_zRisePerSecond )
{
wad->m_worldPos.z += wad->m_zRisePerSecond / LOGICFRAMES_PER_SECOND * zRiseTimeScale;
}

//
Expand Down
Loading