Working towards refactoring TimingSegments.

Hope I took care of the Windows 20** files right.
This commit is contained in:
Jason Felds
2011-05-31 00:17:46 -04:00
parent 3e21fdeb33
commit e90b81d3c3
7 changed files with 164 additions and 3 deletions
@@ -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 = "<absolute>"; };
2B30D6801315EA7E00044B68 /* MouseDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseDevice.cpp; sourceTree = "<group>"; };
2B30D6811315EA7E00044B68 /* MouseDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MouseDevice.h; sourceTree = "<group>"; };
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;
};
+1 -1
View File
@@ -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
+2
View File
@@ -1524,6 +1524,8 @@
RelativePath="TimingData.h"
>
</File>
<File RelativePath="TimingSegments.cpp"></File>
<File RelativePath="TimingSegments.h"></File>
<File
RelativePath="TitleSubstitution.cpp"
>
+2
View File
@@ -478,6 +478,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)</Command>
<ClCompile Include="Style.cpp" />
<ClCompile Include="StyleUtil.cpp" />
<ClCompile Include="TimingData.cpp" />
<ClCompile Include="TimingSegments.cpp" />
<ClCompile Include="TitleSubstitution.cpp" />
<ClCompile Include="Trail.cpp" />
<ClCompile Include="TrailUtil.cpp" />
@@ -1798,6 +1799,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)</Command>
<ClInclude Include="SubscriptionManager.h" />
<ClInclude Include="ThemeMetric.h" />
<ClInclude Include="TimingData.h" />
<ClInclude Include="TimingSegments.h" />
<ClInclude Include="TitleSubstitution.h" />
<ClInclude Include="Trail.h" />
<ClInclude Include="TrailUtil.h" />
+6
View File
@@ -507,6 +507,9 @@
<ClCompile Include="TimingData.cpp">
<Filter>Data Structures</Filter>
</ClCompile>
<ClCompile Include="TimingSegments.cpp">
<Filter>Data Structures</Filter>
</ClCompile>
<ClCompile Include="TitleSubstitution.cpp">
<Filter>Data Structures</Filter>
</ClCompile>
@@ -2027,6 +2030,9 @@
<ClInclude Include="TimingData.h">
<Filter>Data Structures</Filter>
</ClInclude>
<ClInclude Include="TimingSegments.h">
<Filter>Data Structures</Filter>
</ClInclude>
<ClInclude Include="TitleSubstitution.h">
<Filter>Data Structures</Filter>
</ClInclude>
+55
View File
@@ -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.
*/
+88
View File
@@ -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.
*/