From 768b2e5846053f899c8eda340b1c83be4a6574a6 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 7 Nov 2003 07:25:52 +0000 Subject: [PATCH] rework ScreenOptionMaster metric names to not depend on language specific row title create Mines row in ScreenPlayerOptions and move other options around --- stepmania/Themes/default/metrics.ini | 37 ++++++++++------ stepmania/src/CodeDetector.cpp | 2 + stepmania/src/CodeDetector.h | 1 + stepmania/src/NoteDataUtil.cpp | 13 ++++++ stepmania/src/NoteDataUtil.h | 1 + stepmania/src/OptionIcon.cpp | 11 ++++- stepmania/src/PlayerOptions.cpp | 3 ++ stepmania/src/PlayerOptions.h | 1 + stepmania/src/ScreenOptions.cpp | 38 +---------------- stepmania/src/ScreenOptions.h | 5 ++- stepmania/src/ScreenOptionsMaster.cpp | 61 ++++++++++++++++++++++++--- stepmania/src/ScreenOptionsMaster.h | 2 + 12 files changed, 115 insertions(+), 60 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 071967f9d3..5583268418 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1888,6 +1888,7 @@ NextAppearance=Left,Up,Right NextTurn= Reverse=Down,Left,Right,Left,Right HoldNotes=Right,Left,Down,Up +Mines= Dark= CancelAll=Left,Right,Left,Right,Left,Right,Left,Right NextTheme=Left,Left,Left,Right,Right,Right,Left,Right @@ -2710,21 +2711,22 @@ StyleIcon=0 PrevScreen= NextScreen= -OptionMenuFlags=rows,13 +OptionMenuFlags=rows,14 Line1=list,Speed Line2=list,Accel;title,Acceler::-ation Line3=list,Effect Line4=list,Appearance;title,Appear::-ance Line5=list,Turn -Line6=list,Transform;title,Trans::-form +Line6=list,Transform;title,Insert Line7=list,Scroll Line8=list,NoteSkins Line9=list,Holds -Line10=list,Hide -Line11=list,Persp -Line12=Steps -Line13=Characters +Line10=list,Mines +Line11=list,Hide +Line12=list,Persp +Line13=Steps +Line14=Characters [ScreenRaveOptions] PrevScreen=ScreenSelectMusic @@ -2940,7 +2942,7 @@ TurnName,5=SHUFFLE Turn,6=mod,supershuffle TurnName,6=S.SHUFFLE -Transform=9 +Transform=8 TransformDefault=mod,no transform Transform,1= TransformName,1=OFF @@ -2954,12 +2956,10 @@ Transform,5=mod,quick TransformName,5=QUICK Transform,6=mod,skippy TransformName,6=SKIPPY -Transform,7=mod,mines -TransformName,7=MINES -Transform,8=mod,echo -TransformName,8=ECHO -Transform,9=mod,stomp -TransformName,9=STOMP +Transform,7=mod,echo +TransformName,7=ECHO +Transform,8=mod,stomp +TransformName,8=STOMP Scroll=4 ScrollDefault=mod,no reverse,no split,no alternate @@ -2973,7 +2973,7 @@ Scroll,4=mod,alternate ScrollName,4=ALTERNATE Holds=3 -HoldsDefault=mod,no noholds +HoldsDefault=mod,no noholds,no planted Holds,1=mod,noholds HoldsName,1=OFF Holds,2= @@ -2981,6 +2981,15 @@ HoldsName,2=ON Holds,3=mod,planted HoldsName,3=PLANTED +Mines=3 +MinesDefault=mod,no nomines,no mines +Mines,1=mod,nomines +MinesName,1=OFF +Mines,2= +MinesName,2=ON +Mines,3=mod,mines +MinesName,3=ADD + Hide=3 HideDefault=mod,no dark,no blind Hide,1= diff --git a/stepmania/src/CodeDetector.cpp b/stepmania/src/CodeDetector.cpp index 1b09153eec..182b172d5a 100644 --- a/stepmania/src/CodeDetector.cpp +++ b/stepmania/src/CodeDetector.cpp @@ -42,6 +42,7 @@ const CString g_sCodeNames[CodeDetector::NUM_CODES] = { "NextTurn", "Reverse", "HoldNotes", + "Mines", "Dark", "Hidden", "RandomVanish", @@ -183,6 +184,7 @@ bool CodeDetector::DetectAndAdjustMusicOptions( GameController controller ) case CODE_NEXT_TURN: GAMESTATE->m_PlayerOptions[pn].NextTurn(); break; case CODE_REVERSE: GAMESTATE->m_PlayerOptions[pn].NextScroll(); break; case CODE_HOLDS: TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_bHoldNotes, true, false ); break; + case CODE_MINES: TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_bMines, true, false ); break; case CODE_DARK: FLOAT_TOGGLE( GAMESTATE->m_PlayerOptions[pn].m_fDark ); break; case CODE_CANCEL_ALL: GAMESTATE->m_PlayerOptions[pn].Init(); GAMESTATE->m_PlayerOptions[pn].FromString( PREFSMAN->m_sDefaultModifiers ); break; diff --git a/stepmania/src/CodeDetector.h b/stepmania/src/CodeDetector.h index 073015aab2..1ef102213f 100644 --- a/stepmania/src/CodeDetector.h +++ b/stepmania/src/CodeDetector.h @@ -37,6 +37,7 @@ public: CODE_NEXT_TURN, CODE_REVERSE, CODE_HOLDS, + CODE_MINES, CODE_DARK, CODE_HIDDEN, CODE_RANDOMVANISH, diff --git a/stepmania/src/NoteDataUtil.cpp b/stepmania/src/NoteDataUtil.cpp index 0fdc081041..ef9a05bc74 100644 --- a/stepmania/src/NoteDataUtil.cpp +++ b/stepmania/src/NoteDataUtil.cpp @@ -282,6 +282,16 @@ void NoteDataUtil::RemoveHoldNotes(NoteData &in) } +void NoteDataUtil::RemoveMines(NoteData &in) +{ + int max_row = in.GetLastRow(); + for( int t=0; tGetPathToF("ScreenOptions title") ); - CString sText = optline.name; + CString sText = optline.title; title.SetText( sText ); title.SetXY( LABELS_X, fY ); @@ -422,41 +422,7 @@ void ScreenOptions::PositionIcons() void ScreenOptions::RefreshIcons() { - ASSERT( m_iNumOptionRows < (int) MAX_OPTION_LINES ); - - for( int p=0; pIsHumanPlayer(p) ) - continue; - - for( int i=0; i= (int)m_OptionRow[i].choices.size() ) - { - /* Invalid selection. Send debug output, to aid debugging. */ - CString error = ssprintf("Option row with name \"%s\" selects item %i, but there are only %i items:\n", - m_OptionRow[i].name.c_str(), - iSelection, m_OptionRow[i].choices.size() ); - - for( unsigned j = 0; j < m_OptionRow[i].choices.size(); ++j ) - error += ssprintf(" %s\n", m_OptionRow[i].choices[j].c_str()); - - RageException::Throw( "%s", error.c_str() ); - } - - CString sSelection = row.choices[iSelection]; - if( sSelection == "ON" ) - sSelection = m_OptionRow[i].name; - if( row.bOneChoiceForAllPlayers ) - icon.Load( (PlayerNumber)p, "", false ); - else - icon.Load( (PlayerNumber)p, sSelection, false ); - } - } + // handled by ScreenOptionsMaster } diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index b880404e52..4c1b46bc9a 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -27,6 +27,7 @@ const unsigned MAX_OPTION_LINES = 40; struct OptionRow { CString name; + CString title; bool bOneChoiceForAllPlayers; vector choices; @@ -35,6 +36,7 @@ struct OptionRow OptionRow( const char *n, int 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; + title = n; bOneChoiceForAllPlayers = !!b; #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); @@ -68,7 +70,7 @@ protected: BitmapText &GetTextItemForRow( PlayerNumber pn, int iRow ); void PositionUnderlines(); void PositionIcons(); - void RefreshIcons(); + virtual void RefreshIcons(); void PositionCursors(); void PositionItems(); void TweenCursor( PlayerNumber player_no ); @@ -99,7 +101,6 @@ protected: // derived classes need access to these int m_iSelectedOption[NUM_PLAYERS][MAX_OPTION_LINES]; int m_iCurrentRow[NUM_PLAYERS]; -private: InputMode m_InputMode; int m_iNumOptionRows; diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index 9d14f165cb..67271bfc22 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -240,35 +240,34 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ): const CString name = asBits[0]; const CString param = asBits.size() > 1? asBits[1]: ""; - CString Title = ""; if( !name.CompareNoCase("title") ) { TitleSetExplicitly = true; - row.name = param; + row.title = param; } else if( !name.CompareNoCase("list") ) { - SetList( row, hand, param, Title ); + SetList( row, hand, param, row.name ); } else if( !name.CompareNoCase("steps") ) { SetStep( row, hand ); - Title = "Steps"; + row.name = "Steps"; } else if( !name.CompareNoCase("conf") ) { - SetConf( row, hand, param, Title ); + SetConf( row, hand, param, row.name ); } else if( !name.CompareNoCase("characters") ) { SetCharacter( row, hand ); - Title = "Characters"; + row.name = "Characters"; } else RageException::Throw( "Unexpected type '%s' in %s::Line%i", name.c_str(), m_sName.c_str(), i ); if( !TitleSetExplicitly ) - row.name = Title; + row.title = row.name; } OptionRowHandlers.push_back( hand ); } @@ -568,3 +567,51 @@ void ScreenOptionsMaster::GoToPrevState() SCREENMAN->SetNewScreen( PREV_SCREEN ); // (GAMESTATE->m_PlayMode) ); } +void ScreenOptionsMaster::RefreshIcons() +{ + ASSERT( m_iNumOptionRows < (int) MAX_OPTION_LINES ); + + for( int p=0; pIsHumanPlayer(p) ) + continue; + + for( int i=0; i= (int)m_OptionRow[i].choices.size() ) + { + /* Invalid selection. Send debug output, to aid debugging. */ + CString error = ssprintf("Option row with name '%s' selects item %i, but there are only %i items:\n", + m_OptionRow[i].name.c_str(), + iSelection, m_OptionRow[i].choices.size() ); + + for( unsigned j = 0; j < m_OptionRow[i].choices.size(); ++j ) + error += ssprintf(" %s\n", m_OptionRow[i].choices[j].c_str()); + + RageException::Throw( "%s", error.c_str() ); + } + + // set icon name + CString sIcon; + switch( handler.type ) + { + case ROW_LIST: + sIcon = handler.ListEntries[iSelection].m_sModifiers; + break; + case ROW_STEP: + case ROW_CHARACTER: + sIcon = row.choices[iSelection]; + break; + case ROW_CONFIG: + break; + } + + icon.Load( (PlayerNumber)p, sIcon, false ); + } + } +} diff --git a/stepmania/src/ScreenOptionsMaster.h b/stepmania/src/ScreenOptionsMaster.h index 81731955fd..3957238e8e 100644 --- a/stepmania/src/ScreenOptionsMaster.h +++ b/stepmania/src/ScreenOptionsMaster.h @@ -56,6 +56,8 @@ protected: virtual void GoToNextState(); virtual void GoToPrevState(); + + virtual void RefreshIcons(); };