diff --git a/stepmania/src/RoomWheel.cpp b/stepmania/src/RoomWheel.cpp index b7167b42f8..55ed8a8fc2 100644 --- a/stepmania/src/RoomWheel.cpp +++ b/stepmania/src/RoomWheel.cpp @@ -20,11 +20,18 @@ void RoomWheel::Load( CString sType ) m_WheelBaseItems.clear(); for( int i=0; iGetMetricF(m_sName,"InfoBoxWidth") ); + m_roomInfo.SetHeight( THEME->GetMetricF(m_sName,"InfoBoxHeight") ); + SET_XY( m_roomInfo ); + m_roomInfo.SetHidden( true ); + OFF_COMMAND( m_roomInfo ); + this->AddChild(&m_roomInfo); m_WheelState = STATE_SELECTING; + m_RoomInfoState = LOCKED; AddPerminateItem( new RoomWheelData(TYPE_GENERIC, "Create Room", "Create a new game room", THEME->GetMetricC( m_sName, "CreateRoomColor")) ); @@ -32,7 +39,6 @@ void RoomWheel::Load( CString sType ) RebuildWheelItems(); } - RoomWheelData::RoomWheelData( WheelItemType wit, CString sTitle, CString sDesc, RageColor color ): WheelItemBaseData( wit, sTitle, color ) { @@ -83,6 +89,7 @@ void RoomWheel::AddPerminateItem(RoomWheelData* itemdata) bool RoomWheel::Select() { + RetractInfoBox(); if( m_iSelection > 0 ) return WheelBase::Select(); else if( m_iSelection == 0 ) @@ -103,6 +110,59 @@ void RoomWheelItem::LoadFromWheelItemBaseData( WheelItemBaseData* pWID ) m_text.SetDiffuseColor( pWID->m_color ); } +void RoomWheel::Update( float fDeltaTime ) +{ + WheelBase::Update(fDeltaTime); + + if ((m_deployDelay.PeekDeltaTime() >= 1.5) && (m_deployDelay.PeekDeltaTime() < (1.5 + 5))) + DeployInfoBox(); + else if (m_deployDelay.PeekDeltaTime() >= 1.5 + 5) + RetractInfoBox(); +} + +void RoomWheel::Move(int n) +{ + if ((n == 0) && (m_iSelection >= m_offset)) + { + m_RoomInfoState = CLOSED; + m_deployDelay.Touch(); + + if (m_roomInfo.GetHidden()) + m_roomInfo.SetHidden(false); + } + else + RetractInfoBox(); + + WheelBase::Move(n); +} + +unsigned int RoomWheel::GetNumItems() const +{ + return m_WheelBaseItemsData.size() - m_offset; +} + +void RoomWheel::RemoveItem( int index ) +{ + WheelBase::RemoveItem(index + m_offset); +} + +void RoomWheel::DeployInfoBox() +{ + if (m_RoomInfoState == CLOSED) + { + SET_XY_AND_ON_COMMAND( m_roomInfo ); + m_RoomInfoState = OPEN; + } +} + +void RoomWheel::RetractInfoBox() +{ + if (m_RoomInfoState == OPEN) + OFF_COMMAND( m_roomInfo ); + + m_RoomInfoState = LOCKED; +} + /* * (c) 2004 Josh Allen * All rights reserved. diff --git a/stepmania/src/RoomWheel.h b/stepmania/src/RoomWheel.h index 093215f8e0..72d0cb4147 100644 --- a/stepmania/src/RoomWheel.h +++ b/stepmania/src/RoomWheel.h @@ -3,6 +3,7 @@ #ifndef ROOMWHEEL_H #define ROOMWHEEL_H +#include "Quad.h" #include "WheelBase.h" #include "WheelItemBase.h" #include "ThemeMetric.h" @@ -36,14 +37,35 @@ private: class RoomWheel : public WheelBase { public: virtual void Load( CString sType ); - inline RoomWheelData* GetItem(unsigned int i) { return (RoomWheelData*)WheelBase::GetItem(i + m_offset); } virtual void BuildWheelItemsData( vector &arrayWheelItemDatas ); - virtual inline unsigned int GetNumItems() { return m_WheelBaseItemsData.size() - m_offset; } - virtual void RemoveItem( int index ) { WheelBase::RemoveItem(index + m_offset); } - void AddPerminateItem(RoomWheelData* itemdata); + virtual unsigned int GetNumItems() const; + virtual void RemoveItem( int index ); virtual bool Select(); + virtual void Update( float fDeltaTime ); + virtual void Move(int n); + + inline RoomWheelData* GetItem(unsigned int i) { return (RoomWheelData*)WheelBase::GetItem(i + m_offset); } + void AddPerminateItem(RoomWheelData* itemdata); + int GetCurrentIndex() const { return m_iSelection; } private: int m_offset; + + enum RoomInfoState + { + OPEN = 0, + CLOSED, + LOCKED + }; + + Quad m_roomInfo; + + RageTimer m_deployDelay; +// RageTimer m_retractDelay; + + RoomInfoState m_RoomInfoState; + + void DeployInfoBox(); + void RetractInfoBox(); }; #endif diff --git a/stepmania/src/ScreenNetRoom.cpp b/stepmania/src/ScreenNetRoom.cpp index d081833c08..8fab115fc1 100644 --- a/stepmania/src/ScreenNetRoom.cpp +++ b/stepmania/src/ScreenNetRoom.cpp @@ -22,8 +22,6 @@ #define ROOMSPACEY THEME->GetMetricF(m_sName,"RoomsSpacingY") #define ROOMLOWERBOUND THEME->GetMetricF(m_sName,"RoomsLowerBound") #define ROOMUPPERBOUND THEME->GetMetricF(m_sName,"RoomsUpperBound") -#define INFOBOXWIDTH THEME->GetMetricF(m_sName,"InfoBoxWidth") -#define INFOBOXHEIGHT THEME->GetMetricF(m_sName,"InfoBoxHeight") AutoScreenMessage( SM_SMOnlinePack ) AutoScreenMessage( SM_BackFromRoomName ) @@ -33,7 +31,6 @@ REGISTER_SCREEN_CLASS( ScreenNetRoom ); ScreenNetRoom::ScreenNetRoom( const CString& sName ) : ScreenNetSelectBase( sName ) { GAMESTATE->FinishStage(); - m_RoomInfoState = LOCKED; } void ScreenNetRoom::Init() @@ -67,35 +64,13 @@ void ScreenNetRoom::Init() this->MoveToHead( &m_RoomWheel ); ON_COMMAND( m_RoomWheel ); - m_roomInfo.SetName("InfoBox"); - m_roomInfo.SetWidth( INFOBOXWIDTH ); - m_roomInfo.SetHeight( INFOBOXHEIGHT ); - SET_XY( m_roomInfo ); - m_roomInfo.SetHidden( true ); - OFF_COMMAND( m_roomInfo ); - this->AddChild(&m_roomInfo); - m_roomInfo.SetDrawOrder(1); - NSMAN->ReportNSSOnOff(7); } void ScreenNetRoom::Input( const InputEventPlus &input ) { if (((input.MenuI.button == MENU_BUTTON_LEFT) || (input.MenuI.button == MENU_BUTTON_RIGHT)) && (input.type == IET_RELEASE)) - { m_RoomWheel.Move(0); - m_deployDelay.Touch(); - m_RoomInfoState = CLOSED; - } - - if (((input.MenuI.button == MENU_BUTTON_LEFT) || (input.MenuI.button == MENU_BUTTON_RIGHT)) && (input.type != IET_RELEASE)) - { - if (m_roomInfo.GetHidden()) - m_roomInfo.SetHidden(false); - - RetractInfoBox(); - m_RoomInfoState = LOCKED; //Force a lock so the info box does not deploy from a quick pause in scrolling - } ScreenNetSelectBase::Input( input ); } @@ -180,16 +155,12 @@ void ScreenNetRoom::TweenOffScreen() NSMAN->ReportNSSOnOff(6); } +/* void ScreenNetRoom::Update( float fDeltaTime ) { ScreenNetSelectBase::Update( fDeltaTime ); - - if (m_deployDelay.PeekDeltaTime() >= 1.5) - DeployInfoBox(); - - if (m_retractDelay.PeekDeltaTime() >= 5) - RetractInfoBox(); } +*/ void ScreenNetRoom::MenuStart( PlayerNumber pn ) { @@ -301,25 +272,6 @@ void ScreenNetRoom::CreateNewRoom( const CString& rName, const CString& rDesc ) NSMAN->SendSMOnline( ); } -void ScreenNetRoom::DeployInfoBox() -{ - if (m_RoomInfoState == CLOSED) - { - SET_XY_AND_ON_COMMAND( m_roomInfo ); - m_retractDelay.Touch(); - m_RoomInfoState = OPEN; - } -} - -void ScreenNetRoom::RetractInfoBox() -{ - if (m_RoomInfoState == OPEN) - { - OFF_COMMAND( m_roomInfo ); - m_RoomInfoState = LOCKED; - } -} - #endif /* diff --git a/stepmania/src/ScreenNetRoom.h b/stepmania/src/ScreenNetRoom.h index 6bb998f5a1..d27270708e 100644 --- a/stepmania/src/ScreenNetRoom.h +++ b/stepmania/src/ScreenNetRoom.h @@ -8,13 +8,6 @@ #include #include "RoomWheel.h" -enum RoomInfoState -{ - OPEN = 0, - CLOSED, - LOCKED -}; - class RoomData { public: void SetName( const CString& name ) { m_name = name; } @@ -44,16 +37,13 @@ protected: virtual void MenuBack( PlayerNumber pn ); virtual void TweenOffScreen( ); - virtual void Update( float fDeltaTime ); +// virtual void Update( float fDeltaTime ); private: void UpdateRoomsList(); void MenuLeft( const InputEventPlus &input ); void MenuRight( const InputEventPlus &input ); void CreateNewRoom( const CString& rName, const CString& rDesc ); - - void DeployInfoBox(); - void RetractInfoBox(); RageSound m_soundChangeSel; @@ -67,13 +57,6 @@ private: CString m_newRoomName, m_newRoomDesc; RoomWheel m_RoomWheel; - - Quad m_roomInfo; - - RageTimer m_deployDelay; - RageTimer m_retractDelay; - - RoomInfoState m_RoomInfoState; }; #endif