Implement ScreenMiniMenu with ScreenOptions

This commit is contained in:
Chris Danford
2005-03-20 06:41:56 +00:00
parent 48e6cb1a69
commit bbadc010f4
16 changed files with 534 additions and 745 deletions
+14 -16
View File
@@ -43,14 +43,12 @@ enum CourseEntryMenuRow
lives,
};
static const MenuRow g_CourseOptionsMenuItems[] =
{
{ repeat, "Repeat", true, true, 0, { "NO","YES" } },
{ randomize, "Randomize", true, true, 0, { "NO","YES" } },
{ lives, "Lives", true, true, 4, { "Use Bar Life","1","2","3","4","5","6","7","8","9","10" } },
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_CourseOptionsMenu( "Course Options", g_CourseOptionsMenuItems );
static Menu g_CourseOptionsMenu(
"ScreenMiniMenuCourseOptions",
MenuRow( repeat, "Repeat", true, true, 0, "NO","YES" ),
MenuRow( randomize, "Randomize", true, true, 0, "NO","YES" ),
MenuRow( lives, "Lives", true, true, 4, "Use Bar Life","1","2","3","4","5","6","7","8","9","10" )
);
enum CourseOptionsMenuRow
{
@@ -279,11 +277,11 @@ void EditCoursesMenu::Start()
switch( m_SelectedRow )
{
case ROW_COURSE_OPTIONS:
g_CourseOptionsMenu.rows[repeat].defaultChoice = pCourse->m_bRepeat ? 1 : 0;
g_CourseOptionsMenu.rows[randomize].defaultChoice = pCourse->m_bRandomize ? 1 : 0;
g_CourseOptionsMenu.rows[lives].defaultChoice = pCourse->m_iLives;
if( g_CourseOptionsMenu.rows[lives].defaultChoice == -1 )
g_CourseOptionsMenu.rows[lives].defaultChoice = 0;
g_CourseOptionsMenu.rows[repeat].iDefaultChoice = pCourse->m_bRepeat ? 1 : 0;
g_CourseOptionsMenu.rows[randomize].iDefaultChoice = pCourse->m_bRandomize ? 1 : 0;
g_CourseOptionsMenu.rows[lives].iDefaultChoice = pCourse->m_iLives;
if( g_CourseOptionsMenu.rows[lives].iDefaultChoice == -1 )
g_CourseOptionsMenu.rows[lives].iDefaultChoice = 0;
SCREENMAN->MiniMenu( &g_CourseOptionsMenu, SM_BackFromCourseOptionsMenu );
break;
case ROW_ACTION:
@@ -353,9 +351,9 @@ void EditCoursesMenu::HandleScreenMessage( const ScreenMessage SM )
switch( SM )
{
case SM_BackFromCourseOptionsMenu:
pCourse->m_bRepeat = !!ScreenMiniMenu::s_iLastAnswers[repeat];
pCourse->m_bRandomize = !!ScreenMiniMenu::s_iLastAnswers[randomize];
pCourse->m_iLives = ScreenMiniMenu::s_iLastAnswers[lives];
pCourse->m_bRepeat = !!ScreenMiniMenu::s_viLastAnswers[repeat];
pCourse->m_bRandomize = !!ScreenMiniMenu::s_viLastAnswers[randomize];
pCourse->m_iLives = ScreenMiniMenu::s_viLastAnswers[lives];
if( pCourse->m_iLives == 0 )
pCourse->m_iLives = -1;
+9 -3
View File
@@ -15,11 +15,17 @@
OptionIcon::OptionIcon()
{
m_spr.Load( THEME->GetPathG("OptionIcon","frame 3x2") );
}
void OptionIcon::Load( CString sType )
{
ASSERT( m_SubActors.empty() ); // don't load twice
m_spr.Load( THEME->GetPathG(sType,"icon 3x2") );
m_spr.StopAnimating();
this->AddChild( &m_spr );
m_text.LoadFromFont( THEME->GetPathF("OptionIcon","text") );
m_text.LoadFromFont( THEME->GetPathF(sType,"icon") );
m_text.SetShadowLength( 0 );
m_text.SetZoom( TEXT_ZOOM );
m_text.SetXY( TEXT_OFFSET_X, TEXT_OFFSET_Y );
@@ -28,7 +34,7 @@ OptionIcon::OptionIcon()
this->AddChild( &m_text );
}
void OptionIcon::Load( PlayerNumber pn, const CString &_sText, bool bHeader )
void OptionIcon::Set( PlayerNumber pn, const CString &_sText, bool bHeader )
{
CString sText = _sText;
+2 -2
View File
@@ -13,8 +13,8 @@ class OptionIcon : public ActorFrame
{
public:
OptionIcon();
void Load( PlayerNumber pn, const CString &sText, bool bHeader = false );
void Load( CString sType );
void Set( PlayerNumber pn, const CString &sText, bool bHeader = false );
void DrawPrimitives();
protected:
+7 -4
View File
@@ -86,6 +86,8 @@ int OptionToPreferredColumn( CString sOptionText )
void OptionIconRow::Load( PlayerNumber pn )
{
m_PlayerNumber = pn;
for( unsigned i=0; i<NUM_OPTION_COLS; i++ )
m_OptionIcon[i].Load( "OptionIconRow" );
}
void OptionIconRow::Refresh()
@@ -93,8 +95,6 @@ void OptionIconRow::Refresh()
ASSERT( m_PlayerNumber != NUM_PLAYERS );
// init
for( unsigned i=0; i<NUM_OPTION_COLS; i++ )
m_OptionIcon[i].Load( m_PlayerNumber, "", i==0 );
CString sOptions = GAMESTATE->m_pPlayerState[m_PlayerNumber]->m_PlayerOptions.GetString();
CStringArray asOptions;
@@ -125,8 +125,11 @@ void OptionIconRow::Refresh()
}
}
for( unsigned i=0; i<NUM_OPTION_COLS-1; i++ )
m_OptionIcon[i+1].Load( m_PlayerNumber, asTabs[i], false );
for( unsigned i=0; i<NUM_OPTION_COLS; i++ )
if( i == 0 )
m_OptionIcon[i].Set( m_PlayerNumber, "", true );
else
m_OptionIcon[i].Set( m_PlayerNumber, asTabs[i-1], false );
}
void OptionIconRow::DrawPrimitives()
+35 -58
View File
@@ -102,6 +102,9 @@ void OptionRow::LoadMetrics( const CString &sType )
CAPITALIZE_ALL_OPTION_NAMES .Load(m_sType,"CapitalizeAllOptionNames");
SHOW_UNDERLINES .Load(m_sType,"ShowUnderlines");
TWEEN_SECONDS .Load(m_sType,"TweenSeconds");
FOREACH_PlayerNumber( p )
m_OptionIcons[p].Load( m_sType );
}
void OptionRow::LoadNormal( const OptionRowDefinition &def, OptionRowHandler *pHand, bool bFirstItemGoesDown )
@@ -117,19 +120,14 @@ void OptionRow::LoadNormal( const OptionRowDefinition &def, OptionRowHandler *pH
MESSAGEMAN->Subscribe( this, *m );
}
if( !def.choices.size() )
RageException::Throw( "Screen %s menu entry \"%s\" has no choices",
m_sName.c_str(), def.name.c_str() );
FOREACH_PlayerNumber( p )
{
vector<bool> &vbSelected = m_vbSelected[p];
vbSelected.resize( m_RowDef.choices.size() );
FOREACH( bool, vbSelected, b )
*b = false;
vbSelected.resize( 0 );
vbSelected.resize( m_RowDef.choices.size(), false );
// set select the first item if a SELECT_ONE row
if( m_RowDef.selectType == SELECT_ONE )
if( vbSelected.size() && m_RowDef.selectType == SELECT_ONE )
vbSelected[0] = true;
}
@@ -147,23 +145,6 @@ void OptionRow::AfterImportOptions(
float fY
)
{
/*
ITEMS_START_X,
ITEMS_GAP_X,
ITEMS_END_X,
ITEMS_LONG_ROW_SHARED_X,
ITEMS_LONG_ROW_X,
ITEMS_ZOOM,
CAPITALIZE_ALL_OPTION_NAMES,
THEME->GetPathF(m_sType,"item"),
THEME->GetPathF(m_sType,"title"),
THEME->GetPathG(m_sType,"bullet"),
LABELS_X,
ARROWS_X,
LABELS_ON_COMMAND
*/
// Make all selections the same if bOneChoiceForAllPlayers
if( m_RowDef.bOneChoiceForAllPlayers )
{
@@ -185,10 +166,10 @@ void OptionRow::AfterImportOptions(
bHasASelection = true;
}
if( !bHasASelection )
if( !bHasASelection && !m_vbSelected[p].empty() )
m_vbSelected[p][0] = true;
m_iChoiceInRowWithFocus[p] = GetOneSelection(p); // focus on the selection we just set
m_iChoiceInRowWithFocus[p] = GetOneSelection(p, true); // focus on the selection we just set
}
break;
case SELECT_MULTIPLE:
@@ -249,7 +230,7 @@ void OptionRow::AfterImportOptions(
const int iChoiceInRowWithFocus = m_iChoiceInRowWithFocus[p];
bt->LoadFromFont( THEME->GetPathF(m_sType,"item") );
CString sText = m_RowDef.choices[iChoiceInRowWithFocus];
CString sText = (iChoiceInRowWithFocus==-1) ? "" : m_RowDef.choices[iChoiceInRowWithFocus];
if( CAPITALIZE_ALL_OPTION_NAMES )
sText.MakeUpper();
bt->SetText( sText );
@@ -272,7 +253,8 @@ void OptionRow::AfterImportOptions(
{
OptionsCursor *ul = new OptionsCursor;
m_Underline[p].push_back( ul );
ul->Load( p, true );
ul->Load( m_sType, OptionsCursor::underline );
ul->Set( p );
int iWidth, iX, iY;
GetWidthXY( p, 0, iWidth, iX, iY );
ul->SetX( float(iX) );
@@ -306,7 +288,8 @@ void OptionRow::AfterImportOptions(
{
OptionsCursor *ul = new OptionsCursor;
m_Underline[p].push_back( ul );
ul->Load( p, true );
ul->Load( m_sType, OptionsCursor::cursor );
ul->Set( p );
ul->SetX( fX );
ul->SetWidth( truncf(fItemWidth) );
}
@@ -349,12 +332,6 @@ void OptionRow::AfterImportOptions(
void OptionRow::LoadExit()
{
/*
THEME->GetPathF(m_sType,"item"),
THEME->GetMetric("OptionNames","Exit"),
ITEMS_LONG_ROW_SHARED_X,
ITEMS_ZOOM
*/
m_RowType = OptionRow::ROW_EXIT;
m_RowDef.name = "Exit";
m_RowDef.choices.push_back( "" );
@@ -377,10 +354,6 @@ void OptionRow::LoadExit()
void OptionRow::PositionUnderlines( PlayerNumber pn )
{
/*
SHOW_UNDERLINES
TWEEN_SECONDS
*/
if( m_RowType == ROW_EXIT )
return;
@@ -404,7 +377,7 @@ void OptionRow::PositionUnderlines( PlayerNumber pn )
ASSERT( m_vbSelected[pnTakeSelectedFrom].size() == m_RowDef.choices.size() );
bool bSelected = m_vbSelected[pnTakeSelectedFrom][ iChoiceWithFocus ];
bool bSelected = (iChoiceWithFocus==-1) ? false : m_vbSelected[pnTakeSelectedFrom][ iChoiceWithFocus ];
bool bHidden = !bSelected || m_bHidden;
if( !(bool)SHOW_UNDERLINES )
bHidden = true;
@@ -504,10 +477,16 @@ void OptionRow::UpdateEnabledDisabled()
bThisRowHasFocusByAll &= m_bRowHasFocus[p];
bool bRowEnabled = !m_RowDef.m_vEnabledForPlayers.empty();
float fDiffuseAlpha = (m_bHidden || !bRowEnabled)? 0.0f:1.0f;
/* Don't tween selection colors at all. */
RageColor color = bThisRowHasFocusByAny ? COLOR_SELECTED:COLOR_NOT_SELECTED;
RageColor color;
if( bThisRowHasFocusByAny ) color = COLOR_SELECTED;
else if( bRowEnabled ) color = COLOR_NOT_SELECTED;
else color = COLOR_DISABLED;
if( m_bHidden )
color.a = 0;
m_sprBullet.SetGlobalDiffuseColor( color );
m_textTitle.SetGlobalDiffuseColor( color );
@@ -519,12 +498,12 @@ void OptionRow::UpdateEnabledDisabled()
for( unsigned j=0; j<m_textItems.size(); j++ )
{
if( m_textItems[j]->GetDestY() == m_fY &&
m_textItems[j]->DestTweenState().diffuse[0][3] == fDiffuseAlpha )
m_textItems[j]->DestTweenState().diffuse[0] == color )
continue;
m_textItems[j]->StopTweening();
m_textItems[j]->BeginTweening( TWEEN_SECONDS );
m_textItems[j]->SetDiffuseAlpha( fDiffuseAlpha );
m_textItems[j]->SetDiffuseAlpha( color.a );
m_textItems[j]->SetY( m_fY );
}
break;
@@ -533,14 +512,12 @@ void OptionRow::UpdateEnabledDisabled()
{
bool bRowEnabled = m_RowDef.m_vEnabledForPlayers.find(pn) != m_RowDef.m_vEnabledForPlayers.end();
if( m_bRowHasFocus[pn] )
color = COLOR_SELECTED;
else if( bRowEnabled )
color = COLOR_NOT_SELECTED;
else
color = COLOR_DISABLED;
if( m_bRowHasFocus[pn] ) color = COLOR_SELECTED;
else if( bRowEnabled ) color = COLOR_NOT_SELECTED;
else color = COLOR_DISABLED;
color.a = (bRowEnabled && !m_bHidden) ? 1.0f:0.0f;
if( m_bHidden )
color.a = 0;
unsigned item_no = m_RowDef.bOneChoiceForAllPlayers ? 0 : pn;
@@ -578,14 +555,14 @@ void OptionRow::UpdateEnabledDisabled()
m_textItems[0]->SetEffectNone();
}
if( m_sprBullet.GetDestY() != m_fY || m_sprBullet.DestTweenState().diffuse[0][3] != fDiffuseAlpha )
if( m_sprBullet.GetDestY() != m_fY || m_sprBullet.DestTweenState().diffuse[0] != color )
{
m_sprBullet.StopTweening();
m_textTitle.StopTweening();
m_sprBullet.BeginTweening( TWEEN_SECONDS );
m_textTitle.BeginTweening( TWEEN_SECONDS );
m_sprBullet.SetDiffuseAlpha( fDiffuseAlpha );
m_textTitle.SetDiffuseAlpha( fDiffuseAlpha );
m_sprBullet.SetDiffuseAlpha( color.a );
m_textTitle.SetDiffuseAlpha( color.a );
m_sprBullet.SetY( m_fY );
m_textTitle.SetY( m_fY );
}
@@ -593,7 +570,7 @@ void OptionRow::UpdateEnabledDisabled()
void OptionRow::LoadOptionIcon( PlayerNumber pn, const CString &sText )
{
m_OptionIcons[pn].Load( pn, sText, false );
m_OptionIcons[pn].Set( pn, sText, false );
}
BitmapText &OptionRow::GetTextItemForRow( PlayerNumber pn, int iChoiceOnRow )
@@ -646,9 +623,9 @@ int OptionRow::GetOneSelection( PlayerNumber pn, bool bAllowFail ) const
return -1;
}
int OptionRow::GetOneSharedSelection() const
int OptionRow::GetOneSharedSelection( bool bAllowFail ) const
{
return GetOneSelection( (PlayerNumber)0 );
return GetOneSelection( (PlayerNumber)0, bAllowFail );
}
void OptionRow::SetOneSelection( PlayerNumber pn, int iChoice )
+11 -5
View File
@@ -42,7 +42,10 @@ struct OptionRowDefinition
set<PlayerNumber> m_vEnabledForPlayers; // only players in this set may change focus to this row
bool m_bExportOnChange;
bool EnabledForPlayer( PlayerNumber pn ) { return m_vEnabledForPlayers.find(pn) != m_vEnabledForPlayers.end(); }
bool IsEnabledForPlayer( PlayerNumber pn ) const
{
return m_vEnabledForPlayers.find(pn) != m_vEnabledForPlayers.end();
}
OptionRowDefinition() { Init(); }
void Init()
@@ -58,9 +61,13 @@ struct OptionRowDefinition
m_bExportOnChange = false;
}
OptionRowDefinition( const char *n, bool b, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL ) :
name(n), bOneChoiceForAllPlayers(b), selectType(SELECT_ONE), layoutType(LAYOUT_SHOW_ALL_IN_ROW)
OptionRowDefinition( const char *n, bool b, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL )
{
Init();
name=n;
bOneChoiceForAllPlayers=b;
selectType=SELECT_ONE;
layoutType=LAYOUT_SHOW_ALL_IN_ROW;
#define PUSH( c ) if(c) choices.push_back(c);
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);
#undef PUSH
@@ -95,7 +102,7 @@ public:
void UpdateEnabledDisabled();
int GetOneSelection( PlayerNumber pn, bool bAllowFail=false ) const;
int GetOneSharedSelection() const;
int GetOneSharedSelection( bool bAllowFail=false ) const;
void SetOneSelection( PlayerNumber pn, int iChoice );
void SetOneSharedSelection( int iChoice );
@@ -104,7 +111,6 @@ public:
if( m_RowDef.bOneChoiceForAllPlayers )
pn = PLAYER_1;
int iChoice = m_iChoiceInRowWithFocus[pn];
ASSERT(iChoice >= 0 && iChoice < (int)m_RowDef.choices.size());
return iChoice;
}
void SetChoiceInRowWithFocus( PlayerNumber pn, int iChoice )
+11 -4
View File
@@ -8,14 +8,17 @@
OptionsCursor::OptionsCursor()
{
}
void OptionsCursor::Load( CString sType, Element elem )
{
ASSERT( m_SubActors.empty() ); // don't load twice
this->AddChild( &m_sprMiddle );
this->AddChild( &m_sprLeft );
this->AddChild( &m_sprRight );
}
void OptionsCursor::Load( PlayerNumber pn, bool bUnderline )
{
CString sPath = THEME->GetPathG("OptionsCursor",bUnderline?"underline":"cursor");
CString sPath = THEME->GetPathG(sType,elem==cursor?"cursor":"underline");
m_sprLeft.Load( sPath );
m_sprMiddle.Load( sPath );
@@ -24,6 +27,10 @@ void OptionsCursor::Load( PlayerNumber pn, bool bUnderline )
m_sprLeft.StopAnimating();
m_sprMiddle.StopAnimating();
m_sprRight.StopAnimating();
}
void OptionsCursor::Set( PlayerNumber pn )
{
int iBaseFrameNo;
switch( pn )
+3 -1
View File
@@ -13,7 +13,9 @@ class OptionsCursor : public ActorFrame
public:
OptionsCursor();
void Load( PlayerNumber pn, bool bUnderline );
enum Element { cursor, underline };
void Load( CString sType, Element elem );
void Set( PlayerNumber pn );
void SetBarWidth( int iWidth );
void TweenBarWidth( int iNewWidth );
+229 -247
View File
@@ -322,166 +322,148 @@ const MapEditToDI *ScreenEdit::GetCurrentMap() const
}
}
static const MenuRow g_KeyboardShortcutsItems[] =
{
static Menu g_KeyboardShortcuts(
"ScreenMiniMenuKeyboardShortcuts",
#if !defined(XBOX)
{ -1, "PgUp/PgDn: jump measure", false, true, 0, { NULL } },
{ -1, "Home/End: jump to first/last beat", false, true, 0, { NULL } },
{ -1, "Ctrl + Up/Down: Change zoom", false, true, 0, { NULL } },
{ -1, "Shift + Up/Down: Drag area marker", false, true, 0, { NULL } },
{ -1, "P: Play selection", false, true, 0, { NULL } },
{ -1, "Ctrl + P: Play whole song", false, true, 0, { NULL } },
{ -1, "Shift + P: Play current beat to end", false, true, 0, { NULL } },
{ -1, "Ctrl + R: Record", false, true, 0, { NULL } },
{ -1, "F4: Toggle assist tick", false, true, 0, { NULL } },
{ -1, "F5/F6: Next/prev steps of same StepsType", false, true, 0, { NULL } },
{ -1, "F7/F8: Decrease/increase BPM at cur beat", false, true, 0, { NULL } },
{ -1, "F9/F10: Decrease/increase stop at cur beat", false, true, 0, { NULL } },
{ -1, "F11/F12: Decrease/increase music offset", false, true, 0, { NULL } },
/* XXX: This would be better as a single submenu, to let people tweak
* and play the sample several times (without having to re-enter the
* menu each time), so it doesn't use a whole bunch of hotkeys. */
{ -1, "[ and ]: Decrease/increase sample music start", false, true, 0, { NULL } },
{ -1, "{ and }: Decrease/increase sample music length", false, true, 0, { NULL } },
{ -1, "M: Play sample music", false, true, 0, { NULL } },
{ -1, "B: Add/Edit Background Change", false, true, 0, { NULL } },
{ -1, "Insert: Insert beat and shift down", false, true, 0, { NULL } },
{ -1, "Ctrl + Insert: Shift BPM changes and stops down one beat",
false, true, 0, { NULL } },
{ -1, "Delete: Delete beat and shift up", false, true, 0, { NULL } },
{ -1, "Ctrl + Delete: Shift BPM changes and stops up one beat",
false, true, 0, { NULL } },
{ -1, "Shift + number: Lay mine", false, true, 0, { NULL } },
{ -1, "Alt + number: Add to/remove from right half", false, true, 0, { NULL } },
MenuRow( -1, "PgUp/PgDn: jump measure", false, true, 0, NULL ),
MenuRow( -1, "Home/End: jump to first/last beat", false, true, 0, NULL ),
MenuRow( -1, "Ctrl + Up/Down: Change zoom", false, true, 0, NULL ),
MenuRow( -1, "Shift + Up/Down: Drag area marker", false, true, 0, NULL ),
MenuRow( -1, "P: Play selection", false, true, 0, NULL ),
MenuRow( -1, "Ctrl + P: Play whole song", false, true, 0, NULL ),
MenuRow( -1, "Shift + P: Play current beat to end", false, true, 0, NULL ),
MenuRow( -1, "Ctrl + R: Record", false, true, 0, NULL ),
MenuRow( -1, "F4: Toggle assist tick", false, true, 0, NULL ),
MenuRow( -1, "F5/F6: Next/prev steps of same StepsType", false, true, 0, NULL ),
MenuRow( -1, "F7/F8: Decrease/increase BPM at cur beat", false, true, 0, NULL ),
MenuRow( -1, "F9/F10: Decrease/increase stop at cur beat", false, true, 0, NULL ),
MenuRow( -1, "F11/F12: Decrease/increase music offset", false, true, 0, NULL ),
/* XXX: This would be better as a single submenu, to let people tweak
* and play the sample several times (without having to re-enter the
* menu each time), so it doesn't use a whole bunch of hotkeys. */
MenuRow( -1, "[ and ]: Decrease/increase sample music start", false, true, 0, NULL ),
MenuRow( -1, "{ and }: Decrease/increase sample music length", false, true, 0, NULL ),
MenuRow( -1, "M: Play sample music", false, true, 0, NULL ),
MenuRow( -1, "B: Add/Edit Background Change", false, true, 0, NULL ),
MenuRow( -1, "Insert: Insert beat and shift down", false, true, 0, NULL ),
MenuRow( -1, "Ctrl + Insert: Shift BPM changes and stops down one beat",
false, true, 0, NULL ),
MenuRow( -1, "Delete: Delete beat and shift up", false, true, 0, NULL ),
MenuRow( -1, "Ctrl + Delete: Shift BPM changes and stops up one beat",
false, true, 0, NULL ),
MenuRow( -1, "Shift + number: Lay mine", false, true, 0, NULL ),
MenuRow( -1, "Alt + number: Add to/remove from right half", false, true, 0, NULL )
#else
{ -1, "L + Up/Down: Change zoom", false, true, 0, { NULL } },
{ -1, "R + Up/Down: Drag area marker", false, true, 0, { NULL } },
{ -1, "L + Select: Play selection", false, true, 0, { NULL } },
{ -1, "R + Start: Play whole song", false, true, 0, { NULL } },
{ -1, "R + Select: Record", false, true, 0, { NULL } },
{ -1, "L + Black: Toggle assist tick", false, true, 0, { NULL } },
{ -1, "R + White: Insert beat and shift down", false, true, 0, { NULL } },
{ -1, "R + Black: Delete beat and shift up", false, true, 0, { NULL } },
{ -1, "R + button: Lay mine", false, true, 0, { NULL } },
{ -1, "L + button: Add to/remove from right half", false, true, 0, { NULL } },
MenuRow( -1, "L + Up/Down: Change zoom", false, true, 0, NULL ),
MenuRow( -1, "R + Up/Down: Drag area marker", false, true, 0, NULL ),
MenuRow( -1, "L + Select: Play selection", false, true, 0, NULL ),
MenuRow( -1, "R + Start: Play whole song", false, true, 0, NULL ),
MenuRow( -1, "R + Select: Record", false, true, 0, NULL ),
MenuRow( -1, "L + Black: Toggle assist tick", false, true, 0, NULL ),
MenuRow( -1, "R + White: Insert beat and shift down", false, true, 0, NULL ),
MenuRow( -1, "R + Black: Delete beat and shift up", false, true, 0, NULL ),
MenuRow( -1, "R + button: Lay mine", false, true, 0, NULL ),
MenuRow( -1, "L + button: Add to/remove from right half", false, true, 0, NULL )
#endif
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_KeyboardShortcuts( "Keyboard Shortcuts", g_KeyboardShortcutsItems );
);
static const MenuRow g_MainMenuItems[] =
{
{ ScreenEdit::edit_notes_statistics, "Edit Steps Statistics", true, true, 0, { NULL } },
{ ScreenEdit::play_whole_song, "Play Whole Song", true, true, 0, { NULL } },
{ ScreenEdit::play_current_beat_to_end, "Play Current Beat To End", true, true, 0, { NULL } },
{ ScreenEdit::save, "Save", true, true, 0, { NULL } },
{ ScreenEdit::revert_to_last_save, "Revert to Last Save", true, true, 0, { NULL } },
{ ScreenEdit::player_options, "Player Options", true, true, 0, { NULL } },
{ ScreenEdit::song_options, "Song Options", true, false, 0, { NULL } },
{ ScreenEdit::edit_song_info, "Edit Song Info", true, false, 0, { NULL } },
{ ScreenEdit::edit_bpm, "Edit BPM Change", true, false, 0, { NULL } },
{ ScreenEdit::edit_stop, "Edit Stop", true, false, 0, { NULL } },
{ ScreenEdit::edit_bg_change, "Add/Edit BG Change", true, false, 0, { NULL } },
{ ScreenEdit::play_preview_music, "Play preview music", true, false, 0, { NULL } },
{ ScreenEdit::preferences, "Preferences", true, false, 0, { NULL } },
{ ScreenEdit::exit, "Exit", true, true, 0, { NULL } },
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_MainMenu( "Main Menu", g_MainMenuItems );
static Menu g_MainMenu(
"ScreenMiniMenuMainMenu",
MenuRow( ScreenEdit::edit_notes_statistics, "Edit Steps Statistics", true, true, 0, NULL ),
MenuRow( ScreenEdit::play_whole_song, "Play Whole Song", true, true, 0, NULL ),
MenuRow( ScreenEdit::play_current_beat_to_end, "Play Current Beat To End", true, true, 0, NULL ),
MenuRow( ScreenEdit::save, "Save", true, true, 0, NULL ),
MenuRow( ScreenEdit::revert_to_last_save, "Revert to Last Save", true, true, 0, NULL ),
MenuRow( ScreenEdit::player_options, "Player Options", true, true, 0, NULL ),
MenuRow( ScreenEdit::song_options, "Song Options", true, false, 0, NULL ),
MenuRow( ScreenEdit::edit_song_info, "Edit Song Info", true, false, 0, NULL ),
MenuRow( ScreenEdit::edit_bpm, "Edit BPM Change", true, false, 0, NULL ),
MenuRow( ScreenEdit::edit_stop, "Edit Stop", true, false, 0, NULL ),
MenuRow( ScreenEdit::edit_bg_change, "Add/Edit BG Change", true, false, 0, NULL ),
MenuRow( ScreenEdit::play_preview_music, "Play preview music", true, false, 0, NULL ),
MenuRow( ScreenEdit::preferences, "Preferences", true, false, 0, NULL ),
MenuRow( ScreenEdit::exit, "Exit", true, true, 0, NULL )
);
static const MenuRow g_AreaMenuItems[] =
{
{ ScreenEdit::cut, "Cut", true, true, 0, { NULL } },
{ ScreenEdit::copy, "Copy", true, true, 0, { NULL } },
{ ScreenEdit::paste_at_current_beat, "Paste at current beat", true, true, 0, { NULL } },
{ ScreenEdit::paste_at_begin_marker, "Paste at begin marker", true, true, 0, { NULL } },
{ ScreenEdit::clear, "Clear area", true, true, 0, { NULL } },
{ ScreenEdit::quantize, "Quantize", true, true, 0, { "4TH","8TH","12TH","16TH","24TH","32ND","48TH","64TH" } },
{ ScreenEdit::turn, "Turn", true, true, 0, { "Left","Right","Mirror","Shuffle","Super Shuffle" } },
{ ScreenEdit::transform, "Transform", true, true, 0, { "NoHolds","NoMines","Little","Wide","Big","Quick","BMRize","Skippy","Mines","Echo","Stomp","Planted","Floored","Twister","NoJumps","NoHands","NoQuads" } },
{ ScreenEdit::alter, "Alter", true, true, 0, { "Backwards","Swap Sides","Copy Left To Right","Copy Right To Left","Clear Left","Clear Right","Collapse To One","Collapse Left","Shift Left","Shift Right" } },
{ ScreenEdit::tempo, "Tempo", true, true, 0, { "Compress 2x","Compress 3->2","Compress 4->3","Expand 3->4","Expand 2->3","Expand 2x" } },
{ ScreenEdit::play, "Play selection", true, true, 0, { NULL } },
{ ScreenEdit::record, "Record in selection", true, true, 0, { NULL } },
{ ScreenEdit::insert_and_shift, "Insert beat and shift down", true, true, 0, { NULL } },
{ ScreenEdit::delete_and_shift, "Delete beat and shift up", true, true, 0, { NULL } },
{ ScreenEdit::shift_pauses_forward, "Shift pauses and BPM changes down",true, false, 0, { NULL } },
{ ScreenEdit::shift_pauses_backward, "Shift pauses and BPM changes up", true, false, 0, { NULL } },
{ ScreenEdit::convert_beat_to_pause, "Convert beats to pause", true, false, 0, { NULL } },
{ ScreenEdit::convert_pause_to_beat, "Convert pause to beats", true, false, 0, { NULL } },
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_AreaMenu( "Area Menu", g_AreaMenuItems );
static Menu g_AreaMenu(
"ScreenMiniMenuAreaMenu",
MenuRow( ScreenEdit::cut, "Cut", true, true, 0, NULL ),
MenuRow( ScreenEdit::copy, "Copy", true, true, 0, NULL ),
MenuRow( ScreenEdit::paste_at_current_beat, "Paste at current beat", true, true, 0, NULL ),
MenuRow( ScreenEdit::paste_at_begin_marker, "Paste at begin marker", true, true, 0, NULL ),
MenuRow( ScreenEdit::clear, "Clear area", true, true, 0, NULL ),
MenuRow( ScreenEdit::quantize, "Quantize", true, true, 0, "4TH","8TH","12TH","16TH","24TH","32ND","48TH","64TH" ),
MenuRow( ScreenEdit::turn, "Turn", true, true, 0, "Left","Right","Mirror","Shuffle","Super Shuffle" ),
MenuRow( ScreenEdit::transform, "Transform", true, true, 0, "NoHolds","NoMines","Little","Wide","Big","Quick","BMRize","Skippy","Mines","Echo","Stomp","Planted","Floored","Twister","NoJumps","NoHands","NoQuads" ),
MenuRow( ScreenEdit::alter, "Alter", true, true, 0, "Backwards","Swap Sides","Copy Left To Right","Copy Right To Left","Clear Left","Clear Right","Collapse To One","Collapse Left","Shift Left","Shift Right" ),
MenuRow( ScreenEdit::tempo, "Tempo", true, true, 0, "Compress 2x","Compress 3->2","Compress 4->3","Expand 3->4","Expand 2->3","Expand 2x" ),
MenuRow( ScreenEdit::play, "Play selection", true, true, 0, NULL ),
MenuRow( ScreenEdit::record, "Record in selection", true, true, 0, NULL ),
MenuRow( ScreenEdit::insert_and_shift, "Insert beat and shift down", true, true, 0, NULL ),
MenuRow( ScreenEdit::delete_and_shift, "Delete beat and shift up", true, true, 0, NULL ),
MenuRow( ScreenEdit::shift_pauses_forward, "Shift pauses and BPM changes down",true, false, 0, NULL ),
MenuRow( ScreenEdit::shift_pauses_backward, "Shift pauses and BPM changes up", true, false, 0, NULL ),
MenuRow( ScreenEdit::convert_beat_to_pause, "Convert beats to pause", true, false, 0, NULL ),
MenuRow( ScreenEdit::convert_pause_to_beat, "Convert pause to beats", true, false, 0, NULL )
);
static const MenuRow g_EditNotesStatisticsItems[] =
{
{ ScreenEdit::difficulty, "Difficulty", true, true, 0, { "BEGINNER","EASY","MEDIUM","HARD","CHALLENGE","EDIT" } },
{ ScreenEdit::meter, "Meter", true, true, 0, { "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15" } },
{ ScreenEdit::description, "Description", true, true, 0, { NULL } },
{ ScreenEdit::predict_meter, "Predicted Meter", false, true, 0, { NULL } },
{ ScreenEdit::tap_notes, "Tap Steps", false, true, 0, { NULL } },
{ ScreenEdit::hold_notes, "Hold Steps", false, true, 0, { NULL } },
{ ScreenEdit::stream, "Stream", false, true, 0, { NULL } },
{ ScreenEdit::voltage, "Voltage", false, true, 0, { NULL } },
{ ScreenEdit::air, "Air", false, true, 0, { NULL } },
{ ScreenEdit::freeze, "Freeze", false, true, 0, { NULL } },
{ ScreenEdit::chaos, "Chaos", false, true, 0, { NULL } },
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_EditNotesStatistics( "Statistics", g_EditNotesStatisticsItems );
static Menu g_EditNotesStatistics(
"ScreenMiniMenuStatistics",
MenuRow( ScreenEdit::difficulty, "Difficulty", true, true, 0, "BEGINNER","EASY","MEDIUM","HARD","CHALLENGE","EDIT" ),
MenuRow( ScreenEdit::meter, "Meter", true, true, 0, "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15" ),
MenuRow( ScreenEdit::description, "Description", true, true, 0, NULL ),
MenuRow( ScreenEdit::predict_meter, "Predicted Meter", false, true, 0, NULL ),
MenuRow( ScreenEdit::tap_notes, "Tap Steps", false, true, 0, NULL ),
MenuRow( ScreenEdit::hold_notes, "Hold Steps", false, true, 0, NULL ),
MenuRow( ScreenEdit::stream, "Stream", false, true, 0, NULL ),
MenuRow( ScreenEdit::voltage, "Voltage", false, true, 0, NULL ),
MenuRow( ScreenEdit::air, "Air", false, true, 0, NULL ),
MenuRow( ScreenEdit::freeze, "Freeze", false, true, 0, NULL ),
MenuRow( ScreenEdit::chaos, "Chaos", false, true, 0, NULL )
);
static const MenuRow g_EditSongInfoItems[] =
{
{ ScreenEdit::main_title, "Main title", true, true, 0, { NULL } },
{ ScreenEdit::sub_title, "Sub title", true, true, 0, { NULL } },
{ ScreenEdit::artist, "Artist", true, true, 0, { NULL } },
{ ScreenEdit::credit, "Credit", true, true, 0, { NULL } },
{ ScreenEdit::main_title_transliteration, "Main title transliteration", true, true, 0, { NULL } },
{ ScreenEdit::sub_title_transliteration, "Sub title transliteration", true, true, 0, { NULL } },
{ ScreenEdit::artist_transliteration, "Artist transliteration", true, true, 0, { NULL } },
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_EditSongInfo( "Edit Song Info", g_EditSongInfoItems );
static Menu g_EditSongInfo(
"ScreenMiniMenuEditSongInfo",
MenuRow( ScreenEdit::main_title, "Main title", true, true, 0, NULL ),
MenuRow( ScreenEdit::sub_title, "Sub title", true, true, 0, NULL ),
MenuRow( ScreenEdit::artist, "Artist", true, true, 0, NULL ),
MenuRow( ScreenEdit::credit, "Credit", true, true, 0, NULL ),
MenuRow( ScreenEdit::main_title_transliteration, "Main title transliteration", true, true, 0, NULL ),
MenuRow( ScreenEdit::sub_title_transliteration, "Sub title transliteration", true, true, 0, NULL ),
MenuRow( ScreenEdit::artist_transliteration, "Artist transliteration", true, true, 0, NULL )
);
static const MenuRow g_BGChangeItems[] =
{
{ ScreenEdit::rate, "Rate (applies to new adds)", true, true, 10, { "0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%","120%","140%","160%","180%","200%" } },
{ ScreenEdit::fade_last, "Fade Last (applies to new adds)", true, true, 0, { "NO","YES" } },
{ ScreenEdit::rewind_movie, "Rewind Movie (applies to new adds)", true, true, 0, { "NO","YES" } },
{ ScreenEdit::loop, "Loop (applies to new adds)", true, true, 1, { "NO","YES" } },
{ ScreenEdit::add_random, "Add Change to random", true, true, 0, { NULL } },
{ ScreenEdit::add_song_bganimation, "Add Change to song BGAnimation", true, true, 0, { NULL } },
{ ScreenEdit::add_song_movie, "Add Change to song Movie", true, true, 0, { NULL } },
{ ScreenEdit::add_song_still, "Add Change to song Still", true, true, 0, { NULL } },
{ ScreenEdit::add_global_random_movie, "Add Change to global Random Movie", true, true, 0, { NULL } },
{ ScreenEdit::add_global_bganimation, "Add Change to global BGAnimation", true, true, 0, { NULL } },
{ ScreenEdit::add_global_visualization, "Add Change to global Visualization", true, true, 0, { NULL } },
{ ScreenEdit::delete_change, "Remove Change", true, true, 0, { NULL } },
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_BGChange( "Background Change", g_BGChangeItems );
static Menu g_BackgroundChange(
"ScreenMiniMenuBackgroundChange",
MenuRow( ScreenEdit::rate, "Rate (applies to new adds)", true, true, 10, "0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%","120%","140%","160%","180%","200%" ),
MenuRow( ScreenEdit::fade_last, "Fade Last (applies to new adds)", true, true, 0, "NO","YES" ),
MenuRow( ScreenEdit::rewind_movie, "Rewind Movie (applies to new adds)", true, true, 0, "NO","YES" ),
MenuRow( ScreenEdit::loop, "Loop (applies to new adds)", true, true, 1, "NO","YES" ),
MenuRow( ScreenEdit::add_random, "Add Change to random", true, true, 0, NULL ),
MenuRow( ScreenEdit::add_song_bganimation, "Add Change to song BGAnimation", true, true, 0, NULL ),
MenuRow( ScreenEdit::add_song_movie, "Add Change to song Movie", true, true, 0, NULL ),
MenuRow( ScreenEdit::add_song_still, "Add Change to song Still", true, true, 0, NULL ),
MenuRow( ScreenEdit::add_global_random_movie, "Add Change to global Random Movie", true, true, 0, NULL ),
MenuRow( ScreenEdit::add_global_bganimation, "Add Change to global BGAnimation", true, true, 0, NULL ),
MenuRow( ScreenEdit::add_global_visualization, "Add Change to global Visualization", true, true, 0, NULL ),
MenuRow( ScreenEdit::delete_change, "Remove Change", true, true, 0, NULL )
);
static const MenuRow g_PrefsItems[] =
{
{ ScreenEdit::pref_show_bgs_play, "Show BGChanges during Play/Record", true, true, 0, { "NO","YES" } },
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_Prefs( "Preferences", g_PrefsItems );
static Menu g_Prefs(
"ScreenMiniMenuPreferences",
MenuRow( ScreenEdit::pref_show_bgs_play, "Show BGChanges during Play/Record", true, true, 0, "NO","YES" )
);
static const MenuRow g_InsertAttackItems[] =
{
{ -1, "Duration seconds", true, true, 3, { "5","10","15","20","25","30","35","40","45" } },
{ -1, "Set modifiers", true, true, 0, { "PRESS START" } },
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_InsertAttack( "Insert Attack", g_InsertAttackItems );
static Menu g_InsertAttack(
"ScreenMiniMenuInsertAttack",
MenuRow( -1, "Duration seconds", true, true, 3, "5","10","15","20","25","30","35","40","45" ),
MenuRow( -1, "Set modifiers", true, true, 0, "PRESS START" )
);
static const MenuRow g_CourseModeItems[] =
{
{ -1, "Play mods from course", true, true, 0, { NULL } },
{ -1, NULL, true, true, 0, { NULL } }
};
static Menu g_CourseMode( "Course Display", g_CourseModeItems );
static Menu g_CourseMode(
"ScreenMiniMenuCourseDisplay",
MenuRow( -1, "Play mods from course", true, true, 0, NULL )
);
// HACK: need to remember the track we're inserting on so
// that we can lay the attack note after coming back from
@@ -747,8 +729,8 @@ void ScreenEdit::UpdateTextInfo()
CString sNoteType = NoteTypeToString(m_SnapDisplay.GetNoteType()) + " notes";
CString sText;
sText += ssprintf( "Current Beat:\n %.2f\n", GAMESTATE->m_fSongBeat );
sText += ssprintf( "Current Second:\n %.2f\n", m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) );
sText += ssprintf( "Current Beat:\n %.3f\n", GAMESTATE->m_fSongBeat );
sText += ssprintf( "Current Second:\n %.3f\n", m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) );
sText += ssprintf( "Snap to:\n %s\n", sNoteType.c_str() );
sText += ssprintf( "Selection begin:\n %s\n", m_NoteFieldEdit.m_iBeginMarker==-1 ? "not set" : ssprintf("%.2f",NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker)).c_str() );
sText += ssprintf( "Selection end:\n %s\n", m_NoteFieldEdit.m_iEndMarker==-1 ? "not set" : ssprintf("%.2f",NoteRowToBeat(m_NoteFieldEdit.m_iEndMarker)).c_str() );
@@ -1030,19 +1012,19 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
{
// update enabled/disabled in g_AreaMenu
bool bAreaSelected = m_NoteFieldEdit.m_iBeginMarker!=-1 && m_NoteFieldEdit.m_iEndMarker!=-1;
g_AreaMenu.rows[cut].enabled = bAreaSelected;
g_AreaMenu.rows[copy].enabled = bAreaSelected;
g_AreaMenu.rows[paste_at_current_beat].enabled = this->m_Clipboard.GetLastBeat() != 0;
g_AreaMenu.rows[paste_at_begin_marker].enabled = this->m_Clipboard.GetLastBeat() != 0 && m_NoteFieldEdit.m_iBeginMarker!=-1;
g_AreaMenu.rows[clear].enabled = bAreaSelected;
g_AreaMenu.rows[quantize].enabled = bAreaSelected;
g_AreaMenu.rows[turn].enabled = bAreaSelected;
g_AreaMenu.rows[transform].enabled = bAreaSelected;
g_AreaMenu.rows[alter].enabled = bAreaSelected;
g_AreaMenu.rows[tempo].enabled = bAreaSelected;
g_AreaMenu.rows[play].enabled = bAreaSelected;
g_AreaMenu.rows[record].enabled = bAreaSelected;
g_AreaMenu.rows[convert_beat_to_pause].enabled = bAreaSelected;
g_AreaMenu.rows[cut].bEnabled = bAreaSelected;
g_AreaMenu.rows[copy].bEnabled = bAreaSelected;
g_AreaMenu.rows[paste_at_current_beat].bEnabled = this->m_Clipboard.GetLastBeat() != 0;
g_AreaMenu.rows[paste_at_begin_marker].bEnabled = this->m_Clipboard.GetLastBeat() != 0 && m_NoteFieldEdit.m_iBeginMarker!=-1;
g_AreaMenu.rows[clear].bEnabled = bAreaSelected;
g_AreaMenu.rows[quantize].bEnabled = bAreaSelected;
g_AreaMenu.rows[turn].bEnabled = bAreaSelected;
g_AreaMenu.rows[transform].bEnabled = bAreaSelected;
g_AreaMenu.rows[alter].bEnabled = bAreaSelected;
g_AreaMenu.rows[tempo].bEnabled = bAreaSelected;
g_AreaMenu.rows[play].bEnabled = bAreaSelected;
g_AreaMenu.rows[record].bEnabled = bAreaSelected;
g_AreaMenu.rows[convert_beat_to_pause].bEnabled = bAreaSelected;
SCREENMAN->MiniMenu( &g_AreaMenu, SM_BackFromAreaMenu );
}
break;
@@ -1224,13 +1206,13 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
PlayPreviewMusic();
break;
case EDIT_BUTTON_OPEN_BGA_MENU:
HandleMainMenuChoice( edit_bg_change, NULL );
HandleMainMenuChoice( edit_bg_change );
break;
case EDIT_BUTTON_OPEN_COURSE_MENU:
{
g_CourseMode.rows[0].choices.clear();
g_CourseMode.rows[0].choices.push_back( "OFF" );
g_CourseMode.rows[0].defaultChoice = 0;
g_CourseMode.rows[0].iDefaultChoice = 0;
vector<Course*> courses;
SONGMAN->GetAllCourses( courses, false );
@@ -1252,7 +1234,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
{
g_CourseMode.rows[0].choices.push_back( crs->GetFullDisplayTitle() );
if( crs == m_pAttacksFromCourse )
g_CourseMode.rows[0].defaultChoice = g_CourseMode.rows[0].choices.size()-1;
g_CourseMode.rows[0].iDefaultChoice = g_CourseMode.rows[0].choices.size()-1;
}
}
@@ -1260,40 +1242,40 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
break;
}
case EDIT_BUTTON_PLAY_FROM_START:
HandleMainMenuChoice( play_whole_song, NULL );
HandleMainMenuChoice( play_whole_song );
break;
case EDIT_BUTTON_PLAY_FROM_CURSOR:
HandleMainMenuChoice( play_current_beat_to_end, NULL );
HandleMainMenuChoice( play_current_beat_to_end );
break;
case EDIT_BUTTON_PLAY_SELECTION:
if( m_NoteFieldEdit.m_iBeginMarker!=-1 && m_NoteFieldEdit.m_iEndMarker!=-1 )
HandleAreaMenuChoice( play, NULL );
HandleAreaMenuChoice( play );
else
HandleMainMenuChoice( play_current_beat_to_end, NULL );
HandleMainMenuChoice( play_current_beat_to_end );
break;
case EDIT_BUTTON_RECORD:
if( m_NoteFieldEdit.m_iBeginMarker!=-1 && m_NoteFieldEdit.m_iEndMarker!=-1 )
HandleAreaMenuChoice( record, NULL );
HandleAreaMenuChoice( record );
break;
case EDIT_BUTTON_INSERT:
HandleAreaMenuChoice( insert_and_shift, NULL );
HandleAreaMenuChoice( insert_and_shift );
SCREENMAN->PlayInvalidSound();
break;
case EDIT_BUTTON_INSERT_SHIFT_PAUSES:
HandleAreaMenuChoice( shift_pauses_forward, NULL );
HandleAreaMenuChoice( shift_pauses_forward );
SCREENMAN->PlayInvalidSound();
break;
case EDIT_BUTTON_DELETE:
HandleAreaMenuChoice( delete_and_shift, NULL );
HandleAreaMenuChoice( delete_and_shift );
SCREENMAN->PlayInvalidSound();
break;
case EDIT_BUTTON_DELETE_SHIFT_PAUSES:
HandleAreaMenuChoice( shift_pauses_backward, NULL );
HandleAreaMenuChoice( shift_pauses_backward );
SCREENMAN->PlayInvalidSound();
break;
}
@@ -1462,16 +1444,16 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
GAMESTATE->m_bEditing = false;
break;
case SM_BackFromMainMenu:
HandleMainMenuChoice( (MainMenuChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_iLastAnswers );
HandleMainMenuChoice( (MainMenuChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_viLastAnswers );
break;
case SM_BackFromAreaMenu:
HandleAreaMenuChoice( (AreaMenuChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_iLastAnswers );
HandleAreaMenuChoice( (AreaMenuChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_viLastAnswers );
break;
case SM_BackFromEditNotesStatistics:
HandleEditNotesStatisticsChoice( (EditNotesStatisticsChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_iLastAnswers );
HandleEditNotesStatisticsChoice( (EditNotesStatisticsChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_viLastAnswers );
break;
case SM_BackFromEditSongInfo:
HandleEditSongInfoChoice( (EditSongInfoChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_iLastAnswers );
HandleEditSongInfoChoice( (EditSongInfoChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_viLastAnswers );
break;
case SM_BackFromBPMChange:
{
@@ -1488,15 +1470,15 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
}
break;
case SM_BackFromBGChange:
HandleBGChangeChoice( (BGChangeChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_iLastAnswers );
HandleBGChangeChoice( (BGChangeChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_viLastAnswers );
break;
case SM_BackFromPrefs:
PREFSMAN->m_bEditorShowBGChangesPlay = !!ScreenMiniMenu::s_iLastAnswers[pref_show_bgs_play];
PREFSMAN->m_bEditorShowBGChangesPlay = !!ScreenMiniMenu::s_viLastAnswers[pref_show_bgs_play];
PREFSMAN->SaveGlobalPrefsToDisk();
break;
case SM_BackFromCourseModeMenu:
{
const int num = ScreenMiniMenu::s_iLastAnswers[0];
const int num = ScreenMiniMenu::s_viLastAnswers[0];
m_pAttacksFromCourse = NULL;
if( num != 0 )
{
@@ -1517,8 +1499,8 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
break;
case SM_BackFromInsertAttack:
{
int iDurationChoice = ScreenMiniMenu::s_iLastAnswers[0];
g_fLastInsertAttackDurationSeconds = strtof( g_InsertAttackItems[0].choices[iDurationChoice], NULL );
int iDurationChoice = ScreenMiniMenu::s_viLastAnswers[0];
g_fLastInsertAttackDurationSeconds = strtof( g_InsertAttack.rows[0].choices[iDurationChoice], NULL );
GAMESTATE->StoreSelectedOptions(); // save so that we don't lose the options chosen for edit and playback
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertAttackModifiers );
}
@@ -1556,7 +1538,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{
case ANSWER_YES:
// This will send SM_Success or SM_Failure.
HandleMainMenuChoice( ScreenEdit::save_on_exit, NULL );
HandleMainMenuChoice( ScreenEdit::save_on_exit );
return;
case ANSWER_NO:
/* Don't save; just exit. */
@@ -1691,7 +1673,7 @@ void ChangeArtistTranslit( CString sNew )
// End helper functions
void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers )
void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAnswers )
{
switch( c )
{
@@ -1702,8 +1684,8 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers )
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
float fMusicSeconds = m_soundMusic.GetLengthSeconds();
g_EditNotesStatistics.rows[difficulty].defaultChoice = pSteps->GetDifficulty();
g_EditNotesStatistics.rows[meter].defaultChoice = clamp( pSteps->GetMeter()-1, 0, 14 );
g_EditNotesStatistics.rows[difficulty].iDefaultChoice = pSteps->GetDifficulty();
g_EditNotesStatistics.rows[meter].iDefaultChoice = clamp( pSteps->GetMeter()-1, 0, 14 );
g_EditNotesStatistics.rows[predict_meter].choices.resize(1);g_EditNotesStatistics.rows[predict_meter].choices[0] = ssprintf("%f",pSteps->PredictMeter());
g_EditNotesStatistics.rows[description].choices.resize(1); g_EditNotesStatistics.rows[description].choices[0] = pSteps->GetDescription();
g_EditNotesStatistics.rows[tap_notes].choices.resize(1); g_EditNotesStatistics.rows[tap_notes].choices[0] = ssprintf("%d", m_NoteDataEdit.GetNumTapNotes());
@@ -1721,14 +1703,14 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers )
{
m_NoteFieldEdit.m_iBeginMarker = 0;
m_NoteFieldEdit.m_iEndMarker = m_NoteDataEdit.GetLastRow();
HandleAreaMenuChoice( play, NULL );
HandleAreaMenuChoice( play );
}
break;
case play_current_beat_to_end:
{
m_NoteFieldEdit.m_iBeginMarker = BeatToNoteRow(GAMESTATE->m_fSongBeat);
m_NoteFieldEdit.m_iEndMarker = m_NoteDataEdit.GetLastRow();
HandleAreaMenuChoice( play, NULL );
HandleAreaMenuChoice( play );
}
break;
case save:
@@ -1825,24 +1807,24 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers )
//
// m_pSong->GetSongDir() has trailing slash
g_BGChange.rows[add_song_bganimation].choices.clear();
GetDirListing( m_pSong->GetSongDir()+"*", g_BGChange.rows[add_song_bganimation].choices, true );
g_BackgroundChange.rows[add_song_bganimation].choices.clear();
GetDirListing( m_pSong->GetSongDir()+"*", g_BackgroundChange.rows[add_song_bganimation].choices, true );
g_BGChange.rows[add_song_movie].choices.clear();
GetDirListing( m_pSong->GetSongDir()+"*.avi", g_BGChange.rows[add_song_movie].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.mpg", g_BGChange.rows[add_song_movie].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.mpeg", g_BGChange.rows[add_song_movie].choices, false );
g_BackgroundChange.rows[add_song_movie].choices.clear();
GetDirListing( m_pSong->GetSongDir()+"*.avi", g_BackgroundChange.rows[add_song_movie].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.mpg", g_BackgroundChange.rows[add_song_movie].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.mpeg", g_BackgroundChange.rows[add_song_movie].choices, false );
g_BGChange.rows[add_song_still].choices.clear();
GetDirListing( m_pSong->GetSongDir()+"*.png", g_BGChange.rows[add_song_still].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.jpg", g_BGChange.rows[add_song_still].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.gif", g_BGChange.rows[add_song_still].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.bmp", g_BGChange.rows[add_song_still].choices, false );
g_BackgroundChange.rows[add_song_still].choices.clear();
GetDirListing( m_pSong->GetSongDir()+"*.png", g_BackgroundChange.rows[add_song_still].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.jpg", g_BackgroundChange.rows[add_song_still].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.gif", g_BackgroundChange.rows[add_song_still].choices, false );
GetDirListing( m_pSong->GetSongDir()+"*.bmp", g_BackgroundChange.rows[add_song_still].choices, false );
g_BGChange.rows[add_global_random_movie].choices.clear();
GetDirListing( RANDOMMOVIES_DIR+"*.avi", g_BGChange.rows[add_global_random_movie].choices, false );
GetDirListing( RANDOMMOVIES_DIR+"*.mpg", g_BGChange.rows[add_global_random_movie].choices, false );
GetDirListing( RANDOMMOVIES_DIR+"*.mpeg", g_BGChange.rows[add_global_random_movie].choices, false );
g_BackgroundChange.rows[add_global_random_movie].choices.clear();
GetDirListing( RANDOMMOVIES_DIR+"*.avi", g_BackgroundChange.rows[add_global_random_movie].choices, false );
GetDirListing( RANDOMMOVIES_DIR+"*.mpg", g_BackgroundChange.rows[add_global_random_movie].choices, false );
GetDirListing( RANDOMMOVIES_DIR+"*.mpeg", g_BackgroundChange.rows[add_global_random_movie].choices, false );
vector<CString> vSubDirs;
GetDirListing( RANDOMMOVIES_DIR+"*", vSubDirs, true );
@@ -1856,16 +1838,16 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers )
GetDirListing( RANDOMMOVIES_DIR+sSubDir+"/*.mpeg", vsMovies, false );
FOREACH_CONST( CString, vsMovies, m )
g_BGChange.rows[add_global_random_movie].choices.push_back( sSubDir +"/"+ *m );
g_BackgroundChange.rows[add_global_random_movie].choices.push_back( sSubDir +"/"+ *m );
}
g_BGChange.rows[add_global_bganimation].choices.clear();
GetDirListing( BG_ANIMS_DIR+"*", g_BGChange.rows[add_global_bganimation].choices, true );
g_BackgroundChange.rows[add_global_bganimation].choices.clear();
GetDirListing( BG_ANIMS_DIR+"*", g_BackgroundChange.rows[add_global_bganimation].choices, true );
g_BGChange.rows[add_global_visualization].choices.clear();
GetDirListing( VISUALIZATIONS_DIR+"*.avi", g_BGChange.rows[add_global_visualization].choices, false );
GetDirListing( VISUALIZATIONS_DIR+"*.mpg", g_BGChange.rows[add_global_visualization].choices, false );
GetDirListing( VISUALIZATIONS_DIR+"*.mpeg", g_BGChange.rows[add_global_visualization].choices, false );
g_BackgroundChange.rows[add_global_visualization].choices.clear();
GetDirListing( VISUALIZATIONS_DIR+"*.avi", g_BackgroundChange.rows[add_global_visualization].choices, false );
GetDirListing( VISUALIZATIONS_DIR+"*.mpg", g_BackgroundChange.rows[add_global_visualization].choices, false );
GetDirListing( VISUALIZATIONS_DIR+"*.mpeg", g_BackgroundChange.rows[add_global_visualization].choices, false );
//
@@ -1882,34 +1864,34 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers )
}
}
g_BGChange.rows[add_random].enabled = true;
g_BGChange.rows[add_song_bganimation].enabled = g_BGChange.rows[add_song_bganimation].choices.size() > 0;
g_BGChange.rows[add_song_movie].enabled = g_BGChange.rows[add_song_movie].choices.size() > 0;
g_BGChange.rows[add_song_still].enabled = g_BGChange.rows[add_song_still].choices.size() > 0;
g_BGChange.rows[add_global_random_movie].enabled = g_BGChange.rows[add_global_random_movie].choices.size() > 0;
g_BGChange.rows[add_global_bganimation].enabled = g_BGChange.rows[add_global_bganimation].choices.size() > 0;
g_BGChange.rows[add_global_visualization].enabled = g_BGChange.rows[add_global_visualization].choices.size() > 0;
g_BGChange.rows[delete_change].enabled = bAlreadyBGChangeHere;
g_BackgroundChange.rows[add_random].bEnabled = true;
g_BackgroundChange.rows[add_song_bganimation].bEnabled = g_BackgroundChange.rows[add_song_bganimation].choices.size() > 0;
g_BackgroundChange.rows[add_song_movie].bEnabled = g_BackgroundChange.rows[add_song_movie].choices.size() > 0;
g_BackgroundChange.rows[add_song_still].bEnabled = g_BackgroundChange.rows[add_song_still].choices.size() > 0;
g_BackgroundChange.rows[add_global_random_movie].bEnabled = g_BackgroundChange.rows[add_global_random_movie].choices.size() > 0;
g_BackgroundChange.rows[add_global_bganimation].bEnabled = g_BackgroundChange.rows[add_global_bganimation].choices.size() > 0;
g_BackgroundChange.rows[add_global_visualization].bEnabled = g_BackgroundChange.rows[add_global_visualization].choices.size() > 0;
g_BackgroundChange.rows[delete_change].bEnabled = bAlreadyBGChangeHere;
// set default choices
g_BGChange.rows[rate]. SetDefaultChoiceIfPresent( ssprintf("%2.0f%%",bgChange.m_fRate*100) );
g_BGChange.rows[fade_last].defaultChoice = bgChange.m_bFadeLast ? 1 : 0;
g_BGChange.rows[rewind_movie].defaultChoice = bgChange.m_bRewindMovie ? 1 : 0;
g_BGChange.rows[loop].defaultChoice = bgChange.m_bLoop ? 1 : 0;
g_BGChange.rows[add_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BGChange.rows[add_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BGChange.rows[add_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BGChange.rows[add_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BGChange.rows[add_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BGChange.rows[add_global_visualization]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BackgroundChange.rows[rate]. SetDefaultChoiceIfPresent( ssprintf("%2.0f%%",bgChange.m_fRate*100) );
g_BackgroundChange.rows[fade_last].iDefaultChoice = bgChange.m_bFadeLast ? 1 : 0;
g_BackgroundChange.rows[rewind_movie].iDefaultChoice = bgChange.m_bRewindMovie ? 1 : 0;
g_BackgroundChange.rows[loop].iDefaultChoice = bgChange.m_bLoop ? 1 : 0;
g_BackgroundChange.rows[add_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BackgroundChange.rows[add_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BackgroundChange.rows[add_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BackgroundChange.rows[add_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BackgroundChange.rows[add_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
g_BackgroundChange.rows[add_global_visualization]. SetDefaultChoiceIfPresent( bgChange.m_sBGName );
SCREENMAN->MiniMenu( &g_BGChange, SM_BackFromBGChange );
SCREENMAN->MiniMenu( &g_BackgroundChange, SM_BackFromBGChange );
}
break;
case preferences:
g_Prefs.rows[pref_show_bgs_play].defaultChoice = PREFSMAN->m_bEditorShowBGChangesPlay;
g_Prefs.rows[pref_show_bgs_play].iDefaultChoice = PREFSMAN->m_bEditorShowBGChangesPlay;
SCREENMAN->MiniMenu( &g_Prefs, SM_BackFromPrefs );
break;
@@ -1928,14 +1910,14 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers )
};
}
void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, const vector<int> &iAnswers )
{
switch( c )
{
case cut:
{
HandleAreaMenuChoice( copy, NULL );
HandleAreaMenuChoice( clear, NULL );
HandleAreaMenuChoice( copy );
HandleAreaMenuChoice( clear );
}
break;
case copy:
@@ -1972,7 +1954,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
case turn:
{
const NoteData OldClipboard( m_Clipboard );
HandleAreaMenuChoice( cut, NULL );
HandleAreaMenuChoice( cut );
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
TurnType tt = (TurnType)iAnswers[c];
@@ -1986,7 +1968,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
default: ASSERT(0);
}
HandleAreaMenuChoice( paste_at_begin_marker, NULL );
HandleAreaMenuChoice( paste_at_begin_marker );
m_Clipboard = OldClipboard;
}
break;
@@ -2026,7 +2008,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
case alter:
{
const NoteData OldClipboard( m_Clipboard );
HandleAreaMenuChoice( cut, NULL );
HandleAreaMenuChoice( cut );
AlterType at = (AlterType)iAnswers[c];
switch( at )
@@ -2044,7 +2026,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
default: ASSERT(0);
}
HandleAreaMenuChoice( paste_at_begin_marker, NULL );
HandleAreaMenuChoice( paste_at_begin_marker );
m_Clipboard = OldClipboard;
}
break;
@@ -2052,7 +2034,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
{
// This affects all steps.
const NoteData OldClipboard( m_Clipboard );
HandleAreaMenuChoice( cut, NULL );
HandleAreaMenuChoice( cut );
AlterType at = (AlterType)iAnswers[c];
float fScale = -1;
@@ -2085,7 +2067,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
NoteDataUtil::ShiftRows( m_NoteDataEdit, m_NoteFieldEdit.m_iBeginMarker, iDeltaBeats );
m_pSong->m_Timing.ScaleRegion( fScale, m_NoteFieldEdit.m_iBeginMarker, m_NoteFieldEdit.m_iEndMarker );
HandleAreaMenuChoice( paste_at_begin_marker, NULL );
HandleAreaMenuChoice( paste_at_begin_marker );
const vector<Steps*> sIter = m_pSong->GetAllSteps();
CString sTempStyle, sTempDiff;
@@ -2283,7 +2265,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
}
void ScreenEdit::HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, int* iAnswers )
void ScreenEdit::HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, const vector<int> &iAnswers )
{
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
Difficulty dc = (Difficulty)iAnswers[difficulty];
@@ -2299,7 +2281,7 @@ void ScreenEdit::HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, i
}
}
void ScreenEdit::HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers )
void ScreenEdit::HandleEditSongInfoChoice( EditSongInfoChoice c, const vector<int> &iAnswers )
{
Song* pSong = GAMESTATE->m_pCurSong;
@@ -2331,7 +2313,7 @@ void ScreenEdit::HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers )
};
}
void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, int* iAnswers )
void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, const vector<int> &iAnswers )
{
BackgroundChange newChange;
@@ -2359,7 +2341,7 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, int* iAnswers )
case add_global_random_movie:
case add_global_bganimation:
case add_global_visualization:
newChange.m_sBGName = g_BGChange.rows[c].choices[iAnswers[c]];
newChange.m_sBGName = g_BackgroundChange.rows[c].choices[iAnswers[c]];
break;
case delete_change:
newChange.m_sBGName = "";
@@ -2368,7 +2350,7 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, int* iAnswers )
break;
};
newChange.m_fRate = strtof( g_BGChange.rows[rate].choices[iAnswers[rate]], NULL )/100.f;
newChange.m_fRate = strtof( g_BackgroundChange.rows[rate].choices[iAnswers[rate]], NULL )/100.f;
newChange.m_bFadeLast = !!iAnswers[fade_last];
newChange.m_bRewindMovie = !!iAnswers[rewind_movie];
newChange.m_bLoop = !!iAnswers[loop];
+7 -5
View File
@@ -221,7 +221,8 @@ public:
NUM_MAIN_MENU_CHOICES,
MAIN_MENU_CHOICE_INVALID
};
void HandleMainMenuChoice( MainMenuChoice c, int* iAnswers );
void HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAnswers );
void HandleMainMenuChoice( MainMenuChoice c ) { const vector<int> v; HandleMainMenuChoice( c, v ); }
MainMenuChoice m_CurrentAction;
enum AreaMenuChoice {
@@ -245,7 +246,8 @@ public:
convert_pause_to_beat,
NUM_AREA_MENU_CHOICES
};
void HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers );
void HandleAreaMenuChoice( AreaMenuChoice c, const vector<int> &iAnswers );
void HandleAreaMenuChoice( AreaMenuChoice c ) { const vector<int> v; HandleAreaMenuChoice( c, v ); }
enum TurnType
{
left,
@@ -315,7 +317,7 @@ public:
chaos,
NUM_EDIT_NOTES_STATISTICS_CHOICES
};
void HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, int* iAnswers );
void HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, const vector<int> &iAnswers );
enum EditSongInfoChoice {
main_title,
@@ -327,7 +329,7 @@ public:
artist_transliteration,
NUM_EDIT_SONG_INFO_CHOICES
};
void HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers );
void HandleEditSongInfoChoice( EditSongInfoChoice c, const vector<int> &iAnswers );
enum BGChangeChoice {
rate,
@@ -349,7 +351,7 @@ public:
pref_show_bgs_play,
NUM_PREFS_CHOICES
};
void HandleBGChangeChoice( BGChangeChoice c, int* iAnswers );
void HandleBGChangeChoice( BGChangeChoice c, const vector<int> &iAnswers );
void InitEditMappings();
bool DeviceToEdit( DeviceInput DeviceI, EditButton &button ) const;
+8 -2
View File
@@ -279,6 +279,8 @@ Screen* ScreenManager::MakeNewScreenInternal( const CString &sScreenName )
LOG->Trace( "Loaded '%s' ('%s') in %f", sScreenName.c_str(), sClassName.c_str(), t.GetDeltaTime());
this->ZeroNextUpdate();
return ret;
}
@@ -484,6 +486,7 @@ void ScreenManager::Prompt( ScreenMessage SM_SendWhenDone, const CString &sText,
// add the new state onto the back of the array
Screen *pNewScreen = new ScreenPrompt( sText, type, defaultAnswer, OnYes, OnNo, pCallbackData);
pNewScreen->Init();
this->ZeroNextUpdate();
SetFromNewScreen( pNewScreen, true );
m_MessageSendOnPop = SM_SendWhenDone;
@@ -497,6 +500,7 @@ void ScreenManager::TextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion,
// add the new state onto the back of the array
Screen *pNewScreen = new ScreenTextEntry( "ScreenTextEntry", sQuestion, sInitialAnswer, OnOK, OnCancel );
pNewScreen->Init();
this->ZeroNextUpdate();
SetFromNewScreen( pNewScreen, true );
m_MessageSendOnPop = SM_SendWhenDone;
@@ -510,6 +514,7 @@ void ScreenManager::Password( ScreenMessage SM_SendWhenDone, const CString &sTex
// add the new state onto the back of the array
Screen *pNewScreen = new ScreenTextEntry( "ScreenTextEntry", sText, "", OnOK, OnCancel, true );
pNewScreen->Init();
this->ZeroNextUpdate();
SetFromNewScreen( pNewScreen, true );
m_MessageSendOnPop = SM_SendWhenDone;
@@ -521,8 +526,9 @@ void ScreenManager::MiniMenu( Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessa
m_ScreenStack.back()->HandleScreenMessage( SM_LoseFocus );
// add the new state onto the back of the array
Screen *pNewScreen = new ScreenMiniMenu( pDef, SM_SendOnOK, SM_SendOnCancel );
pNewScreen->Init();
ScreenMiniMenu *pNewScreen = new ScreenMiniMenu( pDef->sClassName );
pNewScreen->Init( pDef, SM_SendOnOK, SM_SendOnCancel );
this->ZeroNextUpdate();
SetFromNewScreen( pNewScreen, true );
}
+59 -282
View File
@@ -9,326 +9,103 @@
#include "Foreach.h"
#include "ScreenDimensions.h"
#include "CommonMetrics.h"
const float LABEL_X = 200;
const float ANSWER_X = 440;
const float SPACING_Y = 26;
const float ZOOM_SELECTED = 0.7f;
const float ZOOM_NOT_SELECTED = 0.5f;
const RageColor COLOR_ENABLED = RageColor(1,1,1,1);
const RageColor COLOR_DISABLED = RageColor(0.5f,0.5f,0.5f,1);
#include "GameState.h"
const ScreenMessage SM_GoToOK = (ScreenMessage)(SM_User+1);
const ScreenMessage SM_GoToCancel = (ScreenMessage)(SM_User+2);
int ScreenMiniMenu::s_iLastRowCode;
int ScreenMiniMenu::s_iLastAnswers[MAX_MENU_ROWS];
int ScreenMiniMenu::s_iLastRowCode = -1;
vector<int> ScreenMiniMenu::s_viLastAnswers;
//REGISTER_SCREEN_CLASS( ScreenMiniMenu );
ScreenMiniMenu::ScreenMiniMenu( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel ) :
Screen("ScreenMiniMenu")
ScreenMiniMenu::ScreenMiniMenu( CString sClassName ) :ScreenOptions( sClassName )
{
}
void ScreenMiniMenu::Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel )
{
ScreenOptions::Init();
m_Background.Load( THEME->GetPathB(m_sName,"background") );
m_Background->SetDrawOrder( DRAW_ORDER_BEFORE_EVERYTHING );
this->AddChild( m_Background );
m_Background->PlayCommand( "On" );
this->SortByDrawOrder();
m_bIsTransparent = true; // draw screens below us
m_SMSendOnOK = SM_SendOnOK;
m_SMSendOnCancel = SM_SendOnCancel;
m_Def = *pDef;
ASSERT( m_Def.rows.size() <= MAX_MENU_ROWS );
// Remove rows that aren't applicable to HomeEditMode.
if( HOME_EDIT_MODE )
FOREACH_CONST( MenuRow, pDef->rows, r )
{
for( int i=((int)m_Def.rows.size())-1; i>=0; i-- )
{
if( !m_Def.rows[i].bShowInHomeEditMode )
m_Def.rows.erase( m_Def.rows.begin()+i );
}
// Don't add rows that aren't applicable to HomeEditMode.
if( !HOME_EDIT_MODE || r->bShowInHomeEditMode )
m_vMenuRows.push_back( *r );
}
m_Background.LoadFromAniDir( THEME->GetPathB("ScreenMiniMenu","background") );
m_Background.PlayCommand("On");
this->AddChild( &m_Background );
float fHeightOfAll = min( SCREEN_HEIGHT-80, (m_Def.rows.size()-1)*SPACING_Y );
m_textTitle.LoadFromFont( THEME->GetPathF("Common","normal") );
m_textTitle.SetText( m_Def.title );
m_textTitle.SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y - fHeightOfAll/2 - 30 );
m_textTitle.SetZoom( 0.8f );
this->AddChild( &m_textTitle );
m_sndChangeRow.Load( THEME->GetPathS("ScreenMiniMenu","row"), true );
m_sndChangeValue.Load( THEME->GetPathS("ScreenMiniMenu","value"), true );
bool bMarkedFirstEnabledLine = false;
m_iCurLine = 0;
float fLongestLabelPlusAnswer = 0;
for( unsigned i=0; i<m_Def.rows.size(); i++ )
// Convert from m_vMenuRows to vector<OptionRowDefinition>
vector<OptionRowDefinition> vDefs;
vDefs.resize( m_vMenuRows.size() );
for( unsigned r=0; r<m_vMenuRows.size(); r++ )
{
MenuRowInternal& line = m_Def.rows[i];
m_iCurAnswers[i] = 0;
const MenuRow &mr = m_vMenuRows[r];
OptionRowDefinition &ord = vDefs[r];
float fY;
if( m_Def.rows.size() > 1 )
fY = SCALE( i, 0.f, m_Def.rows.size()-1.f, SCREEN_CENTER_Y-fHeightOfAll/2, SCREEN_CENTER_Y+fHeightOfAll/2 );
ord.name = mr.sName;
if( mr.bEnabled )
{
ord.m_vEnabledForPlayers.clear();
FOREACH_EnabledPlayer( pn )
ord.m_vEnabledForPlayers.insert( pn );
}
else
fY = SCREEN_CENTER_Y;
m_textLabel[i].LoadFromFont( THEME->GetPathF("Common","normal") );
m_textLabel[i].SetText( line.name );
m_textLabel[i].SetY( fY );
m_textLabel[i].SetZoom( ZOOM_NOT_SELECTED );
m_textLabel[i].SetHorizAlign( Actor::align_left );
m_textLabel[i].SetDiffuse( line.enabled ? COLOR_ENABLED : COLOR_DISABLED );
this->AddChild( &m_textLabel[i] );
m_textAnswer[i].LoadFromFont( THEME->GetPathF("Common","normal") );
m_textAnswer[i].SetY( fY );
m_textAnswer[i].SetZoom( ZOOM_NOT_SELECTED );
m_textAnswer[i].SetHorizAlign( Actor::align_right );
m_textAnswer[i].SetDiffuse( line.enabled ? COLOR_ENABLED : COLOR_DISABLED );
this->AddChild( &m_textAnswer[i] );
for( unsigned j = 0; j < line.choices.size(); ++j )
{
m_textAnswer[i].SetText( line.choices[j] );
fLongestLabelPlusAnswer = max(
fLongestLabelPlusAnswer,
m_textLabel[i].GetUnzoomedWidth() * ZOOM_SELECTED +
m_textAnswer[i].GetUnzoomedWidth() * ZOOM_SELECTED );
ord.m_vEnabledForPlayers.clear();
}
ASSERT_M( line.choices.empty() || line.defaultChoice < (int) line.choices.size(),
ssprintf("%i, %i", line.defaultChoice, (int) line.choices.size()) );
CString sText = line.choices.empty() ? CString("") : line.choices[line.defaultChoice];
m_textAnswer[i].SetText( sText );
if( !bMarkedFirstEnabledLine && line.enabled )
{
m_iCurLine = i;
AfterLineChanged();
bMarkedFirstEnabledLine = true;
}
m_iCurAnswers[i] = line.defaultChoice;
ord.bOneChoiceForAllPlayers = true;
ord.selectType = SELECT_ONE;
ord.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
ord.m_bExportOnChange = false;
ord.choices = mr.choices;
}
// adjust text spacing based on widest line
float fLabelX = LABEL_X;
float fAnswerX = ANSWER_X;
float fDefaultWidth = ANSWER_X - LABEL_X;
if( fLongestLabelPlusAnswer+20 > fDefaultWidth )
{
float fIncreaseBy = fLongestLabelPlusAnswer - fDefaultWidth + 20;
fLabelX -= fIncreaseBy/2;
fAnswerX += fIncreaseBy/2;
}
vector<OptionRowHandler*> vHands;
vHands.resize( vDefs.size(), NULL );
for( unsigned k=0; k<m_Def.rows.size(); k++ )
{
m_textLabel[k].SetX( fLabelX );
m_textAnswer[k].SetX( fAnswerX );
}
m_In.Load( THEME->GetPathB("ScreenMiniMenu","in") );
m_In.StartTransitioning();
this->AddChild( &m_In );
m_Out.Load( THEME->GetPathB("ScreenMiniMenu","out") );
this->AddChild( &m_Out );
ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
}
void ScreenMiniMenu::Update( float fDeltaTime )
void ScreenMiniMenu::ImportOptions( int r, PlayerNumber pn )
{
Screen::Update( fDeltaTime );
OptionRow &or = *m_Rows[r];
MenuRow &mr = m_vMenuRows[r];
if( !mr.choices.empty() )
or.SetOneSharedSelection( mr.iDefaultChoice );
}
void ScreenMiniMenu::DrawPrimitives()
void ScreenMiniMenu::ExportOptions( int r, PlayerNumber pn )
{
Screen::DrawPrimitives();
if( r == GetCurrentRow() )
s_iLastRowCode = m_vMenuRows[r].iRowCode;
s_viLastAnswers.resize( m_vMenuRows.size() );
s_viLastAnswers[r] = m_Rows[r]->GetOneSharedSelection( true );
}
void ScreenMiniMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
void ScreenMiniMenu::GoToNextScreen()
{
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
return;
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
SCREENMAN->PopTopScreen( m_SMSendOnOK );
}
void ScreenMiniMenu::HandleScreenMessage( const ScreenMessage SM )
void ScreenMiniMenu::GoToPrevScreen()
{
switch( SM )
{
case SM_GoToOK:
SCREENMAN->PopTopScreen( m_SMSendOnOK );
break;
case SM_GoToCancel:
SCREENMAN->PopTopScreen( m_SMSendOnCancel );
break;
}
SCREENMAN->PopTopScreen( m_SMSendOnCancel );
}
void ScreenMiniMenu::MenuUp( PlayerNumber pn, const InputEventType type )
{
if( GetGoUpSpot() != -1 )
{
BeforeLineChanged();
m_iCurLine = GetGoUpSpot();
AfterLineChanged();
}
}
void ScreenMiniMenu::MenuDown( PlayerNumber pn, const InputEventType type )
{
if( GetGoDownSpot() != -1 )
{
BeforeLineChanged();
m_iCurLine = GetGoDownSpot();
AfterLineChanged();
}
}
void ScreenMiniMenu::MenuLeft( PlayerNumber pn, const InputEventType type )
{
if( CanGoLeft() )
{
m_iCurAnswers[m_iCurLine]--;
AfterAnswerChanged();
}
}
void ScreenMiniMenu::MenuRight( PlayerNumber pn, const InputEventType type )
{
if( CanGoRight() )
{
m_iCurAnswers[m_iCurLine]++;
AfterAnswerChanged();
}
}
void ScreenMiniMenu::MenuStart( PlayerNumber pn, const InputEventType type )
{
m_Out.StartTransitioning( SM_GoToOK );
SCREENMAN->PlayStartSound();
s_iLastRowCode = m_Def.rows[m_iCurLine].iRowCode;
COPY( s_iLastAnswers, m_iCurAnswers );
}
void ScreenMiniMenu::MenuBack( PlayerNumber pn )
{
m_Out.StartTransitioning( SM_GoToCancel );
}
void ScreenMiniMenu::BeforeLineChanged()
{
m_textLabel[m_iCurLine].SetEffectNone();
m_textAnswer[m_iCurLine].SetEffectNone();
m_textLabel[m_iCurLine].SetZoom( ZOOM_NOT_SELECTED );
m_textAnswer[m_iCurLine].SetZoom( ZOOM_NOT_SELECTED );
m_sndChangeRow.Play();
}
void ScreenMiniMenu::AfterLineChanged()
{
m_textLabel[m_iCurLine].SetEffectGlowShift( 1.0f, RageColor(0,0.5f,0,1), RageColor(0,1,0,1) );
m_textAnswer[m_iCurLine].SetEffectGlowShift( 1.0f, RageColor(0,0.5f,0,1), RageColor(0,1,0,1) );
m_textLabel[m_iCurLine].SetZoom( ZOOM_SELECTED );
m_textAnswer[m_iCurLine].SetZoom( ZOOM_SELECTED );
}
void ScreenMiniMenu::AfterAnswerChanged()
{
m_sndChangeValue.Play();
int iAnswerInRow = m_iCurAnswers[m_iCurLine];
CString sAnswerText = m_Def.rows[m_iCurLine].choices[iAnswerInRow];
m_textAnswer[m_iCurLine].SetText( sAnswerText );
}
int ScreenMiniMenu::GetGoUpSpot()
{
for( int i=m_iCurLine-1; i>=0; i-- )
if( m_Def.rows[i].enabled )
return i;
// wrap
for( int i=m_Def.rows.size()-1; i>=0; i-- )
if( m_Def.rows[i].enabled )
return i;
return -1;
}
int ScreenMiniMenu::GetGoDownSpot()
{
for( unsigned i=m_iCurLine+1; i<m_Def.rows.size(); i++ )
if( m_Def.rows[i].enabled )
return i;
// wrap
for( unsigned i=0; i<m_Def.rows.size(); i++ )
if( m_Def.rows[i].enabled )
return i;
return -1;
}
bool ScreenMiniMenu::CanGoLeft()
{
int iNumInCurRow = m_Def.rows[m_iCurLine].choices.size();
if( iNumInCurRow==0 )
return false;
else
return m_iCurAnswers[m_iCurLine] != 0;
}
bool ScreenMiniMenu::CanGoRight()
{
int iNumInCurRow = m_Def.rows[m_iCurLine].choices.size();
if( iNumInCurRow==0 )
return false;
else
return m_iCurAnswers[m_iCurLine] != iNumInCurRow-1;
}
Menu::Menu( CString t, const MenuRow *rowp )
{
title = t;
for( int i = 0; rowp[i].name; ++i )
rows.push_back( rowp[i] );
}
MenuRowInternal::MenuRowInternal( const MenuRow &r )
{
iRowCode = r.iRowCode;
name = r.name;
enabled = r.enabled;
defaultChoice = r.defaultChoice;
bShowInHomeEditMode = r.bShowInHomeEditMode;
#define PUSH( c ) if(c!=NULL) choices.push_back(c);
for( unsigned i = 0; i < ARRAYSIZE(r.choices); ++i )
PUSH( r.choices[i] );
#undef PUSH
}
void MenuRowInternal::SetDefaultChoiceIfPresent( const CString &s )
{
FOREACH( CString, choices, c )
{
if( *c == s )
{
defaultChoice = c - choices.begin();
return;
}
}
}
/*
* (c) 2003-2004 Chris Danford
+41 -67
View File
@@ -3,105 +3,79 @@
#ifndef SCREEN_MINI_MENU_H
#define SCREEN_MINI_MENU_H
#include "Screen.h"
#include "ScreenOptions.h"
#include "BitmapText.h"
#include "Transition.h"
#include "Quad.h"
#include "RageSound.h"
#include "BGAnimation.h"
#define MAX_MENU_ROWS 40
struct MenuRow
{
int iRowCode;
const char *name;
bool enabled;
CString sName;
bool bEnabled;
bool bShowInHomeEditMode;
int defaultChoice;
const char *choices[32];
};
struct MenuRowInternal
{
int iRowCode;
CString name;
bool enabled;
bool bShowInHomeEditMode;
int defaultChoice;
int iDefaultChoice;
vector<CString> choices;
MenuRowInternal()
MenuRow() {}
MenuRow( int r, CString n, bool e, bool s, int d, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL )
{
iRowCode = -1;
enabled = true;
bShowInHomeEditMode = true;
defaultChoice = 0;
iRowCode = r; sName = n; bEnabled = e; bShowInHomeEditMode = s; iDefaultChoice = d;
#define PUSH( c ) if(c) choices.push_back(c);
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);
#undef PUSH
}
MenuRowInternal( const MenuRow &r );
void SetDefaultChoiceIfPresent( const CString &s );
void SetDefaultChoiceIfPresent( CString sChoice )
{
iDefaultChoice = 0;
FOREACH_CONST( CString, choices, s )
if( sChoice == *s )
iDefaultChoice = s - choices.begin();
}
};
struct Menu
{
CString title;
vector<MenuRowInternal> rows;
CString sClassName;
vector<MenuRow> rows;
Menu() {}
Menu( CString t, const MenuRow *rows );
Menu( CString c, MenuRow r0=MenuRow(), MenuRow r1=MenuRow(), MenuRow r2=MenuRow(), MenuRow r3=MenuRow(), MenuRow r4=MenuRow(), MenuRow r5=MenuRow(), MenuRow r6=MenuRow(), MenuRow r7=MenuRow(), MenuRow r8=MenuRow(), MenuRow r9=MenuRow(), MenuRow r10=MenuRow(), MenuRow r11=MenuRow(), MenuRow r12=MenuRow(), MenuRow r13=MenuRow(), MenuRow r14=MenuRow(), MenuRow r15=MenuRow(), MenuRow r16=MenuRow(), MenuRow r17=MenuRow(), MenuRow r18=MenuRow(), MenuRow r19=MenuRow(), MenuRow r20=MenuRow(), MenuRow r21=MenuRow(), MenuRow r22=MenuRow(), MenuRow r23=MenuRow(), MenuRow r24=MenuRow(), MenuRow r25=MenuRow(), MenuRow r26=MenuRow(), MenuRow r27=MenuRow(), MenuRow r28=MenuRow(), MenuRow r29=MenuRow() )
{
sClassName = c;
#define PUSH( r ) if(!r.sName.empty()) rows.push_back(r);
PUSH(r0);PUSH(r1);PUSH(r2);PUSH(r3);PUSH(r4);PUSH(r5);PUSH(r6);PUSH(r7);PUSH(r8);PUSH(r9);PUSH(r10);PUSH(r11);PUSH(r12);PUSH(r13);PUSH(r14);PUSH(r15);PUSH(r16);PUSH(r17);PUSH(r18);PUSH(r19);PUSH(r20);PUSH(r21);PUSH(r22);PUSH(r23);PUSH(r24);PUSH(r25);PUSH(r26);PUSH(r27);PUSH(r28);PUSH(r29);
#undef PUSH
}
};
class ScreenMiniMenu : public Screen
class ScreenMiniMenu : public ScreenOptions
{
public:
ScreenMiniMenu( CString sName );
ScreenMiniMenu( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel );
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void HandleScreenMessage( const ScreenMessage SM );
ScreenMiniMenu( CString sScreenClass );
void Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel );
protected:
void MenuUp( PlayerNumber pn, const InputEventType type );
void MenuDown( PlayerNumber pn, const InputEventType type );
void MenuLeft( PlayerNumber pn, const InputEventType type );
void MenuRight( PlayerNumber pn, const InputEventType type );
void MenuBack( PlayerNumber pn );
void MenuStart( PlayerNumber pn, const InputEventType type );
virtual void ImportOptions( int row, PlayerNumber pn );
virtual void ExportOptions( int row, PlayerNumber pn );
virtual void GoToNextScreen();
virtual void GoToPrevScreen();
int GetGoUpSpot(); // return -1 if can't go up
int GetGoDownSpot(); // return -1 if can't go down
bool CanGoLeft();
bool CanGoRight();
// Screens that get pushed on top of other screens don't
// use the ScreenManager's shared background, so they must draw their own.
AutoActor m_Background;
ScreenMessage m_SMSendOnOK;
ScreenMessage m_SMSendOnCancel;
void BeforeLineChanged();
void AfterLineChanged();
void AfterAnswerChanged();
BGAnimation m_Background;
Menu m_Def;
BitmapText m_textTitle;
BitmapText m_textLabel[MAX_MENU_ROWS];
BitmapText m_textAnswer[MAX_MENU_ROWS];
int m_iCurLine;
int m_iCurAnswers[MAX_MENU_ROWS];
ScreenMessage m_SMSendOnOK, m_SMSendOnCancel;
RageSound m_sndChangeRow;
RageSound m_sndChangeValue;
Transition m_In;
Transition m_Out;
vector<MenuRow> m_vMenuRows;
public:
static int s_iLastRowCode;
static int s_iLastAnswers[MAX_MENU_ROWS];
static vector<int> s_viLastAnswers;
};
+90 -47
View File
@@ -71,6 +71,20 @@ static CString EXPLANATION_X_NAME( size_t p ) { return ssprintf("ExplanationP%
static CString EXPLANATION_Y_NAME( size_t p ) { return ssprintf("ExplanationP%dY",p+1); }
static CString EXPLANATION_ON_COMMAND_NAME( size_t p ) { return ssprintf("ExplanationP%dOnCommand",p+1); }
static CString OPTION_TITLE( CString s )
{
s.Replace("\n-","");
s.Replace("\n","");
s.Replace(" ","");
return THEME->GetMetric("OptionTitles",s+"Title");
}
static CString OPTION_EXPLANATION( CString s )
{
s.Replace("\n-","");
s.Replace("\n","");
s.Replace(" ","");
return THEME->GetMetric("OptionExplanations",s+"Help");
}
//REGISTER_SCREEN_CLASS( ScreenOptions ); // can't be instantiated
ScreenOptions::ScreenOptions( CString sClassName ) : ScreenWithMenuElements(sClassName),
@@ -95,7 +109,9 @@ ScreenOptions::ScreenOptions( CString sClassName ) : ScreenWithMenuElements(sCla
SHOW_EXIT_ROW (m_sName,"ShowExitRow"),
SEPARATE_EXIT_ROW (m_sName,"SeparateExitRow"),
SEPARATE_EXIT_ROW_Y (m_sName,"SeparateExitRowY"),
OPTION_ROW_TYPE (m_sName,"OptionRowType")
OPTION_ROW_TYPE (m_sName,"OptionRowType"),
SHOW_EXPLANATIONS (m_sName,"ShowExplanations"),
THEME_OPTION_TITLES (m_sName,"ThemeOptionTitles")
{
m_fLockInputSecs = 0.0001f; // always lock for a tiny amount of time so that we throw away any queued inputs during the load.
@@ -121,8 +137,8 @@ void ScreenOptions::Init()
m_bMoreShown = false;
FOREACH_PlayerNumber( p )
{
m_iCurrentRow[p] = 0;
m_iFocusX[p] = 0;
m_iCurrentRow[p] = -1;
m_iFocusX[p] = -1;
m_bWasOnExit[p] = false;
m_bGotAtLeastOneStartPressed[p] = false;
}
@@ -147,11 +163,13 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
{
m_Rows.push_back( new OptionRow() );
OptionRow &row = *m_Rows.back();
const OptionRowDefinition &def = vDefs[r];
OptionRowHandler* hand = vHands[r];
bool bFirstRowGoesDown = m_OptionsNavigation==NAV_TOGGLE_THREE_KEY;
row.LoadMetrics( OPTION_ROW_TYPE );
row.LoadNormal( vDefs[r], vHands[r], bFirstRowGoesDown );
row.LoadNormal( def, hand, bFirstRowGoesDown );
FOREACH_HumanPlayer( p )
this->ImportOptions( r, p );
@@ -186,8 +204,9 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
// init highlights
FOREACH_HumanPlayer( p )
{
m_Highlight[p].Load( p, false );
m_framePage.AddChild( &m_Highlight[p] );
m_Cursor[p].Load( "ScreenOptions", OptionsCursor::cursor );
m_Cursor[p].Set( p );
m_framePage.AddChild( &m_Cursor[p] );
}
for( unsigned r=0; r<m_Rows.size(); r++ ) // foreach row
@@ -264,6 +283,20 @@ void ScreenOptions::InitMenu( InputMode im, const vector<OptionRowDefinition> &v
GetExplanationTitle( r );
}
// put focus on the first enabled row
FOREACH_PlayerNumber( p )
{
for( unsigned r=0; r<m_Rows.size(); r++ )
{
const OptionRow &row = *m_Rows[r];
if( row.GetRowDef().IsEnabledForPlayer(p) )
{
m_iCurrentRow[p] = r;
break;
}
}
}
CHECKPOINT;
PositionItems();
@@ -305,10 +338,7 @@ CString ScreenOptions::GetExplanationText( int iRow ) const
CString sLineName = row.GetRowDef().name;
ASSERT( !sLineName.empty() );
sLineName.Replace("\n-","");
sLineName.Replace("\n","");
sLineName.Replace(" ","");
return THEME->GetMetric( "OptionExplanations", sLineName+"Help" );
return SHOW_EXPLANATIONS ? OPTION_EXPLANATION(sLineName) : "";
}
CString ScreenOptions::GetExplanationTitle( int iRow ) const
@@ -316,10 +346,7 @@ CString ScreenOptions::GetExplanationTitle( int iRow ) const
OptionRow &row = *m_Rows[iRow];
CString sLineName = row.GetRowDef().name;
sLineName.Replace("\n-","");
sLineName.Replace("\n","");
sLineName.Replace(" ","");
CString sTitle = THEME->GetMetric( "OptionTitles", sLineName+"Title" );
CString sTitle = THEME_OPTION_TITLES ? OPTION_TITLE(sLineName) : sLineName;
// HACK: tack the BPM onto the name of the speed line
if( sLineName.CompareNoCase("speed")==0 )
@@ -416,13 +443,13 @@ void ScreenOptions::PositionCursors()
{
// 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.
FOREACH_HumanPlayer( pn ) // foreach player
FOREACH_HumanPlayer( pn )
{
const int iRow = m_iCurrentRow[pn];
ASSERT_M( iRow < (int)m_Rows.size(), ssprintf("%i < %i", iRow, (int)m_Rows.size() ) );
OptionRow &OptionRow = *m_Rows[iRow];
OptionsCursor &highlight = m_Highlight[pn];
OptionsCursor &highlight = m_Cursor[pn];
const int iChoiceWithFocus = OptionRow.GetChoiceInRowWithFocus(pn);
@@ -445,7 +472,7 @@ void ScreenOptions::TweenCursor( PlayerNumber pn )
int iWidth, iX, iY;
GetWidthXY( pn, iRow, iChoiceWithFocus, iWidth, iX, iY );
OptionsCursor &highlight = m_Highlight[pn];
OptionsCursor &highlight = m_Cursor[pn];
highlight.StopTweening();
highlight.BeginTweening( TWEEN_SECONDS );
highlight.TweenBarWidth( iWidth );
@@ -811,16 +838,30 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType selectType
}
}
// If on exit, check it all players are on "Exit"
if( IsOnLastRow(pn) )
//
// Check whether Start ends this screen.
//
{
/* Don't accept START to go to the next screen if we're still transitioning in. */
if( AllAreOnLastRow() && selectType == IET_FIRST_PRESS && !IsTransitioning() )
this->BeginFadingOut();
return;
}
bool bEndThisScreen = false;
// If there's no exit row, then pressing Start on any row ends the screen.
if( !SHOW_EXIT_ROW )
bEndThisScreen = true;
// If all players are on "Exit"
if( AllAreOnLastRow() )
bEndThisScreen = true;
/* Don't accept START to go to the next screen if we're still transitioning in. */
if( selectType != IET_FIRST_PRESS || IsTransitioning() )
bEndThisScreen = false;
if( bEndThisScreen )
{
this->BeginFadingOut();
return;
}
}
if( row.GetFirstItemGoesDown() )
{
@@ -912,6 +953,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
return; // don't allow a move
const int iNumOptions = row.GetRowDef().choices.size();
if( m_OptionsNavigation == NAV_THREE_KEY_MENU && iNumOptions <= 1 ) // 1 or 0
{
/* There are no other options on the row; move up or down instead of left and right.
@@ -923,6 +965,9 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
return;
}
if( iNumOptions == 0 )
return;
if( Repeat )
return;
@@ -931,6 +976,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
int iCurrentChoiceWithFocus = row.GetChoiceInRowWithFocus(pn);
int iNewChoiceWithFocus = iCurrentChoiceWithFocus + iDelta;
ASSERT( iNumOptions > 0 );
wrap( iNewChoiceWithFocus, iNumOptions );
if( iCurrentChoiceWithFocus != iNewChoiceWithFocus )
@@ -1078,36 +1124,33 @@ void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat )
void ScreenOptions::MenuUp( PlayerNumber pn, const InputEventType type )
{
int r;
bool bFoundDest = false;
for( r=m_iCurrentRow[pn]-1; r>=0; r-- )
{
OptionRow &row = *m_Rows[r];
if( row.GetRowDef().EnabledForPlayer(pn) )
{
bFoundDest = true;
break;
}
}
int iDelta = bFoundDest ? r-m_iCurrentRow[pn] : -1;
MoveRow( pn, iDelta, type != IET_FIRST_PRESS );
MenuUpDown( pn, type, -1 );
}
void ScreenOptions::MenuDown( PlayerNumber pn, const InputEventType type )
{
unsigned r;
bool bFoundDest = false;
for( r=m_iCurrentRow[pn]+1; r<m_Rows.size(); r++ )
MenuUpDown( pn, type, +1 );
}
void ScreenOptions::MenuUpDown( PlayerNumber pn, const InputEventType type, int iDir )
{
ASSERT( iDir == -1 || iDir == +1 );
int iDest = -1;
for( int r=1; r<(int)m_Rows.size(); r++ )
{
OptionRow &row = *m_Rows[r];
if( row.GetRowDef().EnabledForPlayer(pn) )
int iDelta = r*iDir;
iDest = m_iCurrentRow[pn] + iDelta;
ASSERT( m_Rows.size() );
wrap( iDest, m_Rows.size() );
OptionRow &row = *m_Rows[iDest];
if( row.GetRowDef().IsEnabledForPlayer(pn) )
{
bFoundDest = true;
break;
MoveRow( pn, iDelta, type != IET_FIRST_PRESS );
return;
}
}
int iDelta = bFoundDest ? r-m_iCurrentRow[pn] : +1;
MoveRow( pn, iDelta, type != IET_FIRST_PRESS );
}
+4 -1
View File
@@ -67,6 +67,7 @@ protected:
void MenuRight( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,+1,type != IET_FIRST_PRESS); }
void MenuUp( PlayerNumber pn, const InputEventType type );
void MenuDown( PlayerNumber pn, const InputEventType type );
void MenuUpDown( PlayerNumber pn, const InputEventType type, int iDir ); // iDir == -1 or iDir == +1
/* Returns -1 if on a row with no OptionRowDefinition (eg. EXIT). */
int GetCurrentRow(PlayerNumber pn = PLAYER_1) const;
@@ -93,7 +94,7 @@ protected:
ActorFrame m_framePage;
AutoActor m_sprPage;
OptionsCursor m_Highlight[NUM_PLAYERS];
OptionsCursor m_Cursor[NUM_PLAYERS];
Sprite m_sprLineHighlight[NUM_PLAYERS];
BitmapText m_textPlayerName[NUM_PLAYERS];
@@ -140,6 +141,8 @@ protected:
ThemeMetric<bool> SEPARATE_EXIT_ROW;
ThemeMetric<float> SEPARATE_EXIT_ROW_Y;
ThemeMetric<CString> OPTION_ROW_TYPE;
ThemeMetric<bool> THEME_OPTION_TITLES;
ThemeMetric<bool> SHOW_EXPLANATIONS;
float m_fLockInputSecs;
};
+4 -1
View File
@@ -258,7 +258,10 @@ void ScreenSelectCharacter::AfterValueChange( PlayerNumber pn )
if(GAMESTATE->m_PlayMode == PLAY_MODE_BATTLE || GAMESTATE->m_PlayMode == PLAY_MODE_RAVE)
for( int i=0; i<NUM_ATTACK_LEVELS; i++ )
for( int j=0; j<NUM_ATTACKS_PER_LEVEL; j++ )
m_AttackIcons[pnAffected][i][j].Load( pnAffected, pChar->m_sAttacks[i][j] );
{
m_AttackIcons[pnAffected][i][j].Load( "ScreenSelectCharacter" );
m_AttackIcons[pnAffected][i][j].Set( pnAffected, pChar->m_sAttacks[i][j] );
}
int c = m_iSelectedCharacter[pnAffected] - MAX_CHAR_ICONS_TO_SHOW/2;
wrap( c, apCharacters.size() );