Files
itgmania212121/stepmania/src/Course.h
T

149 lines
4.1 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"
2003-10-25 22:55:11 +00:00
#include "Attack.h"
2003-12-21 02:54:23 +00:00
#include <map>
#include "Trail.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-08-03 00:13:55 +00:00
class Steps;
2004-02-10 09:42:01 +00:00
class Profile;
2002-06-14 22:25:22 +00:00
2003-08-10 23:48:10 +00:00
enum CourseEntryType
{
COURSE_ENTRY_FIXED,
COURSE_ENTRY_RANDOM,
COURSE_ENTRY_RANDOM_WITHIN_GROUP,
COURSE_ENTRY_BEST,
COURSE_ENTRY_WORST,
NUM_COURSE_ENTRY_TYPES // leave this at the end
};
inline CString CourseEntryTypeToString( CourseEntryType cet )
{
switch( cet )
{
case COURSE_ENTRY_FIXED: return "fixed";
case COURSE_ENTRY_RANDOM: return "random";
case COURSE_ENTRY_RANDOM_WITHIN_GROUP: return "random_within_group";
case COURSE_ENTRY_BEST: return "best";
case COURSE_ENTRY_WORST: return "worst";
default: ASSERT(0); return "";
}
}
2003-08-11 02:18:13 +00:00
class CourseEntry
{
public:
2003-08-10 23:48:10 +00:00
CourseEntryType 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
2004-02-10 22:52:43 +00:00
bool no_difficult; // if true, difficult course setting doesn't affect this entry
2003-08-10 23:48:10 +00:00
int low_meter; // = -1 if no meter range specified
int high_meter; // = -1 if no meter range specified
int players_index; // ignored if type isn't 'best' or 'worst'
CString modifiers; // set player and song options using these
2003-10-26 03:02:30 +00:00
AttackArray attacks; // set timed modifiers
2003-08-10 23:48:10 +00:00
CourseEntry()
{
2003-08-11 06:09:57 +00:00
type = (CourseEntryType)0;
2003-08-12 06:51:03 +00:00
mystery = false;
pSong = NULL;
group_name = "";
2003-08-10 23:48:10 +00:00
difficulty = DIFFICULTY_INVALID;
2004-02-10 22:52:43 +00:00
no_difficult = false;
2003-08-10 23:48:10 +00:00
low_meter = -1;
high_meter = -1;
2003-08-12 06:51:03 +00:00
players_index = 0;
modifiers = "";
2003-08-10 23:48:10 +00:00
}
};
2002-06-14 22:25:22 +00:00
class Course
{
public:
Course();
2002-06-14 22:25:22 +00:00
bool m_bIsAutogen; // was this created by AutoGen?
CString m_sPath;
CString m_sName, m_sNameTranslit;
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
2002-07-27 19:29:51 +00:00
int m_iLives; // -1 means use bar life meter
int m_iCustomMeter[NUM_COURSE_DIFFICULTIES]; // -1 = no meter specified
bool m_bSortByMeter;
2003-08-10 23:48:10 +00:00
vector<CourseEntry> m_entries;
2003-07-27 19:14:05 +00:00
2003-08-03 00:13:55 +00:00
// Dereferences course_entries and returns only the playable Songs and Steps
Trail* GetTrail( StepsType st, CourseDifficulty cd ) const;
float GetMeter( StepsType st, CourseDifficulty cd ) const;
2004-03-13 23:11:57 +00:00
bool HasMods() const;
bool AllSongsAreFixed() const;
2003-07-21 21:54:07 +00:00
int GetEstimatedNumStages() const { return m_entries.size(); }
bool HasCourseDifficulty( StepsType st, CourseDifficulty cd ) const;
bool IsPlayableIn( StepsType st ) const;
bool CourseHasBestOrWorst() const;
RageColor GetColor() const;
bool GetTotalSeconds( StepsType st, 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;
2002-06-14 22:25:22 +00:00
bool IsFixed() const;
2003-02-05 19:16:00 +00:00
void LoadFromCRSFile( CString sPath );
void Init();
2003-04-11 00:12:22 +00:00
void Save();
void AutogenEndlessFromGroup( CString sGroupName, Difficulty dc );
void AutogenNonstopFromGroup( CString sGroupName, Difficulty dc );
void AutogenOniFromArtist( CString sArtistName, vector<Song*> aSongs, Difficulty dc );
2002-06-14 22:25:22 +00:00
// sorting values
int m_SortOrder_TotalDifficulty;
int m_SortOrder_Ranking;
bool IsRanking() const;
void UpdateCourseStats( StepsType st );
2003-12-21 02:54:23 +00:00
/* Call per-screen, and if song or notes pointers change: */
void ClearCache();
private:
void GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail ) const;
void GetMeterRange( int stage, int& iMeterLowOut, int& iMeterHighOut, CourseDifficulty cd ) const;
2003-12-21 02:54:23 +00:00
typedef pair<StepsType,CourseDifficulty> TrailParams;
typedef map<TrailParams, Trail> TrailCache;
mutable TrailCache m_TrailCache;
2002-06-14 22:25:22 +00:00
};
2002-07-27 19:29:51 +00:00
#endif