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:
Brandon W
2025-03-02 10:34:28 -08:00
committed by teejusb
parent 2feb9e784c
commit 9789ef9697
5 changed files with 26 additions and 3 deletions
+12 -2
View File
@@ -13,6 +13,7 @@
#include "LightsManager.h" // for NUM_CabinetLight
#include "ActorUtil.h"
#include "Preference.h"
#include "GameLoop.h"
#include <cmath>
#include <cstddef>
@@ -166,9 +167,10 @@ Actor::Actor()
m_size = RageVector2( 1, 1 );
InitState();
m_pParent = nullptr;
m_FakeParent= nullptr;
m_FakeParent = nullptr;
m_bFirstUpdate = true;
m_tween_uses_effect_delta= false;
m_tween_uses_effect_delta = false;
tab_tilde_scaling_enabled_ = true;
}
Actor::~Actor()
@@ -872,6 +874,14 @@ bool Actor::IsFirstUpdate() const
void Actor::Update( float 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) );
if( m_fHibernateSecondsLeft > 0 )
+7
View File
@@ -714,6 +714,9 @@ protected:
* follow the effect clock. Actor::Update must be called first. */
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
RageColor m_effectColor1;
RageColor m_effectColor2;
@@ -753,6 +756,10 @@ protected:
static std::vector<float> g_vfCurrentBGMBeatPlayerNoOffset;
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
std::map<RString, apActorCommands> m_mapNameToCommands;
};
+1
View File
@@ -25,6 +25,7 @@ Banner::Banner()
{
m_bScrolling = false;
m_fPercentScrolling = 0;
Actor::DisableTabTildeScaling();
}
// Ugly: if sIsBanner is false, we're actually loading something other than a banner.
+4
View File
@@ -40,6 +40,10 @@ void GameLoop::SetUpdateRate( float fUpdateRate )
g_fUpdateRate = fUpdateRate;
}
float GameLoop::GetUpdateRate() {
return g_fUpdateRate;
}
static void CheckGameLoopTimerSkips( float fDeltaTime )
{
static int iLastFPS = 0;
+2 -1
View File
@@ -5,7 +5,8 @@ namespace GameLoop
{
void RunGameLoop();
void UpdateAllButDraw( bool bRunningFromVBLANK);
void SetUpdateRate( float fUpdateRate );
void SetUpdateRate(float fUpdateRate);
float GetUpdateRate();
void ChangeTheme(const RString &sNewTheme);
void ChangeGame(const RString& new_game, const RString& new_theme= "");
void StartConcurrentRendering();