diff --git a/Xcode/stepmania.xcodeproj/project.pbxproj b/Xcode/stepmania.xcodeproj/project.pbxproj index 0efeaa2235..e135889337 100644 --- a/Xcode/stepmania.xcodeproj/project.pbxproj +++ b/Xcode/stepmania.xcodeproj/project.pbxproj @@ -25,6 +25,8 @@ 1215D7A208C6559A00B87D8B /* ScreenGameplayNormal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1215D7A008C6559A00B87D8B /* ScreenGameplayNormal.cpp */; }; 2B30D6821315EA7E00044B68 /* MouseDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B30D6801315EA7E00044B68 /* MouseDevice.cpp */; }; 2B30D6831315EA7E00044B68 /* MouseDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B30D6811315EA7E00044B68 /* MouseDevice.h */; }; + 2B43509513949F37006FA051 /* TimingSegments.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B43509313949F37006FA051 /* TimingSegments.h */; }; + 2B43509613949F37006FA051 /* TimingSegments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B43509413949F37006FA051 /* TimingSegments.cpp */; }; 2B76698B132FF71500586512 /* NotesLoaderSMA.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B766989132FF71500586512 /* NotesLoaderSMA.h */; }; 2B76698C132FF71500586512 /* NotesLoaderSMA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B76698A132FF71500586512 /* NotesLoaderSMA.cpp */; }; 2B9C2E8D137A138B004C92F3 /* NotesLoaderJson.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B9C2E89137A138B004C92F3 /* NotesLoaderJson.cpp */; }; @@ -1802,6 +1804,8 @@ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 2B30D6801315EA7E00044B68 /* MouseDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseDevice.cpp; sourceTree = ""; }; 2B30D6811315EA7E00044B68 /* MouseDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MouseDevice.h; sourceTree = ""; }; + 2B43509313949F37006FA051 /* TimingSegments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TimingSegments.h; path = ../src/TimingSegments.h; sourceTree = SOURCE_ROOT; }; + 2B43509413949F37006FA051 /* TimingSegments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TimingSegments.cpp; path = ../src/TimingSegments.cpp; sourceTree = SOURCE_ROOT; }; 2B766989132FF71500586512 /* NotesLoaderSMA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotesLoaderSMA.h; path = ../src/NotesLoaderSMA.h; sourceTree = SOURCE_ROOT; }; 2B76698A132FF71500586512 /* NotesLoaderSMA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesLoaderSMA.cpp; path = ../src/NotesLoaderSMA.cpp; sourceTree = SOURCE_ROOT; }; 2B9C2E89137A138B004C92F3 /* NotesLoaderJson.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesLoaderJson.cpp; path = ../src/NotesLoaderJson.cpp; sourceTree = SOURCE_ROOT; }; @@ -3961,6 +3965,8 @@ AA21D5A10712AE16008B825F /* ThemeMetric.h */, AA729C420599B50D00779F33 /* TimingData.cpp */, AA729C430599B50D00779F33 /* TimingData.h */, + 2B43509413949F37006FA051 /* TimingSegments.cpp */, + 2B43509313949F37006FA051 /* TimingSegments.h */, AA6EFE0E04770C79005F316C /* TitleSubstitution.cpp */, AA6EFE0F04770C79005F316C /* TitleSubstitution.h */, AA70E3650663112800DAE1FD /* Trail.cpp */, @@ -5065,6 +5071,7 @@ B75CE3B5137963350076A82D /* SongPosition.h in Headers */, 2B9C2E8E137A138B004C92F3 /* NotesLoaderJson.h in Headers */, 2B9C2E90137A138B004C92F3 /* NotesWriterJson.h in Headers */, + 2B43509513949F37006FA051 /* TimingSegments.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6328,6 +6335,7 @@ 2BC6133813773C8E00CC8BBD /* pngwrite.c in Sources */, 2BC6133913773C8E00CC8BBD /* pngwtran.c in Sources */, 2BC6133A13773C8E00CC8BBD /* pngwutil.c in Sources */, + 2B43509613949F37006FA051 /* TimingSegments.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/src/Makefile.am b/src/Makefile.am index 178a263f39..2abcf7c4be 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -182,7 +182,7 @@ SongOptions.cpp SongOptions.h SongUtil.cpp SongUtil.h StageStats.cpp StageStats. SoundEffectControl.cpp SoundEffectControl.h \ StepsUtil.cpp StepsUtil.h Style.cpp Style.h StyleUtil.cpp StyleUtil.h \ SubscriptionManager.h \ -TimingData.cpp TimingData.h \ +TimingData.cpp TimingData.h TimingSegments.cpp TimingSegments.h \ ThemeMetric.h \ Trail.cpp Trail.h TrailUtil.cpp TrailUtil.h TitleSubstitution.cpp TitleSubstitution.h \ Tween.cpp Tween.h diff --git a/src/StepMania-net2008.vcproj b/src/StepMania-net2008.vcproj index d4a1f01a8a..bcc20ea4b9 100644 --- a/src/StepMania-net2008.vcproj +++ b/src/StepMania-net2008.vcproj @@ -1524,6 +1524,8 @@ RelativePath="TimingData.h" > + + diff --git a/src/StepMania-net2010.vcxproj b/src/StepMania-net2010.vcxproj index d44826bcdc..ebc0108298 100644 --- a/src/StepMania-net2010.vcxproj +++ b/src/StepMania-net2010.vcxproj @@ -478,6 +478,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) + @@ -1798,6 +1799,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) + @@ -2369,4 +2371,4 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) - \ No newline at end of file + diff --git a/src/StepMania-net2010.vcxproj.filters b/src/StepMania-net2010.vcxproj.filters index 37961b681b..0d28f9a2c7 100644 --- a/src/StepMania-net2010.vcxproj.filters +++ b/src/StepMania-net2010.vcxproj.filters @@ -507,6 +507,9 @@ Data Structures + + Data Structures + Data Structures @@ -2027,6 +2030,9 @@ Data Structures + + Data Structures + Data Structures @@ -3148,4 +3154,4 @@ BaseClasses - \ No newline at end of file + diff --git a/src/TimingSegments.cpp b/src/TimingSegments.cpp new file mode 100644 index 0000000000..254c905403 --- /dev/null +++ b/src/TimingSegments.cpp @@ -0,0 +1,55 @@ +#include "TimingSegments.h" + +TimingSegment::TimingSegment() : startingRow(-1) {} + +TimingSegment::TimingSegment(int s) : startingRow(s) {} + +TimingSegment::TimingSegment(float s) : startingRow(BeatToNoteRow(s)) {} + +TimingSegment::~TimingSegment() {} + +void TimingSegment::SetRow(const int s) +{ + this->startingRow = s; +} +void TimingSegment::SetBeat(const float s) +{ + this->startingRow = BeatToNoteRow(s); +} + +int TimingSegment::GetRow() const +{ + return this->startingRow; +} + +float TimingSegment::GetBeat() const +{ + return NoteRowToBeat(this->startingRow); +} + +/** + * @file + * @author Jason Felds (c) 2011 + * @section LICENSE + * 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/TimingSegments.h b/src/TimingSegments.h new file mode 100644 index 0000000000..6d61d8a88e --- /dev/null +++ b/src/TimingSegments.h @@ -0,0 +1,88 @@ +#ifndef TIMING_SEGMENTS_H +#define TIMING_SEGMENTS_H + +#include "NoteTypes.h" // Converting rows to beats and vice~versa. + +/** + * @brief Compare a TimingData segment's properties with one another. + * + * This will be removed once we start respecting public & private data.*/ +#define COMPARE(x) if(x!=other.x) return false; + +/** + * @brief The general TimingSegment for all of the changing glory. + * + * Each segment is supposed to derive from this one. */ +struct TimingSegment +{ + /** @brief Set up a TimingSegment with default values. */ + TimingSegment(); + /** + * @brief Set up a TimingSegment with specified values. + * @param s the starting row. */ + TimingSegment(int s); + /** + * @brief Set up a TimingSegment with specified values. + * @param s the starting beat. */ + TimingSegment(float s); + + virtual ~TimingSegment(); + + /** + * @brief Set the starting row of the TimingSegment. + * + * This is virtual to allow other segments to implement validation + * as required by them. + * @param s the supplied row. */ + virtual void SetRow( const int s ); + /** + * @brief Set the starting beat of the TimingSegment. + * + * This is virtual to allow other segments to implement validation + * as required by them. + * @param s the supplied beat. */ + virtual void SetBeat( const float s ); + /** + * @brief Get the starting row of the TimingSegment. + * @return the starting row. */ + int GetRow() const; + /** + * @brief Get the starting beat of the TimingSegment. + * @return the starting beat. */ + float GetBeat() const; + +private: + /** @brief The row in which this segment activates. */ + int startingRow; +}; + +#undef COMPARE + +#endif + +/** + * @file + * @author Jason Felds (c) 2011 + * @section LICENSE + * 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. + */