2002-11-16 08:07:38 +00:00
|
|
|
#ifndef MUSICWHEEL_H
|
|
|
|
|
#define MUSICWHEEL_H
|
2002-01-16 10:01:32 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-05-01 19:14:55 +00:00
|
|
|
Class: MusicWheel
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-05-01 19:14:55 +00:00
|
|
|
Desc: A wheel with song names used in the Select Music screen.
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-05-01 19:14:55 +00:00
|
|
|
Chris Danford
|
2002-01-16 10:01:32 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "Sprite.h"
|
|
|
|
|
#include "ActorFrame.h"
|
2003-04-11 15:53:32 +00:00
|
|
|
#include "RageSound.h"
|
2002-03-10 10:30:45 +00:00
|
|
|
#include "RandomSample.h"
|
2002-05-01 19:14:55 +00:00
|
|
|
#include "GameConstantsAndTypes.h"
|
2002-01-16 10:01:32 +00:00
|
|
|
#include "MusicSortDisplay.h"
|
2003-03-31 23:06:15 +00:00
|
|
|
#include "ScreenMessage.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "ScoreDisplayNormal.h"
|
2002-05-01 19:14:55 +00:00
|
|
|
#include "ScrollBar.h"
|
2003-01-19 00:47:06 +00:00
|
|
|
#include "RageTimer.h"
|
2003-02-10 05:30:12 +00:00
|
|
|
#include "MusicWheelItem.h"
|
2003-03-31 23:06:15 +00:00
|
|
|
class Course;
|
|
|
|
|
class Song;
|
2002-04-28 20:42:32 +00:00
|
|
|
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-03-26 19:15:38 +00:00
|
|
|
const int MAX_WHEEL_ITEMS = 15;
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
const ScreenMessage SM_SongChanged = ScreenMessage(SM_User+47); // this should be unique!
|
2003-07-20 08:54:31 +00:00
|
|
|
const ScreenMessage SM_SortOrderChanging= ScreenMessage(SM_User+48);
|
|
|
|
|
const ScreenMessage SM_SortOrderChanged = ScreenMessage(SM_User+49);
|
2002-01-20 08:59:38 +00:00
|
|
|
|
|
|
|
|
|
2003-02-11 23:52:18 +00:00
|
|
|
struct CompareSongPointerArrayBySectionName;
|
|
|
|
|
|
2002-01-16 10:01:32 +00:00
|
|
|
class MusicWheel : public ActorFrame
|
|
|
|
|
{
|
2003-02-11 23:52:18 +00:00
|
|
|
friend struct CompareSongPointerArrayBySectionName;
|
|
|
|
|
|
2002-01-16 10:01:32 +00:00
|
|
|
public:
|
|
|
|
|
MusicWheel();
|
2002-02-06 05:13:39 +00:00
|
|
|
~MusicWheel();
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-01-18 21:19:05 +00:00
|
|
|
virtual void Update( float fDeltaTime );
|
2002-05-19 01:59:48 +00:00
|
|
|
virtual void DrawPrimitives();
|
2003-04-23 05:54:56 +00:00
|
|
|
void DrawItem( int index );
|
2002-01-18 21:19:05 +00:00
|
|
|
|
2003-01-02 02:59:25 +00:00
|
|
|
virtual void TweenOnScreen(bool changing_sort);
|
|
|
|
|
virtual void TweenOffScreen(bool changing_sort);
|
|
|
|
|
virtual void TweenOnScreen() { TweenOnScreen(false); }
|
|
|
|
|
virtual void TweenOffScreen() { TweenOffScreen(false); }
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-01-02 02:59:25 +00:00
|
|
|
void Move(int n);
|
2003-06-16 17:28:58 +00:00
|
|
|
bool ChangeSort( SongSortOrder new_so ); // return true if change successful
|
|
|
|
|
bool NextSort(); // return true if change successful
|
2002-08-20 21:00:56 +00:00
|
|
|
void StartRoulette();
|
2003-01-19 00:47:06 +00:00
|
|
|
void StartRandom();
|
2003-01-02 02:59:25 +00:00
|
|
|
bool IsRouletting() const;
|
|
|
|
|
/* Return true if we're moving fast automatically. */
|
|
|
|
|
int IsMoving() const;
|
|
|
|
|
|
2002-04-28 20:42:32 +00:00
|
|
|
void NotesChanged( PlayerNumber pn ); // update grade graphics and top score
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-04-02 04:41:49 +00:00
|
|
|
void GetItemPosition( float fPosOffsetsFromMiddle, float& fX_out, float& fY_out, float& fZ_out, float& fRotationX_out );
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-06-16 17:28:58 +00:00
|
|
|
bool Select(); // return true if this selection ends the screen
|
2003-03-31 23:06:15 +00:00
|
|
|
WheelItemType GetSelectedType() { return m_CurWheelItemData[m_iSelection]->m_Type; };
|
2003-01-02 02:59:25 +00:00
|
|
|
Song* GetSelectedSong() { return m_CurWheelItemData[m_iSelection]->m_pSong; };
|
|
|
|
|
Course* GetSelectedCourse() { return m_CurWheelItemData[m_iSelection]->m_pCourse; };
|
|
|
|
|
CString GetSelectedSection(){ return m_CurWheelItemData[m_iSelection]->m_sSectionName; };
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-07-31 04:06:34 +00:00
|
|
|
bool WheelIsLocked() { return (m_WheelState == STATE_LOCKED ? true : false); }
|
2003-03-31 23:06:15 +00:00
|
|
|
void RebuildMusicWheelItems();
|
2002-01-16 10:01:32 +00:00
|
|
|
|
|
|
|
|
protected:
|
2003-04-19 18:51:13 +00:00
|
|
|
void GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CString sPreferredGroup );
|
2003-01-03 03:24:00 +00:00
|
|
|
void BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItems, SongSortOrder so );
|
2003-06-16 17:28:58 +00:00
|
|
|
void SetOpenGroup(CString group, SongSortOrder so = SORT_INVALID);
|
2003-01-02 02:59:25 +00:00
|
|
|
bool SelectSong(const Song *p);
|
|
|
|
|
bool SelectCourse(const Course *p);
|
2003-06-16 17:28:58 +00:00
|
|
|
bool SelectSort( SongSortOrder so );
|
2003-01-21 07:04:53 +00:00
|
|
|
void ChangeMusic(int dist); /* +1 or -1 */
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
ScrollBar m_ScrollBar;
|
2002-05-29 09:47:24 +00:00
|
|
|
Sprite m_sprSelectionOverlay;
|
2002-02-09 04:30:27 +00:00
|
|
|
|
2003-02-17 20:38:57 +00:00
|
|
|
vector<WheelItemData> m_WheelItemDatas[NUM_SORT_ORDERS];
|
2003-01-02 02:59:25 +00:00
|
|
|
vector<WheelItemData *> m_CurWheelItemData;
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-03-31 23:06:15 +00:00
|
|
|
MusicWheelItem m_MusicWheelItems[MAX_WHEEL_ITEMS];
|
2002-02-09 04:30:27 +00:00
|
|
|
|
2003-01-02 02:59:25 +00:00
|
|
|
int m_iSelection; // index into m_CurWheelItemData
|
2002-05-28 20:01:22 +00:00
|
|
|
CString m_sExpandedSectionName;
|
2003-06-16 17:28:58 +00:00
|
|
|
SongSortOrder m_LastSongSortOrder;
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-06-24 22:04:31 +00:00
|
|
|
int m_iSwitchesLeftInSpinDown;
|
|
|
|
|
float m_fLockedWheelVelocity;
|
2003-01-02 02:59:25 +00:00
|
|
|
/* 0 = none; -1 or 1 = up/down */
|
|
|
|
|
int m_Moving;
|
2003-01-19 00:47:06 +00:00
|
|
|
RageTimer m_MovingSoundTimer;
|
2003-01-02 02:59:25 +00:00
|
|
|
float m_TimeBeforeMovingBegins;
|
|
|
|
|
float m_SpinSpeed;
|
2002-01-18 21:19:05 +00:00
|
|
|
enum WheelState {
|
2002-06-24 22:04:31 +00:00
|
|
|
STATE_SELECTING_MUSIC,
|
2002-01-18 21:19:05 +00:00
|
|
|
STATE_FLYING_OFF_BEFORE_NEXT_SORT,
|
|
|
|
|
STATE_FLYING_ON_AFTER_NEXT_SORT,
|
|
|
|
|
STATE_TWEENING_ON_SCREEN,
|
|
|
|
|
STATE_TWEENING_OFF_SCREEN,
|
2002-06-14 22:25:22 +00:00
|
|
|
STATE_WAITING_OFF_SCREEN,
|
|
|
|
|
STATE_ROULETTE_SPINNING,
|
|
|
|
|
STATE_ROULETTE_SLOWING_DOWN,
|
2003-01-03 03:24:00 +00:00
|
|
|
STATE_RANDOM_SPINNING,
|
2002-06-14 22:25:22 +00:00
|
|
|
STATE_LOCKED,
|
2002-01-18 21:19:05 +00:00
|
|
|
};
|
2002-05-28 20:01:22 +00:00
|
|
|
WheelState m_WheelState;
|
|
|
|
|
float m_fTimeLeftInState;
|
|
|
|
|
float m_fPositionOffsetFromSelection;
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-01-02 08:13:34 +00:00
|
|
|
RageSound m_soundChangeMusic;
|
|
|
|
|
RageSound m_soundChangeSort;
|
|
|
|
|
RageSound m_soundExpand;
|
|
|
|
|
RageSound m_soundStart;
|
|
|
|
|
RageSound m_soundLocked;
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-02-11 23:52:18 +00:00
|
|
|
static CString GetSectionNameFromSongAndSort( const Song* pSong, SongSortOrder so );
|
2003-06-19 06:24:41 +00:00
|
|
|
static void SortSongPointerArrayBySectionName( vector<Song*> &arraySongPointers, SongSortOrder so );
|
2002-12-30 22:40:34 +00:00
|
|
|
bool WheelItemIsVisible(int n);
|
2003-01-02 02:59:25 +00:00
|
|
|
void UpdateScrollbar();
|
2002-01-16 10:01:32 +00:00
|
|
|
};
|
2002-11-16 08:07:38 +00:00
|
|
|
|
|
|
|
|
#endif
|