2002-05-20 08:59:37 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
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
|
2002-05-20 08:59:37 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ScreenOptions.h"
|
|
|
|
|
#include "RageTextureManager.h"
|
|
|
|
|
#include "RageUtil.h"
|
2003-01-02 07:54:28 +00:00
|
|
|
#include "RageSoundManager.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#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"
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
#define ICONS_X( p ) THEME->GetMetricF("ScreenOptions",ssprintf("IconsP%dX",p+1))
|
2002-09-04 03:49:08 +00:00
|
|
|
#define ARROWS_X THEME->GetMetricF("ScreenOptions","ArrowsX")
|
2002-09-03 06:33:08 +00:00
|
|
|
#define LABELS_X THEME->GetMetricF("ScreenOptions","LabelsX")
|
2002-09-04 03:49:08 +00:00
|
|
|
#define LABELS_ZOOM THEME->GetMetricF("ScreenOptions","LabelsZoom")
|
|
|
|
|
#define LABELS_H_ALIGN THEME->GetMetricI("ScreenOptions","LabelsHAlign")
|
|
|
|
|
#define ITEMS_ZOOM THEME->GetMetricF("ScreenOptions","ItemsZoom")
|
2002-09-03 06:33:08 +00:00
|
|
|
#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")
|
2002-09-10 21:16:34 +00:00
|
|
|
#define EXPLANATION_X THEME->GetMetricF("ScreenOptions","ExplanationX")
|
|
|
|
|
#define EXPLANATION_Y THEME->GetMetricF("ScreenOptions","ExplanationY")
|
|
|
|
|
#define EXPLANATION_ZOOM THEME->GetMetricF("ScreenOptions","ExplanationZoom")
|
2002-08-27 16:53:25 +00:00
|
|
|
#define HELP_TEXT THEME->GetMetric("ScreenOptions","HelpText")
|
|
|
|
|
#define TIMER_SECONDS THEME->GetMetricI("ScreenOptions","TimerSeconds")
|
2002-09-04 03:49:08 +00:00
|
|
|
#define COLOR_SELECTED THEME->GetMetricC("ScreenOptions","ColorSelected")
|
|
|
|
|
#define COLOR_NOT_SELECTED THEME->GetMetricC("ScreenOptions","ColorNotSelected")
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
const ScreenMessage SM_PlaySample = ScreenMessage(SM_User-4);
|
2002-09-04 03:49:08 +00:00
|
|
|
const ScreenMessage SM_TweenOffScreen = ScreenMessage(SM_User-7);
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
ScreenOptions::ScreenOptions( CString sBackgroundPath, CString sPagePath, CString sTopEdgePath )
|
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
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
m_SoundChangeCol.Load( THEME->GetPathTo("Sounds","option change col") );
|
2002-09-04 03:49:08 +00:00
|
|
|
m_SoundNextRow.Load( THEME->GetPathTo("Sounds","option next row") );
|
|
|
|
|
m_SoundPrevRow.Load( THEME->GetPathTo("Sounds","option prev row") );
|
|
|
|
|
m_SoundStart.Load( THEME->GetPathTo("Sounds","menu start") );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
m_Menu.Load(
|
2002-05-27 18:36:01 +00:00
|
|
|
sBackgroundPath,
|
2002-05-20 08:59:37 +00:00
|
|
|
sTopEdgePath,
|
2002-09-03 22:31:06 +00:00
|
|
|
HELP_TEXT, false, true, TIMER_SECONDS
|
2002-05-20 08:59:37 +00:00
|
|
|
);
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_Menu );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
// 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
|
|
|
|
|
|
|
|
m_sprPage.Load( sPagePath );
|
|
|
|
|
m_sprPage.SetXY( CENTER_X, CENTER_Y );
|
2002-09-02 21:59:58 +00:00
|
|
|
m_framePage.AddChild( &m_sprPage );
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
m_Menu.TweenOnScreenFromBlack( SM_None );
|
2002-05-20 08:59:37 +00:00
|
|
|
m_Wipe.OpenWipingRight(SM_None);
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_Wipe );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
|
|
|
|
m_framePage.SetX( SCREEN_LEFT-SCREEN_WIDTH );
|
|
|
|
|
m_framePage.BeginTweening( 0.3f, Actor::TWEEN_BIAS_BEGIN );
|
|
|
|
|
m_framePage.SetTweenX( 0 );
|
2003-02-14 06:46:19 +00:00
|
|
|
memset(&m_OptionDim, 0, sizeof(m_OptionDim));
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenOptions::Init( InputMode im, OptionRowData OptionRowData[], int iNumOptionLines, bool bUseIcons )
|
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;
|
2002-09-04 03:49:08 +00:00
|
|
|
m_OptionRowData = OptionRowData;
|
|
|
|
|
m_iNumOptionRows = iNumOptionLines;
|
2002-09-03 22:31:06 +00:00
|
|
|
m_bUseIcons = bUseIcons;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
this->ImportOptions();
|
2002-08-13 23:26:46 +00:00
|
|
|
if( m_InputMode == INPUTMODE_BOTH )
|
|
|
|
|
{
|
2002-11-16 20:21:00 +00:00
|
|
|
for( unsigned l=0; l<MAX_OPTION_LINES; l++ )
|
2002-08-13 23:26:46 +00:00
|
|
|
m_iSelectedOption[PLAYER_2][l] = m_iSelectedOption[PLAYER_1][l];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// init highlights and underlines
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
|
|
|
|
if( !GAMESTATE->IsPlayerEnabled(p) )
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
m_Underline[p][l].Load( (PlayerNumber)p, true );
|
2002-09-02 21:59:58 +00:00
|
|
|
m_framePage.AddChild( &m_Underline[p][l] );
|
2002-09-03 06:33:08 +00:00
|
|
|
|
2002-09-03 22:31:06 +00:00
|
|
|
m_OptionIcons[p][l].Load( (PlayerNumber)p, "", false );
|
2002-09-03 06:33:08 +00:00
|
|
|
m_framePage.AddChild( &m_OptionIcons[p][l] );
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_Highlight[p].Load( (PlayerNumber)p, false );
|
2002-09-02 21:59:58 +00:00
|
|
|
m_framePage.AddChild( &m_Highlight[p] );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// init text
|
2002-11-16 20:21:00 +00:00
|
|
|
int i;
|
2002-11-16 20:30:51 +00:00
|
|
|
for( i=0; i<m_iNumOptionRows; i++ ) // foreach line
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
m_framePage.AddChild( &m_sprLineArrows[i] );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
m_framePage.AddChild( &m_textOptionLineTitles[i] );
|
|
|
|
|
|
2002-10-31 03:25:35 +00:00
|
|
|
for( unsigned j=0; j<m_OptionRowData[i].iNumOptions; j++ )
|
2002-09-02 21:59:58 +00:00
|
|
|
m_framePage.AddChild( &m_textOptions[i][j] ); // this array has to be big enough to hold all of the options
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
// TRICKY: Add one more item. This will be "EXIT"
|
|
|
|
|
m_framePage.AddChild( &m_textOptions[i][0] );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2002-09-10 21:16:34 +00:00
|
|
|
// add explanation here so it appears on top
|
2002-09-10 23:42:41 +00:00
|
|
|
m_textExplanation.LoadFromFont( THEME->GetPathTo("Fonts","option explanation") );
|
2002-09-10 21:16:34 +00:00
|
|
|
m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y );
|
|
|
|
|
m_textExplanation.SetZoom( EXPLANATION_ZOOM );
|
|
|
|
|
m_textExplanation.SetShadowLength( 2 );
|
|
|
|
|
m_framePage.AddChild( &m_textExplanation );
|
|
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
InitOptionsText();
|
|
|
|
|
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();
|
2002-09-10 21:16:34 +00:00
|
|
|
OnChange();
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenOptions::~ScreenOptions()
|
|
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenOptions::~ScreenOptions()" );
|
2002-05-20 08:59:37 +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
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
int iOptionInRow = m_iSelectedOption[pn][iRow];
|
2002-05-20 08:59:37 +00:00
|
|
|
BitmapText &option = m_textOptions[iRow][iOptionInRow];
|
|
|
|
|
|
2002-09-10 23:42:41 +00:00
|
|
|
iWidthOut = int(roundf( option.GetWidestLineWidthInSourcePixels() * option.GetZoomX() ));
|
|
|
|
|
iXOut = int(roundf( option.GetX() ));
|
|
|
|
|
iYOut = int(roundf( option.GetY() ));
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenOptions::InitOptionsText()
|
|
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
const float fLineGap = ITEMS_SPACING_Y - max(0, (m_iNumOptionRows-10)*2);
|
2002-07-11 19:02:26 +00:00
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
// init m_textOptions from optionLines
|
2002-11-16 20:21:00 +00:00
|
|
|
int i;
|
|
|
|
|
for( i=0; i<m_iNumOptionRows; i++ ) // foreach options line
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
OptionRowData &optline = m_OptionRowData[i];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
float fY = ITEMS_START_Y + fLineGap*i;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
BitmapText &title = m_textOptionLineTitles[i];
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
title.LoadFromFont( THEME->GetPathTo("Fonts","option title") );
|
2002-09-03 06:33:08 +00:00
|
|
|
CString sText = optline.szTitle;
|
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 );
|
2002-08-27 16:53:25 +00:00
|
|
|
title.TurnShadowOff();
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
|
|
|
|
|
Sprite &arrow = m_sprLineArrows[i];
|
|
|
|
|
arrow.Load( THEME->GetPathTo("Graphics","options arrow") );
|
|
|
|
|
arrow.SetXY( ARROWS_X, fY );
|
|
|
|
|
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
// init all text in this line and count the width of the line
|
2002-07-31 22:37:58 +00:00
|
|
|
float fX = ITEMS_START_X; // indent 70 pixels
|
2002-10-31 03:25:35 +00:00
|
|
|
for( unsigned j=0; j<optline.iNumOptions; j++ ) // for each option on this line
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
|
|
|
|
BitmapText &option = m_textOptions[i][j];
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
option.LoadFromFont( THEME->GetPathTo("Fonts","option item") );
|
2002-05-20 08:59:37 +00:00
|
|
|
option.SetText( optline.szOptionsText[j] );
|
2002-09-04 03:49:08 +00:00
|
|
|
option.SetZoom( ITEMS_ZOOM );
|
2002-05-20 08:59:37 +00:00
|
|
|
option.SetShadowLength( 2 );
|
|
|
|
|
|
|
|
|
|
// set the XY position of each item in the line
|
|
|
|
|
float fItemWidth = option.GetWidestLineWidthInSourcePixels() * option.GetZoomX();
|
|
|
|
|
fX += fItemWidth/2;
|
|
|
|
|
option.SetXY( fX, fY );
|
2002-09-03 06:33:08 +00:00
|
|
|
fX += fItemWidth/2 + ITEMS_GAP_X;
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
2002-09-04 03:49:08 +00:00
|
|
|
|
|
|
|
|
BitmapText &option = m_textOptions[i][0];
|
|
|
|
|
option.LoadFromFont( THEME->GetPathTo("Fonts","option item") );
|
|
|
|
|
option.SetText( "EXIT" );
|
|
|
|
|
option.SetZoom( ITEMS_ZOOM );
|
|
|
|
|
option.SetShadowLength( 2 );
|
|
|
|
|
float fY = ITEMS_START_Y + fLineGap*i;
|
|
|
|
|
option.SetXY( CENTER_X, fY );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-21 22:23:01 +00:00
|
|
|
void ScreenOptions::DimOption(int line, int option, bool dim)
|
|
|
|
|
{
|
|
|
|
|
if(m_OptionDim[line][option] == dim)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_OptionDim[line][option] = dim;
|
|
|
|
|
m_textOptions[line][option].StopTweening();
|
|
|
|
|
m_textOptions[line][option].BeginTweening(.250);
|
|
|
|
|
if(m_OptionDim[line][option])
|
|
|
|
|
m_textOptions[line][option].SetTweenDiffuse( RageColor(.5,.5,.5,1) );
|
|
|
|
|
else
|
|
|
|
|
m_textOptions[line][option].SetTweenDiffuse( RageColor(1,1,1,1) );
|
|
|
|
|
|
|
|
|
|
/* Don't know if I like this ...-glenn
|
|
|
|
|
m_textOptionLineTitles[line].BeginTweening(.250);
|
|
|
|
|
if(RowCompletelyDimmed(line))
|
|
|
|
|
m_textOptionLineTitles[line].SetTweenZoom( 0.6f );
|
|
|
|
|
else
|
|
|
|
|
m_textOptionLineTitles[line].SetTweenZoom( 0.7f );
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ScreenOptions::RowCompletelyDimmed(int line) const
|
|
|
|
|
{
|
|
|
|
|
for(unsigned i = 0; i < m_OptionRowData[line].iNumOptions; ++i)
|
|
|
|
|
if(!m_OptionDim[line][i]) return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
for( int i=0; i<m_iNumOptionRows; i++ ) // foreach options line
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
// Quad &underline = m_OptionUnderline[p][i];
|
|
|
|
|
OptionsCursor &underline = m_Underline[p][i];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-02-01 01:11:00 +00:00
|
|
|
// If there's only one choice (ScreenOptionsMenu), don't show underlines.
|
|
|
|
|
// It looks silly.
|
|
|
|
|
bool bOnlyOneChoice = m_OptionRowData[i].iNumOptions == 1;
|
|
|
|
|
underline.SetDiffuse( bOnlyOneChoice ? RageColor(1,1,1,0) : RageColor(1,1,1,1) );
|
|
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
int iWidth, iX, iY;
|
|
|
|
|
GetWidthXY( (PlayerNumber)p, i, iWidth, iX, iY );
|
|
|
|
|
underline.SetBarWidth( iWidth );
|
|
|
|
|
underline.SetXY( (float)iX, (float)iY );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-09-03 06:33:08 +00:00
|
|
|
void ScreenOptions::PositionIcons()
|
|
|
|
|
{
|
|
|
|
|
// Set the position of the underscores showing the current choice for each option line.
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
|
|
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
for( int i=0; i<m_iNumOptionRows; i++ ) // foreach options line
|
2002-09-03 06:33:08 +00:00
|
|
|
{
|
|
|
|
|
OptionIcon &icon = m_OptionIcons[p][i];
|
|
|
|
|
|
|
|
|
|
int iWidth, iX, iY;
|
|
|
|
|
GetWidthXY( (PlayerNumber)p, i, iWidth, iX, iY );
|
|
|
|
|
icon.SetXY( ICONS_X(p), (float)iY );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-03 22:31:06 +00:00
|
|
|
void ScreenOptions::RefreshIcons()
|
|
|
|
|
{
|
|
|
|
|
// Set the position of the underscores showing the current choice for each option line.
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
|
|
|
|
|
{
|
2002-09-04 03:49:08 +00:00
|
|
|
for( int i=0; i<m_iNumOptionRows; i++ ) // foreach options line
|
2002-09-03 22:31:06 +00:00
|
|
|
{
|
|
|
|
|
OptionIcon &icon = m_OptionIcons[p][i];
|
|
|
|
|
|
|
|
|
|
int iSelection = m_iSelectedOption[p][i];
|
2002-09-04 03:49:08 +00:00
|
|
|
CString sSelection = m_OptionRowData[i].szOptionsText[iSelection];
|
|
|
|
|
if( sSelection == "ON" )
|
|
|
|
|
sSelection = m_OptionRowData[i].szTitle;
|
2002-09-03 22:31:06 +00:00
|
|
|
icon.Load( (PlayerNumber)p, m_bUseIcons ? sSelection : "", false );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
int i=m_iCurrentRow[p];
|
|
|
|
|
|
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;
|
|
|
|
|
GetWidthXY( (PlayerNumber)p, i, iWidth, iX, iY );
|
|
|
|
|
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.
|
|
|
|
|
int iCurRow = m_iCurrentRow[player_no];
|
|
|
|
|
|
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 );
|
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 );
|
|
|
|
|
highlight.SetTweenXY( (float)iX, (float)iY );
|
2002-05-20 08:59:37 +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
|
2002-11-16 20:21:00 +00:00
|
|
|
int i;
|
|
|
|
|
for( i=0; i<m_iNumOptionRows; i++ ) // foreach line
|
2002-09-04 03:49:08 +00:00
|
|
|
{
|
|
|
|
|
bool bThisRowIsSelected = false;
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
if( GAMESTATE->IsPlayerEnabled(p) && m_iCurrentRow[p] == i )
|
|
|
|
|
bThisRowIsSelected = true;
|
|
|
|
|
|
|
|
|
|
m_sprLineArrows[i].SetDiffuse( bThisRowIsSelected ? colorSelected : colorNotSelected );
|
|
|
|
|
|
|
|
|
|
m_textOptionLineTitles[i].SetDiffuse( bThisRowIsSelected ? colorSelected : colorNotSelected );
|
|
|
|
|
|
2002-10-31 03:25:35 +00:00
|
|
|
for( unsigned j=0; j<m_OptionRowData[i].iNumOptions; j++ )
|
2002-09-04 03:49:08 +00:00
|
|
|
m_textOptions[i][j].SetDiffuse( bThisRowIsSelected ? colorSelected : colorNotSelected );
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-10 21:16:34 +00:00
|
|
|
bool bThisRowIsSelectedByBoth = true;
|
2002-09-04 03:49:08 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2002-09-10 21:16:34 +00:00
|
|
|
if( GAMESTATE->IsPlayerEnabled(p) && m_iCurrentRow[p] != i )
|
|
|
|
|
bThisRowIsSelectedByBoth = false;
|
|
|
|
|
m_textOptions[i][0].SetDiffuse( bThisRowIsSelectedByBoth ? colorNotSelected : colorSelected );
|
|
|
|
|
if( bThisRowIsSelectedByBoth )
|
2002-09-04 03:49:08 +00:00
|
|
|
m_textOptions[i][0].SetEffectCamelion( 2.5, colorSelected, colorNotSelected );
|
|
|
|
|
else
|
|
|
|
|
m_textOptions[i][0].SetEffectNone();
|
|
|
|
|
}
|
|
|
|
|
|
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 )
|
|
|
|
|
{
|
|
|
|
|
if( m_Wipe.IsClosing() )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// 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:
|
2002-09-04 03:49:08 +00:00
|
|
|
this->SendScreenMessage( SM_TweenOffScreen, 0 );
|
2002-07-02 00:27:58 +00:00
|
|
|
break;
|
2002-08-27 23:31:41 +00:00
|
|
|
case SM_GoToPrevScreen:
|
2002-05-20 08:59:37 +00:00
|
|
|
this->ExportOptions();
|
|
|
|
|
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;
|
2002-09-04 03:49:08 +00:00
|
|
|
case SM_TweenOffScreen:
|
|
|
|
|
m_Menu.TweenOffScreenToBlack( SM_None, false );
|
|
|
|
|
|
|
|
|
|
m_SoundStart.Play();
|
|
|
|
|
m_Wipe.CloseWipingRight( SM_GoToNextScreen );
|
|
|
|
|
|
|
|
|
|
m_framePage.BeginTweening( 0.3f, Actor::TWEEN_BIAS_END );
|
|
|
|
|
m_framePage.SetTweenX( SCREEN_RIGHT );
|
|
|
|
|
break;
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenOptions::OnChange()
|
|
|
|
|
{
|
|
|
|
|
PositionUnderlines();
|
2002-09-03 22:31:06 +00:00
|
|
|
RefreshIcons();
|
2002-09-04 03:49:08 +00:00
|
|
|
UpdateEnabledDisabled();
|
2002-09-10 21:16:34 +00:00
|
|
|
|
|
|
|
|
int iCurRow = m_iCurrentRow[PLAYER_1];
|
|
|
|
|
if( iCurRow < m_iNumOptionRows )
|
|
|
|
|
m_textExplanation.SetText( m_OptionRowData[iCurRow].szExplanation );
|
|
|
|
|
else
|
|
|
|
|
m_textExplanation.SetText( "" );
|
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
|
|
|
|
2002-05-28 20:01:22 +00:00
|
|
|
m_Menu.TweenOffScreenToBlack( SM_None, true );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
m_Wipe.CloseWipingLeft( SM_GoToPrevScreen );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2003-02-12 00:41:56 +00:00
|
|
|
void ScreenOptions::StartGoToNextState()
|
|
|
|
|
{
|
|
|
|
|
this->SendScreenMessage( SM_TweenOffScreen, 0 );
|
|
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
void ScreenOptions::MenuStart( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-09-10 09:10:36 +00:00
|
|
|
if( PREFSMAN->m_bArcadeOptionsNavigation )
|
|
|
|
|
{
|
|
|
|
|
bool bAllOnExit = true;
|
|
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
if( GAMESTATE->IsPlayerEnabled(p) && m_iCurrentRow[p] != m_iNumOptionRows )
|
|
|
|
|
bAllOnExit = false;
|
2002-09-05 03:45:07 +00:00
|
|
|
|
2002-09-10 09:10:36 +00:00
|
|
|
if( m_iCurrentRow[pn] != m_iNumOptionRows ) // not on exit
|
|
|
|
|
MenuDown( pn ); // can't go down any more
|
|
|
|
|
else if( bAllOnExit )
|
|
|
|
|
this->SendScreenMessage( SM_TweenOffScreen, 0 );
|
|
|
|
|
}
|
|
|
|
|
else // !m_bArcadeOptionsNavigation
|
|
|
|
|
{
|
2002-09-05 03:45:07 +00:00
|
|
|
this->SendScreenMessage( SM_TweenOffScreen, 0 );
|
2002-09-10 09:10:36 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
void ScreenOptions::MenuLeft( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
if( m_InputMode == INPUTMODE_PLAYERS && p != pn )
|
|
|
|
|
continue; // skip
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
int iCurRow = m_iCurrentRow[p];
|
2002-08-22 07:35:58 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
if( iCurRow == m_iNumOptionRows ) // EXIT is selected
|
|
|
|
|
return; // don't allow a move
|
|
|
|
|
|
|
|
|
|
const int iNumOptions = m_OptionRowData[iCurRow].iNumOptions;
|
2003-02-01 01:11:00 +00:00
|
|
|
if( iNumOptions == 1 )
|
|
|
|
|
continue;
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
m_iSelectedOption[p][iCurRow] = (m_iSelectedOption[p][iCurRow]-1+iNumOptions) % iNumOptions;
|
2003-01-21 22:23:01 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
TweenCursor( (PlayerNumber)p );
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
2002-09-04 03:49:08 +00:00
|
|
|
m_SoundChangeCol.Play();
|
2002-05-20 08:59:37 +00:00
|
|
|
OnChange();
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
void ScreenOptions::MenuRight( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
if( m_InputMode == INPUTMODE_PLAYERS && p != pn )
|
|
|
|
|
continue; // skip
|
|
|
|
|
|
|
|
|
|
int iCurRow = m_iCurrentRow[p];
|
2002-09-04 03:49:08 +00:00
|
|
|
|
|
|
|
|
if( iCurRow == m_iNumOptionRows ) // EXIT is selected
|
|
|
|
|
return; // don't allow a move
|
|
|
|
|
|
|
|
|
|
const int iNumOptions = m_OptionRowData[iCurRow].iNumOptions;
|
2003-02-01 01:11:00 +00:00
|
|
|
if( iNumOptions == 1 )
|
|
|
|
|
continue;
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
m_iSelectedOption[p][iCurRow] = (m_iSelectedOption[p][iCurRow]+1) % iNumOptions;
|
2003-01-21 22:23:01 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
TweenCursor( (PlayerNumber)p );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
2002-09-04 03:49:08 +00:00
|
|
|
m_SoundChangeCol.Play();
|
2002-05-20 08:59:37 +00:00
|
|
|
OnChange();
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
void ScreenOptions::MenuUp( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
if( m_InputMode == INPUTMODE_PLAYERS && p != pn )
|
|
|
|
|
continue; // skip
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
if( m_iCurrentRow[p] == 0 ) // on first row
|
|
|
|
|
return; // can't go up any more
|
|
|
|
|
|
|
|
|
|
m_iCurrentRow[p]--;
|
2003-01-21 22:23:01 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
TweenCursor( (PlayerNumber)p );
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
2002-09-04 03:49:08 +00:00
|
|
|
m_SoundPrevRow.Play();
|
2002-05-20 08:59:37 +00:00
|
|
|
OnChange();
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-22 08:08:16 +00:00
|
|
|
|
2002-08-27 23:31:41 +00:00
|
|
|
void ScreenOptions::MenuDown( PlayerNumber pn )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-08-13 23:26:46 +00:00
|
|
|
if( m_InputMode == INPUTMODE_PLAYERS && p != pn )
|
|
|
|
|
continue; // skip
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
if( m_iCurrentRow[p] == m_iNumOptionRows ) // on exit
|
|
|
|
|
return; // can't go down any more
|
|
|
|
|
|
|
|
|
|
m_iCurrentRow[p]++;
|
2003-01-21 22:23:01 +00:00
|
|
|
|
|
|
|
|
// Chris: Commented this out, but will add back in later.
|
|
|
|
|
// /* Find the next row with any un-dimmed entries. */
|
|
|
|
|
// int new_row = m_iCurrentRow[p];
|
|
|
|
|
// do {
|
|
|
|
|
// if( ++new_row == m_iNumOptionRows )
|
|
|
|
|
// new_row = 0; // wrap around
|
|
|
|
|
// if(!RowCompletelyDimmed(new_row)) break;
|
|
|
|
|
// } while(new_row != m_iCurrentRow[p]);
|
|
|
|
|
// m_iCurrentRow[p] = new_row;
|
|
|
|
|
|
2002-09-04 03:49:08 +00:00
|
|
|
TweenCursor( (PlayerNumber)p );
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
2002-09-04 03:49:08 +00:00
|
|
|
m_SoundNextRow.Play();
|
2002-05-20 08:59:37 +00:00
|
|
|
OnChange();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|