2003-01-08 23:43:54 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: ScreenAttract
|
|
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ScreenAttract.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "StepMania.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "SongManager.h"
|
|
|
|
|
#include "AnnouncerManager.h"
|
|
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "GameManager.h"
|
|
|
|
|
#include "InputMapper.h"
|
|
|
|
|
#include "ThemeManager.h"
|
2003-02-14 06:43:23 +00:00
|
|
|
#include "SDL_utils.h"
|
2003-01-08 23:43:54 +00:00
|
|
|
#include "RageSoundManager.h"
|
|
|
|
|
|
2003-01-20 05:08:35 +00:00
|
|
|
#define SECONDS_TO_SHOW THEME->GetMetricF(m_sMetricName,"SecondsToShow")
|
|
|
|
|
#define NEXT_SCREEN THEME->GetMetric(m_sMetricName,"NextScreen")
|
2003-01-08 23:43:54 +00:00
|
|
|
|
|
|
|
|
|
2003-01-19 04:44:22 +00:00
|
|
|
ScreenAttract::ScreenAttract( CString sMetricName, CString sElementName )
|
2003-01-08 23:43:54 +00:00
|
|
|
{
|
2003-01-19 04:44:22 +00:00
|
|
|
LOG->Trace( "ScreenAttract::ScreenAttract(%s, %s)", sMetricName.c_str(), sElementName.c_str() );
|
|
|
|
|
|
2003-01-20 04:33:45 +00:00
|
|
|
GAMESTATE->Reset();
|
|
|
|
|
|
2003-01-19 04:44:22 +00:00
|
|
|
m_sMetricName = sMetricName;
|
|
|
|
|
m_sElementName = sElementName;
|
|
|
|
|
|
|
|
|
|
// We have to do initialization in the first update because this->GetElementName() won't
|
|
|
|
|
// work until the object has been fully constructed.
|
|
|
|
|
m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations",m_sElementName) );
|
|
|
|
|
this->AddChild( &m_Background );
|
|
|
|
|
|
|
|
|
|
m_Fade.SetClosed();
|
|
|
|
|
m_Fade.OpenWipingRight( SM_None );
|
|
|
|
|
this->AddChild( &m_Fade );
|
|
|
|
|
|
|
|
|
|
SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sElementName) );
|
|
|
|
|
|
|
|
|
|
m_soundStart.Load( THEME->GetPathTo("Sounds","menu start") );
|
|
|
|
|
|
2003-01-26 20:49:05 +00:00
|
|
|
SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds",m_sElementName + " music") ); // DO loop. -Chris
|
2003-01-19 04:44:22 +00:00
|
|
|
|
|
|
|
|
GAMESTATE->m_bPlayersCanJoin = true;
|
|
|
|
|
|
|
|
|
|
this->SendScreenMessage( SM_BeginFadingOut, SECONDS_TO_SHOW );
|
2003-01-08 23:43:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScreenAttract::~ScreenAttract()
|
|
|
|
|
{
|
|
|
|
|
LOG->Trace( "ScreenAttract::~ScreenAttract()" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenAttract::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
|
|
|
|
{
|
2003-01-19 04:44:22 +00:00
|
|
|
LOG->Trace( "ScreenAttract::Input()" );
|
2003-01-08 23:43:54 +00:00
|
|
|
|
2003-01-10 02:22:07 +00:00
|
|
|
if(type != IET_FIRST_PRESS) return; // don't care
|
|
|
|
|
|
2003-01-19 04:44:22 +00:00
|
|
|
if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == SDLK_F3 )
|
|
|
|
|
{
|
|
|
|
|
(int&)PREFSMAN->m_CoinMode = (PREFSMAN->m_CoinMode+1) % PrefsManager::NUM_COIN_MODES;
|
2003-02-12 11:43:08 +00:00
|
|
|
/*ResetGame();
|
|
|
|
|
This causes problems on ScreenIntroMovie, which results in the
|
|
|
|
|
movie being restarted and/or becoming out-of-synch -- Miryokuteki */
|
|
|
|
|
|
2003-01-19 04:44:22 +00:00
|
|
|
CString sMessage = "Coin Mode: ";
|
|
|
|
|
switch( PREFSMAN->m_CoinMode )
|
|
|
|
|
{
|
|
|
|
|
case PrefsManager::COIN_HOME: sMessage += "HOME"; break;
|
|
|
|
|
case PrefsManager::COIN_PAY: sMessage += "PAY"; break;
|
|
|
|
|
case PrefsManager::COIN_FREE: sMessage += "FREE"; break;
|
|
|
|
|
}
|
2003-02-12 11:43:08 +00:00
|
|
|
SCREENMAN->RefreshCreditsMessages();
|
2003-01-19 04:44:22 +00:00
|
|
|
SCREENMAN->SystemMessage( sMessage );
|
2003-01-08 23:43:54 +00:00
|
|
|
return;
|
2003-01-19 04:44:22 +00:00
|
|
|
}
|
2003-01-08 23:43:54 +00:00
|
|
|
|
2003-01-10 02:22:07 +00:00
|
|
|
if( MenuI.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
switch( MenuI.button )
|
|
|
|
|
{
|
|
|
|
|
case MENU_BUTTON_LEFT:
|
|
|
|
|
case MENU_BUTTON_RIGHT:
|
2003-01-26 20:49:05 +00:00
|
|
|
this->SendScreenMessage( SM_BeginFadingOut, 0 );
|
2003-01-10 02:22:07 +00:00
|
|
|
break;
|
2003-01-19 04:44:22 +00:00
|
|
|
case MENU_BUTTON_COIN:
|
2003-02-12 11:43:08 +00:00
|
|
|
/* Credit already taken care of.. go forth -- Miryokuteki */
|
|
|
|
|
//Screen::MenuCoin( MenuI.player ); // increment coins, play sound
|
2003-01-21 02:16:40 +00:00
|
|
|
SOUNDMAN->StopMusic();
|
2003-02-14 06:43:23 +00:00
|
|
|
SDL_Delay( 800 ); // do a little pause, like the arcade does
|
2003-01-10 02:22:07 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
|
|
|
|
break;
|
2003-01-19 04:44:22 +00:00
|
|
|
case MENU_BUTTON_START:
|
2003-01-10 02:22:07 +00:00
|
|
|
case MENU_BUTTON_BACK:
|
2003-01-19 04:44:22 +00:00
|
|
|
|
|
|
|
|
switch( PREFSMAN->m_CoinMode )
|
|
|
|
|
{
|
|
|
|
|
case PrefsManager::COIN_PAY:
|
|
|
|
|
if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit )
|
|
|
|
|
break; // don't fall through
|
|
|
|
|
// fall through
|
|
|
|
|
case PrefsManager::COIN_FREE:
|
|
|
|
|
case PrefsManager::COIN_HOME:
|
2003-01-21 02:16:40 +00:00
|
|
|
SOUNDMAN->StopMusic();
|
2003-01-19 04:44:22 +00:00
|
|
|
SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","insert coin") );
|
2003-02-14 06:43:23 +00:00
|
|
|
SDL_Delay( 800 ); // do a little pause, like the arcade does
|
2003-01-19 04:44:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
2003-01-10 02:22:07 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
2003-01-08 23:43:54 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-10 02:22:07 +00:00
|
|
|
void ScreenAttract::Update( float fDelta )
|
|
|
|
|
{
|
2003-01-08 23:43:54 +00:00
|
|
|
Screen::Update(fDelta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenAttract::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
|
|
|
|
case SM_BeginFadingOut:
|
2003-01-10 02:22:07 +00:00
|
|
|
if( !m_Fade.IsClosing() )
|
|
|
|
|
m_Fade.CloseWipingRight( SM_GoToNextScreen );
|
2003-01-08 23:43:54 +00:00
|
|
|
break;
|
|
|
|
|
case SM_GoToNextScreen:
|
2003-01-19 10:14:46 +00:00
|
|
|
/* XXX: Look at the def of the screen we're going to; if it has a
|
|
|
|
|
* music theme element and it's the same as the one we're playing
|
|
|
|
|
* now, don't stop. (However, if we're going to interrupt it
|
|
|
|
|
* when we fade in, it's cleaner to stop it before we fade out.) */
|
2003-01-26 20:49:05 +00:00
|
|
|
/* Don't stop the music, or else the music will start over from the
|
|
|
|
|
* beginning for consecutive screens with the same music. -Chris */
|
|
|
|
|
//SOUNDMAN->PlayMusic( "" );
|
2003-01-08 23:43:54 +00:00
|
|
|
SCREENMAN->SetNewScreen( NEXT_SCREEN );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|