Go back to using float time values in ScreenEdit

This fixes a regression where record mode can't tell if you're trying to input a hold or not.
This commit is contained in:
sukibaby
2024-11-28 11:03:52 -08:00
committed by teejusb
parent ee16093adc
commit 758ae970e2
+12 -10
View File
@@ -47,10 +47,12 @@
static Preference<float> g_iDefaultRecordLength( "DefaultRecordLength", 4 ); static Preference<float> g_iDefaultRecordLength( "DefaultRecordLength", 4 );
static Preference<bool> g_bEditorShowBGChangesPlay( "EditorShowBGChangesPlay", true ); static Preference<bool> g_bEditorShowBGChangesPlay( "EditorShowBGChangesPlay", true );
/** @brief How long must the button be held to generate a hold in record mode? */ /** @brief How long must the button be held to generate a hold in record mode?
constexpr uint_fast64_t record_hold_default = 300000; // 0.3 seconds in microseconds * Note this must be a float, if it isn't then record mode can't tell if you're
uint_fast64_t record_hold_seconds = record_hold_default; * trying to input a hold or not. */
constexpr uint_fast64_t time_between_autosave = 300000000; // 300 seconds in microseconds constexpr static float record_hold_default= 0.3f;
float record_hold_seconds = record_hold_default;
constexpr static float time_between_autosave= 300.0f; // 5 minutes. -Kyz
#define PLAYER_X (SCREEN_CENTER_X) #define PLAYER_X (SCREEN_CENTER_X)
#define PLAYER_Y (SCREEN_CENTER_Y) #define PLAYER_Y (SCREEN_CENTER_Y)
@@ -1681,8 +1683,8 @@ void ScreenEdit::Update( float fDeltaTime )
if(m_EditState == STATE_EDITING) if(m_EditState == STATE_EDITING)
{ {
if(IsDirty() && m_next_autosave_time > -1000000 && if(IsDirty() && m_next_autosave_time > -1.0f &&
RageTimer::GetTimeSinceStartMicroseconds() > m_next_autosave_time) RageTimer::GetTimeSinceStart() > m_next_autosave_time)
{ {
PerformSave(true); PerformSave(true);
} }
@@ -4352,7 +4354,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
else if( SM == SM_AutoSaveSuccessful ) else if( SM == SM_AutoSaveSuccessful )
{ {
LOG->Trace("AutoSave successful."); LOG->Trace("AutoSave successful.");
m_next_autosave_time= RageTimer::GetTimeSinceStartMicroseconds() + time_between_autosave; m_next_autosave_time= RageTimer::GetTimeSinceStart() + time_between_autosave;
SCREENMAN->SystemMessage(AUTOSAVE_SUCCESSFUL); SCREENMAN->SystemMessage(AUTOSAVE_SUCCESSFUL);
} }
else if( SM == SM_SaveFailed ) // save failed; stay in the editor else if( SM == SM_SaveFailed ) // save failed; stay in the editor
@@ -4428,19 +4430,19 @@ void ScreenEdit::SetDirty(bool dirty)
if(EDIT_MODE.GetValue() != EditMode_Full) if(EDIT_MODE.GetValue() != EditMode_Full)
{ {
m_dirty= false; m_dirty= false;
m_next_autosave_time= -1000000; m_next_autosave_time= -1.0f;
return; return;
} }
if(dirty) if(dirty)
{ {
if(!m_dirty) if(!m_dirty)
{ {
m_next_autosave_time= RageTimer::GetTimeSinceStartMicroseconds() + time_between_autosave; m_next_autosave_time= RageTimer::GetTimeSinceStart() + time_between_autosave;
} }
} }
else else
{ {
m_next_autosave_time= -1000000; m_next_autosave_time= -1.0f;
} }
m_dirty= dirty; m_dirty= dirty;
} }