2002-11-16 08:07:38 +00:00
#ifndef COURSE_H
#define COURSE_H
2002-06-14 22:25:22 +00:00
/*
-----------------------------------------------------------------------------
2002-07-27 19:29:51 +00:00
Class: Course
2002-06-14 22:25:22 +00:00
Desc: A queue of songs and notes.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
2003-02-26 00:20:00 +00:00
#include "PlayerNumber.h"
2002-06-14 22:25:22 +00:00
#include "GameConstantsAndTypes.h"
2002-12-17 05:41:04 +00:00
2002-07-28 20:28:37 +00:00
struct PlayerOptions ;
struct SongOptions ;
2002-06-14 22:25:22 +00:00
class Song ;
2003-03-26 23:08:05 +00:00
class Notes ;
2002-06-14 22:25:22 +00:00
class Course
{
2003-02-16 10:12:03 +00:00
struct Entry {
2003-04-14 07:11:04 +00:00
enum Type { fixed , random , random_within_group , best , worst } type ;
2003-02-16 23:54:30 +00:00
Song * pSong ; // used in type=fixed
CString group_name ; // used in type=random_within_group
Difficulty difficulty ; // = DIFFICULTY_INVALID if no difficulty specified
int low_meter ; // = -1 if no meter range specified
int high_meter ; // = -1 if no meter range specified
2003-04-14 07:11:04 +00:00
int players_index ; // ignored if type isn't 'best' or 'worst'
2003-02-16 23:54:30 +00:00
CString modifiers ; // set player and song options using these
2003-02-14 21:42:44 +00:00
2003-02-16 10:12:03 +00:00
Entry ()
{
difficulty = DIFFICULTY_INVALID ;
low_meter = - 1 ;
high_meter = - 1 ;
players_index = - 1 ;
}
2002-12-17 05:41:04 +00:00
};
2003-02-16 10:12:03 +00:00
vector < Entry > m_entries ;
2002-12-17 05:41:04 +00:00
2002-06-14 22:25:22 +00:00
public :
2002-12-17 05:07:56 +00:00
Course ();
2002-06-14 22:25:22 +00:00
2003-03-27 01:56:21 +00:00
bool m_bIsAutogen ; // was this created by AutoGen?
2003-01-21 05:14:59 +00:00
CString m_sPath ;
2002-06-14 22:25:22 +00:00
CString m_sName ;
2003-04-19 18:51:13 +00:00
bool HasBanner () const ;
2002-06-14 22:25:22 +00:00
CString m_sBannerPath ;
CString m_sCDTitlePath ;
2002-12-17 05:16:33 +00:00
2003-02-14 21:42:44 +00:00
bool m_bRepeat ; // repeat after last song? "Endless"
2002-07-29 03:06:55 +00:00
bool m_bRandomize ; // play the songs in a random order
2003-03-07 05:24:52 +00:00
bool m_bDifficult ; // only make something difficult once
2002-07-27 19:29:51 +00:00
int m_iLives ; // -1 means use bar life meter
2003-02-14 21:42:44 +00:00
int m_iExtra ; // extra stage number... // not used? -Chris
int GetEstimatedNumStages () const { return m_entries . size (); }
bool HasDifficult () const ;
2003-02-16 10:12:03 +00:00
bool IsPlayableIn ( NotesType nt ) const ;
void GetStageInfo ( // Derefrences course_entries and returns only the playable Songs and Notes
2003-02-14 21:42:44 +00:00
vector < Song *>& vSongsOut ,
vector < Notes *>& vNotesOut ,
vector < CString >& vsModifiersOut ,
2003-06-06 19:42:53 +00:00
NotesType nt ) const ; // like EX's Standard/Difficult option for courses
2003-02-14 21:42:44 +00:00
bool GetFirstStageInfo (
Song *& pSongOut ,
Notes *& pNotesOut ,
CString & sModifiersOut ,
NotesType nt ) const ;
RageColor GetColor () const ;
bool IsMysterySong ( int stage ) const ;
2003-02-16 10:12:03 +00:00
Difficulty GetDifficulty ( int stage ) const ;
void GetMeterRange ( int stage , int & iMeterLowOut , int & iMeterHighOut ) const ;
2003-02-14 21:42:44 +00:00
bool ContainsAnyMysterySongs () const ;
bool GetTotalSeconds ( float & fSecondsOut ) const ;
2002-07-02 17:34:20 +00:00
2002-06-14 22:25:22 +00:00
2003-02-05 19:16:00 +00:00
void LoadFromCRSFile ( CString sPath );
2003-04-11 00:12:22 +00:00
void Save ();
2003-03-27 01:56:21 +00:00
void AutogenEndlessFromGroup ( CString sGroupName , vector < Song *> & apSongsInGroup );
void AutogenNonstopFromGroup ( CString sGroupName , vector < Song *> & apSongsInGroup );
2002-06-14 22:25:22 +00:00
2002-09-04 03:29:42 +00:00
2003-01-21 05:14:59 +00:00
// Statistics
2003-02-14 21:42:44 +00:00
struct RankingScore
2003-01-21 05:14:59 +00:00
{
int iDancePoints ;
float fSurviveTime ;
CString sName ;
2003-02-14 21:42:44 +00:00
} m_RankingScores [ NUM_NOTES_TYPES ][ NUM_RANKING_LINES ]; // sorted highest to lowest by iDancePoints
2003-01-24 02:43:07 +00:00
struct MemCardScore
{
2003-02-14 21:42:44 +00:00
int iNumTimesPlayed ;
2003-01-24 02:43:07 +00:00
int iDancePoints ;
float fSurviveTime ;
2003-02-14 21:42:44 +00:00
} m_MemCardScores [ NUM_MEMORY_CARDS ][ NUM_NOTES_TYPES ];
void AddScores ( NotesType nt , bool bPlayerEnabled [ NUM_PLAYERS ], int iDancePoints [ NUM_PLAYERS ], float fSurviveTime [ NUM_PLAYERS ], int iRankingIndexOut [ NUM_PLAYERS ], bool bNewRecordOut [ NUM_PLAYERS ] ); // iNewRecordIndexOut[p] = -1 if not a new record
2003-01-24 02:43:07 +00:00
2003-01-21 05:14:59 +00:00
2002-09-04 03:29:42 +00:00
private :
2003-02-16 23:54:30 +00:00
Song * FindSong ( CString sGroup , CString sSong ) const ;
2002-06-14 22:25:22 +00:00
};
2002-07-27 19:29:51 +00:00
2003-01-03 05:56:28 +00:00
void SortCoursePointerArrayByDifficulty ( vector < Course *> & apCourses );
2002-07-27 19:29:51 +00:00
2002-11-16 08:07:38 +00:00
#endif