2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-07-31 22:37:58 +00:00
|
|
|
Class: ScreenOptions
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-07-31 22:37:58 +00:00
|
|
|
Desc: See header.
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-07-31 22:37:58 +00:00
|
|
|
Chris Danford
|
2003-06-16 17:34:20 +00:00
|
|
|
Glenn Maynard
|
2002-05-20 08:59:37 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ScreenOptions.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "RageLog.h"
|
2002-08-13 23:26:46 +00:00
|
|
|
#include "GameState.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2003-08-29 08:16:24 +00:00
|
|
|
#include "InputMapper.h"
|
2003-12-18 00:17:04 +00:00
|
|
|
#include "ActorUtil.h"
|
2003-12-18 22:51:43 +00:00
|
|
|
#include "ProfileManager.h"
|
2003-12-31 08:45:05 +00:00
|
|
|
#include "song.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-03-31 14:02:39 +00:00
|
|
|
const float ITEM_X[NUM_PLAYERS] = { 260, 420 };
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-11-06 07:23:22 +00:00
|
|
|
#define ICONS_X( p ) THEME->GetMetricF("ScreenOptions",ssprintf("IconsP%dX",p+1))
|
|
|
|
|
#define ARROWS_X THEME->GetMetricF("ScreenOptions","ArrowsX")
|
|
|
|
|
#define LABELS_X THEME->GetMetricF("ScreenOptions","LabelsX")
|
|
|
|
|
#define LABELS_ZOOM THEME->GetMetricF("ScreenOptions","LabelsZoom")
|
|
|
|
|
#define LABELS_H_ALIGN THEME->GetMetricI("ScreenOptions","LabelsHAlign")
|
|
|
|
|
#define ITEMS_ZOOM THEME->GetMetricF("ScreenOptions","ItemsZoom")
|
|
|
|
|
#define ITEMS_START_X THEME->GetMetricF("ScreenOptions","ItemsStartX")
|
|
|
|
|
#define ITEMS_GAP_X THEME->GetMetricF("ScreenOptions","ItemsGapX")
|
|
|
|
|
#define ITEMS_START_Y THEME->GetMetricF("ScreenOptions","ItemsStartY")
|
|
|
|
|
#define ITEMS_SPACING_Y THEME->GetMetricF("ScreenOptions","ItemsSpacingY")
|
|
|
|
|
#define EXPLANATION_X(p) THEME->GetMetricF("ScreenOptions",ssprintf("ExplanationP%dX",p+1))
|
|
|
|
|
#define EXPLANATION_Y(p) THEME->GetMetricF("ScreenOptions",ssprintf("ExplanationP%dY",p+1))
|
2003-11-06 09:54:40 +00:00
|
|
|
#define EXPLANATION_ON_COMMAND(p) THEME->GetMetric ("ScreenOptions",ssprintf("ExplanationP%dOnCommand",p+1))
|
2003-11-06 07:23:22 +00:00
|
|
|
#define EXPLANATION_TOGETHER_X THEME->GetMetricF("ScreenOptions","ExplanationTogetherX")
|
|
|
|
|
#define EXPLANATION_TOGETHER_Y THEME->GetMetricF("ScreenOptions","ExplanationTogetherY")
|
|
|
|
|
#define EXPLANATION_TOGETHER_ON_COMMAND THEME->GetMetric ("ScreenOptions","ExplanationTogetherOnCommand")
|
2003-12-18 00:17:04 +00:00
|
|
|
#define SHOW_SCROLL_BAR THEME->GetMetricB("ScreenOptions","ShowScrollBar")
|
2003-12-18 00:48:31 +00:00
|
|
|
/* Extra parens needed to work around stupid VC6 compiler crash: */
|
|
|
|
|
#define SCROLL_BAR_HEIGHT (THEME->GetMetricF("ScreenOptions","ScrollBarHeight"))
|
|
|
|
|
#define SCROLL_BAR_TIME (THEME->GetMetricF("ScreenOptions","ScrollBarTime"))
|
2003-11-06 07:23:22 +00:00
|
|
|
#define ITEMS_SPACING_Y THEME->GetMetricF("ScreenOptions","ItemsSpacingY")
|
|
|
|
|
#define EXPLANATION_ZOOM THEME->GetMetricF("ScreenOptions","ExplanationZoom")
|
|
|
|
|
#define COLOR_SELECTED THEME->GetMetricC("ScreenOptions","ColorSelected")
|
|
|
|
|
#define COLOR_NOT_SELECTED THEME->GetMetricC("ScreenOptions","ColorNotSelected")
|
|
|
|
|
#define NUM_SHOWN_ITEMS THEME->GetMetricI("ScreenOptions","NumShownItems")
|
2003-12-31 08:45:05 +00:00
|
|
|
#define SHOW_BPM_IN_SPEED_TITLE THEME->GetMetricB("ScreenOptions","ShowBpmInSpeedTitle")
|
2003-12-31 22:32:46 +00:00
|
|
|
#define FRAME_ON_COMMAND THEME->GetMetric ("ScreenOptions","FrameOnCommand")
|
|
|
|
|
#define FRAME_OFF_COMMAND THEME->GetMetric ("ScreenOptions","FrameOffCommand")
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-01-09 05:50:15 +00:00
|
|
|
/*
|
|
|
|
|
* Three navigation types are provided:
|
|
|
|
|
*
|
|
|
|
|
* NAV_THREE_KEY:
|
|
|
|
|
* left, right -> change option
|
|
|
|
|
* up, down -> don't matter (change row)
|
|
|
|
|
* start -> move to next row
|
|
|
|
|
* left+right+start -> move to prev row
|
|
|
|
|
* (next screen via "exit" entry)
|
|
|
|
|
* This is the minimal navigation, for using menus with only three buttons.
|
|
|
|
|
*
|
|
|
|
|
* NAV_FIVE_KEY:
|
|
|
|
|
* left, right -> change option
|
|
|
|
|
* up, down -> change row
|
|
|
|
|
* start -> next screen
|
|
|
|
|
* This is a much more convenient navigation, requiring five keys.
|
|
|
|
|
*
|
|
|
|
|
* NAV_THREE_KEY_MENU:
|
|
|
|
|
* left, right -> change row
|
|
|
|
|
* up, down -> change row
|
|
|
|
|
* start -> next screen
|
|
|
|
|
* This is a specialized navigation for ScreenOptionsMenu. It must be enabled to
|
|
|
|
|
* allow screens that use rows to select other screens to work with only three
|
|
|
|
|
* buttons. (It's also used when in five-key mode.)
|
|
|
|
|
*/
|
|
|
|
|
|
2003-09-27 08:00:10 +00:00
|
|
|
ScreenOptions::ScreenOptions( CString sClassName ) : Screen(sClassName)
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenOptions::ScreenOptions()" );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-01-09 05:50:15 +00:00
|
|
|
m_OptionsNavigation = PREFSMAN->m_bArcadeOptionsNavigation? NAV_THREE_KEY:NAV_FIVE_KEY;
|
2004-01-09 04:43:27 +00:00
|
|
|
|
2003-11-25 21:53:56 +00:00
|
|
|
m_SoundChangeCol.Load( THEME->GetPathToS("ScreenOptions change"), true );
|
|
|
|
|
m_SoundNextRow.Load( THEME->GetPathToS("ScreenOptions next"), true );
|
|
|
|
|
m_SoundPrevRow.Load( THEME->GetPathToS("ScreenOptions prev"), true );
|
2003-04-12 17:39:27 +00:00
|
|
|
m_SoundStart.Load( THEME->GetPathToS("Common start") );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-09-27 04:58:30 +00:00
|
|
|
m_Menu.Load( sClassName );
|
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
|
|
|
// add everything to m_framePage so we can animate everything at once
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_framePage );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
|
|
|
|
m_iCurrentRow[p] = 0;
|
|
|
|
|
|
2002-11-16 20:21:00 +00:00
|
|
|
for( unsigned l=0; l<MAX_OPTION_LINES; l++ )
|
2002-05-20 08:59:37 +00:00
|
|
|
m_iSelectedOption[p][l] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-31 22:32:46 +00:00
|
|
|
m_framePage.Command( FRAME_ON_COMMAND );
|
2004-01-09 04:14:13 +00:00
|
|
|
}
|
2003-12-31 22:32:46 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
void ScreenOptions::LoadOptionIcon( PlayerNumber pn, int iRow, CString sText )
|
|
|
|
|
{
|
|
|
|
|
m_Rows[iRow]->m_OptionIcons[pn].Load( pn, sText, false );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2003-11-05 07:46:20 +00:00
|
|
|
void ScreenOptions::Init( InputMode im, OptionRow OptionRows[], int iNumOptionLines )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenOptions::Set()" );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
m_InputMode = im;
|
2003-09-04 20:22:06 +00:00
|
|
|
m_OptionRow = OptionRows;
|
2002-09-04 03:49:08 +00:00
|
|
|
m_iNumOptionRows = iNumOptionLines;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
this->ImportOptions();
|
2003-10-01 07:02:26 +00:00
|
|
|
|
2003-10-01 07:50:30 +00:00
|
|
|
for( int l=0; l<m_iNumOptionRows; l++ )
|
2003-08-23 22:04:57 +00:00
|
|
|
if( m_OptionRow[l].bOneChoiceForAllPlayers )
|
2002-08-13 23:26:46 +00:00
|
|
|
m_iSelectedOption[PLAYER_2][l] = m_iSelectedOption[PLAYER_1][l];
|
2003-08-23 22:04:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int p;
|
|
|
|
|
|
2003-12-19 22:10:06 +00:00
|
|
|
m_sprPage.Load( THEME->GetPathToG(m_sName+" page") );
|
|
|
|
|
m_sprPage->SetName( "Page" );
|
|
|
|
|
UtilSetXYAndOnCommand( m_sprPage, "ScreenOptions" );
|
|
|
|
|
m_framePage.AddChild( m_sprPage );
|
|
|
|
|
|
2003-08-23 22:04:57 +00:00
|
|
|
// init highlights
|
|
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
|
|
|
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
|
|
|
|
continue; // skip
|
|
|
|
|
|
2003-12-19 22:10:06 +00:00
|
|
|
m_sprLineHighlight[p].Load( THEME->GetPathToG("ScreenOptions line highlight") );
|
|
|
|
|
m_sprLineHighlight[p].SetName( "LineHighlight" );
|
|
|
|
|
m_sprLineHighlight[p].SetX( CENTER_X );
|
|
|
|
|
m_framePage.AddChild( &m_sprLineHighlight[p] );
|
|
|
|
|
UtilOnCommand( m_sprLineHighlight[p], "ScreenOptions" );
|
|
|
|
|
|
2003-08-23 22:04:57 +00:00
|
|
|
m_Highlight[p].Load( (PlayerNumber)p, false );
|
|
|
|
|
m_framePage.AddChild( &m_Highlight[p] );
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
int r;
|
|
|
|
|
for( r=0; r<m_iNumOptionRows; r++ ) // foreach row
|
|
|
|
|
{
|
|
|
|
|
m_Rows.push_back( new Row() );
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-23 22:04:57 +00:00
|
|
|
// init underlines
|
|
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
2003-04-10 05:46:31 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
2002-08-13 23:26:46 +00:00
|
|
|
continue; // skip
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
for( int l=0; l<m_iNumOptionRows; l++ )
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[l];
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
LoadOptionIcon( (PlayerNumber)p, l, "" );
|
|
|
|
|
m_framePage.AddChild( &row.m_OptionIcons[p] );
|
|
|
|
|
|
|
|
|
|
row.m_Underline[p].Load( (PlayerNumber)p, true );
|
|
|
|
|
m_framePage.AddChild( &row.m_Underline[p] );
|
2003-08-23 22:04:57 +00:00
|
|
|
}
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
2003-09-04 20:22:06 +00:00
|
|
|
// init m_textItems from optionLines
|
2004-01-09 04:14:13 +00:00
|
|
|
for( r=0; r<m_iNumOptionRows; r++ ) // foreach row
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[r];
|
|
|
|
|
row.Type = Row::ROW_NORMAL;
|
|
|
|
|
|
|
|
|
|
vector<BitmapText *> & textItems = row.m_textItems;
|
2003-09-05 07:34:13 +00:00
|
|
|
const OptionRow &optline = m_OptionRow[r];
|
|
|
|
|
|
2003-09-05 07:08:08 +00:00
|
|
|
unsigned c;
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
m_framePage.AddChild( &row.m_sprBullet );
|
|
|
|
|
m_framePage.AddChild( &row.m_textTitle );
|
2002-09-04 03:49:08 +00:00
|
|
|
|
2003-09-04 20:22:06 +00:00
|
|
|
float fX = ITEMS_START_X; // indent 70 pixels
|
2003-09-05 07:08:08 +00:00
|
|
|
for( c=0; c<optline.choices.size(); c++ )
|
2003-08-23 22:04:57 +00:00
|
|
|
{
|
2003-09-04 19:53:07 +00:00
|
|
|
BitmapText *bt = new BitmapText;
|
2003-09-05 07:34:13 +00:00
|
|
|
textItems.push_back( bt );
|
2003-09-04 19:53:07 +00:00
|
|
|
|
2003-09-04 20:22:06 +00:00
|
|
|
bt->LoadFromFont( THEME->GetPathToF("ScreenOptions item") );
|
|
|
|
|
bt->SetText( optline.choices[c] );
|
|
|
|
|
bt->SetZoom( ITEMS_ZOOM );
|
|
|
|
|
bt->EnableShadow( false );
|
|
|
|
|
|
|
|
|
|
// set the X position of each item in the line
|
2003-11-24 02:32:10 +00:00
|
|
|
const float fItemWidth = bt->GetZoomedWidth();
|
2003-09-04 20:22:06 +00:00
|
|
|
fX += fItemWidth/2;
|
|
|
|
|
bt->SetX( fX );
|
|
|
|
|
fX += fItemWidth/2 + ITEMS_GAP_X;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( fX > SCREEN_RIGHT-40 )
|
|
|
|
|
{
|
|
|
|
|
// It goes off the edge of the screen. Re-init with the "long row" style.
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_bRowIsLong = true;
|
|
|
|
|
for( unsigned j=0; j<optline.choices.size(); j++ ) // for each option on this row
|
2003-09-05 07:34:13 +00:00
|
|
|
delete textItems[j];
|
|
|
|
|
textItems.clear();
|
2003-09-04 20:22:06 +00:00
|
|
|
|
|
|
|
|
for( unsigned p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
|
|
|
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
BitmapText *bt = new BitmapText;
|
2003-09-05 07:34:13 +00:00
|
|
|
textItems.push_back( bt );
|
2003-09-04 20:22:06 +00:00
|
|
|
|
|
|
|
|
const int iChoiceInRow = m_iSelectedOption[p][r];
|
|
|
|
|
|
|
|
|
|
bt->LoadFromFont( THEME->GetPathToF("ScreenOptions item") );
|
2003-09-05 07:34:13 +00:00
|
|
|
bt->SetText( optline.choices[iChoiceInRow] );
|
2003-09-04 20:22:06 +00:00
|
|
|
bt->SetZoom( ITEMS_ZOOM );
|
|
|
|
|
bt->EnableShadow( false );
|
|
|
|
|
|
|
|
|
|
/* if choices are locked together, center the item. */
|
|
|
|
|
if( optline.bOneChoiceForAllPlayers )
|
|
|
|
|
bt->SetX( (ITEM_X[0]+ITEM_X[1])/2 );
|
|
|
|
|
else
|
|
|
|
|
bt->SetX( ITEM_X[p] );
|
|
|
|
|
|
2003-09-04 21:04:39 +00:00
|
|
|
/* If bOneChoiceForAllPlayers, then only initialize one text item. */
|
|
|
|
|
if( optline.bOneChoiceForAllPlayers )
|
|
|
|
|
break;
|
2003-09-04 20:22:06 +00:00
|
|
|
}
|
2003-08-23 22:04:57 +00:00
|
|
|
}
|
2003-09-04 20:22:06 +00:00
|
|
|
|
2003-09-05 07:34:13 +00:00
|
|
|
for( c=0; c<textItems.size(); c++ )
|
|
|
|
|
m_framePage.AddChild( textItems[c] );
|
2004-01-09 00:03:33 +00:00
|
|
|
}
|
2003-09-04 20:22:06 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
// TRICKY: Add one more item. This will be "EXIT"
|
2003-09-04 19:53:07 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
m_Rows.push_back( new Row() );
|
|
|
|
|
Row &row = *m_Rows.back();
|
|
|
|
|
row.Type = Row::ROW_EXIT;
|
|
|
|
|
|
2003-09-04 19:53:07 +00:00
|
|
|
BitmapText *bt = new BitmapText;
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_textItems.push_back( bt );
|
2003-09-04 20:22:06 +00:00
|
|
|
|
|
|
|
|
bt->LoadFromFont( THEME->GetPathToF("ScreenOptions item") );
|
|
|
|
|
bt->SetText( "EXIT" );
|
|
|
|
|
bt->SetZoom( ITEMS_ZOOM );
|
2004-01-09 04:14:13 +00:00
|
|
|
bt->EnableShadow( false );
|
|
|
|
|
bt->SetX( CENTER_X );
|
2003-09-04 20:22:06 +00:00
|
|
|
|
2003-09-04 19:53:07 +00:00
|
|
|
m_framePage.AddChild( bt );
|
|
|
|
|
}
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2004-01-09 00:03:33 +00:00
|
|
|
InitOptionsText();
|
|
|
|
|
|
2002-09-10 21:16:34 +00:00
|
|
|
// add explanation here so it appears on top
|
2003-11-07 05:17:41 +00:00
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
|
|
|
|
m_textExplanation[p].LoadFromFont( THEME->GetPathToF("ScreenOptions explanation") );
|
|
|
|
|
m_textExplanation[p].SetZoom( EXPLANATION_ZOOM );
|
|
|
|
|
m_textExplanation[p].SetShadowLength( 0 );
|
|
|
|
|
m_framePage.AddChild( &m_textExplanation[p] );
|
|
|
|
|
}
|
2003-12-18 00:17:04 +00:00
|
|
|
|
2003-12-30 04:35:48 +00:00
|
|
|
/* Hack: if m_CurStyle is set, we're probably in the player or song options menu, so
|
|
|
|
|
* the player name is meaningful. Otherwise, we're probably in the system menu. */
|
|
|
|
|
if( GAMESTATE->m_CurStyle != STYLE_INVALID )
|
2003-12-18 22:51:43 +00:00
|
|
|
{
|
2003-12-30 04:35:48 +00:00
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
|
|
|
|
m_textPlayerName[p].LoadFromFont( THEME->GetPathToF( "ScreenOptions player") );
|
|
|
|
|
m_textPlayerName[p].SetName( ssprintf("PlayerNameP%i",p+1) );
|
|
|
|
|
m_textPlayerName[p].SetText( PROFILEMAN->GetPlayerName((PlayerNumber)p) );
|
|
|
|
|
UtilSetXYAndOnCommand( m_textPlayerName[p], "ScreenOptions" );
|
|
|
|
|
m_framePage.AddChild( &m_textPlayerName[p] );
|
|
|
|
|
}
|
2003-12-18 22:51:43 +00:00
|
|
|
}
|
|
|
|
|
|
2003-12-18 00:17:04 +00:00
|
|
|
if( SHOW_SCROLL_BAR )
|
|
|
|
|
{
|
|
|
|
|
m_ScrollBar.SetName( "DualScrollBar", "ScrollBar" );
|
|
|
|
|
m_ScrollBar.SetBarHeight( SCROLL_BAR_HEIGHT );
|
|
|
|
|
m_ScrollBar.SetBarTime( SCROLL_BAR_TIME );
|
|
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
m_ScrollBar.EnablePlayer( (PlayerNumber)p, GAMESTATE->IsHumanPlayer(p) );
|
|
|
|
|
m_ScrollBar.Load();
|
|
|
|
|
UtilSetXY( m_ScrollBar, "ScreenOptions" );
|
|
|
|
|
m_framePage.AddChild( &m_ScrollBar );
|
|
|
|
|
}
|
|
|
|
|
|
2003-11-05 07:46:20 +00:00
|
|
|
switch( m_InputMode )
|
|
|
|
|
{
|
|
|
|
|
case INPUTMODE_INDIVIDUAL:
|
|
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
m_textExplanation[p].SetXY( EXPLANATION_X(p), EXPLANATION_Y(p) );
|
|
|
|
|
break;
|
|
|
|
|
case INPUTMODE_TOGETHER:
|
|
|
|
|
m_textExplanation[0].SetXY( EXPLANATION_TOGETHER_X, EXPLANATION_TOGETHER_Y );
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-19 22:10:06 +00:00
|
|
|
m_sprFrame.Load( THEME->GetPathToG( "ScreenOptions frame") );
|
|
|
|
|
m_sprFrame->SetXY( CENTER_X, CENTER_Y );
|
|
|
|
|
m_framePage.AddChild( m_sprFrame );
|
|
|
|
|
|
2003-11-05 07:46:20 +00:00
|
|
|
// poke once at all the explanation metrics so that we catch missing ones early
|
2004-01-09 04:14:13 +00:00
|
|
|
for( r=0; r<(int)m_Rows.size(); r++ ) // foreach row
|
2003-11-08 04:25:33 +00:00
|
|
|
{
|
2003-11-08 02:46:12 +00:00
|
|
|
GetExplanationText( r );
|
2003-11-08 04:25:33 +00:00
|
|
|
GetExplanationTitle( r );
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-30 22:14:19 +00:00
|
|
|
CHECKPOINT;
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2003-06-16 03:29:59 +00:00
|
|
|
PositionItems();
|
2002-05-20 08:59:37 +00:00
|
|
|
PositionUnderlines();
|
2002-09-03 06:33:08 +00:00
|
|
|
PositionIcons();
|
2002-09-03 22:31:06 +00:00
|
|
|
RefreshIcons();
|
2002-09-04 03:49:08 +00:00
|
|
|
PositionCursors();
|
|
|
|
|
UpdateEnabledDisabled();
|
2003-11-06 09:54:40 +00:00
|
|
|
for( p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
OnChange( (PlayerNumber)p );
|
2004-01-08 23:32:14 +00:00
|
|
|
|
2003-09-04 19:53:07 +00:00
|
|
|
CHECKPOINT;
|
2003-06-16 17:34:20 +00:00
|
|
|
|
|
|
|
|
/* It's tweening into position, but on the initial tween-in we only want to
|
|
|
|
|
* tween in the whole page at once. Since the tweens are nontrivial, it's
|
|
|
|
|
* easiest to queue the tweens and then force them to finish. */
|
2004-01-09 04:14:13 +00:00
|
|
|
for( r=0; r<(int) m_Rows.size(); r++ ) // foreach options line
|
2003-06-16 17:34:20 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[r];
|
|
|
|
|
row.m_sprBullet.FinishTweening();
|
|
|
|
|
row.m_textTitle.FinishTweening();
|
|
|
|
|
|
|
|
|
|
for( unsigned c=0; c<row.m_textItems.size(); c++ )
|
|
|
|
|
row.m_textItems[c]->FinishTweening();
|
2003-06-16 17:34:20 +00:00
|
|
|
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
|
|
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_Underline[p].FinishTweening();
|
|
|
|
|
row.m_OptionIcons[p].FinishTweening();
|
2003-06-16 17:34:20 +00:00
|
|
|
}
|
|
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenOptions::~ScreenOptions()
|
|
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenOptions::~ScreenOptions()" );
|
2004-01-09 00:03:33 +00:00
|
|
|
for( unsigned i=0; i<m_Rows.size(); i++ )
|
2004-01-09 04:14:13 +00:00
|
|
|
delete m_Rows[i];
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
CString ScreenOptions::GetExplanationText( int iRow ) const
|
2003-11-08 02:46:12 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
if( m_Rows[iRow]->Type == Row::ROW_EXIT )
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
CString sLineName = m_OptionRow[iRow].name;
|
2003-11-08 02:46:12 +00:00
|
|
|
sLineName.Replace("\n-","");
|
|
|
|
|
sLineName.Replace("\n","");
|
|
|
|
|
sLineName.Replace(" ","");
|
2003-11-08 04:25:33 +00:00
|
|
|
return THEME->GetMetric( "OptionExplanations", sLineName+"Help" );
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
CString ScreenOptions::GetExplanationTitle( int iRow ) const
|
2003-11-08 04:25:33 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
if( m_Rows[iRow]->Type == Row::ROW_EXIT )
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
CString sLineName = m_OptionRow[iRow].name;
|
2003-11-08 04:25:33 +00:00
|
|
|
sLineName.Replace("\n-","");
|
|
|
|
|
sLineName.Replace("\n","");
|
|
|
|
|
sLineName.Replace(" ","");
|
2003-12-31 08:45:05 +00:00
|
|
|
CString sTitle = THEME->GetMetric( "OptionExplanations", sLineName+"Title" );
|
|
|
|
|
|
|
|
|
|
// HACK: tack the BPM onto the name of the speed line
|
|
|
|
|
if( sLineName.CompareNoCase("speed")==0 )
|
|
|
|
|
{
|
|
|
|
|
if( SHOW_BPM_IN_SPEED_TITLE && GAMESTATE->m_pCurSong )
|
|
|
|
|
{
|
|
|
|
|
float fMinBpm, fMaxBpm;
|
|
|
|
|
GAMESTATE->m_pCurSong->GetDisplayBPM( fMinBpm, fMaxBpm );
|
|
|
|
|
if( fMinBpm == fMaxBpm )
|
|
|
|
|
sTitle += ssprintf( " (%.0f)", fMinBpm );
|
|
|
|
|
else
|
|
|
|
|
sTitle += ssprintf( " (%.0f-%.0f)", fMinBpm, fMaxBpm );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sTitle;
|
2003-11-08 02:46:12 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-09-06 07:42:28 +00:00
|
|
|
BitmapText &ScreenOptions::GetTextItemForRow( PlayerNumber pn, int iRow )
|
|
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[iRow];
|
|
|
|
|
if( row.Type == Row::ROW_EXIT )
|
|
|
|
|
return *row.m_textItems[0];
|
2003-09-06 07:42:28 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
if( !row.m_bRowIsLong )
|
2003-09-06 07:42:28 +00:00
|
|
|
{
|
|
|
|
|
unsigned iOptionInRow = m_iSelectedOption[pn][iRow];
|
2004-01-09 04:14:13 +00:00
|
|
|
return *row.m_textItems[iOptionInRow];
|
2003-09-06 07:42:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const bool bOneChoice = m_OptionRow[iRow].bOneChoiceForAllPlayers;
|
|
|
|
|
|
|
|
|
|
if( bOneChoice )
|
2004-01-09 04:14:13 +00:00
|
|
|
return *row.m_textItems[0];
|
2003-09-06 07:42:28 +00:00
|
|
|
|
|
|
|
|
/* We have lots of options and this isn't a OneChoice row, which means
|
|
|
|
|
* each player has a separate item displayed. */
|
2004-01-09 04:14:13 +00:00
|
|
|
int iOptionInRow = min( (unsigned)pn, row.m_textItems.size()-1 );
|
|
|
|
|
CHECKPOINT;
|
|
|
|
|
return *row.m_textItems[iOptionInRow];
|
2003-09-06 07:42:28 +00:00
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenOptions::GetWidthXY( PlayerNumber pn, int iRow, int &iWidthOut, int &iXOut, int &iYOut )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-09-06 07:42:28 +00:00
|
|
|
BitmapText &text = GetTextItemForRow( pn, iRow );
|
2003-03-31 14:02:39 +00:00
|
|
|
|
2003-11-24 02:32:10 +00:00
|
|
|
iWidthOut = int(roundf( text.GetZoomedWidth() ));
|
2003-06-16 03:29:59 +00:00
|
|
|
iXOut = int(roundf( text.GetDestX() ));
|
2004-01-09 04:14:13 +00:00
|
|
|
/* We update m_fY, change colors and tween items, and then tween rows to
|
|
|
|
|
* their final positions. (This is so we don't tween colors, too.) m_fY
|
2003-06-16 03:29:59 +00:00
|
|
|
* is the actual destination position, even though we may not have set up the
|
|
|
|
|
* tween yet. */
|
2004-01-09 04:14:13 +00:00
|
|
|
iYOut = int(roundf( m_Rows[iRow]->m_fY ));
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenOptions::InitOptionsText()
|
|
|
|
|
{
|
2004-01-09 00:03:33 +00:00
|
|
|
for( unsigned i=0; i<m_Rows.size(); i++ ) // foreach options line
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[i];
|
|
|
|
|
if( row.Type == Row::ROW_EXIT )
|
2004-01-09 00:03:33 +00:00
|
|
|
continue;
|
|
|
|
|
|
2003-06-16 03:29:59 +00:00
|
|
|
const float fY = ITEMS_START_Y + ITEMS_SPACING_Y*i;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
BitmapText &title = row.m_textTitle;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
title.LoadFromFont( THEME->GetPathToF("ScreenOptions title") );
|
2003-11-08 04:25:33 +00:00
|
|
|
CString sText = GetExplanationTitle( i );
|
2002-09-04 22:57:40 +00:00
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
title.SetText( sText );
|
2002-06-14 22:25:22 +00:00
|
|
|
title.SetXY( LABELS_X, fY );
|
2002-09-04 03:49:08 +00:00
|
|
|
title.SetZoom( LABELS_ZOOM );
|
|
|
|
|
title.SetHorizAlign( (Actor::HorizAlign)LABELS_H_ALIGN );
|
2002-05-20 08:59:37 +00:00
|
|
|
title.SetVertAlign( Actor::align_middle );
|
2003-03-02 01:43:33 +00:00
|
|
|
title.EnableShadow( false );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
Sprite &bullet = row.m_sprBullet;
|
2003-04-12 17:39:27 +00:00
|
|
|
bullet.Load( THEME->GetPathToG("ScreenOptions bullet") );
|
2003-03-31 14:02:39 +00:00
|
|
|
bullet.SetXY( ARROWS_X, fY );
|
2003-09-04 20:22:06 +00:00
|
|
|
|
|
|
|
|
// set the Y position of each item in the line
|
2004-01-09 04:14:13 +00:00
|
|
|
for( unsigned c=0; c<row.m_textItems.size(); c++ )
|
|
|
|
|
row.m_textItems[c]->SetY( fY );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenOptions::PositionUnderlines()
|
|
|
|
|
{
|
|
|
|
|
// Set the position of the underscores showing the current choice for each option line.
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
|
|
|
|
|
{
|
2003-09-05 07:34:13 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
|
|
|
|
continue; // skip
|
|
|
|
|
|
2004-01-09 00:03:33 +00:00
|
|
|
for( unsigned i=0; i<m_Rows.size(); i++ ) // foreach options line
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[i];
|
|
|
|
|
if( row.Type == Row::ROW_EXIT )
|
2004-01-09 00:03:33 +00:00
|
|
|
continue;
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
OptionsCursor &underline = row.m_Underline[p];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-06-16 20:01:18 +00:00
|
|
|
/* Don't tween X movement and color changes. */
|
2003-06-16 03:29:59 +00:00
|
|
|
int iWidth, iX, iY;
|
|
|
|
|
GetWidthXY( (PlayerNumber)p, i, iWidth, iX, iY );
|
2003-06-16 20:01:18 +00:00
|
|
|
underline.SetGlobalX( (float)iX );
|
|
|
|
|
underline.SetGlobalDiffuseColor( RageColor(1,1,1, 1.0f) );
|
2003-06-16 03:29:59 +00:00
|
|
|
|
2003-02-01 01:11:00 +00:00
|
|
|
// If there's only one choice (ScreenOptionsMenu), don't show underlines.
|
|
|
|
|
// It looks silly.
|
2003-03-15 19:25:37 +00:00
|
|
|
bool bOnlyOneChoice = m_OptionRow[i].choices.size() == 1;
|
2004-01-09 04:14:13 +00:00
|
|
|
bool hidden = bOnlyOneChoice || row.m_bHidden;
|
2003-02-01 01:11:00 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
if( underline.GetDestY() != row.m_fY )
|
2003-06-16 20:01:18 +00:00
|
|
|
{
|
|
|
|
|
underline.StopTweening();
|
|
|
|
|
underline.BeginTweening( 0.3f );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* XXX: diffuse doesn't work since underline is an ActorFrame */
|
2003-06-16 03:29:59 +00:00
|
|
|
underline.SetDiffuse( RageColor(1,1,1,hidden? 0.0f:1.0f) );
|
2002-08-13 23:26:46 +00:00
|
|
|
underline.SetBarWidth( iWidth );
|
2003-06-16 03:29:59 +00:00
|
|
|
underline.SetY( (float)iY );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
void ScreenOptions::PositionIcons()
|
|
|
|
|
{
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
|
|
|
|
|
{
|
2003-09-05 07:34:13 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
|
|
|
|
continue;
|
|
|
|
|
|
2004-01-09 00:03:33 +00:00
|
|
|
for( unsigned i=0; i<m_Rows.size(); i++ ) // foreach options line
|
2002-09-03 06:33:08 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[i];
|
|
|
|
|
if( row.Type == Row::ROW_EXIT )
|
2004-01-09 00:03:33 +00:00
|
|
|
continue;
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
OptionIcon &icon = row.m_OptionIcons[p];
|
2002-09-03 06:33:08 +00:00
|
|
|
|
2003-03-31 14:02:39 +00:00
|
|
|
int iWidth, iX, iY; // We only use iY
|
2002-09-03 06:33:08 +00:00
|
|
|
GetWidthXY( (PlayerNumber)p, i, iWidth, iX, iY );
|
2003-06-16 03:29:59 +00:00
|
|
|
icon.SetX( ICONS_X(p) );
|
2003-06-16 20:01:18 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
if( icon.GetDestY() != row.m_fY )
|
2003-06-16 20:01:18 +00:00
|
|
|
{
|
|
|
|
|
icon.StopTweening();
|
|
|
|
|
icon.BeginTweening( 0.3f );
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-16 03:29:59 +00:00
|
|
|
icon.SetY( (float)iY );
|
2003-06-16 20:01:18 +00:00
|
|
|
/* XXX: this doesn't work since icon is an ActorFrame */
|
2004-01-09 04:14:13 +00:00
|
|
|
icon.SetDiffuse( RageColor(1,1,1, row.m_bHidden? 0.0f:1.0f) );
|
2002-09-03 06:33:08 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-03 22:31:06 +00:00
|
|
|
void ScreenOptions::RefreshIcons()
|
|
|
|
|
{
|
2003-11-07 07:25:52 +00:00
|
|
|
// handled by ScreenOptionsMaster
|
2002-09-03 22:31:06 +00:00
|
|
|
}
|
|
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenOptions::PositionCursors()
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
|
|
|
|
// Set the position of the highlight showing the current option the user is changing.
|
|
|
|
|
// Set the position of the underscores showing the current choice for each option line.
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
|
|
|
|
|
{
|
2003-09-05 07:34:13 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
|
|
|
|
continue;
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
const int row = m_iCurrentRow[p];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
OptionsCursor &highlight = m_Highlight[p];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
int iWidth, iX, iY;
|
2004-01-09 04:14:13 +00:00
|
|
|
GetWidthXY( (PlayerNumber)p, row, iWidth, iX, iY );
|
2002-08-13 23:26:46 +00:00
|
|
|
highlight.SetBarWidth( iWidth );
|
|
|
|
|
highlight.SetXY( (float)iX, (float)iY );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenOptions::TweenCursor( PlayerNumber player_no )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
|
|
|
|
// Set the position of the highlight showing the current option the user is changing.
|
2004-01-09 04:14:13 +00:00
|
|
|
const int iCurRow = m_iCurrentRow[player_no];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
OptionsCursor &highlight = m_Highlight[player_no];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
int iWidth, iX, iY;
|
|
|
|
|
GetWidthXY( player_no, iCurRow, iWidth, iX, iY );
|
2003-03-31 14:02:39 +00:00
|
|
|
|
2002-09-02 21:59:58 +00:00
|
|
|
highlight.StopTweening();
|
2002-05-20 08:59:37 +00:00
|
|
|
highlight.BeginTweening( 0.2f );
|
2002-08-13 23:26:46 +00:00
|
|
|
highlight.TweenBarWidth( iWidth );
|
2003-04-12 06:16:12 +00:00
|
|
|
highlight.SetXY( (float)iX, (float)iY );
|
2003-12-19 22:10:06 +00:00
|
|
|
|
|
|
|
|
m_sprLineHighlight[player_no].SetY( (float)iY );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2003-08-28 07:38:09 +00:00
|
|
|
void ScreenOptions::UpdateText( PlayerNumber player_no, int iRow )
|
2003-03-31 14:02:39 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[iRow];
|
2003-03-31 14:02:39 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
if( !row.m_bRowIsLong )
|
2003-09-04 20:22:06 +00:00
|
|
|
return;
|
2003-08-28 07:38:09 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
int iChoiceInRow = m_iSelectedOption[player_no][iRow];
|
|
|
|
|
|
|
|
|
|
const OptionRow &optrow = m_OptionRow[iRow];
|
2003-03-31 14:02:39 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
unsigned item_no = optrow.bOneChoiceForAllPlayers?0:player_no;
|
2003-09-18 19:07:10 +00:00
|
|
|
|
|
|
|
|
/* If player_no is 2 and there is no player 1: */
|
2004-01-09 04:14:13 +00:00
|
|
|
item_no = min( item_no, m_Rows[iRow]->m_textItems.size()-1 );
|
2003-09-18 19:07:10 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
m_Rows[iRow]->m_textItems[item_no]->SetText( m_OptionRow[iRow].choices[iChoiceInRow] );
|
2003-03-31 14:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenOptions::UpdateEnabledDisabled()
|
|
|
|
|
{
|
2002-10-28 05:30:45 +00:00
|
|
|
RageColor colorSelected = COLOR_SELECTED;
|
|
|
|
|
RageColor colorNotSelected = COLOR_NOT_SELECTED;
|
2002-09-04 03:49:08 +00:00
|
|
|
|
|
|
|
|
// init text
|
2004-01-09 00:03:33 +00:00
|
|
|
for( unsigned i=0; i<m_Rows.size(); i++ ) // foreach line
|
2002-09-04 03:49:08 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[i];
|
|
|
|
|
|
|
|
|
|
if( row.Type == Row::ROW_EXIT )
|
2004-01-09 00:03:33 +00:00
|
|
|
{
|
|
|
|
|
bool bExitRowIsSelectedByBoth = true;
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] != (int) i )
|
|
|
|
|
bExitRowIsSelectedByBoth = false;
|
|
|
|
|
|
|
|
|
|
RageColor color = bExitRowIsSelectedByBoth ? colorSelected : colorNotSelected;
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_textItems[0]->SetGlobalDiffuseColor( color );
|
2004-01-09 00:03:33 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
if( row.m_textItems[0]->GetDestY() != row.m_fY )
|
2004-01-09 00:03:33 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_textItems[0]->StopTweening();
|
|
|
|
|
row.m_textItems[0]->BeginTweening( 0.3f );
|
|
|
|
|
row.m_textItems[0]->SetDiffuseAlpha( row.m_bHidden? 0.0f:1.0f );
|
|
|
|
|
row.m_textItems[0]->SetY( row.m_fY );
|
2004-01-09 00:03:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( bExitRowIsSelectedByBoth )
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_textItems[0]->SetEffectDiffuseShift( 1.0f, colorSelected, colorNotSelected );
|
2004-01-09 00:03:33 +00:00
|
|
|
else
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_textItems[0]->SetEffectNone();
|
2004-01-09 00:03:33 +00:00
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
bool bThisRowIsSelected = false;
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2004-01-09 00:03:33 +00:00
|
|
|
if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] == (int) i )
|
2002-09-04 03:49:08 +00:00
|
|
|
bThisRowIsSelected = true;
|
|
|
|
|
|
2003-06-16 20:01:18 +00:00
|
|
|
/* Don't tween selection colors at all. */
|
2003-06-16 03:29:59 +00:00
|
|
|
RageColor color = bThisRowIsSelected ? colorSelected : colorNotSelected;
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_sprBullet.SetGlobalDiffuseColor( color );
|
|
|
|
|
row.m_textTitle.SetGlobalDiffuseColor( color );
|
2002-09-04 03:49:08 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
for( unsigned j=0; j<row.m_textItems.size(); j++ )
|
|
|
|
|
row.m_textItems[j]->SetGlobalDiffuseColor( color );
|
2003-06-16 20:01:18 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
if( row.m_sprBullet.GetDestY() != row.m_fY )
|
2003-06-16 20:01:18 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_sprBullet.StopTweening();
|
|
|
|
|
row.m_textTitle.StopTweening();
|
|
|
|
|
row.m_sprBullet.BeginTweening( 0.3f );
|
|
|
|
|
row.m_textTitle.BeginTweening( 0.3f );
|
2003-06-16 20:01:18 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_sprBullet.SetDiffuseAlpha( row.m_bHidden? 0.0f:1.0f );
|
|
|
|
|
row.m_textTitle.SetDiffuseAlpha( row.m_bHidden? 0.0f:1.0f );
|
2003-05-21 01:58:47 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_sprBullet.SetY( row.m_fY );
|
|
|
|
|
row.m_textTitle.SetY( row.m_fY );
|
2003-06-16 20:01:18 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
for( unsigned j=0; j<row.m_textItems.size(); j++ )
|
2003-09-04 20:22:06 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_textItems[j]->StopTweening();
|
|
|
|
|
row.m_textItems[j]->BeginTweening( 0.3f );
|
|
|
|
|
row.m_textItems[j]->SetDiffuseAlpha( row.m_bHidden? 0.0f:1.0f );
|
|
|
|
|
row.m_textItems[j]->SetY( row.m_fY );
|
2003-09-04 20:22:06 +00:00
|
|
|
}
|
2003-06-16 20:01:18 +00:00
|
|
|
}
|
2002-09-04 03:49:08 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
void ScreenOptions::Update( float fDeltaTime )
|
|
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
//LOG->Trace( "ScreenOptions::Update(%f)", fDeltaTime );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
Screen::Update( fDeltaTime );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenOptions::DrawPrimitives()
|
|
|
|
|
{
|
|
|
|
|
m_Menu.DrawBottomLayer();
|
|
|
|
|
Screen::DrawPrimitives();
|
|
|
|
|
m_Menu.DrawTopLayer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenOptions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
|
|
|
|
{
|
2003-03-22 19:58:44 +00:00
|
|
|
/* Allow input when transitioning in (m_In.IsTransitioning()), but ignore it
|
|
|
|
|
* when we're transitioning out. */
|
|
|
|
|
if( m_Menu.m_Back.IsTransitioning() || m_Menu.m_Out.IsTransitioning() )
|
2002-05-20 08:59:37 +00:00
|
|
|
return;
|
|
|
|
|
|
2003-11-25 21:53:56 +00:00
|
|
|
if( type == IET_RELEASE )
|
|
|
|
|
{
|
|
|
|
|
switch( MenuI.button )
|
|
|
|
|
{
|
|
|
|
|
case MENU_BUTTON_START:
|
|
|
|
|
case MENU_BUTTON_RIGHT:
|
|
|
|
|
case MENU_BUTTON_LEFT:
|
|
|
|
|
INPUTMAPPER->ResetKeyRepeat( MenuInput(MenuI.player, MENU_BUTTON_START) );
|
|
|
|
|
INPUTMAPPER->ResetKeyRepeat( MenuInput(MenuI.player, MENU_BUTTON_RIGHT) );
|
|
|
|
|
INPUTMAPPER->ResetKeyRepeat( MenuInput(MenuI.player, MENU_BUTTON_LEFT) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-29 08:16:24 +00:00
|
|
|
// if we are in dedicated menubutton input and arcade navigation
|
|
|
|
|
// check to see if MENU_BUTTON_LEFT and MENU_BUTTON_RIGHT are being held
|
2003-11-25 19:46:32 +00:00
|
|
|
const bool bHoldingLeftOrRight = MenuI.IsValid() && MenuI.button == MENU_BUTTON_START &&
|
2004-01-09 05:50:15 +00:00
|
|
|
m_OptionsNavigation == NAV_THREE_KEY &&
|
2003-10-17 08:03:46 +00:00
|
|
|
(INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_RIGHT) ) ||
|
|
|
|
|
INPUTMAPPER->IsButtonDown( MenuInput(MenuI.player, MENU_BUTTON_LEFT) ) );
|
|
|
|
|
|
2003-11-25 21:53:56 +00:00
|
|
|
if( type != IET_RELEASE && bHoldingLeftOrRight )
|
2003-08-29 08:16:24 +00:00
|
|
|
{
|
2003-11-25 21:53:56 +00:00
|
|
|
Move( MenuI.player, -1, type != IET_FIRST_PRESS );
|
2003-08-29 08:16:24 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
// default input handler
|
|
|
|
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
2002-07-02 00:27:58 +00:00
|
|
|
case SM_MenuTimer:
|
2004-01-09 04:14:13 +00:00
|
|
|
StartGoToNextState();
|
2002-07-02 00:27:58 +00:00
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToPrevScreen:
|
2003-03-09 00:55:49 +00:00
|
|
|
// this->ExportOptions(); // Don't save options if we're going back!
|
2002-05-20 08:59:37 +00:00
|
|
|
this->GoToPrevState();
|
|
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToNextScreen:
|
2002-05-20 08:59:37 +00:00
|
|
|
this->ExportOptions();
|
|
|
|
|
this->GoToNextState();
|
|
|
|
|
break;
|
2003-03-11 08:52:45 +00:00
|
|
|
case SM_BeginFadingOut:
|
2003-03-30 21:42:10 +00:00
|
|
|
if(m_Menu.IsTransitioning())
|
|
|
|
|
return; /* already transitioning */
|
2003-03-09 00:55:49 +00:00
|
|
|
m_Menu.StartTransitioning( SM_GoToNextScreen );
|
2002-09-04 03:49:08 +00:00
|
|
|
|
|
|
|
|
m_SoundStart.Play();
|
|
|
|
|
|
2003-12-31 22:32:46 +00:00
|
|
|
m_framePage.Command( FRAME_OFF_COMMAND );
|
2002-09-04 03:49:08 +00:00
|
|
|
break;
|
2003-11-25 22:03:01 +00:00
|
|
|
case SM_GainFocus:
|
|
|
|
|
INPUTFILTER->SetRepeatRate( 0.25f, 12, 0.25f, 12 );
|
|
|
|
|
break;
|
|
|
|
|
case SM_LoseFocus:
|
|
|
|
|
INPUTFILTER->ResetRepeatRate();
|
|
|
|
|
break;
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-06-16 03:29:59 +00:00
|
|
|
void ScreenOptions::PositionItems()
|
|
|
|
|
{
|
2003-07-20 22:21:00 +00:00
|
|
|
const int total = NUM_SHOWN_ITEMS;
|
|
|
|
|
const int halfsize = total / 2;
|
|
|
|
|
|
2003-06-18 04:11:33 +00:00
|
|
|
int first_start, first_end, second_start, second_end;
|
|
|
|
|
|
2003-06-16 03:42:48 +00:00
|
|
|
/* Choices for each player. If only one player is active, it's the same for both. */
|
|
|
|
|
const int P1Choice = GAMESTATE->IsHumanPlayer(PLAYER_1)? m_iCurrentRow[PLAYER_1]: m_iCurrentRow[PLAYER_2];
|
|
|
|
|
const int P2Choice = GAMESTATE->IsHumanPlayer(PLAYER_2)? m_iCurrentRow[PLAYER_2]: m_iCurrentRow[PLAYER_1];
|
2003-06-16 03:29:59 +00:00
|
|
|
|
2003-06-18 04:11:33 +00:00
|
|
|
const bool BothPlayersActivated = GAMESTATE->IsHumanPlayer(PLAYER_1) && GAMESTATE->IsHumanPlayer(PLAYER_2);
|
2003-08-23 22:04:57 +00:00
|
|
|
if( m_InputMode == INPUTMODE_TOGETHER || !BothPlayersActivated )
|
2003-06-18 04:11:33 +00:00
|
|
|
{
|
|
|
|
|
/* Simply center the cursor. */
|
|
|
|
|
first_start = max( P1Choice - halfsize, 0 );
|
|
|
|
|
first_end = first_start + total;
|
|
|
|
|
second_start = second_end = first_end;
|
|
|
|
|
} else {
|
|
|
|
|
/* First half: */
|
|
|
|
|
const int earliest = min( P1Choice, P2Choice );
|
|
|
|
|
first_start = max( earliest - halfsize/2, 0 );
|
|
|
|
|
first_end = first_start + halfsize;
|
|
|
|
|
|
|
|
|
|
/* Second half: */
|
|
|
|
|
const int latest = max( P1Choice, P2Choice );
|
2003-06-16 03:29:59 +00:00
|
|
|
|
2003-06-18 04:11:33 +00:00
|
|
|
second_start = max( latest - halfsize/2, 0 );
|
2003-06-16 03:29:59 +00:00
|
|
|
|
2003-06-18 04:11:33 +00:00
|
|
|
/* Don't overlap. */
|
|
|
|
|
second_start = max( second_start, first_end );
|
2003-06-16 03:29:59 +00:00
|
|
|
|
2003-06-18 04:11:33 +00:00
|
|
|
second_end = second_start + halfsize;
|
2003-06-16 03:29:59 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-09 00:03:33 +00:00
|
|
|
first_end = min( first_end, (int) m_Rows.size() );
|
|
|
|
|
second_end = min( second_end, (int) m_Rows.size() );
|
2003-06-18 04:11:33 +00:00
|
|
|
|
2004-01-09 00:03:33 +00:00
|
|
|
/* If less than total (and m_Rows.size()) are displayed, fill in the empty
|
2003-06-18 04:11:33 +00:00
|
|
|
* space intelligently. */
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
const int sum = (first_end - first_start) + (second_end - second_start);
|
2004-01-09 00:03:33 +00:00
|
|
|
if( sum >= (int) m_Rows.size() || sum >= total)
|
2003-06-18 04:11:33 +00:00
|
|
|
break; /* nothing more to display, or no room */
|
|
|
|
|
|
|
|
|
|
/* First priority: expand the top of the second half until it meets
|
|
|
|
|
* the first half. */
|
|
|
|
|
if( second_start > first_end )
|
|
|
|
|
second_start--;
|
|
|
|
|
/* Otherwise, expand either end. */
|
|
|
|
|
else if( first_start > 0 )
|
|
|
|
|
first_start--;
|
2004-01-09 00:03:33 +00:00
|
|
|
else if( second_end < (int) m_Rows.size() )
|
2003-06-18 04:11:33 +00:00
|
|
|
second_end++;
|
|
|
|
|
else
|
|
|
|
|
ASSERT(0); /* do we have room to grow or don't we? */
|
|
|
|
|
}
|
2003-06-16 03:29:59 +00:00
|
|
|
|
2003-06-18 04:11:33 +00:00
|
|
|
int pos = 0;
|
2004-01-09 04:14:13 +00:00
|
|
|
for( int i=0; i<(int) m_Rows.size(); i++ ) // foreach row
|
2003-06-16 03:29:59 +00:00
|
|
|
{
|
|
|
|
|
float ItemPosition;
|
|
|
|
|
if( i < first_start )
|
|
|
|
|
ItemPosition = -0.5f;
|
2003-06-18 04:11:33 +00:00
|
|
|
else if( i < first_end )
|
|
|
|
|
ItemPosition = (float) pos++;
|
2003-06-16 03:29:59 +00:00
|
|
|
else if( i < second_start )
|
2003-06-18 00:26:34 +00:00
|
|
|
ItemPosition = halfsize - 0.5f;
|
2003-06-18 04:11:33 +00:00
|
|
|
else if( i < second_end )
|
|
|
|
|
ItemPosition = (float) pos++;
|
2003-06-16 03:29:59 +00:00
|
|
|
else
|
|
|
|
|
ItemPosition = (float) total - 0.5f;
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
Row &row = *m_Rows[i];
|
|
|
|
|
|
2003-06-16 03:29:59 +00:00
|
|
|
float fY = ITEMS_START_Y + ITEMS_SPACING_Y*ItemPosition;
|
2004-01-09 04:14:13 +00:00
|
|
|
row.m_fY = fY;
|
|
|
|
|
row.m_bHidden = i < first_start ||
|
2003-06-18 04:11:33 +00:00
|
|
|
(i >= first_end && i < second_start) ||
|
|
|
|
|
i >= second_end;
|
2003-06-16 03:29:59 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-11-06 09:54:40 +00:00
|
|
|
void ScreenOptions::OnChange( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-11-06 09:54:40 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(pn) )
|
|
|
|
|
return;
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
/* Update m_fY and m_bHidden[]. */
|
2003-06-16 03:29:59 +00:00
|
|
|
PositionItems();
|
|
|
|
|
|
|
|
|
|
/* Do positioning. */
|
2002-05-20 08:59:37 +00:00
|
|
|
PositionUnderlines();
|
2002-09-03 22:31:06 +00:00
|
|
|
RefreshIcons();
|
2003-06-16 03:29:59 +00:00
|
|
|
PositionIcons();
|
2002-09-04 03:49:08 +00:00
|
|
|
UpdateEnabledDisabled();
|
2002-09-10 21:16:34 +00:00
|
|
|
|
2003-12-18 00:17:04 +00:00
|
|
|
if( SHOW_SCROLL_BAR )
|
2004-01-09 00:03:33 +00:00
|
|
|
{
|
|
|
|
|
float fPercent = 0;
|
|
|
|
|
if( m_Rows.size() > 1 )
|
|
|
|
|
fPercent = m_iCurrentRow[pn] / float(m_Rows.size()-1);
|
|
|
|
|
m_ScrollBar.SetPercentage( pn, fPercent );
|
|
|
|
|
}
|
2003-12-18 00:17:04 +00:00
|
|
|
|
2003-11-06 21:45:44 +00:00
|
|
|
/* Update all players, since changing one player can move both cursors. */
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
TweenCursor( (PlayerNumber) p );
|
2003-11-05 07:46:20 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
const int iCurRow = m_iCurrentRow[pn];
|
|
|
|
|
const CString text = GetExplanationText( iCurRow );
|
2003-12-05 20:08:43 +00:00
|
|
|
|
2003-11-06 09:54:40 +00:00
|
|
|
BitmapText *pText = NULL;
|
|
|
|
|
switch( m_InputMode )
|
|
|
|
|
{
|
|
|
|
|
case INPUTMODE_INDIVIDUAL:
|
|
|
|
|
pText = &m_textExplanation[pn];
|
2003-12-05 20:08:43 +00:00
|
|
|
if( pText->GetText() != text )
|
|
|
|
|
{
|
|
|
|
|
pText->FinishTweening();
|
|
|
|
|
pText->Command( EXPLANATION_ON_COMMAND(pn) );
|
|
|
|
|
pText->SetText( text );
|
|
|
|
|
}
|
2003-11-06 09:54:40 +00:00
|
|
|
break;
|
|
|
|
|
case INPUTMODE_TOGETHER:
|
2003-11-06 21:45:44 +00:00
|
|
|
pText = &m_textExplanation[0];
|
2003-12-05 20:08:43 +00:00
|
|
|
if( pText->GetText() != text )
|
|
|
|
|
{
|
|
|
|
|
pText->FinishTweening();
|
|
|
|
|
pText->Command( EXPLANATION_TOGETHER_ON_COMMAND );
|
|
|
|
|
pText->SetText( text );
|
|
|
|
|
}
|
2003-11-06 09:54:40 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenOptions::MenuBack( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
Screen::MenuBack( pn );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
m_Menu.Back( SM_GoToPrevScreen );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2003-02-12 00:41:56 +00:00
|
|
|
void ScreenOptions::StartGoToNextState()
|
|
|
|
|
{
|
2003-03-25 21:17:29 +00:00
|
|
|
this->PostScreenMessage( SM_BeginFadingOut, 0 );
|
2003-02-12 00:41:56 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-11-25 21:53:56 +00:00
|
|
|
void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-03-12 03:44:55 +00:00
|
|
|
if( m_Menu.IsTransitioning() )
|
|
|
|
|
return;
|
2003-11-25 21:53:56 +00:00
|
|
|
if( type == IET_RELEASE )
|
|
|
|
|
return;
|
2003-03-12 03:44:55 +00:00
|
|
|
|
2004-01-09 05:50:15 +00:00
|
|
|
switch( m_OptionsNavigation )
|
|
|
|
|
{
|
|
|
|
|
case NAV_THREE_KEY:
|
2002-09-10 09:10:36 +00:00
|
|
|
{
|
|
|
|
|
bool bAllOnExit = true;
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2004-01-09 04:14:13 +00:00
|
|
|
if( GAMESTATE->IsHumanPlayer(p) && m_Rows[m_iCurrentRow[p]]->Type != Row::ROW_EXIT )
|
2002-09-10 09:10:36 +00:00
|
|
|
bAllOnExit = false;
|
2002-09-05 03:45:07 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
if( m_Rows[m_iCurrentRow[pn]]->Type != Row::ROW_EXIT ) // not on exit
|
2003-11-25 21:53:56 +00:00
|
|
|
MenuDown( pn, type ); // can't go down any more
|
|
|
|
|
else if( bAllOnExit && type == IET_FIRST_PRESS )
|
2004-01-09 04:14:13 +00:00
|
|
|
StartGoToNextState();
|
2002-09-10 09:10:36 +00:00
|
|
|
}
|
2004-01-09 05:50:15 +00:00
|
|
|
case NAV_THREE_KEY_MENU:
|
|
|
|
|
case NAV_FIVE_KEY:
|
|
|
|
|
if( type == IET_FIRST_PRESS ) // m_SMOptionsNavigation
|
|
|
|
|
StartGoToNextState();
|
2002-09-10 09:10:36 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-01-09 04:43:27 +00:00
|
|
|
/* Left/right */
|
2003-11-25 21:53:56 +00:00
|
|
|
void ScreenOptions::ChangeValue( PlayerNumber pn, int iDelta, bool Repeat )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2004-01-09 04:14:13 +00:00
|
|
|
const int iCurRow = m_iCurrentRow[pn];
|
|
|
|
|
Row &row = *m_Rows[iCurRow];
|
|
|
|
|
OptionRow &optrow = m_OptionRow[iCurRow];
|
2003-10-03 04:18:17 +00:00
|
|
|
|
2004-01-09 05:50:15 +00:00
|
|
|
/* If START is being pressed, and in NAV_THREE_KEY, then we're holding left/right
|
2004-01-09 04:43:27 +00:00
|
|
|
* and start to move backwards. Don't move left and right, too. */
|
2004-01-09 05:50:15 +00:00
|
|
|
if( m_OptionsNavigation == NAV_THREE_KEY && INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_START) ) )
|
2004-01-09 04:43:27 +00:00
|
|
|
return;
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
const int iNumOptions = (row.Type == Row::ROW_EXIT)? 1: optrow.choices.size();
|
2004-01-09 05:50:15 +00:00
|
|
|
if( m_OptionsNavigation == NAV_THREE_KEY_MENU && iNumOptions <= 1 ) // 1 or 0
|
2003-10-17 08:03:46 +00:00
|
|
|
{
|
2004-01-09 04:43:27 +00:00
|
|
|
/* There are no other options on the row; move up or down instead of left and right.
|
|
|
|
|
* This allows navigating the options menu with left/right/start. */
|
|
|
|
|
Move( pn, iDelta, Repeat );
|
|
|
|
|
return;
|
2003-10-17 08:03:46 +00:00
|
|
|
}
|
2004-01-09 04:43:27 +00:00
|
|
|
|
2003-11-25 21:53:56 +00:00
|
|
|
if( Repeat )
|
|
|
|
|
return;
|
2003-10-17 08:03:46 +00:00
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
if( row.Type == Row::ROW_EXIT ) // EXIT is selected
|
2003-10-03 04:18:17 +00:00
|
|
|
return; // don't allow a move
|
|
|
|
|
|
2004-01-09 04:43:27 +00:00
|
|
|
bool bOneChanged = false;
|
2002-08-13 23:26:46 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2004-01-09 04:43:27 +00:00
|
|
|
if( p != pn )
|
2002-08-13 23:26:46 +00:00
|
|
|
continue; // skip
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-10-03 04:18:17 +00:00
|
|
|
int iNewSel = m_iSelectedOption[p][iCurRow] + iDelta;
|
|
|
|
|
wrap( iNewSel, iNumOptions );
|
|
|
|
|
|
2004-01-09 04:43:27 +00:00
|
|
|
if( iNewSel != m_iSelectedOption[p][iCurRow] )
|
|
|
|
|
bOneChanged = true;
|
|
|
|
|
|
2004-01-09 04:14:13 +00:00
|
|
|
if( optrow.bOneChoiceForAllPlayers )
|
2003-08-23 22:04:57 +00:00
|
|
|
{
|
|
|
|
|
for( int p2=0; p2<NUM_PLAYERS; p2++ )
|
2003-08-23 22:13:06 +00:00
|
|
|
{
|
2003-08-23 22:04:57 +00:00
|
|
|
m_iSelectedOption[p2][iCurRow] = iNewSel;
|
2003-08-23 22:13:06 +00:00
|
|
|
UpdateText( (PlayerNumber)p2, iCurRow );
|
|
|
|
|
}
|
2003-08-23 22:04:57 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_iSelectedOption[p][iCurRow] = iNewSel;
|
2003-08-23 22:13:06 +00:00
|
|
|
UpdateText( (PlayerNumber)p, iCurRow );
|
2003-08-23 22:04:57 +00:00
|
|
|
}
|
2003-11-07 05:17:41 +00:00
|
|
|
OnChange( (PlayerNumber)p );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
2004-01-09 04:43:27 +00:00
|
|
|
if( bOneChanged )
|
|
|
|
|
m_SoundChangeCol.Play();
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2003-08-23 22:04:57 +00:00
|
|
|
|
2004-01-09 04:43:27 +00:00
|
|
|
/* Up/down */
|
2003-11-25 21:53:56 +00:00
|
|
|
void ScreenOptions::Move( PlayerNumber pn, int dir, bool Repeat )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-11-25 21:53:56 +00:00
|
|
|
LOG->Trace("move pn %i, dir %i, rep %i", pn, dir, Repeat);
|
|
|
|
|
bool changed = false;
|
2002-08-13 23:26:46 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-11-25 21:53:56 +00:00
|
|
|
if( m_InputMode == INPUTMODE_INDIVIDUAL && p != pn )
|
2002-08-13 23:26:46 +00:00
|
|
|
continue; // skip
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-11-25 21:53:56 +00:00
|
|
|
int row = m_iCurrentRow[p] + dir;
|
2004-01-09 00:03:33 +00:00
|
|
|
if( Repeat && ( row == -1 || row == (int) m_Rows.size() ) )
|
2003-11-25 21:53:56 +00:00
|
|
|
continue; // don't wrap while repeating
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-01-09 00:03:33 +00:00
|
|
|
wrap( row, m_Rows.size() );
|
2003-11-25 21:53:56 +00:00
|
|
|
m_iCurrentRow[p] = row;
|
2002-08-22 08:08:16 +00:00
|
|
|
|
2003-11-07 05:17:41 +00:00
|
|
|
OnChange( (PlayerNumber)p );
|
2003-11-25 21:53:56 +00:00
|
|
|
changed = true;
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
2003-11-25 21:53:56 +00:00
|
|
|
if( changed )
|
|
|
|
|
m_SoundNextRow.Play();
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
2004-01-09 04:14:13 +00:00
|
|
|
|
|
|
|
|
int ScreenOptions::GetCurrentRow( PlayerNumber pn ) const
|
|
|
|
|
{
|
|
|
|
|
const int l = m_iCurrentRow[pn];
|
|
|
|
|
if( m_Rows[l]->Type != Row::ROW_NORMAL )
|
|
|
|
|
return -1;
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenOptions::Row::Row()
|
|
|
|
|
{
|
|
|
|
|
m_bRowIsLong = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenOptions::Row::~Row()
|
|
|
|
|
{
|
|
|
|
|
for( unsigned i = 0; i < m_textItems.size(); ++i )
|
|
|
|
|
delete m_textItems[i];
|
|
|
|
|
}
|