Files
itgmania212121/stepmania/src/Course.h
T

139 lines
4.2 KiB
C++
Raw Normal View History

#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
-----------------------------------------------------------------------------
*/
#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
{
struct Entry {
enum Type { fixed, random, random_within_group, best, worst, caprice } type;
bool mystery; // show "??????"
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'
CString modifiers; // set player and song options using these
Entry()
{
difficulty = DIFFICULTY_INVALID;
low_meter = -1;
high_meter = -1;
players_index = -1;
mystery = false;
}
2002-12-17 05:41:04 +00:00
};
vector<Entry> m_entries;
2002-12-17 05:41:04 +00:00
2002-06-14 22:25:22 +00:00
public:
Course();
2002-06-14 22:25:22 +00:00
bool m_bIsAutogen; // was this created by AutoGen?
CString m_sPath;
2002-06-14 22:25:22 +00:00
CString m_sName;
CString m_sTranslitName; // used for unlocks
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
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-07-21 22:33:01 +00:00
int m_iMeter; // -1 autogens
2003-07-21 21:54:07 +00:00
struct Info
{
2003-07-27 19:14:05 +00:00
Info(): pSong(NULL), pNotes(NULL), Random(false), Difficult(false) { }
2003-07-21 23:16:06 +00:00
Song* pSong;
Notes* pNotes;
2003-07-21 21:54:07 +00:00
CString Modifiers;
bool Random;
bool Mystery;
2003-07-27 19:14:05 +00:00
bool Difficult; /* set to true if this is the difficult version */
2003-07-21 21:54:07 +00:00
/* Corresponding entry in m_entries: */
int CourseIndex;
};
2003-07-27 19:14:05 +00:00
2003-07-21 21:54:07 +00:00
// Dereferences course_entries and returns only the playable Songs and Notes
2003-07-27 19:14:05 +00:00
void GetCourseInfo( NotesType nt, vector<Info> &ci, int Difficult = -1 ) const;
2003-07-21 21:54:07 +00:00
int GetEstimatedNumStages() const { return m_entries.size(); }
2003-07-17 22:44:17 +00:00
bool HasDifficult( NotesType nt ) const;
bool IsPlayableIn( NotesType nt ) const;
RageColor GetColor() const;
Difficulty GetDifficulty( const Info &stage ) const;
void GetMeterRange( const Info &stage, int& iMeterLowOut, int& iMeterHighOut ) const;
bool GetTotalSeconds( float& fSecondsOut ) const;
2002-07-02 17:34:20 +00:00
2003-07-27 19:14:05 +00:00
bool IsNonstop() const { return GetPlayMode() == PLAY_MODE_NONSTOP; }
bool IsOni() const { return GetPlayMode() == PLAY_MODE_ONI; }
bool IsEndless() const { return GetPlayMode() == PLAY_MODE_ENDLESS; }
2003-07-20 01:54:17 +00:00
PlayMode GetPlayMode() const;
2003-07-27 19:14:05 +00:00
int GetMeter( int Difficult = -1 ) const;
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();
void AutogenEndlessFromGroup( CString sGroupName, vector<Song*> &apSongsInGroup );
void AutogenNonstopFromGroup( CString sGroupName, vector<Song*> &apSongsInGroup );
2002-06-14 22:25:22 +00:00
// Statistics
struct RankingScore
{
2003-06-30 08:06:47 +00:00
/* Dance points for oni, regular score for nonstop. */
int iScore;
float fSurviveTime;
CString sName;
} m_RankingScores[NUM_NOTES_TYPES][NUM_RANKING_LINES]; // sorted highest to lowest by iDancePoints
struct MemCardScore
{
int iNumTimesPlayed;
2003-06-30 08:06:47 +00:00
int iScore;
float fSurviveTime;
} 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
// sorting values
int SortOrder_TotalDifficulty;
float SortOrder_AvgDifficulty;
int SortOrder_Ranking;
void UpdateCourseStats();
private:
2003-06-30 08:06:47 +00:00
void SetDefaultScore();
2003-07-27 19:14:05 +00:00
void GetMeterRange( int stage, int& iMeterLowOut, int& iMeterHighOut, int Difficult = -1 ) 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 );
2003-07-20 08:50:19 +00:00
void SortCoursePointerArrayByType( vector<Course*> &apCourses );
void SortCoursePointerArrayByAvgDifficulty( vector<Course*> &apCourses );
void SortCoursePointerArrayByTotalDifficulty( vector<Course*> &apCourses );
void SortCoursePointerArrayByRanking( vector<Course*> &apCourses );
#endif