don't hard code a sleep - let a BGAnimation control the transition

This commit is contained in:
Chris Danford
2005-04-01 12:35:49 +00:00
parent c40ab7f7a7
commit 2480c02254
11 changed files with 45 additions and 54 deletions
@@ -0,0 +1 @@
_fade out normal
+1 -2
View File
@@ -6,7 +6,6 @@ InitialScreen=ScreenCompany
WindowTitle=StepMania
DefaultModifiers=
DefaultCpuModifiers=
JoinPauseSeconds=0.8
DifficultiesToShow=beginner,easy,medium,hard,challenge
CourseDifficultiesToShow=easy,regular,difficult
StepsTypesToHide=dance-couple,dance-solo,pump-halfdouble,lights-cabinet
@@ -998,7 +997,7 @@ OverlayOffCommand=
[ScreenGameplay]
Class=ScreenGameplay
Fallback=Screen
Fallback=ScreenWithMenuElementsBlank
ShowEvaluationOnFail=0
StaticBGY=SCREEN_CENTER_Y+0
StaticBGX=SCREEN_CENTER_X+0
-1
View File
@@ -14,7 +14,6 @@ ThemeMetric<CString> FIRST_RUN_INITIAL_SCREEN ("Common","FirstRunInitialScreen
ThemeMetric<CString> DEFAULT_MODIFIERS ("Common","DefaultModifiers" );
ThemeMetric<CString> DEFAULT_CPU_MODIFIERS ("Common","DefaultCpuModifiers" );
ThemeMetric1D<RageColor> PLAYER_COLOR ("Common",PLAYER_COLOR_NAME,NUM_PLAYERS);
ThemeMetric<float> JOIN_PAUSE_SECONDS ("Common","JoinPauseSeconds");
ThemeMetric<CString> WINDOW_TITLE ("Common","WindowTitle");
ThemeMetric<bool> HOME_EDIT_MODE ("Common","HomeEditMode");
ThemeMetric<int> MAX_COURSE_ENTRIES_BEFORE_VARIOUS ("Common","MaxCourseEntriesBeforeShowVarious");
-1
View File
@@ -49,7 +49,6 @@ extern ThemeMetric<CString> FIRST_RUN_INITIAL_SCREEN;
extern ThemeMetric<CString> DEFAULT_MODIFIERS;
extern ThemeMetric<CString> DEFAULT_CPU_MODIFIERS;
extern ThemeMetric1D<RageColor> PLAYER_COLOR;
extern ThemeMetric<float> JOIN_PAUSE_SECONDS;
extern ThemeMetric<CString> WINDOW_TITLE;
extern ThemeMetric<bool> HOME_EDIT_MODE;
extern ThemeMetric<int> MAX_COURSE_ENTRIES_BEFORE_VARIOUS;
+27 -15
View File
@@ -16,10 +16,9 @@
#include "CommonMetrics.h"
#include "BGAnimation.h"
#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen")
#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen")
#define START_SCREEN(sScreenName) THEME->GetMetric (sScreenName,"StartScreen")
REGISTER_SCREEN_CLASS( ScreenAttract );
ScreenAttract::ScreenAttract( CString sName, bool bResetGameState ) : ScreenWithMenuElements( sName )
{
@@ -49,10 +48,10 @@ void ScreenAttract::Input( const DeviceInput& DeviceI, const InputEventType type
{
// LOG->Trace( "ScreenAttract::Input()" );
AttractInput( DeviceI, type, GameI, MenuI, StyleI, m_In.IsTransitioning() || m_Out.IsTransitioning(), m_sName );
AttractInput( DeviceI, type, GameI, MenuI, StyleI, this );
}
void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, bool bTransitioning, CString sScreenName )
void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, ScreenWithMenuElements *pScreen )
{
if(type != IET_FIRST_PRESS)
return; // don't care
@@ -75,14 +74,19 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
// fall through
case COIN_HOME:
case COIN_FREE:
if( pScreen->IsTransitioning() )
return;
LOG->Trace("ScreenAttract::AttractInput: begin fading to START_SCREEN" );
SOUND->StopMusic();
SCREENMAN->SendMessageToTopScreen( SM_StopMusic );
/* HandleGlobalInputs() already played the coin sound. Don't play it again. */
if( MenuI.button != MENU_BUTTON_COIN )
SCREENMAN->PlayCoinSound();
SCREENMAN->SendMessageToTopScreen( SM_StopMusic );
usleep( (int)(JOIN_PAUSE_SECONDS*1000*1000) ); // do a little pause, like the arcade does
LOG->Trace("ScreenAttract::AttractInput: go to START_SCREEN" );
SCREENMAN->SetNewScreen( START_SCREEN(sScreenName) );
pScreen->Cancel( SM_GoToStartScreen );
break;
default:
ASSERT(0);
@@ -91,7 +95,7 @@ void ScreenAttract::AttractInput( const DeviceInput& DeviceI, const InputEventTy
}
}
if( bTransitioning )
if( pScreen->IsTransitioning() )
return;
if( MenuI.IsValid() )
@@ -126,14 +130,18 @@ void ScreenAttract::Update( float fDelta )
void ScreenAttract::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
if( SM == SM_MenuTimer ||
SM == SM_BeginFadingOut )
{
case SM_MenuTimer:
case SM_BeginFadingOut:
if( !IsTransitioning() )
StartTransitioning( SM_GoToNextScreen );
break;
case SM_GoToNextScreen:
}
else if( SM == SM_GoToStartScreen )
{
GoToStartScreen( m_sName );
}
else if( SM == SM_GoToNextScreen )
{
/* Look at the def of the screen we're going to; if it has a music theme element
* and it's the same as the one we're playing now, don't stop. However, if we're
* going to interrupt it when we fade in, stop the old music before we fade out. */
@@ -145,10 +153,14 @@ void ScreenAttract::HandleScreenMessage( const ScreenMessage SM )
SOUND->PlayMusic( "" ); // stop the music
SCREENMAN->SetNewScreen( NEXT_SCREEN );
break;
}
}
void ScreenAttract::GoToStartScreen( CString sScreenName )
{
SCREENMAN->SetNewScreen( START_SCREEN(sScreenName) );
}
/*
* (c) 2003-2004 Chris Danford
* All rights reserved.
+4 -1
View File
@@ -5,6 +5,7 @@
#include "ScreenWithMenuElements.h"
AutoScreenMessage( SM_GoToStartScreen )
class ScreenAttract : public ScreenWithMenuElements
{
@@ -13,8 +14,10 @@ public:
virtual void Init();
virtual ~ScreenAttract();
static void AttractInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, ScreenWithMenuElements *pScreen );
static void GoToStartScreen( CString sScreenName );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
static void AttractInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, bool bTransitioning, CString sScreenName );
virtual void Update( float fDelta );
virtual void HandleScreenMessage( const ScreenMessage SM );
+1 -1
View File
@@ -79,7 +79,7 @@ void ScreenDemonstration::HandleScreenMessage( const ScreenMessage SM )
return;
}
ScreenGameplay::HandleScreenMessage( SM );
ScreenJukebox::HandleScreenMessage( SM );
}
/*
+2 -10
View File
@@ -86,7 +86,7 @@ AutoScreenMessage( SM_StopHereWeGo )
static Preference<float> g_fNetStartOffset( Options, "NetworkStartOffset", -3.0 );
REGISTER_SCREEN_CLASS( ScreenGameplay );
ScreenGameplay::ScreenGameplay( CString sName ) : Screen(sName)
ScreenGameplay::ScreenGameplay( CString sName ) : ScreenWithMenuElements(sName)
{
PLAYER_TYPE.Load( sName, "PlayerType" );
GIVE_UP_TEXT.Load( sName, "GiveUpText" );
@@ -99,7 +99,7 @@ ScreenGameplay::ScreenGameplay( CString sName ) : Screen(sName)
void ScreenGameplay::Init()
{
Screen::Init();
ScreenWithMenuElements::Init();
/* Pause MEMCARDMAN. If a memory card is remove, we don't want to interrupt the
* player by making a noise until the game finishes. */
@@ -620,14 +620,6 @@ void ScreenGameplay::Init()
m_textDebug.SetDrawOrder( DRAW_ORDER_TRANSITIONS-1 ); // just under transitions, over the foreground
this->AddChild( &m_textDebug );
m_In.Load( THEME->GetPathB(m_sName,"in") );
m_In.SetDrawOrder( DRAW_ORDER_TRANSITIONS );
this->AddChild( &m_In );
m_Cancel.Load( THEME->GetPathB(m_sName,"cancel") );
m_Cancel.SetDrawOrder( DRAW_ORDER_TRANSITIONS ); // on top of everything else
this->AddChild( &m_Cancel );
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) // only load if we're going to use it
{
+2 -4
View File
@@ -3,7 +3,7 @@
#ifndef SCREEN_GAMEPLAY_H
#define SCREEN_GAMEPLAY_H
#include "Screen.h"
#include "ScreenWithMenuElements.h"
#include "Sprite.h"
#include "Transition.h"
#include "BitmapText.h"
@@ -30,7 +30,7 @@ class Inventory;
AutoScreenMessage( SM_NotesEnded )
class LyricsLoader;
class ScreenGameplay : public Screen
class ScreenGameplay : public ScreenWithMenuElements
{
public:
ScreenGameplay( CString sName );
@@ -139,8 +139,6 @@ protected:
Transition m_Toasty; // easter egg
Transition m_Win[NUM_PLAYERS];
Transition m_Draw;
Transition m_In;
Transition m_Cancel;
AutoActor m_Overlay;
BitmapText m_textSurviveTime; // used in extra stage
+7 -17
View File
@@ -23,7 +23,6 @@
#define SHOW_COURSE_MODIFIERS THEME->GetMetricB("ScreenJukebox","ShowCourseModifiers")
static ThemeMetricDifficultiesToShow DIFFICULTIES_TO_SHOW_HERE("ScreenDemonstration","DifficultiesToShow");
REGISTER_SCREEN_CLASS( ScreenJukebox );
bool ScreenJukebox::SetSong( bool bDemonstration )
{
@@ -126,11 +125,8 @@ void ScreenJukebox::Init()
{
/* Note that you also need to make sure you benchmark with the
* same notes. I use a copy of MaxU with only heavy notes included. */
FOREACH_PlayerNumber( p )
FOREACH_EnabledPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
/* Lots and lots of arrows. This might even bias to arrows a little
* too much. */
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = PlayerOptions();
@@ -142,11 +138,8 @@ void ScreenJukebox::Init()
GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF;
}
FOREACH_PlayerNumber( p )
FOREACH_EnabledPlayer( p )
{
if( !GAMESTATE->IsPlayerEnabled(p) )
continue;
/* Reset the combo, in case ComboContinuesBetweenSongs is enabled. */
Profile* pProfile = PROFILEMAN->GetProfile(p);
if( pProfile )
@@ -176,13 +169,6 @@ void ScreenJukebox::Init()
return;
}
m_In.Load( THEME->GetPathB("ScreenDemonstration","in") );
this->AddChild( &m_In );
m_In.StartTransitioning();
m_Out.Load( THEME->GetPathB("ScreenDemonstration","out") );
this->AddChild( &m_Out );
ClearMessageQueue(); // remove all of the messages set in ScreenGameplay that animate "ready", "here we go", etc.
GAMESTATE->m_bPastHereWeGo = true;
@@ -208,7 +194,7 @@ void ScreenJukebox::Input( const DeviceInput& DeviceI, const InputEventType type
}
}
ScreenAttract::AttractInput( DeviceI, type, GameI, MenuI, StyleI, m_Out.IsTransitioning(), m_sName );
ScreenAttract::AttractInput( DeviceI, type, GameI, MenuI, StyleI, this );
}
void ScreenJukebox::HandleScreenMessage( const ScreenMessage SM )
@@ -227,6 +213,10 @@ void ScreenJukebox::HandleScreenMessage( const ScreenMessage SM )
SCREENMAN->SetNewScreen( "ScreenJukebox" );
return;
}
else if( SM == SM_GoToStartScreen )
{
ScreenAttract::GoToStartScreen( m_sName );
}
ScreenGameplay::HandleScreenMessage( SM );
}
-2
View File
@@ -21,8 +21,6 @@ public:
protected:
bool m_bDemonstration;
Transition m_In;
Transition m_Out;
virtual void InitSongQueues();
};