forgot to check in Steps.h/cpp

This commit is contained in:
Chris Danford
2003-08-03 00:57:20 +00:00
parent a5484733ab
commit caa7783413
2 changed files with 45 additions and 45 deletions
@@ -1,7 +1,7 @@
#include "global.h" #include "global.h"
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: Notes Class: Steps
Desc: See header. Desc: See header.
@@ -11,9 +11,9 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "Notes.h" #include "Steps.h"
#include "song.h" #include "song.h"
#include "Notes.h" #include "Steps.h"
#include "IniFile.h" #include "IniFile.h"
#include "math.h" // for fabs() #include "math.h" // for fabs()
#include "RageUtil.h" #include "RageUtil.h"
@@ -26,7 +26,7 @@
Notes::Notes() Steps::Steps()
{ {
/* FIXME: should we init this to NOTES_TYPE_INVALID? /* FIXME: should we init this to NOTES_TYPE_INVALID?
* I have a feeling that it's the right thing to do but that * I have a feeling that it's the right thing to do but that
@@ -50,13 +50,13 @@ Notes::Notes()
} }
} }
Notes::~Notes() Steps::~Steps()
{ {
delete notes; delete notes;
delete notes_comp; delete notes_comp;
} }
void Notes::SetNoteData( NoteData* pNewNoteData ) void Steps::SetNoteData( NoteData* pNewNoteData )
{ {
ASSERT( pNewNoteData->GetNumTracks() == GameManager::NotesTypeToNumTracks(m_NotesType) ); ASSERT( pNewNoteData->GetNumTracks() == GameManager::NotesTypeToNumTracks(m_NotesType) );
@@ -69,7 +69,7 @@ void Notes::SetNoteData( NoteData* pNewNoteData )
notes = new NoteData(*pNewNoteData); notes = new NoteData(*pNewNoteData);
} }
void Notes::GetNoteData( NoteData* pNoteDataOut ) const void Steps::GetNoteData( NoteData* pNoteDataOut ) const
{ {
ASSERT(this); ASSERT(this);
ASSERT(pNoteDataOut); ASSERT(pNoteDataOut);
@@ -85,7 +85,7 @@ void Notes::GetNoteData( NoteData* pNoteDataOut ) const
} }
} }
void Notes::SetSMNoteData( const CString &out ) void Steps::SetSMNoteData( const CString &out )
{ {
delete notes; delete notes;
notes = NULL; notes = NULL;
@@ -96,7 +96,7 @@ void Notes::SetSMNoteData( const CString &out )
*notes_comp = out; *notes_comp = out;
} }
CString Notes::GetSMNoteData() const CString Steps::GetSMNoteData() const
{ {
if(!notes_comp) if(!notes_comp)
{ {
@@ -107,7 +107,7 @@ CString Notes::GetSMNoteData() const
return *notes_comp; return *notes_comp;
} }
void Notes::TidyUpData() void Steps::TidyUpData()
{ {
if( GetDifficulty() == DIFFICULTY_INVALID ) if( GetDifficulty() == DIFFICULTY_INVALID )
SetDifficulty(StringToDifficulty(GetDescription())); SetDifficulty(StringToDifficulty(GetDescription()));
@@ -147,7 +147,7 @@ void Notes::TidyUpData()
} }
} }
void Notes::Decompress() const void Steps::Decompress() const
{ {
if(notes) if(notes)
{ {
@@ -182,7 +182,7 @@ void Notes::Decompress() const
} }
} }
void Notes::Compress() const void Steps::Compress() const
{ {
if(!notes_comp) if(!notes_comp)
{ {
@@ -196,7 +196,7 @@ void Notes::Compress() const
/* Copy our parent's data. This is done when we're being changed from autogen /* Copy our parent's data. This is done when we're being changed from autogen
* to normal. (needed?) */ * to normal. (needed?) */
void Notes::DeAutogen() void Steps::DeAutogen()
{ {
if(!parent) if(!parent)
return; /* OK */ return; /* OK */
@@ -214,13 +214,13 @@ void Notes::DeAutogen()
Compress(); Compress();
} }
void Notes::AutogenFrom( Notes *parent_, NotesType ntTo ) void Steps::AutogenFrom( Steps *parent_, NotesType ntTo )
{ {
parent = parent_; parent = parent_;
m_NotesType = ntTo; m_NotesType = ntTo;
} }
void Notes::CopyFrom( Notes* pSource, NotesType ntTo ) // pSource does not have to be of the same NotesType! void Steps::CopyFrom( Steps* pSource, NotesType ntTo ) // pSource does not have to be of the same NotesType!
{ {
m_NotesType = ntTo; m_NotesType = ntTo;
NoteData noteData; NoteData noteData;
@@ -236,7 +236,7 @@ void Notes::CopyFrom( Notes* pSource, NotesType ntTo ) // pSource does not have
this->SetRadarValue( (RadarCategory)r, radarValues[r] ); this->SetRadarValue( (RadarCategory)r, radarValues[r] );
} }
void Notes::CreateBlank( NotesType ntTo ) void Steps::CreateBlank( NotesType ntTo )
{ {
m_NotesType = ntTo; m_NotesType = ntTo;
NoteData noteData; NoteData noteData;
@@ -245,36 +245,36 @@ void Notes::CreateBlank( NotesType ntTo )
} }
const Notes *Notes::Real() const const Steps *Steps::Real() const
{ {
if(parent) return parent; if(parent) return parent;
return this; return this;
} }
bool Notes::IsAutogen() const bool Steps::IsAutogen() const
{ {
return parent != NULL; return parent != NULL;
} }
void Notes::SetDescription(CString desc) void Steps::SetDescription(CString desc)
{ {
DeAutogen(); DeAutogen();
m_sDescription = desc; m_sDescription = desc;
} }
void Notes::SetDifficulty(Difficulty d) void Steps::SetDifficulty(Difficulty d)
{ {
DeAutogen(); DeAutogen();
m_Difficulty = d; m_Difficulty = d;
} }
void Notes::SetMeter(int meter) void Steps::SetMeter(int meter)
{ {
DeAutogen(); DeAutogen();
m_iMeter = meter; m_iMeter = meter;
} }
void Notes::SetRadarValue(int r, float val) void Steps::SetRadarValue(int r, float val)
{ {
DeAutogen(); DeAutogen();
ASSERT(r < NUM_RADAR_CATEGORIES); ASSERT(r < NUM_RADAR_CATEGORIES);
@@ -287,7 +287,7 @@ void Notes::SetRadarValue(int r, float val)
* XXX: Isn't it possible to beat the grade but not beat the score, since * XXX: Isn't it possible to beat the grade but not beat the score, since
* grading and scores are on completely different systems? Should we be * grading and scores are on completely different systems? Should we be
* checking for these completely separately? */ * checking for these completely separately? */
bool Notes::MemCardScore::HigherScore( int vsScore, Grade vsGrade ) const bool Steps::MemCardScore::HigherScore( int vsScore, Grade vsGrade ) const
{ {
if( vsScore > this->iScore ) if( vsScore > this->iScore )
return true; return true;
@@ -296,7 +296,7 @@ bool Notes::MemCardScore::HigherScore( int vsScore, Grade vsGrade ) const
return vsGrade > this->grade; return vsGrade > this->grade;
} }
void Notes::AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecordOut ) void Steps::AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecordOut )
{ {
bNewRecordOut = false; bNewRecordOut = false;
@@ -322,7 +322,7 @@ void Notes::AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecord
// Sorting stuff // Sorting stuff
// //
bool CompareNotesPointersByRadarValues(const Notes* pNotes1, const Notes* pNotes2) bool CompareNotesPointersByRadarValues(const Steps* pNotes1, const Steps* pNotes2)
{ {
float fScore1 = 0; float fScore1 = 0;
float fScore2 = 0; float fScore2 = 0;
@@ -336,17 +336,17 @@ bool CompareNotesPointersByRadarValues(const Notes* pNotes1, const Notes* pNotes
return fScore1 < fScore2; return fScore1 < fScore2;
} }
bool CompareNotesPointersByMeter(const Notes *pNotes1, const Notes* pNotes2) bool CompareNotesPointersByMeter(const Steps *pNotes1, const Steps* pNotes2)
{ {
return pNotes1->GetMeter() < pNotes2->GetMeter(); return pNotes1->GetMeter() < pNotes2->GetMeter();
} }
bool CompareNotesPointersByDifficulty(const Notes *pNotes1, const Notes *pNotes2) bool CompareNotesPointersByDifficulty(const Steps *pNotes1, const Steps *pNotes2)
{ {
return pNotes1->GetDifficulty() < pNotes2->GetDifficulty(); return pNotes1->GetDifficulty() < pNotes2->GetDifficulty();
} }
void SortNotesArrayByDifficulty( vector<Notes*> &arraySteps ) void SortNotesArrayByDifficulty( vector<Steps*> &arraySteps )
{ {
/* Sort in reverse order of priority. */ /* Sort in reverse order of priority. */
stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByRadarValues ); stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByRadarValues );
+17 -17
View File
@@ -1,11 +1,11 @@
#ifndef NOTES_H #ifndef STEPS_H
#define NOTES_H #define STEPS_H
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: Notes Class: Steps
Desc: Holds note information for a Song. A Song may have one or more Notess. Desc: Holds note information for a Song. A Song may have one or more Notess.
A Notes can be played by one or more Styles. See StyleDef.h for more info on A Steps can be played by one or more Styles. See StyleDef.h for more info on
Styles. Styles.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
@@ -18,20 +18,20 @@
#include "Grade.h" #include "Grade.h"
class NoteData; class NoteData;
class Notes class Steps
{ {
public: public:
Notes(); Steps();
~Notes(); ~Steps();
// initializers // initializers
void AutogenFrom( Notes *parent, NotesType ntTo ); void AutogenFrom( Steps *parent, NotesType ntTo );
void CopyFrom( Notes* pSource, NotesType ntTo ); void CopyFrom( Steps* pSource, NotesType ntTo );
void CreateBlank( NotesType ntTo ); void CreateBlank( NotesType ntTo );
void Compress() const; void Compress() const;
void Decompress() const; void Decompress() const;
void DeAutogen(); /* If this Notes is autogenerated, make it a real Notes. */ void DeAutogen(); /* If this Steps is autogenerated, make it a real Steps. */
CString GetDescription() const { return Real()->m_sDescription; } CString GetDescription() const { return Real()->m_sDescription; }
Difficulty GetDifficulty() const { return Real()->m_Difficulty; } Difficulty GetDifficulty() const { return Real()->m_Difficulty; }
@@ -67,9 +67,9 @@ public:
void TidyUpData(); void TidyUpData();
protected: protected:
/* If this Notes is autogenerated, this will point to the autogen /* If this Steps is autogenerated, this will point to the autogen
* source. If this is true, notes_comp will always be NULL. */ * source. If this is true, notes_comp will always be NULL. */
const Notes *parent; const Steps *parent;
/* We can have one or both of these; if we have both, they're always identical. /* We can have one or both of these; if we have both, they're always identical.
* Call Compress() to force us to only have notes_comp; otherwise, creation of * Call Compress() to force us to only have notes_comp; otherwise, creation of
@@ -77,7 +77,7 @@ protected:
mutable NoteData *notes; mutable NoteData *notes;
mutable CString *notes_comp; mutable CString *notes_comp;
const Notes *Real() const; const Steps *Real() const;
/* These values are pulled from the autogen source first, if there is one. */ /* These values are pulled from the autogen source first, if there is one. */
CString m_sDescription; // This text is displayed next to the number of feet when a song is selected CString m_sDescription; // This text is displayed next to the number of feet when a song is selected
@@ -87,9 +87,9 @@ protected:
}; };
bool CompareNotesPointersByRadarValues(const Notes* pNotes1, const Notes* pNotes2); bool CompareNotesPointersByRadarValues(const Steps* pNotes1, const Steps* pNotes2);
bool CompareNotesPointersByMeter(const Notes *pNotes1, const Notes* pNotes2); bool CompareNotesPointersByMeter(const Steps *pNotes1, const Steps* pNotes2);
bool CompareNotesPointersByDifficulty(const Notes *pNotes1, const Notes *pNotes2); bool CompareNotesPointersByDifficulty(const Steps *pNotes1, const Steps *pNotes2);
void SortNotesArrayByDifficulty( vector<Notes*> &arrayNotess ); void SortNotesArrayByDifficulty( vector<Steps*> &arrayNotess );
#endif #endif