[timing] Start the break-age.

48 compile time errors. This will be fun.
This commit is contained in:
Jason Felds
2011-07-27 22:20:52 -04:00
parent 93b3f71120
commit 4d4c0f5bd1
2 changed files with 30 additions and 66 deletions
+21 -13
View File
@@ -4,7 +4,8 @@
static const char *TimingSegmentTypeNames[] = { static const char *TimingSegmentTypeNames[] = {
"BPM", "BPM",
"Stop/Delay", // TODO: separate when stops and delays are separate. "Stop",
"Delay",
"Time Sig", "Time Sig",
"Warp", "Warp",
"Label", "Label",
@@ -332,25 +333,32 @@ void StopSegment::SetPause(const float i)
this->pauseSeconds = i; this->pauseSeconds = i;
} }
bool StopSegment::GetDelay() const
{
return this->isDelay;
}
void StopSegment::SetDelay(const bool i)
{
this->isDelay = i;
}
bool StopSegment::operator<( const StopSegment &other ) const bool StopSegment::operator<( const StopSegment &other ) const
{ {
LTCOMPARE(GetRow()); LTCOMPARE(GetRow());
if (this->GetDelay() && !other.GetDelay()) return true;
if (!this->GetDelay() && other.GetDelay()) return false;
LTCOMPARE(GetPause()); LTCOMPARE(GetPause());
return false; return false;
} }
float DelaySegment::GetPause() const
{
return this->pauseSeconds;
}
void DelaySegment::SetPause(const float i)
{
this->pauseSeconds = i;
}
bool DelaySegment::operator<( const DelaySegment &other ) const
{
LTCOMPARE(GetRow());
LTCOMPARE(GetPause());
return false;
}
#undef LTCOMPARE
/** /**
* @file * @file
* @author Jason Felds (c) 2011 * @author Jason Felds (c) 2011
+9 -53
View File
@@ -6,10 +6,8 @@
enum TimingSegmentType enum TimingSegmentType
{ {
SEGMENT_BPM, SEGMENT_BPM,
SEGMENT_STOP_DELAY, SEGMENT_STOP,
// uncomment the below two when stops and delays don't share one. SEGMENT_DELAY,
// SEGMENT_STOP,
// SEGMENT_DELAY,
SEGMENT_TIME_SIG, SEGMENT_TIME_SIG,
SEGMENT_WARP, SEGMENT_WARP,
SEGMENT_LABEL, SEGMENT_LABEL,
@@ -81,7 +79,7 @@ struct TimingSegment
{ {
return TimingSegmentType_Invalid; return TimingSegmentType_Invalid;
} }
// TODO: Remove isDelay optional param and split Stops and Delays.
virtual RString ToString(int dec) const virtual RString ToString(int dec) const
{ {
return FloatToString(this->GetBeat()); return FloatToString(this->GetBeat());
@@ -877,9 +875,7 @@ private:
}; };
/** /**
* @brief Identifies when a song has a stop or a delay. * @brief Identifies when a song has a stop, DDR/ITG style.
*
* 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
{ {
@@ -889,35 +885,21 @@ struct StopSegment : public TimingSegment
* It is best to override the values as soon as possible. * It is best to override the values as soon as possible.
*/ */
StopSegment() : TimingSegment(-1), StopSegment() : TimingSegment(-1),
pauseSeconds(-1.0f), isDelay(false) {} pauseSeconds(-1.0f) {}
StopSegment (const StopSegment &other): StopSegment (const StopSegment &other):
TimingSegment(other.GetRow()), TimingSegment(other.GetRow()),
pauseSeconds(other.GetPause()), pauseSeconds(other.GetPause()) {}
isDelay(other.GetDelay()) {}
/** /**
* @brief Creates a Stop Segment with specified values. * @brief Creates a Stop Segment with specified values.
*
* This will not create a dedicated delay segment.
* Use the third constructor for making delays.
* @param s the starting row / beat of this segment. * @param s the starting row / beat of this segment.
* @param f the length of time to pause the note scrolling. * @param f the length of time to pause the note scrolling.
*/ */
template <typename StartType> template <typename StartType>
StopSegment( StartType s, float f ): StopSegment( StartType s, float f ):
TimingSegment(max((StartType)0, s)), TimingSegment(max((StartType)0, s)),
pauseSeconds(f), isDelay(false) {} pauseSeconds(f) {}
/**
* @brief Creates a Stop/Delay Segment with specified values.
* @param s the starting row / beat of this segment.
* @param f the length of time to pause the note scrolling.
* @param d the flag that makes this Stop Segment a Delay Segment.
*/
template <typename StartType>
StopSegment( StartType s, float f, bool d ):
TimingSegment(max((StartType)0, s)),
pauseSeconds(f), isDelay(d) {}
/** /**
* @brief Get the pause length in this StopSegment. * @brief Get the pause length in this StopSegment.
@@ -929,16 +911,6 @@ struct StopSegment : public TimingSegment
* @param i the pause length. */ * @param i the pause length. */
void SetPause(const float i); void SetPause(const float i);
/**
* @brief Get the behavior in this StopSegment.
* @return the behavior. */
bool GetDelay() const;
/**
* @brief Set the behavior in this StopSegment.
* @param i the behavior. */
void SetDelay(const bool i);
virtual RString ToString(int dec) const virtual RString ToString(int dec) const
{ {
const RString str = "%.0" + IntToString(dec) const RString str = "%.0" + IntToString(dec)
@@ -948,30 +920,17 @@ struct StopSegment : public TimingSegment
/** /**
* @brief Compares two StopSegments to see if one is less than the other. * @brief Compares two StopSegments to see if one is less than the other.
*
* It should be observed that Delay Segments have to come before Stop Segments.
* Otherwise, it will act like a Stop Segment with extra time from the Delay at
* the same row.
* @param other the other StopSegment to compare to. * @param other the other StopSegment to compare to.
* @return the truth/falsehood of if the first is less than the second. * @return the truth/falsehood of if the first is less than the second.
*/ */
bool operator<( const StopSegment &other ) const; bool operator<( const StopSegment &other ) const;
TimingSegmentType GetType() const { return SEGMENT_STOP_DELAY; } TimingSegmentType GetType() const { return SEGMENT_STOP; }
private: private:
/** /**
* @brief The amount of time to complete the pause at the given row. * @brief The amount of time to complete the pause at the given row.
*/ */
float pauseSeconds; float pauseSeconds;
/**
* @brief How does this StopSegment behave?
*
* If true, the Stop Segment is treated as a Delay Segment, similar to the Pump It Up series.
* If false, this behaves similar to the DDR/ITG style games.
*
* TODO: Separate out DelaySegments in the future.
*/
bool isDelay;
}; };
/** /**
@@ -993,9 +952,6 @@ struct DelaySegment : public TimingSegment
/** /**
* @brief Creates a Delay Segment with specified values. * @brief Creates a Delay Segment with specified values.
*
* This will not create a dedicated delay segment.
* Use the third constructor for making delays.
* @param s the starting row / beat of this segment. * @param s the starting row / beat of this segment.
* @param f the length of time to pause the note scrolling. * @param f the length of time to pause the note scrolling.
*/ */
@@ -1030,7 +986,7 @@ struct DelaySegment : public TimingSegment
*/ */
bool operator<( const DelaySegment &other ) const; bool operator<( const DelaySegment &other ) const;
TimingSegmentType GetType() const { return SEGMENT_STOP_DELAY; } TimingSegmentType GetType() const { return SEGMENT_DELAY; }
private: private:
/** /**
* @brief The amount of time to complete the pause at the given row. * @brief The amount of time to complete the pause at the given row.