From 21ab45ec969162220f9871b5d6ef3f78f2f8948b Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 10 Jan 2003 02:22:07 +0000 Subject: [PATCH] fixed broken screen gameplay, started adding coin-op logic --- stepmania/NEWS | 2 + stepmania/Themes/default/metrics.ini | 28 +-- stepmania/src/Actor.cpp | 18 ++ stepmania/src/Actor.h | 14 +- stepmania/src/GameInput.h | 6 + stepmania/src/GameManager.cpp | 36 ++++ stepmania/src/MenuInput.h | 1 + stepmania/src/Screen.cpp | 8 - stepmania/src/Screen.h | 3 - stepmania/src/ScreenAttract.cpp | 110 +++++------ stepmania/src/ScreenAttract.h | 10 +- stepmania/src/ScreenDemonstration.cpp | 196 +++++++++++++++++++ stepmania/src/ScreenDemonstration.h | 19 +- stepmania/src/ScreenGameplay.cpp | 263 ++++++++++---------------- stepmania/src/ScreenGameplay.h | 14 +- stepmania/src/ScreenInstructions.cpp | 14 +- stepmania/src/ScreenManager.cpp | 10 +- stepmania/src/ScreenManager.h | 2 +- stepmania/src/ScreenPrompt.cpp | 13 ++ stepmania/src/ScreenSelectGame.cpp | 5 +- stepmania/src/ScreenSelectStyle.cpp | 2 +- stepmania/src/ScreenTitleMenu.cpp | 118 +----------- stepmania/src/ScreenTitleMenu.h | 1 - stepmania/src/SongManager.cpp | 34 +--- stepmania/src/SongManager.h | 4 +- stepmania/src/StepMania.cpp | 40 +++- stepmania/src/StepMania.dsp | 4 +- stepmania/src/StepMania.h | 2 + stepmania/src/StepMania.vcproj | 6 + stepmania/src/ThemeManager.cpp | 2 +- stepmania/stepmania.nsi | 4 +- 31 files changed, 549 insertions(+), 440 deletions(-) diff --git a/stepmania/NEWS b/stepmania/NEWS index 4d6b80dbdc..48b842dabb 100644 --- a/stepmania/NEWS +++ b/stepmania/NEWS @@ -1,4 +1,6 @@ ----------------------- Version 3.01 --------------------------- +NEW FEATURE: New High Score screen +NEW FEATURE: Full "attract" sequence NEW FEATURE: .SM files can now contain UTF-8 text. NEW FEATURE: New alignment tags for bitmap fonts. NEW FEATURE: Bitmap fonts now support full Unicode mapping. diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index a42b9e2f0c..cc44d70c82 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -2,7 +2,7 @@ // - ScreenCaution // - ScreenEz2SelectPlayer // - ScreenSelectMode -// - ScreenHowToPlay +// - ScreenInstructions // - ScreenSelectCourse // - ScreenSelectDifficulty // - ScreenSelectGroup @@ -133,7 +133,7 @@ CursorShadowLengthY=10 HelpText=Use &LEFT; &RIGHT; to select, then press START TimerSeconds=40 NextScreenArcade=ScreenSelectGroup -NextScreenOni=ScreenHowToPlay +NextScreenOni=ScreenInstructions [ScreenSelectGroup] FrameX=180 @@ -161,9 +161,9 @@ TitlesRows=10 TitlesZoom=0.5 HelpText=Use &LEFT; &RIGHT; to select, then press START TimerSeconds=40 -NextScreen=ScreenHowToPlay +NextScreen=ScreenInstructions -[ScreenHowToPlay] +[ScreenInstructions] NextScreenArcade=ScreenSelectMusic NextScreenOni=ScreenSelectCourse HelpText=Press START to continue @@ -438,8 +438,8 @@ CreditsP1Y=472 CreditsP2X=540 CreditsP2Y=472 CreditsColor=1,1,1,1 -CreditsShadowLength=2 -CreditsZoom=0.5 +CreditsShadowLength=0 +CreditsZoom=1.0 [WheelItemDisplay] IconX=-136 @@ -722,19 +722,19 @@ SecondsToShow=10 NextScreen=ScreenHighScores [ScreenHighScores] -SecondsToShow=10 +SecondsToShow=30 NextScreen=ScreenMemoryCard [ScreenMemoryCard] -SecondsToShow=10 +SecondsToShow=5 NextScreen=ScreenWarning [ScreenWarning] -SecondsToShow=10 +SecondsToShow=5 NextScreen=ScreenCompany [ScreenCompany] -SecondsToShow=10 +SecondsToShow=5 NextScreen=ScreenAlbums [ScreenAlbums] @@ -742,9 +742,13 @@ SecondsToShow=10 NextScreen=ScreenLogo [ScreenLogo] -SecondsToShow=20 +SecondsToShow=5 NextScreen=ScreenDemonstration [ScreenDemonstration] SecondsToShow=30 -NextScreen=ScreenUnlock \ No newline at end of file +NextScreen=ScreenHowToPlay + +[ScreenHowToPlay] +SecondsToShow=30 +NextScreen=ScreenUnlock diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index ae5857c329..8c5a006ac3 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -20,6 +20,8 @@ Actor::Actor() { + m_bFirstUpdate = true; + m_iNumTweenStates = 0; m_size = RageVector2( 1, 1 ); @@ -198,10 +200,26 @@ void Actor::UpdateTweening( float fDeltaTime ) } } +bool Actor::IsFirstUpdate() +{ + return m_bFirstUpdate; +} + +void Actor::FirstUpdate() +{ + +} + void Actor::Update( float fDeltaTime ) { // LOG->Trace( "Actor::Update( %f )", fDeltaTime ); + if( m_bFirstUpdate ) + { + this->FirstUpdate(); + m_bFirstUpdate = false; + } + // update effect switch( m_Effect ) { diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index bae2eefbf6..ab6aa14cea 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -49,6 +49,8 @@ public: virtual void BeginDraw(); // pushes transform onto world matrix stack virtual void DrawPrimitives() = 0; // override with Actor specific action virtual void EndDraw(); // pops transform from world matrix stack + bool IsFirstUpdate(); + virtual void FirstUpdate(); // called after object is constructed, but before the first call to Update() virtual void Update( float fDeltaTime ); virtual void UpdateTweening( float fDeltaTime ); @@ -188,19 +190,11 @@ public: protected: -/* - RageVector2 m_size; // width, height - RageVector3 m_pos; // X-Y coordinate of where the center point will appear on screen - RageVector3 m_rotation; // X, Y, and Z m_rotation - RageVector2 m_scale; // X and Y zooming - RageColor m_colorDiffuse[4]; // 4 corner colors - left to right, top to bottom - RageColor m_colorGlow; -*/ + bool m_bFirstUpdate; + // // Stuff for tweening // - - struct TweenState { // start and end position for tweening diff --git a/stepmania/src/GameInput.h b/stepmania/src/GameInput.h index f328e13c84..06e29f8cbe 100644 --- a/stepmania/src/GameInput.h +++ b/stepmania/src/GameInput.h @@ -34,6 +34,7 @@ enum // DanceButtons DANCE_BUTTON_MENURIGHT, DANCE_BUTTON_MENUUP, DANCE_BUTTON_MENUDOWN, + DANCE_BUTTON_INSERTCOIN, NUM_DANCE_BUTTONS, // leave this at the end }; @@ -50,6 +51,7 @@ enum // PumpButtons PUMP_BUTTON_MENURIGHT, PUMP_BUTTON_MENUUP, PUMP_BUTTON_MENUDOWN, + PUMP_BUTTON_INSERTCOIN, NUM_PUMP_BUTTONS, // leave this at the end }; @@ -68,6 +70,7 @@ enum // EZ2Buttons EZ2_BUTTON_MENURIGHT, EZ2_BUTTON_MENUUP, EZ2_BUTTON_MENUDOWN, + EZ2_BUTTON_INSERTCOIN, NUM_EZ2_BUTTONS, // leave this at the end }; @@ -84,6 +87,7 @@ enum // ParaButtons PARA_BUTTON_MENURIGHT, PARA_BUTTON_MENUUP, PARA_BUTTON_MENUDOWN, + PARA_BUTTON_INSERTCOIN, NUM_PARA_BUTTONS, // leave this at the end }; @@ -103,6 +107,7 @@ enum // 3DDX Buttons DS3DDX_BUTTON_MENURIGHT, DS3DDX_BUTTON_MENUUP, DS3DDX_BUTTON_MENUDOWN, + DS3DDX_BUTTON_INSERTCOIN, NUM_DS3DDX_BUTTONS, // leave this at the end. }; @@ -125,6 +130,7 @@ enum // BM Buttons BM_BUTTON_MENURIGHT, BM_BUTTON_MENUUP, BM_BUTTON_MENUDOWN, + BM_BUTTON_INSERTCOIN, NUM_BM_BUTTONS, // leave this at the end. }; diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 42f8c4d122..7cfb5007f8 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -78,6 +78,7 @@ GameDef g_GameDefs[NUM_GAMES] = "MenuRight", "MenuUp", "MenuDown", + "Insert Coin", }, { // m_szSecondaryFunction "(MenuLeft)", @@ -92,6 +93,7 @@ GameDef g_GameDefs[NUM_GAMES] = "(dedicated)", "(dedicated)", "(dedicated)", + "", }, { // m_DedicatedMenuButton DANCE_BUTTON_MENULEFT, // MENU_BUTTON_LEFT @@ -100,6 +102,7 @@ GameDef g_GameDefs[NUM_GAMES] = DANCE_BUTTON_MENUDOWN, // MENU_BUTTON_DOWN DANCE_BUTTON_START, // MENU_BUTTON_START DANCE_BUTTON_BACK, // MENU_BUTTON_BACK + DANCE_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_SecondaryMenuButton DANCE_BUTTON_LEFT, // MENU_BUTTON_LEFT @@ -108,6 +111,7 @@ GameDef g_GameDefs[NUM_GAMES] = DANCE_BUTTON_DOWN, // MENU_BUTTON_DOWN DANCE_BUTTON_START, // MENU_BUTTON_START DANCE_BUTTON_BACK, // MENU_BUTTON_BACK + DANCE_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -123,6 +127,7 @@ GameDef g_GameDefs[NUM_GAMES] = -1, //no default key // DANCE_BUTTON_MENURIGHT SDLK_UP, // DANCE_BUTTON_MENUUP SDLK_DOWN, // DANCE_BUTTON_MENUDOWN + SDLK_F1, // DANCE_BUTTON_INSERTCOIN }, { // PLAYER_2 SDLK_KP4, // DANCE_BUTTON_LEFT, @@ -137,6 +142,7 @@ GameDef g_GameDefs[NUM_GAMES] = -1, //no default key // DANCE_BUTTON_MENURIGHT -1, //no default key // DANCE_BUTTON_MENUUP -1, //no default key // DANCE_BUTTON_MENUDOWN + SDLK_F2, // DANCE_BUTTON_INSERTCOIN }, } }, @@ -157,6 +163,7 @@ GameDef g_GameDefs[NUM_GAMES] = "MenuRight", "MenuUp", "MenuDown", + "Insert Coin", }, { // m_szSecondaryFunction "(MenuUp)", @@ -170,6 +177,7 @@ GameDef g_GameDefs[NUM_GAMES] = "(dedicated)", "(dedicated)", "(dedicated)", + "", }, { // m_DedicatedMenuButton PUMP_BUTTON_MENULEFT, // MENU_BUTTON_LEFT @@ -178,6 +186,7 @@ GameDef g_GameDefs[NUM_GAMES] = PUMP_BUTTON_MENUDOWN, // MENU_BUTTON_DOWN PUMP_BUTTON_START, // MENU_BUTTON_START PUMP_BUTTON_BACK, // MENU_BUTTON_BACK + PUMP_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_SecondaryMenuButton PUMP_BUTTON_DOWNLEFT, // MENU_BUTTON_LEFT @@ -186,6 +195,7 @@ GameDef g_GameDefs[NUM_GAMES] = PUMP_BUTTON_UPRIGHT, // MENU_BUTTON_DOWN PUMP_BUTTON_CENTER, // MENU_BUTTON_START PUMP_BUTTON_BACK, // MENU_BUTTON_BACK + PUMP_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -200,6 +210,7 @@ GameDef g_GameDefs[NUM_GAMES] = SDLK_RIGHT, // PUMP_BUTTON_MENURIGHT SDLK_UP, // PUMP_BUTTON_MENUUP SDLK_DOWN, // PUMP_BUTTON_MENUDOWN + SDLK_F1, // PUMP_BUTTON_INSERTCOIN }, { // PLAYER_2 SDLK_KP7, // PUMP_BUTTON_UPLEFT, @@ -213,6 +224,7 @@ GameDef g_GameDefs[NUM_GAMES] = -1, //no default key // PUMP_BUTTON_MENURIGHT -1, //no default key // PUMP_BUTTON_MENUUP -1, //no default key // PUMP_BUTTON_MENUDOWN + SDLK_F2, // PUMP_BUTTON_INSERTCOIN }, } }, @@ -235,6 +247,7 @@ GameDef g_GameDefs[NUM_GAMES] = "MenuRight", "MenuUp", "MenuDown", + "Insert Coin", }, { // m_szSecondaryFunction "(MenuUp)", @@ -250,6 +263,7 @@ GameDef g_GameDefs[NUM_GAMES] = "(dedicated)", "(dedicated)", "(dedicated)", + "", }, { // m_DedicatedMenuButton EZ2_BUTTON_MENULEFT, // MENU_BUTTON_LEFT @@ -258,6 +272,7 @@ GameDef g_GameDefs[NUM_GAMES] = EZ2_BUTTON_MENUDOWN, // MENU_BUTTON_DOWN EZ2_BUTTON_START, // MENU_BUTTON_START EZ2_BUTTON_BACK, // MENU_BUTTON_BACK + EZ2_BUTTON_INSERTCOIN, // MENU_BUTTON_INSERTCOIN }, { // m_SecondaryMenuButton EZ2_BUTTON_HANDUPLEFT, // MENU_BUTTON_LEFT @@ -266,6 +281,7 @@ GameDef g_GameDefs[NUM_GAMES] = EZ2_BUTTON_FOOTUPRIGHT, // MENU_BUTTON_DOWN EZ2_BUTTON_FOOTDOWN, // MENU_BUTTON_START EZ2_BUTTON_BACK, // MENU_BUTTON_BACK + EZ2_BUTTON_INSERTCOIN, // MENU_BUTTON_INSERTCOIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -282,6 +298,7 @@ GameDef g_GameDefs[NUM_GAMES] = SDLK_RIGHT, // EZ2_BUTTON_MENURIGHT SDLK_UP, // EZ2_BUTTON_MENUUP SDLK_DOWN, // EZ2_BUTTON_MENUDOWN + SDLK_F1, // EZ2_BUTTON_INSERTCOIN }, { // PLAYER_2 -1, // EZ2_BUTTON_FOOTUPLEFT, @@ -297,6 +314,7 @@ GameDef g_GameDefs[NUM_GAMES] = -1, //no default key // EZ2_BUTTON_MENURIGHT -1, //no default key // EZ2_BUTTON_MENUUP -1, //no default key // EZ2_BUTTON_MENUDOWN + SDLK_F2, // EZ2_BUTTON_INSERTCOIN }, }, }, @@ -317,6 +335,7 @@ GameDef g_GameDefs[NUM_GAMES] = "MenuRight", "MenuUp", "MenuDown", + "Insert Coin", }, { // m_szSecondaryFunction "(MenuLeft)", @@ -330,6 +349,7 @@ GameDef g_GameDefs[NUM_GAMES] = "(dedicated)", "(dedicated)", "(dedicated)", + "", }, { // m_DedicatedMenuButton PARA_BUTTON_MENULEFT, // MENU_BUTTON_LEFT @@ -338,6 +358,7 @@ GameDef g_GameDefs[NUM_GAMES] = PARA_BUTTON_MENUDOWN, // MENU_BUTTON_DOWN PARA_BUTTON_START, // MENU_BUTTON_START PARA_BUTTON_BACK, // MENU_BUTTON_BACK + PARA_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_SecondaryMenuButton PARA_BUTTON_LEFT, // MENU_BUTTON_LEFT @@ -346,6 +367,7 @@ GameDef g_GameDefs[NUM_GAMES] = PARA_BUTTON_UPLEFT, // MENU_BUTTON_DOWN PARA_BUTTON_START, // MENU_BUTTON_START PARA_BUTTON_BACK, // MENU_BUTTON_BACK + PARA_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -360,6 +382,7 @@ GameDef g_GameDefs[NUM_GAMES] = SDLK_RIGHT, //no default key // PARA_BUTTON_MENURIGHT SDLK_UP, // PARA_BUTTON_MENUUP SDLK_DOWN, // PARA_BUTTON_MENUDOWN + SDLK_F1, // PARA_BUTTON_INSERTCOIN }, { // PLAYER_2 -1, // PARA_BUTTON_LEFT, @@ -373,6 +396,7 @@ GameDef g_GameDefs[NUM_GAMES] = -1, //no default key // PARA_BUTTON_MENURIGHT -1, // PARA_BUTTON_MENUUP -1, + -1, // PARA_BUTTON_INSERTCOIN }, } }, @@ -396,6 +420,7 @@ GameDef g_GameDefs[NUM_GAMES] = "MenuRight", "MenuUp", "MenuDown", + "Insert Coin", }, { // m_szSecondaryFunction "(MenuLeft)", @@ -412,6 +437,7 @@ GameDef g_GameDefs[NUM_GAMES] = "(dedicated)", "(dedicated)", "(dedicated)", + "", }, { // m_DedicatedMenuButton DS3DDX_BUTTON_MENULEFT, // MENU_BUTTON_LEFT @@ -420,6 +446,7 @@ GameDef g_GameDefs[NUM_GAMES] = DS3DDX_BUTTON_MENUDOWN, // MENU_BUTTON_DOWN DS3DDX_BUTTON_START, // MENU_BUTTON_START DS3DDX_BUTTON_BACK, // MENU_BUTTON_BACK + DS3DDX_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_SecondaryMenuButton DS3DDX_BUTTON_HANDLEFT, // MENU_BUTTON_LEFT @@ -428,6 +455,7 @@ GameDef g_GameDefs[NUM_GAMES] = DS3DDX_BUTTON_HANDDOWN, // MENU_BUTTON_DOWN DS3DDX_BUTTON_START, // MENU_BUTTON_START DS3DDX_BUTTON_BACK, // MENU_BUTTON_BACK + DS3DDX_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -445,6 +473,7 @@ GameDef g_GameDefs[NUM_GAMES] = SDLK_RIGHT, //no default key // DS3DDX_BUTTON_MENURIGHT SDLK_UP, // DS3DDX_BUTTON_MENUUP SDLK_DOWN, // DS3DDX_BUTTON_MENUDOWN + SDLK_F1, // DS3DDX_BUTTON_INSERTCOIN }, { // PLAYER_2 -1, // DS3DDX_BUTTON_HANDLEFT, @@ -461,6 +490,7 @@ GameDef g_GameDefs[NUM_GAMES] = -1, //no default key // DS3DDX_BUTTON_MENURIGHT -1, // DS3DDX_BUTTON_MENUUP -1, // DS3DDX_BUTTON_MENUDOWN + -1, // DS3DDX_BUTTON_INSERTCOIN }, } }, @@ -485,6 +515,7 @@ GameDef g_GameDefs[NUM_GAMES] = "MenuRight", "MenuUp", "MenuDown", + "Insert Coin", }, { // m_szSecondaryFunction "(MenuLeft)", @@ -503,6 +534,7 @@ GameDef g_GameDefs[NUM_GAMES] = "(dedicated)", "(dedicated)", "(dedicated)", + "", }, { // m_DedicatedMenuButton BM_BUTTON_MENULEFT, // MENU_BUTTON_LEFT @@ -511,6 +543,7 @@ GameDef g_GameDefs[NUM_GAMES] = BM_BUTTON_MENUDOWN, // MENU_BUTTON_DOWN BM_BUTTON_START, // MENU_BUTTON_START BM_BUTTON_SELECT, // MENU_BUTTON_BACK + BM_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_SecondaryMenuButton BM_BUTTON_KEY1, // MENU_BUTTON_LEFT @@ -519,6 +552,7 @@ GameDef g_GameDefs[NUM_GAMES] = BM_BUTTON_SCRATCHDOWN, // MENU_BUTTON_DOWN BM_BUTTON_START, // MENU_BUTTON_START BM_BUTTON_SELECT, // MENU_BUTTON_BACK + BM_BUTTON_INSERTCOIN,// MENU_BUTTON_INSERTCOIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -537,6 +571,7 @@ GameDef g_GameDefs[NUM_GAMES] = SDLK_RIGHT, // BM_BUTTON_MENURIGHT SDLK_UP, // BM_BUTTON_MENUUP SDLK_DOWN, // BM_BUTTON_MENUDOWN + SDLK_F1, // BM_BUTTON_INSERTCOIN }, { // PLAYER_2 -1, // BM_BUTTON_KEY1, @@ -554,6 +589,7 @@ GameDef g_GameDefs[NUM_GAMES] = -1, // BM_BUTTON_MENURIGHT -1, // BM_BUTTON_MENUUP -1, // BM_BUTTON_MENUDOWN + -1, // BM_BUTTON_INSERTCOIN }, } }, diff --git a/stepmania/src/MenuInput.h b/stepmania/src/MenuInput.h index 03207680ab..b743beb3ba 100644 --- a/stepmania/src/MenuInput.h +++ b/stepmania/src/MenuInput.h @@ -22,6 +22,7 @@ enum MenuButton MENU_BUTTON_DOWN, MENU_BUTTON_START, MENU_BUTTON_BACK, + MENU_BUTTON_INSERTCOIN, NUM_MENU_BUTTONS, // leave this at the end MENU_BUTTON_INVALID }; diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index aa285c9467..9bb0af2243 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -17,7 +17,6 @@ Screen::Screen() { - m_FirstUpdate = true; } Screen::~Screen() @@ -106,10 +105,3 @@ void Screen::SendScreenMessage( ScreenMessage SM, float fDelay ) QSM.fDelayRemaining = fDelay; m_QueuedMessages.push_back( QSM ); } - -bool Screen::FirstUpdate() -{ - bool ret = m_FirstUpdate; - m_FirstUpdate = false; - return ret; -} diff --git a/stepmania/src/Screen.h b/stepmania/src/Screen.h index 879bfa8075..e99605797d 100644 --- a/stepmania/src/Screen.h +++ b/stepmania/src/Screen.h @@ -39,9 +39,6 @@ public: void SendScreenMessage( const ScreenMessage SM, const float fDelay ); void ClearMessageQueue() { m_QueuedMessages.clear(); } - /* Used only by ScreenManager::Update. */ - bool FirstUpdate(); - protected: // structure for holding messages sent to a Screen diff --git a/stepmania/src/ScreenAttract.cpp b/stepmania/src/ScreenAttract.cpp index d1ee337849..4a1e55a8b6 100644 --- a/stepmania/src/ScreenAttract.cpp +++ b/stepmania/src/ScreenAttract.cpp @@ -37,33 +37,6 @@ const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+3); ScreenAttract::ScreenAttract() { LOG->Trace( "ScreenAttract::ScreenAttract()" ); - - m_bFirstUpdate = true; - - // - // I think it's better to do all the initialization here rather than have it scattered - // about in all the global singleton classes - // - GAMESTATE->Reset(); - PREFSMAN->ReadGamePrefsFromDisk(); - INPUTMAPPER->ReadMappingsFromDisk(); - GAMESTATE->m_bPlayersCanJoin = true; - - if( !GAMEMAN->DoesNoteSkinExist( GAMEMAN->GetCurNoteSkin() ) ) - { - CStringArray asNoteSkinNames; - GAMEMAN->GetNoteSkinNames( asNoteSkinNames ); - GAMEMAN->SwitchNoteSkin( asNoteSkinNames[0] ); - } - if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) ) - { - CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; - if( THEME->DoesThemeExist( sGameName ) ) - THEME->SwitchTheme( sGameName ); - else - THEME->SwitchTheme( "default" ); - } - PREFSMAN->SaveGamePrefsToDisk(); } @@ -77,36 +50,59 @@ void ScreenAttract::Input( const DeviceInput& DeviceI, const InputEventType type { // LOG->Trace( "ScreenAttract::Input()" ); + if(type != IET_FIRST_PRESS) return; // don't care + if( m_Fade.IsClosing() ) return; - Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); + if( MenuI.IsValid() ) + { + switch( MenuI.button ) + { + case MENU_BUTTON_LEFT: + case MENU_BUTTON_RIGHT: + m_Fade.CloseWipingRight( SM_GoToNextScreen ); + break; + case MENU_BUTTON_START: + GAMESTATE->m_bSideIsJoined[MenuI.player] = true; + GAMESTATE->m_MasterPlayerNumber = MenuI.player; + GAMESTATE->m_bPlayersCanJoin = false; + + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","insert coin") ); + ::Sleep( 1000 ); // do a little pause, like the arcade does + SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + break; + case MENU_BUTTON_BACK: + Exit(); + break; + } + } + +// Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); +} + +void ScreenAttract::FirstUpdate() +{ + // We have to do initialization in the first update because this->GetElementName() won't + // work until the object has been fully constructed. + m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations",this->GetElementName()) ); + this->AddChild( &m_Background ); + + m_Fade.SetClosed(); + m_Fade.OpenWipingRight( SM_None ); + this->AddChild( &m_Fade ); + + SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo(this->GetElementName()) ); + + m_soundStart.Load( THEME->GetPathTo("Sounds","menu start") ); + + SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds",this->GetElementName() + " music") ); + + this->SendScreenMessage( SM_BeginFadingOut, SECONDS_TO_SHOW ); } void ScreenAttract::Update( float fDelta ) { - // We have to do initialization in the first update because this->GetElementName() won't - // work until the object has been fully constructed. - if( m_bFirstUpdate ) - { - m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations",this->GetElementName()) ); - this->AddChild( &m_Background ); - - m_Fade.SetClosed(); - m_Fade.OpenWipingRight( SM_None ); - this->AddChild( &m_Fade ); - - SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo(this->GetElementName()) ); - - m_soundStart.Load( THEME->GetPathTo("Sounds","menu start") ); - - SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds",this->GetElementName() + " music") ); - - this->SendScreenMessage( SM_BeginFadingOut, SECONDS_TO_SHOW ); - - m_bFirstUpdate = false; - } - Screen::Update(fDelta); } @@ -115,21 +111,11 @@ void ScreenAttract::HandleScreenMessage( const ScreenMessage SM ) switch( SM ) { case SM_BeginFadingOut: - m_Fade.CloseWipingRight( SM_GoToNextScreen ); + if( !m_Fade.IsClosing() ) + m_Fade.CloseWipingRight( SM_GoToNextScreen ); break; case SM_GoToNextScreen: SCREENMAN->SetNewScreen( NEXT_SCREEN ); break; } } - -void ScreenAttract::MenuStart( PlayerNumber pn ) -{ - GAMESTATE->m_bSideIsJoined[pn] = true; - GAMESTATE->m_MasterPlayerNumber = pn; - GAMESTATE->m_bPlayersCanJoin = false; - - SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","insert coin") ); - ::Sleep( 1000 ); // do a little pause, like the arcade does - SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); -} diff --git a/stepmania/src/ScreenAttract.h b/stepmania/src/ScreenAttract.h index 60a42a0491..6fc7fdcb23 100644 --- a/stepmania/src/ScreenAttract.h +++ b/stepmania/src/ScreenAttract.h @@ -4,7 +4,8 @@ ----------------------------------------------------------------------------- Class: ScreenAttract - Desc: Base class for all attraction screens. + Desc: Base class for all attraction screens. This class handles input + and coin logic Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford @@ -27,16 +28,15 @@ public: virtual ~ScreenAttract(); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); + virtual void FirstUpdate(); virtual void Update( float fDelta ); virtual void HandleScreenMessage( const ScreenMessage SM ); -private: - void MenuStart( PlayerNumber pn ); +protected: + virtual CString GetMetricName() = 0; // used to loop up theme metrics virtual CString GetElementName() = 0; // used to loop up theme elements - bool m_bFirstUpdate; - BGAnimation m_Background; TransitionFade m_Fade; RandomSample m_soundStart; diff --git a/stepmania/src/ScreenDemonstration.cpp b/stepmania/src/ScreenDemonstration.cpp index fe0d493b09..3c7b212071 100644 --- a/stepmania/src/ScreenDemonstration.cpp +++ b/stepmania/src/ScreenDemonstration.cpp @@ -10,3 +10,199 @@ ----------------------------------------------------------------------------- */ +#include "ScreenDemonstration.h" +#include "RageLog.h" +#include "ThemeManager.h" +#include "GameState.h" +#include "SongManager.h" +#include "StepMania.h" + + +#define SECONDS_TO_SHOW THEME->GetMetricF("ScreenDemonstration","SecondsToShow") +#define NEXT_SCREEN THEME->GetMetric("ScreenDemonstration","NextScreen") + + +const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+101); // MUST be same as in ScreenGameplay +const ScreenMessage SM_BeginFadingToNextScreen = ScreenMessage(SM_User+1000); +const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+1002); + + +ScreenDemonstration::ScreenDemonstration() : ScreenGameplay( false ) +{ + LOG->Trace( "ScreenDemonstration::ScreenDemonstration()" ); + GAMESTATE->m_bDemonstration = true; + + + // + // Set the current song to prepare for a demonstration + // + + switch( GAMESTATE->m_CurGame ) + { + case GAME_DANCE: GAMESTATE->m_CurStyle = STYLE_DANCE_VERSUS; break; + case GAME_PUMP: GAMESTATE->m_CurStyle = STYLE_PUMP_VERSUS; break; + case GAME_EZ2: GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE_VERSUS; break; + case GAME_PARA: GAMESTATE->m_CurStyle = STYLE_PARA_SINGLE; break; + case GAME_DS3DDX: GAMESTATE->m_CurStyle = STYLE_DS3DDX_SINGLE; break; + case GAME_BM: GAMESTATE->m_CurStyle = STYLE_BM_SINGLE; break; + default: ASSERT(0); + } + + GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE; + + + // + // Search for a Song and Steps to play during the demo + // + for( int i=0; i<600; i++ ) // try 600 times + { + Song* pSong = SONGMAN->GetRandomSong(); + if( pSong == NULL ) // returns NULL there are no songs + { + // we didn't find a song. Abort demonstration. + this->SendScreenMessage( SM_GoToNextScreen, 0 ); + return; + } + + if( pSong->m_apNotes.empty() ) + continue; // skip + + if( !pSong->HasMusic() ) + continue; // skip + + vector apNotes; + pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, apNotes ); + + if( apNotes.empty() ) + continue; // skip + + // Found something we can use! + Notes* pNotes = apNotes[ rand()%apNotes.size() ]; + + GAMESTATE->m_pCurSong = pSong; + for( int p=0; pm_pCurNotes[p] = pNotes; + + break; // done looking + } + + ASSERT( GAMESTATE->m_pCurSong ); + + GAMESTATE->m_MasterPlayerNumber = PLAYER_1; + + // choose some cool options + for( int p=0; pIsPlayerEnabled(p) ) + continue; + + GAMESTATE->m_PlayerOptions[p] = PlayerOptions(); + + if( RandomFloat(0,1)>0.8f ) + GAMESTATE->m_PlayerOptions[p].m_fArrowScrollSpeed = 1.5f; + GAMESTATE->m_PlayerOptions[p].m_bEffects[ rand()%PlayerOptions::NUM_EFFECT_TYPES ] = true; + if( RandomFloat(0,1)>0.9f ) + GAMESTATE->m_PlayerOptions[p].m_AppearanceType = PlayerOptions::APPEARANCE_HIDDEN; + if( RandomFloat(0,1)>0.9f ) + GAMESTATE->m_PlayerOptions[p].m_AppearanceType = PlayerOptions::APPEARANCE_SUDDEN; + if( RandomFloat(0,1)>0.7f ) + GAMESTATE->m_PlayerOptions[p].m_bReverseScroll = true; + if( RandomFloat(0,1)>0.8f ) + GAMESTATE->m_PlayerOptions[p].m_bDark = true; + } + + GAMESTATE->m_SongOptions = SongOptions(); + + GAMESTATE->m_SongOptions.m_LifeType = (randomf(0,1)>0.8f) ? SongOptions::LIFE_BATTERY : SongOptions::LIFE_BAR; + GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF; +} + +ScreenDemonstration::~ScreenDemonstration() +{ + GAMESTATE->m_bDemonstration = false; +} + +void ScreenDemonstration::FirstUpdate() +{ + LOG->Trace( "ScreenDemonstration::FirstUpdate()" ); + + ScreenGameplay::FirstUpdate(); + + + m_sprDemonstrationOverlay.Load( THEME->GetPathTo("Graphics","demonstration overlay") ); + m_sprDemonstrationOverlay.SetXY( CENTER_X, CENTER_Y ); + this->AddChild( &m_sprDemonstrationOverlay ); + + m_sprDemonstrationBlink.Load( THEME->GetPathTo("Graphics","demonstration blink") ); + m_sprDemonstrationBlink.SetXY( CENTER_X, CENTER_Y ); + m_sprDemonstrationBlink.SetEffectBlinking(); + this->AddChild( &m_sprDemonstrationBlink ); + + m_Fade.OpenWipingRight(); + + this->ClearMessageQueue(); // remove all of the messages set in ScreenGameplay that animate "ready", "here we go", etc. + + m_StarWipe.SetOpened(); + m_DancingState = STATE_DANCING; + this->SendScreenMessage( SM_BeginFadingToNextScreen, SECONDS_TO_SHOW ); +} + +void ScreenDemonstration::Update( float fDeltaTime ) +{ + ScreenGameplay::Update( fDeltaTime ); + + m_textAutoPlay.SetDiffuse( RageColor(1,1,1,0) ); // hide autoplay +} + +void ScreenDemonstration::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) +{ + //LOG->Trace( "ScreenDemonstration::Input()" ); + + if(type != IET_FIRST_PRESS) return; // don't care + + if( m_Fade.IsClosing() ) + return; + + if( MenuI.IsValid() ) + { + switch( MenuI.button ) + { + case MENU_BUTTON_LEFT: + case MENU_BUTTON_RIGHT: + m_Fade.CloseWipingRight( SM_GoToNextScreen ); + break; + case MENU_BUTTON_START: + m_soundMusic.Stop(); + GAMESTATE->m_bSideIsJoined[MenuI.player] = true; + GAMESTATE->m_MasterPlayerNumber = MenuI.player; + GAMESTATE->m_bPlayersCanJoin = false; + + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","insert coin") ); + ::Sleep( 1000 ); // do a little pause, like the arcade does + SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + break; + case MENU_BUTTON_BACK: + Exit(); + break; + } + } + +} + +void ScreenDemonstration::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_NotesEnded: + this->SendScreenMessage( SM_BeginFadingToNextScreen, 0 ); + return; + case SM_BeginFadingToNextScreen: + m_Fade.CloseWipingRight( SM_GoToNextScreen ); + return; + case SM_GoToNextScreen: + SCREENMAN->SetNewScreen( NEXT_SCREEN ); + return; + } + + ScreenGameplay::HandleScreenMessage( SM ); +} \ No newline at end of file diff --git a/stepmania/src/ScreenDemonstration.h b/stepmania/src/ScreenDemonstration.h index faf98d0116..4147530119 100644 --- a/stepmania/src/ScreenDemonstration.h +++ b/stepmania/src/ScreenDemonstration.h @@ -9,16 +9,25 @@ ----------------------------------------------------------------------------- */ -#include "ScreenAttract.h" +#include "ScreenGameplay.h" +#include "Sprite.h" -class ScreenDemonstration : public ScreenAttract +class ScreenDemonstration : public ScreenGameplay { public: + ScreenDemonstration(); + ~ScreenDemonstration(); + + virtual void FirstUpdate(); + virtual void Update( float fDeltaTime ); + virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); + virtual void HandleScreenMessage( const ScreenMessage SM ); + +protected: + Sprite m_sprDemonstrationOverlay; + Sprite m_sprDemonstrationBlink; -private: - virtual CString GetMetricName() { return "Demonstration"; }; // used to look up theme metrics - virtual CString GetElementName() { return "demonstration"; }; // used to look up theme elements }; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 6c88b7ad26..236bd0d480 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -72,7 +72,6 @@ #define SURVIVE_TIME_X THEME->GetMetricF("ScreenGameplay","SurviveTimeX") #define SURVIVE_TIME_Y THEME->GetMetricF("ScreenGameplay","SurviveTimeY") #define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("ScreenGameplay","SecondsBetweenComments") -#define DEMONSTRATION_SECONDS THEME->GetMetricF("ScreenGameplay","DemonstrationSeconds") #define TICK_EARLY_SECONDS THEME->GetMetricF("ScreenGameplay","TickEarlySeconds") float g_fTickEarlySecondsCache = 0; // reading directly out of theme metrics is slow @@ -81,7 +80,6 @@ float g_fTickEarlySecondsCache = 0; // reading directly out of theme metrics is // received while STATE_DANCING const ScreenMessage SM_NotesEnded = ScreenMessage(SM_User+101); const ScreenMessage SM_BeginLoadingNextSong = ScreenMessage(SM_User+102); -const ScreenMessage SM_BeginFadingToTitleMenu = ScreenMessage(SM_User+103); const ScreenMessage SM_PlayToastySound = ScreenMessage(SM_User+105); // received while STATE_OUTRO @@ -95,16 +93,20 @@ const ScreenMessage SM_BeginFailed = ScreenMessage(SM_User+121); const ScreenMessage SM_ShowFailed = ScreenMessage(SM_User+122); const ScreenMessage SM_PlayFailComment = ScreenMessage(SM_User+123); const ScreenMessage SM_GoToScreenAfterFail = ScreenMessage(SM_User+125); -const ScreenMessage SM_GoToTitleMenu = ScreenMessage(SM_User+126); -ScreenGameplay::ScreenGameplay() +ScreenGameplay::ScreenGameplay( bool bLoadSounds ) { LOG->Trace( "ScreenGameplay::ScreenGameplay()" ); - int p; - for( p=0; pmusic->StopPlaying(); + + + m_soundToasty.Load( THEME->GetPathTo("Sounds","gameplay toasty") ); + + + if( bLoadSounds ) // don't load sounds if just playing demonstration + { + m_soundFail.Load( THEME->GetPathTo("Sounds","gameplay failed") ); + m_soundTryExtraStage.Load( THEME->GetPathTo("Sounds","gameplay try extra stage") ); + m_soundOniDie.Load( THEME->GetPathTo("Sounds","gameplay oni die") ); + m_announcerReady.Load( ANNOUNCER->GetPathTo("gameplay ready") ); + if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) + m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo("gameplay here we go extra") ); + else if( GAMESTATE->IsFinalStage() ) + m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo("gameplay here we go final") ); + else + m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo("gameplay here we go normal") ); + m_announcerDanger.Load( ANNOUNCER->GetPathTo("gameplay comment danger") ); + m_announcerGood.Load( ANNOUNCER->GetPathTo("gameplay comment good") ); + m_announcerHot.Load( ANNOUNCER->GetPathTo("gameplay comment hot") ); + m_announcerOni.Load( ANNOUNCER->GetPathTo("gameplay comment oni") ); + + m_announcer100Combo.Load( ANNOUNCER->GetPathTo("gameplay 100 combo") ); + m_announcer200Combo.Load( ANNOUNCER->GetPathTo("gameplay 200 combo") ); + m_announcer300Combo.Load( ANNOUNCER->GetPathTo("gameplay 300 combo") ); + m_announcer400Combo.Load( ANNOUNCER->GetPathTo("gameplay 400 combo") ); + m_announcer500Combo.Load( ANNOUNCER->GetPathTo("gameplay 500 combo") ); + m_announcer600Combo.Load( ANNOUNCER->GetPathTo("gameplay 600 combo") ); + m_announcer700Combo.Load( ANNOUNCER->GetPathTo("gameplay 700 combo") ); + m_announcer800Combo.Load( ANNOUNCER->GetPathTo("gameplay 800 combo") ); + m_announcer900Combo.Load( ANNOUNCER->GetPathTo("gameplay 900 combo") ); + m_announcer1000Combo.Load( ANNOUNCER->GetPathTo("gameplay 1000 combo") ); + m_announcerComboStopped.Load( ANNOUNCER->GetPathTo("gameplay combo stopped") ); + } + + m_iRowLastCrossed = -1; + + m_soundAssistTick.Load( THEME->GetPathTo("Sounds","gameplay assist tick") ); +} + +void ScreenGameplay::FirstUpdate() +{ + Screen::FirstUpdate(); + + /* It's OK to operate on GAMESTATE here, but not in the constructor */ GAMESTATE->ResetStageStatistics(); // clear values - - const bool bExtra = GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2(); - const bool bReverse[NUM_PLAYERS] = { - GAMESTATE->m_PlayerOptions[0].m_bReverseScroll, - GAMESTATE->m_PlayerOptions[1].m_bReverseScroll - }; - + // Update possible dance points - for( p=0; pIsPlayerEnabled(p) ) continue; // skip @@ -158,6 +199,16 @@ ScreenGameplay::ScreenGameplay() } } + + + const bool bExtra = GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2(); + const bool bReverse[NUM_PLAYERS] = { + GAMESTATE->m_PlayerOptions[0].m_bReverseScroll, + GAMESTATE->m_PlayerOptions[1].m_bReverseScroll + }; + + + m_bChangedOffsetOrBPM = (GAMESTATE->m_SongOptions.m_AutoAdjust == SongOptions::ADJUST_ON); @@ -232,16 +283,6 @@ ScreenGameplay::ScreenGameplay() m_textStageNumber.SetText( GAMESTATE->GetStageText() ); m_textStageNumber.SetDiffuse( GAMESTATE->GetStageColor() ); - Song* pSong; - pSong = GAMESTATE->m_pCurSong; - m_BPMDisplay.SetXY( BPM_X, BPM_Y ); - m_BPMDisplay.SetZoom( BPM_ZOOM ); - this->AddChild( &m_BPMDisplay ); - float fMinBPM, fMaxBPM; - pSong->GetMinMaxBPM( fMinBPM, fMaxBPM ); - m_BPMDisplay.SetBPMRange( fMinBPM, fMaxBPM ); - - for( p=0; pGetPathTo("Fonts","Header2") ); @@ -323,7 +364,6 @@ ScreenGameplay::ScreenGameplay() m_textPlayerOptions[p].SetXY( PLAYER_OPTIONS_X(p), PLAYER_OPTIONS_Y(p,bExtra) ); m_textPlayerOptions[p].SetZoom( 0.5f ); m_textPlayerOptions[p].SetDiffuse( RageColor(1,1,1,1) ); - m_textPlayerOptions[p].SetText( GAMESTATE->m_PlayerOptions[p].GetString() ); this->AddChild( &m_textPlayerOptions[p] ); } @@ -355,7 +395,7 @@ ScreenGameplay::ScreenGameplay() m_textAutoPlay.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); m_textAutoPlay.SetXY( AUTOPLAY_X, AUTOPLAY_Y ); m_textAutoPlay.SetText( "AutoPlay is ON" ); - m_textAutoPlay.SetDiffuse( RageColor(1,1,1,1) ); + m_textAutoPlay.SetDiffuse( RageColor(1,1,1,PREFSMAN->m_bAutoPlay?1:0) ); this->AddChild( &m_textAutoPlay ); @@ -390,20 +430,6 @@ ScreenGameplay::ScreenGameplay() m_sprTryExtraStage.SetDiffuse( RageColor(1,1,1,0) ); this->AddChild( &m_sprTryExtraStage ); - if( GAMESTATE->m_bDemonstration ) - { - m_sprDemonstrationOverlay.Load( THEME->GetPathTo("Graphics","gameplay demonstration overlay") ); - m_sprDemonstrationOverlay.SetXY( CENTER_X, CENTER_Y ); - this->AddChild( &m_sprDemonstrationOverlay ); - - m_sprDemonstrationBlink.Load( THEME->GetPathTo("Graphics","gameplay demonstration blink") ); - m_sprDemonstrationBlink.SetXY( CENTER_X, CENTER_Y ); - m_sprDemonstrationBlink.SetEffectBlinking(); - this->AddChild( &m_sprDemonstrationBlink ); - - m_Fade.OpenWipingRight(); - } - m_Fade.SetOpened(); this->AddChild( &m_Fade ); @@ -418,61 +444,23 @@ ScreenGameplay::ScreenGameplay() m_sprToasty.Load( THEME->GetPathTo("Graphics","gameplay toasty") ); m_sprToasty.SetDiffuse( RageColor(1,1,1,0) ); this->AddChild( &m_sprToasty ); + + Song* pSong; + pSong = GAMESTATE->m_pCurSong; + m_BPMDisplay.SetXY( BPM_X, BPM_Y ); + m_BPMDisplay.SetZoom( BPM_ZOOM ); + this->AddChild( &m_BPMDisplay ); + float fMinBPM, fMaxBPM; + pSong->GetMinMaxBPM( fMinBPM, fMaxBPM ); + m_BPMDisplay.SetBPMRange( fMinBPM, fMaxBPM ); + - m_soundToasty.Load( THEME->GetPathTo("Sounds","gameplay toasty") ); - - - if( !GAMESTATE->m_bDemonstration ) // don't load sounds if just playing demonstration - { - m_soundFail.Load( THEME->GetPathTo("Sounds","gameplay failed") ); - m_soundTryExtraStage.Load( THEME->GetPathTo("Sounds","gameplay try extra stage") ); - m_soundOniDie.Load( THEME->GetPathTo("Sounds","gameplay oni die") ); - m_announcerReady.Load( ANNOUNCER->GetPathTo("gameplay ready") ); - if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) - m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo("gameplay here we go extra") ); - else if( GAMESTATE->IsFinalStage() ) - m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo("gameplay here we go final") ); - else - m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo("gameplay here we go normal") ); - m_announcerDanger.Load( ANNOUNCER->GetPathTo("gameplay comment danger") ); - m_announcerGood.Load( ANNOUNCER->GetPathTo("gameplay comment good") ); - m_announcerHot.Load( ANNOUNCER->GetPathTo("gameplay comment hot") ); - m_announcerOni.Load( ANNOUNCER->GetPathTo("gameplay comment oni") ); - - m_announcer100Combo.Load( ANNOUNCER->GetPathTo("gameplay 100 combo") ); - m_announcer200Combo.Load( ANNOUNCER->GetPathTo("gameplay 200 combo") ); - m_announcer300Combo.Load( ANNOUNCER->GetPathTo("gameplay 300 combo") ); - m_announcer400Combo.Load( ANNOUNCER->GetPathTo("gameplay 400 combo") ); - m_announcer500Combo.Load( ANNOUNCER->GetPathTo("gameplay 500 combo") ); - m_announcer600Combo.Load( ANNOUNCER->GetPathTo("gameplay 600 combo") ); - m_announcer700Combo.Load( ANNOUNCER->GetPathTo("gameplay 700 combo") ); - m_announcer800Combo.Load( ANNOUNCER->GetPathTo("gameplay 800 combo") ); - m_announcer900Combo.Load( ANNOUNCER->GetPathTo("gameplay 900 combo") ); - m_announcer1000Combo.Load( ANNOUNCER->GetPathTo("gameplay 1000 combo") ); - m_announcerComboStopped.Load( ANNOUNCER->GetPathTo("gameplay combo stopped") ); - } - - m_iRowLastCrossed = -1; - - m_soundAssistTick.Load( THEME->GetPathTo("Sounds","gameplay assist tick") ); - TweenOnScreen(); - /* XXX: We set m_textPlayerOptions[p] above, so that won't - * include options set by the course. Should it? -glenn */ - LoadNextSong( true ); + for( int i=0; i<30; i++ ) + this->SendScreenMessage( ScreenMessage(SM_User+i), i/2.0f ); // Send messages to we can get the introduction rolling - if( GAMESTATE->m_bDemonstration ) - { - m_StarWipe.SetOpened(); - m_DancingState = STATE_DANCING; - this->SendScreenMessage( SM_BeginFadingToTitleMenu, DEMONSTRATION_SECONDS ); - } - else - { - for( int i=0; i<30; i++ ) - this->SendScreenMessage( ScreenMessage(SM_User+i), i/2.0f ); // Send messages to we can get the introduction rolling - } + LoadNextSong( true ); } ScreenGameplay::~ScreenGameplay() @@ -572,6 +560,9 @@ void ScreenGameplay::LoadNextSong( bool bFirstLoad ) if( !GAMESTATE->IsPlayerEnabled(p) ) continue; + m_textPlayerOptions[p].SetText( GAMESTATE->m_PlayerOptions[p].GetString() ); + + // reset oni game over graphic m_sprOniGameOver[p].SetY( SCREEN_TOP - m_sprOniGameOver[p].GetZoomedHeight()/2 ); m_sprOniGameOver[p].SetDiffuse( RageColor(1,1,1,0) ); // 0 alpha so we don't waste time drawing while not visible @@ -661,7 +652,7 @@ bool ScreenGameplay::AllFailedEarlier() } // play assist ticks -bool ScreenGameplay::PlayTicks() const +bool ScreenGameplay::IsTimeToPlayTicks() const { // Sound cards have a latency between when a sample is Play()ed and when the sound // will start coming out the speaker. Compensate for this by boosting @@ -709,6 +700,8 @@ hehe - Andy) void ScreenGameplay::Update( float fDeltaTime ) { + Screen::Update( fDeltaTime ); + int pn; if( GAMESTATE->m_pCurSong == NULL ) @@ -803,29 +796,25 @@ void ScreenGameplay::Update( float fDeltaTime ) // // Check to see if it's time to play a gameplay comment // - if( !GAMESTATE->m_bDemonstration ) // don't play announcer comments in demonstration + m_fTimeLeftBeforeDancingComment -= fDeltaTime; + if( m_fTimeLeftBeforeDancingComment <= 0 ) { - m_fTimeLeftBeforeDancingComment -= fDeltaTime; - if( m_fTimeLeftBeforeDancingComment <= 0 ) + switch( GAMESTATE->m_PlayMode ) { - switch( GAMESTATE->m_PlayMode ) - { - case PLAY_MODE_ARCADE: - if( OneIsHot() ) m_announcerHot.PlayRandom(); - else if( AllAreInDanger() ) m_announcerDanger.PlayRandom(); - else m_announcerGood.PlayRandom(); - break; - case PLAY_MODE_ONI: - case PLAY_MODE_ENDLESS: - m_announcerOni.PlayRandom(); - break; - default: - ASSERT(0); - } - - m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS; // reset for the next comment + case PLAY_MODE_ARCADE: + if( OneIsHot() ) m_announcerHot.PlayRandom(); + else if( AllAreInDanger() ) m_announcerDanger.PlayRandom(); + else m_announcerGood.PlayRandom(); + break; + case PLAY_MODE_ONI: + case PLAY_MODE_ENDLESS: + m_announcerOni.PlayRandom(); + break; + default: + ASSERT(0); } + m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS; // reset for the next comment } } @@ -849,16 +838,8 @@ void ScreenGameplay::Update( float fDeltaTime ) m_iRowLastCrossed = iRowNow; } - - if(PlayTicks()) + if(IsTimeToPlayTicks()) m_soundAssistTick.Play(); - - if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration ) - m_textAutoPlay.SetDiffuse( RageColor(1,1,1,1) ); - else - m_textAutoPlay.SetDiffuse( RageColor(1,1,1,0) ); - - Screen::Update( fDeltaTime ); } @@ -873,26 +854,6 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ //LOG->Trace( "ScreenGameplay::Input()" ); if(type == IET_RELEASE) return; // don't care - if( GAMESTATE->m_bDemonstration ) - { - /* Special case:always allow escape. */ - if( DeviceI.device==DEVICE_KEYBOARD && DeviceI.button==SDLK_ESCAPE && !m_Fade.IsClosing() ) - { - this->SendScreenMessage( SM_BeginFadingToTitleMenu, 0 ); - } - /* Since escape backs out, we want to allow any other back buttons to - * work, too, to avoid confusion. */ - else if( (MenuI.button==MENU_BUTTON_START || MenuI.button==MENU_BUTTON_BACK) - && !m_Fade.IsClosing() ) - { - m_soundMusic.StopPlaying(); - SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","insert coin") ); - ::Sleep( 1000 ); // do a little pause, like the arcade does - this->SendScreenMessage( SM_GoToTitleMenu, 0 ); - } - return; // don't fall through below - } - // Handle special keys to adjust the offset if( DeviceI.device == DEVICE_KEYBOARD ) { @@ -928,6 +889,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ break; case SDLK_F8: PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay; + m_textAutoPlay.SetDiffuse( RageColor(1,1,1,PREFSMAN->m_bAutoPlay?1:0) ); break; case SDLK_F9: case SDLK_F10: @@ -1146,12 +1108,6 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) // received while STATE_DANCING case SM_NotesEnded: { - if( GAMESTATE->m_bDemonstration ) // Don't show "CLEARED" in Demo - { - this->SendScreenMessage( SM_BeginFadingToTitleMenu, 0 ); - return; - } - // save any statistics int p; for( p=0; pSendScreenMessage( SM_PlayToastySound, 0.3f ); @@ -1490,9 +1443,6 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) else SCREENMAN->SetNewScreen( "ScreenGameOver" ); break; - case SM_GoToTitleMenu: - SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); - break; } } @@ -1512,8 +1462,7 @@ void ScreenGameplay::TweenOnScreen() { float fOriginalY = apActorsInLifeFrame[i]->GetY(); apActorsInLifeFrame[i]->SetY( fOriginalY-100 ); - if( !GAMESTATE->m_bDemonstration ) - apActorsInLifeFrame[i]->BeginTweening( 0.5f ); // sleep + apActorsInLifeFrame[i]->BeginTweening( 0.5f ); // sleep apActorsInLifeFrame[i]->BeginTweening( 1 ); apActorsInLifeFrame[i]->SetTweenY( fOriginalY ); } @@ -1533,8 +1482,7 @@ void ScreenGameplay::TweenOnScreen() { float fOriginalY = apActorsInScoreFrame[i]->GetY(); apActorsInScoreFrame[i]->SetY( fOriginalY+100 ); - if( !GAMESTATE->m_bDemonstration ) - apActorsInScoreFrame[i]->BeginTweening( 0.5f ); // sleep + apActorsInScoreFrame[i]->BeginTweening( 0.5f ); // sleep apActorsInScoreFrame[i]->BeginTweening( 1 ); apActorsInScoreFrame[i]->SetTweenY( fOriginalY ); } @@ -1543,8 +1491,7 @@ void ScreenGameplay::TweenOnScreen() { float fOriginalX = m_DifficultyIcon[p].GetX(); m_DifficultyIcon[p].SetX( (p==PLAYER_1) ? fOriginalX-200 : fOriginalX+200 ); - if( !GAMESTATE->m_bDemonstration ) - m_DifficultyIcon[p].BeginTweening( 0.5f ); // sleep + m_DifficultyIcon[p].BeginTweening( 0.5f ); // sleep m_DifficultyIcon[p].BeginTweening( 1 ); m_DifficultyIcon[p].SetTweenX( fOriginalX ); } diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 71138d65c5..c5bc5589d2 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -1,3 +1,5 @@ +#ifndef SCREENGAMEPLAY_H +#define SCREENGAMEPLAY_H /* ----------------------------------------------------------------------------- Class: ScreenGameplay @@ -47,15 +49,16 @@ const ScreenMessage SM_ComboStopped = ScreenMessage(SM_User+210); class ScreenGameplay : public Screen { public: - ScreenGameplay(); + ScreenGameplay( bool bLoadSounds = true ); virtual ~ScreenGameplay(); + virtual void FirstUpdate(); virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); virtual void HandleScreenMessage( const ScreenMessage SM ); -private: +protected: void TweenOnScreen(); void TweenOffScreen(); @@ -66,7 +69,7 @@ private: bool AllAreInDanger(); bool AllAreFailing(); bool AllFailedEarlier(); - bool PlayTicks() const; + bool IsTimeToPlayTicks() const; enum DancingState { STATE_INTRO = 0, // not allowed to press Back @@ -123,9 +126,6 @@ private: Sprite m_sprToasty; // easter egg - Sprite m_sprDemonstrationOverlay; - Sprite m_sprDemonstrationBlink; - RandomSample m_soundFail; RandomSample m_soundOniDie; RandomSample m_soundTryExtraStage; @@ -156,4 +156,4 @@ private: }; - +#endif \ No newline at end of file diff --git a/stepmania/src/ScreenInstructions.cpp b/stepmania/src/ScreenInstructions.cpp index bb76da6417..72cc121571 100644 --- a/stepmania/src/ScreenInstructions.cpp +++ b/stepmania/src/ScreenInstructions.cpp @@ -37,8 +37,8 @@ ScreenInstructions::ScreenInstructions() LOG->Trace( "ScreenInstructions::ScreenInstructions()" ); m_Menu.Load( - THEME->GetPathTo("BGAnimations","How To Play"), - THEME->GetPathTo("Graphics","How To Play Top Edge"), + THEME->GetPathTo("BGAnimations","Instructions"), + THEME->GetPathTo("Graphics","Instructions Top Edge"), HELP_TEXT, false, true, TIMER_SECONDS ); this->AddChild( &m_Menu ); @@ -56,13 +56,13 @@ ScreenInstructions::ScreenInstructions() switch( GAMESTATE->m_PlayMode ) { case PLAY_MODE_ARCADE: - sHowToPlayPath = THEME->GetPathTo("Graphics","how to play arcade"); + sHowToPlayPath = THEME->GetPathTo("Graphics","instructions arcade"); break; case PLAY_MODE_ENDLESS: - sHowToPlayPath = THEME->GetPathTo("Graphics","how to play endless"); + sHowToPlayPath = THEME->GetPathTo("Graphics","instructions endless"); break; case PLAY_MODE_ONI: - sHowToPlayPath = THEME->GetPathTo("Graphics","how to play oni"); + sHowToPlayPath = THEME->GetPathTo("Graphics","instructions oni"); break; default: ASSERT(0); @@ -77,7 +77,7 @@ ScreenInstructions::ScreenInstructions() m_sprHowToPlay.BeginTweening( 0.6f, Actor::TWEEN_BIAS_BEGIN ); m_sprHowToPlay.SetTweenX( CENTER_X ); - SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","how to play music") ); + SOUNDMAN->PlayMusic( THEME->GetPathTo("Sounds","instructions music") ); } ScreenInstructions::~ScreenInstructions() @@ -96,7 +96,7 @@ void ScreenInstructions::DrawPrimitives() { m_Menu.DrawBottomLayer(); m_Menu.DrawTopLayer(); - Screen::DrawPrimitives(); // draw How To Play graphic on top of all the others! + Screen::DrawPrimitives(); // draw instructions graphic on top of all the others! } void ScreenInstructions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index 0c11810005..2ced3f1330 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -102,10 +102,10 @@ void ScreenManager::Update( float fDeltaTime ) * * So, let's just drop the first update for every screen. */ - if(m_ScreenStack[i]->FirstUpdate()) - continue; - - m_ScreenStack[i]->Update( fDeltaTime ); + if( m_ScreenStack[i]->IsFirstUpdate() ) + m_ScreenStack[i]->Update( 0 ); + else + m_ScreenStack[i]->Update( fDeltaTime ); } } @@ -197,6 +197,7 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type #include "ScreenLogo.h" #include "ScreenUnlock.h" #include "ScreenDemonstration.h" +#include "ScreenInstructions.h" #include "ScreenPrompt.h" #include "ScreenTextEntry.h" @@ -243,6 +244,7 @@ Screen* ScreenManager::MakeNewScreen( CString sClassName ) else if( 0==stricmp(sClassName, "ScreenLogo") ) ret = new ScreenLogo; else if( 0==stricmp(sClassName, "ScreenUnlock") ) ret = new ScreenUnlock; else if( 0==stricmp(sClassName, "ScreenDemonstration") ) ret = new ScreenDemonstration; + else if( 0==stricmp(sClassName, "ScreenInstructions") ) ret = new ScreenInstructions; else RageException::Throw( "Invalid Screen class name '%s'", sClassName.GetString() ); diff --git a/stepmania/src/ScreenManager.h b/stepmania/src/ScreenManager.h index 51da65dd9c..2529c29504 100644 --- a/stepmania/src/ScreenManager.h +++ b/stepmania/src/ScreenManager.h @@ -46,7 +46,7 @@ public: void RefreshCreditsMessages(); private: - vector m_ScreenStack; + vector m_ScreenStack; // bottommost to topmost vector m_ScreensToDelete; Screen *m_ScreenBuffered; diff --git a/stepmania/src/ScreenPrompt.cpp b/stepmania/src/ScreenPrompt.cpp index 57aa039e6c..72c134fa27 100644 --- a/stepmania/src/ScreenPrompt.cpp +++ b/stepmania/src/ScreenPrompt.cpp @@ -95,6 +95,19 @@ void ScreenPrompt::Input( const DeviceInput& DeviceI, const InputEventType type, if( m_Fade.IsOpening() ) return; + if( DeviceI.device == DEVICE_KEYBOARD ) + { + switch( DeviceI.button ) + { + case SDLK_LEFT: + this->MenuLeft( StyleI.player ); + return; + case SDLK_RIGHT: + this->MenuLeft( StyleI.player ); + return; + } + } + Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); } diff --git a/stepmania/src/ScreenSelectGame.cpp b/stepmania/src/ScreenSelectGame.cpp index fe4d79dae9..25f85e7b2a 100644 --- a/stepmania/src/ScreenSelectGame.cpp +++ b/stepmania/src/ScreenSelectGame.cpp @@ -18,6 +18,7 @@ #include "GameState.h" #include "InputMapper.h" #include "ThemeManager.h" +#include "StepMania.h" enum { @@ -100,12 +101,12 @@ void ScreenSelectGame::ExportOptions() void ScreenSelectGame::GoToPrevState() { - SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + Reset(); } void ScreenSelectGame::GoToNextState() { - SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + Reset(); } diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index 77e3fb8c0c..327b81629f 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -333,7 +333,7 @@ void ScreenSelectStyle::UpdateEnabledDisabled() if( IsEnabled(i) ) m_sprIcon[i].SetDiffuse( RageColor(1,1,1,1) ); else - m_sprIcon[i].SetDiffuse( RageColor(0.5f,0.5f,0.5f,1) ); + m_sprIcon[i].SetDiffuse( RageColor(0.25f,0.25f,0.25f,1) ); } // Select first enabled style diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 6250f63493..145ed279ea 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -58,47 +58,19 @@ const CString CHOICE_TEXT[ScreenTitleMenu::NUM_TITLE_MENU_CHOICES] = { #define COLOR_SELECTED THEME->GetMetricC("ScreenTitleMenu","ColorSelected") #define ZOOM_NOT_SELECTED THEME->GetMetricF("ScreenTitleMenu","ZoomNotSelected") #define ZOOM_SELECTED THEME->GetMetricF("ScreenTitleMenu","ZoomSelected") -#define SECONDS_BEFORE_DEMONSTRATION THEME->GetMetricF("ScreenTitleMenu","SecondsBeforeDemonstration") #define SECONDS_BETWEEN_ATTRACT THEME->GetMetricF("ScreenTitleMenu","SecondsBetweenAttract") #define HELP_TEXT THEME->GetMetric("ScreenTitleMenu","HelpText") #define NEXT_SCREEN THEME->GetMetric("ScreenTitleMenu","NextScreen") const ScreenMessage SM_PlayAttract = ScreenMessage(SM_User+1); const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+12); -const ScreenMessage SM_GoToDemonstration = ScreenMessage(SM_User+13); +const ScreenMessage SM_GoToAttractLoop = ScreenMessage(SM_User+13); ScreenTitleMenu::ScreenTitleMenu() { LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" ); - // - // I think it's better to do all the initialization here rather than have it scattered - // about in all the global singleton classes - // - GAMESTATE->Reset(); - PREFSMAN->ReadGamePrefsFromDisk(); - INPUTMAPPER->ReadMappingsFromDisk(); - GAMESTATE->m_bPlayersCanJoin = true; - - if( !GAMEMAN->DoesNoteSkinExist( GAMEMAN->GetCurNoteSkin() ) ) - { - CStringArray asNoteSkinNames; - GAMEMAN->GetNoteSkinNames( asNoteSkinNames ); - GAMEMAN->SwitchNoteSkin( asNoteSkinNames[0] ); - } - if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) ) - { - CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; - if( THEME->DoesThemeExist( sGameName ) ) - THEME->SwitchTheme( sGameName ); - else - THEME->SwitchTheme( "default" ); - } - PREFSMAN->SaveGamePrefsToDisk(); - - - m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations","title menu") ); this->AddChild( &m_Background ); @@ -190,79 +162,14 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty if( m_Fade.IsClosing() ) return; - /* Reset the demonstration timer when a key is pressed. */ - TimeToDemonstration.GetDeltaTime(); - - if(DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == SDLK_F1 && type == IET_FIRST_PRESS) - { - FadeToDemonstration(); - return; - } - Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); } void ScreenTitleMenu::Update( float fDelta ) { - if(TimeToDemonstration.PeekDeltaTime() >= SECONDS_BEFORE_DEMONSTRATION) - { - FadeToDemonstration(); - TimeToDemonstration.GetDeltaTime(); - } Screen::Update(fDelta); } -void ScreenTitleMenu::FadeToDemonstration() -{ - // Set up the game state for a demonstration - switch( GAMESTATE->m_CurGame ) - { - case GAME_DANCE: GAMESTATE->m_CurStyle = STYLE_DANCE_VERSUS; break; - case GAME_PUMP: GAMESTATE->m_CurStyle = STYLE_PUMP_VERSUS; break; - case GAME_EZ2: GAMESTATE->m_CurStyle = STYLE_EZ2_SINGLE_VERSUS; break; - case GAME_PARA: GAMESTATE->m_CurStyle = STYLE_PARA_SINGLE; break; - case GAME_DS3DDX: GAMESTATE->m_CurStyle = STYLE_DS3DDX_SINGLE; break; - case GAME_BM: GAMESTATE->m_CurStyle = STYLE_BM_SINGLE; break; - default: ASSERT(0); - } - - GAMESTATE->m_PlayMode = PLAY_MODE_ARCADE; - - if(!SONGMAN->ChooseRandomSong()) - { - // Couldn't find Song/Notes to play. Abort demonstration! - GAMESTATE->Reset(); - return; - } - - ASSERT( GAMESTATE->m_pCurSong ); - - GAMESTATE->m_MasterPlayerNumber = PLAYER_1; - - // choose some cool options - for( int p=0; pIsPlayerEnabled(p) ) - continue; - - if( RandomFloat(0,1)>0.8f ) - GAMESTATE->m_PlayerOptions[p].m_fArrowScrollSpeed = 1.5f; - GAMESTATE->m_PlayerOptions[p].m_bEffects[ rand()%PlayerOptions::NUM_EFFECT_TYPES ] = true; - if( RandomFloat(0,1)>0.9f ) - GAMESTATE->m_PlayerOptions[p].m_AppearanceType = PlayerOptions::APPEARANCE_HIDDEN; - if( RandomFloat(0,1)>0.9f ) - GAMESTATE->m_PlayerOptions[p].m_AppearanceType = PlayerOptions::APPEARANCE_SUDDEN; - if( RandomFloat(0,1)>0.7f ) - GAMESTATE->m_PlayerOptions[p].m_bReverseScroll = true; - if( RandomFloat(0,1)>0.8f ) - GAMESTATE->m_PlayerOptions[p].m_bDark = true; - } - GAMESTATE->m_SongOptions.m_LifeType = (randomf(0,1)>0.8f) ? SongOptions::LIFE_BATTERY : SongOptions::LIFE_BAR; - GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF; - - GAMESTATE->m_bDemonstration = true; - m_Fade.CloseWipingRight( SM_GoToDemonstration ); -} void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) { @@ -310,11 +217,8 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) break; } break; - case SM_GoToDemonstration: - { - ASSERT( GAMESTATE->m_pCurSong ); - SCREENMAN->SetNewScreen( "ScreenGameplay" ); - } + case SM_GoToAttractLoop: + SCREENMAN->SetNewScreen( "ScreenCompany" ); break; } } @@ -406,11 +310,7 @@ void ScreenTitleMenu::MenuStart( PlayerNumber pn ) break; case CHOICE_EXIT: { m_soundSelect.PlayRandom(); - - SDL_Event *event; - event = (SDL_Event *) malloc(sizeof(event)); - event->type = SDL_QUIT; - SDL_PushEvent(event); + Exit(); LOG->Trace("CHOICE_EXIT: shutting down"); } return; @@ -420,13 +320,7 @@ void ScreenTitleMenu::MenuStart( PlayerNumber pn ) } void ScreenTitleMenu::MenuBack( PlayerNumber pn ) -{ - if(m_TitleMenuChoice == CHOICE_EXIT) - return; - - LoseFocus( m_TitleMenuChoice ); - m_TitleMenuChoice = CHOICE_EXIT; - m_soundChange.PlayRandom(); - GainFocus( m_TitleMenuChoice ); +{ + this->m_Fade.CloseWipingRight( SM_GoToAttractLoop ); } diff --git a/stepmania/src/ScreenTitleMenu.h b/stepmania/src/ScreenTitleMenu.h index 34a3ebba1b..31f6c22456 100644 --- a/stepmania/src/ScreenTitleMenu.h +++ b/stepmania/src/ScreenTitleMenu.h @@ -51,7 +51,6 @@ private: void MenuDown( PlayerNumber pn ); void MenuBack( PlayerNumber pn ); void MenuStart( PlayerNumber pn ); - void FadeToDemonstration(); TitleMenuChoice m_TitleMenuChoice; diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index a4d31a94d3..80141db8b9 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -623,38 +623,12 @@ void SongManager::GetExtraStageInfo( bool bExtra2, CString sPreferredGroup, cons } } -/* Pick a random song (for the demonstration). */ -bool SongManager::ChooseRandomSong() +Song* SongManager::GetRandomSong() { - if( SONGMAN->m_pSongs.empty() ) - return false; + if( m_pSongs.empty() ) + return NULL; - int i; - for( i=0; i<600; i++ ) // try 600 times - { - Song* pSong = m_pSongs[ rand()%m_pSongs.size() ]; - - if( pSong->m_apNotes.empty() ) - continue; // skip - - if( !pSong->HasMusic() ) - continue; // skip - - for( int j=0; j<3; j++ ) // try 3 times - { - Notes* pNotes = pSong->m_apNotes[ rand()%pSong->m_apNotes.size() ]; - if( pNotes->m_NotesType != GAMESTATE->GetCurrentStyleDef()->m_NotesType ) - continue; - - // found something we can use! - GAMESTATE->m_pCurSong = pSong; - for( int p=0; pm_pCurNotes[p] = pNotes; - return true; - } - } - - return false; + return SONGMAN->m_pSongs[ rand()%m_pSongs.size() ]; } Song* SongManager::GetSongFromDir( CString sDir ) diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index fac477be0c..3e0f4665ef 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -62,9 +62,7 @@ public: void GetExtraStageInfo( bool bExtra2, CString sPreferredGroup, const StyleDef *s, Song*& pSongOut, Notes*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out ); - /* Choose a random song from the current style. Return true - * if successful, false if no song could be found. */ - bool ChooseRandomSong(); + Song* GetRandomSong(); Song* GetSongFromDir( CString sDir ); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 233becffd1..aa514bcabf 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -108,6 +108,39 @@ void ApplyGraphicOptions() TEXTUREMAN->ReloadAll(); } +void Exit() +{ + SDL_Event *event; + event = (SDL_Event *) malloc(sizeof(event)); + event->type = SDL_QUIT; + SDL_PushEvent(event); +} + +void Reset() +{ + GAMESTATE->Reset(); + PREFSMAN->ReadGamePrefsFromDisk(); + INPUTMAPPER->ReadMappingsFromDisk(); + GAMESTATE->m_bPlayersCanJoin = true; + + if( !GAMEMAN->DoesNoteSkinExist( GAMEMAN->GetCurNoteSkin() ) ) + { + CStringArray asNoteSkinNames; + GAMEMAN->GetNoteSkinNames( asNoteSkinNames ); + GAMEMAN->SwitchNoteSkin( asNoteSkinNames[0] ); + } + if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) ) + { + CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; + if( THEME->DoesThemeExist( sGameName ) ) + THEME->SwitchTheme( sGameName ); + else + THEME->SwitchTheme( "default" ); + } + PREFSMAN->SaveGamePrefsToDisk(); + + SCREENMAN->SetNewScreen( "ScreenCompany" ); // Change this to set a different initial screen +} static void GameLoop(); #include "SDL_utils.h" @@ -220,9 +253,7 @@ int main(int argc, char* argv[]) FONT = new FontManager; SCREENMAN = new ScreenManager; - - // normal game - SCREENMAN->SetNewScreen( "ScreenWarning" ); + Reset(); /* Run the main loop. */ GameLoop(); @@ -307,9 +338,10 @@ static void HandleInputEvents(float fDeltaTime) // pressed just F4 PREFSMAN->m_bWindowed = !PREFSMAN->m_bWindowed; ApplyGraphicOptions(); - // fall through + continue; /* why fall through? other code shouldn't be using * globally-bound keys -glenn */ + /* you're right. -Chris */ } } else if( type == IET_FIRST_PRESS && DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5)) diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 3ebcc614c4..57b74cfb58 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -60,7 +60,7 @@ IntDir=.\../Release6 TargetDir=\stepmania\stepmania TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -95,7 +95,7 @@ IntDir=.\../Debug6 TargetDir=\stepmania\stepmania TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index e425d76444..ee404e14ef 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -14,7 +14,9 @@ void ApplyGraphicOptions(); +void Exit(); +void Reset(); #endif diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 451872142b..78ffc90b51 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -192,6 +192,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + + + diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index ac456f60c2..ccc958b909 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -334,7 +334,7 @@ try_element_again: asPossibleElementFilePaths[0].GetString(), sNewFilePath.GetString()); #ifdef _DEBUG - if( MessageBox(NULL, "ThemeManager", message.GetString(), MB_RETRYCANCEL ) == IDRETRY) + if( MessageBox(NULL, message.GetString(), "ThemeManager", MB_RETRYCANCEL ) == IDRETRY) goto try_element_again; #endif RageException::Throw( "%s", message.GetString() ); diff --git a/stepmania/stepmania.nsi b/stepmania/stepmania.nsi index 879460c04a..0466e5f3d6 100644 --- a/stepmania/stepmania.nsi +++ b/stepmania/stepmania.nsi @@ -7,8 +7,8 @@ ; NOTE: this .NSI script is designed for NSIS v1.8+ Name "StepMania" -OutFile "stepmania310.exe" -!define PRODUCT_NAME "StepMania 3.1" +OutFile "stepmania301.exe" +!define PRODUCT_NAME "StepMania 3.01" ; Some default compiler settings (uncomment and change at will):