00001
00002
00003
#ifndef COURSE_H
00004
#define COURSE_H
00005
00006
#include "PlayerNumber.h"
00007
#include "GameConstantsAndTypes.h"
00008
#include "Attack.h"
00009
#include <map>
00010
#include "Trail.h"
00011
00012
struct PlayerOptions;
00013
struct SongOptions;
00014
class Song;
00015
class Steps;
00016
class Profile;
00017
00018 enum CourseEntryType
00019 {
00020
COURSE_ENTRY_FIXED,
00021
COURSE_ENTRY_RANDOM,
00022
COURSE_ENTRY_RANDOM_WITHIN_GROUP,
00023
COURSE_ENTRY_BEST,
00024
COURSE_ENTRY_WORST,
00025
NUM_COURSE_ENTRY_TYPES
00026 };
00027
00028 inline CString CourseEntryTypeToString( CourseEntryType cet )
00029 {
00030
switch( cet )
00031 {
00032
case COURSE_ENTRY_FIXED:
return "fixed";
00033
case COURSE_ENTRY_RANDOM:
return "random";
00034
case COURSE_ENTRY_RANDOM_WITHIN_GROUP:
return "random_within_group";
00035
case COURSE_ENTRY_BEST:
return "best";
00036
case COURSE_ENTRY_WORST:
return "worst";
00037
default:
ASSERT(0);
return "";
00038 }
00039 }
00040
00041 class CourseEntry
00042 {
00043
public:
00044 CourseEntryType type;
00045 bool mystery;
00046 Song*
pSong;
00047 CString group_name;
00048 Difficulty difficulty;
00049 bool no_difficult;
00050 int low_meter;
00051 int high_meter;
00052 int players_index;
00053 CString modifiers;
00054 AttackArray attacks;
00055
00056 CourseEntry()
00057 {
00058
type = (
CourseEntryType)0;
00059
mystery =
false;
00060
pSong = NULL;
00061
group_name =
"";
00062
difficulty =
DIFFICULTY_INVALID;
00063
no_difficult =
false;
00064
low_meter = -1;
00065
high_meter = -1;
00066
players_index = 0;
00067
modifiers =
"";
00068 }
00069 };
00070
00071 class Course
00072 {
00073
public:
00074
Course();
00075
00076 bool m_bIsAutogen;
00077 CString m_sPath;
00078
private:
00079 CString m_sMainTitle,
m_sMainTitleTranslit;
00080 CString m_sSubTitle,
m_sSubTitleTranslit;
00081
00082
public:
00083
bool HasBanner() const;
00084
00085 CString m_sBannerPath;
00086 CString m_sCDTitlePath;
00087
00088 bool m_bRepeat;
00089 bool m_bRandomize;
00090 int m_iLives;
00091 int m_iCustomMeter[NUM_DIFFICULTIES];
00092 bool m_bSortByMeter;
00093
00094 vector<
CourseEntry> m_entries;
00095
00096
00097
00098 CString GetDisplayMainTitle() const;
00099 CString GetDisplaySubTitle() const;
00100
00101
00102 CString GetTranslitMainTitle()
const {
return m_sMainTitleTranslit.size()?
m_sMainTitleTranslit:
m_sMainTitle; }
00103 CString GetTranslitSubTitle()
const {
return m_sSubTitleTranslit.size()?
m_sSubTitleTranslit:
m_sSubTitle; }
00104
00105
00106
CString GetFullDisplayTitle() const;
00107 CString GetFullTranslitTitle() const;
00108
00109
00110
Trail* GetTrail( StepsType st,
CourseDifficulty cd=DIFFICULTY_MEDIUM ) const;
00111
void GetTrails( vector<
Trail*> &AddTo, StepsType st ) const;
00112
float GetMeter( StepsType st, CourseDifficulty cd=DIFFICULTY_MEDIUM ) const;
00113
bool HasMods() const;
00114
bool AllSongsAreFixed() const;
00115
00116 int GetEstimatedNumStages()
const {
return m_entries.size(); }
00117
bool IsPlayableIn( StepsType st )
const;
00118
bool CourseHasBestOrWorst() const;
00119
RageColor GetColor() const;
00120
bool GetTotalSeconds( StepsType st,
float& fSecondsOut ) const;
00121
00122 bool IsNonstop()
const {
return GetPlayMode() ==
PLAY_MODE_NONSTOP; }
00123 bool IsOni()
const {
return GetPlayMode() ==
PLAY_MODE_ONI; }
00124 bool IsEndless()
const {
return GetPlayMode() ==
PLAY_MODE_ENDLESS; }
00125
PlayMode GetPlayMode() const;
00126
00127
bool IsFixed() const;
00128
00129 bool ShowInDemonstrationAndRanking()
const {
return true; }
00130
00131
void LoadFromCRSFile( CString sPath );
00132
void RevertFromDisk();
00133
void Init();
00134
void Save();
00135
void AutogenEndlessFromGroup( CString sGroupName, Difficulty dc );
00136
void AutogenNonstopFromGroup( CString sGroupName, Difficulty dc );
00137
void AutogenOniFromArtist( CString sArtistName, CString sArtistNameTranslit, vector<Song*> aSongs, Difficulty dc );
00138
00139
00140 int m_SortOrder_TotalDifficulty;
00141 int m_SortOrder_Ranking;
00142
bool IsRanking() const;
00143
00144
void UpdateCourseStats( StepsType st );
00145
00146
00147
void RegenerateNonFixedTrails();
00148
00149
00150
void Invalidate(
Song *pStaleSong );
00151
00152
void GetAllCachedTrails( vector<
Trail *> &out );
00153
00154 const
CourseEntry *FindFixedSong( const
Song *pSong ) const;
00155
00156 private:
00157
bool GetTrailUnsorted( StepsType st,
CourseDifficulty cd,
Trail &trail ) const;
00158
bool GetTrailSorted( StepsType st, CourseDifficulty cd,
Trail &trail ) const;
00159
00160 typedef pair<StepsType,Difficulty>
CacheEntry;
00161 struct
CacheData
00162 {
00163 Trail trail;
00164 bool null;
00165 };
00166 typedef map<CacheEntry, CacheData>
TrailCache_t;
00167 mutable TrailCache_t m_TrailCache;
00168 mutable int m_iTrailCacheSeed;
00169 };
00170
00171
#endif
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196