Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

MusicWheel.h

Go to the documentation of this file.
00001 /* MusicWheel - A wheel with song names used in the Select Music screen. */ 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); // this should be unique! 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 ); // return true if change successful 00050 bool NextSort(); // return true if change successful 00051 void StartRoulette(); 00052 void StartRandom(); 00053 bool IsRouletting() const; 00054 /* Return true if we're moving fast automatically. */ 00055 int IsMoving() const; 00056 bool IsSettled() const; 00057 00058 void NotesOrTrailChanged( PlayerNumber pn ); // update grade graphics and top score 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(); // return true if this selection ends the screen 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); /* +1 or -1 */ 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; // index into m_CurWheelItemData 00095 CString m_sExpandedSectionName; 00096 SortOrder m_LastSortOrder; 00097 00098 int m_iSwitchesLeftInSpinDown; 00099 float m_fLockedWheelVelocity; 00100 /* 0 = none; -1 or 1 = up/down */ 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 * (c) 2001-2004 Chris Danford, Chris Gomez, Glenn Maynard 00134 * All rights reserved. 00135 * 00136 * Permission is hereby granted, free of charge, to any person obtaining a 00137 * copy of this software and associated documentation files (the 00138 * "Software"), to deal in the Software without restriction, including 00139 * without limitation the rights to use, copy, modify, merge, publish, 00140 * distribute, and/or sell copies of the Software, and to permit persons to 00141 * whom the Software is furnished to do so, provided that the above 00142 * copyright notice(s) and this permission notice appear in all copies of 00143 * the Software and that both the above copyright notice(s) and this 00144 * permission notice appear in supporting documentation. 00145 * 00146 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00147 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00148 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00149 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00150 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00151 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00152 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00153 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00154 * PERFORMANCE OF THIS SOFTWARE. 00155 */

Generated on Thu Jan 27 20:57:25 2005 for StepMania by doxygen 1.3.7