2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "ScreenStage.h"
|
2005-06-19 22:54:06 +00:00
|
|
|
#include "ActorUtil.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "AnnouncerManager.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "GameState.h"
|
2004-07-08 00:10:34 +00:00
|
|
|
#include "GameSoundManager.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2003-11-16 04:45:12 +00:00
|
|
|
#include "LightsManager.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
|
2004-04-25 22:52:15 +00:00
|
|
|
#define MINIMUM_DELAY THEME->GetMetricF(m_sName,"MinimumDelay")
|
2003-03-10 00:16:49 +00:00
|
|
|
|
2005-03-28 08:01:36 +00:00
|
|
|
AutoScreenMessage( SM_PrepScreen )
|
2003-03-10 00:16:49 +00:00
|
|
|
|
2006-01-15 20:46:15 +00:00
|
|
|
REGISTER_SCREEN_CLASS( ScreenStage );
|
2005-02-23 06:29:05 +00:00
|
|
|
|
|
|
|
|
void ScreenStage::Init()
|
|
|
|
|
{
|
|
|
|
|
Screen::Init();
|
|
|
|
|
|
2005-03-12 00:31:25 +00:00
|
|
|
ALLOW_BACK.Load( m_sName, "AllowBack" );
|
|
|
|
|
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->StopMusic();
|
2002-07-28 20:28:37 +00:00
|
|
|
|
2004-03-23 06:11:10 +00:00
|
|
|
LIGHTSMAN->SetLightsMode( LIGHTSMODE_STAGE );
|
2003-11-16 04:45:12 +00:00
|
|
|
|
2005-06-19 22:48:58 +00:00
|
|
|
m_sprOverlay.Load( THEME->GetPathB(m_sName,"overlay") );
|
|
|
|
|
m_sprOverlay->SetName( "Overlay" );
|
|
|
|
|
m_sprOverlay->SetDrawOrder( DRAW_ORDER_OVERLAY );
|
|
|
|
|
ON_COMMAND( m_sprOverlay );
|
|
|
|
|
this->AddChild( m_sprOverlay );
|
2003-12-19 09:30:54 +00:00
|
|
|
|
2005-01-17 04:10:50 +00:00
|
|
|
m_In.Load( THEME->GetPathB(m_sName,"in") );
|
2003-03-17 01:48:40 +00:00
|
|
|
m_In.StartTransitioning();
|
2004-05-02 03:01:27 +00:00
|
|
|
m_In.SetDrawOrder( DRAW_ORDER_TRANSITIONS );
|
2003-03-10 00:16:49 +00:00
|
|
|
this->AddChild( &m_In );
|
2002-08-27 23:31:41 +00:00
|
|
|
|
2005-01-17 04:10:50 +00:00
|
|
|
m_Out.Load( THEME->GetPathB(m_sName,"out") );
|
2004-05-02 03:01:27 +00:00
|
|
|
m_Out.SetDrawOrder( DRAW_ORDER_TRANSITIONS );
|
2003-03-10 00:16:49 +00:00
|
|
|
this->AddChild( &m_Out );
|
2002-08-27 23:31:41 +00:00
|
|
|
|
2005-03-20 06:14:41 +00:00
|
|
|
m_Cancel.Load( THEME->GetPathB(m_sName,"cancel") );
|
|
|
|
|
m_Cancel.SetDrawOrder( DRAW_ORDER_TRANSITIONS );
|
|
|
|
|
this->AddChild( &m_Cancel );
|
2003-12-19 09:30:54 +00:00
|
|
|
|
2005-05-06 10:48:32 +00:00
|
|
|
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("stage "+StageToString(GAMESTATE->GetCurrentStage())) );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2004-05-02 03:01:27 +00:00
|
|
|
this->SortByDrawOrder();
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
void ScreenStage::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
2005-03-23 08:48:38 +00:00
|
|
|
if( SM == SM_PrepScreen )
|
2005-02-07 23:46:41 +00:00
|
|
|
{
|
|
|
|
|
RageTimer length;
|
2006-01-15 18:35:26 +00:00
|
|
|
SCREENMAN->PrepareScreen( GetNextScreen() );
|
2005-02-07 23:46:41 +00:00
|
|
|
float fScreenLoadSeconds = length.GetDeltaTime();
|
2004-04-25 22:52:15 +00:00
|
|
|
|
2005-02-07 23:46:41 +00:00
|
|
|
/* The screen load took fScreenLoadSeconds. Move on to the next screen after
|
|
|
|
|
* no less than MINIMUM_DELAY seconds. */
|
|
|
|
|
this->PostScreenMessage( SM_BeginFadingOut, max( 0, MINIMUM_DELAY-fScreenLoadSeconds) );
|
2005-06-19 22:52:08 +00:00
|
|
|
return;
|
2005-02-07 23:46:41 +00:00
|
|
|
}
|
2005-03-23 08:48:38 +00:00
|
|
|
else if( SM == SM_BeginFadingOut )
|
|
|
|
|
{
|
2006-11-13 21:04:17 +00:00
|
|
|
if( m_sprOverlay->GetTweenTimeLeft() )
|
2005-07-13 06:51:08 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Clear any other SM_BeginFadingOut messages. */
|
|
|
|
|
this->ClearMessageQueue( SM_BeginFadingOut );
|
|
|
|
|
|
2004-04-25 22:40:31 +00:00
|
|
|
m_Out.StartTransitioning();
|
2006-07-23 22:43:28 +00:00
|
|
|
OFF_COMMAND( m_sprOverlay );
|
2004-04-25 22:40:31 +00:00
|
|
|
this->PostScreenMessage( SM_GoToNextScreen, this->GetTweenTimeLeft() );
|
2005-06-19 22:52:08 +00:00
|
|
|
return;
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
2005-06-19 22:52:08 +00:00
|
|
|
|
|
|
|
|
Screen::HandleScreenMessage( SM );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
2003-03-10 02:29:01 +00:00
|
|
|
|
2004-05-22 01:17:09 +00:00
|
|
|
void ScreenStage::Update( float fDeltaTime )
|
|
|
|
|
{
|
2005-07-13 06:51:08 +00:00
|
|
|
if( this->IsFirstUpdate() )
|
|
|
|
|
{
|
2006-11-13 21:04:17 +00:00
|
|
|
/* Prep the new screen once m_In is complete. */
|
|
|
|
|
this->PostScreenMessage( SM_PrepScreen, m_sprOverlay->GetTweenTimeLeft() );
|
2005-07-13 06:51:08 +00:00
|
|
|
}
|
|
|
|
|
|
2004-05-22 01:17:09 +00:00
|
|
|
Screen::Update( fDeltaTime );
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-15 01:47:24 +00:00
|
|
|
void ScreenStage::MenuBack( const InputEventPlus &input )
|
2003-03-10 02:29:01 +00:00
|
|
|
{
|
2005-03-20 06:14:41 +00:00
|
|
|
if( m_In.IsTransitioning() || m_Out.IsTransitioning() || m_Cancel.IsTransitioning() )
|
2003-03-10 02:29:01 +00:00
|
|
|
return;
|
|
|
|
|
|
2005-03-14 20:26:50 +00:00
|
|
|
if( !ALLOW_BACK )
|
2005-03-12 00:31:25 +00:00
|
|
|
return;
|
|
|
|
|
|
2003-03-10 02:29:01 +00:00
|
|
|
this->ClearMessageQueue();
|
2006-07-03 06:18:18 +00:00
|
|
|
GAMESTATE->CancelStage();
|
2006-06-25 18:11:09 +00:00
|
|
|
m_sNextScreen = GetPrevScreen();
|
2005-03-20 06:14:41 +00:00
|
|
|
m_Cancel.StartTransitioning( SM_GoToPrevScreen );
|
2004-05-22 01:17:09 +00:00
|
|
|
|
|
|
|
|
/* If a Back is buffered while we're prepping the screen (very common), we'll
|
|
|
|
|
* get it right after the prep finishes. However, the next update will contain
|
|
|
|
|
* the time spent prepping the screen. Zero the next delta, so the update is
|
|
|
|
|
* seen. */
|
2005-10-13 07:12:46 +00:00
|
|
|
SCREENMAN->ZeroNextUpdate();
|
2003-03-10 02:29:01 +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.
|
|
|
|
|
*/
|