From c71d8f8c9c65e0c63d5af527514d9e6382c8e11c Mon Sep 17 00:00:00 2001 From: Andrew Livy Date: Thu, 1 May 2003 23:40:12 +0000 Subject: [PATCH] Total Re-write of ScreenSelectMode, now working under the ScreenSelect class, but still a lot of work to do. --- stepmania/TODO.andy | 59 ++-- stepmania/src/Screen.cpp | 4 +- stepmania/src/ScreenEz2SelectMusic.h | 2 +- stepmania/src/ScreenSelect.cpp | 11 +- stepmania/src/ScreenSelectMode.cpp | 411 +++++---------------------- stepmania/src/ScreenSelectMode.h | 58 ++-- stepmania/src/ScreenSelectStyle.cpp | 1 - stepmania/src/StepMania.RC | 63 ++++ stepmania/src/resource.h | 4 +- 9 files changed, 208 insertions(+), 405 deletions(-) diff --git a/stepmania/TODO.andy b/stepmania/TODO.andy index e17f0ddf5d..67dffaefc1 100644 --- a/stepmania/TODO.andy +++ b/stepmania/TODO.andy @@ -3,29 +3,22 @@ X denotes task complete or no longer required to do. - denotes task to do, but also being worked upon by other dev. H denotes task on hold. -TODO As of: 12:26 03/02/28 -* Mathematics Assignment -* Integrating Assignment 3 +TODO As of: 17:11 03/04/22 +* Pass Exams +* Finish the BGA editor + TODO As of: 16:57 03/02/08 X Object Oriented Design 2 Assignment X Operating Systems 2 Assignment -* Systems Programming 2 Assignment +X Systems Programming 2 Assignment * Para-Style EndScreens * Para-Style Scoreboard * Ez2-Style Scoreboard -H Pump Battle Mode +- Pump Battle Mode H Pump Random Speed H Pump Random Vanish -TODO As of: 06:36:PM 10/12/02 -X Optimize The Music Banner Wheel - -TODO As of: 04:46:PM 27/11/02 -X Systems Programming Assignment -X Integrating Assignment 2 -X Add Scoreboard Initials Entry Frontend - TODO As of: 01:30:PM 13/11/02 * Work on 3DDX Support X Software Engineering Assignment @@ -41,14 +34,6 @@ H Update Menu Graphics for Ez2 * Finish The PUMP Graphics - Work on Beatmania Support -TODO As of: 07:47:PM 12/09/02 - -X Get internet connection back (evil BT!! Changed their TOS and didn't tell me!) -X Put the graphics artists work onto the project -X Add credits for the ez2 graphics team :) -X Add PARA Gametype -X Add Ez2dancer Style Select Background Animation - TODO As of: 11:42:PM 05/09/02 X Fix the Bug on ScreenStage that reports the current stage number for final stage as being 00 in Ez2 @@ -70,4 +55,34 @@ H Create Ez2dancer HowToPlay screens. X Modify Pump Style Select So it is more arcade accurate. - Update the rather tacky graphics. -* Keep my sanity. \ No newline at end of file +* Keep my sanity. + + + + +----------------------------------------------------------------------------- +Completed Modules Of Work + + +TODO As of: 07:47:PM 12/09/02 + +X Get internet connection back (evil BT!! Changed their TOS and didn't tell me!) +X Put the graphics artists work onto the project +X Add credits for the ez2 graphics team :) +X Add PARA Gametype +X Add Ez2dancer Style Select Background Animation + + +TODO As of: 06:36:PM 10/12/02 + +X Optimize The Music Banner Wheel + +X TODO As of: 04:46:PM 27/11/02 +X Systems Programming Assignment +X Integrating Assignment 2 +X Add Scoreboard Initials Entry Frontend + + +TODO As of: 12:26 03/02/28 +X Mathematics Assignment +X Integrating Assignment 3 \ No newline at end of file diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index 86561520e2..542f1d9df6 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -252,7 +252,6 @@ void Screen::ClearMessageQueue( const ScreenMessage SM ) #include "ScreenEditMenu.h" #include "ScreenEvaluation.h" #include "ScreenEz2SelectPlayer.h" -#include "ScreenSelectMode.h" #include "ScreenGameOver.h" #include "ScreenGameplay.h" #include "ScreenGraphicOptions.h" @@ -299,6 +298,7 @@ void Screen::ClearMessageQueue( const ScreenMessage SM ) #include "ScreenCredits.h" #include "ScreenSelectCharacter.h" #include "ScreenRaveOptions.h" +#include "ScreenSelectMode.h" Screen* Screen::Create( CString sClassName ) { @@ -316,7 +316,6 @@ Screen* Screen::Create( CString sClassName ) IF_RETURN( ScreenEvaluationBattle ); IF_RETURN( ScreenEvaluationRave ); IF_RETURN( ScreenEz2SelectPlayer ); - IF_RETURN( ScreenSelectMode ); IF_RETURN( ScreenGameOver ); IF_RETURN( ScreenGameplay ); IF_RETURN( ScreenGraphicOptions ); @@ -336,6 +335,7 @@ Screen* Screen::Create( CString sClassName ) IF_RETURN( ScreenSelectMusic ); IF_RETURN( ScreenSelectStyle5th ); IF_RETURN( ScreenSelectStyle ); + IF_RETURN( ScreenSelectMode ); IF_RETURN( ScreenSongOptions ); IF_RETURN( ScreenStage ); IF_RETURN( ScreenTest ); diff --git a/stepmania/src/ScreenEz2SelectMusic.h b/stepmania/src/ScreenEz2SelectMusic.h index 136e1865b0..0d9503c5f7 100644 --- a/stepmania/src/ScreenEz2SelectMusic.h +++ b/stepmania/src/ScreenEz2SelectMusic.h @@ -76,7 +76,7 @@ protected: bool m_bGoToOptions; bool m_bMadeChoice; bool m_bTransitioning; - + int i_ErrorDetected; #ifdef DEBUG diff --git a/stepmania/src/ScreenSelect.cpp b/stepmania/src/ScreenSelect.cpp index 9b07c5808e..8658f2bce8 100644 --- a/stepmania/src/ScreenSelect.cpp +++ b/stepmania/src/ScreenSelect.cpp @@ -179,7 +179,16 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type, * are other screens you can join (eg ScreenCaution). -glenn */ /* Joint premium on a DDR machine does allow two player modes with a single - * credit. -Chris */ + * credit. -Chris + */ + + /* Indeed, I can see three different premium settings here: + AnyPlayersTwoCoins (2 coins for doubles and 2 coins for versus) + OnePlayerOneCoin (1 coin for doubles, but 2 coins for versus (like pump and ez2)) + TwoPlayerOneCoin (1 coin for doubles / versus play) + perhaps we should change the joint premium system to work this way? + That way we can support all gametypes. + */ if( PREFSMAN->m_iCoinMode == COIN_PAY ) { diff --git a/stepmania/src/ScreenSelectMode.cpp b/stepmania/src/ScreenSelectMode.cpp index 4ddf85cda9..62530accf3 100644 --- a/stepmania/src/ScreenSelectMode.cpp +++ b/stepmania/src/ScreenSelectMode.cpp @@ -26,120 +26,53 @@ Chris Danford /* Constants */ - - -#define JOIN_FRAME_X( p ) THEME->GetMetricF("ScreenSelectMode",ssprintf("JoinFrameP%dX",p+1)) -#define JOIN_FRAME_Y( i ) THEME->GetMetricF("ScreenSelectMode",ssprintf("JoinFrameP%dY",i+1)) -#define JOIN_MESSAGE_X( p ) THEME->GetMetricF("ScreenSelectMode",ssprintf("JoinMessageP%dX",p+1)) -#define JOIN_MESSAGE_Y( i ) THEME->GetMetricF("ScreenSelectMode",ssprintf("JoinMessageP%dY",i+1)) -#define GUIDE_X THEME->GetMetricF("ScreenSelectMode","GuideX") -#define GUIDE_Y THEME->GetMetricF("ScreenSelectMode","GuideY") -#define HELP_TEXT THEME->GetMetric("ScreenSelectMode","HelpText") -#define TIMER_SECONDS THEME->GetMetricI("ScreenSelectMode","TimerSeconds") -#define NEXT_SCREEN THEME->GetMetric("ScreenSelectMode","NextScreen") -#define SCROLLING_ELEMENT_SPACING THEME->GetMetricI("ScreenSelectMode","ScrollingElementSpacing") -#define SCROLLING_LIST_X THEME->GetMetricF("ScreenSelectMode","ScrollingListX") -#define SCROLLING_LIST_Y THEME->GetMetricF("ScreenSelectMode","ScrollingListY") -#define SELECTION_SPECIFIC_BG_ANIMATIONS THEME->GetMetricB("ScreenSelectMode","SelectionSpecificBGAnimations") -#define BOUNCE_JOIN_MESSAGE THEME->GetMetricB("ScreenSelectMode","BounceJoinMessage") -#define FOLD_ON_JOIN THEME->GetMetricB("ScreenSelectMode","FoldOnJoin") - -const float TWEEN_TIME = 0.35f; - +#define ELEM_SPACING THEME->GetMetricI("ScreenSelectMode","ElementSpacing") +#define INCLUDE_DOUBLE_IN_JP THEME->GetMetricI("ScreenSelectMode","IncludeDoubleInJointPremium") +#define SCROLLING_LIST_X THEME->GetMetricI("ScreenSelectMode","ScrollingListX") +#define SCROLLING_LIST_Y THEME->GetMetricI("ScreenSelectMode","ScrollingListY") +#define GUIDE_X THEME->GetMetricF("ScreenSelectMode", "GuideX") +#define GUIDE_Y THEME->GetMetricF("ScreenSelectMode", "GuideY") /************************************ ScreenSelectMode (Constructor) Desc: Sets up the screen display ************************************/ -ScreenSelectMode::ScreenSelectMode() : Screen("ScreenSelectMode") +ScreenSelectMode::ScreenSelectMode() : ScreenSelect( "ScreenSelectMode" ) { - LOG->Trace( "ScreenSelectMode::ScreenSelectMode()" ); - GAMESTATE->m_bPlayersCanJoin = true; - SCREENMAN->RefreshCreditsMessages(); - - - GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE; // the only mode you can select on this screen - - - /*********** TODO: MAKE THIS WORK FOR ALL GAME STYLES! *************/ m_ChoiceListFrame.Load( THEME->GetPathToG("ScreenSelectMode list frame")); m_ChoiceListFrame.SetXY( SCROLLING_LIST_X, SCROLLING_LIST_Y); this->AddChild( &m_ChoiceListFrame ); - m_ScrollingList.SetXY( CENTER_X, SCROLLING_LIST_Y ); - m_ScrollingList.SetSpacing( SCROLLING_ELEMENT_SPACING ); - m_ScrollingList.SetNumberVisible( 9 ); + m_soundModeChange.Load( THEME->GetPathToS("ScreenSelectMode modechange")); + unsigned i; + for( i=0; iGetPathToG(sElementName); + + arrayLocations.push_back( sElementPath ); + } + + // m_ScrollingList.UseSpriteType(BANNERTYPE); + m_ScrollingList.SetXY( SCROLLING_LIST_X, SCROLLING_LIST_Y ); + m_ScrollingList.SetSpacing( ELEM_SPACING ); this->AddChild( &m_ScrollingList ); m_ChoiceListHighlight.Load( THEME->GetPathToG("ScreenSelectMode list highlight")); - m_ChoiceListHighlight.SetXY( CENTER_X, SCROLLING_LIST_Y); - this->AddChild( &m_ChoiceListHighlight ); + m_ChoiceListHighlight.SetXY( SCROLLING_LIST_X, SCROLLING_LIST_Y ); + this->AddChild(&m_ChoiceListHighlight); m_Guide.Load( THEME->GetPathToG("select mode guide")); m_Guide.SetXY( GUIDE_X, GUIDE_Y ); this->AddChild( &m_Guide ); - for( int p=0; pGetPathToG("ScreenSelectMode join frame 1x2") ); - m_sprJoinFrame[p].StopAnimating(); - m_sprJoinFrame[p].SetState( p ); - m_sprJoinFrame[p].SetXY( JOIN_FRAME_X(p), JOIN_FRAME_Y(p) ); - this->AddChild( &m_sprJoinFrame[p] ); - - if( GAMESTATE->m_bSideIsJoined[p] ) - m_sprJoinFrame[p].SetZoomY( 0 ); - - m_sprJoinMessage[p].Load( THEME->GetPathToG("ScreenSelectMode join message 2x2") ); - m_sprJoinMessage[p].StopAnimating(); - m_sprJoinMessage[p].SetState( p ); - m_sprJoinMessage[p].SetXY( JOIN_MESSAGE_X(p), JOIN_MESSAGE_Y(p) ); - if( BOUNCE_JOIN_MESSAGE ) - m_sprJoinMessage[p].SetEffectBounce( 0.5f, RageVector3(0,10,0) ); - this->AddChild( &m_sprJoinMessage[p] ); - - if( GAMESTATE->m_bSideIsJoined[p] ) - { - m_sprJoinMessage[p].SetState( p+NUM_PLAYERS ); - - if( FOLD_ON_JOIN ) - { - m_sprJoinMessage[p].SetZoomY( 0 ); - m_sprJoinFrame[p].SetZoomY( 0 ); - } - } - } - - - m_Menu.Load( "ScreenSelectMode" ); - this->AddChild( &m_Menu ); - - m_soundSelect.Load( THEME->GetPathToS("Common start") ); - m_soundChange.Load( THEME->GetPathToS("ScreenSelectMode change"), true ); - - SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select mode intro") ); - - SOUNDMAN->PlayMusic( THEME->GetPathToS("ScreenSelectMode music") ); - - RefreshModeChoices(); - - if( SELECTION_SPECIFIC_BG_ANIMATIONS ) - { - CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; - - for( unsigned i=0; iname; - m_Infotext[i].Load( THEME->GetPathToG(ssprintf("ScreenSelectMode infotext %s %s", sGameName.c_str(), sChoiceName.c_str())) ); - m_Infotext[i].SetXY( GUIDE_X, GUIDE_Y ); - this->AddChild( &m_Infotext[i] ); - m_Infotext[i].SetDiffuse( RageColor(0,0,0,0)); - } - } - AfterChange(); - - TweenOnScreen(); + UpdateSelectableChoices(); } /************************************ @@ -152,267 +85,71 @@ ScreenSelectMode::~ScreenSelectMode() LOG->Trace( "ScreenSelectMode::~ScreenSelectMode()" ); } -/************************************ -Update -Desc: Animates the 1p/2p selection -************************************/ -void ScreenSelectMode::Update( float fDeltaTime ) -{ - m_BGAnimations[ m_ScrollingList.GetSelection() ].Update( fDeltaTime ); - Screen::Update( fDeltaTime ); -} - -/************************************ -DrawPrimitives -Desc: Draws the screen =P -************************************/ - -void ScreenSelectMode::DrawPrimitives() -{ - m_Menu.DrawBottomLayer(); - m_BGAnimations[ m_ScrollingList.GetSelection() ].Draw(); - Screen::DrawPrimitives(); - m_Menu.DrawTopLayer(); -} - -/************************************ -Input -Desc: Handles player input. -************************************/ -void ScreenSelectMode::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) -{ - LOG->Trace( "ScreenSelectMode::Input()" ); - - if( m_Menu.IsTransitioning() ) - return; - - Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler -} - -/************************************ -HandleScreenMessage -Desc: Handles Screen Messages and changes - game states. -************************************/ -void ScreenSelectMode::HandleScreenMessage( const ScreenMessage SM ) -{ - Screen::HandleScreenMessage( SM ); - - switch( SM ) - { - case SM_MenuTimer: - MenuStart( PLAYER_INVALID ); - TweenOffScreen(); - m_Menu.StartTransitioning( SM_GoToNextScreen ); - break; - case SM_GoToPrevScreen: - SOUNDMAN->StopMusic(); - SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); - break; - case SM_GoToNextScreen: - // Put the mode choice into effect - int iSelection = m_ScrollingList.GetSelection(); - const ModeChoice* pChoice = m_apPossibleModeChoices[ iSelection ]; - GAMESTATE->m_CurStyle = pChoice->style; - GAMESTATE->m_PlayMode = pChoice->pm; - for( int p=0; pm_PreferredDifficulty[p] = pChoice->dc; - - switch( GAMESTATE->m_PlayMode ) - { - case PLAY_MODE_ARCADE: - SCREENMAN->SetNewScreen( NEXT_SCREEN ); - break; - case PLAY_MODE_NONSTOP: - case PLAY_MODE_ONI: - case PLAY_MODE_ENDLESS: - SCREENMAN->SetNewScreen( "ScreenSelectCourse" ); - break; - default: - ASSERT(0); - } - break; - } -} - -void ScreenSelectMode::RefreshModeChoices() -{ - int iNumSidesJoined = GAMESTATE->GetNumSidesJoined(); - -// GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_apPossibleModeChoices ); // FIXME - ASSERT( !m_apPossibleModeChoices.empty() ); - - int i; - - // remove ModeChoices that won't work with the current number of players - for( i=m_apPossibleModeChoices.size()-1; i>=0; i-- ) - if( m_apPossibleModeChoices[i]->numSidesJoinedToPlay != iNumSidesJoined ) - m_apPossibleModeChoices.erase( m_apPossibleModeChoices.begin()+i, - m_apPossibleModeChoices.begin()+i+1 ); - - CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; - - CStringArray asGraphicPaths; - for( unsigned j=0; jGetPathToG( ssprintf("select mode choice %s %s", sGameName.c_str(), pChoice->name) ) ); - } - - m_ScrollingList.Load( asGraphicPaths ); - - - if( SELECTION_SPECIFIC_BG_ANIMATIONS ) - { - CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; - - for( unsigned i=0; iname; - m_BGAnimations[i].LoadFromAniDir( THEME->GetPathToB(ssprintf("select mode %s %s", sGameName.c_str(), sChoiceName.c_str())) ); - } - } -} - - -/************************************ -MenuBack -Desc: Actions performed when a player -presses the button bound to back -************************************/ -void ScreenSelectMode::MenuBack( PlayerNumber pn ) -{ - SOUNDMAN->StopMusic(); - - m_Menu.Back( SM_GoToPrevScreen ); -} - -void ScreenSelectMode::AfterChange() -{ - if( SELECTION_SPECIFIC_BG_ANIMATIONS ) - { - for( unsigned i=0; iGetCurrentGameDef()->m_szName; -// const ModeChoice& choice = m_aPossibleModeChoices[ m_ScrollingList.GetSelection() ]; -} - void ScreenSelectMode::MenuLeft( PlayerNumber pn ) { m_ScrollingList.Left(); - m_soundChange.Play(); - AfterChange(); + m_soundModeChange.Play(); } void ScreenSelectMode::MenuRight( PlayerNumber pn ) { m_ScrollingList.Right(); - m_soundChange.Play(); - AfterChange(); + m_soundModeChange.Play(); } -/************************************ -MenuDown -Desc: Actions performed when a player -presses the button bound to down -************************************/ -void ScreenSelectMode::MenuDown( PlayerNumber pn ) +void ScreenSelectMode::UpdateSelectableChoices() { - if( GAMESTATE->m_bSideIsJoined[pn] ) // already joined - return; // ignore + CStringArray GraphicPaths; + m_iNumChoices = 0; + unsigned i=0; + unsigned j=0; + for( i=0; im_bJointPremium && INCLUDE_DOUBLE_IN_JP == 1 && ((GAMESTATE->GetNumSidesJoined() == 1 && mc.numSidesJoinedToPlay == 1) || (GAMESTATE->GetNumSidesJoined() == 2 && mc.numSidesJoinedToPlay == 2))) || + (PREFSMAN->m_bJointPremium && INCLUDE_DOUBLE_IN_JP == 0 && + ((modename.substr(0, 6) == "DOUBLE" && GAMESTATE->GetNumSidesJoined() != 2 ) || GAMESTATE->GetNumSidesJoined() == 1 && mc.numSidesJoinedToPlay == 1) || + (modename.substr(0, 6) != "DOUBLE" && GAMESTATE->GetNumSidesJoined() == 2 && mc.numSidesJoinedToPlay == 2)) || + (!PREFSMAN->m_bJointPremium) + ) + { + m_iNumChoices++; + if(j<=MAX_ELEMS) + { + m_iSelectableChoices[j] = i; + j++; + } + else + { + ASSERT(0); // too many choices, can't track them all. Quick Fix: If You Get This Just Increase MAX_ELEMS + } + GraphicPaths.push_back(arrayLocations[i]); + } + } + m_ScrollingList.Unload(); + m_ScrollingList.Load(GraphicPaths); } -/************************************ -MenuStart -Desc: Actions performed when a player -presses the button bound to start -************************************/ + void ScreenSelectMode::MenuStart( PlayerNumber pn ) { - if( pn == PLAYER_INVALID ) - pn = GAMESTATE->m_MasterPlayerNumber; - - if( !GAMESTATE->m_bSideIsJoined[pn] ) - { - // join them - GAMESTATE->m_bSideIsJoined[pn] = true; - SCREENMAN->RefreshCreditsMessages(); - m_soundSelect.Play(); - - m_sprJoinMessage[pn].SetState( pn + NUM_PLAYERS ); - - if( FOLD_ON_JOIN ) - { - m_sprJoinMessage[pn].BeginTweening( 0.25f ); - m_sprJoinMessage[pn].SetZoomY( 0 ); - m_sprJoinFrame[pn].BeginTweening( 0.25f ); - m_sprJoinFrame[pn].SetZoomY( 0 ); - } - - RefreshModeChoices(); - - m_ScrollingList.SetSelection( 0 ); - } - else - { - // made a selection - m_soundSelect.Play(); - - TweenOffScreen(); - m_Menu.StartTransitioning( SM_GoToNextScreen ); - GAMESTATE->m_bPlayersCanJoin = false; - SCREENMAN->RefreshCreditsMessages(); - } + SCREENMAN->PostMessageToTopScreen( SM_AllDoneChoosing, 0 ); } -void ScreenSelectMode::TweenOnScreen() +int ScreenSelectMode::GetSelectionIndex( PlayerNumber pn ) { - float fOriginalZoomY = m_ScrollingList.GetZoomY(); - m_ScrollingList.BeginTweening( 0.5f ); - m_ScrollingList.SetZoomY( fOriginalZoomY ); - - for( int p=0; p m_apPossibleModeChoices; - + virtual int GetSelectionIndex( PlayerNumber pn ); + virtual void UpdateSelectableChoices(); + int m_iNumChoices; + int m_iSelectableChoices[MAX_ELEMS]; + RageSound m_soundModeChange; + CStringArray arrayLocations; ScrollingList m_ScrollingList; - void RefreshModeChoices(); - - BGAnimation m_BGAnimations[MAX_MODE_CHOICES2]; - MenuElements m_Menu; - - RageSound m_soundSelect; - RageSound m_soundChange; + Sprite m_ChoiceListFrame; + Sprite m_ChoiceListHighlight; + Sprite m_sprJoinMessage[NUM_PLAYERS]; + Sprite m_sprJoinFrame[NUM_PLAYERS]; + Sprite m_Guide; }; diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index bd09a36243..b19f6d3364 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -29,7 +29,6 @@ ScreenSelectStyle::ScreenSelectStyle() : ScreenSelect( "ScreenSelectStyle" ) { m_iSelection = 0; - unsigned i; for( i=0; i