Give actors the ability to undo the rate change triggered by holding
tilde or tab. This is gated by a new boolean, `tab_tilde_scaling_enabled_`, and applied only to banners by default.
This commit is contained in:
+12
-2
@@ -13,6 +13,7 @@
|
|||||||
#include "LightsManager.h" // for NUM_CabinetLight
|
#include "LightsManager.h" // for NUM_CabinetLight
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "Preference.h"
|
#include "Preference.h"
|
||||||
|
#include "GameLoop.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@@ -166,9 +167,10 @@ Actor::Actor()
|
|||||||
m_size = RageVector2( 1, 1 );
|
m_size = RageVector2( 1, 1 );
|
||||||
InitState();
|
InitState();
|
||||||
m_pParent = nullptr;
|
m_pParent = nullptr;
|
||||||
m_FakeParent= nullptr;
|
m_FakeParent = nullptr;
|
||||||
m_bFirstUpdate = true;
|
m_bFirstUpdate = true;
|
||||||
m_tween_uses_effect_delta= false;
|
m_tween_uses_effect_delta = false;
|
||||||
|
tab_tilde_scaling_enabled_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor::~Actor()
|
Actor::~Actor()
|
||||||
@@ -872,6 +874,14 @@ bool Actor::IsFirstUpdate() const
|
|||||||
void Actor::Update( float fDeltaTime )
|
void Actor::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
// LOG->Trace( "Actor::Update( %f )", fDeltaTime );
|
// LOG->Trace( "Actor::Update( %f )", fDeltaTime );
|
||||||
|
|
||||||
|
float rate = GameLoop::GetUpdateRate();
|
||||||
|
if (rate != 1 && !tab_tilde_scaling_enabled_) {
|
||||||
|
if (rate != 0) {
|
||||||
|
fDeltaTime *= (1 / rate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT_M( fDeltaTime >= 0, ssprintf("DeltaTime: %f",fDeltaTime) );
|
ASSERT_M( fDeltaTime >= 0, ssprintf("DeltaTime: %f",fDeltaTime) );
|
||||||
|
|
||||||
if( m_fHibernateSecondsLeft > 0 )
|
if( m_fHibernateSecondsLeft > 0 )
|
||||||
|
|||||||
@@ -714,6 +714,9 @@ protected:
|
|||||||
* follow the effect clock. Actor::Update must be called first. */
|
* follow the effect clock. Actor::Update must be called first. */
|
||||||
float GetEffectDeltaTime() const { return m_fEffectDelta; }
|
float GetEffectDeltaTime() const { return m_fEffectDelta; }
|
||||||
|
|
||||||
|
// Use this to disable scaling an actor's rate with tab or tilde.
|
||||||
|
void DisableTabTildeScaling() { tab_tilde_scaling_enabled_ = false; }
|
||||||
|
|
||||||
// todo: account for SSC_FUTURES by having these be vectors too -aj
|
// todo: account for SSC_FUTURES by having these be vectors too -aj
|
||||||
RageColor m_effectColor1;
|
RageColor m_effectColor1;
|
||||||
RageColor m_effectColor2;
|
RageColor m_effectColor2;
|
||||||
@@ -753,6 +756,10 @@ protected:
|
|||||||
static std::vector<float> g_vfCurrentBGMBeatPlayerNoOffset;
|
static std::vector<float> g_vfCurrentBGMBeatPlayerNoOffset;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Some actors shouldn't be scaled with tab or tilde. This bool does not
|
||||||
|
// guard against holding both at the same time (setting the rate to zero).
|
||||||
|
bool tab_tilde_scaling_enabled_;
|
||||||
|
|
||||||
// commands
|
// commands
|
||||||
std::map<RString, apActorCommands> m_mapNameToCommands;
|
std::map<RString, apActorCommands> m_mapNameToCommands;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Banner::Banner()
|
|||||||
{
|
{
|
||||||
m_bScrolling = false;
|
m_bScrolling = false;
|
||||||
m_fPercentScrolling = 0;
|
m_fPercentScrolling = 0;
|
||||||
|
Actor::DisableTabTildeScaling();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ugly: if sIsBanner is false, we're actually loading something other than a banner.
|
// Ugly: if sIsBanner is false, we're actually loading something other than a banner.
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ void GameLoop::SetUpdateRate( float fUpdateRate )
|
|||||||
g_fUpdateRate = fUpdateRate;
|
g_fUpdateRate = fUpdateRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float GameLoop::GetUpdateRate() {
|
||||||
|
return g_fUpdateRate;
|
||||||
|
}
|
||||||
|
|
||||||
static void CheckGameLoopTimerSkips( float fDeltaTime )
|
static void CheckGameLoopTimerSkips( float fDeltaTime )
|
||||||
{
|
{
|
||||||
static int iLastFPS = 0;
|
static int iLastFPS = 0;
|
||||||
|
|||||||
+2
-1
@@ -5,7 +5,8 @@ namespace GameLoop
|
|||||||
{
|
{
|
||||||
void RunGameLoop();
|
void RunGameLoop();
|
||||||
void UpdateAllButDraw( bool bRunningFromVBLANK);
|
void UpdateAllButDraw( bool bRunningFromVBLANK);
|
||||||
void SetUpdateRate( float fUpdateRate );
|
void SetUpdateRate(float fUpdateRate);
|
||||||
|
float GetUpdateRate();
|
||||||
void ChangeTheme(const RString &sNewTheme);
|
void ChangeTheme(const RString &sNewTheme);
|
||||||
void ChangeGame(const RString& new_game, const RString& new_theme= "");
|
void ChangeGame(const RString& new_game, const RString& new_theme= "");
|
||||||
void StartConcurrentRendering();
|
void StartConcurrentRendering();
|
||||||
|
|||||||
Reference in New Issue
Block a user