2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-08-13 23:26:46 +00:00
|
|
|
Class: ScreenCaution
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
Desc: Screen that displays while resources are being loaded.
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-08-13 23:26:46 +00:00
|
|
|
Chris Danford
|
2002-05-20 08:59:37 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ScreenCaution.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "PrefsManager.h"
|
2003-03-19 17:23:24 +00:00
|
|
|
#include "ScreenManager.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "AnnouncerManager.h"
|
2002-08-13 23:26:46 +00:00
|
|
|
#include "GameState.h"
|
2003-07-26 22:53:22 +00:00
|
|
|
#include "RageSounds.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2002-08-13 23:26:46 +00:00
|
|
|
|
|
|
|
|
|
2002-08-27 03:59:22 +00:00
|
|
|
#define NEXT_SCREEN THEME->GetMetric("ScreenCaution","NextScreen")
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
const ScreenMessage SM_DoneOpening = ScreenMessage(SM_User-7);
|
|
|
|
|
const ScreenMessage SM_StartClosing = ScreenMessage(SM_User-8);
|
|
|
|
|
|
|
|
|
|
|
2003-09-27 22:30:51 +00:00
|
|
|
ScreenCaution::ScreenCaution( CString sName ) : Screen( sName )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
GAMESTATE->m_bPlayersCanJoin = true;
|
|
|
|
|
|
2002-12-15 10:07:27 +00:00
|
|
|
if(!PREFSMAN->m_bShowDontDie)
|
|
|
|
|
{
|
2003-03-25 21:17:29 +00:00
|
|
|
this->PostScreenMessage( SM_GoToNextScreen, 0.f );
|
2002-12-15 10:07:27 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_Background.LoadFromAniDir( THEME->GetPathToB("ScreenCaution background") );
|
2002-09-23 07:35:47 +00:00
|
|
|
this->AddChild( &m_Background );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_In.Load( THEME->GetPathToB("ScreenCaution in") );
|
2003-03-05 08:48:35 +00:00
|
|
|
m_In.StartTransitioning( SM_DoneOpening );
|
|
|
|
|
this->AddChild( &m_In );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_Out.Load( THEME->GetPathToB("ScreenCaution out") );
|
2003-03-05 08:48:35 +00:00
|
|
|
this->AddChild( &m_Out );
|
|
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_Back.Load( THEME->GetPathToB("Common back") );
|
2003-03-05 08:48:35 +00:00
|
|
|
this->AddChild( &m_Back );
|
2002-08-20 07:58:19 +00:00
|
|
|
|
2003-07-07 20:24:51 +00:00
|
|
|
this->PostScreenMessage( SM_StartClosing, m_Background.GetLengthSeconds()-m_Out.GetLengthSeconds() );
|
2002-08-27 16:53:25 +00:00
|
|
|
|
2003-07-26 22:53:22 +00:00
|
|
|
SOUND->PlayMusic( THEME->GetPathToS("ScreenCaution music") );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenCaution::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
|
|
|
|
{
|
2003-03-09 03:28:34 +00:00
|
|
|
if( Screen::JoinInput( DeviceI, type, GameI, MenuI, StyleI ) )
|
|
|
|
|
return; // handled
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenCaution::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
|
|
|
|
case SM_StartClosing:
|
2003-07-10 03:37:13 +00:00
|
|
|
if( !m_In.IsTransitioning() && !m_Out.IsTransitioning() )
|
|
|
|
|
{
|
|
|
|
|
m_Background.PlayOffCommand();
|
2003-03-05 08:48:35 +00:00
|
|
|
m_Out.StartTransitioning( SM_GoToNextScreen );
|
2003-07-10 03:37:13 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
break;
|
|
|
|
|
case SM_DoneOpening:
|
2003-07-26 22:53:22 +00:00
|
|
|
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("caution") );
|
2002-05-20 08:59:37 +00:00
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToPrevScreen:
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
2002-08-20 07:58:19 +00:00
|
|
|
break;
|
2002-08-27 03:59:22 +00:00
|
|
|
case SM_GoToNextScreen:
|
|
|
|
|
SCREENMAN->SetNewScreen( NEXT_SCREEN );
|
2002-05-20 08:59:37 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenCaution::MenuStart( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-07-10 03:37:13 +00:00
|
|
|
if( !m_In.IsTransitioning() && !m_Out.IsTransitioning() )
|
|
|
|
|
{
|
|
|
|
|
m_Background.PlayOffCommand();
|
2003-03-09 03:28:34 +00:00
|
|
|
m_Out.StartTransitioning( SM_GoToNextScreen );
|
2003-07-10 03:37:13 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
2002-08-20 07:58:19 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenCaution::MenuBack( PlayerNumber pn )
|
2002-08-20 07:58:19 +00:00
|
|
|
{
|
2003-03-09 09:25:32 +00:00
|
|
|
if( m_In.IsTransitioning() || m_Out.IsTransitioning() || m_Back.IsTransitioning() )
|
2002-08-20 08:29:55 +00:00
|
|
|
return;
|
2002-08-20 07:58:19 +00:00
|
|
|
this->ClearMessageQueue();
|
2003-03-05 08:48:35 +00:00
|
|
|
m_Back.StartTransitioning( SM_GoToPrevScreen );
|
2003-07-26 22:53:22 +00:00
|
|
|
SOUND->PlayOnce( THEME->GetPathToS("Common back") );
|
2002-08-20 07:58:19 +00:00
|
|
|
}
|
|
|
|
|
|