00001
00002
00003
#ifndef MUSICWHEEL_H
00004
#define MUSICWHEEL_H
00005
00006
#include "ActorUtil.h"
00007
#include "ActorFrame.h"
00008
#include "RageSound.h"
00009
#include "RandomSample.h"
00010
#include "GameConstantsAndTypes.h"
00011
#include "MusicSortDisplay.h"
00012
#include "ScreenMessage.h"
00013
#include "ScoreDisplayNormal.h"
00014
#include "ScrollBar.h"
00015
#include "RageTimer.h"
00016
#include "MusicWheelItem.h"
00017
class Course;
00018
class Song;
00019
00020
00021 const int MAX_VISIBLE_WHEEL_ITEMS = 25;
00022
00023 const ScreenMessage SM_SongChanged =
ScreenMessage(SM_User+47);
00024 const ScreenMessage SM_SortOrderChanging=
ScreenMessage(SM_User+48);
00025 const ScreenMessage SM_SortOrderChanged =
ScreenMessage(SM_User+49);
00026
00027
00028
struct CompareSongPointerArrayBySectionName;
00029
00030 class MusicWheel :
public ActorFrame
00031 {
00032
friend struct CompareSongPointerArrayBySectionName;
00033
00034
public:
00035
MusicWheel();
00036
~MusicWheel();
00037
void Load();
00038
00039
virtual void Update(
float fDeltaTime );
00040
virtual void DrawPrimitives();
00041
void DrawItem(
int index );
00042
00043
virtual void TweenOnScreen(
bool changing_sort);
00044
virtual void TweenOffScreen(
bool changing_sort);
00045 virtual void TweenOnScreen() {
TweenOnScreen(
false); }
00046 virtual void TweenOffScreen() {
TweenOffScreen(
false); }
00047
00048
void Move(
int n);
00049
bool ChangeSort( SortOrder new_so );
00050
bool NextSort();
00051
void StartRoulette();
00052
void StartRandom();
00053
bool IsRouletting() const;
00054
00055
int IsMoving() const;
00056
bool IsSettled() const;
00057
00058
void NotesOrTrailChanged( PlayerNumber pn );
00059
00060
void GetItemPosition(
float fPosOffsetsFromMiddle,
float& fX_out,
float& fY_out,
float& fZ_out,
float& fRotationX_out );
00061
void SetItemPosition(
Actor &item,
float fPosOffsetsFromMiddle );
00062
00063
bool Select();
00064 WheelItemType GetSelectedType() {
return m_CurWheelItemData[
m_iSelection]->m_Type; }
00065
Song*
GetSelectedSong();
00066 Course*
GetSelectedCourse() {
return m_CurWheelItemData[
m_iSelection]->m_pCourse; }
00067 CString GetSelectedSection(){
return m_CurWheelItemData[
m_iSelection]->m_sSectionName; }
00068
00069 bool WheelIsLocked() {
return (
m_WheelState ==
STATE_LOCKED ?
true :
false); }
00070
void RebuildMusicWheelItems();
00071
00072
Song *
GetPreferredSelectionForRandomOrPortal();
00073
00074
bool SelectSong(
Song *p );
00075
bool SelectSection(
const CString & SectionName );
00076
void SetOpenGroup(CString group, SortOrder so = SORT_INVALID);
00077
00078
protected:
00079
void GetSongList(vector<Song*> &arraySongs, SortOrder so, CString sPreferredGroup );
00080
void BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItems, SortOrder so );
00081
bool SelectSongOrCourse();
00082
bool SelectCourse(
Course *p );
00083
bool SelectSort( SortOrder so );
00084
void ChangeMusic(
int dist);
00085
00086 ScrollBar m_ScrollBar;
00087 AutoActor m_sprHighlight;
00088
00089 vector<WheelItemData>
m_WheelItemDatas[
NUM_SORT_ORDERS];
00090 vector<WheelItemData *>
m_CurWheelItemData;
00091
00092 MusicWheelItem m_MusicWheelItems[
MAX_VISIBLE_WHEEL_ITEMS];
00093
00094 int m_iSelection;
00095 CString m_sExpandedSectionName;
00096 SortOrder m_LastSortOrder;
00097
00098 int m_iSwitchesLeftInSpinDown;
00099 float m_fLockedWheelVelocity;
00100
00101 int m_Moving;
00102 RageTimer m_MovingSoundTimer;
00103 float m_TimeBeforeMovingBegins;
00104 float m_SpinSpeed;
00105 enum WheelState {
00106
STATE_SELECTING_MUSIC,
00107
STATE_FLYING_OFF_BEFORE_NEXT_SORT,
00108
STATE_FLYING_ON_AFTER_NEXT_SORT,
00109
STATE_TWEENING_ON_SCREEN,
00110
STATE_TWEENING_OFF_SCREEN,
00111
STATE_WAITING_OFF_SCREEN,
00112
STATE_ROULETTE_SPINNING,
00113
STATE_ROULETTE_SLOWING_DOWN,
00114
STATE_RANDOM_SPINNING,
00115
STATE_LOCKED,
00116 };
00117 WheelState m_WheelState;
00118 float m_fTimeLeftInState;
00119 float m_fPositionOffsetFromSelection;
00120
00121 RageSound m_soundChangeMusic;
00122 RageSound m_soundChangeSort;
00123 RageSound m_soundExpand;
00124 RageSound m_soundLocked;
00125
00126
bool WheelItemIsVisible(
int n);
00127
void UpdateScrollbar();
00128 };
00129
00130
#endif
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155