From 0e976b3ad24e9d3c0cb1464d483ff3efa5c87228 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 16 Jun 2003 03:44:15 +0000 Subject: [PATCH] Move options back to the first page. (Havn't removed the other one yet.) --- stepmania/src/ScreenPlayerOptions.cpp | 222 +++++++++++++++++++++----- 1 file changed, 183 insertions(+), 39 deletions(-) diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 6d28308bf8..e36533fdcd 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -20,6 +20,7 @@ #include "NoteSkinManager.h" #include "NoteFieldPositioning.h" #include "ScreenSongOptions.h" +#include "Character.h" #include "Notes.h" #include "Course.h" @@ -29,23 +30,33 @@ enum { PO_SPEED = 0, PO_ACCEL, + PO_EFFECT, PO_APPEAR, PO_TURN, + PO_TRANSFORM, PO_SCROLL, + PO_NOTE_SKIN, PO_HOLD_NOTES, PO_DARK, + PO_PERSPECTIVE, PO_STEP, + PO_CHARACTER, NUM_PLAYER_OPTIONS_LINES }; OptionRow g_PlayerOptionsLines[NUM_PLAYER_OPTIONS_LINES] = { OptionRow( "Speed", "x0.25","x0.5","x0.75","x1","x1.5","x2","x3","x5","x8","C200","C300" ), OptionRow( "Acceler\n-ation", "OFF","BOOST","BRAKE","WAVE","EXPAND","BOOMERANG" ), + OptionRow( "Effect", "OFF","DRUNK","DIZZY","MINI","FLIP","TORNADO" ), OptionRow( "Appear\n-ance", "VISIBLE","HIDDEN","SUDDEN","STEALTH","BLINK", "R.VANISH" ), OptionRow( "Turn", "OFF","MIRROR","LEFT","RIGHT","SHUFFLE","S.SHUFFLE" ), + OptionRow( "Trans\n-form", "OFF","LITTLE","WIDE","BIG","QUICK","SKIPPY" ), OptionRow( "Scroll", "STANDARD","REVERSE" ), + OptionRow( "Note\nSkin", "" ), OptionRow( "Holds", "OFF","ON" ), OptionRow( "Dark", "OFF","ON" ), - OptionRow( "Step", "" ) + OptionRow( "Perspec\n-tive", "" ), + OptionRow( "Step", "" ), + OptionRow( "Character", "" ), }; @@ -60,19 +71,34 @@ ScreenPlayerOptions::ScreenPlayerOptions() : NUM_PLAYER_OPTIONS_LINES, true, false ); + /* If we're going to "press start for more options" or skipping options + * entirely, we need a different fade out. XXX: this is a hack */ + if(PREFSMAN->m_ShowSongOptions == PrefsManager::NO) + m_Menu.m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions direct out") ); /* direct to stage */ + else if(PREFSMAN->m_ShowSongOptions == PrefsManager::ASK) + m_Menu.m_Out.Load( THEME->GetPathToB("ScreenPlayerOptions option out") ); /* optional song options */ + + m_sprOptionsMessage.Load( THEME->GetPathToG("ScreenPlayerOptions options") ); + m_sprOptionsMessage.StopAnimating(); + m_sprOptionsMessage.SetXY( CENTER_X, CENTER_Y ); + m_sprOptionsMessage.SetZoom( 1 ); + m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) ); + //this->AddChild( &m_sprOptionsMessage ); // we have to draw this manually over the top of transitions + + m_bAcceptedChoices = false; + m_bGoToOptions = ( PREFSMAN->m_ShowSongOptions == PrefsManager::YES ); + SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("player options intro") ); } void ScreenPlayerOptions::ImportOptions() { - // // fill in difficulty names - // m_OptionRow[PO_STEP].choices.clear(); - if( GAMESTATE->m_pCurCourse ) // playing a course + if( GAMESTATE->m_pCurCourse ) // playing a course { - m_OptionRow[PO_STEP].choices.push_back( "REGULAR" ); + m_OptionRow[PO_STEP].choices.push_back( "REGULAR" ); if( GAMESTATE->m_pCurCourse->HasDifficult() ) m_OptionRow[PO_STEP].choices.push_back( "DIFFICULT" ); } @@ -85,18 +111,53 @@ void ScreenPlayerOptions::ImportOptions() { CString s = vNotes[i]->GetDescription(); s.MakeUpper(); - m_OptionRow[PO_STEP].choices.push_back( s ); + m_OptionRow[PO_STEP].choices.push_back( s ); } } // - // highlight currently selected values + // fill in skin names // + CStringArray arraySkinNames; + NOTESKIN->GetNoteSkinNames( arraySkinNames ); + + m_OptionRow[PO_NOTE_SKIN].choices.clear(); + + unsigned i; + for( i=0; im_pPosition->GetNamesForCurrentGame(arrayPosNames); + for( i=0; im_pCharacters.size(); i++ ) + { + CString s = GAMESTATE->m_pCharacters[i]->m_sName; + s.MakeUpper(); + m_OptionRow[PO_CHARACTER].choices.push_back( s ); + } + + for( int p=0; pIsHumanPlayer(p) ) - continue; // skip - PlayerOptions &po = GAMESTATE->m_PlayerOptions[p]; if( !po.m_bTimeSpacing && po.m_fScrollSpeed == 0.25f ) m_iSelectedOption[p][PO_SPEED] = 0; @@ -113,32 +174,49 @@ void ScreenPlayerOptions::ImportOptions() else m_iSelectedOption[p][PO_SPEED] = 3; m_iSelectedOption[p][PO_ACCEL] = po.GetFirstAccel()+1; + m_iSelectedOption[p][PO_EFFECT] = po.GetFirstEffect()+1; m_iSelectedOption[p][PO_APPEAR] = po.GetFirstAppearance()+1; m_iSelectedOption[p][PO_TURN] = po.m_Turn; + m_iSelectedOption[p][PO_TRANSFORM] = po.m_Transform; m_iSelectedOption[p][PO_SCROLL] = po.m_fReverseScroll==1 ? 1 : 0 ; + // highlight currently selected skin + m_iSelectedOption[p][PO_NOTE_SKIN] = -1; + for( unsigned j=0; jm_pCurCourse ) // playing a course + /* Default: */ + m_iSelectedOption[p][PO_PERSPECTIVE] = 1; + if(po.m_fPerspectiveTilt == -1) + m_iSelectedOption[p][PO_PERSPECTIVE] = 0; + else if(po.m_fPerspectiveTilt == 1) + m_iSelectedOption[p][PO_PERSPECTIVE] = 2; + else /* po.m_fPerspectiveTilt == 0 */ { - if( GAMESTATE->m_bDifficultCourses ) - m_iSelectedOption[p][PO_STEP] = 1; - else - m_iSelectedOption[p][PO_STEP] = 0; - } - else - { - vector vNotes; - GAMESTATE->m_pCurSong->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_NotesType ); - SortNotesArrayByDifficulty( vNotes ); - for( unsigned i=0; im_pCurNotes[p] == vNotes[i] ) - m_iSelectedOption[p][PO_STEP] = i; - } + vector &choices = m_OptionRow[PO_PERSPECTIVE].choices; + for(unsigned n = 3; n < choices.size(); ++n) + if(!choices[n].CompareNoCase(GAMESTATE->m_PlayerOptions[p].m_sPositioning)) + m_iSelectedOption[p][PO_PERSPECTIVE] = n; } + + for( i=0; im_pCharacters.size(); i++ ) + if( GAMESTATE->m_pCurCharacters[p] == GAMESTATE->m_pCharacters[i] ) + m_iSelectedOption[p][PO_CHARACTER] = i+1; + + po.Init(); } } @@ -146,9 +224,6 @@ void ScreenPlayerOptions::ExportOptions() { for( int p=0; pIsHumanPlayer(p) ) - continue; // skip - PlayerOptions &po = GAMESTATE->m_PlayerOptions[p]; po.Init(); @@ -170,33 +245,62 @@ void ScreenPlayerOptions::ExportOptions() if( m_iSelectedOption[p][PO_ACCEL] != 0 ) po.SetOneAccel( (PlayerOptions::Accel)(m_iSelectedOption[p][PO_ACCEL]-1) ); + if( m_iSelectedOption[p][PO_EFFECT] != 0 ) + po.SetOneEffect( (PlayerOptions::Effect)(m_iSelectedOption[p][PO_EFFECT]-1) ); if( m_iSelectedOption[p][PO_APPEAR] != 0 ) po.SetOneAppearance( (PlayerOptions::Appearance)(m_iSelectedOption[p][PO_APPEAR]-1) ); po.m_Turn = (PlayerOptions::Turn)m_iSelectedOption[p][PO_TURN]; + po.m_Transform = (PlayerOptions::Transform)m_iSelectedOption[p][PO_TRANSFORM]; po.m_fReverseScroll = (m_iSelectedOption[p][PO_SCROLL] == 1) ? 1.f : 0.f; + int iSelectedSkin = m_iSelectedOption[p][PO_NOTE_SKIN]; + CString sNewSkin = m_OptionRow[PO_NOTE_SKIN].choices[iSelectedSkin]; + po.m_sNoteSkin = sNewSkin; + + po.m_bHoldNotes = (m_iSelectedOption[p][PO_HOLD_NOTES] == 1); po.m_fDark = (m_iSelectedOption[p][PO_DARK] == 1) ? 1.f : 0.f; - - // - // apply difficulty selection - // - if( GAMESTATE->m_pCurCourse ) // playing a course + + switch(m_iSelectedOption[p][PO_PERSPECTIVE]) { - if( m_iSelectedOption[p][PO_STEP] == 1 ) - GAMESTATE->m_bDifficultCourses = true; + case 0: po.m_fPerspectiveTilt = -1; break; + case 2: po.m_fPerspectiveTilt = 1; break; + default:po.m_fPerspectiveTilt = 0; break; + } + if(m_iSelectedOption[p][PO_PERSPECTIVE] > 2) + { + const int choice = m_iSelectedOption[p][PO_PERSPECTIVE]; + GAMESTATE->m_PlayerOptions[p].m_sPositioning = m_OptionRow[PO_PERSPECTIVE].choices[choice]; + } + + if( GAMESTATE->m_pCurCourse ) // playing a course + { + if( GAMESTATE->m_bDifficultCourses ) + m_iSelectedOption[p][PO_STEP] = 1; else - GAMESTATE->m_bDifficultCourses = false; + m_iSelectedOption[p][PO_STEP] = 0; } else { vector vNotes; GAMESTATE->m_pCurSong->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_NotesType ); SortNotesArrayByDifficulty( vNotes ); - GAMESTATE->m_pCurNotes[p] = vNotes[ m_iSelectedOption[p][PO_STEP] ]; + for( unsigned i=0; im_pCurNotes[p] == vNotes[i] ) + m_iSelectedOption[p][PO_STEP] = i; + } } + + if( m_iSelectedOption[p][PO_CHARACTER] > 0 ) + { + int choice = m_iSelectedOption[p][PO_CHARACTER] - 1; + GAMESTATE->m_pCurCharacters[p] = GAMESTATE->m_pCharacters[choice]; + } + else + GAMESTATE->m_pCurCharacters[p] = NULL; } } @@ -212,28 +316,68 @@ void ScreenPlayerOptions::GoToNextState() { if( GAMESTATE->m_bEditing ) SCREENMAN->PopTopScreen(); - else + else if( m_bGoToOptions ) SCREENMAN->SetNewScreen( NEXT_SCREEN(GAMESTATE->m_PlayMode) ); + else + SCREENMAN->SetNewScreen( ScreenSongOptions::GetNextScreen() ); } void ScreenPlayerOptions::Update( float fDelta ) { ScreenOptions::Update( fDelta ); + m_sprOptionsMessage.Update( fDelta ); } void ScreenPlayerOptions::DrawPrimitives() { ScreenOptions::DrawPrimitives(); + m_sprOptionsMessage.Draw(); } void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { + if( !GAMESTATE->m_bEditing && + type == IET_FIRST_PRESS && + !m_Menu.m_In.IsTransitioning() && + MenuI.IsValid() && + MenuI.button == MENU_BUTTON_START && + PREFSMAN->m_ShowSongOptions == PrefsManager::ASK ) + { + if( m_bAcceptedChoices && !m_bGoToOptions ) + { + m_bGoToOptions = true; + m_sprOptionsMessage.SetState( 1 ); + SOUNDMAN->PlayOnce( THEME->GetPathToS("Common start") ); + } + } + ScreenOptions::Input( DeviceI, type, GameI, MenuI, StyleI ); } void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM ) { + if(PREFSMAN->m_ShowSongOptions == PrefsManager::ASK) + switch( SM ) + { + case SM_BeginFadingOut: // when the user accepts the page of options + { + m_bAcceptedChoices = true; + + float fShowSeconds = m_Menu.m_Out.GetLengthSeconds(); + + // show "hold START for options" + m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) ); + m_sprOptionsMessage.BeginTweening( 0.15f ); // fade in + m_sprOptionsMessage.SetZoomY( 1 ); + m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,1) ); + m_sprOptionsMessage.BeginTweening( fShowSeconds-0.3f ); // sleep + m_sprOptionsMessage.BeginTweening( 0.15f ); // fade out + m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) ); + m_sprOptionsMessage.SetZoomY( 0 ); + } + break; + } ScreenOptions::HandleScreenMessage( SM ); } \ No newline at end of file