Files
itgmania212121/stepmania/src/ScreenTitleMenu.cpp
T

133 lines
4.4 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
#include "ScreenTitleMenu.h"
#include "ScreenManager.h"
#include "RageUtil.h"
#include "StepMania.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2002-05-20 08:59:37 +00:00
#include "RageLog.h"
#include "AnnouncerManager.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
2002-05-28 20:01:22 +00:00
#include "GameManager.h"
#include "ThemeManager.h"
2004-07-08 00:10:34 +00:00
#include "GameSoundManager.h"
#include "CodeDetector.h"
2003-04-18 23:55:20 +00:00
#include "RageTextureManager.h"
2003-11-16 04:45:12 +00:00
#include "LightsManager.h"
2004-07-25 17:07:32 +00:00
#include "Game.h"
2005-08-03 03:27:43 +00:00
#include "InputMapper.h"
#include "ProfileManager.h"
#include "CharacterManager.h"
#include "InputEventPlus.h"
2005-12-22 03:10:04 +00:00
#include "LocalizedString.h"
2003-01-02 07:54:28 +00:00
2005-01-30 00:01:35 +00:00
#define COIN_MODE_CHANGE_SCREEN THEME->GetMetric (m_sName,"CoinModeChangeScreen")
2004-11-26 17:28:47 +00:00
REGISTER_SCREEN_CLASS( ScreenTitleMenu );
ScreenTitleMenu::ScreenTitleMenu( CString sScreenName ) :
ScreenSelectMaster( sScreenName )
2002-05-20 08:59:37 +00:00
{
2003-09-27 20:50:12 +00:00
/* XXX We really need two common calls: 1, something run when exiting from gameplay
* (to do this reset), and 2, something run when entering gameplay, to apply default
* options. Having special cases in attract screens and the title menu to reset
* things stinks ... */
GAMESTATE->Reset();
2003-03-09 03:28:34 +00:00
// TRICKY: Do this after GameState::Reset.
LIGHTSMAN->SetLightsMode( LIGHTSMODE_JOINING );
2005-05-18 08:17:42 +00:00
this->SubscribeToMessage( PREFSMAN->m_CoinMode.GetName()+"Changed" );
}
2003-11-16 04:45:12 +00:00
void ScreenTitleMenu::Init()
{
ScreenSelectMaster::Init();
2003-11-16 04:45:12 +00:00
2005-08-03 03:27:43 +00:00
m_soundSelectPressed.Load( THEME->GetPathS(m_sName,"select down"), true );
2004-05-02 03:01:27 +00:00
this->SortByDrawOrder();
CHARMAN->DemandGraphics();
SOUND->PlayOnceFromAnnouncer( "title menu game name" );
}
2002-05-20 08:59:37 +00:00
ScreenTitleMenu::~ScreenTitleMenu()
{
2005-01-04 11:06:13 +00:00
LOG->Trace( "ScreenTitleMenu::~ScreenTitleMenu()" );
CHARMAN->UndemandGraphics();
2003-09-26 09:03:48 +00:00
}
2005-12-20 08:35:47 +00:00
static LocalizedString THEME_ ("ScreenTitleMenu","Theme");
static LocalizedString ANNOUNCER_ ("ScreenTitleMenu","Announcer");
void ScreenTitleMenu::Input( const InputEventPlus &input )
2002-05-20 08:59:37 +00:00
{
LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", input.DeviceI.device, input.DeviceI.button ); // debugging gameport joystick problem
2002-05-20 08:59:37 +00:00
2005-08-03 03:27:43 +00:00
if( m_In.IsTransitioning() || m_Cancel.IsTransitioning() ) /* not m_Out */
return;
if( input.type == IET_FIRST_PRESS )
2003-09-25 02:16:37 +00:00
{
2005-04-04 02:34:56 +00:00
//
// detect codes
//
if( CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_THEME) ||
CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_THEME2) )
2005-04-04 02:34:56 +00:00
{
THEME->NextTheme();
2005-12-02 01:16:28 +00:00
StepMania::ApplyGraphicOptions(); // update window title and icon
2005-12-20 08:35:47 +00:00
SCREENMAN->SystemMessage( THEME_.GetValue()+": "+THEME->GetCurThemeName() );
2005-04-04 02:34:56 +00:00
SCREENMAN->SetNewScreen( m_sName );
TEXTUREMAN->DoDelayedDelete();
}
if( CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_ANNOUNCER) ||
CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_ANNOUNCER2) )
2005-04-04 02:34:56 +00:00
{
ANNOUNCER->NextAnnouncer();
CString sName = ANNOUNCER->GetCurAnnouncerName();
if( sName=="" ) sName = "(none)";
2005-12-20 08:35:47 +00:00
SCREENMAN->SystemMessage( ANNOUNCER_.GetValue()+": "+sName );
2005-04-04 02:34:56 +00:00
SCREENMAN->SetNewScreen( m_sName );
}
2002-05-20 08:59:37 +00:00
}
ScreenSelectMaster::Input( input );
2002-05-20 08:59:37 +00:00
}
void ScreenTitleMenu::HandleMessage( const CString& sMessage )
{
2005-05-18 07:14:19 +00:00
if( sMessage == PREFSMAN->m_CoinMode.GetName()+"Changed" )
{
/* 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 );
}
}
2005-08-03 03:27:43 +00:00
2004-06-08 05:22:33 +00:00
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/