00001
00002
00003
#ifndef SONG_H
00004
#define SONG_H
00005
00006
#include "PlayerNumber.h"
00007
#include "GameConstantsAndTypes.h"
00008
#include "Grade.h"
00009
#include "TimingData.h"
00010
#include "Difficulty.h"
00011
00012
class Steps;
00013
class Style;
00014
class NotesLoader;
00015
class LyricsLoader;
00016
class Profile;
00017
class StepsID;
00018
00019 #define MAX_EDITS_PER_SONG_PER_PROFILE 5
00020 #define MAX_EDITS_PER_SONG 5*NUM_PROFILE_SLOTS
00021
00022 extern const int FILE_CACHE_VERSION;
00023
00024
00025 struct BackgroundChange
00026 {
00027 BackgroundChange() {
m_fStartBeat=-1;
m_fRate=1;
m_bFadeLast=
false;
m_bRewindMovie=
false;
m_bLoop=
true; };
00028 BackgroundChange(
float s, CString n,
float r=1.f,
bool f=
false,
bool m=
false,
bool l=
true ) {
m_fStartBeat=s;
m_sBGName=n;
m_fRate=r;
m_bFadeLast=
f;
m_bRewindMovie=m;
m_bLoop=l; };
00029 float m_fStartBeat;
00030 CString m_sBGName;
00031 float m_fRate;
00032 bool m_bFadeLast;
00033 bool m_bRewindMovie;
00034 bool m_bLoop;
00035 };
00036
00037
void SortBackgroundChangesArray( vector<BackgroundChange> &arrayBackgroundChanges );
00038
00039 struct LyricSegment
00040 {
00041 float m_fStartTime;
00042 CString m_sLyric;
00043 RageColor m_Color;
00044 };
00045
00046
00047 class Song
00048 {
00049 CString m_sSongDir;
00050
00051
public:
00052
00053 enum SelectionDisplay {
SHOW_ALWAYS,
00054
SHOW_ROULETTE,
00055
SHOW_NEVER }
00056 m_SelectionDisplay;
00057
00058
Song();
00059
~Song();
00060
void Reset();
00061
00062
NotesLoader *MakeLoader( CString sDir )
const;
00063
00064
bool LoadFromSongDir( CString sDir );
00065
00066
void TidyUpData();
00067
void ReCalculateRadarValuesAndLastBeat();
00068
void TranslateTitles();
00069
00070
void SaveToSMFile( CString sPath,
bool bSavingCache );
00071
void Save();
00072
void SaveToCacheFile();
00073
void SaveToDWIFile();
00074
00075
const CString &
GetSongFilePath() const;
00076 CString GetCacheFilePath() const;
00077
00078
void AddAutoGenNotes();
00079
void AutoGen( StepsType ntTo, StepsType ntFrom );
00080
void RemoveAutoGenNotes();
00081
00082
00083 const CString &GetSongDir()
const {
return m_sSongDir; }
00084
00085
00086
00087
00088
00089 CString m_sSongFileName;
00090
00091 CString m_sGroupName;
00092
00093 ProfileSlot m_LoadedFromProfile;
00094 bool m_bIsSymLink;
00095
00096 CString m_sMainTitle,
m_sSubTitle,
m_sArtist;
00097 CString m_sMainTitleTranslit,
m_sSubTitleTranslit,
m_sArtistTranslit;
00098
00099
00100
00101
CString GetDisplayMainTitle() const;
00102 CString GetDisplaySubTitle() const;
00103 CString GetDisplayArtist() const;
00104
00105
00106 CString GetTranslitMainTitle()
const {
return m_sMainTitleTranslit.size()?
m_sMainTitleTranslit:
m_sMainTitle; }
00107 CString GetTranslitSubTitle()
const {
return m_sSubTitleTranslit.size()?
m_sSubTitleTranslit:
m_sSubTitle; }
00108 CString GetTranslitArtist()
const {
return m_sArtistTranslit.size()?
m_sArtistTranslit:
m_sArtist; }
00109
00110
00111
CString GetFullDisplayTitle() const;
00112 CString GetFullTranslitTitle() const;
00113
00114
00115 CString m_sCredit;
00116
00117 CString m_sMusicFile;
00118 float m_fMusicLengthSeconds;
00119 float m_fFirstBeat;
00120 float m_fLastBeat;
00121 float m_fMusicSampleStartSeconds;
00122 float m_fMusicSampleLengthSeconds;
00123 enum {
DISPLAY_ACTUAL,
DISPLAY_SPECIFIED,
DISPLAY_RANDOM } m_DisplayBPMType;
00124 float m_fSpecifiedBPMMin;
00125 float m_fSpecifiedBPMMax;
00126
00127 CString m_sBannerFile;
00128 CString m_sLyricsFile;
00129 CString m_sBackgroundFile;
00130 CString m_sCDTitleFile;
00131
00132
CString GetMusicPath() const;
00133 CString GetBannerPath() const;
00134 CString GetLyricsPath() const;
00135 CString GetBackgroundPath() const;
00136 CString GetCDTitlePath() const;
00137
00138
00139 bool m_bHasMusic, m_bHasBanner;
00140
00141
bool HasMusic() const;
00142
bool HasBanner() const;
00143
bool HasBackground() const;
00144
bool HasCDTitle() const;
00145
bool HasMovieBackground() const;
00146
bool HasBGChanges() const;
00147
bool HasLyrics() const;
00148
00149
bool Matches(CString sGroup, CString sSong) const;
00150
00151 TimingData m_Timing;
00152 vector<
BackgroundChange> m_BackgroundChanges;
00153 vector<
BackgroundChange> m_ForegroundChanges;
00154 vector<
LyricSegment> m_LyricSegments;
00155
00156 void AddBPMSegment( const
BPMSegment &seg ) { m_Timing.
AddBPMSegment( seg ); }
00157 void AddStopSegment(
const StopSegment &seg ) {
m_Timing.
AddStopSegment( seg ); }
00158
void AddBackgroundChange(
BackgroundChange seg );
00159
void AddForegroundChange(
BackgroundChange seg );
00160
void AddLyricSegment(
LyricSegment seg );
00161
00162
void GetDisplayBpms(
DisplayBpms &AddTo )
const;
00163
CString GetBackgroundAtBeat(
float fBeat )
const;
00164
00165 float GetBPMAtBeat(
float fBeat )
const {
return m_Timing.
GetBPMAtBeat( fBeat ); }
00166 void SetBPMAtBeat(
float fBeat,
float fBPM ) {
m_Timing.
SetBPMAtBeat( fBeat, fBPM ); }
00167 BPMSegment&
GetBPMSegmentAtBeat(
float fBeat ) {
return m_Timing.
GetBPMSegmentAtBeat( fBeat ); }
00168 void GetBeatAndBPSFromElapsedTime(
float fElapsedTime,
float &fBeatOut,
float &fBPSOut,
bool &bFreezeOut )
const {
m_Timing.
GetBeatAndBPSFromElapsedTime( fElapsedTime, fBeatOut, fBPSOut, bFreezeOut ); }
00169 float GetBeatFromElapsedTime(
float fElapsedTime )
const {
return m_Timing.
GetBeatFromElapsedTime( fElapsedTime ); }
00170 float GetElapsedTimeFromBeat(
float fBeat )
const {
return m_Timing.
GetElapsedTimeFromBeat( fBeat ); }
00171
bool HasSignificantBpmChangesOrStops() const;
00172
00173
bool SongCompleteForStyle( const
Style *st ) const;
00174
bool HasStepsType( StepsType st ) const;
00175
bool HasStepsTypeAndDifficulty( StepsType st, Difficulty dc ) const;
00176 const vector<
Steps*>& GetAllSteps( StepsType st=STEPS_TYPE_INVALID )
const {
return st==
STEPS_TYPE_INVALID?
m_vpSteps:
m_vpStepsByType[st]; }
00177
void GetSteps(
00178 vector<Steps*>& arrayAddTo,
00179 StepsType st = STEPS_TYPE_INVALID,
00180 Difficulty dc = DIFFICULTY_INVALID,
00181
int iMeterLow = -1,
00182
int iMeterHigh = -1,
00183
const CString &sDescription =
"",
00184
bool bIncludeAutoGen =
true,
00185
unsigned uHash = 0,
00186
int iMaxToGet = -1
00187 )
const;
00188
Steps* GetSteps(
00189 StepsType st = STEPS_TYPE_INVALID,
00190 Difficulty dc = DIFFICULTY_INVALID,
00191
int iMeterLow = -1,
00192
int iMeterHigh = -1,
00193
const CString &sDescription =
"",
00194
unsigned uHash = 0,
00195
bool bIncludeAutoGen =
true
00196 )
const;
00197
Steps* GetStepsByDifficulty( StepsType st, Difficulty dc,
bool bIncludeAutoGen =
true )
const;
00198
Steps* GetStepsByMeter( StepsType st,
int iMeterLow,
int iMeterHigh )
const;
00199
Steps* GetStepsByDescription( StepsType st, CString sDescription )
const;
00200
Steps* GetClosestNotes( StepsType st, Difficulty dc )
const;
00201
bool IsEasy( StepsType st )
const;
00202
bool IsTutorial() const;
00203
bool HasEdits( StepsType st ) const;
00204 SelectionDisplay GetDisplayed() const;
00205
bool NormallyDisplayed() const;
00206
bool NeverDisplayed() const;
00207
bool RouletteDisplayed() const;
00208
bool ShowInDemonstrationAndRanking() const;
00209
00210
void AddSteps(
Steps* pSteps );
00211
void RemoveSteps( const
Steps* pSteps );
00212
00213
void FreeAllLoadedFromProfiles();
00214 bool WasLoadedFromProfile()
const {
return m_LoadedFromProfile !=
PROFILE_SLOT_INVALID; }
00215
int GetNumStepsLoadedFromProfile( ProfileSlot slot )
const;
00216
bool IsEditAlreadyLoaded(
Steps* pSteps )
const;
00217
00218
00219
00220
00221
00222
00223 vector<CString>
m_vsKeysoundFile;
00224
00225
private:
00226
void AdjustDuplicateSteps();
00227
void DeleteDuplicateSteps( vector<Steps*> &vSteps );
00228
00229 vector<Steps*>
m_vpSteps;
00230 vector<Steps*>
m_vpStepsByType[
NUM_STEPS_TYPES];
00231 };
00232
00233
#endif
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258