diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 81e01eebf0..7f632cfb55 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -13,6 +13,8 @@ StepMania 5.0 ????????? | 20110??? * [Difficulty] Allow ALL StepsTypes to use CustomDifficulty properly. There was some unfair targeting of Couple and Routine. [Wolfman2000] * [Steps] Calculate accurate radar values for Couple charts. [Wolfman2000] +* [ScreenEdit] Display more accurate chart data for Couple and Routine charts + for the future. No more having (almost) every row as a jump! [Wolfman2000] 2011/07/12 ---------- diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 4d3f9d6514..497c15706c 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -2453,6 +2453,7 @@ LineHighlightP2ChangeToExitCommand= CursorOnCommand=visible,false [ScreenOptionsService] +AllowOperatorMenuButton=false Class="ScreenOptionsMaster" Fallback="ScreenOptionsSimpleService" # @@ -3641,6 +3642,14 @@ NumHandsFormat="%s: %d\n" NumRollsFormat="%s: %d\n" NumLiftsFormat="%s: %d\n" NumFakesFormat="%s: %d\n" +NumStepsFormatTwoPlayer="%s: %d/%d\n" +NumJumpsFormatTwoPlayer="%s: %d/%d\n" +NumHoldsFormatTwoPlayer="%s: %d/%d\n" +NumMinesFormatTwoPlayer="%s: %d/%d\n" +NumHandsFormatTwoPlayer="%s: %d/%d\n" +NumRollsFormatTwoPlayer="%s: %d/%d\n" +NumLiftsFormatTwoPlayer="%s: %d/%d\n" +NumFakesFormatTwoPlayer="%s: %d/%d\n" TimingModeFormat="%s:\n %s\n" Beat0OffsetFormat="%s:\n %.6f secs\n" PreviewStartFormat="%s:\n %.6f secs\n" diff --git a/Xcode/stepmania.xcodeproj/project.pbxproj b/Xcode/stepmania.xcodeproj/project.pbxproj index 50933dbaab..0f026901f7 100644 --- a/Xcode/stepmania.xcodeproj/project.pbxproj +++ b/Xcode/stepmania.xcodeproj/project.pbxproj @@ -321,7 +321,6 @@ AA29CDD50558741A00961A51 /* ScreenSelectCharacter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E005B047711F3005F316C /* ScreenSelectCharacter.cpp */; }; AA29CDDB0558741A00961A51 /* ScreenSelectMusic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E0069047711F3005F316C /* ScreenSelectMusic.cpp */; }; AA29CDDD0558741A00961A51 /* ScreenSongOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E006F047711F3005F316C /* ScreenSongOptions.cpp */; }; - AA29CDE10558741A00961A51 /* ScreenTestFonts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E0079047711F3005F316C /* ScreenTestFonts.cpp */; }; AA29CDE20558741A00961A51 /* ScreenTestSound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E007B047711F3005F316C /* ScreenTestSound.cpp */; }; AA29CDE30558741A00961A51 /* ScreenTextEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E007D047711F3005F316C /* ScreenTextEntry.cpp */; }; AA29CDE40558741A00961A51 /* ScreenTitleMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E007F047711F3005F316C /* ScreenTitleMenu.cpp */; }; @@ -535,7 +534,6 @@ AA40D24209A08D650068C0D5 /* ScreenSelectCharacter.h in Headers */ = {isa = PBXBuildFile; fileRef = AA6E005C047711F3005F316C /* ScreenSelectCharacter.h */; }; AA40D24609A08D650068C0D5 /* ScreenSelectMusic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA6E006A047711F3005F316C /* ScreenSelectMusic.h */; }; AA40D24809A08D650068C0D5 /* ScreenSongOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA6E0070047711F3005F316C /* ScreenSongOptions.h */; }; - AA40D24A09A08D650068C0D5 /* ScreenTestFonts.h in Headers */ = {isa = PBXBuildFile; fileRef = AA6E007A047711F3005F316C /* ScreenTestFonts.h */; }; AA40D24B09A08D650068C0D5 /* ScreenTestSound.h in Headers */ = {isa = PBXBuildFile; fileRef = AA6E007C047711F3005F316C /* ScreenTestSound.h */; }; AA40D24C09A08D650068C0D5 /* ScreenTextEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = AA6E007E047711F3005F316C /* ScreenTextEntry.h */; }; AA40D24D09A08D650068C0D5 /* ScreenTitleMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AA6E0080047711F3005F316C /* ScreenTitleMenu.h */; }; @@ -862,7 +860,6 @@ AA40D3FF09A08D650068C0D5 /* ScreenSelectCharacter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E005B047711F3005F316C /* ScreenSelectCharacter.cpp */; }; AA40D40309A08D650068C0D5 /* ScreenSelectMusic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E0069047711F3005F316C /* ScreenSelectMusic.cpp */; }; AA40D40509A08D650068C0D5 /* ScreenSongOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E006F047711F3005F316C /* ScreenSongOptions.cpp */; }; - AA40D40709A08D650068C0D5 /* ScreenTestFonts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E0079047711F3005F316C /* ScreenTestFonts.cpp */; }; AA40D40809A08D650068C0D5 /* ScreenTestSound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E007B047711F3005F316C /* ScreenTestSound.cpp */; }; AA40D40909A08D650068C0D5 /* ScreenTextEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E007D047711F3005F316C /* ScreenTextEntry.cpp */; }; AA40D40A09A08D650068C0D5 /* ScreenTitleMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA6E007F047711F3005F316C /* ScreenTitleMenu.cpp */; }; @@ -2163,8 +2160,6 @@ AA6E006A047711F3005F316C /* ScreenSelectMusic.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; name = ScreenSelectMusic.h; path = ../src/ScreenSelectMusic.h; sourceTree = ""; }; AA6E006F047711F3005F316C /* ScreenSongOptions.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = ScreenSongOptions.cpp; path = ../src/ScreenSongOptions.cpp; sourceTree = ""; }; AA6E0070047711F3005F316C /* ScreenSongOptions.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; name = ScreenSongOptions.h; path = ../src/ScreenSongOptions.h; sourceTree = ""; }; - AA6E0079047711F3005F316C /* ScreenTestFonts.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = ScreenTestFonts.cpp; path = ../src/ScreenTestFonts.cpp; sourceTree = ""; }; - AA6E007A047711F3005F316C /* ScreenTestFonts.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; name = ScreenTestFonts.h; path = ../src/ScreenTestFonts.h; sourceTree = ""; }; AA6E007B047711F3005F316C /* ScreenTestSound.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = ScreenTestSound.cpp; path = ../src/ScreenTestSound.cpp; sourceTree = ""; }; AA6E007C047711F3005F316C /* ScreenTestSound.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; name = ScreenTestSound.h; path = ../src/ScreenTestSound.h; sourceTree = ""; }; AA6E007D047711F3005F316C /* ScreenTextEntry.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = ScreenTextEntry.cpp; path = ../src/ScreenTextEntry.cpp; sourceTree = ""; }; @@ -3540,8 +3535,6 @@ AA07A55E0843E72B00E33D21 /* ScreenSyncOverlay.h */, AA1145DB075DFADF0050A3D1 /* ScreenSystemLayer.cpp */, AA1145DC075DFADF0050A3D1 /* ScreenSystemLayer.h */, - AA6E0079047711F3005F316C /* ScreenTestFonts.cpp */, - AA6E007A047711F3005F316C /* ScreenTestFonts.h */, AAC622FA05389A0500D02EE9 /* ScreenTestInput.cpp */, AAC622FB05389A0500D02EE9 /* ScreenTestInput.h */, AAF7435906110E8D00B19AD1 /* ScreenTestLights.cpp */, @@ -5283,7 +5276,6 @@ AA40D24209A08D650068C0D5 /* ScreenSelectCharacter.h in Headers */, AA40D24609A08D650068C0D5 /* ScreenSelectMusic.h in Headers */, AA40D24809A08D650068C0D5 /* ScreenSongOptions.h in Headers */, - AA40D24A09A08D650068C0D5 /* ScreenTestFonts.h in Headers */, AA40D24B09A08D650068C0D5 /* ScreenTestSound.h in Headers */, AA40D24C09A08D650068C0D5 /* ScreenTextEntry.h in Headers */, AA40D24D09A08D650068C0D5 /* ScreenTitleMenu.h in Headers */, @@ -6207,7 +6199,6 @@ AA29CDD50558741A00961A51 /* ScreenSelectCharacter.cpp in Sources */, AA29CDDB0558741A00961A51 /* ScreenSelectMusic.cpp in Sources */, AA29CDDD0558741A00961A51 /* ScreenSongOptions.cpp in Sources */, - AA29CDE10558741A00961A51 /* ScreenTestFonts.cpp in Sources */, AA29CDE20558741A00961A51 /* ScreenTestSound.cpp in Sources */, AA29CDE30558741A00961A51 /* ScreenTextEntry.cpp in Sources */, AA29CDE40558741A00961A51 /* ScreenTitleMenu.cpp in Sources */, @@ -6615,7 +6606,6 @@ AA40D3FF09A08D650068C0D5 /* ScreenSelectCharacter.cpp in Sources */, AA40D40309A08D650068C0D5 /* ScreenSelectMusic.cpp in Sources */, AA40D40509A08D650068C0D5 /* ScreenSongOptions.cpp in Sources */, - AA40D40709A08D650068C0D5 /* ScreenTestFonts.cpp in Sources */, AA40D40809A08D650068C0D5 /* ScreenTestSound.cpp in Sources */, AA40D40909A08D650068C0D5 /* ScreenTextEntry.cpp in Sources */, AA40D40A09A08D650068C0D5 /* ScreenTitleMenu.cpp in Sources */, diff --git a/src/Makefile.am b/src/Makefile.am index 7b7c57d5ab..34443e1708 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -107,7 +107,7 @@ ScreenSyncOverlay.cpp ScreenSyncOverlay.h \ ScreenSystemLayer.cpp ScreenSystemLayer.h ScreenSetTime.cpp ScreenSetTime.h \ ScreenSongOptions.cpp ScreenSongOptions.h \ ScreenSplash.cpp ScreenSplash.h \ -ScreenTestFonts.cpp ScreenTestFonts.h ScreenTestInput.cpp ScreenTestInput.h \ +ScreenTestInput.cpp ScreenTestInput.h \ ScreenTestLights.cpp ScreenTestLights.h ScreenTestSound.cpp ScreenTestSound.h ScreenTextEntry.cpp ScreenTextEntry.h \ ScreenTitleMenu.cpp ScreenTitleMenu.h \ ScreenUnlockBrowse.cpp ScreenUnlockBrowse.h \ diff --git a/src/NoteData.cpp b/src/NoteData.cpp index 50265d5b65..78880dfbbe 100644 --- a/src/NoteData.cpp +++ b/src/NoteData.cpp @@ -459,6 +459,31 @@ int NoteData::GetLastRow() const return iOldestRowFoundSoFar; } +bool NoteData::IsTap(const TapNote &tn, const int row) const +{ + return (tn.type != TapNote::empty && tn.type != TapNote::mine + && tn.type != TapNote::lift && tn.type != TapNote::fake + && GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(row)); +} + +bool NoteData::IsMine(const TapNote &tn, const int row) const +{ + return (tn.type == TapNote::mine + && GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(row)); +} + +bool NoteData::IsLift(const TapNote &tn, const int row) const +{ + return (tn.type == TapNote::lift + && GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(row)); +} + +bool NoteData::IsFake(const TapNote &tn, const int row) const +{ + return (tn.type == TapNote::fake + || !GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(row)); +} + int NoteData::GetNumTapNotes( int iStartIndex, int iEndIndex ) const { int iNumNotes = 0; @@ -466,10 +491,7 @@ int NoteData::GetNumTapNotes( int iStartIndex, int iEndIndex ) const { FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex ) { - const TapNote &tn = GetTapNote(t, r); - if( tn.type != TapNote::empty && tn.type != TapNote::mine - && tn.type != TapNote::lift && tn.type != TapNote::fake - && GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(r) ) + if (this->IsTap(GetTapNote(t, r), r)) iNumNotes++; } } @@ -500,8 +522,7 @@ int NoteData::GetNumMines( int iStartIndex, int iEndIndex ) const for( int t=0; tGetProcessedTimingData()->IsJudgableAtRow(r)) + if (this->IsMine(GetTapNote(t, r), r)) iNumMines++; } @@ -640,8 +661,7 @@ int NoteData::GetNumLifts( int iStartIndex, int iEndIndex ) const for( int t=0; tGetProcessedTimingData()->IsJudgableAtRow(r)) + if( this->IsLift(GetTapNote(t, r), r)) iNumLifts++; } @@ -655,14 +675,190 @@ int NoteData::GetNumFakes( int iStartIndex, int iEndIndex ) const for( int t=0; tGetProcessedTimingData()->IsJudgableAtRow(r)) - iNumFakes++; + if( this->IsFake(GetTapNote(t, r), r)) + iNumFakes++; } return iNumFakes; } +bool NoteData::IsPlayer1(const int track, const TapNote &tn) const +{ + if (this->IsComposite()) + { + return tn.pn == PLAYER_1; + } + return track < (this->GetNumTracks() / 2); +} + +pair NoteData::GetNumTapNotesTwoPlayer( int iStartIndex, int iEndIndex ) const +{ + pair num(0, 0); + for( int t=0; tIsTap(tn, r)) + { + if (this->IsPlayer1(t, tn)) + num.first++; + else + num.second++; + } + } + } + return num; +} + +pair NoteData::GetNumRowsWithSimultaneousTapsTwoPlayer(int minTaps, + int startRow, + int endRow) const +{ + pair num(0, 0); + FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( *this, r, startRow, endRow ) + { + pair found(0, 0); + for( int t=0; tIsTap(tn, r)) + { + if (this->IsPlayer1(t, tn)) + found.first++; + else + found.second++; + } + } + if (found.first >= minTaps) + num.first++; + if (found.second >= minTaps) + num.second++; + } + return num; +} + +pair NoteData::GetNumJumpsTwoPlayer( int iStartIndex, int iEndIndex ) const +{ + return GetNumRowsWithSimultaneousTapsTwoPlayer( 2, iStartIndex, iEndIndex ); +} + +pair NoteData::GetNumHandsTwoPlayer( int iStartIndex, int iEndIndex ) const +{ + return GetNumRowsWithSimultaneousTapsTwoPlayer( 3, iStartIndex, iEndIndex ); +} + +pair NoteData::GetNumQuadsTwoPlayer( int iStartIndex, int iEndIndex ) const +{ + return GetNumRowsWithSimultaneousTapsTwoPlayer( 4, iStartIndex, iEndIndex ); +} + +pair NoteData::GetNumHoldNotesTwoPlayer( int iStartIndex, int iEndIndex ) const +{ + pair num(0, 0); + for( int t=0; tsecond.type != TapNote::hold_head || + lBegin->second.subType != TapNote::hold_head_hold ) + continue; + if (!GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(lBegin->first)) + continue; + if (this->IsPlayer1(t, lBegin->second)) + num.first++; + else + num.second++; + } + } + return num; +} + +pair NoteData::GetNumMinesTwoPlayer( int iStartIndex, int iEndIndex ) const +{ + pair num(0, 0); + for( int t=0; tIsMine(tn, r)) + { + if (this->IsPlayer1(t, tn)) + num.first++; + else + num.second++; + } + } + } + return num; +} + +pair NoteData::GetNumRollsTwoPlayer( int iStartIndex, int iEndIndex ) const +{ + pair num(0, 0); + for( int t=0; tsecond.type != TapNote::hold_head || + lBegin->second.subType != TapNote::hold_head_roll ) + continue; + if (!GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(lBegin->first)) + continue; + if (this->IsPlayer1(t, lBegin->second)) + num.first++; + else + num.second++; + } + } + return num; +} + +pair NoteData::GetNumLiftsTwoPlayer( int iStartIndex, int iEndIndex ) const +{ + pair num(0, 0); + for( int t=0; tIsLift(tn, r)) + { + if (this->IsPlayer1(t, tn)) + num.first++; + else + num.second++; + } + } + } + return num; +} + +pair NoteData::GetNumFakesTwoPlayer( int iStartIndex, int iEndIndex ) const +{ + pair num(0, 0); + for( int t=0; tIsFake(tn, r)) + { + if (this->IsPlayer1(t, tn)) + num.first++; + else + num.second++; + } + } + } + return num; +} + /* int NoteData::GetNumMinefields( int iStartIndex, int iEndIndex ) const { diff --git a/src/NoteData.h b/src/NoteData.h index 5de742eb30..df8d6a5856 100644 --- a/src/NoteData.h +++ b/src/NoteData.h @@ -90,7 +90,46 @@ private: // There's no point in inserting empty notes into the map. // Any blank space in the map is defined to be empty. vector m_TapNotes; + + /** + * @brief Determine whether this note is for Player 1 or Player 2. + * @param track the track/column the note is in. + * @param tn the note in question. Required for routine mode. + * @return true if it's for player 1, false for player 2. */ + bool IsPlayer1(const int track, const TapNote &tn) const; + + /** + * @brief Determine if the note in questino should be counted as a tap. + * @param tn the note in question. + * @param row the row it lives in. + * @return true if it's a tap, false otherwise. */ + bool IsTap(const TapNote &tn, const int row) const; + + /** + * @brief Determine if the note in questino should be counted as a mine. + * @param tn the note in question. + * @param row the row it lives in. + * @return true if it's a mine, false otherwise. */ + bool IsMine(const TapNote &tn, const int row) const; + + /** + * @brief Determine if the note in questino should be counted as a lift. + * @param tn the note in question. + * @param row the row it lives in. + * @return true if it's a lift, false otherwise. */ + bool IsLift(const TapNote &tn, const int row) const; + + /** + * @brief Determine if the note in questino should be counted as a fake. + * @param tn the note in question. + * @param row the row it lives in. + * @return true if it's a fake, false otherwise. */ + bool IsFake(const TapNote &tn, const int row) const; + pair GetNumRowsWithSimultaneousTapsTwoPlayer(int minTaps = 2, + int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + public: void Init(); @@ -130,7 +169,8 @@ public: * @param iEndRow the ending point. * @param begin the eventual beginning point of the range. * @param end the eventual end point of the range. */ - void GetTapNoteRange( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &begin, TrackMap::const_iterator &end ) const; + void GetTapNoteRange(int iTrack, int iStartRow, int iEndRow, + TrackMap::const_iterator &begin, TrackMap::const_iterator &end ) const; /** * @brief Return a constant iterator range for [rowBegin,rowEnd). * @param iTrack the column to use. @@ -158,13 +198,17 @@ public: /* Return an iterator range include iStartRow to iEndRow. Extend the range to include * hold notes overlapping the boundary. */ - void GetTapNoteRangeInclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &begin, TrackMap::const_iterator &end, bool bIncludeAdjacent=false ) const; - void GetTapNoteRangeInclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &begin, TrackMap::iterator &end, bool bIncludeAdjacent=false ); + void GetTapNoteRangeInclusive(int iTrack, int iStartRow, int iEndRow, + TrackMap::const_iterator &begin, TrackMap::const_iterator &end, bool bIncludeAdjacent=false ) const; + void GetTapNoteRangeInclusive(int iTrack, int iStartRow, int iEndRow, + TrackMap::iterator &begin, TrackMap::iterator &end, bool bIncludeAdjacent=false ); /* Return an iterator range include iStartRow to iEndRow. Shrink the range to exclude * hold notes overlapping the boundary. */ - void GetTapNoteRangeExclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::const_iterator &begin, TrackMap::const_iterator &end ) const; - void GetTapNoteRangeExclusive( int iTrack, int iStartRow, int iEndRow, TrackMap::iterator &begin, TrackMap::iterator &end ); + void GetTapNoteRangeExclusive(int iTrack, int iStartRow, int iEndRow, + TrackMap::const_iterator &begin, TrackMap::const_iterator &end ) const; + void GetTapNoteRangeExclusive(int iTrack, int iStartRow, int iEndRow, + TrackMap::iterator &begin, TrackMap::iterator &end ); /* Returns the row of the first TapNote on the track that has a row greater than rowInOut. */ @@ -175,7 +219,17 @@ public: void MoveTapNoteTrack( int dest, int src ); void SetTapNote( int track, int row, const TapNote& tn ); - void AddHoldNote( int iTrack, int iStartRow, int iEndRow, TapNote tn ); // add note hold note merging overlapping HoldNotes and destroying TapNotes underneath + /** + * @brief Add a hold note, merging other overlapping holds and destroying + * tap notes underneath. + * @param iTrack the column to work with. + * @param iStartRow the starting row. + * @param iEndRow the ending row. + * @param tn the tap note. */ + void AddHoldNote(int iTrack, + int iStartRow, + int iEndRow, + TapNote tn ); void ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack ); void ClearRange( int rowBegin, int rowEnd ); @@ -222,7 +276,12 @@ public: // Count rows that contain iMinTaps or more taps. int GetNumRowsWithSimultaneousTaps( int iMinTaps, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const; - int GetNumJumps( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const { return GetNumRowsWithSimultaneousTaps( 2, iStartIndex, iEndIndex ); } + int GetNumJumps( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const + { + return GetNumRowsWithSimultaneousTaps( 2, iStartIndex, iEndIndex ); + } + + // This row needs at least iMinSimultaneousPresses either tapped or held. bool RowNeedsAtLeastSimultaneousPresses( int iMinSimultaneousPresses, int row ) const; @@ -230,15 +289,51 @@ public: // Count rows that need iMinSimultaneousPresses either tapped or held. int GetNumRowsWithSimultaneousPresses( int iMinSimultaneousPresses, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const; - int GetNumHands( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const { return GetNumRowsWithSimultaneousPresses( 3, iStartIndex, iEndIndex ); } - int GetNumQuads( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const { return GetNumRowsWithSimultaneousPresses( 4, iStartIndex, iEndIndex ); } + int GetNumHands( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const + { + return GetNumRowsWithSimultaneousPresses( 3, iStartIndex, iEndIndex ); + } + int GetNumQuads( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const + { + return GetNumRowsWithSimultaneousPresses( 4, iStartIndex, iEndIndex ); + } // and the other notetypes int GetNumLifts( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const; int GetNumFakes( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const; + // the couple/routine style variants of the above. + pair GetNumTapNotesTwoPlayer(int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + + pair GetNumJumpsTwoPlayer(int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + + pair GetNumHandsTwoPlayer(int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + + pair GetNumQuadsTwoPlayer(int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + + pair GetNumHoldNotesTwoPlayer(int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + + pair GetNumMinesTwoPlayer(int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + + pair GetNumRollsTwoPlayer(int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + + pair GetNumLiftsTwoPlayer(int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + + pair GetNumFakesTwoPlayer(int startRow = 0, + int endRow = MAX_NOTE_ROW) const; + // Transformations - void LoadTransformed( const NoteData& original, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] ); // -1 for iOriginalTracksToTakeFrom means no track + void LoadTransformed(const NoteData& original, + int iNewNumTracks, + const int iOriginalTrackToTakeFrom[] ); // -1 for iOriginalTracksToTakeFrom means no track // XML XNode* CreateNode() const; diff --git a/src/NoteDisplay.cpp b/src/NoteDisplay.cpp index 9695fd09e9..d71b845198 100644 --- a/src/NoteDisplay.cpp +++ b/src/NoteDisplay.cpp @@ -692,11 +692,18 @@ void NoteDisplay::DrawActor( const TapNote& tn, Actor* pActor, NotePart part, in const float fGlow = ArrowEffects::GetGlow( m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar ); const RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha); const RageColor glow = RageColor(1,1,1,fGlow); - float fRotationX = 0, fRotationY = 0, fRotationZ = 0; + float fRotationX = 0, fRotationZ = 0; + const float fRotationY = ArrowEffects::GetRotationY( m_pPlayerState, fYOffset ); + + bool bIsHoldHead = tn.type == tn.hold_head; + bool bIsHoldCap = bIsHoldHead || tn.type == tn.hold_tail; + + fRotationZ = ArrowEffects::GetRotationZ( m_pPlayerState, fBeat, bIsHoldHead ); + if( !bIsHoldCap ) + { + fRotationX = ArrowEffects::GetRotationX( m_pPlayerState, fYOffset ); + } - fRotationX = ArrowEffects::GetRotationX( m_pPlayerState, fYOffset ); - fRotationY = ArrowEffects::GetRotationY( m_pPlayerState, fYOffset ); - fRotationZ = ArrowEffects::GetRotationZ( m_pPlayerState, fBeat, tn.type == tn.hold_head ); if( tn.type != tn.hold_head ) fColorScale *= ArrowEffects::GetBrightness( m_pPlayerState, fBeat ); diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index e770978675..ef764b97d0 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -242,7 +242,6 @@ bool SMLoader::ProcessBPMs( TimingData &out, const RString line, const int rowsP if( fNewBPM < 0.0f ) { - out.m_bHasNegativeBpms = true; negBeat = fBeat; negBPM = fNewBPM; } diff --git a/src/OptionRowHandler.cpp b/src/OptionRowHandler.cpp index 594af3f5ec..ebcee7a186 100644 --- a/src/OptionRowHandler.cpp +++ b/src/OptionRowHandler.cpp @@ -453,7 +453,7 @@ class OptionRowHandlerListSteps : public OptionRowHandlerList if (STEPS_USE_CHART_NAME) { s = pSteps->GetChartName(); - // TODO: find a way to make this use lua. + // TODO: find a way to make this use lua or metrics. if (!(s == "" || s == "blank" || s == "Blank")) { goto nameGotten; @@ -461,12 +461,18 @@ class OptionRowHandlerListSteps : public OptionRowHandlerList } if( pSteps->GetDifficulty() == Difficulty_Edit ) { - s = pSteps->GetDescription(); + s = pSteps->GetChartName(); + if (s == "" || s == "blank" || s == "Blank") + s = pSteps->GetDescription(); } else { if( pSteps->IsAnEdit() ) - s = pSteps->GetDescription(); + { + s = pSteps->GetChartName(); + if (s == "" || s == "blank" || s == "Blank") + s = pSteps->GetDescription(); + } else s = CustomDifficultyToLocalizedString( GetCustomDifficulty( pSteps->m_StepsType, pSteps->GetDifficulty(), CourseType_Invalid ) ); } diff --git a/src/Player.cpp b/src/Player.cpp index 5dfed3e310..8638d33cff 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -1512,7 +1512,7 @@ void Player::DrawPrimitives() DISPLAY->PopMatrix(); // m_pNoteField->m_sprBoard->GetVisible() - if( !(bool)COMBO_UNDER_FIELD && m_pPlayerState->m_PlayerOptions.GetCurrent().m_fBlind == 0 ) + if( !COMBO_UNDER_FIELD && m_pPlayerState->m_PlayerOptions.GetCurrent().m_fBlind == 0 ) if( m_sprCombo ) m_sprCombo->Draw(); @@ -2965,10 +2965,12 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now ) if( iCheckpointFrequencyRows > 0 ) { // "the first row after the start of the range that lands on a beat" - int iFirstCheckpointInRange = ((m_iFirstUncrossedRow+iCheckpointFrequencyRows-1)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows; + int iFirstCheckpointInRange = QuantizeUp(m_iFirstUncrossedRow, + iCheckpointFrequencyRows); // "the last row or first row earlier that lands on a beat" - int iLastCheckpointInRange = ((iLastRowCrossed)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows; + int iLastCheckpointInRange = QuantizeDown(iLastRowCrossed, + iCheckpointFrequencyRows); for( int r = iFirstCheckpointInRange; r <= iLastCheckpointInRange; r += iCheckpointFrequencyRows ) { @@ -2990,10 +2992,12 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now ) int iTrack = nIter.Track(); // "the first row after the hold head that lands on a beat" - int iFirstCheckpointOfHold = ((iStartRow+iCheckpointFrequencyRows)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows; + int iFirstCheckpointOfHold = QuantizeUp(iStartRow, + iCheckpointFrequencyRows); // "the end row or the first earlier row that lands on a beat" - int iLastCheckpointOfHold = ((iEndRow)/iCheckpointFrequencyRows) * iCheckpointFrequencyRows; + int iLastCheckpointOfHold = QuantizeDown(iEndRow, + iCheckpointFrequencyRows); // count the end of the hold as a checkpoint bool bHoldOverlapsRow = iFirstCheckpointOfHold <= r && r <= iLastCheckpointOfHold; diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 346aaa5e11..f0dacde5c0 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -1190,6 +1190,14 @@ static ThemeMetric NUM_HANDS_FORMAT("ScreenEdit", "NumHandsFormat"); static ThemeMetric NUM_ROLLS_FORMAT("ScreenEdit", "NumRollsFormat"); static ThemeMetric NUM_LIFTS_FORMAT("ScreenEdit", "NumLiftsFormat"); static ThemeMetric NUM_FAKES_FORMAT("ScreenEdit", "NumFakesFormat"); +static ThemeMetric NUM_STEPS_FORMAT_TWO_PLAYER("ScreenEdit", "NumStepsFormatTwoPlayer"); +static ThemeMetric NUM_JUMPS_FORMAT_TWO_PLAYER("ScreenEdit", "NumJumpsFormatTwoPlayer"); +static ThemeMetric NUM_HOLDS_FORMAT_TWO_PLAYER("ScreenEdit", "NumHoldsFormatTwoPlayer"); +static ThemeMetric NUM_MINES_FORMAT_TWO_PLAYER("ScreenEdit", "NumMinesFormatTwoPlayer"); +static ThemeMetric NUM_HANDS_FORMAT_TWO_PLAYER("ScreenEdit", "NumHandsFormatTwoPlayer"); +static ThemeMetric NUM_ROLLS_FORMAT_TWO_PLAYER("ScreenEdit", "NumRollsFormatTwoPlayer"); +static ThemeMetric NUM_LIFTS_FORMAT_TWO_PLAYER("ScreenEdit", "NumLiftsFormatTwoPlayer"); +static ThemeMetric NUM_FAKES_FORMAT_TWO_PLAYER("ScreenEdit", "NumFakesFormatTwoPlayer"); static ThemeMetric TIMING_MODE_FORMAT("ScreenEdit", "TimingModeFormat"); static ThemeMetric BEAT_0_OFFSET_FORMAT("ScreenEdit", "Beat0OffsetFormat"); static ThemeMetric PREVIEW_START_FORMAT("ScreenEdit", "PreviewStartFormat"); @@ -1259,15 +1267,53 @@ void ScreenEdit::UpdateTextInfo() } GAMESTATE->SetProcessedTimingData(&m_pSteps->m_Timing); - - sText += ssprintf( NUM_STEPS_FORMAT.GetValue(), TAP_STEPS.GetValue().c_str(), m_NoteDataEdit.GetNumTapNotes() ); - sText += ssprintf( NUM_JUMPS_FORMAT.GetValue(), JUMPS.GetValue().c_str(), m_NoteDataEdit.GetNumJumps() ); - sText += ssprintf( NUM_HANDS_FORMAT.GetValue(), HANDS.GetValue().c_str(), m_NoteDataEdit.GetNumHands() ); - sText += ssprintf( NUM_HOLDS_FORMAT.GetValue(), HOLDS.GetValue().c_str(), m_NoteDataEdit.GetNumHoldNotes() ); - sText += ssprintf( NUM_MINES_FORMAT.GetValue(), MINES.GetValue().c_str(), m_NoteDataEdit.GetNumMines() ); - sText += ssprintf( NUM_ROLLS_FORMAT.GetValue(), ROLLS.GetValue().c_str(), m_NoteDataEdit.GetNumRolls() ); - sText += ssprintf( NUM_LIFTS_FORMAT.GetValue(), LIFTS.GetValue().c_str(), m_NoteDataEdit.GetNumLifts() ); - sText += ssprintf( NUM_FAKES_FORMAT.GetValue(), FAKES.GetValue().c_str(), m_NoteDataEdit.GetNumFakes() ); + const StepsTypeCategory &cat = GAMEMAN->GetStepsTypeInfo(m_pSteps->m_StepsType).m_StepsTypeCategory; + if (cat == StepsTypeCategory_Couple || cat == StepsTypeCategory_Routine) + { + pair tmp = m_NoteDataEdit.GetNumTapNotesTwoPlayer(); + sText += ssprintf(NUM_STEPS_FORMAT_TWO_PLAYER.GetValue(), + TAP_STEPS.GetValue().c_str(), + tmp.first, tmp.second); + tmp = m_NoteDataEdit.GetNumJumpsTwoPlayer(); + sText += ssprintf(NUM_JUMPS_FORMAT_TWO_PLAYER.GetValue(), + JUMPS.GetValue().c_str(), + tmp.first, tmp.second); + tmp = m_NoteDataEdit.GetNumHandsTwoPlayer(); + sText += ssprintf(NUM_HANDS_FORMAT_TWO_PLAYER.GetValue(), + HANDS.GetValue().c_str(), + tmp.first, tmp.second); + tmp = m_NoteDataEdit.GetNumHoldNotesTwoPlayer(); + sText += ssprintf(NUM_HOLDS_FORMAT_TWO_PLAYER.GetValue(), + HOLDS.GetValue().c_str(), + tmp.first, tmp.second); + tmp = m_NoteDataEdit.GetNumMinesTwoPlayer(); + sText += ssprintf(NUM_MINES_FORMAT_TWO_PLAYER.GetValue(), + MINES.GetValue().c_str(), + tmp.first, tmp.second); + tmp = m_NoteDataEdit.GetNumRollsTwoPlayer(); + sText += ssprintf(NUM_ROLLS_FORMAT_TWO_PLAYER.GetValue(), + ROLLS.GetValue().c_str(), + tmp.first, tmp.second); + tmp = m_NoteDataEdit.GetNumLiftsTwoPlayer(); + sText += ssprintf(NUM_LIFTS_FORMAT_TWO_PLAYER.GetValue(), + LIFTS.GetValue().c_str(), + tmp.first, tmp.second); + tmp = m_NoteDataEdit.GetNumFakesTwoPlayer(); + sText += ssprintf(NUM_FAKES_FORMAT_TWO_PLAYER.GetValue(), + FAKES.GetValue().c_str(), + tmp.first, tmp.second); + } + else + { + sText += ssprintf( NUM_STEPS_FORMAT.GetValue(), TAP_STEPS.GetValue().c_str(), m_NoteDataEdit.GetNumTapNotes() ); + sText += ssprintf( NUM_JUMPS_FORMAT.GetValue(), JUMPS.GetValue().c_str(), m_NoteDataEdit.GetNumJumps() ); + sText += ssprintf( NUM_HANDS_FORMAT.GetValue(), HANDS.GetValue().c_str(), m_NoteDataEdit.GetNumHands() ); + sText += ssprintf( NUM_HOLDS_FORMAT.GetValue(), HOLDS.GetValue().c_str(), m_NoteDataEdit.GetNumHoldNotes() ); + sText += ssprintf( NUM_MINES_FORMAT.GetValue(), MINES.GetValue().c_str(), m_NoteDataEdit.GetNumMines() ); + sText += ssprintf( NUM_ROLLS_FORMAT.GetValue(), ROLLS.GetValue().c_str(), m_NoteDataEdit.GetNumRolls() ); + sText += ssprintf( NUM_LIFTS_FORMAT.GetValue(), LIFTS.GetValue().c_str(), m_NoteDataEdit.GetNumLifts() ); + sText += ssprintf( NUM_FAKES_FORMAT.GetValue(), FAKES.GetValue().c_str(), m_NoteDataEdit.GetNumFakes() ); + } switch( EDIT_MODE.GetValue() ) { DEFAULT_FAIL( EDIT_MODE.GetValue() ); @@ -3738,15 +3784,41 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns case view_steps_data: { float fMusicSeconds = m_pSoundMusic->GetLengthSeconds(); - g_StepsData.rows[tap_notes].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumTapNotes()) ); - g_StepsData.rows[jumps].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumJumps()) ); - g_StepsData.rows[hands].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumHands()) ); - g_StepsData.rows[quads].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumQuads()) ); - g_StepsData.rows[holds].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumHoldNotes()) ); - g_StepsData.rows[mines].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumMines()) ); - g_StepsData.rows[rolls].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumRolls()) ); - g_StepsData.rows[lifts].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumLifts()) ); - g_StepsData.rows[fakes].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumFakes()) ); + Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; + const StepsTypeCategory &cat = GAMEMAN->GetStepsTypeInfo(pSteps->m_StepsType).m_StepsTypeCategory; + if (cat == StepsTypeCategory_Couple || cat == StepsTypeCategory_Routine) + { + pair tmp = m_NoteDataEdit.GetNumTapNotesTwoPlayer(); + g_StepsData.rows[tap_notes].SetOneUnthemedChoice( ssprintf("%d / %d", tmp.first, tmp.second) ); + tmp = m_NoteDataEdit.GetNumJumpsTwoPlayer(); + g_StepsData.rows[jumps].SetOneUnthemedChoice( ssprintf("%d / %d", tmp.first, tmp.second) ); + tmp = m_NoteDataEdit.GetNumHandsTwoPlayer(); + g_StepsData.rows[hands].SetOneUnthemedChoice( ssprintf("%d / %d", tmp.first, tmp.second) ); + tmp = m_NoteDataEdit.GetNumQuadsTwoPlayer(); + g_StepsData.rows[quads].SetOneUnthemedChoice( ssprintf("%d / %d", tmp.first, tmp.second) ); + tmp = m_NoteDataEdit.GetNumHoldNotesTwoPlayer(); + g_StepsData.rows[holds].SetOneUnthemedChoice( ssprintf("%d / %d", tmp.first, tmp.second) ); + tmp = m_NoteDataEdit.GetNumMinesTwoPlayer(); + g_StepsData.rows[mines].SetOneUnthemedChoice( ssprintf("%d / %d", tmp.first, tmp.second) ); + tmp = m_NoteDataEdit.GetNumRollsTwoPlayer(); + g_StepsData.rows[rolls].SetOneUnthemedChoice( ssprintf("%d / %d", tmp.first, tmp.second) ); + tmp = m_NoteDataEdit.GetNumLiftsTwoPlayer(); + g_StepsData.rows[lifts].SetOneUnthemedChoice( ssprintf("%d / %d", tmp.first, tmp.second) ); + tmp = m_NoteDataEdit.GetNumFakesTwoPlayer(); + g_StepsData.rows[fakes].SetOneUnthemedChoice( ssprintf("%d / %d", tmp.first, tmp.second) ); + } + else + { + g_StepsData.rows[tap_notes].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumTapNotes()) ); + g_StepsData.rows[jumps].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumJumps()) ); + g_StepsData.rows[hands].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumHands()) ); + g_StepsData.rows[quads].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumQuads()) ); + g_StepsData.rows[holds].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumHoldNotes()) ); + g_StepsData.rows[mines].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumMines()) ); + g_StepsData.rows[rolls].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumRolls()) ); + g_StepsData.rows[lifts].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumLifts()) ); + g_StepsData.rows[fakes].SetOneUnthemedChoice( ssprintf("%d", m_NoteDataEdit.GetNumFakes()) ); + } g_StepsData.rows[stream].SetOneUnthemedChoice( ssprintf("%.2f", NoteDataUtil::GetStreamRadarValue(m_NoteDataEdit,fMusicSeconds)) ); g_StepsData.rows[voltage].SetOneUnthemedChoice( ssprintf("%.2f", NoteDataUtil::GetVoltageRadarValue(m_NoteDataEdit,fMusicSeconds)) ); g_StepsData.rows[air].SetOneUnthemedChoice( ssprintf("%.2f", NoteDataUtil::GetAirRadarValue(m_NoteDataEdit,fMusicSeconds)) ); @@ -5123,7 +5195,7 @@ void ScreenEdit::DoHelp() RString sDescription = THEME->GetString( "EditHelpDescription", hl.szEnglishDescription ); // TODO: Better way of hiding routine only key on non-routine. - if( sDescription.Left(13) == "Switch player" && m_InputPlayerNumber == PLAYER_INVALID ) + if( hl.veb[0] == EDIT_BUTTON_SWITCH_PLAYERS && m_InputPlayerNumber == PLAYER_INVALID ) { continue; } diff --git a/src/ScreenTestFonts.cpp b/src/ScreenTestFonts.cpp deleted file mode 100644 index 708a2d711a..0000000000 --- a/src/ScreenTestFonts.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include "global.h" -#include "ScreenTestFonts.h" -#include "FontManager.h" -#include "RageTextureManager.h" -#include "ScreenTextEntry.h" -#include "ScreenDimensions.h" -#include "InputEventPlus.h" -#include "RageUtil.h" - - -static const float LineWidth = 400; -static const float LineHeight = 50; - -/** @brief A quick way of getting a font metric. */ -#define FONT( i ) THEME->GetMetric (m_sName,ssprintf("Font%i",i)) -/** @brief A quick way of getting a particular string. */ -#define TEXT( i ) THEME->GetString (m_sName,ssprintf("Text%i",i)) - -static RString g_sCustomText; - -static void ChangeText( const RString &sText ) -{ - g_sCustomText = sText; -} - -AutoScreenMessage( SM_ChangeText ); - -void ScreenTestFonts::HandleScreenMessage( const ScreenMessage SM ) -{ - if( SM == ScreenMessage(SM_ChangeText) ) - SetText( g_sCustomText ); -} - -REGISTER_SCREEN_CLASS( ScreenTestFonts ); - -void ScreenTestFonts::Init() -{ - Screen::Init(); - - Hline.SetXY(SCREEN_CENTER_X, SCREEN_CENTER_Y); - Hline.SetZoomX(LineWidth); - Hline.SetDiffuse( RageColor(1, 1, 1, 1) ); - this->AddChild(&Hline); - - Vline.SetXY(SCREEN_CENTER_X, SCREEN_CENTER_Y); - Vline.SetZoomY(LineHeight); - Vline.SetDiffuse( RageColor(0, 1, 0, .8f) ); - this->AddChild(&Vline); - - font.SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y+100 ); - font.LoadFromFont( THEME->GetPathF("Common", "normal") ); - font.SetZoom(.5f); - this->AddChild(&font); - - txt.SetName( "Text" ); - SetFont( THEME->GetPathF("", FONT(1)) ); - LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( txt ); - SetText( "Foo" ); -} - -void ScreenTestFonts::SetText( RString sText ) -{ - txt.SetShadowLength( 0 ); - txt.SetText( "" ); /* force it */ - txt.SetText( sText ); - m_sCurText = sText; -} - -void ScreenTestFonts::SetFont( RString sFont ) -{ - m_sFont = sFont; - - txt.LoadFromFont( m_sFont ); - font.SetText( m_sFont ); - /* The font changed, so we need to reset the text or it'll be - * misaligned. */ - SetText( m_sCurText ); -} - -void ScreenTestFonts::DrawPrimitives() -{ - Screen::DrawPrimitives(); - - /* Draw this manually, so we can breakpoint here. */ - txt.Draw(); -} - - -void ScreenTestFonts::Input( const InputEventPlus &input ) -{ - if( input.type != IET_FIRST_PRESS ) - return; - switch( input.DeviceI.button ) - { - case '[': txt.SetVertAlign( align_bottom ); break; - case '\\': txt.SetVertAlign( align_middle ); break; - case ']': txt.SetVertAlign( align_top ); break; - - case ',': txt.SetHorizAlign( align_left ); break; - case '.': txt.SetHorizAlign( align_center ); break; - case '/': txt.SetHorizAlign( align_right ); break; - - case '`': if( m_sCurText != g_sCustomText ) - SetText( g_sCustomText ); - else - ScreenTextEntry::TextEntry( SM_ChangeText, "Edit text.", g_sCustomText, 100, NULL, ChangeText, NULL); - break; - case '1': SetText( TEXT(1) ); break; - case '2': SetText( TEXT(2) ); break; - case '3': SetText( TEXT(3) ); break; - case '4': SetText( TEXT(4) ); break; - case '5': SetText( TEXT(5) ); break; - - case 'q': SetFont( THEME->GetPathF("", FONT(1)) ); break; - case 'w': SetFont( THEME->GetPathF("", FONT(2)) ); break; - case 'e': SetFont( THEME->GetPathF("", FONT(3)) ); break; - case 'r': SetFont( THEME->GetPathF("", FONT(4)) ); break; - case 't': SetFont( THEME->GetPathF("", FONT(5)) ); break; - - case 'a': SetFont( THEME->GetPathF("", FONT(1)) ); break; - - case 'z': FONT->ReloadFonts(); - TEXTUREMAN->ReloadAll(); - SetText( m_sCurText ); - SetFont( m_sFont ); - break; - } -} - -/* - * (c) 2003-2005 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ diff --git a/src/ScreenTestFonts.h b/src/ScreenTestFonts.h deleted file mode 100644 index c6cdf7e2cf..0000000000 --- a/src/ScreenTestFonts.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef SCREEN_TEST_FONTS_H -#define SCREEN_TEST_FONTS_H - -#include "Screen.h" -#include "BitmapText.h" -#include "Quad.h" - -/** @brief Display and test fonts. */ -class ScreenTestFonts: public Screen -{ -public: - virtual void Init(); - - void Input( const InputEventPlus &input ); - void DrawPrimitives(); - void HandleScreenMessage( const ScreenMessage SM ); - -private: - void SetText( RString sText ); - void SetFont( RString sFont ); - - /** @brief The current text to display. */ - RString m_sCurText; - /** @brief The current font in use. */ - RString m_sFont; - BitmapText txt, font; - Quad Vline, Hline; -}; - -#endif - -/* - * (c) 2003-2005 Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ diff --git a/src/StepMania-net2008.vcproj b/src/StepMania-net2008.vcproj index 315331951d..de9c6271f7 100644 --- a/src/StepMania-net2008.vcproj +++ b/src/StepMania-net2008.vcproj @@ -1055,14 +1055,6 @@ - - - - diff --git a/src/StepMania-net2010.vcxproj b/src/StepMania-net2010.vcxproj index c350d25de4..ed95eb576f 100644 --- a/src/StepMania-net2010.vcxproj +++ b/src/StepMania-net2010.vcxproj @@ -420,7 +420,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) - @@ -1740,7 +1739,6 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) - diff --git a/src/StepMania-net2010.vcxproj.filters b/src/StepMania-net2010.vcxproj.filters index 7c21d06c80..2a3608a7c2 100644 --- a/src/StepMania-net2010.vcxproj.filters +++ b/src/StepMania-net2010.vcxproj.filters @@ -264,9 +264,6 @@ Screens - - Screens - Screens @@ -1781,9 +1778,6 @@ Screens - - Screens - Screens diff --git a/src/TimingData.cpp b/src/TimingData.cpp index 29d8d1ada0..5ecfa97a96 100644 --- a/src/TimingData.cpp +++ b/src/TimingData.cpp @@ -9,14 +9,12 @@ TimingData::TimingData() : - m_fBeat0OffsetInSeconds(0), - m_bHasNegativeBpms(false) + m_fBeat0OffsetInSeconds(0) { } TimingData::TimingData(float fOffset) : - m_fBeat0OffsetInSeconds(fOffset), - m_bHasNegativeBpms(false) + m_fBeat0OffsetInSeconds(fOffset) { } diff --git a/src/TimingData.h b/src/TimingData.h index 37b273f71c..27656363ed 100644 --- a/src/TimingData.h +++ b/src/TimingData.h @@ -1395,17 +1395,11 @@ public: vector m_ScrollSegments; /** @brief The collection of FakeSegments. */ vector m_FakeSegments; + /** * @brief The initial offset of a song. */ float m_fBeat0OffsetInSeconds; - /** - * @brief A flag to see if negative BPMs are used in this song. - * - * This is only used for Lua bindings in the Song, with the intentions that - * this is moved into TimingData at a future point in time. - */ - bool m_bHasNegativeBpms; }; #undef COMPARE diff --git a/src/TimingSegments.cpp b/src/TimingSegments.cpp index c208672e01..a26f94df23 100644 --- a/src/TimingSegments.cpp +++ b/src/TimingSegments.cpp @@ -3,31 +3,31 @@ #define LTCOMPARE(x) if(this->x < other.x) return true; if(this->x > other.x) return false; -BaseTimingSegment::~BaseTimingSegment() {} +TimingSegment::~TimingSegment() {} -void BaseTimingSegment::SetRow(const int s) +void TimingSegment::SetRow(const int s) { this->startingRow = s; } -void BaseTimingSegment::SetBeat(const float s) +void TimingSegment::SetBeat(const float s) { SetRow(BeatToNoteRow(s)); } -int BaseTimingSegment::GetRow() const +int TimingSegment::GetRow() const { return this->startingRow; } -float BaseTimingSegment::GetBeat() const +float TimingSegment::GetBeat() const { return NoteRowToBeat(GetRow()); } -void BaseTimingSegment::Scale( int start, int length, int newLength ) +void TimingSegment::Scale( int start, int length, int newLength ) { - SetRow( ScalePosition( start, length, newLength, GetRow() ) ); + SetRow( ScalePosition( start, length, newLength, this->GetRow() ) ); } @@ -51,7 +51,7 @@ void FakeSegment::Scale( int start, int length, int newLength ) float newStartBeat = ScalePosition( NoteRowToBeat(start), NoteRowToBeat(length), NoteRowToBeat(newLength), startBeat ); float newEndBeat = ScalePosition( NoteRowToBeat(start), NoteRowToBeat(length), NoteRowToBeat(newLength), endBeat ); SetLength( newEndBeat - newStartBeat ); - TimingSegment::Scale( start, length, newLength ); + TimingSegment::Scale( start, length, newLength ); } bool FakeSegment::operator<( const FakeSegment &other ) const @@ -82,7 +82,7 @@ void WarpSegment::Scale( int start, int length, int newLength ) float newStartBeat = ScalePosition( NoteRowToBeat(start), NoteRowToBeat(length), NoteRowToBeat(newLength), startBeat ); float newEndBeat = ScalePosition( NoteRowToBeat(start), NoteRowToBeat(length), NoteRowToBeat(newLength), endBeat ); SetLength( newEndBeat - newStartBeat ); - TimingSegment::Scale( start, length, newLength ); + TimingSegment::Scale( start, length, newLength ); } bool WarpSegment::operator<( const WarpSegment &other ) const @@ -278,7 +278,7 @@ void SpeedSegment::Scale( int start, int oldLength, int newLength ) endBeat); SetLength( newEndBeat - newStartBeat ); } - TimingSegment::Scale( start, oldLength, newLength ); + TimingSegment::Scale( start, oldLength, newLength ); } bool SpeedSegment::operator<( const SpeedSegment &other ) const diff --git a/src/TimingSegments.h b/src/TimingSegments.h index 5e59daed90..39cbeffc34 100644 --- a/src/TimingSegments.h +++ b/src/TimingSegments.h @@ -3,29 +3,44 @@ #include "NoteTypes.h" // Converting rows to beats and vice~versa. +enum TimingSegmentType +{ + SEGMENT_BPM, + SEGMENT_STOP_DELAY, + // uncomment the below two when stops and delays don't share one. + // SEGMENT_STOP, + // SEGMENT_DELAY, + SEGMENT_TIME_SIG, + SEGMENT_WARP, + SEGMENT_LABEL, + SEGMENT_TICKCOUNT, + SEGMENT_COMBO, + SEGMENT_SPEED, + SEGMENT_SCROLL, + SEGMENT_FAKE, + NUM_TimingSegmentTypes +}; + /** * @brief The base timing segment for all of the changing glory. - * - * Do not derive from this class!! Instead, derive from TimingSegment! */ -struct BaseTimingSegment +struct TimingSegment { - /** @brief Set up a BaseTimingSegment with default values. */ - BaseTimingSegment(): + /** @brief Set up a TimingSegment with default values. */ + TimingSegment(): startingRow(-1) {}; /** - * @brief Set up a BaseTimingSegment with specified values. + * @brief Set up a TimingSegment with specified values. * @param s the starting row / beat. */ - BaseTimingSegment(int s): startingRow(ToNoteRow(s)) {} - BaseTimingSegment(float s): startingRow(ToNoteRow(s)) {} + TimingSegment(int s): startingRow(ToNoteRow(s)) {} + TimingSegment(float s): startingRow(ToNoteRow(s)) {} - template - BaseTimingSegment(const DerivedSegment &other): + TimingSegment(const TimingSegment &other): startingRow(other.GetRow()) {}; - virtual ~BaseTimingSegment(); + virtual ~TimingSegment(); /** * @brief Scales itself. @@ -58,27 +73,9 @@ struct BaseTimingSegment * @brief Get the starting beat of the BaseTimingSegment. * @return the starting beat. */ float GetBeat() const; - -private: - /** @brief The row in which this segment activates. */ - int startingRow; -}; - -/** - * @brief The general TimingSegment for all of the changing glory. - * - * Each segment is supposed to derive from this one. */ -template -struct TimingSegment: public BaseTimingSegment -{ - - TimingSegment(): BaseTimingSegment(-1) {}; - TimingSegment(const DerivedSegment &other): BaseTimingSegment(other) {}; - - template - TimingSegment(StartType s): BaseTimingSegment(s) {}; - + virtual TimingSegmentType GetType() const = 0; + /** * @brief Compares two DrivedSegments to see if one is less than the other. * @param other the other TimingSegments to compare to. @@ -87,11 +84,11 @@ struct TimingSegment: public BaseTimingSegment * This is virtual to allow other segments to implement comparison * as required by them. */ - virtual bool operator<( const DerivedSegment &other ) const + bool operator<( const TimingSegment &other ) const { return this->GetRow() < other.GetRow(); }; - + /** * @brief Compares two DrivedSegments to see if they are equal to each other. * @param other the other FakeSegment to compare to. @@ -100,38 +97,45 @@ struct TimingSegment: public BaseTimingSegment * This is virtual to allow other segments to implement comparison * as required by them. */ - bool operator==( const DerivedSegment &other ) const + bool operator==( const TimingSegment &other ) const { return !this->operator<(other) && - !other.operator<(*static_cast(this)); + !other.operator<(*static_cast(this)); }; /** * @brief Compares two DrivedSegments to see if they are not equal to each other. * @param other the other DrivedSegments to compare to. * @return the inequality of the two segments. */ - bool operator!=( const DerivedSegment &other ) const { return !this->operator==(other); }; + bool operator!=( const TimingSegment &other ) const { return !this->operator==(other); }; /** * @brief Compares two DrivedSegments to see if one is less than or equal to the other. * @param other the other DrivedSegments to compare to. * @return the truth/falsehood of if the first is less or equal to than the second. */ - bool operator<=( const DerivedSegment &other ) const { return !this->operator>(other); }; + bool operator<=( const TimingSegment &other ) const { return !this->operator>(other); }; /** * @brief Compares two DrivedSegments to see if one is greater than the other. * @param other the other DrivedSegments to compare to. * @return the truth/falsehood of if the first is greater than the second. */ - bool operator>( const DerivedSegment &other ) const + bool operator>( const TimingSegment &other ) const { - return other.operator<(*static_cast(this)); + return other.operator<(*static_cast(this)); }; /** * @brief Compares two DrivedSegments to see if one is greater than or equal to the other. * @param other the other DrivedSegments to compare to. * @return the truth/falsehood of if the first is greater than or equal to the second. */ - bool operator>=( const DerivedSegment &other ) const { return !this->operator<(other); }; + bool operator>=( const TimingSegment &other ) const { return !this->operator<(other); }; + +private: + /** @brief The row in which this segment activates. */ + int startingRow; + + /** @brief The specific type of segment this is. */ + TimingSegmentType segType; }; @@ -147,7 +151,7 @@ struct TimingSegment: public BaseTimingSegment * drawn normally. * * These were inspired by the Pump It Up series. */ -struct FakeSegment : public TimingSegment +struct FakeSegment : public TimingSegment { /** * @brief Create a simple Fake Segment with default values. @@ -155,14 +159,14 @@ struct FakeSegment : public TimingSegment * It is best to override the values as soon as possible. */ FakeSegment(): - TimingSegment(-1), lengthBeats(-1) {}; + TimingSegment(-1), lengthBeats(-1) {}; /** * @brief Create a copy of another Fake Segment. * @param other the other fake segment */ FakeSegment(const FakeSegment &other): - TimingSegment(other), + TimingSegment(other.GetRow()), lengthBeats(other.GetLength()) {}; /** @@ -172,7 +176,7 @@ struct FakeSegment : public TimingSegment */ template FakeSegment( StartType s, LengthType r ): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), lengthBeats(ToBeat(max((LengthType)0, r))) {}; /** @@ -194,6 +198,8 @@ struct FakeSegment : public TimingSegment */ bool operator<( const FakeSegment &other ) const; + TimingSegmentType GetType() const { return SEGMENT_FAKE; } + private: /** * @brief The number of beats the FakeSegment is alive for. @@ -208,7 +214,7 @@ private: * abusing negative BPMs. Negative BPMs should be converted to warp segments. * WarpAt=WarpToRelative is the format, where both are in beats. * (Technically they're both rows though.) */ -struct WarpSegment : public TimingSegment +struct WarpSegment : public TimingSegment { /** * @brief Create a simple Warp Segment with default values. @@ -216,14 +222,14 @@ struct WarpSegment : public TimingSegment * It is best to override the values as soon as possible. */ WarpSegment(): - TimingSegment(-1), lengthBeats(-1) {}; + TimingSegment(-1), lengthBeats(-1) {}; /** * @brief Create a copy of another Warp Segment. * @param other the other warp segment */ WarpSegment(const WarpSegment &other): - TimingSegment(other), + TimingSegment(other.GetRow()), lengthBeats(other.GetLength()) {}; /** @@ -233,7 +239,7 @@ struct WarpSegment : public TimingSegment */ template WarpSegment( StartType s, LengthType r ): - TimingSegment(s), + TimingSegment(s), lengthBeats(ToBeat(max((LengthType)0, r))) {}; /** @@ -254,6 +260,8 @@ struct WarpSegment : public TimingSegment * @return the truth/falsehood of if the first is less than the second. */ bool operator<( const WarpSegment &other ) const; + + TimingSegmentType GetType() const { return SEGMENT_WARP; } private: /** * @brief The number of beats the FakeSegment is alive for. @@ -269,7 +277,7 @@ private: * system used by various based video games. The number is used to * represent how many ticks can be counted in one beat. */ -struct TickcountSegment : public TimingSegment +struct TickcountSegment : public TimingSegment { /** * @brief Creates a simple Tickcount Segment with default values. @@ -277,14 +285,14 @@ struct TickcountSegment : public TimingSegment * It is best to override the values as soon as possible. */ TickcountSegment(): - TimingSegment(-1), ticks(4) {}; + TimingSegment(-1), ticks(4) {}; /** * @brief Create a copy of another Tickcount Segment. * @param other the other tickcount segment */ TickcountSegment(const TickcountSegment &other): - TimingSegment(other), + TimingSegment(other.GetRow()), ticks(other.GetTicks()) {}; /** @@ -292,7 +300,7 @@ struct TickcountSegment : public TimingSegment * @param s the starting row / beat. */ template TickcountSegment( StartType s ): - TimingSegment(max((StartType)0, s)), ticks(4) {}; + TimingSegment(max((StartType)0, s)), ticks(4) {}; /** * @brief Creates a TickcountSegment with specified values. @@ -300,7 +308,7 @@ struct TickcountSegment : public TimingSegment * @param t the amount of ticks counted per beat. */ template TickcountSegment( StartType s, int t ): - TimingSegment(max((StartType)0, s)), ticks(max(0, t)) {}; + TimingSegment(max((StartType)0, s)), ticks(max(0, t)) {}; /** * @brief Get the number of ticks in this TickcountSegment. @@ -319,6 +327,8 @@ struct TickcountSegment : public TimingSegment */ bool operator<( const TickcountSegment &other ) const; + TimingSegmentType GetType() const { return SEGMENT_TICKCOUNT; } + private: /** * @brief The amount of ticks counted per beat. @@ -332,7 +342,7 @@ private: * Admitedly, this would primarily be used for mission mode style charts. However, * it can have its place during normal gameplay. */ -struct ComboSegment : public TimingSegment +struct ComboSegment : public TimingSegment { /** * @brief Creates a simple Combo Segment with default values. @@ -340,10 +350,10 @@ struct ComboSegment : public TimingSegment * It is best to override the values as soon as possible. */ ComboSegment() : - TimingSegment(-1), combo(1) { } + TimingSegment(-1), combo(1) { } ComboSegment(const ComboSegment &other) : - TimingSegment(other), + TimingSegment(other.GetRow()), combo(other.GetCombo()), missCombo(other.GetMissCombo()) {}; @@ -354,7 +364,7 @@ struct ComboSegment : public TimingSegment */ template ComboSegment( StartType s, int t ): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), combo(max(0,t)), missCombo(max(0,t)) {} /** @@ -365,7 +375,7 @@ struct ComboSegment : public TimingSegment */ template ComboSegment(StartType s, int t, int m): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), combo(max(0,t)), missCombo(max(0,m)) {} /** @@ -394,6 +404,8 @@ struct ComboSegment : public TimingSegment * @return the truth/falsehood of if the first is less than the second. */ bool operator<( const ComboSegment &other ) const; + + TimingSegmentType GetType() const { return SEGMENT_COMBO; } private: /** * @brief The amount the combo increases at this point. @@ -410,7 +422,7 @@ private: * This is meant for helping to identify different sections of a chart * versus relying on measures and beats alone. */ -struct LabelSegment : public TimingSegment +struct LabelSegment : public TimingSegment { /** * @brief Creates a simple Label Segment with default values. @@ -418,10 +430,10 @@ struct LabelSegment : public TimingSegment * It is best to override the values as soon as possible. */ LabelSegment() : - TimingSegment(-1), label("") { } + TimingSegment(-1), label("") { } LabelSegment(const LabelSegment &other) : - TimingSegment(other), + TimingSegment(other.GetRow()), label(other.GetLabel()) {}; /** @@ -431,7 +443,7 @@ struct LabelSegment : public TimingSegment */ template LabelSegment( StartType s, RString l ): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), label(l) {} /** @@ -450,6 +462,8 @@ struct LabelSegment : public TimingSegment * @return the truth/falsehood of if the first is less than the second. */ bool operator<( const LabelSegment &other ) const; + + TimingSegmentType GetType() const { return SEGMENT_LABEL; } private: /** @@ -463,7 +477,7 @@ private: /** * @brief Identifies when a song changes its BPM. */ -struct BPMSegment : public TimingSegment +struct BPMSegment : public TimingSegment { /** * @brief Creates a simple BPM Segment with default values. @@ -471,15 +485,12 @@ struct BPMSegment : public TimingSegment * It is best to override the values as soon as possible. */ BPMSegment() : - TimingSegment(-1), bps(-1.0f) { } + TimingSegment(-1), bps(-1.0f) { } BPMSegment(const BPMSegment &other) : - TimingSegment(other), + TimingSegment(other.GetRow()), bps(other.GetBPS()) {}; - operator int() const { return 1; } - operator float() const { return 2.0f; } - /** * @brief Creates a BPM Segment with the specified starting row and beats per second. * @param s the starting row / beat of this segment. @@ -487,7 +498,7 @@ struct BPMSegment : public TimingSegment */ template BPMSegment( StartType s, float bpm ): - TimingSegment(max((StartType)0, s)), bps(0.0f) { SetBPM(bpm); } + TimingSegment(max((StartType)0, s)), bps(0.0f) { SetBPM(bpm); } /** * @brief Get the label in this LabelSegment. @@ -515,6 +526,8 @@ struct BPMSegment : public TimingSegment * @return the truth/falsehood of if the first is less than the second. */ bool operator<( const BPMSegment &other ) const; + + TimingSegmentType GetType() const { return SEGMENT_BPM; } private: /** @@ -530,17 +543,17 @@ private: * (called the numerator here, though this isn't properly a * fraction) is the number of beats per measure. The lower number * (denominator here) is the note value representing one beat. */ -struct TimeSignatureSegment : public TimingSegment +struct TimeSignatureSegment : public TimingSegment { /** * @brief Creates a simple Time Signature Segment with default values. */ TimeSignatureSegment(): - TimingSegment(-1), + TimingSegment(-1), numerator(4), denominator(4) { } TimeSignatureSegment(const TimeSignatureSegment &other) : - TimingSegment(other), + TimingSegment(other.GetRow()), numerator(other.GetNum()), denominator(other.GetDen()) {}; /** @@ -552,7 +565,7 @@ struct TimeSignatureSegment : public TimingSegment */ template TimeSignatureSegment( StartType s, int n ): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), numerator(max(1, n)), denominator(4) {} /** * @brief Creates a Time Signature Segment with supplied values. @@ -562,7 +575,7 @@ struct TimeSignatureSegment : public TimingSegment */ template TimeSignatureSegment( StartType s, int n, int d ): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), numerator(max(1, n)), denominator(max(1, d)) {} /** @@ -603,6 +616,8 @@ struct TimeSignatureSegment : public TimingSegment * @return the truth/falsehood of if the first is less than the second. */ bool operator<( const TimeSignatureSegment &other ) const; + + TimingSegmentType GetType() const { return SEGMENT_TIME_SIG; } private: /** * @brief The numerator of the TimeSignatureSegment. @@ -624,15 +639,15 @@ private: * back to 1. * * These were inspired by the Pump It Up series. */ -struct SpeedSegment : public TimingSegment +struct SpeedSegment : public TimingSegment { /** @brief Sets up the SpeedSegment with default values. */ SpeedSegment(): - TimingSegment(0), + TimingSegment(0), ratio(1), length(0), unit(0) {} SpeedSegment(const SpeedSegment &other) : - TimingSegment(other), + TimingSegment(other.GetRow()), ratio(other.GetRatio()), length(other.GetLength()), unit(other.GetUnit()) {}; @@ -643,7 +658,7 @@ struct SpeedSegment : public TimingSegment * @param p The percentage to use. */ template SpeedSegment( StartType s, float p): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), ratio(p), length(0), unit(0) {} /** @@ -653,7 +668,7 @@ struct SpeedSegment : public TimingSegment * @param w The number of beats to wait. */ template SpeedSegment(StartType s, float p, float w): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), ratio(p), length(w), unit(0) {} @@ -665,7 +680,7 @@ struct SpeedSegment : public TimingSegment * @param k The mode used for the wait variable. */ template SpeedSegment(StartType s, float p, float w, unsigned short k): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), ratio(p), length(w), unit(k) {} /** @@ -713,6 +728,8 @@ struct SpeedSegment : public TimingSegment * @return the truth/falsehood of if the first is less than the second. */ bool operator<( const SpeedSegment &other ) const; + + TimingSegmentType GetType() const { return SEGMENT_SPEED; } private: /** @brief The percentage (ratio) to use when multiplying the Player's BPM. */ float ratio; @@ -740,10 +757,10 @@ private: * reset it by setting the precentage back to 1. * * These were inspired by the Pump It Up series. */ -struct ScrollSegment : public TimingSegment +struct ScrollSegment : public TimingSegment { /** @brief Sets up the ScrollSegment with default values. */ - ScrollSegment(): TimingSegment(0), + ScrollSegment(): TimingSegment(0), ratio(1) {} /** @@ -752,11 +769,11 @@ struct ScrollSegment : public TimingSegment * @param p The percentage to use. */ template ScrollSegment( StartType s, float p): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), ratio(p) {} ScrollSegment(const ScrollSegment &other) : - TimingSegment(other), + TimingSegment(other.GetRow()), ratio(other.GetRatio()) {} /** @@ -775,6 +792,8 @@ struct ScrollSegment : public TimingSegment * @return the truth/falsehood of if the first is less than the second. */ bool operator<( const ScrollSegment &other ) const; + + TimingSegmentType GetType() const { return SEGMENT_SCROLL; } private: /** @brief The ratio / percentage to use when multiplying the chart's scroll rate. */ float ratio; @@ -785,18 +804,18 @@ private: * * It is hopeful that stops and delays can be made into their own segments at some point. */ -struct StopSegment : public TimingSegment +struct StopSegment : public TimingSegment { /** * @brief Creates a simple Stop Segment with default values. * * It is best to override the values as soon as possible. */ - StopSegment() : TimingSegment(-1), + StopSegment() : TimingSegment(-1), pauseSeconds(-1.0f), isDelay(false) {} StopSegment (const StopSegment &other): - TimingSegment(other), + TimingSegment(other.GetRow()), pauseSeconds(other.GetPause()), isDelay(other.GetDelay()) {} @@ -810,7 +829,7 @@ struct StopSegment : public TimingSegment */ template StopSegment( StartType s, float f ): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), pauseSeconds(f), isDelay(false) {} /** * @brief Creates a Stop/Delay Segment with specified values. @@ -820,7 +839,7 @@ struct StopSegment : public TimingSegment */ template StopSegment( StartType s, float f, bool d ): - TimingSegment(max((StartType)0, s)), + TimingSegment(max((StartType)0, s)), pauseSeconds(f), isDelay(d) {} /** @@ -853,6 +872,8 @@ struct StopSegment : public TimingSegment * @return the truth/falsehood of if the first is less than the second. */ bool operator<( const StopSegment &other ) const; + + TimingSegmentType GetType() const { return SEGMENT_STOP_DELAY; } private: /** * @brief The amount of time to complete the pause at the given row.