repositioned MenuElements "play sound on first update" hack inside of Transition where it belongs
This commit is contained in:
@@ -138,7 +138,7 @@ bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller )
|
|||||||
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||||
PlayerNumber pn = pStyleDef->ControllerToPlayerNumber( controller );
|
PlayerNumber pn = pStyleDef->ControllerToPlayerNumber( controller );
|
||||||
|
|
||||||
for( int c=0; c<CodeDetector::NUM_CODES; c++ )
|
for( int c=CODE_MIRROR; c<=CODE_CANCEL_ALL; c++ )
|
||||||
{
|
{
|
||||||
Code code = (Code)c;
|
Code code = (Code)c;
|
||||||
|
|
||||||
@@ -162,8 +162,6 @@ bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller )
|
|||||||
case CODE_HOLDS: TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_bHoldNotes, true, false ); break;
|
case CODE_HOLDS: TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_bHoldNotes, true, false ); break;
|
||||||
case CODE_DARK: FLOAT_TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_fDark ); break;
|
case CODE_DARK: FLOAT_TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_fDark ); break;
|
||||||
case CODE_CANCEL_ALL: GAMESTATE->m_PlayerOptions[pn].Init(); break;
|
case CODE_CANCEL_ALL: GAMESTATE->m_PlayerOptions[pn].Init(); break;
|
||||||
default:
|
|
||||||
ASSERT(0); // unhandled code
|
|
||||||
}
|
}
|
||||||
return true; // don't check any more
|
return true; // don't check any more
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,19 +94,11 @@ void MenuElements::Load( CString sClassName, bool bEnableTimer, bool bLoadStyleI
|
|||||||
|
|
||||||
m_soundBack.Load( THEME->GetPathToS("Common back") );
|
m_soundBack.Load( THEME->GetPathToS("Common back") );
|
||||||
|
|
||||||
m_bStartedTransitionIn = false;
|
m_In.StartTransitioning();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuElements::Update( float fDeltaTime )
|
void MenuElements::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
if(!m_bStartedTransitionIn)
|
|
||||||
{
|
|
||||||
/* Start the transition on the first update, not in the ctor, so
|
|
||||||
* we don't play a sound while our parent is still loading. */
|
|
||||||
m_bStartedTransitionIn = true;
|
|
||||||
m_In.StartTransitioning( SM_None );
|
|
||||||
}
|
|
||||||
|
|
||||||
ActorFrame::Update(fDeltaTime);
|
ActorFrame::Update(fDeltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,6 @@ public: // let owner tinker with these objects
|
|||||||
Transition m_Back;
|
Transition m_Back;
|
||||||
|
|
||||||
RageSound m_soundBack;
|
RageSound m_soundBack;
|
||||||
|
|
||||||
bool m_bStartedTransitionIn;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ ScreenDemonstration::ScreenDemonstration() : ScreenJukebox( PrepareForDemonstrat
|
|||||||
|
|
||||||
if( GAMESTATE->m_pCurSong == NULL ) // we didn't find a song.
|
if( GAMESTATE->m_pCurSong == NULL ) // we didn't find a song.
|
||||||
{
|
{
|
||||||
this->PostScreenMessage( SM_GoToNextScreen, 0 ); // Abort demonstration.
|
HandleScreenMessage( SM_GoToNextScreen ); // Abort demonstration.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -332,6 +332,8 @@ void ScreenManager::Update( float fDeltaTime )
|
|||||||
else
|
else
|
||||||
pScreen->Update( fDeltaTime );
|
pScreen->Update( fDeltaTime );
|
||||||
|
|
||||||
|
// TODO: If a new Screen is set during this Update, that new screen is Drawn
|
||||||
|
// before it's first Update.
|
||||||
m_SystemLayer->Update( fDeltaTime );
|
m_SystemLayer->Update( fDeltaTime );
|
||||||
|
|
||||||
EmptyDeleteQueue();
|
EmptyDeleteQueue();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "ScreenSandbox.h"
|
#include "ScreenSandbox.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
#include "ThemeManager.h"
|
||||||
|
|
||||||
|
|
||||||
ScreenSandbox::ScreenSandbox() : Screen("ScreenSandbox")
|
ScreenSandbox::ScreenSandbox() : Screen("ScreenSandbox")
|
||||||
@@ -32,6 +33,10 @@ ScreenSandbox::ScreenSandbox() : Screen("ScreenSandbox")
|
|||||||
obj.SetXY(CENTER_X, CENTER_Y);
|
obj.SetXY(CENTER_X, CENTER_Y);
|
||||||
// obj.SetZoom(50);
|
// obj.SetZoom(50);
|
||||||
this->AddChild(&obj);
|
this->AddChild(&obj);
|
||||||
|
|
||||||
|
this->AddChild( &m_In );
|
||||||
|
|
||||||
|
this->AddChild( &m_Out );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSandbox::HandleScreenMessage( const ScreenMessage SM )
|
void ScreenSandbox::HandleScreenMessage( const ScreenMessage SM )
|
||||||
@@ -40,9 +45,22 @@ void ScreenSandbox::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
|
|
||||||
void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
void ScreenSandbox::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||||
{
|
{
|
||||||
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSandbox::Update( float fDeltaTime )
|
void ScreenSandbox::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
Screen::Update(fDeltaTime);
|
Screen::Update(fDeltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenSandbox::MenuLeft( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
m_In.Load( THEME->GetPathToB("_menu in") );
|
||||||
|
m_In.StartTransitioning();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenSandbox::MenuRight( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
m_Out.Load( THEME->GetPathToB("_menu out") );
|
||||||
|
m_Out.StartTransitioning();
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
#include "Sample3dObject.h"
|
#include "Sample3dObject.h"
|
||||||
#include "Quad.h"
|
#include "Quad.h"
|
||||||
|
#include "Transition.h"
|
||||||
|
|
||||||
class ScreenSandbox : public Screen
|
class ScreenSandbox : public Screen
|
||||||
{
|
{
|
||||||
@@ -23,9 +24,14 @@ public:
|
|||||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
|
void MenuLeft( PlayerNumber pn );
|
||||||
|
void MenuRight( PlayerNumber pn );
|
||||||
|
|
||||||
void Update(float f);
|
void Update(float f);
|
||||||
Sample3dObject obj;
|
Sample3dObject obj;
|
||||||
Quad m_quad;
|
Quad m_quad;
|
||||||
|
Transition m_In;
|
||||||
|
Transition m_Out;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@
|
|||||||
#define BANNER_WIDTH THEME->GetMetricF("ScreenSelectGroup","BannerWidth")
|
#define BANNER_WIDTH THEME->GetMetricF("ScreenSelectGroup","BannerWidth")
|
||||||
#define BANNER_HEIGHT THEME->GetMetricF("ScreenSelectGroup","BannerHeight")
|
#define BANNER_HEIGHT THEME->GetMetricF("ScreenSelectGroup","BannerHeight")
|
||||||
#define SLEEP_AFTER_TWEEN_OFF_SECONDS THEME->GetMetricF("ScreenSelectGroup","SleepAfterTweenOffSeconds")
|
#define SLEEP_AFTER_TWEEN_OFF_SECONDS THEME->GetMetricF("ScreenSelectGroup","SleepAfterTweenOffSeconds")
|
||||||
#define HELP_TEXT THEME->GetMetric ("ScreenSelectGroup","HelpText")
|
|
||||||
#define TIMER_SECONDS THEME->GetMetricI("ScreenSelectGroup","TimerSeconds")
|
|
||||||
#define NEXT_SCREEN THEME->GetMetric ("ScreenSelectGroup","NextScreen")
|
#define NEXT_SCREEN THEME->GetMetric ("ScreenSelectGroup","NextScreen")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
|
|||||||
{
|
{
|
||||||
LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" );
|
LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" );
|
||||||
|
|
||||||
|
GAMESTATE->Reset();
|
||||||
GAMESTATE->m_bPlayersCanJoin = true;
|
GAMESTATE->m_bPlayersCanJoin = true;
|
||||||
|
|
||||||
CodeDetector::RefreshCacheItems();
|
CodeDetector::RefreshCacheItems();
|
||||||
|
|||||||
@@ -51,14 +51,19 @@ void Transition::Update( float fDeltaTime )
|
|||||||
|
|
||||||
if( m_State == transitioning )
|
if( m_State == transitioning )
|
||||||
{
|
{
|
||||||
|
/* Start the transition on the first update, not in the ctor, so
|
||||||
|
* we don't play a sound while our parent is still loading. */
|
||||||
|
if( m_fSecsIntoTransition==0 ) // first update
|
||||||
|
m_sound.PlayRandom();
|
||||||
|
|
||||||
m_BGAnimation.Update( fDeltaTime );
|
m_BGAnimation.Update( fDeltaTime );
|
||||||
if( m_fSecsIntoTransition > m_BGAnimation.GetLengthSeconds() ) // over
|
if( m_fSecsIntoTransition > m_BGAnimation.GetLengthSeconds() ) // over
|
||||||
{
|
{
|
||||||
|
SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone );
|
||||||
m_fSecsIntoTransition = 0.0;
|
m_fSecsIntoTransition = 0.0;
|
||||||
m_State = finished;
|
m_State = finished;
|
||||||
SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone );
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
m_fSecsIntoTransition += fDeltaTime;
|
m_fSecsIntoTransition += fDeltaTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,8 +72,13 @@ void Transition::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
// Unless we're transitioning, don't draw because we'll waste resources drawing things
|
// Unless we're transitioning, don't draw because we'll waste resources drawing things
|
||||||
// that aren't visible. -Chris
|
// that aren't visible. -Chris
|
||||||
if( m_State != transitioning )
|
switch( m_State )
|
||||||
|
{
|
||||||
|
// case waiting:
|
||||||
|
// return;
|
||||||
|
case finished:
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_BGAnimation.Draw();
|
m_BGAnimation.Draw();
|
||||||
}
|
}
|
||||||
@@ -78,7 +88,6 @@ void Transition::StartTransitioning( ScreenMessage send_when_done )
|
|||||||
ASSERT( m_State == waiting ); // can't call this more than once
|
ASSERT( m_State == waiting ); // can't call this more than once
|
||||||
m_MessageToSendWhenDone = send_when_done;
|
m_MessageToSendWhenDone = send_when_done;
|
||||||
m_State = transitioning;
|
m_State = transitioning;
|
||||||
m_sound.PlayRandom();
|
|
||||||
m_fSecsIntoTransition = 0.0;
|
m_fSecsIntoTransition = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user