Files
itgmania212121/stepmania/src/MusicWheel.h
T

154 lines
5.1 KiB
C++
Raw Normal View History

2004-06-07 21:14:03 +00:00
/* MusicWheel - A wheel with song names used in the Select Music screen. */
#ifndef MUSICWHEEL_H
#define MUSICWHEEL_H
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"
#include "RageTimer.h"
#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-11-02 09:17:15 +00:00
const int MAX_WHEEL_ITEMS = 25;
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!
const ScreenMessage SM_SortOrderChanging= ScreenMessage(SM_User+48);
const ScreenMessage SM_SortOrderChanged = ScreenMessage(SM_User+49);
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();
~MusicWheel();
void Load();
2002-01-16 10:01:32 +00:00
virtual void Update( float fDeltaTime );
2002-05-19 01:59:48 +00:00
virtual void DrawPrimitives();
void DrawItem( int index );
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);
2004-03-12 08:31:40 +00:00
bool ChangeSort( SortOrder new_so ); // return true if change successful
2003-06-16 17:28:58 +00:00
bool NextSort(); // return true if change successful
2002-08-20 21:00:56 +00:00
void StartRoulette();
void StartRandom();
2003-01-02 02:59:25 +00:00
bool IsRouletting() const;
/* Return true if we're moving fast automatically. */
int IsMoving() const;
2004-09-04 21:32:36 +00:00
bool IsSettled() const;
2003-01-02 02:59:25 +00:00
2004-06-03 08:22:02 +00:00
void NotesOrTrailChanged( 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 );
2003-11-18 18:07:37 +00:00
void SetItemPosition( Actor &item, float fPosOffsetsFromMiddle );
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
2004-06-02 05:12:45 +00:00
WheelItemType GetSelectedType() { return m_CurWheelItemData[m_iSelection]->m_Type; }
Song* GetSelectedSong();
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
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
int GetPreferredSelectionForRandomOrPortal();
2002-01-16 10:01:32 +00:00
protected:
2004-03-12 08:31:40 +00:00
void GetSongList(vector<Song*> &arraySongs, SortOrder so, CString sPreferredGroup );
void BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItems, SortOrder so );
void SetOpenGroup(CString group, SortOrder so = SORT_INVALID);
bool SelectSongOrCourse();
bool SelectSong( Song *p );
bool SelectCourse( Course *p );
2004-03-12 08:31:40 +00:00
bool SelectSort( SortOrder so );
2003-01-21 07:04:53 +00:00
void ChangeMusic(int dist); /* +1 or -1 */
2002-01-16 10:01:32 +00:00
ScrollBar m_ScrollBar;
2002-05-29 09:47:24 +00:00
Sprite m_sprSelectionOverlay;
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];
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;
2004-03-12 08:31:40 +00:00
SortOrder m_LastSortOrder;
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;
RageTimer m_MovingSoundTimer;
2003-01-02 02:59:25 +00:00
float m_TimeBeforeMovingBegins;
float m_SpinSpeed;
enum WheelState {
2002-06-24 22:04:31 +00:00
STATE_SELECTING_MUSIC,
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-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_soundLocked;
2002-01-16 10:01:32 +00:00
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
};
#endif
2004-06-07 21:14:03 +00:00
/*
* (c) 2001-2004 Chris Danford, Chris Gomez, Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/