Files
itgmania212121/stepmania/src/ScreenStage.cpp
T

138 lines
4.2 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 "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"
#include "ThemeManager.h"
2003-11-16 04:45:12 +00:00
#include "LightsManager.h"
2002-07-23 01:41:40 +00:00
#define MINIMUM_DELAY THEME->GetMetricF(m_sName,"MinimumDelay")
AutoScreenMessage( SM_PrepScreen )
2006-01-15 20:46:15 +00:00
REGISTER_SCREEN_CLASS( ScreenStage );
void ScreenStage::Init()
{
Screen::Init();
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
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 );
2005-01-17 04:10:50 +00:00
m_In.Load( THEME->GetPathB(m_sName,"in") );
m_In.StartTransitioning();
2004-05-02 03:01:27 +00:00
m_In.SetDrawOrder( DRAW_ORDER_TRANSITIONS );
this->AddChild( &m_In );
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 );
this->AddChild( &m_Out );
m_Cancel.Load( THEME->GetPathB(m_sName,"cancel") );
m_Cancel.SetDrawOrder( DRAW_ORDER_TRANSITIONS );
this->AddChild( &m_Cancel );
2005-05-06 10:48:32 +00:00
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("stage "+StageToString(GAMESTATE->GetCurrentStage())) );
2004-05-02 03:01:27 +00:00
this->SortByDrawOrder();
}
2002-05-20 08:59:37 +00:00
void ScreenStage::HandleScreenMessage( const ScreenMessage SM )
{
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();
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
}
else if( SM == SM_BeginFadingOut )
{
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-06-19 22:52:08 +00:00
Screen::HandleScreenMessage( SM );
2002-05-20 08:59:37 +00:00
}
void ScreenStage::Update( float fDeltaTime )
{
2005-07-13 06:51:08 +00:00
if( this->IsFirstUpdate() )
{
/* Prep the new screen once m_In is complete. */
this->PostScreenMessage( SM_PrepScreen, m_sprOverlay->GetTweenTimeLeft() );
2005-07-13 06:51:08 +00:00
}
Screen::Update( fDeltaTime );
}
2006-09-15 01:47:24 +00:00
void ScreenStage::MenuBack( const InputEventPlus &input )
{
if( m_In.IsTransitioning() || m_Out.IsTransitioning() || m_Cancel.IsTransitioning() )
return;
if( !ALLOW_BACK )
return;
this->ClearMessageQueue();
GAMESTATE->CancelStage();
m_sNextScreen = GetPrevScreen();
m_Cancel.StartTransitioning( SM_GoToPrevScreen );
/* 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();
}
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.
*/