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
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: ScreenStage
|
|
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#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-08-27 03:59:22 +00:00
|
|
|
|
2004-02-01 03:01:54 +00:00
|
|
|
#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen")
|
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
|
|
|
{
|
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()) );
|
2003-03-10 00:16:49 +00:00
|
|
|
this->AddChild( &m_Background );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-02-01 03:01:54 +00:00
|
|
|
m_Overlay.LoadFromAniDir( THEME->GetPathToB(m_sName + " 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();
|
2003-03-10 00:16:49 +00:00
|
|
|
this->AddChild( &m_In );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2004-02-01 03:01:54 +00:00
|
|
|
m_Out.Load( THEME->GetPathToB(m_sName + " out") );
|
2003-03-10 00:16:49 +00:00
|
|
|
this->AddChild( &m_Out );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_Back.Load( THEME->GetPathToB("Common back") );
|
2003-03-10 02:29:01 +00:00
|
|
|
this->AddChild( &m_Back );
|
2003-12-19 09:30:54 +00:00
|
|
|
|
2003-03-17 01:48:40 +00:00
|
|
|
/* Prep the new screen once the animation is complete. This way, we
|
|
|
|
|
* start loading the gameplay screen as soon as possible. */
|
2003-03-25 21:17:29 +00:00
|
|
|
this->PostScreenMessage( SM_PrepScreen, m_Background.GetLengthSeconds() );
|
2003-03-17 01:48:40 +00:00
|
|
|
|
|
|
|
|
/* Start fading out after m_In is complete, minus the length of m_Out. This
|
|
|
|
|
* essentially makes m_In a timer to pad the length, so we always wait a minimum
|
|
|
|
|
* amount of time. It's a slightly confusing timer, though; maybe we shouldn't
|
|
|
|
|
* make m_Out affect it. (Maybe just make it a metric? XXX) */
|
|
|
|
|
float fStartFadingOutSeconds = m_In.GetLengthSeconds() - m_Out.GetLengthSeconds();
|
|
|
|
|
|
|
|
|
|
/* Never do this before we send SM_PrepScreen--we havn't loaded the screen yet. */
|
|
|
|
|
fStartFadingOutSeconds = max(fStartFadingOutSeconds, m_Background.GetLengthSeconds());
|
|
|
|
|
|
2003-03-25 21:17:29 +00:00
|
|
|
this->PostScreenMessage( SM_BeginFadingOut, fStartFadingOutSeconds );
|
2003-03-17 01:48:40 +00:00
|
|
|
|
2003-12-19 09:30:54 +00:00
|
|
|
int p;
|
|
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
|
|
|
|
Character* pChar = GAMESTATE->m_pCurCharacters[p];
|
|
|
|
|
m_sprCharacterIcon[p].SetName( ssprintf("CharacterIconP%d",p+1) );
|
|
|
|
|
m_sprCharacterIcon[p].Load( pChar->GetStageIconPath() );
|
|
|
|
|
SET_XY( m_sprCharacterIcon[p] );
|
|
|
|
|
ON_COMMAND( m_sprCharacterIcon[p] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_SongTitle.SetName( "SongTitle");
|
|
|
|
|
m_Artist.SetName( "Artist" );
|
|
|
|
|
m_SongTitle.LoadFromFont( THEME->GetPathToF("ScreenStage Title") );
|
|
|
|
|
m_Artist.LoadFromFont( THEME->GetPathToF("ScreenStage Artist") );
|
|
|
|
|
|
|
|
|
|
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 )
|
|
|
|
|
if( GAMESTATE->m_pCurSong != NULL)
|
|
|
|
|
if( GAMESTATE->m_pCurSong->HasBanner() )
|
|
|
|
|
m_Banner.LoadFromSong( GAMESTATE->m_pCurSong );
|
|
|
|
|
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-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
void ScreenStage::Update( float fDeltaTime )
|
|
|
|
|
{
|
|
|
|
|
Screen::Update( fDeltaTime );
|
2003-12-19 09:30:54 +00:00
|
|
|
int p;
|
|
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
m_sprCharacterIcon[p].Update(fDeltaTime);
|
|
|
|
|
m_Overlay.Update(fDeltaTime);
|
|
|
|
|
if ( PREFSMAN->m_bShowBanners )
|
2004-04-25 08:54:10 +00:00
|
|
|
if( GAMESTATE->m_pCurSong && GAMESTATE->m_pCurSong->HasBanner() )
|
|
|
|
|
m_Banner.Update(fDeltaTime);
|
2003-12-19 09:30:54 +00:00
|
|
|
m_SongTitle.Update(fDeltaTime);
|
|
|
|
|
m_Artist.Update(fDeltaTime);
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenStage::DrawPrimitives()
|
|
|
|
|
{
|
2002-08-28 22:42:40 +00:00
|
|
|
Screen::DrawPrimitives();
|
2003-12-19 09:30:54 +00:00
|
|
|
int p;
|
|
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
m_sprCharacterIcon[p].Draw();
|
|
|
|
|
m_Overlay.Draw();
|
|
|
|
|
if ( PREFSMAN->m_bShowBanners )
|
2004-04-25 08:54:10 +00:00
|
|
|
if( GAMESTATE->m_pCurSong && GAMESTATE->m_pCurSong->HasBanner() )
|
|
|
|
|
m_Banner.Draw();
|
2003-12-19 09:30:54 +00:00
|
|
|
m_SongTitle.Draw();
|
|
|
|
|
m_Artist.Draw();
|
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:
|
2003-03-10 00:16:49 +00:00
|
|
|
SCREENMAN->PrepNewScreen( NEXT_SCREEN );
|
2002-05-20 08:59:37 +00:00
|
|
|
break;
|
2003-03-10 00:16:49 +00:00
|
|
|
case SM_BeginFadingOut:
|
|
|
|
|
m_Out.StartTransitioning( SM_GoToNextScreen );
|
2003-12-19 09:30:54 +00:00
|
|
|
int p;
|
|
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
OFF_COMMAND( m_sprCharacterIcon[p] );
|
|
|
|
|
OFF_COMMAND( m_SongTitle );
|
|
|
|
|
OFF_COMMAND( m_Artist );
|
|
|
|
|
OFF_COMMAND( m_Banner );
|
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
|
|
|
|
|
|
|
|
void ScreenStage::MenuBack( PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
if( m_In.IsTransitioning() || m_Out.IsTransitioning() || m_Back.IsTransitioning() )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
this->ClearMessageQueue();
|
|
|
|
|
m_Back.StartTransitioning( SM_GoToPrevScreen );
|
|
|
|
|
}
|