Files
itgmania212121/stepmania/src/ScreenPlayerOptions.cpp
T

136 lines
4.1 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-05-20 08:59:37 +00:00
/*
-----------------------------------------------------------------------------
Class: ScreenPlayerOptions
2002-05-20 08:59:37 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
2002-05-20 08:59:37 +00:00
-----------------------------------------------------------------------------
*/
#include "ScreenPlayerOptions.h"
#include "ScreenManager.h"
#include "RageLog.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
#include "ThemeManager.h"
#include "AnnouncerManager.h"
2003-07-26 23:05:16 +00:00
#include "RageSounds.h"
2003-04-21 22:36:45 +00:00
#include "ScreenSongOptions.h"
#include "PrefsManager.h"
2002-05-20 08:59:37 +00:00
2003-09-10 08:47:43 +00:00
#define PREV_SCREEN( play_mode ) THEME->GetMetric ("ScreenPlayerOptions","PrevScreen"+Capitalize(PlayModeToString(play_mode)))
#define NEXT_SCREEN( play_mode ) THEME->GetMetric ("ScreenPlayerOptions","NextScreen"+Capitalize(PlayModeToString(play_mode)))
2002-05-20 08:59:37 +00:00
2003-09-27 22:30:51 +00:00
ScreenPlayerOptions::ScreenPlayerOptions( CString sClassName ) :
ScreenOptionsMaster( sClassName )
2002-05-20 08:59:37 +00:00
{
LOG->Trace( "ScreenPlayerOptions::ScreenPlayerOptions()" );
2002-05-20 08:59:37 +00:00
/* If we're going to "press start for more options" or skipping options
* entirely, we need a different fade out. XXX: this is a hack */
2003-09-05 07:34:13 +00:00
if(PREFSMAN->m_ShowSongOptions == PrefsManager::NO)
m_Menu.m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions direct out") ); /* direct to stage */
2003-09-05 07:34:13 +00:00
else if(PREFSMAN->m_ShowSongOptions == PrefsManager::ASK)
m_Menu.m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions option out") ); /* optional song options */
m_sprOptionsMessage.Load( THEME->GetPathToG("ScreenPlayerOptions options") );
m_sprOptionsMessage.StopAnimating();
m_sprOptionsMessage.SetXY( CENTER_X, CENTER_Y );
m_sprOptionsMessage.SetZoom( 1 );
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) );
//this->AddChild( &m_sprOptionsMessage ); // we have to draw this manually over the top of transitions
m_bAcceptedChoices = false;
2003-09-05 07:34:13 +00:00
m_bGoToOptions = ( PREFSMAN->m_ShowSongOptions == PrefsManager::YES );
2003-07-26 23:05:16 +00:00
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("player options intro") );
2002-05-20 08:59:37 +00:00
}
void ScreenPlayerOptions::GoToPrevState()
{
2003-02-19 05:46:09 +00:00
if( GAMESTATE->m_bEditing )
SCREENMAN->PopTopScreen();
else
SCREENMAN->SetNewScreen( PREV_SCREEN(GAMESTATE->m_PlayMode) );
2002-05-20 08:59:37 +00:00
}
void ScreenPlayerOptions::GoToNextState()
{
2003-02-19 05:46:09 +00:00
if( GAMESTATE->m_bEditing )
SCREENMAN->PopTopScreen();
else
2003-08-11 06:09:57 +00:00
{
GAMESTATE->AdjustFailType();
2003-09-05 07:34:13 +00:00
if( m_bGoToOptions )
2003-08-11 06:09:57 +00:00
SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) );
2003-09-05 07:34:13 +00:00
else
SCREENMAN->SetNewScreen( ScreenSongOptions::GetNextScreen() );
2003-08-11 06:09:57 +00:00
}
2002-05-20 08:59:37 +00:00
}
2003-03-11 08:52:45 +00:00
void ScreenPlayerOptions::Update( float fDelta )
{
ScreenOptionsMaster::Update( fDelta );
2003-09-05 07:34:13 +00:00
m_sprOptionsMessage.Update( fDelta );
2003-03-11 08:52:45 +00:00
}
2002-05-20 08:59:37 +00:00
2003-03-11 08:52:45 +00:00
void ScreenPlayerOptions::DrawPrimitives()
{
ScreenOptionsMaster::DrawPrimitives();
2003-09-05 07:34:13 +00:00
m_sprOptionsMessage.Draw();
2003-03-11 08:52:45 +00:00
}
void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
2003-09-05 07:34:13 +00:00
if( !GAMESTATE->m_bEditing &&
type == IET_FIRST_PRESS &&
!m_Menu.m_In.IsTransitioning() &&
MenuI.IsValid() &&
MenuI.button == MENU_BUTTON_START &&
PREFSMAN->m_ShowSongOptions == PrefsManager::ASK )
{
if( m_bAcceptedChoices && !m_bGoToOptions )
{
m_bGoToOptions = true;
m_sprOptionsMessage.SetState( 1 );
2003-07-26 23:05:16 +00:00
SOUND->PlayOnce( THEME->GetPathToS("Common start") );
}
}
2003-09-05 07:34:13 +00:00
ScreenOptionsMaster::Input( DeviceI, type, GameI, MenuI, StyleI );
2003-03-11 08:52:45 +00:00
}
void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM )
{
2003-09-05 07:34:13 +00:00
if( PREFSMAN->m_ShowSongOptions == PrefsManager::ASK )
{
switch( SM )
{
case SM_BeginFadingOut: // when the user accepts the page of options
{
m_bAcceptedChoices = true;
float fShowSeconds = m_Menu.m_Out.GetLengthSeconds();
// show "hold START for options"
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) );
m_sprOptionsMessage.BeginTweening( 0.15f ); // fade in
m_sprOptionsMessage.SetZoomY( 1 );
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,1) );
m_sprOptionsMessage.BeginTweening( fShowSeconds-0.3f ); // sleep
m_sprOptionsMessage.BeginTweening( 0.15f ); // fade out
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) );
m_sprOptionsMessage.SetZoomY( 0 );
}
break;
}
}
ScreenOptionsMaster::HandleScreenMessage( SM );
2003-09-19 01:11:32 +00:00
}