From a87562116b7cdd3fce20fef18705879124b1aba9 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 22 Aug 2002 03:35:33 +0000 Subject: [PATCH] Add optoin to make pad escape instant. --- stepmania/src/PrefsManager.cpp | 3 +++ stepmania/src/PrefsManager.h | 20 +++++++++++--------- stepmania/src/Screen.cpp | 8 +++++++- stepmania/src/Screen.h | 13 ++++++------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index e4cbf17b17..2bcf1028af 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -48,6 +48,7 @@ PrefsManager::PrefsManager() m_fLifeDifficultyScale = 1.0f; m_iMovieDecodeMS = 2; m_bUseBGIfNoBanner = false; + m_bDelayedEscape = true; ReadGlobalPrefsFromDisk( true ); } @@ -83,6 +84,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ) ini.GetValueF( "Options", "LifeDifficultyScale", m_fLifeDifficultyScale ); ini.GetValueI( "Options", "MovieDecodeMS", m_iMovieDecodeMS ); ini.GetValueB( "Options", "UseBGIfNoBanner", m_bUseBGIfNoBanner ); + ini.GetValueB( "Options", "DelayedEscape", m_bDelayedEscape ); m_asAdditionalSongFolders.RemoveAll(); CString sAdditionalSongFolders; @@ -121,6 +123,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.SetValueF( "Options", "LifeDifficultyScale", m_fLifeDifficultyScale ); ini.SetValueI( "Options", "MovieDecodeMS", m_iMovieDecodeMS ); ini.SetValueB( "Options", "UseBGIfNoBanner", m_bUseBGIfNoBanner ); + ini.SetValueB( "Options", "DelayedEscape", m_bDelayedEscape ); ini.SetValue( "Options", "AdditionalSongFolders", join(",", m_asAdditionalSongFolders) ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index f73e7fa690..4171689c74 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -31,21 +31,23 @@ public: int m_iDisplayResolution; int m_iTextureResolution; int m_iRefreshRate; // 0 means 'default' - bool m_bIgnoreJoyAxes; - bool m_bOnlyDedicatedMenuButtons; bool m_bShowStats; BackgroundMode m_BackgroundMode; - bool m_bShowDanger; float m_fBGBrightness; - bool m_bMenuTimer; - bool m_bEventMode; - int m_iNumArcadeStages; - bool m_bAutoPlay; - float m_fJudgeWindow; - float m_fLifeDifficultyScale; int m_iMovieDecodeMS; bool m_bUseBGIfNoBanner; + bool m_bIgnoreJoyAxes; + bool m_bOnlyDedicatedMenuButtons; + bool m_bMenuTimer; + bool m_bShowDanger; + int m_iNumArcadeStages; + bool m_bEventMode; + float m_fJudgeWindow; + float m_fLifeDifficultyScale; + bool m_bAutoPlay; + bool m_bDelayedEscape; + CStringArray m_asAdditionalSongFolders; int GetDisplayHeight(); diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index d42a2f14a7..5cbb7e0aed 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -46,12 +46,18 @@ void Screen::Update( float fDeltaTime ) } } +void Screen::MenuBack( const PlayerNumber p, const InputEventType type ) +{ + if(!PREFSMAN->m_bDelayedEscape || type==IET_SLOW_REPEAT || type==IET_FAST_REPEAT) + MenuBack(p); +} + void Screen::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { /* Don't send release messages with the default handler. */ if(type == IET_RELEASE) return; // don't care - // don't make user hold back button if they're pressing escape + /* Don't make the user hold the back button if they're pressing escape. */ if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == DIK_ESCAPE ) { this->MenuBack( MenuI.player ); diff --git a/stepmania/src/Screen.h b/stepmania/src/Screen.h index 956ba66d95..707871754b 100644 --- a/stepmania/src/Screen.h +++ b/stepmania/src/Screen.h @@ -50,12 +50,12 @@ protected: public: // let subclass override if they want - virtual void MenuUp( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuUp(p); }; - virtual void MenuDown( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuDown(p); }; - virtual void MenuLeft( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuLeft(p); }; - virtual void MenuRight( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuRight(p); }; - virtual void MenuStart( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuStart(p); }; - virtual void MenuBack( const PlayerNumber p, const InputEventType type ) { if(type==IET_SLOW_REPEAT || type==IET_FAST_REPEAT) MenuBack(p); }; + virtual void MenuUp( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuUp(p); } + virtual void MenuDown( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuDown(p); } + virtual void MenuLeft( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuLeft(p); } + virtual void MenuRight( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuRight(p); } + virtual void MenuStart( const PlayerNumber p, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuStart(p); } + virtual void MenuBack( const PlayerNumber p, const InputEventType type ); virtual void MenuUp( const PlayerNumber p ) {}; virtual void MenuDown( const PlayerNumber p ) {}; @@ -63,5 +63,4 @@ public: virtual void MenuRight( const PlayerNumber p ) {}; virtual void MenuStart( const PlayerNumber p ) {}; virtual void MenuBack( const PlayerNumber p ) {}; - };