2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-06-14 22:25:22 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: ScreenSelectCourse
|
|
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "ScreenSelectCourse.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "PrefsManager.h"
|
2003-10-31 22:14:02 +00:00
|
|
|
#include "ProfileManager.h"
|
2002-06-14 22:25:22 +00:00
|
|
|
#include "SongManager.h"
|
|
|
|
|
#include "GameManager.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "InputMapper.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-09-02 21:59:58 +00:00
|
|
|
#include "CodeDetector.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2003-07-17 20:10:07 +00:00
|
|
|
#include "Course.h"
|
2002-06-14 22:25:22 +00:00
|
|
|
|
|
|
|
|
|
2002-09-05 03:45:07 +00:00
|
|
|
#define EXPLANATION_X THEME->GetMetricF("ScreenSelectCourse","ExplanationX")
|
|
|
|
|
#define EXPLANATION_Y THEME->GetMetricF("ScreenSelectCourse","ExplanationY")
|
2002-08-27 03:59:22 +00:00
|
|
|
#define BANNER_FRAME_X THEME->GetMetricF("ScreenSelectCourse","BannerFrameX")
|
|
|
|
|
#define BANNER_FRAME_Y THEME->GetMetricF("ScreenSelectCourse","BannerFrameY")
|
|
|
|
|
#define BANNER_X THEME->GetMetricF("ScreenSelectCourse","BannerX")
|
|
|
|
|
#define BANNER_Y THEME->GetMetricF("ScreenSelectCourse","BannerY")
|
|
|
|
|
#define BANNER_WIDTH THEME->GetMetricF("ScreenSelectCourse","BannerWidth")
|
|
|
|
|
#define BANNER_HEIGHT THEME->GetMetricF("ScreenSelectCourse","BannerHeight")
|
|
|
|
|
#define STAGES_X THEME->GetMetricF("ScreenSelectCourse","StagesX")
|
|
|
|
|
#define STAGES_Y THEME->GetMetricF("ScreenSelectCourse","StagesY")
|
|
|
|
|
#define TIME_X THEME->GetMetricF("ScreenSelectCourse","TimeX")
|
|
|
|
|
#define TIME_Y THEME->GetMetricF("ScreenSelectCourse","TimeY")
|
|
|
|
|
#define WHEEL_X THEME->GetMetricF("ScreenSelectCourse","WheelX")
|
|
|
|
|
#define WHEEL_Y THEME->GetMetricF("ScreenSelectCourse","WheelY")
|
2002-08-29 20:18:41 +00:00
|
|
|
#define SCORE_X( p ) THEME->GetMetricF("ScreenSelectCourse",ssprintf("ScoreP%dX",p+1))
|
|
|
|
|
#define SCORE_Y( i ) THEME->GetMetricF("ScreenSelectCourse",ssprintf("ScoreP%dY",i+1))
|
2002-10-06 00:07:09 +00:00
|
|
|
#define SCORE_ZOOM THEME->GetMetricF("ScreenSelectCourse","ScoreZoom")
|
2002-08-27 03:59:22 +00:00
|
|
|
#define HELP_TEXT THEME->GetMetric("ScreenSelectCourse","HelpText")
|
|
|
|
|
#define TIMER_SECONDS THEME->GetMetricI("ScreenSelectCourse","TimerSeconds")
|
2002-08-22 09:31:32 +00:00
|
|
|
|
2002-06-14 22:25:22 +00:00
|
|
|
|
|
|
|
|
const float TWEEN_TIME = 0.5f;
|
2003-10-31 22:14:02 +00:00
|
|
|
const int NUM_SCORE_DIGITS = 9;
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2003-02-17 00:39:10 +00:00
|
|
|
static const ScreenMessage SM_AllowOptionsMenuRepeat = ScreenMessage(SM_User+1);
|
2002-06-14 22:25:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-05-01 23:19:33 +00:00
|
|
|
ScreenSelectCourse::ScreenSelectCourse( CString sClassName ) : ScreenWithMenuElements( sClassName )
|
2002-06-14 22:25:22 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenSelectCourse::ScreenSelectCourse()" );
|
2003-03-07 06:05:30 +00:00
|
|
|
|
2004-01-22 03:11:40 +00:00
|
|
|
/* Finish any previous stage. It's OK to call this when we havn't played a stage yet. */
|
|
|
|
|
GAMESTATE->FinishStage();
|
|
|
|
|
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->PlayMusic( THEME->GetPathToS("ScreenSelectCourse music") );
|
2002-08-01 03:15:27 +00:00
|
|
|
|
2004-02-06 03:57:47 +00:00
|
|
|
m_MusicWheel.Load();
|
|
|
|
|
|
2002-07-27 19:29:51 +00:00
|
|
|
m_bMadeChoice = false;
|
|
|
|
|
m_bGoToOptions = false;
|
2003-02-17 00:39:10 +00:00
|
|
|
m_bAllowOptionsMenuRepeat = false;
|
|
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_sprExplanation.Load( THEME->GetPathToG("ScreenSelectCourse explanation") );
|
2002-09-05 03:45:07 +00:00
|
|
|
m_sprExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y );
|
|
|
|
|
this->AddChild( &m_sprExplanation );
|
|
|
|
|
|
2002-08-22 09:31:32 +00:00
|
|
|
m_Banner.SetXY( BANNER_X, BANNER_Y );
|
2003-07-14 19:35:12 +00:00
|
|
|
m_Banner.ScaleToClipped( BANNER_WIDTH, BANNER_HEIGHT );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_Banner );
|
2002-08-22 09:31:32 +00:00
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_sprBannerFrame.Load( THEME->GetPathToG("ScreenSelectCourse banner frame") );
|
2002-08-22 09:31:32 +00:00
|
|
|
m_sprBannerFrame.SetXY( BANNER_FRAME_X, BANNER_FRAME_Y );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_sprBannerFrame );
|
2002-08-22 09:31:32 +00:00
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textNumSongs.LoadFromNumbers( THEME->GetPathToN("ScreenSelectCourse num songs") );
|
2004-03-20 02:59:08 +00:00
|
|
|
m_textNumSongs.SetShadowLength( 0 );
|
2003-03-30 18:12:57 +00:00
|
|
|
m_textNumSongs.SetXY( STAGES_X, STAGES_Y );
|
2002-09-03 22:31:06 +00:00
|
|
|
this->AddChild( &m_textNumSongs );
|
2002-08-22 09:31:32 +00:00
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textTime.LoadFromNumbers( THEME->GetPathToN("ScreenSelectCourse total time") );
|
2004-03-20 02:59:08 +00:00
|
|
|
m_textTime.SetShadowLength( 0 );
|
2003-03-30 18:12:57 +00:00
|
|
|
m_textTime.SetXY( TIME_X, TIME_Y );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_textTime );
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2003-11-16 21:43:25 +00:00
|
|
|
m_CourseContentsFrame.SetName( "Contents" );
|
|
|
|
|
SET_XY( m_CourseContentsFrame );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_CourseContentsFrame );
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2003-11-18 19:06:35 +00:00
|
|
|
m_MusicWheel.SetName( "MusicWheel", "Wheel" );
|
2002-06-14 22:25:22 +00:00
|
|
|
m_MusicWheel.SetXY( WHEEL_X, WHEEL_Y );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_MusicWheel );
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2002-08-22 09:31:32 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
2003-04-10 05:46:31 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
|
2002-08-22 09:31:32 +00:00
|
|
|
continue; // skip
|
|
|
|
|
|
2003-07-07 05:16:27 +00:00
|
|
|
m_sprHighScoreFrame[p].Load( THEME->GetPathToG(ssprintf("ScreenSelectCourse score frame p%d",p+1)) );
|
2002-08-29 20:18:41 +00:00
|
|
|
m_sprHighScoreFrame[p].SetXY( SCORE_X(p), SCORE_Y(p) );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_sprHighScoreFrame[p] );
|
2002-08-22 09:31:32 +00:00
|
|
|
|
2002-08-29 20:18:41 +00:00
|
|
|
m_HighScore[p].SetXY( SCORE_X(p), SCORE_Y(p) );
|
2002-10-06 00:07:09 +00:00
|
|
|
m_HighScore[p].SetZoom( SCORE_ZOOM );
|
2002-09-02 21:59:58 +00:00
|
|
|
m_HighScore[p].SetDiffuse( PlayerToColor(p) );
|
|
|
|
|
this->AddChild( &m_HighScore[p] );
|
2002-08-22 09:31:32 +00:00
|
|
|
}
|
|
|
|
|
|
2003-11-13 00:39:36 +00:00
|
|
|
#ifdef _XBOX
|
|
|
|
|
//shorten filenames for FATX
|
|
|
|
|
m_sprOptionsMessage.Load( THEME->GetPathToG("ScreenSelectCourse opt message 1x2") );
|
|
|
|
|
#else
|
2003-04-12 17:39:27 +00:00
|
|
|
m_sprOptionsMessage.Load( THEME->GetPathToG("ScreenSelectCourse options message 1x2") );
|
2003-11-13 00:39:36 +00:00
|
|
|
#endif
|
|
|
|
|
|
2002-09-22 18:18:50 +00:00
|
|
|
m_sprOptionsMessage.StopAnimating();
|
|
|
|
|
m_sprOptionsMessage.SetXY( CENTER_X, CENTER_Y );
|
|
|
|
|
m_sprOptionsMessage.SetZoomY( 0 );
|
2002-10-28 05:30:45 +00:00
|
|
|
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) );
|
2003-03-16 20:55:45 +00:00
|
|
|
// this->AddChild( &m_sprOptionsMessage ); // draw and update manually
|
2002-06-14 22:25:22 +00:00
|
|
|
|
|
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_soundOptionsChange.Load( THEME->GetPathToS("ScreenSelectCourse options") );
|
|
|
|
|
m_soundChangeNotes.Load( THEME->GetPathToS("ScreenSelectCourse difficulty") );
|
2003-03-07 05:24:52 +00:00
|
|
|
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("select course intro") );
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->PlayMusic( THEME->GetPathToS("ScreenSelectCourse music") );
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
UpdateOptionsDisplays();
|
|
|
|
|
|
2002-06-14 22:25:22 +00:00
|
|
|
AfterCourseChange();
|
|
|
|
|
TweenOnScreen();
|
2004-02-13 05:39:15 +00:00
|
|
|
|
|
|
|
|
this->SortByZ();
|
2002-06-14 22:25:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ScreenSelectCourse::~ScreenSelectCourse()
|
|
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenSelectCourse::~ScreenSelectCourse()" );
|
2002-06-14 22:25:22 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectCourse::DrawPrimitives()
|
|
|
|
|
{
|
|
|
|
|
Screen::DrawPrimitives();
|
2003-03-16 20:55:45 +00:00
|
|
|
m_sprOptionsMessage.Draw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectCourse::Update( float fDelta )
|
|
|
|
|
{
|
|
|
|
|
Screen::Update( fDelta );
|
|
|
|
|
m_sprOptionsMessage.Update( fDelta );
|
2002-06-14 22:25:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectCourse::TweenOnScreen()
|
|
|
|
|
{
|
2004-02-14 03:38:34 +00:00
|
|
|
m_sprExplanation.Command( "Sleep,0.5;AddX,-640;BounceEnd,0.5;AddX,640" );
|
|
|
|
|
m_sprBannerFrame.Command( "AddX,-640;BounceEnd,0.5;AddX,640" );
|
|
|
|
|
m_Banner.Command( "AddX,-640;BounceEnd,0.5;AddX,640" );
|
|
|
|
|
m_textNumSongs.Command( "AddX,-640;BounceEnd,0.5;AddX,640" );
|
|
|
|
|
m_textTime.Command( "AddX,-640;BounceEnd,0.5;AddX,640" );
|
|
|
|
|
m_CourseContentsFrame.Command( "ZoomY,0;BounceEnd,0.5;ZoomY,1" );
|
2002-09-05 03:45:07 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2002-08-22 09:31:32 +00:00
|
|
|
{
|
2004-02-14 03:38:34 +00:00
|
|
|
m_sprHighScoreFrame[p].Command( "AddX,640;BounceEnd,0.5;AddX,-640" );
|
|
|
|
|
m_HighScore[p].Command( "AddX,640;BounceEnd,0.5;AddX,-640" );
|
2002-08-22 09:31:32 +00:00
|
|
|
}
|
2002-06-14 22:25:22 +00:00
|
|
|
m_MusicWheel.TweenOnScreen();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectCourse::TweenOffScreen()
|
|
|
|
|
{
|
2004-02-14 03:38:34 +00:00
|
|
|
m_sprExplanation.Command( "BounceBegin,0.5;AddX,-640" );
|
|
|
|
|
m_sprBannerFrame.Command( "BounceBegin,0.5;AddX,-640" );
|
|
|
|
|
m_Banner.Command( "BounceBegin,0.5;AddX,-640" );
|
|
|
|
|
m_textNumSongs.Command( "BounceBegin,0.5;AddX,-640" );
|
|
|
|
|
m_textTime.Command( "BounceBegin,0.5;AddX,-640" );
|
|
|
|
|
m_CourseContentsFrame.Command( "Linear,0.5;ZoomY,0" );
|
2002-09-05 03:45:07 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2002-08-22 09:31:32 +00:00
|
|
|
{
|
2004-02-14 03:38:34 +00:00
|
|
|
m_sprHighScoreFrame[p].Command( "BounceBegin,0.5;AddX,640" );
|
|
|
|
|
m_HighScore[p].Command( "BounceBegin,0.5;AddX,640" );
|
2002-08-22 09:31:32 +00:00
|
|
|
}
|
2002-06-14 22:25:22 +00:00
|
|
|
m_MusicWheel.TweenOffScreen();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-01-02 03:00:53 +00:00
|
|
|
void ScreenSelectCourse::Input( const DeviceInput& DeviceI, InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
2002-06-14 22:25:22 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenSelectCourse::Input()" );
|
2003-02-17 00:59:46 +00:00
|
|
|
|
|
|
|
|
if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == SDLK_F9 )
|
|
|
|
|
{
|
|
|
|
|
if( type != IET_FIRST_PRESS ) return;
|
2003-05-20 04:41:47 +00:00
|
|
|
PREFSMAN->m_bShowNative ^= 1;
|
2003-03-31 23:06:15 +00:00
|
|
|
m_MusicWheel.RebuildMusicWheelItems();
|
2003-02-17 00:59:46 +00:00
|
|
|
Course* pCourse = m_MusicWheel.GetSelectedCourse();
|
|
|
|
|
if(pCourse)
|
|
|
|
|
m_CourseContentsFrame.SetFromCourse( pCourse );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-02 03:00:53 +00:00
|
|
|
if( MenuI.button == MENU_BUTTON_RIGHT || MenuI.button == MENU_BUTTON_LEFT )
|
|
|
|
|
{
|
|
|
|
|
if( !MenuI.IsValid() ) return;
|
2003-04-10 05:46:31 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(MenuI.player) ) return;
|
2003-01-02 03:00:53 +00:00
|
|
|
|
|
|
|
|
int dir = 0;
|
|
|
|
|
if(INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_RIGHT) ) )
|
|
|
|
|
dir++;
|
|
|
|
|
if(INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_LEFT) ) )
|
|
|
|
|
dir--;
|
|
|
|
|
|
|
|
|
|
m_MusicWheel.Move(dir);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
if( type == IET_RELEASE ) return; // don't care
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
if( !GameI.IsValid() ) return; // don't care
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2004-01-21 06:14:49 +00:00
|
|
|
/* XXX: What's the difference between this and StyleI.player? */
|
|
|
|
|
PlayerNumber pn = GAMESTATE->GetCurrentStyleDef()->ControllerToPlayerNumber( GameI.controller );
|
|
|
|
|
if( !GAMESTATE->IsHumanPlayer(pn) )
|
|
|
|
|
return;
|
|
|
|
|
|
2003-02-17 00:39:10 +00:00
|
|
|
if( m_bMadeChoice && MenuI.IsValid() && MenuI.button == MENU_BUTTON_START && !GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2() )
|
2002-07-27 19:29:51 +00:00
|
|
|
{
|
2003-02-17 00:39:10 +00:00
|
|
|
if(m_bGoToOptions) return; /* got it already */
|
|
|
|
|
|
|
|
|
|
if( !m_bAllowOptionsMenuRepeat &&
|
|
|
|
|
(type == IET_SLOW_REPEAT || type == IET_FAST_REPEAT ))
|
|
|
|
|
return; /* not allowed yet */
|
|
|
|
|
|
2002-07-27 19:29:51 +00:00
|
|
|
m_bGoToOptions = true;
|
2002-09-22 18:18:50 +00:00
|
|
|
m_sprOptionsMessage.SetState( 1 );
|
2004-05-01 23:28:53 +00:00
|
|
|
SCREENMAN->PlayStartSound();
|
2002-07-27 19:29:51 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2002-09-02 21:59:58 +00:00
|
|
|
|
2004-05-01 23:19:33 +00:00
|
|
|
if( IsTransitioning() ) return; // ignore
|
2003-02-17 00:39:10 +00:00
|
|
|
|
2002-07-28 20:28:37 +00:00
|
|
|
if( m_bMadeChoice )
|
|
|
|
|
return;
|
|
|
|
|
|
2003-04-13 04:50:08 +00:00
|
|
|
if( CodeDetector::DetectAndAdjustMusicOptions(GameI.controller) )
|
2002-09-02 21:59:58 +00:00
|
|
|
{
|
|
|
|
|
m_soundOptionsChange.Play();
|
|
|
|
|
UpdateOptionsDisplays();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-21 01:35:54 +00:00
|
|
|
if( CodeDetector::EnteredEasierDifficulty(GameI.controller) )
|
2003-03-07 05:24:52 +00:00
|
|
|
{
|
2004-02-09 01:39:19 +00:00
|
|
|
if( GAMESTATE->ChangeCourseDifficulty( pn, -1 ) )
|
2004-01-21 01:35:54 +00:00
|
|
|
{
|
|
|
|
|
m_soundChangeNotes.Play();
|
|
|
|
|
SCREENMAN->PostMessageToTopScreen(SM_SongChanged,0);
|
|
|
|
|
}
|
2003-03-07 05:24:52 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-21 01:35:54 +00:00
|
|
|
if( CodeDetector::EnteredHarderDifficulty(GameI.controller) )
|
2003-03-07 05:24:52 +00:00
|
|
|
{
|
2004-02-09 01:39:19 +00:00
|
|
|
if( GAMESTATE->ChangeCourseDifficulty( pn, +1 ) )
|
2004-01-21 01:35:54 +00:00
|
|
|
{
|
|
|
|
|
m_soundChangeNotes.Play();
|
|
|
|
|
SCREENMAN->PostMessageToTopScreen(SM_SongChanged,0);
|
|
|
|
|
}
|
2003-03-07 05:24:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-06-14 22:25:22 +00:00
|
|
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectCourse::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
Screen::HandleScreenMessage( SM );
|
|
|
|
|
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
2003-02-17 00:39:10 +00:00
|
|
|
case SM_AllowOptionsMenuRepeat:
|
|
|
|
|
m_bAllowOptionsMenuRepeat = true;
|
|
|
|
|
break;
|
2002-06-14 22:25:22 +00:00
|
|
|
case SM_MenuTimer:
|
|
|
|
|
MenuStart(PLAYER_1);
|
|
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToPrevScreen:
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
2002-06-14 22:25:22 +00:00
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToNextScreen:
|
2002-06-14 22:25:22 +00:00
|
|
|
|
|
|
|
|
// find out if the Next button is being held down on any of the pads
|
|
|
|
|
bool bIsHoldingNext;
|
|
|
|
|
bIsHoldingNext = false;
|
|
|
|
|
int player;
|
|
|
|
|
for( player=0; player<NUM_PLAYERS; player++ )
|
|
|
|
|
{
|
|
|
|
|
MenuInput mi( (PlayerNumber)player, MENU_BUTTON_START );
|
|
|
|
|
if( INPUTMAPPER->IsButtonDown( mi ) )
|
|
|
|
|
bIsHoldingNext = true;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-27 19:29:51 +00:00
|
|
|
if( bIsHoldingNext || m_bGoToOptions )
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenPlayerOptions" );
|
2002-06-14 22:25:22 +00:00
|
|
|
else
|
2002-08-27 03:59:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( "ScreenStage" );
|
|
|
|
|
|
2002-06-14 22:25:22 +00:00
|
|
|
break;
|
2003-01-02 03:00:53 +00:00
|
|
|
case SM_SongChanged:
|
|
|
|
|
AfterCourseChange();
|
|
|
|
|
break;
|
2002-06-14 22:25:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenSelectCourse::MenuStart( PlayerNumber pn )
|
2002-06-14 22:25:22 +00:00
|
|
|
{
|
2003-08-03 00:13:55 +00:00
|
|
|
// this needs to check whether valid Steps are selected!
|
2002-06-23 11:43:53 +00:00
|
|
|
m_MusicWheel.Select();
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2002-06-23 11:43:53 +00:00
|
|
|
switch( m_MusicWheel.GetSelectedType() )
|
2002-06-14 22:25:22 +00:00
|
|
|
{
|
2002-06-23 11:43:53 +00:00
|
|
|
case TYPE_COURSE:
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("select course comment general") );
|
2002-06-23 11:43:53 +00:00
|
|
|
|
|
|
|
|
TweenOffScreen();
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2004-05-01 23:28:53 +00:00
|
|
|
SCREENMAN->PlayStartSound();
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2002-07-27 19:29:51 +00:00
|
|
|
m_bMadeChoice = true;
|
|
|
|
|
|
2004-05-01 23:19:33 +00:00
|
|
|
float fShowSeconds = m_Out.GetLengthSeconds();
|
2003-03-16 20:55:45 +00:00
|
|
|
|
2002-06-23 11:43:53 +00:00
|
|
|
// show "hold START for options"
|
2002-10-28 05:30:45 +00:00
|
|
|
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) );
|
2003-03-16 20:55:45 +00:00
|
|
|
m_sprOptionsMessage.BeginTweening( 0.15f ); // fade in
|
2003-04-12 06:16:12 +00:00
|
|
|
m_sprOptionsMessage.SetZoomY( 1 );
|
|
|
|
|
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,1) );
|
2003-03-16 20:55:45 +00:00
|
|
|
m_sprOptionsMessage.BeginTweening( fShowSeconds-0.35f ); // sleep
|
|
|
|
|
m_sprOptionsMessage.BeginTweening( 0.15f ); // fade out
|
2003-04-12 06:16:12 +00:00
|
|
|
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) );
|
|
|
|
|
m_sprOptionsMessage.SetZoomY( 0 );
|
2003-03-16 20:55:45 +00:00
|
|
|
|
|
|
|
|
/* Don't accept a held START for a little while, so it's not
|
|
|
|
|
* hit accidentally. Accept an initial START right away, though,
|
|
|
|
|
* so we don't ignore deliberate fast presses (which would be
|
|
|
|
|
* annoying). */
|
2003-03-25 21:17:29 +00:00
|
|
|
this->PostScreenMessage( SM_AllowOptionsMenuRepeat, 0.5f );
|
2003-03-16 20:55:45 +00:00
|
|
|
|
2002-06-23 02:50:33 +00:00
|
|
|
|
2004-05-01 23:19:33 +00:00
|
|
|
StartTransitioning( SM_GoToNextScreen );
|
2002-06-23 02:50:33 +00:00
|
|
|
|
2002-07-28 20:28:37 +00:00
|
|
|
Course* pCourse = m_MusicWheel.GetSelectedCourse();
|
|
|
|
|
GAMESTATE->m_pCurCourse = pCourse;
|
2003-02-17 19:52:16 +00:00
|
|
|
|
2003-08-06 06:30:09 +00:00
|
|
|
// Apply number of lives without turning on LIFE_BATTERY.
|
|
|
|
|
// Don't turn on LIFE_BATTERY because it will override
|
|
|
|
|
// the user's choice if they Back out of gameplay or are in
|
|
|
|
|
// event mode.
|
2003-10-09 00:06:12 +00:00
|
|
|
if( pCourse->m_iLives != -1 )
|
|
|
|
|
GAMESTATE->m_SongOptions.m_iBatteryLives = GAMESTATE->m_pCurCourse->m_iLives;
|
2002-08-22 09:31:32 +00:00
|
|
|
|
2002-06-23 11:43:53 +00:00
|
|
|
break;
|
2002-06-14 22:25:22 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenSelectCourse::MenuBack( PlayerNumber pn )
|
2002-06-14 22:25:22 +00:00
|
|
|
{
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->StopMusic();
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2004-05-01 23:19:33 +00:00
|
|
|
Back( SM_GoToPrevScreen );
|
2002-06-14 22:25:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenSelectCourse::AfterCourseChange()
|
|
|
|
|
{
|
|
|
|
|
switch( m_MusicWheel.GetSelectedType() )
|
|
|
|
|
{
|
|
|
|
|
case TYPE_COURSE:
|
|
|
|
|
{
|
|
|
|
|
Course* pCourse = m_MusicWheel.GetSelectedCourse();
|
2004-02-22 06:04:01 +00:00
|
|
|
const StepsType &st = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
|
2002-08-22 09:31:32 +00:00
|
|
|
|
2003-02-14 21:42:44 +00:00
|
|
|
m_textNumSongs.SetText( ssprintf("%d", pCourse->GetEstimatedNumStages()) );
|
|
|
|
|
float fTotalSeconds;
|
|
|
|
|
if( pCourse->GetTotalSeconds(fTotalSeconds) )
|
2004-02-22 19:51:46 +00:00
|
|
|
m_textTime.SetText( SecondsToMMSSMsMs(fTotalSeconds) );
|
2003-02-14 21:42:44 +00:00
|
|
|
else
|
2004-02-22 19:51:46 +00:00
|
|
|
m_textTime.SetText( "xx:xx.xx" ); // The numbers format doesn't have a '?'. Is there a better solution?
|
2002-08-22 09:31:32 +00:00
|
|
|
|
2003-01-02 03:00:53 +00:00
|
|
|
m_Banner.LoadFromCourse( pCourse );
|
2002-08-22 09:31:32 +00:00
|
|
|
|
2002-06-14 22:25:22 +00:00
|
|
|
m_CourseContentsFrame.SetFromCourse( pCourse );
|
2003-02-17 00:59:46 +00:00
|
|
|
m_CourseContentsFrame.TweenInAfterChangedCourse();
|
2003-10-31 22:14:02 +00:00
|
|
|
|
|
|
|
|
ASSERT(pCourse);
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
2004-03-13 22:18:09 +00:00
|
|
|
CourseDifficulty cd = GAMESTATE->m_PreferredCourseDifficulty[p];
|
2003-10-31 22:14:02 +00:00
|
|
|
|
2004-02-09 06:26:13 +00:00
|
|
|
Profile* pProfile;
|
2003-10-31 22:14:02 +00:00
|
|
|
if( PROFILEMAN->IsUsingProfile( (PlayerNumber)p ) )
|
2004-02-09 06:26:13 +00:00
|
|
|
pProfile = PROFILEMAN->GetProfile((PlayerNumber)p);
|
|
|
|
|
else
|
|
|
|
|
pProfile = PROFILEMAN->GetMachineProfile();
|
|
|
|
|
|
2003-10-31 22:14:02 +00:00
|
|
|
|
|
|
|
|
/* Courses are scored by survive time, dance points,
|
|
|
|
|
* percent, and normal score. Every last mother will
|
|
|
|
|
* have an opinion on which should be used here for
|
|
|
|
|
* each of oni, endless, nonstop --
|
|
|
|
|
* should this choice be an option or a metric? */
|
2004-02-22 06:04:01 +00:00
|
|
|
const HighScoreList& hsl = pProfile->GetCourseHighScoreList( pCourse, st, cd );
|
2003-10-31 22:14:02 +00:00
|
|
|
if ( pCourse->IsOni() || pCourse->IsEndless() )
|
|
|
|
|
{
|
|
|
|
|
/* use survive time */
|
2004-02-10 09:42:01 +00:00
|
|
|
float fSurviveSeconds = hsl.GetTopScore().fSurviveSeconds;
|
2004-02-22 19:51:46 +00:00
|
|
|
CString s = SecondsToMMSSMsMs(fSurviveSeconds);
|
2003-10-31 22:14:02 +00:00
|
|
|
|
|
|
|
|
/* dim the inital unsignificant digits */
|
|
|
|
|
/*XXX we'd like to have a dimmed ':' and '.', but
|
|
|
|
|
* BitmapText only supports dimmed '0' (which
|
|
|
|
|
* is used for the ' ' char) */
|
|
|
|
|
unsigned i = 0;
|
|
|
|
|
for ( ; i<s.length(); i++ ) {
|
|
|
|
|
switch (s[i]) {
|
|
|
|
|
case ':':
|
|
|
|
|
case '.':
|
|
|
|
|
case '0': s[i] = ' '; break;
|
|
|
|
|
default: i = s.length();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_HighScore[p].SetText( s );
|
|
|
|
|
}
|
|
|
|
|
else /* pCourse->IsNonStop() */
|
|
|
|
|
{
|
|
|
|
|
/* use score */
|
2004-02-09 06:26:13 +00:00
|
|
|
int iScore = hsl.GetTopScore().iScore;
|
2003-10-31 22:14:02 +00:00
|
|
|
m_HighScore[p].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, iScore) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-14 22:25:22 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2002-08-22 09:31:32 +00:00
|
|
|
case TYPE_SECTION: // if we get here, there are no courses
|
2003-01-02 03:00:53 +00:00
|
|
|
m_Banner.LoadFromGroup( "" );
|
2002-07-27 19:29:51 +00:00
|
|
|
break;
|
2002-06-14 22:25:22 +00:00
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
void ScreenSelectCourse::UpdateOptionsDisplays()
|
|
|
|
|
{
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
2003-04-10 05:46:31 +00:00
|
|
|
if( GAMESTATE->IsHumanPlayer(p) )
|
2002-09-02 21:59:58 +00:00
|
|
|
{
|
|
|
|
|
CString s = GAMESTATE->m_PlayerOptions[p].GetString();
|
|
|
|
|
s.Replace( ", ", "\n" );
|
|
|
|
|
// m_textPlayerOptions[p].SetText( s );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CString s = GAMESTATE->m_SongOptions.GetString();
|
|
|
|
|
s.Replace( ", ", "\n" );
|
|
|
|
|
// m_textSongOptions.SetText( s );
|
|
|
|
|
}
|