move CoinMode toggle entirely into debug menu

add mute to debug menu
This commit is contained in:
Chris Danford
2005-05-16 22:23:20 +00:00
parent c1ab0fcdb3
commit 5c16cabf0d
8 changed files with 74 additions and 66 deletions
-22
View File
@@ -181,28 +181,6 @@ void Screen::HandleScreenMessage( const ScreenMessage SM )
}
}
bool Screen::ChangeCoinModeInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
if( type != IET_FIRST_PRESS )
return false;
if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == KEY_F3 )
{
CoinMode cm = (CoinMode)(PREFSMAN->m_CoinMode+1);
wrap( (int&)cm, NUM_COIN_MODES );
PREFSMAN->m_CoinMode.Set( cm );
/* Show the real coin mode, not GetCoinMode(), or F3 will go "home, free, free"
* in event mode. XXX: move GetCoinMode to GameState to keep PrefsManager dumb? */
CString sMessage = CoinModeToString( PREFSMAN->m_CoinMode );
sMessage.MakeUpper();
sMessage = "Coin Mode: " + sMessage;
SCREENMAN->RefreshCreditsMessages();
SCREENMAN->SystemMessage( sMessage );
return true;
}
return false;
}
bool Screen::JoinInput( const MenuInput &MenuI )
{
if( !GAMESTATE->PlayersCanJoin() )
-1
View File
@@ -41,7 +41,6 @@ public:
bool IsTransparent() const { return m_bIsTransparent; }
virtual bool UsesBackground() const { return true; } // override and set false if this screen shouldn't load a background
static bool ChangeCoinModeInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); // return true if CoinMode changed
static bool JoinInput( const MenuInput &MenuI ); // return true if a player joined
protected:
-2
View File
@@ -60,8 +60,6 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
if(type != IET_FIRST_PRESS)
return; // don't care
ChangeCoinModeInput( DeviceI, type, GameI, MenuI, StyleI );
if( MenuI.IsValid() )
{
switch( MenuI.button )
+59 -24
View File
@@ -8,11 +8,13 @@
#include "StepMania.h"
#include "GameCommand.h"
#include "ScreenGameplay.h"
#include "RageSoundManager.h"
static bool g_bIsDisplayed = false;
static bool g_bIsSlow = false;
static bool g_bIsHalt = false;
static RageTimer g_HaltTimer(RageZeroTimer);
static bool g_bMute = false;
REGISTER_SCREEN_CLASS( ScreenDebugOverlay );
ScreenDebugOverlay::ScreenDebugOverlay( const CString &sName ) : Screen(sName)
@@ -64,6 +66,7 @@ void ScreenDebugOverlay::Init()
g_Mappings.button[9] = DeviceInput(DEVICE_KEYBOARD, KEY_C0);
g_Mappings.button[10] = DeviceInput(DEVICE_KEYBOARD, KEY_UNDERSCORE);
g_Mappings.button[11] = DeviceInput(DEVICE_KEYBOARD, KEY_EQUAL);
g_Mappings.button[12] = DeviceInput(DEVICE_KEYBOARD, KEY_PAUSE);
}
@@ -130,29 +133,26 @@ void ScreenDebugOverlay::Update( float fDeltaTime )
txt.SetY( SCALE(i, 0, NUM_DEBUG_LINES-1, SCREEN_TOP+60, SCREEN_BOTTOM-40) );
txt.SetZoom( 0.8f );
CString s;
CString s1;
switch( i )
{
case DebugLine_Autoplay: s="AutoPlay"; break;
case DebugLine_CoinMode: { s="CoinMode: "+CoinModeToString(PREFSMAN->m_CoinMode); } break;
case DebugLine_Slow: s="Slow"; break;
case DebugLine_Halt: s="Halt"; break;
case DebugLine_LightsDebug: s="Lights Debug"; break;
case DebugLine_MonkeyInput: s="MonkeyInput"; break;
case DebugLine_Stats: s="Stats"; break;
case DebugLine_Vsync: s="Vsync"; break;
case DebugLine_ScreenTestMode: s="Screen Test Mode"; break;
case DebugLine_ClearMachineStats: s="Clear Machine Stats";break;
case DebugLine_FillMachineStats: s="Fill Machine Stats"; break;
case DebugLine_SendNotesEnded: s="Send Notes Ended"; break;
case DebugLine_CurrentScreen: { s="Screen: "; s+=SCREENMAN ? SCREENMAN->GetTopScreen()->m_sName : ""; } break;
case DebugLine_Uptime: s="uptime: " + SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()); break;
case DebugLine_Autoplay: s1="AutoPlay"; break;
case DebugLine_CoinMode: s1="CoinMode"; break;
case DebugLine_Slow: s1="Slow"; break;
case DebugLine_Halt: s1="Halt"; break;
case DebugLine_LightsDebug: s1="Lights Debug"; break;
case DebugLine_MonkeyInput: s1="MonkeyInput"; break;
case DebugLine_Stats: s1="Stats"; break;
case DebugLine_Vsync: s1="Vsync"; break;
case DebugLine_ScreenTestMode: s1="Screen Test Mode"; break;
case DebugLine_ClearMachineStats: s1="Clear Machine Stats"; break;
case DebugLine_FillMachineStats: s1="Fill Machine Stats"; break;
case DebugLine_SendNotesEnded: s1="Send Notes Ended"; break;
case DebugLine_Volume: s1="Mute"; break;
case DebugLine_CurrentScreen: s1="Screen"; break;
case DebugLine_Uptime: s1="Uptime"; break;
default: ASSERT(0);
}
CString sButton = GetDebugButtonName(i);
if( !sButton.empty() )
sButton += ": ";
txt.SetText( sButton + s );
bool bOn = false;
switch( i )
@@ -169,12 +169,41 @@ void ScreenDebugOverlay::Update( float fDeltaTime )
case DebugLine_ClearMachineStats: bOn=true; break;
case DebugLine_FillMachineStats: bOn=true; break;
case DebugLine_SendNotesEnded: bOn=true; break;
case DebugLine_Volume: bOn=g_bMute; break;
case DebugLine_CurrentScreen: bOn=false; break;
case DebugLine_Uptime: bOn=false; break;
default: ASSERT(0);
}
CString s2;
switch( i )
{
case DebugLine_Autoplay: s2=bOn ? "on":"off"; break;
case DebugLine_CoinMode: s2=CoinModeToString(PREFSMAN->m_CoinMode); break;
case DebugLine_Slow: s2=bOn ? "on":"off"; break;
case DebugLine_Halt: s2=bOn ? "on":"off"; break;
case DebugLine_LightsDebug: s2=bOn ? "on":"off"; break;
case DebugLine_MonkeyInput: s2=bOn ? "on":"off"; break;
case DebugLine_Stats: s2=bOn ? "on":"off"; break;
case DebugLine_Vsync: s2=bOn ? "on":"off"; break;
case DebugLine_ScreenTestMode: s2=bOn ? "on":"off"; break;
case DebugLine_ClearMachineStats: s2=""; break;
case DebugLine_FillMachineStats: s2=""; break;
case DebugLine_SendNotesEnded: s2=""; break;
case DebugLine_Volume: s2=bOn ? "on":"off"; break;
case DebugLine_CurrentScreen: s2=SCREENMAN ? SCREENMAN->GetTopScreen()->m_sName:""; break;
case DebugLine_Uptime: s2=SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()); break;
default: ASSERT(0);
}
txt.SetDiffuse( bOn ? on:off );
CString sButton = GetDebugButtonName(i);
if( !sButton.empty() )
sButton += ": ";
if( !s2.empty() )
s1 += " - ";
txt.SetText( sButton + s1 + s2 );
}
if( g_bIsHalt )
@@ -226,10 +255,10 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
break;
case DebugLine_CoinMode:
{
int i = PREFSMAN->m_CoinMode.Get();
i++;
wrap( i, NUM_COIN_MODES );
PREFSMAN->m_CoinMode.Set( (CoinMode)i );
CoinMode cm = (CoinMode)(PREFSMAN->m_CoinMode+1);
wrap( (int&)cm, NUM_COIN_MODES );
PREFSMAN->m_CoinMode.Set( cm );
SCREENMAN->RefreshCreditsMessages();
}
break;
case DebugLine_Slow:
@@ -274,19 +303,25 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
case DebugLine_SendNotesEnded:
SCREENMAN->PostMessageToTopScreen( SM_NotesEnded, 0 );
break;
case DebugLine_Volume:
g_bMute = !g_bMute;
SOUNDMAN->SetPrefs( g_bMute ? 0 : PREFSMAN->GetSoundVolume() );
break;
case DebugLine_CurrentScreen:
break;
case DebugLine_Uptime:
break;
default: ASSERT(0);
}
break;
SCREENMAN->SystemMessage( txt.GetText() );
}
}
return true;
}
/*
* (c) 2001-2005 Chris Danford, Glenn Maynard
* All rights reserved.
+1
View File
@@ -21,6 +21,7 @@ enum DebugLine
DebugLine_ClearMachineStats,
DebugLine_FillMachineStats,
DebugLine_SendNotesEnded,
DebugLine_Volume,
DebugLine_CurrentScreen,
DebugLine_Uptime,
NUM_DEBUG_LINES
+12 -8
View File
@@ -52,6 +52,8 @@ ScreenTitleMenu::ScreenTitleMenu( CString sScreenName ) :
// TRICKY: Do this after GameState::Reset.
LIGHTSMAN->SetLightsMode( LIGHTSMODE_JOINING );
this->SubscribeToMessage( "CoinModeChanged" );
}
void ScreenTitleMenu::Init()
@@ -114,14 +116,6 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
if( type == IET_FIRST_PRESS )
{
/* If the CoinMode was changed, we need to reload this screen
* so that the right m_aGameCommands will show */
if( ScreenAttract::ChangeCoinModeInput( DeviceI, type, GameI, MenuI, StyleI ) )
{
SCREENMAN->SetNewScreen( COIN_MODE_CHANGE_SCREEN );
return;
}
if( m_In.IsTransitioning() || m_Cancel.IsTransitioning() ) /* not m_Out */
return;
@@ -174,6 +168,16 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
ScreenSelectMaster::Input( DeviceI, type, GameI, MenuI, StyleI );
}
void ScreenTitleMenu::HandleMessage( const CString& sMessage )
{
if( sMessage == "CoinModeChanged" )
{
/* If the CoinMode was changed, we need to reload this screen
* so that the right m_aGameCommands will show */
SCREENMAN->SetNewScreen( COIN_MODE_CHANGE_SCREEN );
}
}
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
+2
View File
@@ -20,6 +20,8 @@ public:
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void HandleMessage( const CString& sMessage );
private:
AutoActor m_sprLogo;
BitmapText m_textVersion;
-9
View File
@@ -1407,15 +1407,6 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
}
}
if(DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_PAUSE))
{
static bool bMute = false;
bMute = !bMute;
SOUNDMAN->SetPrefs( bMute ? 0 : PREFSMAN->GetSoundVolume() );
SCREENMAN->SystemMessage( bMute ? "Mute on" : "Mute off" );
return true;
}
return false;
}