Files
itgmania212121/stepmania/src/ScreenSelectDifficulty.cpp
T

558 lines
15 KiB
C++
Raw Normal View History

2003-03-02 01:43:33 +00:00
#include "global.h"
/*
-----------------------------------------------------------------------------
2003-03-09 00:55:49 +00:00
Class: ScreenSelectDifficulty
2003-03-02 01:43:33 +00:00
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
2003-03-09 00:55:49 +00:00
#include "ScreenSelectDifficulty.h"
2003-04-09 04:41:06 +00:00
#include "ScreenManager.h"
#include "PrefsManager.h"
2003-07-26 23:05:16 +00:00
#include "RageSounds.h"
2003-03-02 01:43:33 +00:00
#include "GameManager.h"
#include "ThemeManager.h"
#include "GameState.h"
#include "AnnouncerManager.h"
2003-03-03 10:03:02 +00:00
#include "ModeChoice.h"
2003-04-13 21:17:14 +00:00
#include "ActorUtil.h"
2003-03-03 10:03:02 +00:00
#define NUM_CHOICES_ON_PAGE_1 THEME->GetMetricI(m_sName,"NumChoicesOnPage1")
#define LOCK_INPUT_SECONDS THEME->GetMetricF(m_sName,"LockInputSeconds")
#define SLEEP_AFTER_CHOICE_SECONDS THEME->GetMetricF(m_sName,"SleepAfterChoiceSeconds")
#define SLEEP_AFTER_TWEEN_OFF_SECONDS THEME->GetMetricF(m_sName,"SleepAfterTweenOffSeconds")
#define CURSOR_CHOOSE_COMMAND THEME->GetMetric (m_sName,"CursorChooseCommand")
#define CURSOR_OFFSET_X_FROM_PICTURE( p ) THEME->GetMetricF(m_sName,ssprintf("CursorP%dOffsetXFromPicture",p+1))
#define CURSOR_OFFSET_Y_FROM_PICTURE( p ) THEME->GetMetricF(m_sName,ssprintf("CursorP%dOffsetYFromPicture",p+1))
#define SHADOW_CHOOSE_COMMAND THEME->GetMetric (m_sName,"ShadowChooseCommand")
#define SHADOW_LENGTH_X THEME->GetMetricF(m_sName,"ShadowLengthX")
#define SHADOW_LENGTH_Y THEME->GetMetricF(m_sName,"ShadowLengthY")
#define OK_CHOOSE_COMMAND THEME->GetMetric (m_sName,"OKChooseCommand")
#define DISABLED_COLOR THEME->GetMetricC(m_sName,"DisabledColor")
2003-03-09 00:55:49 +00:00
#define IGNORED_ELEMENT_COMMAND THEME->GetMetric (m_sName,"IgnoredElementOnCommand")
2003-03-09 00:55:49 +00:00
2003-09-27 22:30:51 +00:00
ScreenSelectDifficulty::ScreenSelectDifficulty( CString sClassName ) : ScreenSelect( sClassName )
2003-03-02 01:43:33 +00:00
{
m_CurrentPage = PAGE_1;
2003-03-10 04:11:45 +00:00
int p;
for( p=0; p<NUM_PLAYERS; p++ )
2003-03-02 01:43:33 +00:00
{
m_iChoiceOnPage[p] = 0;
m_bChosen[p] = false;
}
unsigned c; // GCC is bitching again.
2003-09-27 04:39:12 +00:00
for( c=0; c<m_aModeChoices.size(); c++ )
2003-03-03 10:03:02 +00:00
{
if( (int)c < NUM_CHOICES_ON_PAGE_1 )
m_ModeChoices[PAGE_1].push_back( m_aModeChoices[c] );
2003-03-02 01:43:33 +00:00
else
2003-03-03 10:03:02 +00:00
m_ModeChoices[PAGE_2].push_back( m_aModeChoices[c] );
}
2003-03-02 01:43:33 +00:00
2003-09-21 20:10:15 +00:00
c = 0;
2003-03-02 01:43:33 +00:00
for( int page=0; page<NUM_PAGES; page++ )
{
2003-09-21 20:10:15 +00:00
for( unsigned choice=0; choice<m_ModeChoices[page].size(); choice++, c++ )
2003-03-02 01:43:33 +00:00
{
CString sInfoFile = ssprintf( "%s info%d", m_sName.c_str(), c+1 );
CString sPictureFile = ssprintf( "%s picture%d", m_sName.c_str(), c+1 );
2003-03-02 01:43:33 +00:00
2003-04-12 06:16:12 +00:00
m_sprPicture[page][choice].SetName( ssprintf("PicturePage%dChoice%d",page+1,choice+1) );
m_sprPicture[page][choice].Load( THEME->GetPathToG(sPictureFile) );
2003-03-02 01:43:33 +00:00
m_framePages.AddChild( &m_sprPicture[page][choice] );
2003-04-12 06:16:12 +00:00
m_sprInfo[page][choice].SetName( ssprintf("InfoPage%dChoice%d",page+1,choice+1) );
m_sprInfo[page][choice].Load( THEME->GetPathToG(sInfoFile) );
2003-03-09 00:55:49 +00:00
m_framePages.AddChild( &m_sprInfo[page][choice] );
2003-03-02 01:43:33 +00:00
}
2003-04-12 06:16:12 +00:00
m_sprMore[page].SetName( ssprintf("MorePage%d",page+1) );
m_sprMore[page].Load( THEME->GetPathToG( ssprintf("%s more page%d", m_sName.c_str(),page+1) ) );
2003-03-02 01:43:33 +00:00
m_framePages.AddChild( &m_sprMore[page] );
2003-04-12 06:16:12 +00:00
m_sprExplanation[page].SetName( ssprintf("ExplanationPage%d",page+1) );
m_sprExplanation[page].Load( THEME->GetPathToG( m_sName + " explanation") );
2003-03-02 01:43:33 +00:00
m_sprExplanation[page].StopAnimating();
m_sprExplanation[page].SetState( page );
m_framePages.AddChild( &m_sprExplanation[page] );
}
2003-03-03 10:03:02 +00:00
for( p=0; p<NUM_PLAYERS; p++ )
2003-03-02 01:43:33 +00:00
{
CLAMP( m_iChoiceOnPage[p], 0, (int)m_ModeChoices[0].size()-1 );
m_bChosen[p] = false;
if( !GAMESTATE->IsHumanPlayer(p) )
2003-03-02 01:43:33 +00:00
continue;
2003-04-12 06:16:12 +00:00
m_sprShadow[p].SetName( "Shadow" );
m_sprShadow[p].Load( THEME->GetPathToG( m_sName + " shadow 2x1") );
2003-03-02 01:43:33 +00:00
m_sprShadow[p].StopAnimating();
m_sprShadow[p].SetState( p );
m_sprShadow[p].SetDiffuse( RageColor(0,0,0,0.6f) );
m_framePages.AddChild( &m_sprShadow[p] );
2003-04-12 06:16:12 +00:00
m_sprCursor[p].SetName( "Cursor" );
m_sprCursor[p].Load( THEME->GetPathToG( m_sName + " cursor 2x1") );
2003-03-02 01:43:33 +00:00
m_sprCursor[p].StopAnimating();
m_sprCursor[p].SetState( p );
m_framePages.AddChild( &m_sprCursor[p] );
2003-04-12 06:16:12 +00:00
m_sprOK[p].SetName( "OK" );
m_sprOK[p].Load( THEME->GetPathToG( m_sName + " ok 2x1") );
2003-03-02 01:43:33 +00:00
m_sprOK[p].SetState( p );
m_sprOK[p].StopAnimating();
m_sprOK[p].SetDiffuse( RageColor(1,1,1,0) );
m_framePages.AddChild( &m_sprOK[p] );
}
this->AddChild( &m_framePages );
m_soundChange.Load( THEME->GetPathToS( m_sName + " change") );
m_soundSelect.Load( THEME->GetPathToS( "Common start") );
2003-03-09 00:55:49 +00:00
m_soundDifficult.Load( ANNOUNCER->GetPathTo("select difficulty challenge") );
2003-03-02 01:43:33 +00:00
m_fLockInputTime = LOCK_INPUT_SECONDS;
this->UpdateSelectableChoices();
2003-03-03 10:03:02 +00:00
TweenOnScreen();
2003-03-02 01:43:33 +00:00
}
2003-03-09 00:55:49 +00:00
void ScreenSelectDifficulty::Update( float fDelta )
2003-03-02 01:43:33 +00:00
{
2003-03-03 10:03:02 +00:00
ScreenSelect::Update( fDelta );
2003-03-02 01:43:33 +00:00
m_fLockInputTime = max( 0, m_fLockInputTime-fDelta );
}
2003-03-09 00:55:49 +00:00
void ScreenSelectDifficulty::HandleScreenMessage( const ScreenMessage SM )
2003-03-02 01:43:33 +00:00
{
2003-03-03 10:09:34 +00:00
ScreenSelect::HandleScreenMessage( SM );
2003-03-02 01:43:33 +00:00
switch( SM )
{
case SM_BeginFadingOut:
TweenOffScreen();
2003-03-25 21:17:29 +00:00
SCREENMAN->PostMessageToTopScreen( SM_AllDoneChoosing, SLEEP_AFTER_TWEEN_OFF_SECONDS ); // nofify parent that we're finished
2003-11-07 20:10:38 +00:00
m_Menu.StopTimer();
2003-03-02 01:43:33 +00:00
break;
}
}
2003-03-09 00:55:49 +00:00
int ScreenSelectDifficulty::GetSelectionIndex( PlayerNumber pn )
2003-03-02 01:43:33 +00:00
{
2003-03-03 10:03:02 +00:00
int index = 0;
for( int page=0; page<m_CurrentPage; page++ )
index += m_ModeChoices[page].size();
index += m_iChoiceOnPage[pn];
return index;
2003-03-02 01:43:33 +00:00
}
2003-03-09 00:55:49 +00:00
void ScreenSelectDifficulty::UpdateSelectableChoices()
2003-03-02 01:43:33 +00:00
{
for( int page=0; page<NUM_PAGES; page++ )
{
/* XXX: If a player joins during the tween-in, this diffuse change
* will be undone by the tween. Hmm. */
for( unsigned i=0; i<m_ModeChoices[page].size(); i++ )
{
/* If the icon is text, use a dimmer diffuse, or we won't be
* able to see the glow. */
2003-09-27 03:11:37 +00:00
if( m_ModeChoices[page][i].IsPlayable() )
2003-03-02 01:43:33 +00:00
{
2003-03-09 00:55:49 +00:00
m_sprInfo[page][i].SetDiffuse( RageColor(1,1,1,1) );
2003-03-02 01:43:33 +00:00
m_sprPicture[page][i].SetDiffuse( RageColor(1,1,1,1) );
}
else
{
2003-03-09 00:55:49 +00:00
m_sprInfo[page][i].SetDiffuse( DISABLED_COLOR );
2003-03-02 01:43:33 +00:00
m_sprPicture[page][i].SetDiffuse( DISABLED_COLOR );
}
}
}
2003-09-15 23:01:13 +00:00
// I'm not sure why this was here -- but there seem no ill effects
// of it's removal.
//
//for( int p=0; p<NUM_PLAYERS; p++ )
// if( GAMESTATE->IsHumanPlayer(p) )
// {
// MenuRight( (PlayerNumber)p );
// MenuLeft( (PlayerNumber)p );
// }
2003-03-02 01:43:33 +00:00
}
2004-02-01 03:57:43 +00:00
static bool BothPlayersModeChoice( const ModeChoice &mc )
{
switch( mc.m_pm )
{
case PLAY_MODE_ONI:
case PLAY_MODE_NONSTOP:
case PLAY_MODE_ENDLESS:
case PLAY_MODE_RAVE:
return true;
}
return false;
}
2003-03-09 00:55:49 +00:00
void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn )
2003-03-02 01:43:33 +00:00
{
// if( m_fLockInputTime > 0 )
// return;
2003-03-02 01:43:33 +00:00
if( m_bChosen[pn] )
return;
bool AnotherPlayerSelected = false;
for( int p=0; p<NUM_PLAYERS; p++ )
if( p != pn && m_bChosen[p] )
AnotherPlayerSelected = true;
int iSwitchToIndex = -1;
for( int i=m_iChoiceOnPage[pn]-1; i>=0; i-- )
{
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i];
if( AnotherPlayerSelected && BothPlayersModeChoice(mc) )
continue;
if( mc.IsPlayable() )
{
iSwitchToIndex = i;
break;
}
}
if( iSwitchToIndex == -1 )
2003-03-02 01:43:33 +00:00
{
if( m_CurrentPage > 0 )
ChangePage( (Page)(m_CurrentPage-1) );
return;
2003-03-02 01:43:33 +00:00
}
if( ChangeWithinPage( pn, iSwitchToIndex, false ) )
m_soundChange.Play();
2003-03-02 01:43:33 +00:00
}
2003-03-09 00:55:49 +00:00
void ScreenSelectDifficulty::MenuRight( PlayerNumber pn )
2003-03-02 01:43:33 +00:00
{
// if( m_fLockInputTime > 0 )
// return;
2003-03-02 01:43:33 +00:00
if( m_bChosen[pn] )
return;
bool AnotherPlayerSelected = false;
for( int p=0; p<NUM_PLAYERS; p++ )
if( p != pn && m_bChosen[p] )
AnotherPlayerSelected = true;
int iSwitchToIndex = -1;
2003-09-15 07:14:39 +00:00
for( int i=m_iChoiceOnPage[pn]+1; i<(int) m_ModeChoices[m_CurrentPage].size(); i++ )
{
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i];
if( AnotherPlayerSelected && BothPlayersModeChoice(mc) )
continue;
if( mc.IsPlayable() )
{
iSwitchToIndex = i;
break;
}
}
if( iSwitchToIndex == -1 )
2003-03-02 01:43:33 +00:00
{
if( m_ModeChoices[m_CurrentPage+1].size()==0 ) // there is no page 2
return;
2003-03-02 01:43:33 +00:00
if( m_CurrentPage < NUM_PAGES-1 )
ChangePage( (Page)(m_CurrentPage+1) );
return;
2003-03-02 01:43:33 +00:00
}
if( ChangeWithinPage( pn, iSwitchToIndex, false ) )
m_soundChange.Play();
2003-03-02 01:43:33 +00:00
}
2003-03-09 00:55:49 +00:00
void ScreenSelectDifficulty::ChangePage( Page newPage )
2003-03-02 01:43:33 +00:00
{
int p;
// If anyone has already chosen, don't allow changing of pages
for( p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsHumanPlayer(p) && m_bChosen[p] )
2003-03-02 01:43:33 +00:00
return;
bool bPageIncreasing = newPage > m_CurrentPage;
m_CurrentPage = newPage;
if( newPage == PAGE_2 )
{
2003-03-30 19:32:05 +00:00
/* XXX: only play this once (I thought we already did that?) */
2003-03-02 01:43:33 +00:00
m_soundDifficult.Stop();
m_soundDifficult.PlayRandom();
}
// Find the first Playable mode on the new page
int iSwitchToIndex = -1;
if( !bPageIncreasing ) {
for( int i=m_ModeChoices[newPage].size()-1; i>=0; i-- )
{
2003-09-27 03:11:37 +00:00
if( m_ModeChoices[newPage][i].IsPlayable() )
{
iSwitchToIndex = i;
break;
}
}
} else {
2003-09-15 07:14:39 +00:00
for( unsigned i=0; i<m_ModeChoices[newPage].size(); i++ )
{
2003-09-27 03:11:37 +00:00
if( m_ModeChoices[newPage][i].IsPlayable() )
{
iSwitchToIndex = i;
break;
}
}
}
2003-03-02 01:43:33 +00:00
// change both players
for( p=0; p<NUM_PLAYERS; p++ )
ChangeWithinPage( (PlayerNumber)p, iSwitchToIndex, true );
2003-03-02 01:43:33 +00:00
2003-03-04 01:13:36 +00:00
m_soundChange.Play();
2003-03-02 01:43:33 +00:00
// move frame with choices
m_framePages.StopTweening();
m_framePages.BeginTweening( 0.2f );
2003-04-12 06:16:12 +00:00
m_framePages.SetX( (float)newPage*-SCREEN_WIDTH );
2003-03-02 01:43:33 +00:00
}
bool ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages )
2003-03-02 01:43:33 +00:00
{
bool bAnyChanged = false;
2003-03-02 01:43:33 +00:00
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMESTATE->IsHumanPlayer(p) )
2003-03-02 01:43:33 +00:00
continue; // skip
if( p!=pn && m_CurrentPage==PAGE_1 )
continue; // skip
if( m_iChoiceOnPage[p] == iNewChoice )
continue; // skip
2003-03-02 01:43:33 +00:00
bAnyChanged = true;
2003-03-02 01:43:33 +00:00
m_iChoiceOnPage[p] = iNewChoice;
float fCursorX = GetCursorX( (PlayerNumber)p );
float fCursorY = GetCursorY( (PlayerNumber)p );
m_sprCursor[p].StopTweening();
m_sprCursor[p].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_DECELERATE );
2003-04-12 06:16:12 +00:00
m_sprCursor[p].SetX( fCursorX );
m_sprCursor[p].SetY( fCursorY );
2003-03-02 01:43:33 +00:00
m_sprShadow[p].StopTweening();
m_sprShadow[p].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_DECELERATE );
2003-04-12 06:16:12 +00:00
m_sprShadow[p].SetX( fCursorX + SHADOW_LENGTH_X );
m_sprShadow[p].SetY( fCursorY + SHADOW_LENGTH_Y );
2003-03-02 01:43:33 +00:00
}
return bAnyChanged;
2003-03-02 01:43:33 +00:00
}
2003-03-09 00:55:49 +00:00
void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
2003-03-02 01:43:33 +00:00
{
if( m_fLockInputTime > 0 )
return;
if( m_bChosen[pn] == true )
return;
m_bChosen[pn] = true;
2003-03-30 21:02:15 +00:00
for( int page=0; page<NUM_PAGES; page++ )
2003-04-12 06:16:12 +00:00
OFF_COMMAND( m_sprMore[page] );
2003-03-02 01:43:33 +00:00
const ModeChoice& mc = m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[pn]];
2003-03-04 01:13:36 +00:00
/* Don't play sound if we're recursive, since it just played. */
static bool bPlaySelect = true;
if( bPlaySelect )
2003-03-04 01:13:36 +00:00
{
2003-09-25 05:56:38 +00:00
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectDifficulty comment %s",mc.m_sName.c_str())) );
2003-03-04 01:13:36 +00:00
m_soundSelect.Play();
}
2003-03-02 01:43:33 +00:00
int p;
// courses should be selected for both players at all times
if( BothPlayersModeChoice(mc) )
{
for( p=0; p<NUM_PLAYERS; p++ )
{
if( m_bChosen[p] || !GAMESTATE->IsHumanPlayer((PlayerNumber)p) || p == pn )
continue;
// move all cursors to the oni/nonstop selection so it graphically looks as if all players selected the same option.
ChangeWithinPage( (PlayerNumber)p, m_iChoiceOnPage[pn], false );
bPlaySelect = false;
MenuStart( (PlayerNumber)p ); // agree everyone
bPlaySelect = true;
}
}
else // someone must have chosen arcade style play so oni/nonstop/endless must be disabled
{
for( p=0; p<NUM_PLAYERS; p++ )
{
if( m_bChosen[p] || !GAMESTATE->IsHumanPlayer((PlayerNumber)p) || p == pn )
continue;
if( !BothPlayersModeChoice(m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[p]]) )
continue;
/* This player is currently on a choice that is no longer available due to
* the selection just made. */
int iSwitchToIndex = -1;
for( int i=m_iChoiceOnPage[p]+1; iSwitchToIndex == -1 && i < (int) m_ModeChoices[m_CurrentPage].size(); ++i )
if( m_ModeChoices[m_CurrentPage][i].IsPlayable() )
iSwitchToIndex = i;
if( iSwitchToIndex == -1 )
{
for( i=m_iChoiceOnPage[p]-1; iSwitchToIndex == -1 && i >= 0; --i )
if( m_ModeChoices[m_CurrentPage][i].IsPlayable() )
iSwitchToIndex = i;
}
/* We should always find a place to go--we should at least be able to choose
* the same thing pn picked. */
ASSERT( iSwitchToIndex != -1 );
// move the cursor
ChangeWithinPage( (PlayerNumber) p, iSwitchToIndex, false );
}
/* If the other player is active and hasn't yet chosen, gray out unselectable options.
* Otherwise, don't do this, so we don't gray out stuff when nothing else can be selected
* anyway. */
bool bAnyPlayersLeft = false;
for( p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) || m_bChosen[p] || p == pn )
continue;
bAnyPlayersLeft = true;
}
if( bAnyPlayersLeft )
{
for( unsigned c=0; c<m_ModeChoices[PAGE_1].size(); c++ )
{
if( BothPlayersModeChoice(m_ModeChoices[PAGE_1][c]) )
{
m_sprPicture[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND );
m_sprInfo[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND );
// IGNORED_ELEMENT_COMMAND
}
// m_ModeChoices[PAGE_1].push_back( m_aModeChoices[c] );
}
}
}
2003-03-02 01:43:33 +00:00
if( m_CurrentPage == PAGE_2 )
{
// choose this for all the other players too
2003-03-04 01:13:36 +00:00
for( p=0; p<NUM_PLAYERS; p++ )
2003-03-02 01:43:33 +00:00
{
if( m_bChosen[p] )
continue;
bPlaySelect = false;
2003-03-02 01:43:33 +00:00
MenuStart( (PlayerNumber)p );
bPlaySelect = true;
2003-03-02 01:43:33 +00:00
}
}
m_sprCursor[pn].Command( CURSOR_CHOOSE_COMMAND );
m_sprOK[pn].SetXY( m_sprShadow[pn].GetDestX(), m_sprShadow[pn].GetDestY() );
2003-03-02 01:43:33 +00:00
m_sprOK[pn].Command( OK_CHOOSE_COMMAND );
m_sprShadow[pn].Command( SHADOW_CHOOSE_COMMAND );
// check to see if everyone has chosen
2003-03-09 00:55:49 +00:00
for( p=0; p<NUM_PLAYERS; p++ )
2003-03-02 01:43:33 +00:00
{
if( GAMESTATE->IsHumanPlayer((PlayerNumber)p) && m_bChosen[p] == false )
2003-03-02 01:43:33 +00:00
return;
}
2003-03-25 21:17:29 +00:00
this->PostScreenMessage( SM_BeginFadingOut, SLEEP_AFTER_CHOICE_SECONDS ); // tell our owner it's time to move on
2003-03-02 01:43:33 +00:00
}
2003-03-09 00:55:49 +00:00
void ScreenSelectDifficulty::TweenOnScreen()
2003-03-02 01:43:33 +00:00
{
unsigned p;
for( int page=0; page<NUM_PAGES; page++ )
{
2003-04-12 06:16:12 +00:00
SET_XY_AND_ON_COMMAND( m_sprExplanation[page] );
SET_XY_AND_ON_COMMAND( m_sprMore[page] );
2003-03-02 01:43:33 +00:00
for( unsigned c=0; c<m_ModeChoices[page].size(); c++ )
2003-04-12 06:16:12 +00:00
{
SET_XY_AND_ON_COMMAND( m_sprInfo[page][c] );
SET_XY_AND_ON_COMMAND( m_sprPicture[page][c] );
2003-03-02 01:43:33 +00:00
}
}
for( p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) )
2003-03-02 01:43:33 +00:00
continue;
float fCursorX = GetCursorX( (PlayerNumber)p );
float fCursorY = GetCursorY( (PlayerNumber)p );
m_sprCursor[p].SetXY( fCursorX, fCursorY );
2003-04-12 06:16:12 +00:00
ON_COMMAND( m_sprCursor[p] );
2003-03-02 01:43:33 +00:00
m_sprShadow[p].SetXY( fCursorX + SHADOW_LENGTH_X, fCursorY + SHADOW_LENGTH_Y );
2003-04-12 06:16:12 +00:00
ON_COMMAND( m_sprShadow[p] );
2003-03-02 01:43:33 +00:00
}
}
2003-03-09 00:55:49 +00:00
void ScreenSelectDifficulty::TweenOffScreen()
2003-03-02 01:43:33 +00:00
{
const int page = m_CurrentPage;
2003-04-12 06:16:12 +00:00
OFF_COMMAND( m_sprExplanation[page] );
OFF_COMMAND( m_sprMore[page] );
2003-03-02 01:43:33 +00:00
for( int p=0; p<NUM_PLAYERS; p++ )
{
2003-04-12 06:16:12 +00:00
if( !GAMESTATE->IsHumanPlayer(p) )
2003-03-02 01:43:33 +00:00
continue;
2003-04-12 06:16:12 +00:00
OFF_COMMAND( m_sprCursor[p] );
OFF_COMMAND( m_sprOK[p] );
OFF_COMMAND( m_sprShadow[p] );
2003-03-02 01:43:33 +00:00
}
for( unsigned c=0; c<m_ModeChoices[page].size(); c++ )
{
2003-04-12 06:16:12 +00:00
OFF_COMMAND( m_sprInfo[page][c] );
OFF_COMMAND( m_sprPicture[page][c] );
2003-03-02 01:43:33 +00:00
}
}
2003-03-09 00:55:49 +00:00
float ScreenSelectDifficulty::GetCursorX( PlayerNumber pn )
2003-03-02 01:43:33 +00:00
{
return m_sprPicture[m_CurrentPage][m_iChoiceOnPage[pn]].GetX() + CURSOR_OFFSET_X_FROM_PICTURE(pn);
}
2003-03-09 00:55:49 +00:00
float ScreenSelectDifficulty::GetCursorY( PlayerNumber pn )
2003-03-02 01:43:33 +00:00
{
return m_sprPicture[m_CurrentPage][m_iChoiceOnPage[pn]].GetY() + CURSOR_OFFSET_Y_FROM_PICTURE(pn);
}