revamped SelectDifficulty screen. Metrics can now control the choices available

This commit is contained in:
Chris Danford
2003-02-23 23:29:22 +00:00
parent 80981df5b6
commit 887704d948
7 changed files with 259 additions and 330 deletions
+22 -14
View File
@@ -111,20 +111,27 @@ ExplanationPage1X=170
ExplanationPage1Y=70
ExplanationPage2X=1100
ExplanationPage2Y=70
BeginnerX=98
BeginnerY=180
EasyX=246
EasyY=220
MediumX=394
MediumY=180
HardX=542
HardY=220
NonstopX=760
NonstopY=200
OniX=960
OniY=200
EndlessX=1160
EndlessY=200
ChoicesOnPage1=Beginner,Easy,Medium,Hard
ChoicesOnPage2=Nonstop,Oni,Endless,Battle
Page1Choice1X=98
Page1Choice1Y=180
Page1Choice2X=246
Page1Choice2Y=220
Page1Choice3X=394
Page1Choice3Y=180
Page1Choice4X=542
Page1Choice4Y=220
Page1Choice5X=542
Page1Choice5Y=220
Page2Choice1X=738
Page2Choice1Y=180
Page2Choice2X=886
Page2Choice2Y=220
Page2Choice3X=1034
Page2Choice3Y=180
Page2Choice4X=1182
Page2Choice4Y=220
CursorOffsetP1X=-40
CursorOffsetP1Y=200
CursorOffsetP2X=+40
@@ -136,6 +143,7 @@ HelpText=Use &LEFT; &RIGHT; to select, then press START
TimerSeconds=40
NextScreenArcade=ScreenSelectGroup
NextScreenOni=ScreenInstructions
NextScreenBattle=ScreenInstructions
[ScreenSelectDifficultyEX]
DifficultyP1X=216
+18 -9
View File
@@ -118,14 +118,20 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties
float fPercentThroughBounce = m_fSecsIntoEffect / m_fEffectPeriodSeconds;
float fPercentOffset = sinf( fPercentThroughBounce*PI );
m_temp.pos += m_vectBounce * fPercentOffset;
m_temp.pos.x = roundf( m_temp.pos.x );
m_temp.pos.y = roundf( m_temp.pos.y );
m_temp.pos.z = roundf( m_temp.pos.z );
}
break;
case bobbing:
{
float fPercentThroughBounce = m_fSecsIntoEffect / m_fEffectPeriodSeconds;
float fPercentOffset = sinf( fPercentThroughBounce*PI*2 );
m_temp.pos += m_vectBounce * fPercentOffset;
}
float fPercentThroughBounce = m_fSecsIntoEffect / m_fEffectPeriodSeconds;
float fPercentOffset = sinf( fPercentThroughBounce*PI*2 );
m_temp.pos += m_vectBounce * fPercentOffset;
m_temp.pos.x = roundf( m_temp.pos.x );
m_temp.pos.y = roundf( m_temp.pos.y );
m_temp.pos.z = roundf( m_temp.pos.z );
}
break;
default:
ASSERT(0); // invalid Effect
@@ -515,12 +521,15 @@ void Actor::Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds,
TweenState original = m_current;
TweenState mod = m_current;
#define CONTAINS(needle) (-1!=sFadeString.Find(needle))
CStringArray asBits;
split( sFadeString, " ", asBits );
#define CONTAINS(needle) (find( asBits.begin(), asBits.end(), needle ) != asBits.end())
TweenType tt;
if( CONTAINS("linear") ) tt = TWEEN_LINEAR;
else if( CONTAINS("accelerate") ) tt = TWEEN_BIAS_BEGIN;
else if( CONTAINS("bounce") ) tt = TWEEN_BOUNCE_END;
else if( CONTAINS("accelerate") ) tt = bOnToScreenOrOffOfScreen ? TWEEN_BIAS_END : TWEEN_BIAS_BEGIN;
else if( CONTAINS("bounce") ) tt = bOnToScreenOrOffOfScreen ? TWEEN_BOUNCE_END : TWEEN_BOUNCE_BEGIN;
else if( CONTAINS("spring") ) tt = TWEEN_SPRING;
else tt = TWEEN_LINEAR;
@@ -540,8 +549,8 @@ void Actor::Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds,
mod.rotation.x += (CONTAINS("spinx")?-PI*2:0);
mod.rotation.y += (CONTAINS("spiny")?-PI*2:0);
mod.rotation.z += (CONTAINS("spinz")?-PI*2:0);
mod.scale.x *= (CONTAINS("foldx")?0:1) * (CONTAINS("zoomx")?3:1);
mod.scale.y *= (CONTAINS("foldy")?0:1) * (CONTAINS("zoomy")?3:1);
mod.scale.x *= (CONTAINS("foldx")?0:1) * (CONTAINS("zoomx")||CONTAINS("zoom")?3:1);
mod.scale.y *= (CONTAINS("foldy")?0:1) * (CONTAINS("zoomy")||CONTAINS("zoom")?3:1);
for( int i=0; i<4; i++ )
{
mod.diffuse[i] = GetDiffuse();
+24 -2
View File
@@ -49,10 +49,32 @@ Difficulty StringToDifficulty( CString sDC )
else if( sDC == "heavy" ) return DIFFICULTY_HARD;
else if( sDC == "smaniac" ) return DIFFICULTY_CHALLENGE;
else if( sDC == "challenge" ) return DIFFICULTY_CHALLENGE;
return DIFFICULTY_INVALID;
else return DIFFICULTY_INVALID;
}
CString PlayModeToString( PlayMode pm )
{
switch( pm )
{
case PLAY_MODE_ARCADE: return "arcade";
case PLAY_MODE_ONI: return "oni";
case PLAY_MODE_NONSTOP: return "nonstop";
case PLAY_MODE_ENDLESS: return "endless";
case PLAY_MODE_BATTLE: return "battle";
default: ASSERT(0); return "";
}
}
PlayMode StringToPlayMode( CString s )
{
for( int i=0; i<NUM_PLAY_MODES; i++ )
if( PlayModeToString((PlayMode)i).CompareNoCase(s) == 0 )
return (PlayMode)i;
return PLAY_MODE_INVALID;
}
RageColor PlayerToColor( PlayerNumber pn )
{
switch( pn )
+14 -9
View File
@@ -16,9 +16,9 @@
#include "RageTypes.h" // for RageColor
/////////////////////////////
//
// Screen Dimensions
/////////////////////////////
//
#define SCREEN_WIDTH (640)
#define SCREEN_HEIGHT (480)
@@ -33,12 +33,9 @@
#define SCREEN_NEAR (-1000)
#define SCREEN_FAR (1000)
/////////////////////////
//
// Note definitions
/////////////////////////
//
enum RadarCategory // starting from 12-o'clock rotating clockwise
{
RADAR_STREAM = 0,
@@ -84,19 +81,27 @@ enum NotesType
NOTES_TYPE_INVALID,
};
//////////////////////////
//
// Play mode stuff
//////////////////////////
//
enum PlayMode
{
PLAY_MODE_ARCADE,
PLAY_MODE_NONSTOP, // DDR EX Nonstop
PLAY_MODE_ONI, // DDR EX Challenge
PLAY_MODE_ENDLESS, // DDR PlayStation Endless
PLAY_MODE_BATTLE,
NUM_PLAY_MODES,
PLAY_MODE_INVALID
};
CString PlayModeToString( PlayMode pm );
PlayMode StringToPlayMode( CString s );
//
// Player number stuff
//
enum PlayerNumber {
PLAYER_1 = 0,
PLAYER_2,
+1 -1
View File
@@ -41,7 +41,7 @@ PrefsManager::PrefsManager()
m_iTextureColorDepth = 16; // default to 16 for better preformance on slower cards
m_iMaxTextureResolution = 2048;
m_iRefreshRate = REFRESH_DEFAULT;
m_bIgnoreJoyAxes = false; // when did this get changed to ON by default?
m_bIgnoreJoyAxes = true; // ON by default because all USB convertors that are compatible with pads map to buttons
m_bOnlyDedicatedMenuButtons = false;
#ifdef DEBUG
m_bShowStats = true;
+168 -273
View File
@@ -28,20 +28,9 @@ const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to
#define MORE_Y( page ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("MorePage%dY",page+1))
#define EXPLANATION_X( page ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("ExplanationPage%dX",page+1))
#define EXPLANATION_Y( page ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("ExplanationPage%dY",page+1))
#define BEGINNER_X() THEME->GetMetricF("ScreenSelectDifficulty","BeginnerX")
#define BEGINNER_Y() THEME->GetMetricF("ScreenSelectDifficulty","BeginnerY")
#define EASY_X() THEME->GetMetricF("ScreenSelectDifficulty","EasyX")
#define EASY_Y() THEME->GetMetricF("ScreenSelectDifficulty","EasyY")
#define MEDIUM_X() THEME->GetMetricF("ScreenSelectDifficulty","MediumX")
#define MEDIUM_Y() THEME->GetMetricF("ScreenSelectDifficulty","MediumY")
#define HARD_X() THEME->GetMetricF("ScreenSelectDifficulty","HardX")
#define HARD_Y() THEME->GetMetricF("ScreenSelectDifficulty","HardY")
#define NONSTOP_X() THEME->GetMetricF("ScreenSelectDifficulty","NonstopX")
#define NONSTOP_Y() THEME->GetMetricF("ScreenSelectDifficulty","NonstopY")
#define ONI_X() THEME->GetMetricF("ScreenSelectDifficulty","OniX")
#define ONI_Y() THEME->GetMetricF("ScreenSelectDifficulty","OniY")
#define ENDLESS_X() THEME->GetMetricF("ScreenSelectDifficulty","EndlessX")
#define ENDLESS_Y() THEME->GetMetricF("ScreenSelectDifficulty","EndlessY")
#define CHOICES_ON_PAGE( page ) THEME->GetMetric ("ScreenSelectDifficulty",ssprintf("ChoicesOnPage%d",page+1))
#define CHOICE_X( page, choice ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("Page%dChoice%dX",page+1,choice+1))
#define CHOICE_Y( page, choice ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("Page%dChoice%dY",page+1,choice+1))
#define CURSOR_OFFSET_X( p ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("CursorOffsetP%dX",p+1))
#define CURSOR_OFFSET_Y( i ) THEME->GetMetricF("ScreenSelectDifficulty",ssprintf("CursorOffsetP%dY",i+1))
#define CURSOR_SHADOW_LENGTH_X THEME->GetMetricF("ScreenSelectDifficulty","CursorShadowLengthX")
@@ -49,53 +38,13 @@ const float LOCK_INPUT_TIME = 0.30f; // lock input while waiting for tweening to
#define INITIAL_CHOICE THEME->GetMetricI("ScreenSelectDifficulty","InitialChoice")
#define HELP_TEXT THEME->GetMetric("ScreenSelectDifficulty","HelpText")
#define TIMER_SECONDS THEME->GetMetricI("ScreenSelectDifficulty","TimerSeconds")
#define NEXT_SCREEN_ARCADE THEME->GetMetric("ScreenSelectDifficulty","NextScreenArcade")
#define NEXT_SCREEN_ONI THEME->GetMetric("ScreenSelectDifficulty","NextScreenOni")
#define NEXT_SCREEN_ARCADE THEME->GetMetric ("ScreenSelectDifficulty","NextScreenArcade")
#define NEXT_SCREEN_ONI THEME->GetMetric ("ScreenSelectDifficulty","NextScreenOni")
#define NEXT_SCREEN_BATTLE THEME->GetMetric ("ScreenSelectDifficulty","NextScreenBattle")
float CHOICE_X( int choice )
{
switch( choice )
{
case 0: return BEGINNER_X();
case 1: return EASY_X();
case 2: return MEDIUM_X();
case 3: return HARD_X();
case 4: return NONSTOP_X();
case 5: return ONI_X();
case 6: return ENDLESS_X();
default: ASSERT(0); return 0;
}
}
float CHOICE_Y( int choice )
{
switch( choice )
{
case 0: return BEGINNER_Y();
case 1: return EASY_Y();
case 2: return MEDIUM_Y();
case 3: return HARD_Y();
case 4: return NONSTOP_Y();
case 5: return ONI_Y();
case 6: return ENDLESS_Y();
default: ASSERT(0); return 0;
}
}
const CString CHOICE_TEXT[ScreenSelectDifficulty::NUM_CHOICES] =
{
"beginner",
"easy",
"medium",
"hard",
"nonstop",
"oni",
"endless"
};
float CURSOR_X( int choice, int p ) { return CHOICE_X(choice) + CURSOR_OFFSET_X(p); }
float CURSOR_Y( int choice, int p ) { return CHOICE_Y(choice) + CURSOR_OFFSET_Y(p); }
float CURSOR_X( int page, int choice, int p ) { return CHOICE_X(page,choice) + CURSOR_OFFSET_X(p); }
float CURSOR_Y( int page, int choice, int p ) { return CHOICE_Y(page,choice) + CURSOR_OFFSET_Y(p); }
const ScreenMessage SM_StartTweeningOffScreen = ScreenMessage(SM_User + 3);
@@ -117,21 +66,68 @@ ScreenSelectDifficulty::ScreenSelectDifficulty()
);
this->AddChild( &m_Menu );
for( unsigned c=0; c<NUM_CHOICES; c++ )
// parse ModeChoices
for( int page=0; page<NUM_PAGES; page++ )
{
CString sHeaderFile = ssprintf( "select difficulty header %s", CHOICE_TEXT[c].c_str() );
CString sPictureFile = ssprintf( "select difficulty picture %s", CHOICE_TEXT[c].c_str() );
CStringArray asBits;
split( CHOICES_ON_PAGE(page), ",", asBits );
if( asBits.size() > MAX_CHOICES_PER_PAGE )
RageException::Throw( "Choices exceed max number of choices per page." );
m_sprPicture[c].Load( THEME->GetPathTo("Graphics",sPictureFile) );
m_sprPicture[c].SetXY( CHOICE_X(c), CHOICE_Y(c) );
m_sprPicture[c].SetVertAlign( align_top );
m_framePages.AddChild( &m_sprPicture[c] );
for( unsigned choice=0; choice<asBits.size(); choice++ )
{
Difficulty dc = StringToDifficulty(asBits[choice]);
PlayMode pm = StringToPlayMode(asBits[choice]);
if( dc!=DIFFICULTY_INVALID ) // valid difficulty
{
ModeChoice mc = {
GAMESTATE->m_CurGame,
PLAY_MODE_ARCADE,
GAMESTATE->m_CurStyle,
dc,
"",
GAMESTATE->GetNumSidesJoined() };
strcpy( mc.name, DifficultyToString(dc) );
m_ModeChoices[page].push_back( mc );
}
else if( pm!=PLAY_MODE_INVALID ) // valid play mode
{
ModeChoice mc = {
GAMESTATE->m_CurGame,
pm,
GAMESTATE->m_CurStyle,
DIFFICULTY_MEDIUM,
"",
GAMESTATE->GetNumSidesJoined() };
strcpy( mc.name, PlayModeToString(pm) );
m_ModeChoices[page].push_back( mc );
}
else
RageException::Throw( "Invalid Page%dChoice%d value '%s'.", page+1, choice+1, asBits[choice].GetString() );
}
}
m_sprHeader[c].Load( THEME->GetPathTo("Graphics",sHeaderFile) );
m_sprHeader[c].SetXY( CHOICE_X(c), CHOICE_Y(c) );
m_sprHeader[c].SetVertAlign( align_bottom );
m_framePages.AddChild( &m_sprHeader[c] );
for( int page=0; page<NUM_PAGES; page++ )
{
for( unsigned choice=0; choice<m_ModeChoices[page].size(); choice++ )
{
CString sHeaderFile = ssprintf( "select difficulty header %s", m_ModeChoices[page][choice].name );
CString sPictureFile = ssprintf( "select difficulty picture %s", m_ModeChoices[page][choice].name );
float fChoiceX = CHOICE_X(page,choice);
float fChoiceY = CHOICE_Y(page,choice);
m_sprPicture[page][choice].Load( THEME->GetPathTo("Graphics",sPictureFile) );
m_sprPicture[page][choice].SetXY( fChoiceX, fChoiceY );
m_sprPicture[page][choice].SetVertAlign( align_top );
m_framePages.AddChild( &m_sprPicture[page][choice] );
m_sprHeader[page][choice].Load( THEME->GetPathTo("Graphics",sHeaderFile) );
m_sprHeader[page][choice].SetXY( fChoiceX, fChoiceY );
m_sprHeader[page][choice].SetVertAlign( align_bottom );
m_framePages.AddChild( &m_sprHeader[page][choice] );
}
}
for( p=0; p<NUM_PAGES; p++ )
@@ -147,11 +143,12 @@ ScreenSelectDifficulty::ScreenSelectDifficulty()
m_framePages.AddChild( &m_sprExplanation[p] );
}
m_iCurrentPage = PAGE_1;
for( p=0; p<NUM_PLAYERS; p++ )
{
m_Choice[p] = (Choice)(INITIAL_CHOICE-1);
CLAMP( m_Choice[p], (Choice)0, (Choice)(NUM_CHOICES-1) );
m_iChoiceOnPage[p] = (INITIAL_CHOICE-1);
CLAMP( m_iChoiceOnPage[p], 0, (int)m_ModeChoices[0].size()-1 );
m_bChosen[p] = false;
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) )
@@ -245,29 +242,9 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM )
case SM_GoToNextScreen:
for( p=0; p<NUM_PLAYERS; p++ )
{
switch( m_Choice[p] )
{
case CHOICE_BEGINNER: GAMESTATE->m_PreferredDifficulty[p] = DIFFICULTY_BEGINNER; break;
case CHOICE_EASY: GAMESTATE->m_PreferredDifficulty[p] = DIFFICULTY_EASY; break;
case CHOICE_NONSTOP: // need to set preferred difficulty even for courses
case CHOICE_ONI:
case CHOICE_ENDLESS:
case CHOICE_MEDIUM: GAMESTATE->m_PreferredDifficulty[p] = DIFFICULTY_MEDIUM; break;
case CHOICE_HARD: GAMESTATE->m_PreferredDifficulty[p] = DIFFICULTY_HARD; break;
default: ASSERT(0);
}
}
switch( m_Choice[GAMESTATE->m_MasterPlayerNumber] )
{
case CHOICE_BEGINNER:
case CHOICE_EASY:
case CHOICE_MEDIUM:
case CHOICE_HARD: GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE; break;
case CHOICE_NONSTOP: GAMESTATE->m_PlayMode = PLAY_MODE_NONSTOP; break;
case CHOICE_ONI: GAMESTATE->m_PlayMode = PLAY_MODE_ONI; break;
case CHOICE_ENDLESS: GAMESTATE->m_PlayMode = PLAY_MODE_ENDLESS; break;
default: ASSERT(0); // bad selection
const ModeChoice& mc = m_ModeChoices[m_iCurrentPage][m_iChoiceOnPage[p]];
GAMESTATE->m_PlayMode = mc.pm;
GAMESTATE->m_PreferredDifficulty[p] = mc.dc;
}
switch( GAMESTATE->m_PlayMode )
@@ -276,6 +253,7 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM )
case PLAY_MODE_NONSTOP:
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS: SCREENMAN->SetNewScreen( NEXT_SCREEN_ONI ); break;
case PLAY_MODE_BATTLE: SCREENMAN->SetNewScreen( NEXT_SCREEN_BATTLE ); break;
default: ASSERT(0);
}
break;
@@ -291,101 +269,74 @@ void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM )
void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn )
{
if( m_Choice[pn] == 0 ) // can't go left any more
return;
if( m_bChosen[pn] )
return;
ChangeTo( pn, m_Choice[pn], m_Choice[pn]-1 );
if( m_iChoiceOnPage[pn] == 0 ) // can't go left any more
{
if( m_iCurrentPage > 0 )
ChangePage( m_iCurrentPage-1 );
}
else
ChangeWithinPage( pn, m_iChoiceOnPage[pn]-1, false );
}
void ScreenSelectDifficulty::MenuRight( PlayerNumber pn )
{
if( m_Choice[pn] == NUM_CHOICES-1 ) // can't go right any more
return;
if( m_bChosen[pn] )
return;
ChangeTo( pn, m_Choice[pn], m_Choice[pn]+1 );
if( m_iChoiceOnPage[pn] == (int)m_ModeChoices[m_iCurrentPage].size()-1 ) // can't go left any more
{
if( m_iCurrentPage < NUM_PAGES-1 )
ChangePage( m_iCurrentPage+1 );
}
else
ChangeWithinPage( pn, m_iChoiceOnPage[pn]+1, false );
}
bool ScreenSelectDifficulty::IsOnPage2( int iItemIndex )
{
ASSERT( iItemIndex >= 0 && iItemIndex < NUM_CHOICES );
return iItemIndex >= NUM_CHOICES_ON_PAGE_1;
}
bool ScreenSelectDifficulty::SelectedSomethingOnPage2()
void ScreenSelectDifficulty::ChangePage( int iNewPage )
{
// If anyone has already chosen, don't allow changing of pages
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( GAMESTATE->IsPlayerEnabled(p) && IsOnPage2(m_Choice[p]) )
return true;
}
return false;
}
void ScreenSelectDifficulty::ChangeTo( PlayerNumber pn, int iOldChoice, int iNewChoice )
{
bool bChangedPagesFrom1To2 = !IsOnPage2(iOldChoice) && IsOnPage2(iNewChoice);
bool bChangedPagesFrom2To1 = IsOnPage2(iOldChoice) && !IsOnPage2(iNewChoice);
bool bChangedPages = bChangedPagesFrom1To2 || bChangedPagesFrom2To1;
bool bSelectedSomethingOnPage1 = !IsOnPage2(iNewChoice);
bool bSelectedSomethingOnPage2 = IsOnPage2(iNewChoice);
bool bSomeoneMadeAChoice = false;
int p;
for( p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsPlayerEnabled(p) && m_bChosen[p] )
bSomeoneMadeAChoice = true;
return;
if( bSomeoneMadeAChoice && (bChangedPagesFrom1To2 || bChangedPagesFrom2To1) )
return; // don't allow changing pages after one player has chosen
bool bPageIncreasing = iNewPage > m_iCurrentPage;
m_iCurrentPage = iNewPage;
if( bSelectedSomethingOnPage2 || bChangedPagesFrom2To1 )
{
// change both players
for( int p=0; p<NUM_PLAYERS; p++ )
m_Choice[p] = (Choice)iNewChoice;
}
else // moving around in page 1
{
// change only the player who pressed the button
m_Choice[pn] = (Choice)iNewChoice;
}
if( bChangedPagesFrom1To2 )
if( iNewPage == PAGE_2 )
{
m_soundDifficult.Stop();
m_soundDifficult.PlayRandom();
}
if( bChangedPagesFrom1To2 || bChangedPagesFrom2To1 )
{
m_framePages.StopTweening();
m_framePages.BeginTweening( 0.2f );
m_framePages.SetTweenX( bSelectedSomethingOnPage1 ? 0.0f : -SCREEN_WIDTH );
}
// change both players
int iNewChoice = bPageIncreasing ? 0 : m_ModeChoices[m_iCurrentPage].size()-1;
for( int p=0; p<NUM_PLAYERS; p++ )
ChangeWithinPage( (PlayerNumber)p, iNewChoice, true );
for( p=0; p<NUM_PLAYERS; p++ )
{
if( bSelectedSomethingOnPage2 || bChangedPagesFrom2To1 || p==pn )
{
m_sprCursor[p].StopTweening();
m_sprCursor[p].BeginTweening( 0.2f, bChangedPages ? TWEEN_LINEAR : TWEEN_BIAS_BEGIN );
m_sprCursor[p].SetTweenX( CURSOR_X(m_Choice[p],(PlayerNumber)p) - CURSOR_SHADOW_LENGTH_X );
m_sprCursor[p].SetTweenY( CURSOR_Y(m_Choice[p],(PlayerNumber)p) - CURSOR_SHADOW_LENGTH_Y );
// move frame with choices
m_framePages.StopTweening();
m_framePages.BeginTweening( 0.2f );
m_framePages.SetTweenX( (float)iNewPage*-SCREEN_WIDTH );
}
m_sprJoinMessagehadow[p].StopTweening();
m_sprJoinMessagehadow[p].BeginTweening( 0.2f, bChangedPages ? TWEEN_LINEAR : TWEEN_BIAS_BEGIN );
m_sprJoinMessagehadow[p].SetTweenX( CURSOR_X(m_Choice[p],(PlayerNumber)p) );
m_sprJoinMessagehadow[p].SetTweenY( CURSOR_Y(m_Choice[p],(PlayerNumber)p) );
}
}
void ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages )
{
m_iChoiceOnPage[pn] = iNewChoice;
float fCursorX = CURSOR_X(m_iCurrentPage,m_iChoiceOnPage[pn],pn);
float fCursorY = CURSOR_Y(m_iCurrentPage,m_iChoiceOnPage[pn],pn);
m_sprCursor[pn].StopTweening();
m_sprCursor[pn].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_BIAS_BEGIN );
m_sprCursor[pn].SetTweenX( fCursorX - CURSOR_SHADOW_LENGTH_X );
m_sprCursor[pn].SetTweenY( fCursorY - CURSOR_SHADOW_LENGTH_Y );
m_sprJoinMessagehadow[pn].StopTweening();
m_sprJoinMessagehadow[pn].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_BIAS_BEGIN );
m_sprJoinMessagehadow[pn].SetTweenX( fCursorX );
m_sprJoinMessagehadow[pn].SetTweenY( fCursorY );
m_soundChange.Play();
}
@@ -399,24 +350,12 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
for( unsigned page=0; page<NUM_PAGES; page++ )
m_sprMoreArrows[page].FadeOff( 0, "fade", 0.5f );
m_soundSelect.Play();
int iSelection = m_Choice[pn];
switch( iSelection )
{
case 0: SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select difficulty comment beginner") ); break;
case 1: SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select difficulty comment easy") ); break;
case 2: SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select difficulty comment medium") ); break;
case 3: SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select difficulty comment hard") ); break;
case 4: SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select difficulty comment nonstop") ); break;
case 5: SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select difficulty comment oni") ); break;
case 6: SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select difficulty comment endless") ); break;
}
const ModeChoice& mc = m_ModeChoices[m_iCurrentPage][m_iChoiceOnPage[pn]];
SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("select difficulty comment %s",mc.name)) );
/* XXX: This will play the same announcer twice at the same time; that'll probably
* result in an echo effect. */
if( IsOnPage2(iSelection) ) // chose something on page 2
if( m_iCurrentPage == PAGE_2 )
{
// choose this for all the other players too
for( int p=0; p<NUM_PLAYERS; p++ )
@@ -428,13 +367,16 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
}
}
m_sprCursor[pn].BeginTweening( 0.2f );
m_sprCursor[pn].BeginTweening( 0.2f );
m_sprCursor[pn].SetTweenX( CURSOR_X(iSelection, pn) );
m_sprCursor[pn].SetTweenY( CURSOR_Y(iSelection, pn) );
float fCursorX = CURSOR_X(m_iCurrentPage,m_iChoiceOnPage[pn],pn);
float fCursorY = CURSOR_Y(m_iCurrentPage,m_iChoiceOnPage[pn],pn);
m_sprOK[pn].SetX( CURSOR_X(iSelection, pn) );
m_sprOK[pn].SetY( CURSOR_Y(iSelection, pn) );
m_sprCursor[pn].BeginTweening( 0.2f );
m_sprCursor[pn].BeginTweening( 0.2f );
m_sprCursor[pn].SetTweenX( fCursorX );
m_sprCursor[pn].SetTweenY( fCursorY );
m_sprOK[pn].SetX( fCursorX );
m_sprOK[pn].SetY( fCursorY );
m_sprOK[pn].SetDiffuse( RageColor(1,1,1,0) );
m_sprOK[pn].SetZoom( 2 );
@@ -446,6 +388,7 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
m_sprJoinMessagehadow[pn].BeginTweening( 0.2f );
m_sprJoinMessagehadow[pn].SetDiffuse( RageColor(0,0,0,0) );
m_soundSelect.Play();
// check to see if everyone has chosen
for( int p=0; p<NUM_PLAYERS; p++ )
@@ -464,25 +407,21 @@ void ScreenSelectDifficulty::MenuBack( PlayerNumber pn )
void ScreenSelectDifficulty::TweenOffScreen()
{
unsigned p;
for( p=0; p < m_SubActors.size(); p++ )
for( unsigned p=0; p < m_SubActors.size(); p++ )
m_SubActors[p]->StopTweening();
for( p=0; p<NUM_PAGES; p++ )
{
if( p == 0 && SelectedSomethingOnPage2() )
continue; // skip
m_sprExplanation[p].SetXY( EXPLANATION_X(p), EXPLANATION_Y(p) );
m_sprExplanation[p].BeginTweening( 0.5, Actor::TWEEN_BOUNCE_BEGIN );
m_sprExplanation[p].SetTweenXY( EXPLANATION_X(p)+700, EXPLANATION_Y(p) );
const int page = m_iCurrentPage;
m_sprMoreArrows[p].BeginTweening( 0.5 );
m_sprMoreArrows[p].SetTweenDiffuse( RageColor(1,1,1,0) );
}
m_sprExplanation[page].SetXY( EXPLANATION_X(page), EXPLANATION_Y(page) );
m_sprExplanation[page].BeginTweening( 0.5, Actor::TWEEN_BOUNCE_BEGIN );
m_sprExplanation[page].SetTweenXY( EXPLANATION_X(page)+700, EXPLANATION_Y(page) );
for( p=0; p<NUM_PLAYERS; p++ )
m_sprMoreArrows[page].BeginTweening( 0.5 );
m_sprMoreArrows[page].SetTweenDiffuse( RageColor(1,1,1,0) );
for( unsigned p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) )
continue;
@@ -497,30 +436,17 @@ void ScreenSelectDifficulty::TweenOffScreen()
m_sprJoinMessagehadow[p].SetTweenDiffuse( RageColor(0,0,0,0) );
}
for( unsigned c=0; c<NUM_CHOICES; c++ )
{
if( SelectedSomethingOnPage2() != IsOnPage2(c) ) // item isn't on selected page
continue; // don't tween
for( unsigned c=0; c<m_ModeChoices[page].size(); c++ )
{
const float fPause = c*0.2f;
const float fPauseTime = c*0.2f;
// pause
m_sprHeader[c].BeginTweening( fPauseTime );
m_sprPicture[c].BeginTweening( fPauseTime );
// roll up
m_sprHeader[c].BeginTweening( 0.3f, TWEEN_BOUNCE_BEGIN );
m_sprPicture[c].BeginTweening( 0.3f, TWEEN_BOUNCE_BEGIN );
m_sprPicture[c].SetTweenZoomY( 0 );
// fly off
m_sprHeader[c].BeginTweening( 0.4f, TWEEN_BIAS_END );
m_sprHeader[c].SetTweenXY( CHOICE_X(c)-700, CHOICE_Y(c) );
m_sprPicture[c].BeginTweening( 0.4f, TWEEN_BIAS_END );
m_sprPicture[c].SetTweenXY( CHOICE_X(c)-700, CHOICE_Y(c) );
// roll up
m_sprPicture[page][c].FadeOff( fPause, "foldy bounce", 0.3f );
// fly off
m_sprHeader[page][c].FadeOff( fPause+0.3f, "left far accelerate", 0.4f );
}
}
}
@@ -530,13 +456,8 @@ void ScreenSelectDifficulty::TweenOnScreen()
for( p=0; p<NUM_PAGES; p++ )
{
m_sprExplanation[p].SetXY( EXPLANATION_X(p)+700, EXPLANATION_Y(p) );
m_sprExplanation[p].BeginTweening( 0.3f, Actor::TWEEN_BOUNCE_END );
m_sprExplanation[p].SetTweenXY( EXPLANATION_X(p), EXPLANATION_Y(p) );
m_sprMoreArrows[p].SetDiffuse( RageColor(1,1,1,0) );
m_sprMoreArrows[p].BeginTweening( 0.5 );
m_sprMoreArrows[p].SetTweenDiffuse( RageColor(1,1,1,1) );
m_sprExplanation[p].FadeOn( 0, "right bounce", 0.3f );
m_sprMoreArrows[p].FadeOn( 0, "fade", 0.5f );
}
for( p=0; p<NUM_PLAYERS; p++ )
@@ -544,57 +465,31 @@ void ScreenSelectDifficulty::TweenOnScreen()
if( !GAMESTATE->IsPlayerEnabled((PlayerNumber)p) )
continue;
int iSelection = m_Choice[p];
float fCursorX = CURSOR_X(m_iCurrentPage,m_iChoiceOnPage[p],p);
float fCursorY = CURSOR_Y(m_iCurrentPage,m_iChoiceOnPage[p],p);
m_sprCursor[p].SetXY( CURSOR_X(iSelection,(PlayerNumber)p), CURSOR_Y(iSelection,(PlayerNumber)p) );
/*
m_sprCursor[p].SetDiffuse( RageColor(1,1,1,0) );
m_sprCursor[p].SetRotation( D3DX_PI );
m_sprCursor[p].SetZoom( 2 );
m_sprCursor[p].BeginTweening( 0.3f );
m_sprCursor[p].SetTweenDiffuse( RageColor(1,1,1,1) );
m_sprCursor[p].SetTweenRotationZ( 0 );
m_sprCursor[p].SetTweenZoom( 1 );
*/
m_sprCursor[p].FadeOn( 0, "SpinZ ZoomX ZoomY Fade", 0.3f );
m_sprJoinMessagehadow[p].SetXY( CURSOR_X(iSelection,(PlayerNumber)p), CURSOR_Y(iSelection,(PlayerNumber)p) );
m_sprCursor[p].SetXY( fCursorX, fCursorY );
m_sprCursor[p].FadeOn( 0, "SpinZ Zoom Fade", 0.3f );
m_sprJoinMessagehadow[p].SetXY( fCursorX, fCursorY );
RageColor colorOriginal = m_sprJoinMessagehadow[p].GetDiffuse();
m_sprJoinMessagehadow[p].SetDiffuse( RageColor(0,0,0,0) );
m_sprJoinMessagehadow[p].BeginTweening( 0.3f );
m_sprJoinMessagehadow[p].SetTweenDiffuse( colorOriginal );
}
for( unsigned d=0; d<NUM_CHOICES; d++ )
{
const float fPauseTime = d*0.2f;
const int p = m_iCurrentPage;
for( unsigned c=0; c<m_ModeChoices[m_iCurrentPage].size(); c++ )
{
const float fPause = c*0.2f;
if( SelectedSomethingOnPage2() != IsOnPage2(d) ) // item isn't on the current page
continue; // don't tween
// set off screen
m_sprHeader[d].SetXY( CHOICE_X(d)-700, CHOICE_Y(d) );
m_sprPicture[d].SetXY( CHOICE_X(d)-700, CHOICE_Y(d) );
m_sprPicture[d].SetZoomY( 0 );
// pause
m_sprHeader[d].BeginTweening( fPauseTime );
m_sprPicture[d].BeginTweening( fPauseTime );
// fly on
m_sprHeader[d].BeginTweening( 0.5f, TWEEN_BIAS_BEGIN );
m_sprHeader[d].SetTweenXY( CHOICE_X(d), CHOICE_Y(d) );
m_sprPicture[d].BeginTweening( 0.5f, TWEEN_BIAS_BEGIN );
m_sprPicture[d].SetTweenXY( CHOICE_X(d), CHOICE_Y(d) );
// roll down
m_sprHeader[d].BeginTweening( 0.3f, TWEEN_BOUNCE_END );
m_sprPicture[d].BeginTweening( 0.3f, TWEEN_BOUNCE_END );
m_sprPicture[d].SetTweenZoomY( 1 );
// fly on
m_sprHeader[p][c].FadeOn( fPause, "left far accelerate", 0.4f );
// roll down
m_sprPicture[p][c].FadeOn( fPause+0.4f, "foldy bounce", 0.3f );
}
}
}
+12 -22
View File
@@ -16,26 +16,15 @@
#include "Quad.h"
#include "MenuElements.h"
#include "RandomSample.h"
#include "ModeChoice.h"
class ScreenSelectDifficulty : public Screen
{
public:
enum Choice
{
CHOICE_BEGINNER = 0, // page 1
CHOICE_EASY,
CHOICE_MEDIUM,
CHOICE_HARD,
CHOICE_NONSTOP, // page 2
CHOICE_ONI,
CHOICE_ENDLESS,
NUM_CHOICES
};
#define NUM_CHOICES_ON_PAGE_1 4 // beginner, easy, medium, hard,
#define NUM_CHOICES_ON_PAGE_2 3 // Nonstop, Oni, Endless
#define NUM_PAGES 2
enum Page { PAGE_1, PAGE_2, NUM_PAGES };
#define MAX_CHOICES_PER_PAGE 6
ScreenSelectDifficulty();
virtual ~ScreenSelectDifficulty();
@@ -54,17 +43,15 @@ public:
void TweenOnScreen();
private:
void ChangeTo( PlayerNumber pn, int iOldChoice, int iNewChoice );
bool IsOnPage2( int iChoice );
bool SelectedSomethingOnPage2(); // checks selection of players
void ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages );
void ChangePage( int iNewPage );
MenuElements m_Menu;
ActorFrame m_framePages; // 2 pages
ActorFrame m_framePages; // to hold the 2 pages
Sprite m_sprHeader[NUM_CHOICES];
Sprite m_sprPicture[NUM_CHOICES];
Sprite m_sprHeader[NUM_PAGES][MAX_CHOICES_PER_PAGE];
Sprite m_sprPicture[NUM_PAGES][MAX_CHOICES_PER_PAGE];
Sprite m_sprExplanation[NUM_PAGES];
Sprite m_sprMoreArrows[NUM_PAGES];
@@ -76,7 +63,10 @@ private:
RageSound m_soundSelect;
RandomSample m_soundDifficult;
Choice m_Choice[NUM_PLAYERS];
vector<ModeChoice> m_ModeChoices[NUM_PAGES];
int m_iCurrentPage;
int m_iChoiceOnPage[NUM_PLAYERS];
bool m_bChosen[NUM_PLAYERS];
float m_fLockInputTime;