2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2003-12-19 09:30:54 +00:00
|
|
|
#include "ActorUtil.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "ScreenStage.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "BitmapText.h"
|
|
|
|
|
#include "SongManager.h"
|
|
|
|
|
#include "Sprite.h"
|
|
|
|
|
#include "AnnouncerManager.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "GameState.h"
|
2003-07-26 23:05:16 +00:00
|
|
|
#include "RageSounds.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2003-11-16 04:45:12 +00:00
|
|
|
#include "LightsManager.h"
|
2003-12-20 04:14:12 +00:00
|
|
|
#include "song.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
|
2004-02-01 03:01:54 +00:00
|
|
|
#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen")
|
2004-04-25 22:52:15 +00:00
|
|
|
#define MINIMUM_DELAY THEME->GetMetricF(m_sName,"MinimumDelay")
|
2003-03-10 00:16:49 +00:00
|
|
|
|
2003-03-17 01:48:40 +00:00
|
|
|
const ScreenMessage SM_PrepScreen = (ScreenMessage)(SM_User+0);
|
2003-03-10 00:16:49 +00:00
|
|
|
|
2003-09-27 22:30:51 +00:00
|
|
|
ScreenStage::ScreenStage( CString sClassName ) : Screen( sClassName )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2004-05-22 01:17:09 +00:00
|
|
|
m_bZeroDeltaOnNextUpdate = false;
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2004-02-01 03:01:54 +00:00
|
|
|
m_Background.LoadFromAniDir( THEME->GetPathToB(m_sName + " "+GAMESTATE->GetStageText()) );
|
2004-05-02 03:01:27 +00:00
|
|
|
m_Background.SetDrawOrder( DRAW_ORDER_BEFORE_EVERYTHING );
|
2003-03-10 00:16:49 +00:00
|
|
|
this->AddChild( &m_Background );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-04-25 22:40:31 +00:00
|
|
|
m_Overlay.SetName( "Overlay" );
|
2004-02-01 03:01:54 +00:00
|
|
|
m_Overlay.LoadFromAniDir( THEME->GetPathToB(m_sName + " overlay"));
|
2004-04-25 22:40:31 +00:00
|
|
|
ON_COMMAND( m_Overlay );
|
|
|
|
|
this->AddChild( &m_Overlay );
|
2003-12-19 09:30:54 +00:00
|
|
|
|
2004-02-01 03:01:54 +00:00
|
|
|
m_In.Load( THEME->GetPathToB(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
|
|
|
|
2004-02-01 03:01:54 +00:00
|
|
|
m_Out.Load( THEME->GetPathToB(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
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_Back.Load( THEME->GetPathToB("Common back") );
|
2004-05-02 03:01:27 +00:00
|
|
|
m_Back.SetDrawOrder( DRAW_ORDER_TRANSITIONS );
|
2003-03-10 02:29:01 +00:00
|
|
|
this->AddChild( &m_Back );
|
2003-12-19 09:30:54 +00:00
|
|
|
|
2004-04-25 22:52:15 +00:00
|
|
|
/* Prep the new screen once m_In is complete. */
|
2003-03-25 21:17:29 +00:00
|
|
|
this->PostScreenMessage( SM_PrepScreen, m_Background.GetLengthSeconds() );
|
2003-03-17 01:48:40 +00:00
|
|
|
|
2004-05-22 02:01:58 +00:00
|
|
|
FOREACH_PlayerNumber(p)
|
2003-12-19 09:30:54 +00:00
|
|
|
{
|
|
|
|
|
Character* pChar = GAMESTATE->m_pCurCharacters[p];
|
|
|
|
|
m_sprCharacterIcon[p].SetName( ssprintf("CharacterIconP%d",p+1) );
|
|
|
|
|
m_sprCharacterIcon[p].Load( pChar->GetStageIconPath() );
|
2004-04-25 22:40:31 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( m_sprCharacterIcon[p] );
|
|
|
|
|
this->AddChild( &m_sprCharacterIcon[p] );
|
2003-12-19 09:30:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_SongTitle.SetName( "SongTitle");
|
|
|
|
|
m_Artist.SetName( "Artist" );
|
|
|
|
|
m_SongTitle.LoadFromFont( THEME->GetPathToF("ScreenStage Title") );
|
|
|
|
|
m_Artist.LoadFromFont( THEME->GetPathToF("ScreenStage Artist") );
|
|
|
|
|
|
2004-04-25 22:40:31 +00:00
|
|
|
this->AddChild( &m_SongTitle );
|
|
|
|
|
this->AddChild( &m_Artist );
|
|
|
|
|
|
2003-12-19 09:30:54 +00:00
|
|
|
if(GAMESTATE->m_pCurSong != NULL)
|
|
|
|
|
{
|
|
|
|
|
m_SongTitle.SetText( GAMESTATE->m_pCurSong->m_sMainTitle );
|
|
|
|
|
m_Artist.SetText( GAMESTATE->m_pCurSong->m_sArtist );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_SongTitle.SetText( "" );
|
|
|
|
|
m_Artist.SetText( "" );
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-20 01:12:38 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( m_Artist );
|
|
|
|
|
SET_XY_AND_ON_COMMAND( m_SongTitle );
|
2003-12-19 09:30:54 +00:00
|
|
|
|
|
|
|
|
if ( PREFSMAN->m_bShowBanners )
|
2004-04-25 22:40:31 +00:00
|
|
|
if( GAMESTATE->m_pCurSong && GAMESTATE->m_pCurSong->HasBanner() )
|
|
|
|
|
{
|
|
|
|
|
m_Banner.LoadFromSong( GAMESTATE->m_pCurSong );
|
|
|
|
|
this->AddChild( &m_Banner );
|
|
|
|
|
}
|
2003-12-19 09:30:54 +00:00
|
|
|
m_Banner.SetName("Banner");
|
|
|
|
|
SET_XY( m_Banner );
|
|
|
|
|
ON_COMMAND(m_Banner);
|
2003-03-17 01:48:40 +00:00
|
|
|
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("stage "+GAMESTATE->GetStageText()) );
|
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 )
|
|
|
|
|
{
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
2003-03-17 01:48:40 +00:00
|
|
|
case SM_PrepScreen:
|
2004-04-25 22:52:15 +00:00
|
|
|
/* Start fading out in after MINIMUM_DELAY seconds. Loading the screen
|
|
|
|
|
* might take longer than that, in which case we'll fade out as early as
|
|
|
|
|
* we can. */
|
|
|
|
|
this->PostScreenMessage( SM_BeginFadingOut, MINIMUM_DELAY );
|
|
|
|
|
|
2003-03-10 00:16:49 +00:00
|
|
|
SCREENMAN->PrepNewScreen( NEXT_SCREEN );
|
2002-05-20 08:59:37 +00:00
|
|
|
break;
|
2004-04-25 22:52:15 +00:00
|
|
|
|
2003-03-10 00:16:49 +00:00
|
|
|
case SM_BeginFadingOut:
|
2004-04-25 22:40:31 +00:00
|
|
|
m_Out.StartTransitioning();
|
2004-05-24 08:16:17 +00:00
|
|
|
FOREACH_PlayerNumber( p )
|
2003-12-19 09:30:54 +00:00
|
|
|
OFF_COMMAND( m_sprCharacterIcon[p] );
|
|
|
|
|
OFF_COMMAND( m_SongTitle );
|
|
|
|
|
OFF_COMMAND( m_Artist );
|
|
|
|
|
OFF_COMMAND( m_Banner );
|
2004-04-25 22:40:31 +00:00
|
|
|
OFF_COMMAND( m_Background );
|
|
|
|
|
|
|
|
|
|
this->PostScreenMessage( SM_GoToNextScreen, this->GetTweenTimeLeft() );
|
|
|
|
|
|
2002-07-11 19:02:26 +00:00
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToNextScreen:
|
2002-09-04 23:40:01 +00:00
|
|
|
SCREENMAN->LoadPreppedScreen(); /* use prepped */
|
2002-05-20 08:59:37 +00:00
|
|
|
break;
|
2003-03-10 02:29:01 +00:00
|
|
|
case SM_GoToPrevScreen:
|
|
|
|
|
SCREENMAN->DeletePreppedScreen();
|
|
|
|
|
SCREENMAN->SetNewScreen( "ScreenSelectMusic" );
|
|
|
|
|
break;
|
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 )
|
|
|
|
|
{
|
|
|
|
|
if( m_bZeroDeltaOnNextUpdate )
|
|
|
|
|
{
|
|
|
|
|
m_bZeroDeltaOnNextUpdate = false;
|
|
|
|
|
fDeltaTime = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Screen::Update( fDeltaTime );
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-10 02:29:01 +00:00
|
|
|
void ScreenStage::MenuBack( PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
if( m_In.IsTransitioning() || m_Out.IsTransitioning() || m_Back.IsTransitioning() )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
this->ClearMessageQueue();
|
|
|
|
|
m_Back.StartTransitioning( SM_GoToPrevScreen );
|
2004-05-22 01:17:09 +00:00
|
|
|
SOUND->PlayOnce( THEME->GetPathToS("Common back") );
|
|
|
|
|
|
|
|
|
|
/* 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. */
|
|
|
|
|
m_bZeroDeltaOnNextUpdate = true;
|
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.
|
|
|
|
|
*/
|