2002-05-20 08:59:37 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-06-27 17:49:10 +00:00
|
|
|
Class: ScreenSelectStyle
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
Desc: Testing the Screen class.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-06-27 17:49:10 +00:00
|
|
|
Chris Danford
|
2002-05-20 08:59:37 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "ScreenSelectStyle.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "RageMusic.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "PrefsManager.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "GameManager.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "AnnouncerManager.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "GameState.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
2002-08-27 03:59:22 +00:00
|
|
|
#define ICONS_START_X THEME->GetMetricF("ScreenSelectStyle","IconsStartX")
|
|
|
|
|
#define ICONS_SPACING_X THEME->GetMetricF("ScreenSelectStyle","IconsSpacingX")
|
|
|
|
|
#define ICONS_START_Y THEME->GetMetricF("ScreenSelectStyle","IconsStartY")
|
|
|
|
|
#define ICONS_SPACING_Y THEME->GetMetricF("ScreenSelectStyle","IconsSpacingY")
|
|
|
|
|
#define EXPLANATION_X THEME->GetMetricF("ScreenSelectStyle","ExplanationX")
|
|
|
|
|
#define EXPLANATION_Y THEME->GetMetricF("ScreenSelectStyle","ExplanationY")
|
|
|
|
|
#define INFO_X THEME->GetMetricF("ScreenSelectStyle","InfoX")
|
|
|
|
|
#define INFO_Y THEME->GetMetricF("ScreenSelectStyle","InfoY")
|
|
|
|
|
#define PREVIEW_X THEME->GetMetricF("ScreenSelectStyle","PreviewX")
|
|
|
|
|
#define PREVIEW_Y THEME->GetMetricF("ScreenSelectStyle","PreviewY")
|
|
|
|
|
#define HELP_TEXT THEME->GetMetric("ScreenSelectStyle","HelpText")
|
|
|
|
|
#define TIMER_SECONDS THEME->GetMetricI("ScreenSelectStyle","TimerSeconds")
|
|
|
|
|
#define NEXT_SCREEN THEME->GetMetric("ScreenSelectStyle","NextScreen")
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
const ScreenMessage SM_GoToPrevScreen = ScreenMessage(SM_User + 1);
|
|
|
|
|
const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User + 2);
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
ScreenSelectStyle::ScreenSelectStyle()
|
|
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenSelectStyle::ScreenSelectStyle()" );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-06-24 22:04:31 +00:00
|
|
|
// Reset the current style and game
|
2002-07-23 01:41:40 +00:00
|
|
|
GAMESTATE->m_CurStyle = STYLE_NONE;
|
2002-08-13 23:26:46 +00:00
|
|
|
GAMESTATE->m_bPlayersCanJoin = true;
|
2002-06-24 22:04:31 +00:00
|
|
|
|
2002-08-17 06:44:04 +00:00
|
|
|
GAMEMAN->GetGameplayStylesForGame( GAMESTATE->m_CurGame, m_aPossibleStyles );
|
2002-08-18 17:48:50 +00:00
|
|
|
ASSERT( m_aPossibleStyles.GetSize() > 0 ); // every game should have at least one Style, or else why have the Game? :-)
|
2002-05-27 18:36:01 +00:00
|
|
|
m_iSelection = 0;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-05-27 18:36:01 +00:00
|
|
|
for( int i=0; i<m_aPossibleStyles.GetSize(); i++ )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-09-15 03:50:57 +00:00
|
|
|
m_sprIcon[i].Load( THEME->GetPathTo("Graphics",ssprintf("select style icons %s",GAMESTATE->GetCurrentGameDef()->m_szName) ) );
|
2002-05-27 18:36:01 +00:00
|
|
|
m_sprIcon[i].StopAnimating();
|
2002-07-31 19:40:40 +00:00
|
|
|
m_sprIcon[i].SetState( i );
|
2002-08-13 23:26:46 +00:00
|
|
|
m_sprIcon[i].SetXY( ICONS_START_X + i*ICONS_SPACING_X, ICONS_START_Y + i*ICONS_SPACING_Y );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_sprIcon[i] );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
UpdateEnabledDisabled();
|
|
|
|
|
|
|
|
|
|
m_sprExplanation.Load( THEME->GetPathTo("Graphics","select style explanation") );
|
2002-05-27 18:36:01 +00:00
|
|
|
m_sprExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_sprExplanation );
|
2002-05-27 18:36:01 +00:00
|
|
|
|
|
|
|
|
m_sprPreview.SetXY( PREVIEW_X, PREVIEW_Y );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_sprPreview );
|
2002-05-27 18:36:01 +00:00
|
|
|
|
|
|
|
|
m_sprInfo.SetXY( INFO_X, INFO_Y );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_sprInfo );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-06-27 17:49:10 +00:00
|
|
|
|
2002-09-15 03:50:57 +00:00
|
|
|
const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
|
|
|
|
const StyleDef* pStyleDef = GAMEMAN->GetStyleDefForStyle( m_aPossibleStyles[m_iSelection] );
|
|
|
|
|
|
2002-06-27 17:49:10 +00:00
|
|
|
// Load dummy Sprites
|
2002-06-27 19:14:23 +00:00
|
|
|
for( i=0; i<m_aPossibleStyles.GetSize(); i++ )
|
2002-06-27 17:49:10 +00:00
|
|
|
{
|
2002-09-15 03:50:57 +00:00
|
|
|
m_sprDummyPreview[i].Load( THEME->GetPathTo("Graphics",ssprintf("select style preview %s %s",pGameDef->m_szName,pStyleDef->m_szName)) );
|
|
|
|
|
m_sprDummyInfo[i].Load( THEME->GetPathTo("Graphics",ssprintf("select style info %s %s",pGameDef->m_szName,pStyleDef->m_szName)) );
|
2002-06-27 17:49:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
m_Menu.Load(
|
2002-08-13 23:26:46 +00:00
|
|
|
THEME->GetPathTo("Graphics","select style background"),
|
|
|
|
|
THEME->GetPathTo("Graphics","select style top edge"),
|
2002-09-03 22:31:06 +00:00
|
|
|
HELP_TEXT, false, true, TIMER_SECONDS
|
2002-05-20 08:59:37 +00:00
|
|
|
);
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_Menu );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
m_soundChange.Load( THEME->GetPathTo("Sounds","select style change") );
|
|
|
|
|
m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style intro") );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-27 03:59:22 +00:00
|
|
|
MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","select style music") );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-05-27 18:36:01 +00:00
|
|
|
AfterChange();
|
2002-05-20 08:59:37 +00:00
|
|
|
TweenOnScreen();
|
2002-05-28 20:01:22 +00:00
|
|
|
m_Menu.TweenOnScreenFromBlack( SM_None );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScreenSelectStyle::~ScreenSelectStyle()
|
|
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenSelectStyle::~ScreenSelectStyle()" );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectStyle::DrawPrimitives()
|
|
|
|
|
{
|
|
|
|
|
m_Menu.DrawBottomLayer();
|
|
|
|
|
Screen::DrawPrimitives();
|
|
|
|
|
m_Menu.DrawTopLayer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectStyle::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
|
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenSelectStyle::Input()" );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-05-28 20:01:22 +00:00
|
|
|
if( m_Menu.IsClosing() )
|
2002-05-20 08:59:37 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectStyle::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
Screen::HandleScreenMessage( SM );
|
|
|
|
|
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
2002-05-27 08:23:27 +00:00
|
|
|
case SM_MenuTimer:
|
2002-06-24 22:04:31 +00:00
|
|
|
MenuStart(PLAYER_INVALID);
|
2002-05-27 08:23:27 +00:00
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToPrevScreen:
|
2002-05-20 08:59:37 +00:00
|
|
|
MUSIC->Stop();
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
2002-05-20 08:59:37 +00:00
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToNextScreen:
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( NEXT_SCREEN );
|
2002-05-20 08:59:37 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-27 18:36:01 +00:00
|
|
|
void ScreenSelectStyle::BeforeChange()
|
|
|
|
|
{
|
|
|
|
|
m_sprIcon[m_iSelection].SetEffectNone();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectStyle::AfterChange()
|
|
|
|
|
{
|
|
|
|
|
m_sprIcon[m_iSelection].SetEffectGlowing();
|
|
|
|
|
|
2002-09-15 03:50:57 +00:00
|
|
|
const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
|
|
|
|
const StyleDef* pStyleDef = GAMEMAN->GetStyleDefForStyle( m_aPossibleStyles[m_iSelection] );
|
|
|
|
|
|
2002-05-28 20:01:22 +00:00
|
|
|
// Tween Preview
|
2002-09-15 03:50:57 +00:00
|
|
|
m_sprPreview.Load( THEME->GetPathTo("Graphics",ssprintf("select style preview %s %s",pGameDef->m_szName,pStyleDef->m_szName)) );
|
2002-05-27 18:36:01 +00:00
|
|
|
|
2002-05-28 20:01:22 +00:00
|
|
|
m_sprPreview.StopTweening();
|
2002-09-02 21:59:58 +00:00
|
|
|
m_sprPreview.SetGlow( D3DXCOLOR(1,1,1,0) );
|
|
|
|
|
m_sprPreview.SetDiffuse( D3DXCOLOR(1,1,1,0) );
|
2002-05-28 20:01:22 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
m_sprPreview.BeginTweening( 0.25f ); // sleep
|
2002-05-28 20:01:22 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
m_sprPreview.BeginTweening( 0.2f ); // fade to white
|
|
|
|
|
m_sprPreview.SetTweenGlow( D3DXCOLOR(1,1,1,1) );
|
|
|
|
|
m_sprPreview.SetTweenDiffuse( D3DXCOLOR(1,1,1,0) );
|
2002-05-28 20:01:22 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
m_sprPreview.BeginTweening( 0.01f ); // turn color on
|
|
|
|
|
m_sprPreview.SetTweenDiffuse( D3DXCOLOR(1,1,1,1) );
|
2002-05-28 20:01:22 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
m_sprPreview.BeginTweening( 0.2f ); // fade to color
|
|
|
|
|
m_sprPreview.SetTweenGlow( D3DXCOLOR(1,1,1,0) );
|
|
|
|
|
m_sprPreview.SetTweenDiffuse( D3DXCOLOR(1,1,1,1) );
|
2002-05-28 20:01:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// Tween Info
|
2002-09-15 03:50:57 +00:00
|
|
|
m_sprInfo.Load( THEME->GetPathTo("Graphics",ssprintf("select style info %s %s",pGameDef->m_szName,pStyleDef->m_szName)) );
|
2002-05-28 20:01:22 +00:00
|
|
|
m_sprInfo.StopTweening();
|
2002-05-27 18:36:01 +00:00
|
|
|
m_sprInfo.SetZoomY( 0 );
|
2002-09-02 21:59:58 +00:00
|
|
|
m_sprInfo.BeginTweening( 0.5f, Actor::TWEEN_BOUNCE_END );
|
2002-05-27 18:36:01 +00:00
|
|
|
m_sprInfo.SetTweenZoomY( 1 );
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenSelectStyle::MenuLeft( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
// search for a style to the left of the current selection that is enabled
|
|
|
|
|
int iSwitchToStyleIndex = -1; // -1 means none found
|
|
|
|
|
for( int i=m_iSelection-1; i>=0; i-- )
|
|
|
|
|
{
|
|
|
|
|
if( IsEnabled(i) )
|
|
|
|
|
{
|
|
|
|
|
iSwitchToStyleIndex = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( iSwitchToStyleIndex == -1 )
|
2002-05-20 08:59:37 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
BeforeChange();
|
2002-08-13 23:26:46 +00:00
|
|
|
m_iSelection = iSwitchToStyleIndex;
|
2002-05-20 08:59:37 +00:00
|
|
|
m_soundChange.PlayRandom();
|
|
|
|
|
AfterChange();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenSelectStyle::MenuRight( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
// search for a style to the right of the current selection that is enabled
|
|
|
|
|
int iSwitchToStyleIndex = -1; // -1 means none found
|
|
|
|
|
for( int i=m_iSelection+1; i<m_aPossibleStyles.GetSize(); i++ )
|
|
|
|
|
{
|
|
|
|
|
if( IsEnabled(i) )
|
|
|
|
|
{
|
|
|
|
|
iSwitchToStyleIndex = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( iSwitchToStyleIndex == -1 )
|
2002-05-20 08:59:37 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
BeforeChange();
|
2002-08-13 23:26:46 +00:00
|
|
|
m_iSelection = iSwitchToStyleIndex;
|
2002-05-20 08:59:37 +00:00
|
|
|
m_soundChange.PlayRandom();
|
|
|
|
|
AfterChange();
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenSelectStyle::MenuStart( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
if( pn!=PLAYER_INVALID && !GAMESTATE->m_bSideIsJoined[pn] )
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
|
|
|
|
SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","menu start") );
|
2002-09-04 03:49:08 +00:00
|
|
|
GAMESTATE->m_bSideIsJoined[pn] = true;
|
2002-08-13 23:26:46 +00:00
|
|
|
SCREENMAN->RefreshCreditsMessages();
|
|
|
|
|
UpdateEnabledDisabled();
|
|
|
|
|
return; // don't fall through
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-23 01:41:40 +00:00
|
|
|
GAMESTATE->m_CurStyle = GetSelectedStyle();
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
CString sCurStyleName = GAMESTATE->GetCurrentStyleDef()->m_szName;
|
2002-08-28 22:42:40 +00:00
|
|
|
sCurStyleName.MakeLower();
|
|
|
|
|
if( -1!=sCurStyleName.Find("single") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment single") );
|
|
|
|
|
else if( -1!=sCurStyleName.Find("versus") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment versus") );
|
|
|
|
|
else if( -1!=sCurStyleName.Find("double") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment double") );
|
|
|
|
|
else if( -1!=sCurStyleName.Find("couple") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment couple") );
|
|
|
|
|
else if( -1!=sCurStyleName.Find("solo") ) SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("select style comment solo") );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
m_soundSelect.PlayRandom();
|
|
|
|
|
|
2002-08-20 21:00:56 +00:00
|
|
|
m_Menu.StopTimer();
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
TweenOffScreen();
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenSelectStyle::MenuBack( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
|
|
|
|
MUSIC->Stop();
|
|
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
m_Menu.TweenOffScreenToBlack( SM_GoToPrevScreen, true );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
// m_Fade.CloseWipingLeft( SM_GoToPrevScreen );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-05-28 20:01:22 +00:00
|
|
|
// TweenOffScreen();
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
void ScreenSelectStyle::TweenOnScreen()
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-09-02 21:59:58 +00:00
|
|
|
for( int i=0; i<m_aPossibleStyles.GetSize(); i++ )
|
2002-09-03 06:33:08 +00:00
|
|
|
m_sprIcon[i].FadeOn( (m_aPossibleStyles.GetSize()-i)*0.05f, "Left Accelerate", MENU_ELEMENTS_TWEEN_TIME );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
m_sprExplanation.FadeOn( 0, "Right Accelerate", MENU_ELEMENTS_TWEEN_TIME );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
// let AfterChange tween Preview and Info
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
void ScreenSelectStyle::TweenOffScreen()
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-09-02 21:59:58 +00:00
|
|
|
for( int i=0; i<m_aPossibleStyles.GetSize(); i++ )
|
2002-09-03 06:33:08 +00:00
|
|
|
m_sprIcon[i].FadeOff( 0, "FoldY", MENU_ELEMENTS_TWEEN_TIME );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
m_sprExplanation.FadeOff( 0, "FoldY", MENU_ELEMENTS_TWEEN_TIME );
|
2002-05-28 20:01:22 +00:00
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
m_sprPreview.FadeOff( 0, "FoldY", MENU_ELEMENTS_TWEEN_TIME );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
m_sprInfo.FadeOff( 0, "FoldY", MENU_ELEMENTS_TWEEN_TIME );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
bool ScreenSelectStyle::IsEnabled( int iStyleIndex )
|
|
|
|
|
{
|
|
|
|
|
Style style = m_aPossibleStyles[iStyleIndex];
|
|
|
|
|
|
|
|
|
|
int iNumSidesJoined = 0;
|
|
|
|
|
for( int c=0; c<2; c++ )
|
2002-08-20 21:00:56 +00:00
|
|
|
if( GAMESTATE->m_bSideIsJoined[c] )
|
2002-08-13 23:26:46 +00:00
|
|
|
iNumSidesJoined++; // left side, and right side
|
|
|
|
|
|
|
|
|
|
switch( GAMEMAN->GetStyleDefForStyle(style)->m_StyleType )
|
|
|
|
|
{
|
|
|
|
|
case StyleDef::ONE_PLAYER_ONE_CREDIT: return iNumSidesJoined==1;
|
|
|
|
|
case StyleDef::ONE_PLAYER_TWO_CREDITS: return iNumSidesJoined==2;
|
|
|
|
|
case StyleDef::TWO_PLAYERS_TWO_CREDITS: return iNumSidesJoined==2;
|
|
|
|
|
default: ASSERT(0); return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectStyle::UpdateEnabledDisabled()
|
|
|
|
|
{
|
|
|
|
|
int i;
|
2002-09-11 05:08:45 +00:00
|
|
|
/* XXX: If a player joins during the tween-in, this diffuse change
|
|
|
|
|
* will be undone by the tween. Hmm. */
|
2002-08-13 23:26:46 +00:00
|
|
|
for( i=0; i<m_aPossibleStyles.GetSize(); i++ )
|
|
|
|
|
{
|
|
|
|
|
if( IsEnabled(i) )
|
2002-09-02 21:59:58 +00:00
|
|
|
m_sprIcon[i].SetDiffuse( D3DXCOLOR(1,1,1,1) );
|
2002-08-13 23:26:46 +00:00
|
|
|
else
|
2002-09-02 21:59:58 +00:00
|
|
|
m_sprIcon[i].SetDiffuse( D3DXCOLOR(0.5f,0.5f,0.5f,1) );
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Select first enabled style
|
|
|
|
|
BeforeChange();
|
|
|
|
|
|
|
|
|
|
int iSwitchToStyleIndex = -1; // -1 means none found
|
|
|
|
|
for( i=0; i<m_aPossibleStyles.GetSize(); i++ )
|
|
|
|
|
{
|
|
|
|
|
if( IsEnabled(i) )
|
|
|
|
|
{
|
|
|
|
|
iSwitchToStyleIndex = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-08-18 17:48:50 +00:00
|
|
|
ASSERT( iSwitchToStyleIndex != -1 ); // no styles are enabled. We're stuck! This should never happen
|
2002-08-13 23:26:46 +00:00
|
|
|
|
|
|
|
|
m_iSelection = iSwitchToStyleIndex;
|
|
|
|
|
AfterChange();
|
|
|
|
|
}
|
|
|
|
|
|