diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index a4cbf2e016..3a935ee28d 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -83,7 +83,7 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties for(i=0; i<4; i++) m_temp.diffuse[i] = bBlinkOn ? m_effectColor1 : m_effectColor2; break; - case diffuse_camelion: + case diffuse_shift: for(i=0; i<4; i++) m_temp.diffuse[i] = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors); break; @@ -91,7 +91,7 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties m_temp.glow = bBlinkOn ? m_effectColor1 : m_effectColor2; m_temp.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! break; - case glow_camelion: + case glow_shift: m_temp.glow = m_effectColor1*fPercentBetweenColors + m_effectColor2*(1.0f-fPercentBetweenColors); m_temp.glow.a *= fOriginalAlpha; // don't glow if the Actor is transparent! break; @@ -224,9 +224,9 @@ void Actor::Update( float fDeltaTime ) case no_effect: break; case diffuse_blinking: - case diffuse_camelion: + case diffuse_shift: case glow_blinking: - case glow_camelion: + case glow_shift: case wagging: case bouncing: case bobbing: @@ -400,9 +400,9 @@ void Actor::SetEffectDiffuseBlinking( float fEffectPeriodSeconds, RageColor c1, m_fSecsIntoEffect = 0; } -void Actor::SetEffectDiffuseCamelion( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) { - m_Effect = diffuse_camelion; + m_Effect = diffuse_shift; m_effectColor1 = c1; m_effectColor2 = c2; m_fEffectPeriodSeconds = fEffectPeriodSeconds; @@ -418,9 +418,9 @@ void Actor::SetEffectGlowBlinking( float fEffectPeriodSeconds, RageColor c1, Rag m_fSecsIntoEffect = 0; } -void Actor::SetEffectGlowCamelion( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) { - m_Effect = glow_camelion; + m_Effect = glow_shift; m_effectColor1 = c1; m_effectColor2 = c2; m_fEffectPeriodSeconds = fEffectPeriodSeconds; diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 980c047589..ec399b68b6 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -31,8 +31,8 @@ public: TWEEN_SPRING, }; enum Effect { no_effect, - diffuse_blinking, diffuse_camelion, - glow_blinking, glow_camelion, + diffuse_blinking, diffuse_shift, + glow_blinking, glow_shift, wagging, spinning, vibrating, flickering, bouncing, bobbing @@ -156,13 +156,13 @@ public: void SetEffectDiffuseBlinking( float fEffectPeriodSeconds = 1.0f, RageColor c1 = RageColor(0.5f,0.5f,0.5f,1), RageColor c2 = RageColor(1,1,1,1) ); - void SetEffectDiffuseCamelion( float fEffectPeriodSeconds = 1.0f, + void SetEffectDiffuseShift( float fEffectPeriodSeconds = 1.0f, RageColor c1 = RageColor(0,0,0,1), RageColor c2 = RageColor(1,1,1,1) ); void SetEffectGlowBlinking( float fEffectPeriodSeconds = 1.0f, RageColor c1 = RageColor(1,1,1,0.2f), RageColor c2 = RageColor(1,1,1,0.8f) ); - void SetEffectGlowCamelion( float fEffectPeriodSeconds = 1.0f, + void SetEffectGlowShift( float fEffectPeriodSeconds = 1.0f, RageColor c1 = RageColor(1,1,1,0.2f), RageColor c2 = RageColor(1,1,1,0.8f) ); void SetEffectWagging( float fWagRadians = 0.2, @@ -278,7 +278,7 @@ protected: float m_fSecsIntoEffect; float m_fEffectPeriodSeconds; - // Counting variables for camelion and glowing: + // Counting variables for shift and glowing: RageColor m_effectColor1; RageColor m_effectColor2; diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index 1e97f3afcc..bf6d377ff2 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -184,12 +184,14 @@ float ArrowGetGlow( PlayerNumber pn, float fYPos, float fPercentFadeToFail ) float ArrowGetBrightness( PlayerNumber pn, float fNoteBeat ) { + if( GAMESTATE->m_bEditing ) + return 1; + float fSongBeat = GAMESTATE->m_fSongBeat; float fBeatsUntilStep = fNoteBeat - fSongBeat; float fBrightness = SCALE( fBeatsUntilStep, 0, -1, 1.f, 0.f ); CLAMP( fBrightness, 0, 1 ); -// noisy printf( "fBrightness = %f\n", fBrightness ); return fBrightness; } diff --git a/stepmania/src/EditMenu.cpp b/stepmania/src/EditMenu.cpp index 7072e2d533..d72f520476 100644 --- a/stepmania/src/EditMenu.cpp +++ b/stepmania/src/EditMenu.cpp @@ -226,12 +226,16 @@ void EditMenu::ChangeToRow( Row newRow ) m_sprArrows[i].SetY( ROW_Y(newRow) ); m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); + m_sprArrows[0].EnableAnimation( CanGoLeft() ); + m_sprArrows[1].EnableAnimation( CanGoRight() ); } void EditMenu::OnRowValueChanged( Row row ) { m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); + m_sprArrows[0].EnableAnimation( CanGoLeft() ); + m_sprArrows[1].EnableAnimation( CanGoRight() ); switch( row ) { diff --git a/stepmania/src/FootMeter.cpp b/stepmania/src/FootMeter.cpp index a62781613b..4a039e1327 100644 --- a/stepmania/src/FootMeter.cpp +++ b/stepmania/src/FootMeter.cpp @@ -37,7 +37,7 @@ void FootMeter::SetFromNotes( Notes* pNotes ) SetDiffuse( RageColor(1,1,1,1) ); SetNumFeet( pNotes->GetMeter() ); if( pNotes->GetMeter() > GLOW_IF_METER_GREATER_THAN ) - this->SetEffectGlowCamelion(); + this->SetEffectGlowShift(); else this->SetEffectNone(); diff --git a/stepmania/src/GroupList.cpp b/stepmania/src/GroupList.cpp index f167481e4b..83c4247b3a 100644 --- a/stepmania/src/GroupList.cpp +++ b/stepmania/src/GroupList.cpp @@ -84,12 +84,12 @@ void GroupList::AfterChange() m_sprButton[iSel].StopTweening(); m_sprButton[iSel].BeginTweening( 0.2f ); m_sprButton[iSel].SetTweenX( BUTTON_SELECTED_X ); - m_sprButton[iSel].SetEffectGlowCamelion(); + m_sprButton[iSel].SetEffectGlowShift(); m_screenLabels[iSel].StopTweening(); m_screenLabels[iSel].BeginTweening( 0.2f ); m_screenLabels[iSel].SetTweenX( BUTTON_SELECTED_X ); - m_screenLabels[iSel].SetEffectGlowCamelion(); + m_screenLabels[iSel].SetEffectGlowShift(); } void GroupList::Up() diff --git a/stepmania/src/JukeboxMenu.cpp b/stepmania/src/JukeboxMenu.cpp index a31f97f9d6..0729ded01c 100644 --- a/stepmania/src/JukeboxMenu.cpp +++ b/stepmania/src/JukeboxMenu.cpp @@ -162,12 +162,16 @@ void JukeboxMenu::ChangeToRow( Row newRow ) m_sprArrows[i].SetY( ROW_Y(newRow) ); m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); + m_sprArrows[0].EnableAnimation( CanGoLeft() ); + m_sprArrows[1].EnableAnimation( CanGoRight() ); } void JukeboxMenu::OnRowValueChanged( Row row ) { m_sprArrows[0].SetDiffuse( CanGoLeft()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); m_sprArrows[1].SetDiffuse( CanGoRight()?RageColor(1,1,1,1):RageColor(0.2f,0.2f,0.2f,1) ); + m_sprArrows[0].EnableAnimation( CanGoLeft() ); + m_sprArrows[1].EnableAnimation( CanGoRight() ); switch( row ) { diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index 4b5e45650f..12f71858be 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -87,8 +87,8 @@ void MenuTimer::Update( float fDeltaTime ) SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("hurry up") ); else if( fOldSecondsLeft > 5 && fNewSecondsLeft < 5 ) // transition to below 5 { - m_textDigit1.SetEffectGlowCamelion( 0.15f, RageColor(1,0,0,0), RageColor(1,0,0,1) ); - m_textDigit2.SetEffectGlowCamelion( 0.15f, RageColor(1,0,0,0), RageColor(1,0,0,1) ); + m_textDigit1.SetEffectGlowShift( 0.15f, RageColor(1,0,0,0), RageColor(1,0,0,1) ); + m_textDigit2.SetEffectGlowShift( 0.15f, RageColor(1,0,0,0), RageColor(1,0,0,1) ); m_soundBeep.Play(); } else if( fOldSecondsLeft > 4 && fNewSecondsLeft < 4 ) // transition to below 4 diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index d0488ed172..7225b54535 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -80,7 +80,7 @@ MusicWheel::MusicWheel() m_sprSelectionOverlay.Load( THEME->GetPathTo("Graphics","select music song highlight") ); m_sprSelectionOverlay.SetXY( 0, 0 ); m_sprSelectionOverlay.SetDiffuse( RageColor(1,1,1,1) ); - m_sprSelectionOverlay.SetEffectGlowCamelion( 1.0f, RageColor(1,1,1,0.4f), RageColor(1,1,1,1) ); + m_sprSelectionOverlay.SetEffectGlowShift( 1.0f, RageColor(1,1,1,0.4f), RageColor(1,1,1,1) ); AddChild( &m_sprSelectionOverlay ); m_ScrollBar.SetX( SCROLL_BAR_X ); diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index b8f1ec5078..18e696f341 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -795,7 +795,7 @@ void NoteDataUtil::RemoveHoldNotes(NoteData &in) } -void NoteDataUtil::Turn( NoteData &in, PlayerOptions::TurnType tt ) +void NoteDataUtil::Turn( NoteData &in, TurnType tt ) { int iTakeFromTrack[MAX_NOTE_TRACKS]; // New track "t" will take from old track iTakeFromTrack[t] @@ -803,15 +803,10 @@ void NoteDataUtil::Turn( NoteData &in, PlayerOptions::TurnType tt ) switch( tt ) { - case PlayerOptions::TURN_NONE: - return; // nothing to do - case PlayerOptions::TURN_MIRROR: - for( t=0; tGetCurrentStyleDef()->m_NotesType ) { case NOTES_TYPE_DANCE_SINGLE: @@ -878,8 +873,12 @@ void NoteDataUtil::Turn( NoteData &in, PlayerOptions::TurnType tt ) break; } break; - case PlayerOptions::TURN_SHUFFLE: - case PlayerOptions::TURN_SUPER_SHUFFLE: // use this code to shuffle the HoldNotes + case mirror: + for( t=0; t aiTracksLeftToMap; for( t=0; tm_PlayerOptions[m_PlayerNumber].m_fScrollSpeed; + switch( nt ) + { + default: ASSERT(0); + case NOTE_TYPE_4TH: iSegWidth = 16; iSpaceWidth = 0; fBrightness = 1; break; + case NOTE_TYPE_8TH: iSegWidth = 12; iSpaceWidth = 4; fBrightness = SCALE(fScrollSpeed,1.f,2.f,0.f,1.f); break; + case NOTE_TYPE_16TH:iSegWidth = 4; iSpaceWidth = 4; fBrightness = SCALE(fScrollSpeed,2.f,4.f,0.f,1.f); break; + } + CLAMP( fBrightness, 0, 1 ); + + int iWidth = GetWidth(); + for( int i=-iWidth/2; i<+iWidth/2; ) + { + m_rectMeasureBar.StretchTo( RectI(i,0,i+iSegWidth,0) ); + m_rectMeasureBar.SetY( fYPos ); + m_rectMeasureBar.SetZoomY( bIsMeasure ? 6.f : 2.f ); + m_rectMeasureBar.SetDiffuse( RageColor(1,1,1,0.5f*fBrightness) ); + m_rectMeasureBar.Draw(); + + i += iSegWidth + iSpaceWidth; + } + + if( bIsMeasure ) + { + m_textMeasureNumber.SetDiffuse( RageColor(1,1,1,1) ); + m_textMeasureNumber.SetGlow( RageColor(1,1,1,0) ); + m_textMeasureNumber.SetText( ssprintf("%d", iMeasureNoDisplay) ); + m_textMeasureNumber.SetXY( -iWidth/2.f + 10, fYPos ); + m_textMeasureNumber.Draw(); + } } void NoteField::DrawMarkerBar( const float fBeat ) @@ -103,11 +134,25 @@ void NoteField::DrawMarkerBar( const float fBeat ) m_rectMarkerBar.SetXY( 0, fYPos ); m_rectMarkerBar.SetZoomX( (float)(GetNumTracks()+1) * ARROW_SIZE ); - m_rectMarkerBar.SetZoomY( 20 ); - m_rectMarkerBar.SetDiffuse( RageColor(0,0,0,0.5f) ); + m_rectMarkerBar.SetZoomY( (float)ARROW_SIZE ); m_rectMarkerBar.Draw(); } +void NoteField::DrawAreaHighlight( const float fStartBeat, const float fEndBeat ) +{ + const float fYStartOffset = ArrowGetYOffset( m_PlayerNumber, fStartBeat ); + const float fYStartPos = ArrowGetYPos( m_PlayerNumber, fYStartOffset ); + const float fYEndOffset = ArrowGetYOffset( m_PlayerNumber, fEndBeat ); + const float fYEndPos = ArrowGetYPos( m_PlayerNumber, fYEndOffset ); + + m_rectAreaHighlight.StretchTo( RectI(0, (int)fYStartPos-ARROW_SIZE/2, 1, (int)fYEndPos+ARROW_SIZE/2) ); + m_rectAreaHighlight.SetZoomX( (float)(GetNumTracks()+1) * ARROW_SIZE ); + m_rectAreaHighlight.SetDiffuse( RageColor(1,0,0,0.3f) ); + m_rectAreaHighlight.Draw(); +} + + + void NoteField::DrawBPMText( const float fBeat, const float fBPM ) { const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat ); @@ -116,7 +161,7 @@ void NoteField::DrawBPMText( const float fBeat, const float fBPM ) m_textMeasureNumber.SetDiffuse( RageColor(1,0,0,1) ); m_textMeasureNumber.SetGlow( RageColor(1,1,1,cosf(RageTimer::GetTimeSinceStart()*2)/2+0.5f) ); m_textMeasureNumber.SetText( ssprintf("%.2f", fBPM) ); - m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 - 60, fYPos ); + m_textMeasureNumber.SetXY( -GetWidth()/2.f - 60, fYPos ); m_textMeasureNumber.Draw(); } @@ -128,7 +173,7 @@ void NoteField::DrawFreezeText( const float fBeat, const float fSecs ) m_textMeasureNumber.SetDiffuse( RageColor(0.8f,0.8f,0,1) ); m_textMeasureNumber.SetGlow( RageColor(1,1,1,cosf(RageTimer::GetTimeSinceStart()*2)/2+0.5f) ); m_textMeasureNumber.SetText( ssprintf("%.2f", fSecs) ); - m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 - 10, fYPos ); + m_textMeasureNumber.SetXY( -GetWidth()/2.f - 10, fYPos ); m_textMeasureNumber.Draw(); } @@ -140,7 +185,7 @@ void NoteField::DrawBGChangeText( const float fBeat, const CString sNewBGName ) m_textMeasureNumber.SetDiffuse( RageColor(0,1,0,1) ); m_textMeasureNumber.SetGlow( RageColor(1,1,1,cosf(RageTimer::GetTimeSinceStart()*2)/2+0.5f) ); m_textMeasureNumber.SetText( sNewBGName ); - m_textMeasureNumber.SetXY( +m_rectMeasureBar.GetZoomedWidth()/2 + 10, fYPos ); + m_textMeasureNumber.SetXY( +GetWidth()/2.f + 10, fYPos ); m_textMeasureNumber.Draw(); } @@ -193,12 +238,13 @@ void NoteField::DrawPrimitives() unsigned i; // - // Draw measure bars + // Draw beat bars // - unsigned iFirstMeasureToDraw = max(0, int(fFirstBeatToDraw)/BEATS_PER_MEASURE); - unsigned iLastMeasureToDraw = max(0, (int(fLastBeatToDraw)/BEATS_PER_MEASURE)+1); - for( i=iFirstMeasureToDraw; i<=iLastMeasureToDraw; i++ ) - DrawMeasureBar( i ); + { + float fStartDrawingMeasureBars = max( 0, froundf(fFirstBeatToDraw-0.25f,0.25f) ); + for( float f=fStartDrawingMeasureBars; fm_PlayerOptions[pn].m_bHoldNotes ) NoteDataUtil::RemoveHoldNotes(*this); - NoteDataUtil::Turn( *this, GAMESTATE->m_PlayerOptions[pn].m_TurnType ); + switch( GAMESTATE->m_PlayerOptions[pn].m_TurnType ) + { + case PlayerOptions::TURN_NONE: break; + case PlayerOptions::TURN_MIRROR: NoteDataUtil::Turn( *this, NoteDataUtil::mirror ); break; + case PlayerOptions::TURN_LEFT: NoteDataUtil::Turn( *this, NoteDataUtil::left ); break; + case PlayerOptions::TURN_RIGHT: NoteDataUtil::Turn( *this, NoteDataUtil::right ); break; + case PlayerOptions::TURN_SHUFFLE: NoteDataUtil::Turn( *this, NoteDataUtil::shuffle ); break; + case PlayerOptions::TURN_SUPER_SHUFFLE: NoteDataUtil::Turn( *this, NoteDataUtil::super_shuffle ); break; + default: ASSERT(0); + } switch( GAMESTATE->m_PlayerOptions[pn].m_Transform ) { - case PlayerOptions::TRANSFORM_NONE: - break; - case PlayerOptions::TRANSFORM_LITTLE: - NoteDataUtil::MakeLittle(*this); - break; - case PlayerOptions::TRANSFORM_BIG: - NoteDataUtil::MakeBig(*this); - break; - default: - ASSERT(0); // invalid value - break; + case PlayerOptions::TRANSFORM_NONE: break; + case PlayerOptions::TRANSFORM_LITTLE: NoteDataUtil::Little(*this); break; + case PlayerOptions::TRANSFORM_BIG: NoteDataUtil::Big(*this); break; + default: ASSERT(0); } int iPixelsToDrawBefore = -60; diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 7e3b207946..4801b3a125 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -25,11 +25,13 @@ #include #include "ThemeManager.h" #include "SDL_keysym.h" // for SDLKeys +#include "ScreenMiniMenu.h" #include -const float RECORD_HOLD_THRESHOLD = 0.3f; +const float RECORD_HOLD_SECONDS = 0.3f; + // // Defines specific to GameScreenTitleMenu @@ -41,20 +43,26 @@ const float GRAY_ARROW_Y = ARROW_SIZE * 1.5; const float DEBUG_X = SCREEN_LEFT + 10; const float DEBUG_Y = CENTER_Y-100; -const float HELP_X = SCREEN_LEFT + 10; -const float HELP_Y = SCREEN_BOTTOM - 10; - const float SHORTCUTS_X = CENTER_X - 150; const float SHORTCUTS_Y = CENTER_Y; -const float INFO_X = SCREEN_RIGHT - 10 ; -const float INFO_Y = SCREEN_BOTTOM - 10; +const float HELP_X = SCREEN_LEFT; +const float HELP_Y = CENTER_Y; + +const float HELP_TEXT_X = SCREEN_LEFT + 4; +const float HELP_TEXT_Y = 40; + +const float INFO_X = SCREEN_RIGHT; +const float INFO_Y = CENTER_Y; + +const float INFO_TEXT_X = SCREEN_RIGHT - 114; +const float INFO_TEXT_Y = 40; const float MENU_WIDTH = 110; const float EDIT_X = CENTER_X; const float EDIT_GRAY_Y = GRAY_ARROW_Y; -const float PLAYER_X = EDIT_X; +const float PLAYER_X = CENTER_X; const float PLAYER_Y = SCREEN_TOP; const float ACTION_MENU_ITEM_X = CENTER_X-200; @@ -65,136 +73,132 @@ const float NAMING_MENU_ITEM_X = CENTER_X-200; const float NAMING_MENU_ITEM_START_Y = SCREEN_TOP + 24; const float NAMING_MENU_ITEM_SPACING_Y = 18; -#define TICK_EARLY_SECONDS THEME->GetMetricF("ScreenGameplay","TickEarlySeconds") -static float g_fTickEarlySecondsCache = 0; // reading directly out of theme metrics is slow +CachedThemeMetric TICK_EARLY_SECONDS ("ScreenGameplay","TickEarlySeconds"); + + +const ScreenMessage SM_BackFromMainMenu = (ScreenMessage)(SM_User+1); +const ScreenMessage SM_BackFromAreaMenu = (ScreenMessage)(SM_User+2); +const ScreenMessage SM_BackFromEditNotesStatistics = (ScreenMessage)(SM_User+3); +const ScreenMessage SM_BackFromEditOptions = (ScreenMessage)(SM_User+4); +const ScreenMessage SM_BackFromEditSongInfo = (ScreenMessage)(SM_User+5); + const CString HELP_TEXT = - "Esc: show command menu\n" -// "Hold F1 to show more commands\n" - "Hold keys for faster change:\n" - "F7/F8: Decrease/increase BPM at cur beat\n" - "F9/F10: Dec/inc freeze secs at cur beat\n" - "F11/F12: Decrease/increase music offset\n" - "[ and ]: Dec/inc sample music start\n" - "{ and }: Dec/inc sample music length\n" - "Up/Down: change beat\n" - "Left/Right: change snap\n" - "PgUp/PgDn: jump 1 measure\n" - "Home/End: jump to first/last beat\n" - "Number keys: add or remove tap note\n" - "To create a hold note, hold a number key\n" - " while changing the beat pressing Up/Down\n"; + "Up/Down:\n change beat\n" + "Left/Right:\n change snap\n" + "PgUp/PgDn:\n jump measure\n" + "Home/End:\n jump to first/\n last beat\n" + "Number keys:\n add/remove\n tap note\n" + "Create hold note:\n Hold a number\n while moving\n Up or Down\n" + "F7/F8:\n Dec/inc BPM\n at cur beat\n" + "F9/F10:\n Dec/inc stop\n at cur beat\n" + "F11/F12:\n Dec/inc music\n offset\n" + "[ and ]:\n Dec/inc sample\n music start\n" + "{ and }:\n Dec/inc sample\n music length\n"; -const CString SHORTCUT_TEXT = ""; -/* "S: save changes\n" - "W: save as SM and DWI (lossy)\n" - "Enter/Space: set begin/end selection markers\n" - "G/H/J/K/L: Quantize selection to nearest\n" - " 4th / 8th / 12th / 16th / 12th or 16th\n" - "P: Play selected area\n" - "R: Record in selected area\n" - "T: Toggle Play/Record rate\n" - "X: Cut selected area\n" - "C: Copy selected area\n" - "V: Paste at current beat\n" - "D: Toggle difficulty\n" - "E: Edit description\n" - "A: Edit main title\n" - "U: Edit sub title\n" - "B: Add/Edit background change\n" - "Ins: Insert blank beat\n" - "Del: Delete current beat and shift\n" - "M: Play sample music\n"; -*/ -const CString ACTION_MENU_ITEM_TEXT[NUM_ACTION_MENU_ITEMS] = { - "Enter: Set begin marker (Enter)", - "Space: Set end marker (Space)", - "P: Play selection", - "R: Record in selection", - "T: Toggle Play/Record rate", - "X: Cut selection", - "C: Copy selection", - "V: Paste clipboard at current beat", - "D: Toggle difficulty", - "E: Edit description", - "N: Edit Title/Subtitle/Artist & Transliterations", - "I: Toggle assist tick", - "B: Add/Edit background change at current beat", - "Ins: Insert blank beat and shift down", - "Del: Delete blank beat and shift up", - "G: Quantize selection to 4th notes", - "H: Quantize selection to 8th notes", - "J: Quantize selection to 12th notes", - "K: Quantize selection to 16th notes", - "L: Quantize selection to 12th or 16th notes", - "M: Play sample music", - "S: Save changes as SM and DWI", - "Q: Quit" -}; -const int ACTION_MENU_ITEM_KEY[NUM_ACTION_MENU_ITEMS] = { - SDLK_RETURN, - SDLK_SPACE, - SDLK_p, - SDLK_r, - SDLK_t, - SDLK_x, - SDLK_c, - SDLK_v, - SDLK_d, - SDLK_e, - SDLK_n, - SDLK_i, - SDLK_b, - SDLK_INSERT, - SDLK_DELETE, - SDLK_g, - SDLK_h, - SDLK_j, - SDLK_k, - SDLK_l, - SDLK_m, - SDLK_s, - SDLK_q, +MiniMenuDefinition g_MainMenu = +{ + "Main Menu", + ScreenEdit::NUM_MAIN_MENU_CHOICES, + { + { "Edit Notes Statistics", true, 1, 0, {""} }, + { "Play Whole Song", true, 1, 0, {""} }, + { "Save", true, 1, 0, {""} }, + { "Editor Options", true, 1, 0, {""} }, + { "Player Options", true, 1, 0, {""} }, + { "Song Options", true, 1, 0, {""} }, + { "Edit Song Info", true, 1, 0, {""} }, + { "Add/Edit BPM Change", true, 1, 0, {""} }, + { "Add/Edit Stop", true, 1, 0, {""} }, + { "Add/Edit BG Change", true, 1, 0, {""} }, + { "Play preview music", true, 1, 0, {""} }, + { "Exit", true, 1, 0, {""} }, + } }; -const CString NAMING_MENU_ITEM_TEXT[NUM_NAMING_MENU_ITEMS] = { - " M: Edit main title", - " S: Edit sub title", - " A: Edit artist", - "Shift-M: Edit main title transliteration", - "Shift-S: Edit sub title transliteration", - "Shift-A: Edit artist transliteration" -}; -// Pairs of keystroke + ifCapital -const std::pair NAMING_MENU_ITEM_KEY[NUM_NAMING_MENU_ITEMS] = { - std::make_pair(SDLK_m, false), - std::make_pair(SDLK_s, false), - std::make_pair(SDLK_a, false), - std::make_pair(SDLK_m, true), - std::make_pair(SDLK_s, true), - std::make_pair(SDLK_a, true), +MiniMenuDefinition g_AreaMenu = +{ + "Area Menu", + ScreenEdit::NUM_AREA_MENU_CHOICES, + { + { "Cut", true, 1, 0, {""} }, + { "Copy", true, 1, 0, {""} }, + { "Paste", true, 1, 0, {""} }, + { "Clear", true, 1, 0, {""} }, + { "Quantize", true, NUM_NOTE_TYPES, 0, {"4TH","8TH","12TH","16TH","24TH","32ND"} }, + { "Transform", true, ScreenEdit::NUM_TRANSFORM_TYPES, 0, {"Little","Big","Left","Right","Mirror","Shuffle","Super Shuffle","Backwards","Swap Sides"} }, + { "Play selection", true, 1, 0, {""} }, + { "Record in selection",true, 1, 0, {""} }, + { "Insert blank beat and shift down", true, 1, 0, {""} }, + { "Delete blank beat and shift up", true, 1, 0, {""} }, + } }; +MiniMenuDefinition g_EditNotesStatistics = +{ + "Statistics", + ScreenEdit::NUM_EDIT_NOTES_STATISTICS_CHOICES, + { + { "Difficulty", true, 5, 0, {"BEGINNER","EASY","MEDIUM","HARD","CHALLENGE"} }, + { "Meter", true, 11, 0, {"1","2","3","4","5","6","7","8","9","10","11"} }, + { "Description",true, 1, 0, {""} }, + { "Tap Notes", false, 1, 0, {""} }, + { "Hold Notes", false, 1, 0, {""} }, + { "Stream", false, 1, 0, {""} }, + { "Voltage", false, 1, 0, {""} }, + { "Air", false, 1, 0, {""} }, + { "Freeze", false, 1, 0, {""} }, + { "Chaos", false, 1, 0, {""} }, + } +}; + + +MiniMenuDefinition g_EditOptions = +{ + "Edit Options", + ScreenEdit::NUM_EDIT_OPTIONS_CHOICES, + { + { "Zoom", true, 3, 0, {"1X","2X","4X"} }, + { "Max Notes Per Row", true, 4, 0, {"NO LIMIT","2","3","4"} }, + { "After Note Add", true, 2, 0, {"STAY","NEXT LINE"} }, + } +}; + +MiniMenuDefinition g_EditSongInfo = +{ + "Edit Song Info", + ScreenEdit::NUM_EDIT_SONG_INFO_CHOICES, + { + { "Main title", true, 1, 0, {""} }, + { "Sub title", true, 1, 0, {""} }, + { "Artist", true, 1, 0, {""} }, + { "Main title transliteration", true, 1, 0, {""} }, + { "Sub title transliteration", true, 1, 0, {""} }, + { "Artist transliteration", true, 1, 0, {""} }, + } +}; + ScreenEdit::ScreenEdit() { LOG->Trace( "ScreenEdit::ScreenEdit()" ); + TICK_EARLY_SECONDS.Refresh(); + // set both players to joined so the credit message doesn't show for( int p=0; pm_bSideIsJoined[p] = true; SCREENMAN->RefreshCreditsMessages(); m_iRowLastCrossed = -1; + m_fDestinationScrollSpeed = 1; m_pSong = GAMESTATE->m_pCurSong; m_pNotes = GAMESTATE->m_pCurNotes[PLAYER_1]; - g_fTickEarlySecondsCache = TICK_EARLY_SECONDS; - /* Make EditMenu responsible for creating new Notes */ //if( m_pNotes == NULL ) //{ @@ -264,33 +268,27 @@ ScreenEdit::ScreenEdit() m_Fade.SetClosed(); - m_textInfo.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); - m_textInfo.SetXY( INFO_X, INFO_Y ); - m_textInfo.SetHorizAlign( Actor::align_right ); - m_textInfo.SetVertAlign( Actor::align_bottom ); - m_textInfo.SetZoom( 0.5f ); - m_textInfo.SetShadowLength( 2 ); - //m_textInfo.SetText(); // set this below every frame + m_sprHelp.Load( THEME->GetPathTo("Graphics","edit help") ); + m_sprHelp.SetHorizAlign( Actor::align_left ); + m_sprHelp.SetXY( HELP_X, HELP_Y ); m_textHelp.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); - m_textHelp.SetXY( HELP_X, HELP_Y ); + m_textHelp.SetXY( HELP_TEXT_X, HELP_TEXT_Y ); m_textHelp.SetHorizAlign( Actor::align_left ); - m_textHelp.SetVertAlign( Actor::align_bottom ); + m_textHelp.SetVertAlign( Actor::align_top ); m_textHelp.SetZoom( 0.5f ); - m_textHelp.SetShadowLength( 2 ); m_textHelp.SetText( HELP_TEXT ); - m_rectShortcutsBack.StretchTo( RectI(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) ); - m_rectShortcutsBack.SetDiffuse( RageColor(0,0,0,0.8f) ); - - m_textShortcuts.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); - m_textShortcuts.SetXY( SHORTCUTS_X, SHORTCUTS_Y ); - m_textShortcuts.SetHorizAlign( Actor::align_left ); - m_textShortcuts.SetVertAlign( Actor::align_middle ); - m_textShortcuts.SetZoom( 0.5f ); - m_textShortcuts.SetShadowLength( 2 ); - m_textShortcuts.SetText( SHORTCUT_TEXT ); + m_sprInfo.Load( THEME->GetPathTo("Graphics","edit info") ); + m_sprInfo.SetHorizAlign( Actor::align_right ); + m_sprInfo.SetXY( INFO_X, INFO_Y ); + m_textInfo.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + m_textInfo.SetXY( INFO_TEXT_X, INFO_TEXT_Y ); + m_textInfo.SetHorizAlign( Actor::align_left ); + m_textInfo.SetVertAlign( Actor::align_top ); + m_textInfo.SetZoom( 0.5f ); + //m_textInfo.SetText(); // set this below every frame m_soundChangeLine.Load( THEME->GetPathTo("Sounds","edit change line") ); m_soundChangeSnap.Load( THEME->GetPathTo("Sounds","edit change snap") ); @@ -303,26 +301,6 @@ ScreenEdit::ScreenEdit() m_soundAssistTick.Load( THEME->GetPathTo("Sounds","gameplay assist tick") ); - for( int i=0; iGetPathTo("Fonts","normal") ); - m_textActionMenu[i].SetXY( ACTION_MENU_ITEM_X, ACTION_MENU_ITEM_START_Y + ACTION_MENU_ITEM_SPACING_Y*i ); - m_textActionMenu[i].SetHorizAlign( Actor::align_left ); - m_textActionMenu[i].SetZoom( 0.5f ); - m_textActionMenu[i].SetShadowLength( 2 ); - m_textActionMenu[i].SetText( ACTION_MENU_ITEM_TEXT[i] ); - } - for( int j=0; jGetPathTo("Fonts","normal") ); - m_textNamingMenu[j].SetXY( NAMING_MENU_ITEM_X, NAMING_MENU_ITEM_START_Y + NAMING_MENU_ITEM_SPACING_Y*j ); - m_textNamingMenu[j].SetHorizAlign( Actor::align_left ); - m_textNamingMenu[j].SetZoom( 0.5f ); - m_textNamingMenu[j].SetShadowLength( 2 ); - m_textNamingMenu[j].SetText( NAMING_MENU_ITEM_TEXT[j] ); - } - m_iMenuSelection = 0; - m_Fade.OpenWipingRight(); } @@ -345,7 +323,7 @@ bool ScreenEdit::PlayTicks() const float fPositionSeconds = GAMESTATE->m_fMusicSeconds; // HACK: Play the sound a little bit early to account for the fact that the middle of the tick sounds occurs 0.015 seconds into playing. - fPositionSeconds += (SOUNDMAN->GetPlayLatency()+g_fTickEarlySecondsCache) * m_soundMusic.GetPlaybackRate(); + fPositionSeconds += (SOUNDMAN->GetPlayLatency()+(float)TICK_EARLY_SECONDS) * m_soundMusic.GetPlaybackRate(); float fSongBeat=GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds ); int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); @@ -364,6 +342,17 @@ bool ScreenEdit::PlayTicks() const void ScreenEdit::Update( float fDeltaTime ) { + // approach destonation scroll speed + if( m_fDestinationScrollSpeed != GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed ) + { + float fDelta = m_fDestinationScrollSpeed - GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed; + float fSign = fDelta / fabsf(fDelta); + float fToMove = fSign * fDeltaTime * 4 * (m_fDestinationScrollSpeed>2 ? 2 : 1); + CLAMP( fToMove, -fabsf(fDelta), fabsf(fDelta) ); + GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed += fToMove; + } + + float fPositionSeconds = m_soundMusic.GetPositionSeconds(); float fSongBeat, fBPS; bool bFreeze; @@ -385,7 +374,7 @@ void ScreenEdit::Update( float fDeltaTime ) StyleInput StyleI( PLAYER_1, t ); float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI ); - if( fSecsHeld > RECORD_HOLD_THRESHOLD ) + if( fSecsHeld > RECORD_HOLD_SECONDS ) { // add or extend hold const float fHoldStartSeconds = m_soundMusic.GetPositionSeconds() - fSecsHeld; @@ -427,10 +416,10 @@ void ScreenEdit::Update( float fDeltaTime ) m_GrayArrowRowEdit.Update( fDeltaTime ); m_NoteFieldEdit.Update( fDeltaTime ); m_Fade.Update( fDeltaTime ); + m_sprHelp.Update( fDeltaTime ); m_textHelp.Update( fDeltaTime ); + m_sprInfo.Update( fDeltaTime ); m_textInfo.Update( fDeltaTime ); - m_rectShortcutsBack.Update( fDeltaTime ); - m_textShortcuts.Update( fDeltaTime ); m_rectRecordBack.Update( fDeltaTime ); @@ -459,7 +448,7 @@ void ScreenEdit::Update( float fDeltaTime ) else { float fSign = fDelta / fabsf(fDelta); - float fMoveDelta = fSign*fDeltaTime*40; + float fMoveDelta = fSign*fDeltaTime*40 / GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed; if( fabsf(fMoveDelta) > fabsf(fDelta) ) fMoveDelta = fDelta; m_fTrailingBeat += fMoveDelta; @@ -468,18 +457,6 @@ void ScreenEdit::Update( float fDeltaTime ) m_fTrailingBeat += fDelta * fDeltaTime*5; } - if( m_EditMode == MODE_ACTION_MENU ) - { - for( int i=0; im_fSongBeat, - m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker, - GAMESTATE->m_SongOptions.m_fMusicRate, - DifficultyToString( m_pNotes->GetDifficulty() ).GetString(), - GAMESTATE->m_pCurNotes[PLAYER_1] ? GAMESTATE->m_pCurNotes[PLAYER_1]->GetDescription().GetString() : "no description", - m_pSong->m_sMainTitle.GetString(), - m_pSong->m_sSubTitle.GetString(), - iNumTapNotes, iNumHoldNotes, - GAMESTATE->m_SongOptions.m_AssistType==SongOptions::ASSIST_TICK ? "ON" : "OFF", - m_pSong->m_fBeat0OffsetInSeconds, - m_pSong->m_fMusicSampleStartSeconds, m_pSong->m_fMusicSampleLengthSeconds - ) ); + CString sText; + sText += ssprintf( "Current Beat:\n %.2f\n", GAMESTATE->m_fSongBeat ); + sText += ssprintf( "Snap to:\n %s\n", sNoteType.GetString() ); + sText += ssprintf( "Selection begin:\n %.2f\n", m_NoteFieldEdit.m_fBeginMarker ); + sText += ssprintf( "Selection end:\n %.2f\n", m_NoteFieldEdit.m_fEndMarker ); + sText += ssprintf( "Difficulty:\n %s\n", DifficultyToString( m_pNotes->GetDifficulty() ).GetString() ); + sText += ssprintf( "Description:\n %s\n", GAMESTATE->m_pCurNotes[PLAYER_1] ? GAMESTATE->m_pCurNotes[PLAYER_1]->GetDescription().GetString() : "no description" ); + sText += ssprintf( "Main title:\n %s\n", m_pSong->m_sMainTitle.GetString() ); + sText += ssprintf( "Sub title:\n %s\n", m_pSong->m_sSubTitle.GetString() ); + sText += ssprintf( "Tap Notes:\n %d\n", iNumTapNotes ); + sText += ssprintf( "Hold Notes:\n %d\n", iNumHoldNotes ); + sText += ssprintf( "Beat 0 Offset:\n %.2f secs\n", m_pSong->m_fBeat0OffsetInSeconds ); + sText += ssprintf( "Preview Start:\n %.2f secs\n", m_pSong->m_fMusicSampleStartSeconds ); + sText += ssprintf( "Preview Length:\n %.2f secs\n",m_pSong->m_fMusicSampleLengthSeconds ); + + m_textInfo.SetText( sText ); } @@ -551,14 +518,12 @@ void ScreenEdit::DrawPrimitives() m_NoteFieldEdit.Draw(); GAMESTATE->m_fSongBeat = fSongBeat; // restore real song beat + m_sprHelp.Draw(); m_textHelp.Draw(); + m_sprInfo.Draw(); m_textInfo.Draw(); m_Fade.Draw(); -/* if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD,SDLK_F1) ) ) - { - m_rectShortcutsBack.Draw(); - m_textShortcuts.Draw(); - } */ + m_rectRecordBack.Draw(); @@ -573,34 +538,6 @@ void ScreenEdit::DrawPrimitives() m_Player.Draw(); } - if( m_EditMode == MODE_RECORDING ) - { - /* - for( int t=0; tGetCurrentStyleDef()->m_iColsPerPlayer; t++ ) - { - if( m_bLayingAHold[t] ) - { - bool bHoldingButton = false; - for( int p=0; pIsButtonDown( StyleInput(PlayerInput(p), t) ); - if( bHoldingButton - } - } - */ - } - - if( m_EditMode == MODE_ACTION_MENU ) - { - for( int i=0; iSetNewScreen( "ScreenEditMenu" ); - break; - case SDLK_s: - { - // copy edit into current Notes - Notes* pNotes = GAMESTATE->m_pCurNotes[PLAYER_1]; - ASSERT( pNotes ); - - pNotes->SetNoteData( &m_NoteFieldEdit ); - GAMESTATE->m_pCurSong->Save(); - - SCREENMAN->SystemMessage( "Saved as SM and DWI." ); - SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","edit save") ); - } - break; case SDLK_UP: case SDLK_DOWN: case SDLK_PAGEUP: case SDLK_PAGEDOWN: { + if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD,SDLK_LCTRL)) || + INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD,SDLK_RCTRL)) ) + { + if( DeviceI.button == SDLK_UP ) + { + if( m_fDestinationScrollSpeed == 4 ) + { + m_fDestinationScrollSpeed = 2; + m_soundMarker.Play(); + } + else if( m_fDestinationScrollSpeed == 2 ) + { + m_fDestinationScrollSpeed = 1; + m_soundMarker.Play(); + } + break; + } + else if( DeviceI.button == SDLK_DOWN ) + { + if( m_fDestinationScrollSpeed == 1 ) + { + m_fDestinationScrollSpeed = 2; + m_soundMarker.Play(); + } + else if( m_fDestinationScrollSpeed == 2 ) + { + m_fDestinationScrollSpeed = 4; + m_soundMarker.Play(); + } + break; + } + } + float fBeatsToMove=0.f; switch( DeviceI.button ) { @@ -855,173 +807,62 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ m_SnapDisplay.NextSnapMode(); OnSnapModeChange(); break; - case SDLK_RETURN: - case SDLK_KP_ENTER: - if( m_NoteFieldEdit.m_fEndMarker != -1 && GAMESTATE->m_fSongBeat > m_NoteFieldEdit.m_fEndMarker ) - { - // invalid! The begin maker must be placed before the end marker - m_soundInvalid.Play(); - } - else - { - m_NoteFieldEdit.m_fBeginMarker = GAMESTATE->m_fSongBeat; - m_soundMarker.Play(); - } - break; case SDLK_SPACE: - if( m_NoteFieldEdit.m_fBeginMarker != -1 && GAMESTATE->m_fSongBeat < m_NoteFieldEdit.m_fBeginMarker ) + if( m_NoteFieldEdit.m_fBeginMarker==-1 && m_NoteFieldEdit.m_fEndMarker==-1 ) { - // invalid! The end maker must be placed after the begin marker - m_soundInvalid.Play(); + // lay begin marker + m_NoteFieldEdit.m_fBeginMarker = GAMESTATE->m_fSongBeat; } - else + else if( m_NoteFieldEdit.m_fEndMarker==-1 ) // only begin marker is laid { - m_NoteFieldEdit.m_fEndMarker = GAMESTATE->m_fSongBeat; - m_soundMarker.Play(); - } - break; - case SDLK_g: - case SDLK_h: - case SDLK_j: - case SDLK_k: - case SDLK_l: - { - if( m_NoteFieldEdit.m_fBeginMarker == -1 || m_NoteFieldEdit.m_fEndMarker == -1 ) + if( GAMESTATE->m_fSongBeat == m_NoteFieldEdit.m_fBeginMarker ) { - m_soundInvalid.Play(); + m_NoteFieldEdit.m_fBeginMarker = -1; } else { - NoteType noteType1; - NoteType noteType2; - switch( DeviceI.button ) - { - case SDLK_g: noteType1 = NOTE_TYPE_4TH; noteType2 = NOTE_TYPE_4TH; break; - case SDLK_h: noteType1 = NOTE_TYPE_8TH; noteType2 = NOTE_TYPE_8TH; break; - case SDLK_j: noteType1 = NOTE_TYPE_12TH; noteType2 = NOTE_TYPE_12TH; break; - case SDLK_k: noteType1 = NOTE_TYPE_16TH; noteType2 = NOTE_TYPE_16TH; break; - case SDLK_l: noteType1 = NOTE_TYPE_12TH; noteType2 = NOTE_TYPE_16TH; break; - default: ASSERT( false ); return; - } - - NoteDataUtil::SnapToNearestNoteType( m_NoteFieldEdit, noteType1, noteType2, m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker ); + m_NoteFieldEdit.m_fEndMarker = max( m_NoteFieldEdit.m_fBeginMarker, GAMESTATE->m_fSongBeat ); + m_NoteFieldEdit.m_fBeginMarker = min( m_NoteFieldEdit.m_fBeginMarker, GAMESTATE->m_fSongBeat ); } } + else // both markers are laid + { + if( GAMESTATE->m_fSongBeat == m_NoteFieldEdit.m_fBeginMarker ) + { + m_NoteFieldEdit.m_fBeginMarker = m_NoteFieldEdit.m_fEndMarker; + m_NoteFieldEdit.m_fEndMarker = -1; + } + else if( GAMESTATE->m_fSongBeat == m_NoteFieldEdit.m_fEndMarker ) + { + m_NoteFieldEdit.m_fEndMarker = -1; + } + else + { + m_NoteFieldEdit.m_fBeginMarker = GAMESTATE->m_fSongBeat; + m_NoteFieldEdit.m_fEndMarker = -1; + } + } + m_soundMarker.Play(); + break; + case SDLK_RETURN: + case SDLK_KP_ENTER: + { + // update enabled/disabled in g_AreaMenu + bool bAreaSelected = m_NoteFieldEdit.m_fBeginMarker!=-1 && m_NoteFieldEdit.m_fEndMarker!=-1; + g_AreaMenu.lines[cut].bEnabled = bAreaSelected; + g_AreaMenu.lines[copy].bEnabled = bAreaSelected; + g_AreaMenu.lines[paste].bEnabled = this->m_Clipboard.GetLastBeat() != 0; + g_AreaMenu.lines[clear].bEnabled = bAreaSelected; + g_AreaMenu.lines[quantize].bEnabled = bAreaSelected; + g_AreaMenu.lines[transform].bEnabled = bAreaSelected; + g_AreaMenu.lines[record].bEnabled = bAreaSelected; + g_AreaMenu.lines[insert_and_shift].bEnabled = !bAreaSelected; + g_AreaMenu.lines[delete_and_shift].bEnabled = !bAreaSelected; + SCREENMAN->MiniMenu( &g_AreaMenu, SM_BackFromAreaMenu ); + } break; case SDLK_ESCAPE: - { - m_EditMode = MODE_ACTION_MENU; - m_iMenuSelection = 0; - MenuItemGainFocus( &m_textActionMenu[m_iMenuSelection] ); - - m_rectRecordBack.StopTweening(); - m_rectRecordBack.BeginTweening( 0.5f ); - m_rectRecordBack.SetTweenDiffuse( RageColor(0,0,0,0.8f) ); - } - break; - case SDLK_n: - { - m_EditMode = MODE_NAMING_MENU; - m_iMenuSelection = 0; - MenuItemGainFocus( &m_textNamingMenu[m_iMenuSelection] ); - - m_rectRecordBack.StopTweening(); - m_rectRecordBack.BeginTweening( 0.5f ); - m_rectRecordBack.SetTweenDiffuse( RageColor(0,0,0,0.8f) ); - } - break; - case SDLK_r: - case SDLK_p: - { - if( m_NoteFieldEdit.m_fBeginMarker == -1 ) - m_NoteFieldEdit.m_fBeginMarker = GAMESTATE->m_fSongBeat; - if( m_NoteFieldEdit.m_fEndMarker == -1 ) - m_NoteFieldEdit.m_fEndMarker = m_pSong->m_fLastBeat; - - if(DeviceI.button == SDLK_r) { - m_EditMode = MODE_RECORDING; - - // initialize m_NoteFieldRecord - m_NoteFieldRecord.ClearAll(); - m_NoteFieldRecord.SetNumTracks( m_NoteFieldEdit.GetNumTracks() ); - m_NoteFieldRecord.m_fBeginMarker = m_NoteFieldEdit.m_fBeginMarker; - m_NoteFieldRecord.m_fEndMarker = m_NoteFieldEdit.m_fEndMarker; - - } else { - m_EditMode = MODE_PLAYING; - - m_Player.Load( PLAYER_1, (NoteData*)&m_NoteFieldEdit, NULL, NULL ); - } - - m_rectRecordBack.StopTweening(); - m_rectRecordBack.BeginTweening( 0.5f ); - m_rectRecordBack.SetTweenDiffuse( RageColor(0,0,0,0.8f) ); - - GAMESTATE->m_fSongBeat = m_NoteFieldEdit.m_fBeginMarker - 4; // give a 1 measure lead-in - float fStartSeconds = m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) ; - m_soundMusic.SetPositionSeconds( fStartSeconds ); - m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate ); - m_soundMusic.StartPlaying(); - } - break; - case SDLK_t: - if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.0f ) GAMESTATE->m_SongOptions.m_fMusicRate = 0.9f; - else if( GAMESTATE->m_SongOptions.m_fMusicRate == 0.9f ) GAMESTATE->m_SongOptions.m_fMusicRate = 0.8f; - else if( GAMESTATE->m_SongOptions.m_fMusicRate == 0.8f ) GAMESTATE->m_SongOptions.m_fMusicRate = 0.7f; - else if( GAMESTATE->m_SongOptions.m_fMusicRate == 0.7f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.5f; - else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.5f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.4f; - else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.4f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.3f; - else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.3f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.2f; - else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.2f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.1f; - else if( GAMESTATE->m_SongOptions.m_fMusicRate == 1.1f ) GAMESTATE->m_SongOptions.m_fMusicRate = 1.0f; - break; - case SDLK_INSERT: - case SDLK_DELETE: - { - NoteData temp; - temp.SetNumTracks( m_NoteFieldEdit.GetNumTracks() ); - int iTakeFromRow=0; - int iPasteAtRow; - switch( DeviceI.button ) - { - case SDLK_INSERT: - iTakeFromRow = BeatToNoteRow( GAMESTATE->m_fSongBeat ); - iPasteAtRow = BeatToNoteRow( GAMESTATE->m_fSongBeat+1 ); - break; - case SDLK_DELETE: - iTakeFromRow = BeatToNoteRow( GAMESTATE->m_fSongBeat+1 ); - iPasteAtRow = BeatToNoteRow( GAMESTATE->m_fSongBeat ); - break; - } - temp.CopyRange( &m_NoteFieldEdit, iTakeFromRow, m_NoteFieldEdit.GetLastRow() ); - m_NoteFieldEdit.ClearRange( min(iTakeFromRow,iPasteAtRow), m_NoteFieldEdit.GetLastRow() ); - m_NoteFieldEdit.CopyRange( &temp, 0, temp.GetLastRow(), iPasteAtRow ); - } - break; - case SDLK_x: - case SDLK_c: - if( m_NoteFieldEdit.m_fBeginMarker == -1 || m_NoteFieldEdit.m_fEndMarker == -1 ) - { - m_soundInvalid.Play(); - SCREENMAN->SystemMessage( "You must select a range before copying." ); - } else { - int iFirstRow = BeatToNoteRow( m_NoteFieldEdit.m_fBeginMarker ); - int iLastRow = BeatToNoteRow( m_NoteFieldEdit.m_fEndMarker ); - - m_Clipboard.ClearAll(); - m_Clipboard.CopyRange( &m_NoteFieldEdit, iFirstRow, iLastRow ); - if(DeviceI.button == SDLK_x) - m_NoteFieldEdit.ClearRange( iFirstRow, iLastRow ); - } - break; - case SDLK_v: - { - int iSrcFirstRow = 0; - int iSrcLastRow = BeatToNoteRow( m_Clipboard.GetLastBeat() ); - int iDestFirstRow = BeatToNoteRow( GAMESTATE->m_fSongBeat ); - - m_NoteFieldEdit.CopyRange( &m_Clipboard, iSrcFirstRow, iSrcLastRow, iDestFirstRow ); - } + SCREENMAN->MiniMenu( &g_MainMenu, SM_BackFromMainMenu ); break; case SDLK_d: @@ -1153,13 +994,6 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ m_pSong->m_fBeat0OffsetInSeconds += fOffsetDelta; } break; - case SDLK_m: - SOUNDMAN->PlayMusic(""); - SOUNDMAN->PlayMusic( m_pSong->GetMusicPath(), false, - m_pSong->m_fMusicSampleStartSeconds, - m_pSong->m_fMusicSampleLengthSeconds, - 1.5f ); - break; case SDLK_LEFTBRACKET: case SDLK_RIGHTBRACKET: { @@ -1228,119 +1062,6 @@ void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType t } } -void ScreenEdit::InputActionMenu( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) -{ - if( DeviceI.device != DEVICE_KEYBOARD ) - return; - if(type == IET_RELEASE) return; // don't care - - switch( DeviceI.button ) - { - case SDLK_UP: - MenuItemLoseFocus( &m_textActionMenu[m_iMenuSelection] ); - m_iMenuSelection = (m_iMenuSelection-1+NUM_ACTION_MENU_ITEMS) % NUM_ACTION_MENU_ITEMS; - LOG->Trace( "%d\n", m_iMenuSelection ); - MenuItemGainFocus( &m_textActionMenu[m_iMenuSelection] ); - break; - case SDLK_DOWN: - MenuItemLoseFocus( &m_textActionMenu[m_iMenuSelection] ); - m_iMenuSelection = (m_iMenuSelection+1) % NUM_ACTION_MENU_ITEMS; - LOG->Trace( "%d\n", m_iMenuSelection ); - MenuItemGainFocus( &m_textActionMenu[m_iMenuSelection] ); - break; - case SDLK_RETURN: - case SDLK_ESCAPE: - TransitionToEdit(); - MenuItemLoseFocus( &m_textActionMenu[m_iMenuSelection] ); - if( DeviceI.button == SDLK_RETURN ) - { - SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","menu start") ); - int iMenuKey = ACTION_MENU_ITEM_KEY[m_iMenuSelection]; - InputEdit( DeviceInput(DEVICE_KEYBOARD,iMenuKey), IET_FIRST_PRESS, GameInput(), MenuInput(), StyleInput() ); - } - break; - default: - // On recognized keys, behave as on the top level - for(int i=0; iPlayOnce( THEME->GetPathTo("Sounds","menu start") ); - InputEdit( DeviceI, IET_FIRST_PRESS, GameInput(), MenuInput(), StyleInput() ); - } - } - break; - } -} - -void ScreenEdit::InputNamingMenu( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, bool forceShiftPressed ) -{ - if( DeviceI.device != DEVICE_KEYBOARD ) - return; - if(type == IET_RELEASE) return; // don't care - - bool translit = forceShiftPressed || - INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, SDLK_LSHIFT)) || - INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, SDLK_RSHIFT)); - - switch( DeviceI.button ) { - case SDLK_m: - case SDLK_s: - case SDLK_a: - case SDLK_ESCAPE: - case SDLK_RETURN: - TransitionToEdit(); - MenuItemLoseFocus( &m_textNamingMenu[m_iMenuSelection] ); - break; - } - - switch( DeviceI.button ) - { - case SDLK_m: - if(translit) { - SCREENMAN->TextEntry( SM_None, "Edit song main title transliteration.\nPress Enter to confirm,\nEscape to cancel.", m_pSong->m_sMainTitleTranslit, ChangeMainTitleTranslit, NULL); - } else { - SCREENMAN->TextEntry( SM_None, "Edit song main title.\nPress Enter to confirm,\nEscape to cancel.", m_pSong->m_sMainTitle, ChangeMainTitle, NULL ); - } - break; - - case SDLK_s: - if(translit) { - SCREENMAN->TextEntry( SM_None, "Edit song sub title transliteration.\nPress Enter to confirm,\nEscape to cancel.", m_pSong->m_sSubTitleTranslit, ChangeSubTitleTranslit, NULL); - } else { - SCREENMAN->TextEntry( SM_None, "Edit song sub title.\nPress Enter to confirm,\nEscape to cancel.", m_pSong->m_sSubTitle, ChangeSubTitle, NULL ); - } - break; - - case SDLK_a: - if(translit) { - SCREENMAN->TextEntry( SM_None, "Edit song artist transliteration.\nPress Enter to confirm,\nEscape to cancel.", m_pSong->m_sArtistTranslit, ChangeArtistTranslit, NULL); - } else { - SCREENMAN->TextEntry( SM_None, "Edit song artist.\nPress Enter to confirm,\nEscape to cancel.", m_pSong->m_sArtist, ChangeArtist, NULL ); - } - break; - - case SDLK_UP: - MenuItemLoseFocus( &m_textNamingMenu[m_iMenuSelection] ); - m_iMenuSelection = (m_iMenuSelection-1+NUM_NAMING_MENU_ITEMS) % NUM_NAMING_MENU_ITEMS; - LOG->Trace( "%d\n", m_iMenuSelection ); - MenuItemGainFocus( &m_textNamingMenu[m_iMenuSelection] ); - break; - case SDLK_DOWN: - MenuItemLoseFocus( &m_textNamingMenu[m_iMenuSelection] ); - m_iMenuSelection = (m_iMenuSelection+1) % NUM_NAMING_MENU_ITEMS; - LOG->Trace( "%d\n", m_iMenuSelection ); - MenuItemGainFocus( &m_textNamingMenu[m_iMenuSelection] ); - break; - case SDLK_RETURN: - SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","menu start") ); - const std::pair& pairMenuKey = NAMING_MENU_ITEM_KEY[m_iMenuSelection]; - InputNamingMenu( DeviceInput(DEVICE_KEYBOARD,pairMenuKey.first), IET_FIRST_PRESS, GameInput(), MenuInput(), StyleInput(), pairMenuKey.second ); - break; - } -} - void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { if( type != IET_FIRST_PRESS ) @@ -1426,9 +1147,22 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) case SM_GoToNextScreen: SCREENMAN->SetNewScreen( "ScreenEditMenu" ); break; + case SM_BackFromMainMenu: + HandleMainMenuChoice( (MainMenuChoice)ScreenMiniMenu::s_iLastLine, ScreenMiniMenu::s_iLastAnswers ); + break; + case SM_BackFromAreaMenu: + HandleAreaMenuChoice( (AreaMenuChoice)ScreenMiniMenu::s_iLastLine, ScreenMiniMenu::s_iLastAnswers ); + break; + case SM_BackFromEditNotesStatistics: + HandleEditNotesStatisticsChoice( (EditNotesStatisticsChoice)ScreenMiniMenu::s_iLastLine, ScreenMiniMenu::s_iLastAnswers ); + break; + case SM_BackFromEditOptions: + HandleEditOptionsChoice( (EditOptionsChoice)ScreenMiniMenu::s_iLastLine, ScreenMiniMenu::s_iLastAnswers ); + break; + case SM_BackFromEditSongInfo: + HandleEditSongInfoChoice( (EditSongInfoChoice)ScreenMiniMenu::s_iLastLine, ScreenMiniMenu::s_iLastAnswers ); + break; } - - } void ScreenEdit::OnSnapModeChange() @@ -1442,15 +1176,276 @@ void ScreenEdit::OnSnapModeChange() GAMESTATE->m_fSongBeat -= NoteRowToBeat( iStepIndexHangover ); } -void ScreenEdit::MenuItemGainFocus( BitmapText* menuitem ) +void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers ) { - menuitem->SetEffectDiffuseCamelion( 1.0f, RageColor(1,1,1,1), RageColor(0,1,0,1) ); - menuitem->SetZoom( 0.7f ); - SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","edit menu row") ); + switch( c ) + { + case edit_notes_statistics: + { + Notes* pNotes = GAMESTATE->m_pCurNotes[PLAYER_1]; + float fMusicSeconds = m_soundMusic.GetLengthSeconds(); + + g_EditNotesStatistics.lines[difficulty].iDefaultOption = pNotes->GetDifficulty(); + g_EditNotesStatistics.lines[meter].iDefaultOption = pNotes->GetMeter()+1; + strcpy( g_EditNotesStatistics.lines[description].szOptionsText[0], pNotes->GetDescription() ); + strcpy( g_EditNotesStatistics.lines[tap_notes].szOptionsText[0], ssprintf("%d", m_NoteFieldEdit.GetNumTapNotes()) ); + strcpy( g_EditNotesStatistics.lines[hold_notes].szOptionsText[0], ssprintf("%d", m_NoteFieldEdit.GetNumHoldNotes()) ); + strcpy( g_EditNotesStatistics.lines[stream].szOptionsText[0], ssprintf("%f", NoteDataUtil::GetStreamRadarValue(m_NoteFieldEdit,fMusicSeconds)) ); + strcpy( g_EditNotesStatistics.lines[voltage].szOptionsText[0], ssprintf("%f", NoteDataUtil::GetVoltageRadarValue(m_NoteFieldEdit,fMusicSeconds)) ); + strcpy( g_EditNotesStatistics.lines[air].szOptionsText[0], ssprintf("%f", NoteDataUtil::GetAirRadarValue(m_NoteFieldEdit,fMusicSeconds)) ); + strcpy( g_EditNotesStatistics.lines[freeze].szOptionsText[0], ssprintf("%f", NoteDataUtil::GetFreezeRadarValue(m_NoteFieldEdit,fMusicSeconds)) ); + strcpy( g_EditNotesStatistics.lines[chaos].szOptionsText[0], ssprintf("%f", NoteDataUtil::GetChaosRadarValue(m_NoteFieldEdit,fMusicSeconds)) ); + SCREENMAN->MiniMenu( &g_EditNotesStatistics, SM_BackFromEditNotesStatistics ); + } + break; + case play_whole_song: + break; + case save: + { + // copy edit into current Notes + Notes* pNotes = GAMESTATE->m_pCurNotes[PLAYER_1]; + ASSERT( pNotes ); + + pNotes->SetNoteData( &m_NoteFieldEdit ); + GAMESTATE->m_pCurSong->Save(); + + SCREENMAN->SystemMessage( "Saved as SM and DWI." ); + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","edit save") ); + } + break; + case editor_options: + SCREENMAN->MiniMenu( &g_EditOptions, SM_BackFromEditOptions ); + break; + case player_options: + break; + case song_options: + break; + case edit_song_info: + SCREENMAN->MiniMenu( &g_EditSongInfo, SM_BackFromEditSongInfo ); + break; + case edit_bpm: + break; + case edit_stop: + break; + case edit_bg_change: + break; + case play_preview_music: + SOUNDMAN->PlayMusic(""); + SOUNDMAN->PlayMusic( m_pSong->GetMusicPath(), false, + m_pSong->m_fMusicSampleStartSeconds, + m_pSong->m_fMusicSampleLengthSeconds, + 1.5f ); + break; + case exit: + SCREENMAN->SetNewScreen( "ScreenEditMenu" ); + break; + default: + ASSERT(0); + }; } -void ScreenEdit::MenuItemLoseFocus( BitmapText* menuitem ) +void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers ) { - menuitem->SetEffectNone(); - menuitem->SetZoom( 0.5f ); + switch( c ) + { + case cut: + { + HandleAreaMenuChoice( copy, iAnswers ); + HandleAreaMenuChoice( clear, iAnswers ); + } + break; + case copy: + { + ASSERT( m_NoteFieldEdit.m_fBeginMarker!=-1 && m_NoteFieldEdit.m_fEndMarker!=-1 ); + int iFirstRow = BeatToNoteRow( m_NoteFieldEdit.m_fBeginMarker ); + int iLastRow = BeatToNoteRow( m_NoteFieldEdit.m_fEndMarker ); + m_Clipboard.ClearAll(); + m_Clipboard.CopyRange( &m_NoteFieldEdit, iFirstRow, iLastRow ); + } + break; + case paste: + { + int iSrcFirstRow = 0; + int iSrcLastRow = BeatToNoteRow( m_Clipboard.GetLastBeat() ); + int iDestFirstRow = BeatToNoteRow( GAMESTATE->m_fSongBeat ); + m_NoteFieldEdit.CopyRange( &m_Clipboard, iSrcFirstRow, iSrcLastRow, iDestFirstRow ); + } + break; + case clear: + { + ASSERT( m_NoteFieldEdit.m_fBeginMarker!=-1 && m_NoteFieldEdit.m_fEndMarker!=-1 ); + int iFirstRow = BeatToNoteRow( m_NoteFieldEdit.m_fBeginMarker ); + int iLastRow = BeatToNoteRow( m_NoteFieldEdit.m_fEndMarker ); + m_NoteFieldEdit.ClearRange( iFirstRow, iLastRow ); + } + break; + case quantize: + { + NoteType nt = (NoteType)iAnswers[c]; + NoteDataUtil::SnapToNearestNoteType( m_NoteFieldEdit, nt, nt, m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker ); + } + break; + case transform: + { + HandleAreaMenuChoice( cut, iAnswers ); + + TransformType tt = (TransformType)iAnswers[c]; + switch( tt ) + { + case little: NoteDataUtil::Little( m_Clipboard ); break; + case big: NoteDataUtil::Big( m_Clipboard ); break; + case left: NoteDataUtil::Turn( m_Clipboard, NoteDataUtil::left ); break; + case right: NoteDataUtil::Turn( m_Clipboard, NoteDataUtil::right ); break; + case shuffle: NoteDataUtil::Turn( m_Clipboard, NoteDataUtil::shuffle ); break; + case super_shuffle: NoteDataUtil::Turn( m_Clipboard, NoteDataUtil::super_shuffle ); break; + case backwards: NoteDataUtil::Backwards( m_Clipboard ); break; + case swap_sides: NoteDataUtil::SwapSides( m_Clipboard ); break; + default: ASSERT(0); + } + + HandleAreaMenuChoice( paste, iAnswers ); + } + break; + case play: + { + ASSERT( m_NoteFieldEdit.m_fBeginMarker!=-1 && m_NoteFieldEdit.m_fEndMarker!=-1 ); + + m_EditMode = MODE_PLAYING; + + m_Player.Load( PLAYER_1, (NoteData*)&m_NoteFieldEdit, NULL, NULL ); + + m_rectRecordBack.StopTweening(); + m_rectRecordBack.BeginTweening( 0.5f ); + m_rectRecordBack.SetTweenDiffuse( RageColor(0,0,0,0.8f) ); + + GAMESTATE->m_fSongBeat = m_NoteFieldEdit.m_fBeginMarker - 4; // give a 1 measure lead-in + float fStartSeconds = m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) ; + m_soundMusic.SetPositionSeconds( fStartSeconds ); + m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate ); + m_soundMusic.StartPlaying(); + } + break; + case record: + { + ASSERT( m_NoteFieldEdit.m_fBeginMarker!=-1 && m_NoteFieldEdit.m_fEndMarker!=-1 ); + + m_EditMode = MODE_RECORDING; + + // initialize m_NoteFieldRecord + m_NoteFieldRecord.ClearAll(); + m_NoteFieldRecord.SetNumTracks( m_NoteFieldEdit.GetNumTracks() ); + m_NoteFieldRecord.m_fBeginMarker = m_NoteFieldEdit.m_fBeginMarker; + m_NoteFieldRecord.m_fEndMarker = m_NoteFieldEdit.m_fEndMarker; + + m_rectRecordBack.StopTweening(); + m_rectRecordBack.BeginTweening( 0.5f ); + m_rectRecordBack.SetTweenDiffuse( RageColor(0,0,0,0.8f) ); + + GAMESTATE->m_fSongBeat = m_NoteFieldEdit.m_fBeginMarker - 4; // give a 1 measure lead-in + float fStartSeconds = m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) ; + m_soundMusic.SetPositionSeconds( fStartSeconds ); + m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate ); + m_soundMusic.StartPlaying(); + } + break; + case insert_and_shift: + { + NoteData temp; + temp.SetNumTracks( m_NoteFieldEdit.GetNumTracks() ); + int iTakeFromRow=0; + int iPasteAtRow; + + iTakeFromRow = BeatToNoteRow( GAMESTATE->m_fSongBeat ); + iPasteAtRow = BeatToNoteRow( GAMESTATE->m_fSongBeat+1 ); + + temp.CopyRange( &m_NoteFieldEdit, iTakeFromRow, m_NoteFieldEdit.GetLastRow() ); + m_NoteFieldEdit.ClearRange( min(iTakeFromRow,iPasteAtRow), m_NoteFieldEdit.GetLastRow() ); + m_NoteFieldEdit.CopyRange( &temp, 0, temp.GetLastRow(), iPasteAtRow ); + } + break; + case delete_and_shift: + { + NoteData temp; + temp.SetNumTracks( m_NoteFieldEdit.GetNumTracks() ); + int iTakeFromRow=0; + int iPasteAtRow; + + iTakeFromRow = BeatToNoteRow( GAMESTATE->m_fSongBeat+1 ); + iPasteAtRow = BeatToNoteRow( GAMESTATE->m_fSongBeat ); + + temp.CopyRange( &m_NoteFieldEdit, iTakeFromRow, m_NoteFieldEdit.GetLastRow() ); + m_NoteFieldEdit.ClearRange( min(iTakeFromRow,iPasteAtRow), m_NoteFieldEdit.GetLastRow() ); + m_NoteFieldEdit.CopyRange( &temp, 0, temp.GetLastRow(), iPasteAtRow ); + } + break; + default: + ASSERT(0); + }; + } + +void ScreenEdit::HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, int* iAnswers ) +{ + switch( c ) + { + case difficulty: + break; + case meter: + break; + case description: + break; + case tap_notes: + break; + case hold_notes: + break; + case stream: + break; + case voltage: + break; + case air: + break; + case freeze: + break; + case chaos: + break; + default: + ASSERT(0); + }; + +} + +void ScreenEdit::HandleEditOptionsChoice( EditOptionsChoice c, int* iAnswers ) +{ + switch( c ) + { + case zoom: + break; + case max_notes_per_row: + break; + case after_note_add: + break; + default: + ASSERT(0); + }; +} + +void ScreenEdit::HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers ) +{ + switch( c ) + { + case main_title: + break; + case sub_title: + break; + case artist: + break; + case main_title_transliteration: + break; + case sub_title_transliteration: + break; + case artist_transliteration: + break; + default: + ASSERT(0); + }; +} \ No newline at end of file diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index 0f8331cf31..9d0014f492 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -36,8 +36,6 @@ public: virtual void DrawPrimitives(); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); void InputEdit( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); - void InputActionMenu( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); - void InputNamingMenu( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI, bool forceShiftPressed = false ); void InputRecord( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); void InputPlay( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); virtual void HandleScreenMessage( const ScreenMessage SM ); @@ -52,7 +50,7 @@ protected: void MenuItemLoseFocus( BitmapText* menuitem ); - enum EditMode { MODE_EDITING, MODE_ACTION_MENU, MODE_NAMING_MENU, MODE_RECORDING, MODE_PLAYING }; + enum EditMode { MODE_EDITING, MODE_RECORDING, MODE_PLAYING }; EditMode m_EditMode; Song* m_pSong; @@ -64,10 +62,10 @@ protected: SnapDisplay m_SnapDisplay; GrayArrowRow m_GrayArrowRowEdit; - BitmapText m_textInfo; // status information that changes + Sprite m_sprHelp; BitmapText m_textHelp; - Quad m_rectShortcutsBack; - BitmapText m_textShortcuts; + Sprite m_sprInfo; + BitmapText m_textInfo; // status information that changes // keep track of where we are and what we're doing float m_fTrailingBeat; // this approaches GAMESTATE->m_fSongBeat, which is the actual beat @@ -75,6 +73,8 @@ protected: * -1 when shift isn't pressed: */ float shiftAnchor; + float m_fDestinationScrollSpeed; + NoteData m_Clipboard; RageSound m_soundChangeLine; @@ -99,13 +99,78 @@ protected: Quad m_rectRecordBack; RageSound m_soundMusic; - int m_iMenuSelection; - BitmapText m_textActionMenu[NUM_ACTION_MENU_ITEMS]; - BitmapText m_textNamingMenu[NUM_NAMING_MENU_ITEMS]; - int m_iRowLastCrossed; RageSound m_soundAssistTick; + +public: + enum MainMenuChoice { + edit_notes_statistics, + play_whole_song, + save, + editor_options, + player_options, + song_options, + edit_song_info, + edit_bpm, + edit_stop, + edit_bg_change, + play_preview_music, + exit, + NUM_MAIN_MENU_CHOICES + }; + void HandleMainMenuChoice( MainMenuChoice c, int* iAnswers ); + + enum AreaMenuChoice { + cut, + copy, + paste, + clear, + quantize, + transform, + play, + record, + insert_and_shift, + delete_and_shift, + NUM_AREA_MENU_CHOICES + }; + void HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers ); + enum TransformType { little, big, left, right, mirror, shuffle, super_shuffle, backwards, swap_sides, NUM_TRANSFORM_TYPES }; + + enum EditNotesStatisticsChoice { + difficulty, + meter, + description, + tap_notes, + hold_notes, + stream, + voltage, + air, + freeze, + chaos, + NUM_EDIT_NOTES_STATISTICS_CHOICES + }; + void HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, int* iAnswers ); + + enum EditOptionsChoice { + zoom, + max_notes_per_row, + after_note_add, + NUM_EDIT_OPTIONS_CHOICES + }; + void HandleEditOptionsChoice( EditOptionsChoice c, int* iAnswers ); + + enum EditSongInfoChoice { + main_title, + sub_title, + artist, + main_title_transliteration, + sub_title_transliteration, + artist_transliteration, + NUM_EDIT_SONG_INFO_CHOICES + }; + void HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers ); + }; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 48d7ed6f63..db0e89e31b 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -330,7 +330,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) m_textOniPercentLarge[p].SetXY( PERCENT_BASE_X(p), PERCENT_BASE_Y ); m_textOniPercentLarge[p].SetHorizAlign( Actor::align_right ); m_textOniPercentLarge[p].SetVertAlign( Actor::align_bottom ); - m_textOniPercentLarge[p].SetEffectGlowCamelion( 2.5f ); + m_textOniPercentLarge[p].SetEffectGlowShift( 2.5f ); this->AddChild( &m_textOniPercentLarge[p] ); m_textOniPercentSmall[p].LoadFromNumbers( THEME->GetPathTo("Numbers","evaluation percent numbers") ); @@ -339,7 +339,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) m_textOniPercentSmall[p].SetXY( PERCENT_BASE_X(p), PERCENT_BASE_Y ); m_textOniPercentSmall[p].SetHorizAlign( Actor::align_left ); m_textOniPercentSmall[p].SetVertAlign( Actor::align_bottom ); - m_textOniPercentSmall[p].SetEffectGlowCamelion( 2.5f ); + m_textOniPercentSmall[p].SetEffectGlowShift( 2.5f ); this->AddChild( &m_textOniPercentSmall[p] ); stageStats.iPossibleDancePoints[p] = max( 1, stageStats.iPossibleDancePoints[p] ); @@ -381,7 +381,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) m_Grades[p].SetXY( GRADE_X(p), GRADE_Y ); m_Grades[p].SetZ( 2 ); m_Grades[p].SetZoom( 1.0f ); - m_Grades[p].SetEffectGlowCamelion( 1.0f, GRADES_GLOW_COLOR_1, GRADES_GLOW_COLOR_2 ); + m_Grades[p].SetEffectGlowShift( 1.0f, GRADES_GLOW_COLOR_1, GRADES_GLOW_COLOR_2 ); if( SPIN_GRADES ) m_Grades[p].SpinAndSettleOn( grade[p] ); else @@ -424,7 +424,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) m_sprActualBar[p][r].BeginTweening( 1.0f ); // tween m_sprActualBar[p][r].SetTweenZoomToWidth( BAR_WIDTH*stageStats.fRadarActual[p][r] ); if( stageStats.fRadarActual[p][r] == stageStats.fRadarPossible[p][r] ) - m_sprActualBar[p][r].SetEffectGlowCamelion(); + m_sprActualBar[p][r].SetEffectGlowShift(); this->AddChild( &m_sprActualBar[p][r] ); } break; @@ -435,7 +435,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) { m_sprNewRecord[p].Load( THEME->GetPathTo("Graphics","evaluation new record") ); m_sprNewRecord[p].SetXY( NEW_RECORD_X(p), NEW_RECORD_Y ); - m_sprNewRecord[p].SetEffectGlowCamelion( 2.5f ); + m_sprNewRecord[p].SetEffectGlowShift( 2.5f ); this->AddChild( &m_sprNewRecord[p] ); } } @@ -507,7 +507,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) { m_sprTryExtraStage.Load( THEME->GetPathTo("Graphics",GAMESTATE->IsExtraStage()?"evaluation try extra stage2":"evaluation try extra stage1") ); m_sprTryExtraStage.SetXY( TRY_EXTRA_STAGE_X, TRY_EXTRA_STAGE_Y ); - m_sprTryExtraStage.SetEffectGlowCamelion( 2.5f ); + m_sprTryExtraStage.SetEffectGlowShift( 2.5f ); this->AddChild( &m_sprTryExtraStage ); SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","evaluation extra stage") ); diff --git a/stepmania/src/ScreenLogo.cpp b/stepmania/src/ScreenLogo.cpp index 77dc2df28a..897c26ee56 100644 --- a/stepmania/src/ScreenLogo.cpp +++ b/stepmania/src/ScreenLogo.cpp @@ -34,7 +34,7 @@ ScreenLogo::ScreenLogo() : ScreenAttract("ScreenLogo","logo") m_sprLogo.StopTweening(); m_sprLogo.BeginTweening( 0.5f ); // sleep m_sprLogo.BeginTweening( 0.5f, Actor::TWEEN_BOUNCE_END ); - m_sprLogo.SetEffectGlowCamelion(2.5f, RageColor(1,1,1,0.1f), RageColor(1,1,1,0.3f) ); + m_sprLogo.SetEffectGlowShift(2.5f, RageColor(1,1,1,0.1f), RageColor(1,1,1,0.3f) ); m_sprLogo.SetTweenZoom( 1 ); this->AddChild( &m_sprLogo ); diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index 5f85df7cc7..065b76fe8c 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -210,6 +210,7 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type #include "ScreenPrompt.h" #include "ScreenTextEntry.h" +#include "ScreenMiniMenu.h" Screen* ScreenManager::MakeNewScreen( CString sClassName ) { @@ -351,6 +352,12 @@ void ScreenManager::TextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion, m_ScreenStack.push_back( new ScreenTextEntry(SM_SendWhenDone, sQuestion, sInitialAnswer, OnOK, OnCanel) ); } +void ScreenManager::MiniMenu( MiniMenuDefinition* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel ) +{ + // add the new state onto the back of the array + m_ScreenStack.push_back( new ScreenMiniMenu(pDef, SM_SendOnOK, SM_SendOnCancel) ); +} + void ScreenManager::PopTopScreen( ScreenMessage SM ) { Screen* pScreenToPop = m_ScreenStack.back(); // top menu diff --git a/stepmania/src/ScreenManager.h b/stepmania/src/ScreenManager.h index 37e554ece4..a649f72c6e 100644 --- a/stepmania/src/ScreenManager.h +++ b/stepmania/src/ScreenManager.h @@ -20,6 +20,8 @@ #include "Quad.h" +struct MiniMenuDefinition; + class ScreenManager { public: @@ -38,6 +40,7 @@ public: void SetNewScreen( CString sClassName ); void Prompt( ScreenMessage SM_SendWhenDone, CString sText, bool bYesNo = false, bool bDefaultAnswer = false, void(*OnYes)() = NULL, void(*OnNo)() = NULL ); void TextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer) = NULL, void(*OnCanel)() = NULL ); + void MiniMenu( MiniMenuDefinition* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel = SM_None ); void PopTopScreen( ScreenMessage SM ); void SystemMessage( CString sMessage ); diff --git a/stepmania/src/ScreenMiniMenu.cpp b/stepmania/src/ScreenMiniMenu.cpp new file mode 100644 index 0000000000..83e17d3731 --- /dev/null +++ b/stepmania/src/ScreenMiniMenu.cpp @@ -0,0 +1,243 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: ScreenMiniMenu + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + + +#include "ScreenMiniMenu.h" +#include "PrefsManager.h" +#include "ScreenManager.h" +#include "RageSoundManager.h" +#include "GameConstantsAndTypes.h" +#include "PrefsManager.h" +#include "ThemeManager.h" + + +const float LABEL_X = 200; +const float ANSWER_X = 440; +const float SPACING_Y = 26; + +const ScreenMessage SM_GoToOK = (ScreenMessage)(SM_User+1); +const ScreenMessage SM_GoToCancel = (ScreenMessage)(SM_User+2); + + +int ScreenMiniMenu::s_iLastLine; +int ScreenMiniMenu::s_iLastAnswers[MAX_MINI_MENU_LINES]; + + +ScreenMiniMenu::ScreenMiniMenu( MiniMenuDefinition* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel ) +{ + m_SMSendOnOK = SM_SendOnOK; + m_SMSendOnCancel = SM_SendOnCancel; + m_Def = *pDef; + ASSERT( m_Def.iNumLines <= MAX_MINI_MENU_LINES ); + + + m_Fade.SetTransitionTime( 0.5f ); + m_Fade.SetDiffuse( RageColor(0,0,0,0.7f) ); + m_Fade.SetOpened(); + m_Fade.CloseWipingRight(); + this->AddChild( &m_Fade ); + + + float fHeightOfAll = (m_Def.iNumLines-1)*SPACING_Y; + + m_textTitle.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + m_textTitle.SetText( m_Def.szTitle ); + m_textTitle.SetXY( CENTER_X, CENTER_Y - fHeightOfAll/2 - 30 ); + m_textTitle.SetZoom( 0.8f ); + this->AddChild( &m_textTitle ); + + bool bMarkedFirstEnabledLine = false; + + for( int i=0; iGetPathTo("Fonts","normal") ); + m_textLabel[i].SetText( line.szLabel ); + m_textLabel[i].SetXY( LABEL_X, fY ); + m_textLabel[i].SetZoom( 0.5f ); + m_textLabel[i].SetHorizAlign( Actor::align_left ); + m_textLabel[i].SetDiffuse( line.bEnabled ? RageColor(1,1,1,1) : RageColor(0.5f,0.5f,0.5f,1) ); + this->AddChild( &m_textLabel[i] ); + + m_textAnswer[i].LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + m_textAnswer[i].SetText( line.szOptionsText[0] ); + m_textAnswer[i].SetXY( ANSWER_X, fY ); + m_textAnswer[i].SetZoom( 0.5f ); + m_textAnswer[i].SetHorizAlign( Actor::align_right ); + m_textAnswer[i].SetDiffuse( line.bEnabled ? RageColor(1,1,1,1) : RageColor(0.5f,0.5f,0.5f,1) ); + this->AddChild( &m_textAnswer[i] ); + + if( !bMarkedFirstEnabledLine && line.bEnabled ) + { + m_iCurLine = i; + AfterLineChanged(); + bMarkedFirstEnabledLine = true; + } + + m_iCurAnswers[i] = line.iDefaultOption; + } + + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","menu prompt") ); +} + +void ScreenMiniMenu::Update( float fDeltaTime ) +{ + Screen::Update( fDeltaTime ); +} + +void ScreenMiniMenu::DrawPrimitives() +{ + Screen::DrawPrimitives(); +} + +void ScreenMiniMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) +{ + if( m_Fade.IsOpening() ) + return; + + if( DeviceI.device==DEVICE_KEYBOARD && type==IET_FIRST_PRESS ) + { + switch( DeviceI.button ) + { + case SDLK_LEFT: + this->MenuLeft( StyleI.player ); + return; + case SDLK_RIGHT: + this->MenuRight( StyleI.player ); + return; + } + } + + Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); +} + +void ScreenMiniMenu::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_GoToOK: + SCREENMAN->PopTopScreen( m_SMSendOnOK ); + break; + case SM_GoToCancel: + SCREENMAN->PopTopScreen( m_SMSendOnCancel ); + break; + } +} + +void ScreenMiniMenu::MenuUp( PlayerNumber pn ) +{ + if( GetGoUpSpot() != -1 ) + { + BeforeLineChanged(); + m_iCurLine = GetGoUpSpot(); + AfterLineChanged(); + } +} + +void ScreenMiniMenu::MenuDown( PlayerNumber pn ) +{ + if( GetGoDownSpot() != -1 ) + { + BeforeLineChanged(); + m_iCurLine = GetGoDownSpot(); + AfterLineChanged(); + } +} + +void ScreenMiniMenu::MenuLeft( PlayerNumber pn ) +{ + if( CanGoLeft() ) + { + m_iCurAnswers[m_iCurLine]--; + AfterAnswerChanged(); + } +} + +void ScreenMiniMenu::MenuRight( PlayerNumber pn ) +{ + if( CanGoRight() ) + { + m_iCurAnswers[m_iCurLine]++; + AfterAnswerChanged(); + } +} + +void ScreenMiniMenu::MenuStart( PlayerNumber pn ) +{ + m_Fade.OpenWipingRight( SM_GoToOK ); + + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","menu start") ); + + s_iLastLine = m_iCurLine; + COPY( s_iLastAnswers, m_iCurAnswers ); +} + +void ScreenMiniMenu::MenuBack( PlayerNumber pn ) +{ + m_Fade.OpenWipingRight( SM_GoToCancel ); +} + +void ScreenMiniMenu::BeforeLineChanged() +{ + m_textLabel[m_iCurLine].SetEffectNone(); + m_textAnswer[m_iCurLine].SetEffectNone(); + m_textLabel[m_iCurLine].SetZoom( 0.5f ); + m_textAnswer[m_iCurLine].SetZoom( 0.5f ); +} + +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( 0.7f ); + m_textAnswer[m_iCurLine].SetZoom( 0.7f ); + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","mini menu row") ); +} + +void ScreenMiniMenu::AfterAnswerChanged() +{ + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","mini menu row") ); + int iAnswerInRow = m_iCurAnswers[m_iCurLine]; + CString sAnswerText = m_Def.lines[m_iCurLine].szOptionsText[iAnswerInRow]; + m_textAnswer[m_iCurLine].SetText( sAnswerText ); +} + +int ScreenMiniMenu::GetGoUpSpot() +{ + for( int i=m_iCurLine-1; i>=0; i-- ) + if( m_Def.lines[i].bEnabled ) + return i; + return -1; +} + +int ScreenMiniMenu::GetGoDownSpot() +{ + for( int i=m_iCurLine+1; iAddScreenToTop( new ScreenMiniMenu(...) ); + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Screen.h" +#include "BitmapText.h" +#include "TransitionFade.h" +#include "Quad.h" +#include "RandomSample.h" + +#define MAX_MINI_MENU_LINES 40 +#define MAX_OPTIONS_PER_LINE 20 + +struct MiniMenuDefinition +{ + char szTitle[64]; + int iNumLines; + struct MiniMenuLine + { + char szLabel[40]; + bool bEnabled; + int iNumOptions; + int iDefaultOption; + char szOptionsText[MAX_OPTIONS_PER_LINE][256]; + } lines[MAX_MINI_MENU_LINES]; +}; + + +class ScreenMiniMenu : public Screen +{ +public: + ScreenMiniMenu(); + ScreenMiniMenu( MiniMenuDefinition* 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 ); + +protected: + void MenuUp( PlayerNumber pn ); + void MenuDown( PlayerNumber pn ); + void MenuLeft( PlayerNumber pn ); + void MenuRight( PlayerNumber pn ); + void MenuBack( PlayerNumber pn ); + void MenuStart( PlayerNumber pn ); + + int GetGoUpSpot(); // return -1 if can't go up + int GetGoDownSpot(); // return -1 if can't go down + bool CanGoLeft(); + bool CanGoRight(); + + + void BeforeLineChanged(); + void AfterLineChanged(); + void AfterAnswerChanged(); + + MiniMenuDefinition m_Def; + TransitionFade m_Fade; + BitmapText m_textTitle; + BitmapText m_textLabel[MAX_MINI_MENU_LINES]; + BitmapText m_textAnswer[MAX_MINI_MENU_LINES]; + int m_iCurLine; + int m_iCurAnswers[MAX_MINI_MENU_LINES]; + ScreenMessage m_SMSendOnOK, m_SMSendOnCancel; + +public: + static int s_iLastLine; + static int s_iLastAnswers[MAX_MINI_MENU_LINES]; + +}; + diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 6c253a2466..c62d8755cd 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -379,7 +379,7 @@ void ScreenOptions::UpdateEnabledDisabled() bThisRowIsSelectedByBoth = false; m_textOptions[i][0].SetDiffuse( bThisRowIsSelectedByBoth ? colorNotSelected : colorSelected ); if( bThisRowIsSelectedByBoth ) - m_textOptions[i][0].SetEffectDiffuseCamelion( 1.0f, colorSelected, colorNotSelected ); + m_textOptions[i][0].SetEffectDiffuseShift( 1.0f, colorSelected, colorNotSelected ); else m_textOptions[i][0].SetEffectNone(); } diff --git a/stepmania/src/ScreenPrompt.cpp b/stepmania/src/ScreenPrompt.cpp index efe5039a54..805f7b472a 100644 --- a/stepmania/src/ScreenPrompt.cpp +++ b/stepmania/src/ScreenPrompt.cpp @@ -75,7 +75,7 @@ ScreenPrompt::ScreenPrompt( ScreenMessage SM_SendWhenDone, CString sText, bool b m_rectAnswerBox.SetZoomX( m_textAnswer[m_bAnswer].GetWidestLineWidthInSourcePixels()+10.0f ); m_rectAnswerBox.SetZoomY( 30 ); - m_textAnswer[m_bAnswer].SetEffectGlowCamelion(); + m_textAnswer[m_bAnswer].SetEffectGlowShift(); SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","menu prompt") ); } @@ -142,7 +142,7 @@ void ScreenPrompt::MenuRight( PlayerNumber pn ) m_textAnswer[m_bAnswer].SetEffectNone(); m_bAnswer = !m_bAnswer; - m_textAnswer[m_bAnswer].SetEffectGlowCamelion(); + m_textAnswer[m_bAnswer].SetEffectGlowShift(); m_rectAnswerBox.StopTweening(); m_rectAnswerBox.BeginTweening( 0.2f ); diff --git a/stepmania/src/ScreenRanking.cpp b/stepmania/src/ScreenRanking.cpp index dbc09e6bcd..6e4d7ff950 100644 --- a/stepmania/src/ScreenRanking.cpp +++ b/stepmania/src/ScreenRanking.cpp @@ -218,8 +218,8 @@ void ScreenRanking::SetPage( PageToShow pts ) if( bRecentHighScore ) { - m_textNames[l].SetEffectDiffuseBlinking( 10, TEXT_COLOR, RageColor(1,1,1,1) ); - m_textScores[l].SetEffectDiffuseBlinking( 10, TEXT_COLOR, RageColor(1,1,1,1) ); + m_textNames[l].SetEffectDiffuseBlinking( 0.1f, TEXT_COLOR, RageColor(1,1,1,1) ); + m_textScores[l].SetEffectDiffuseBlinking( 0.1f, TEXT_COLOR, RageColor(1,1,1,1) ); } else { diff --git a/stepmania/src/ScreenSelectDifficulty.cpp b/stepmania/src/ScreenSelectDifficulty.cpp index 971d6c7883..5923e8cb40 100644 --- a/stepmania/src/ScreenSelectDifficulty.cpp +++ b/stepmania/src/ScreenSelectDifficulty.cpp @@ -170,7 +170,7 @@ ScreenSelectDifficulty::ScreenSelectDifficulty() m_sprCursor[p].StopAnimating(); m_sprCursor[p].SetState( p ); m_sprCursor[p].TurnShadowOff(); - m_sprCursor[p].SetEffectGlowCamelion(); + m_sprCursor[p].SetEffectGlowShift(); m_framePages.AddChild( &m_sprCursor[p] ); m_sprOK[p].Load( THEME->GetPathTo("Graphics", "select difficulty ok 2x1") ); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index c618cc181b..668946e0a0 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -152,7 +152,7 @@ ScreenSelectMusic::ScreenSelectMusic() m_textSongOptions.SetXY( SONG_OPTIONS_X, SONG_OPTIONS_Y ); m_textSongOptions.SetZoom( 0.5f ); if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) - m_textSongOptions.SetEffectDiffuseCamelion( 2.5f, RageColor(1,0,0,1), RageColor(1,1,1,1) ); // blink red + m_textSongOptions.SetEffectDiffuseShift( 2.5f, RageColor(1,0,0,1), RageColor(1,1,1,1) ); // blink red m_textSongOptions.SetDiffuse( RageColor(1,1,1,1) ); // white this->AddChild( &m_textSongOptions ); @@ -777,7 +777,7 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn ) m_DifficultyIcon[pn].SetFromNotes( pn, pNotes ); if( pNotes && pNotes->IsAutogen() ) { - m_AutoGenIcon[pn].SetEffectDiffuseCamelion(); + m_AutoGenIcon[pn].SetEffectDiffuseShift(); } else { diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index c188b15024..4c1cfbe824 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -184,7 +184,7 @@ void ScreenSelectStyle::BeforeChange() void ScreenSelectStyle::AfterChange() { - m_sprIcon[m_iSelection]->SetEffectGlowCamelion(); + m_sprIcon[m_iSelection]->SetEffectGlowShift(); const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef(); const StyleDef* pStyleDef = GAMEMAN->GetStyleDefForStyle( m_aPossibleStyles[m_iSelection] ); diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 203a29048c..2afe96e0b0 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -357,6 +357,6 @@ void ScreenTitleMenu::GainFocus( int iChoiceIndex ) color1 = COLOR_SELECTED; color2 = color1 * 0.5f; color2.a = 1; - m_textChoice[iChoiceIndex].SetEffectDiffuseCamelion( 0.5f, color1, color2 ); + m_textChoice[iChoiceIndex].SetEffectDiffuseShift( 0.5f, color1, color2 ); } diff --git a/stepmania/src/Sprite.h b/stepmania/src/Sprite.h index 64d29371a8..40903544ec 100644 --- a/stepmania/src/Sprite.h +++ b/stepmania/src/Sprite.h @@ -51,8 +51,14 @@ public: virtual void DrawPrimitives(); virtual void Update( float fDeltaTime ); - virtual void StartAnimating() { m_bIsAnimating = true; if(m_pTexture) m_pTexture->Play(); }; - virtual void StopAnimating() { m_bIsAnimating = false; if(m_pTexture) m_pTexture->Pause(); }; + virtual void EnableAnimation( bool bEnable ) + { + m_bIsAnimating = bEnable; + if(m_pTexture) + bEnable ? m_pTexture->Play() : m_pTexture->Pause(); + }; + virtual void StartAnimating() { EnableAnimation(true); }; + virtual void StopAnimating() { EnableAnimation(false); }; virtual void SetState( int iNewState ); int GetNumStates() { return m_iNumStates; }; diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index a8e779669c..ebf3b45f4b 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -321,6 +321,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + + + diff --git a/stepmania/src/arch/arch.cpp b/stepmania/src/arch/arch.cpp index 6268748645..2c0ae14b1a 100644 --- a/stepmania/src/arch/arch.cpp +++ b/stepmania/src/arch/arch.cpp @@ -46,18 +46,16 @@ RageSoundDriver *MakeRageSoundDriver(CString drivers) Driver = DriversToTry[i]; LOG->Trace("Initializing driver: %s", DriversToTry[i].GetString()); -#if defined(WIN32) +#ifdef WIN32 if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound; - else if(!DriversToTry[i].CompareNoCase("DirectSound-sw")) ret = new RageSound_DSound_Software; - else if(!DriversToTry[i].CompareNoCase("WaveOut")) ret = new RageSound_WaveOut; - else if(!DriversToTry[i].CompareNoCase("Linux")) ret = new RageSound_Linux; - -#else -#warning No sound drivers defined! - if(1) ret = new RageSound_Null; + if(!DriversToTry[i].CompareNoCase("DirectSound-sw")) ret = new RageSound_DSound_Software; + if(!DriversToTry[i].CompareNoCase("WaveOut")) ret = new RageSound_WaveOut; #endif - else if(!DriversToTry[i].CompareNoCase("Null")) ret = new RageSound_Null; - else +#ifndef WIN32 // FIXME: change to a define for -nix platforms? + if(!DriversToTry[i].CompareNoCase("Linux")) ret = new RageSound_Linux; +#endif + if(!DriversToTry[i].CompareNoCase("Null")) ret = new RageSound_Null; + if( !ret ) LOG->Warn("Unknown sound driver name: %s", DriversToTry[i].GetString()); } catch(const RageException &e) {