From ab9f558c6ed01d6181fa5d6a4ef2a4cf0bb86792 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 19 Jan 2003 04:44:22 +0000 Subject: [PATCH] Adding basic coin support --- stepmania/README-FIRST.TXT | 9 + stepmania/Themes/default/metrics.ini | 11 +- stepmania/src/Actor.cpp | 14 +- stepmania/src/Actor.h | 1 - stepmania/src/BitmapText.cpp | 5 +- stepmania/src/GameInput.h | 12 +- stepmania/src/GameManager.cpp | 48 ++--- stepmania/src/GameState.cpp | 6 +- stepmania/src/GameState.h | 1 + stepmania/src/MenuInput.h | 2 +- stepmania/src/MusicBannerWheel.cpp | 6 +- stepmania/src/NoteDisplay.cpp | 6 +- stepmania/src/PrefsManager.cpp | 9 + stepmania/src/PrefsManager.h | 8 +- stepmania/src/Screen.cpp | 20 ++ stepmania/src/Screen.h | 14 +- stepmania/src/ScreenAlbums.h | 5 +- stepmania/src/ScreenAttract.cpp | 100 ++++++---- stepmania/src/ScreenAttract.h | 7 +- stepmania/src/ScreenCompany.h | 5 +- stepmania/src/ScreenDemonstration.cpp | 93 +++++---- stepmania/src/ScreenDemonstration.h | 1 - stepmania/src/ScreenEz2SelectMusic.cpp | 2 +- stepmania/src/ScreenGameplay.cpp | 96 +++++----- stepmania/src/ScreenGameplay.h | 4 +- stepmania/src/ScreenGraphicOptions.cpp | 11 +- stepmania/src/ScreenHighScores.h | 6 +- stepmania/src/ScreenHowToPlay.h | 6 +- stepmania/src/ScreenLogo.cpp | 13 +- stepmania/src/ScreenLogo.h | 7 +- stepmania/src/ScreenMachineOptions.cpp | 12 ++ stepmania/src/ScreenManager.cpp | 30 ++- stepmania/src/ScreenMemoryCard.h | 5 +- stepmania/src/ScreenSelectGame.cpp | 4 +- stepmania/src/ScreenTitleMenu.cpp | 254 +++++++++++++++---------- stepmania/src/ScreenTitleMenu.h | 6 - stepmania/src/ScreenUnlock.h | 6 +- stepmania/src/ScreenWarning.h | 6 +- stepmania/src/StepMania.cpp | 12 +- stepmania/src/StepMania.h | 4 +- stepmania/src/StepMania.vcproj | 2 +- 41 files changed, 494 insertions(+), 375 deletions(-) diff --git a/stepmania/README-FIRST.TXT b/stepmania/README-FIRST.TXT index aa486423a2..e51b05d52d 100644 --- a/stepmania/README-FIRST.TXT +++ b/stepmania/README-FIRST.TXT @@ -115,6 +115,8 @@ are on right half. The following is a list of special keys: Any time: + * F1 = insert coin for player 1 + * F2 = insert coin for player 2 * F4 = toggle fullscreen * F5 = toggle detail * Hold Tab = increase game speed 4x (useful for moving through menus quickly) @@ -125,6 +127,13 @@ In menus: * Enter = Start * Escape = Back +In any attract screen: + * Left or Right = next attract screen + * F3 = toggle CoinMode + +In title menu: + * Escape = return to attract sequence + In gameplay: * F8 = toggle AutoPlay * F9 = decrease offset diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 4fa6084e19..e713be2cdc 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -37,7 +37,9 @@ ZoomNotSelected=1.0 ZoomSelected=1.3 SecondsBetweenComments=12 SecondsBeforeAttract=30 -HelpText=Use &UP; &DOWN; to select, then press START +HelpTextHome=Use &UP; &DOWN; to select, then press START +HelpTextPay=Insert coins, then press START +HelpTextFree=No charge to join in. Press START NextScreen=ScreenCaution [ScreenCaution] @@ -446,9 +448,9 @@ HelpText=&UP; &DOWN change line &LEFT; &RIGHT; change value START to cont [ScreenManager] StatsX=632 StatsY=10 -CreditsP1X=100 +CreditsP1X=120 CreditsP1Y=472 -CreditsP2X=540 +CreditsP2X=520 CreditsP2Y=472 CreditsColor=1,1,1,1 CreditsShadowLength=0 @@ -717,6 +719,9 @@ HiddenSongs=Some songs are only playable during Oni courses and::with roulette. ShowStats=Display Performance Statistics in the upper right corner::of the screen. FPS = frames per second.::TPF = triangles per frame. DPF = draws per frame. EasterEggs=Enable or disable some special easter eggs. MarvelousTiming=Enable or disable marvelous judgement. +CoinMode=When set to HOME, options will be shown on the title screen.::When set to PAY the title menu choices are hidden and you must::insert coins before joining in. When set to FREE the title menu::choices are hidden and you can joining in without inserting coins. +CoinsPerCredit=The number of coins that must be inserted before a player can join. +JointPremium=When set to OFF, game styles that require both sides of the machine::will cost 2 credits. When set to ON game styles that require both sides::of the machine will cost only 1 credit. [ScreenGraphicOptions] DisplayMode=Choose whether you would like StepMania to run full screen,::or to display in a window on your desktop. diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 7776429b47..b7b5dde9a9 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -205,21 +205,10 @@ 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 ) { @@ -269,6 +258,9 @@ void Actor::Update( float fDeltaTime ) } UpdateTweening( fDeltaTime ); + + if( m_bFirstUpdate ) + m_bFirstUpdate = false; } void Actor::BeginTweening( float time, TweenType tt ) diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 19c345deaa..1f309dc6ce 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -50,7 +50,6 @@ public: 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 ); diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index 9cb4f8bb87..5433aefb52 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -74,7 +74,10 @@ BitmapText::BitmapText() m_iWidestLineWidth = 0; - m_bShadow = true; + // Shadow should be off by default. It requires us to draw 2x as many verticies, + // and is better left baked into the font texture. +// m_bShadow = true; + m_bRainbow = false; } diff --git a/stepmania/src/GameInput.h b/stepmania/src/GameInput.h index 06e29f8cbe..4335e009d0 100644 --- a/stepmania/src/GameInput.h +++ b/stepmania/src/GameInput.h @@ -34,7 +34,7 @@ enum // DanceButtons DANCE_BUTTON_MENURIGHT, DANCE_BUTTON_MENUUP, DANCE_BUTTON_MENUDOWN, - DANCE_BUTTON_INSERTCOIN, + DANCE_BUTTON_COIN, NUM_DANCE_BUTTONS, // leave this at the end }; @@ -51,7 +51,7 @@ enum // PumpButtons PUMP_BUTTON_MENURIGHT, PUMP_BUTTON_MENUUP, PUMP_BUTTON_MENUDOWN, - PUMP_BUTTON_INSERTCOIN, + PUMP_BUTTON_COIN, NUM_PUMP_BUTTONS, // leave this at the end }; @@ -70,7 +70,7 @@ enum // EZ2Buttons EZ2_BUTTON_MENURIGHT, EZ2_BUTTON_MENUUP, EZ2_BUTTON_MENUDOWN, - EZ2_BUTTON_INSERTCOIN, + EZ2_BUTTON_COIN, NUM_EZ2_BUTTONS, // leave this at the end }; @@ -87,7 +87,7 @@ enum // ParaButtons PARA_BUTTON_MENURIGHT, PARA_BUTTON_MENUUP, PARA_BUTTON_MENUDOWN, - PARA_BUTTON_INSERTCOIN, + PARA_BUTTON_COIN, NUM_PARA_BUTTONS, // leave this at the end }; @@ -107,7 +107,7 @@ enum // 3DDX Buttons DS3DDX_BUTTON_MENURIGHT, DS3DDX_BUTTON_MENUUP, DS3DDX_BUTTON_MENUDOWN, - DS3DDX_BUTTON_INSERTCOIN, + DS3DDX_BUTTON_COIN, NUM_DS3DDX_BUTTONS, // leave this at the end. }; @@ -130,7 +130,7 @@ enum // BM Buttons BM_BUTTON_MENURIGHT, BM_BUTTON_MENUUP, BM_BUTTON_MENUDOWN, - BM_BUTTON_INSERTCOIN, + BM_BUTTON_COIN, NUM_BM_BUTTONS, // leave this at the end. }; diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 7cfb5007f8..d9222d9523 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -102,7 +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 + DANCE_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_SecondaryMenuButton DANCE_BUTTON_LEFT, // MENU_BUTTON_LEFT @@ -111,7 +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 + DANCE_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -127,7 +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 + SDLK_F1, // DANCE_BUTTON_COIN }, { // PLAYER_2 SDLK_KP4, // DANCE_BUTTON_LEFT, @@ -142,7 +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 + SDLK_F2, // DANCE_BUTTON_COIN }, } }, @@ -186,7 +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 + PUMP_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_SecondaryMenuButton PUMP_BUTTON_DOWNLEFT, // MENU_BUTTON_LEFT @@ -195,7 +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 + PUMP_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -210,7 +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 + SDLK_F1, // PUMP_BUTTON_COIN }, { // PLAYER_2 SDLK_KP7, // PUMP_BUTTON_UPLEFT, @@ -224,7 +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 + SDLK_F2, // PUMP_BUTTON_COIN }, } }, @@ -272,7 +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 + EZ2_BUTTON_COIN, // MENU_BUTTON_COIN }, { // m_SecondaryMenuButton EZ2_BUTTON_HANDUPLEFT, // MENU_BUTTON_LEFT @@ -281,7 +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 + EZ2_BUTTON_COIN, // MENU_BUTTON_COIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -298,7 +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 + SDLK_F1, // EZ2_BUTTON_COIN }, { // PLAYER_2 -1, // EZ2_BUTTON_FOOTUPLEFT, @@ -314,7 +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 + SDLK_F2, // EZ2_BUTTON_COIN }, }, }, @@ -358,7 +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 + PARA_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_SecondaryMenuButton PARA_BUTTON_LEFT, // MENU_BUTTON_LEFT @@ -367,7 +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 + PARA_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -382,7 +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 + SDLK_F1, // PARA_BUTTON_COIN }, { // PLAYER_2 -1, // PARA_BUTTON_LEFT, @@ -396,7 +396,7 @@ GameDef g_GameDefs[NUM_GAMES] = -1, //no default key // PARA_BUTTON_MENURIGHT -1, // PARA_BUTTON_MENUUP -1, - -1, // PARA_BUTTON_INSERTCOIN + -1, // PARA_BUTTON_COIN }, } }, @@ -446,7 +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 + DS3DDX_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_SecondaryMenuButton DS3DDX_BUTTON_HANDLEFT, // MENU_BUTTON_LEFT @@ -455,7 +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 + DS3DDX_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -473,7 +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 + SDLK_F1, // DS3DDX_BUTTON_COIN }, { // PLAYER_2 -1, // DS3DDX_BUTTON_HANDLEFT, @@ -490,7 +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 + -1, // DS3DDX_BUTTON_COIN }, } }, @@ -543,7 +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 + BM_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_SecondaryMenuButton BM_BUTTON_KEY1, // MENU_BUTTON_LEFT @@ -552,7 +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 + BM_BUTTON_COIN,// MENU_BUTTON_COIN }, { // m_iDefaultKeyboardKey { // PLAYER_1 @@ -571,7 +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 + SDLK_F1, // BM_BUTTON_COIN }, { // PLAYER_2 -1, // BM_BUTTON_KEY1, @@ -589,7 +589,7 @@ GameDef g_GameDefs[NUM_GAMES] = -1, // BM_BUTTON_MENURIGHT -1, // BM_BUTTON_MENUUP -1, // BM_BUTTON_MENUDOWN - -1, // BM_BUTTON_INSERTCOIN + -1, // BM_BUTTON_COIN }, } }, diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 0b60778c6e..99fd859f3d 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -38,6 +38,7 @@ GameState* GAMESTATE = NULL; // global and accessable from anywhere in our progr GameState::GameState() { m_CurGame = GAME_DANCE; + m_iCoins = 0; Reset(); } @@ -51,8 +52,9 @@ void GameState::Reset() m_CurStyle = STYLE_NONE; m_bPlayersCanJoin = false; - for( int i=0; i<2; i++ ) - m_bSideIsJoined[i] = false; + for( p=0; pm_fSongBeat; float fPercentIntoMeasure = fmodf( fSongBeat, g_fTapAnimationLengthInBeats ) / g_fTapAnimationLengthInBeats; fPercentIntoMeasure += 1/(iNumFrames*2.f); // fudge factor so that the "full white" frame shows when the arrow overlaps the receptors - int iSongBeatFrameContrib = fPercentIntoMeasure * iNumFrames; + int iSongBeatFrameContrib = roundf( fPercentIntoMeasure * iNumFrames ); float fBeatFraction = fmodf( fNoteBeat, 1.0f ); fBeatFraction = froundf( fBeatFraction, 0.25f ); - int iBeatFractionContrib = fBeatFraction * iNumFrames; + int iBeatFractionContrib = roundf( fBeatFraction * iNumFrames ); int iFrameNo; if( g_bAllowVivid && GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_ColorType == PlayerOptions::COLOR_VIVID ) @@ -114,7 +114,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float const float fYBodyTop = g_bDrawTapOnTopOfHoldHead ? fYHeadBottom : fYHead; // middle of head const float fYBodyBottom = fYTailTop; // top of tail - const int fYStep = fFrameHeight/4.f; // 4 segments per frame + const int fYStep = fFrameHeight/4; // 4 segments per frame DISPLAY->SetTexture( m_sprHoldParts.GetTexture() ); DISPLAY->SetBlendModeNormal(); diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index b9dd839451..a8e87b809c 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -73,6 +73,9 @@ PrefsManager::PrefsManager() m_bChangeBannersWhenFast = false; m_bEasterEggs = true; m_bMarvelousTiming = true; + m_CoinMode = COIN_HOME; + m_iCoinsPerCredit = 1; + m_bJointPremium = false; m_iBoostAppPriority = -1; /* I'd rather get occasional people asking for support for this even though it's @@ -137,6 +140,9 @@ PrefsManager::~PrefsManager() ini.GetValueB( "Options", "EasterEggs", m_bEasterEggs ); ini.GetValueB( "Options", "MarvelousTiming", m_bMarvelousTiming ); ini.GetValueF( "Options", "SoundVolume", m_fSoundVolume ); + ini.GetValueI( "Options", "CoinMode", (int&)m_CoinMode ); + ini.GetValueI( "Options", "CoinsPerCredit", m_iCoinsPerCredit ); + ini.GetValueB( "Options", "JointPremium", m_bJointPremium ); ini.GetValueI( "Options", "BoostAppPriority", m_iBoostAppPriority ); m_asAdditionalSongFolders.clear(); @@ -196,6 +202,9 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.SetValue ( "Options", "SoundDrivers", m_bSoundDrivers ); ini.SetValueB( "Options", "EasterEggs", m_bEasterEggs ); ini.SetValueB( "Options", "MarvelousTiming", m_bMarvelousTiming ); + ini.SetValueI( "Options", "CoinMode", (int&)m_CoinMode ); + ini.SetValueI( "Options", "CoinsPerCredit", m_iCoinsPerCredit ); + ini.SetValueB( "Options", "JointPremium", m_bJointPremium ); ini.SetValueI( "Options", "BoostAppPriority", m_iBoostAppPriority ); /* Only write these if they aren't the default. This ensures that we can change diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 6f8afbdac7..54ee70f443 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -18,8 +18,6 @@ public: PrefsManager(); ~PrefsManager(); - enum BackgroundMode { BGMODE_OFF, BGMODE_ANIMATIONS, BGMODE_MOVIEVIS, BGMODE_RANDOMMOVIES }; - // GameOptions (ARE saved between sessions) bool m_bWindowed; int m_iDisplayWidth; @@ -29,7 +27,7 @@ public: int m_iMaxTextureResolution; int m_iRefreshRate; bool m_bShowStats; - BackgroundMode m_BackgroundMode; + enum { BGMODE_OFF, BGMODE_ANIMATIONS, BGMODE_MOVIEVIS, BGMODE_RANDOMMOVIES } m_BackgroundMode; float m_fBGBrightness; int m_iMovieDecodeMS; bool m_bUseBGIfNoBanner; @@ -59,6 +57,10 @@ public: bool m_bChangeBannersWhenFast; bool m_bEasterEggs; bool m_bMarvelousTiming; + enum { COIN_HOME, COIN_PAY, COIN_FREE, NUM_COIN_MODES } m_CoinMode; + int m_iCoinsPerCredit; + bool m_bJointPremium; + /* 0 = no; 1 = yes; -1 = auto (do whatever is appropriate for the arch). */ int m_iBoostAppPriority; diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index 9bb0af2243..641e967e7b 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -14,6 +14,9 @@ #include "GameManager.h" #include "GameState.h" #include "PrefsManager.h" +#include "RageSound.h" +#include "ThemeManager.h" +#include "ScreenManager.h" Screen::Screen() { @@ -92,9 +95,26 @@ void Screen::Input( const DeviceInput& DeviceI, const InputEventType type, const case MENU_BUTTON_RIGHT: this->MenuRight( MenuI.player, type ); return; case MENU_BUTTON_BACK: this->MenuBack( MenuI.player, type ); return; case MENU_BUTTON_START: this->MenuStart( MenuI.player, type ); return; + case MENU_BUTTON_COIN: this->MenuCoin( MenuI.player, type ); return; } } +void Screen::MenuCoin( PlayerNumber pn ) +{ + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_PAY: + GAMESTATE->m_iCoins++; + SCREENMAN->RefreshCreditsMessages(); + // fall through + case PrefsManager::COIN_HOME: + case PrefsManager::COIN_FREE: + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","insert coin") ); + break; + default: + ASSERT(0); + } +} void Screen::SendScreenMessage( ScreenMessage SM, float fDelay ) { diff --git a/stepmania/src/Screen.h b/stepmania/src/Screen.h index e99605797d..c7700fc02b 100644 --- a/stepmania/src/Screen.h +++ b/stepmania/src/Screen.h @@ -57,13 +57,15 @@ public: virtual void MenuRight( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuRight(pn); } virtual void MenuStart( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuStart(pn); } virtual void MenuBack( PlayerNumber pn, const InputEventType type ); + virtual void MenuCoin( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuCoin(pn); } - virtual void MenuUp( PlayerNumber pn ) {}; - virtual void MenuDown( PlayerNumber pn ) {}; - virtual void MenuLeft( PlayerNumber pn ) {}; - virtual void MenuRight( PlayerNumber pn ) {}; - virtual void MenuStart( PlayerNumber pn ) {}; - virtual void MenuBack( PlayerNumber pn ) {}; + virtual void MenuUp( PlayerNumber pn ) {} + virtual void MenuDown( PlayerNumber pn ) {} + virtual void MenuLeft( PlayerNumber pn ) {} + virtual void MenuRight( PlayerNumber pn ) {} + virtual void MenuStart( PlayerNumber pn ) {} + virtual void MenuBack( PlayerNumber pn ) {} + virtual void MenuCoin( PlayerNumber pn ); private: bool m_FirstUpdate; diff --git a/stepmania/src/ScreenAlbums.h b/stepmania/src/ScreenAlbums.h index 45593f47eb..323bb05cb6 100644 --- a/stepmania/src/ScreenAlbums.h +++ b/stepmania/src/ScreenAlbums.h @@ -15,10 +15,7 @@ class ScreenAlbums : public ScreenAttract { public: - -private: - virtual CString GetMetricName() { return "Albums"; }; // used to loop up theme metrics - virtual CString GetElementName() { return "albums"; }; // used to loop up theme elements + ScreenAlbums() : ScreenAttract("Albums","albums") { }; }; diff --git a/stepmania/src/ScreenAttract.cpp b/stepmania/src/ScreenAttract.cpp index 874b75fc0e..180fc842ba 100644 --- a/stepmania/src/ScreenAttract.cpp +++ b/stepmania/src/ScreenAttract.cpp @@ -27,16 +27,39 @@ #include "RageSoundManager.h" -#define SECONDS_TO_SHOW THEME->GetMetricF("Screen"+this->GetMetricName(),"SecondsToShow") -#define NEXT_SCREEN THEME->GetMetric("Screen"+this->GetMetricName(),"NextScreen") +#define SECONDS_TO_SHOW THEME->GetMetricF("Screen"+m_sMetricName,"SecondsToShow") +#define NEXT_SCREEN THEME->GetMetric("Screen"+m_sMetricName,"NextScreen") const ScreenMessage SM_BeginFadingOut = ScreenMessage(SM_User+2); const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+3); -ScreenAttract::ScreenAttract() +ScreenAttract::ScreenAttract( CString sMetricName, CString sElementName ) { - LOG->Trace( "ScreenAttract::ScreenAttract()" ); + LOG->Trace( "ScreenAttract::ScreenAttract(%s, %s)", sMetricName.c_str(), sElementName.c_str() ); + + m_sMetricName = sMetricName; + m_sElementName = sElementName; + + // 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",m_sElementName) ); + this->AddChild( &m_Background ); + + m_Fade.SetClosed(); + m_Fade.OpenWipingRight( SM_None ); + this->AddChild( &m_Fade ); + + SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo(m_sElementName) ); + + m_soundStart.Load( THEME->GetPathTo("Sounds","menu start") ); + + m_soundMusic.Load( THEME->GetPathTo("Sounds",m_sElementName + " music") ); + m_soundMusic.Play(); + + GAMESTATE->m_bPlayersCanJoin = true; + + this->SendScreenMessage( SM_BeginFadingOut, SECONDS_TO_SHOW ); } @@ -48,12 +71,24 @@ ScreenAttract::~ScreenAttract() void ScreenAttract::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { -// LOG->Trace( "ScreenAttract::Input()" ); + LOG->Trace( "ScreenAttract::Input()" ); if(type != IET_FIRST_PRESS) return; // don't care - if( m_Fade.IsOpening() || m_Fade.IsClosing() ) + if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == SDLK_F3 ) + { + (int&)PREFSMAN->m_CoinMode = (PREFSMAN->m_CoinMode+1) % PrefsManager::NUM_COIN_MODES; + ResetGame(); + CString sMessage = "Coin Mode: "; + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_HOME: sMessage += "HOME"; break; + case PrefsManager::COIN_PAY: sMessage += "PAY"; break; + case PrefsManager::COIN_FREE: sMessage += "FREE"; break; + } + SCREENMAN->SystemMessage( sMessage ); return; + } if( MenuI.IsValid() ) { @@ -61,20 +96,34 @@ void ScreenAttract::Input( const DeviceInput& DeviceI, const InputEventType type { case MENU_BUTTON_LEFT: case MENU_BUTTON_RIGHT: - m_Fade.CloseWipingRight( SM_GoToNextScreen ); + if( !m_Fade.IsOpening() && !m_Fade.IsClosing() ) + m_Fade.CloseWipingRight( SM_GoToNextScreen ); break; - case MENU_BUTTON_START: + case MENU_BUTTON_COIN: + Screen::MenuCoin( MenuI.player ); // increment coins, play sound 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 + ::Sleep( 200 ); // do a little pause, like the arcade does SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); break; + case MENU_BUTTON_START: case MENU_BUTTON_BACK: - Exit(); + + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_PAY: + if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit ) + break; // don't fall through + // fall through + case PrefsManager::COIN_FREE: + case PrefsManager::COIN_HOME: + m_soundMusic.Stop(); + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","insert coin") ); + ::Sleep( 200 ); // do a little pause, like the arcade does + SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + break; + default: + ASSERT(0); + } break; } } @@ -82,27 +131,6 @@ void ScreenAttract::Input( const DeviceInput& DeviceI, const InputEventType type // 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") ); - - m_soundMusic.Load( THEME->GetPathTo("Sounds",this->GetElementName() + " music") ); - m_soundMusic.Play(); - - this->SendScreenMessage( SM_BeginFadingOut, SECONDS_TO_SHOW ); -} - void ScreenAttract::Update( float fDelta ) { Screen::Update(fDelta); diff --git a/stepmania/src/ScreenAttract.h b/stepmania/src/ScreenAttract.h index 86ce8e38a2..3902930c3c 100644 --- a/stepmania/src/ScreenAttract.h +++ b/stepmania/src/ScreenAttract.h @@ -25,18 +25,17 @@ class ScreenAttract : public Screen { public: - ScreenAttract(); + ScreenAttract( CString sMetricName, CString sElementName ); 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 ); protected: - virtual CString GetMetricName() = 0; // used to loop up theme metrics - virtual CString GetElementName() = 0; // used to loop up theme elements + CString m_sMetricName; // used to loop up theme metrics + CString m_sElementName; // used to loop up theme elements BGAnimation m_Background; TransitionFade m_Fade; diff --git a/stepmania/src/ScreenCompany.h b/stepmania/src/ScreenCompany.h index 9c62e9905a..901f9404bf 100644 --- a/stepmania/src/ScreenCompany.h +++ b/stepmania/src/ScreenCompany.h @@ -15,10 +15,7 @@ class ScreenCompany : public ScreenAttract { public: - -private: - virtual CString GetMetricName() { return "Company"; }; // used to look up theme metrics - virtual CString GetElementName() { return "company"; }; // used to look up theme elements + ScreenCompany() : ScreenAttract("Company","company") { }; }; diff --git a/stepmania/src/ScreenDemonstration.cpp b/stepmania/src/ScreenDemonstration.cpp index be5aad5e6d..ee849d336a 100644 --- a/stepmania/src/ScreenDemonstration.cpp +++ b/stepmania/src/ScreenDemonstration.cpp @@ -27,12 +27,8 @@ const ScreenMessage SM_BeginFadingToNextScreen = ScreenMessage(SM_User+1000); const ScreenMessage SM_GoToNextScreen = ScreenMessage(SM_User+1002); -ScreenDemonstration::ScreenDemonstration() : ScreenGameplay( false ) +bool SetUpSongOptions() // always return true. { - LOG->Trace( "ScreenDemonstration::ScreenDemonstration()" ); - GAMESTATE->m_bDemonstration = true; - - // // Set the current song to prepare for a demonstration // @@ -60,8 +56,8 @@ ScreenDemonstration::ScreenDemonstration() : ScreenGameplay( false ) if( pSong == NULL ) // returns NULL there are no songs { // we didn't find a song. Abort demonstration. - this->SendScreenMessage( SM_GoToNextScreen, 0 ); - return; + SCREENMAN->SendMessageToTopScreen( SM_GoToNextScreen, 0 ); + return true; } if( pSong->m_apNotes.empty() ) @@ -136,22 +132,14 @@ ScreenDemonstration::ScreenDemonstration() : ScreenGameplay( false ) GAMESTATE->m_SongOptions.m_LifeType = (randomf(0,1)>0.8f) ? SongOptions::LIFE_BATTERY : SongOptions::LIFE_BAR; GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF; + + return true; } -ScreenDemonstration::~ScreenDemonstration() +ScreenDemonstration::ScreenDemonstration() : ScreenGameplay(SetUpSongOptions()) // this is a hack to get some code to execute before the ScreenGameplay constructor { - GAMESTATE->m_bDemonstration = false; - GAMESTATE->Reset(); -} - -void ScreenDemonstration::FirstUpdate() -{ - LOG->Trace( "ScreenDemonstration::FirstUpdate()" ); - - if( GAMESTATE->m_pCurSong == NULL ) - return; - - ScreenGameplay::FirstUpdate(); + LOG->Trace( "ScreenDemonstration::ScreenDemonstration()" ); + GAMESTATE->m_bDemonstration = true; m_sprDemonstrationOverlay.Load( THEME->GetPathTo("Graphics","demonstration overlay") ); @@ -165,21 +153,21 @@ void ScreenDemonstration::FirstUpdate() m_Fade.OpenWipingRight(); - this->ClearMessageQueue(); // remove all of the messages set in ScreenGameplay that animate "ready", "here we go", etc. + 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 ); } +ScreenDemonstration::~ScreenDemonstration() +{ + GAMESTATE->m_bDemonstration = false; + GAMESTATE->Reset(); +} + void ScreenDemonstration::Update( float fDeltaTime ) { - if( GAMESTATE->m_pCurSong == NULL ) - { - Screen::Update(fDeltaTime); // handle screen messages - return; - } - ScreenGameplay::Update( fDeltaTime ); // hide status icons @@ -191,10 +179,27 @@ void ScreenDemonstration::Input( const DeviceInput& DeviceI, const InputEventTyp { //LOG->Trace( "ScreenDemonstration::Input()" ); + + // + // This should be the same as ScreenAttract::Input() + // + if(type != IET_FIRST_PRESS) return; // don't care - if( m_Fade.IsClosing() ) + if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == SDLK_F3 ) + { + (int&)PREFSMAN->m_CoinMode = (PREFSMAN->m_CoinMode+1) % PrefsManager::NUM_COIN_MODES; + ResetGame(); + CString sMessage = "Coin Mode: "; + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_HOME: sMessage += "HOME"; break; + case PrefsManager::COIN_PAY: sMessage += "PAY"; break; + case PrefsManager::COIN_FREE: sMessage += "FREE"; break; + } + SCREENMAN->SystemMessage( sMessage ); return; + } if( MenuI.IsValid() ) { @@ -202,20 +207,34 @@ void ScreenDemonstration::Input( const DeviceInput& DeviceI, const InputEventTyp { case MENU_BUTTON_LEFT: case MENU_BUTTON_RIGHT: - m_Fade.CloseWipingRight( SM_GoToNextScreen ); + if( !m_Fade.IsOpening() && !m_Fade.IsClosing() ) + m_Fade.CloseWipingRight( SM_GoToNextScreen ); break; - case MENU_BUTTON_START: + case MENU_BUTTON_COIN: + Screen::MenuCoin( MenuI.player ); // increment coins, play sound 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 + ::Sleep( 200 ); // do a little pause, like the arcade does SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); break; + case MENU_BUTTON_START: case MENU_BUTTON_BACK: - Exit(); + + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_PAY: + if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit ) + break; // don't fall through + // fall through + case PrefsManager::COIN_FREE: + case PrefsManager::COIN_HOME: + m_soundMusic.Stop(); + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","insert coin") ); + ::Sleep( 200 ); // do a little pause, like the arcade does + SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + break; + default: + ASSERT(0); + } break; } } diff --git a/stepmania/src/ScreenDemonstration.h b/stepmania/src/ScreenDemonstration.h index 4147530119..722f076821 100644 --- a/stepmania/src/ScreenDemonstration.h +++ b/stepmania/src/ScreenDemonstration.h @@ -19,7 +19,6 @@ 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 ); diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index 1048df8cf1..99d41ca235 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -226,7 +226,7 @@ void ScreenEz2SelectMusic::UpdateOptions(PlayerNumber pn, int nosound) m_MirrorIcon[pn].SetDiffuse( RageColor(0,0,0,0) ); m_ShuffleIcon[pn].SetDiffuse( RageColor(0,0,0,0) ); - for(int i=0; iTrace( "ScreenGameplay::ScreenGameplay()" ); - /* Important! Don't do any with GAMESTATE in the ScreenGameplay constructor. - * ScreenDemonstration sets the song and other properties in its constructor, - * which is always called after the ScreenGameplay constructor. Instead, - * do this initialization in FirstUpdate() - */ + int p; - for( int 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 */ + /* It's OK to operate on GAMESTATE here, but not in the constructor */ GAMESTATE->ResetStageStatistics(); // clear values // Update possible dance points - for( int p=0; pIsPlayerEnabled(p) ) continue; // skip @@ -466,6 +418,44 @@ void ScreenGameplay::FirstUpdate() this->SendScreenMessage( ScreenMessage(SM_User+i), i/2.0f ); // Send messages to we can get the introduction rolling LoadNextSong( true ); + + + m_soundToasty.Load( THEME->GetPathTo("Sounds","gameplay toasty") ); + + + if( 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") ); } ScreenGameplay::~ScreenGameplay() diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 4e544586c7..0e18e67f83 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -49,9 +49,9 @@ const ScreenMessage SM_ComboStopped = ScreenMessage(SM_User+210); class ScreenGameplay : public Screen { public: - ScreenGameplay( bool bLoadSounds = true ); + ScreenGameplay( bool bDemonstration = 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 ); diff --git a/stepmania/src/ScreenGraphicOptions.cpp b/stepmania/src/ScreenGraphicOptions.cpp index 1b75d9c222..db1685e3e8 100644 --- a/stepmania/src/ScreenGraphicOptions.cpp +++ b/stepmania/src/ScreenGraphicOptions.cpp @@ -29,6 +29,7 @@ enum { GO_DISPLAY_COLOR_DEPTH, GO_MAX_TEXTURE_RESOLUTION, GO_TEXTURE_COLOR_DEPTH, + GO_KEEP_TEXTURES_IN_MEM, GO_REFRESH_RATE, GO_BGMODE, GO_BGBRIGHTNESS, @@ -43,6 +44,7 @@ OptionRowData g_GraphicOptionsLines[NUM_GRAPHIC_OPTIONS_LINES] = { { "Display\nColor", 2, {"16BIT","32BIT"} }, { "Max Texture\nResolution",4, {"256","512","1024","2048"} }, { "Texture\nColor", 2, {"16BIT","32BIT"} }, + { "Keep Textures\nIn Memory",2, {"NO","YES"} }, { "Refresh\nRate", 11, {"DEFAULT","60","70","72","75","80","85","90","100","120","150"} }, { "Background\nMode", 4, {"OFF","ANIMATIONS","VISUALIZATIONS","RANDOM MOVIES"} }, { "Background\nBrightness", 11, {"0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%"} }, @@ -144,6 +146,8 @@ void ScreenGraphicOptions::ImportOptions() case 32: m_iSelectedOption[0][GO_TEXTURE_COLOR_DEPTH] = 1; break; } + m_iSelectedOption[0][GO_KEEP_TEXTURES_IN_MEM] = PREFSMAN->m_iUnloadTextureDelaySeconds>0 ? 1:0; + switch(PREFSMAN->m_iRefreshRate) { case REFRESH_DEFAULT: m_iSelectedOption[0][GO_REFRESH_RATE] = 0; break; @@ -189,14 +193,17 @@ void ScreenGraphicOptions::ExportOptions() default: ASSERT(0); PREFSMAN->m_iTextureColorDepth = 16; break; } + PREFSMAN->m_iUnloadTextureDelaySeconds = (m_iSelectedOption[0][GO_KEEP_TEXTURES_IN_MEM] == 1) ? 1200 : 0; // 20 mins + if(m_iSelectedOption[0][GO_REFRESH_RATE] == 0) PREFSMAN->m_iRefreshRate = REFRESH_DEFAULT; - else { + else + { int n = m_iSelectedOption[0][GO_REFRESH_RATE]; PREFSMAN->m_iRefreshRate = atoi(g_GraphicOptionsLines[GO_REFRESH_RATE].szOptionsText[n]); } - PREFSMAN->m_BackgroundMode = PrefsManager::BackgroundMode( m_iSelectedOption[0][GO_BGMODE] ); + (int&)PREFSMAN->m_BackgroundMode = m_iSelectedOption[0][GO_BGMODE]; PREFSMAN->m_fBGBrightness = m_iSelectedOption[0][GO_BGBRIGHTNESS] / 10.0f; PREFSMAN->m_iMovieDecodeMS = m_iSelectedOption[0][GO_MOVIEDECODEMS]+1; PREFSMAN->m_bUseBGIfNoBanner = m_iSelectedOption[0][GO_BGIFNOBANNER] == 1; diff --git a/stepmania/src/ScreenHighScores.h b/stepmania/src/ScreenHighScores.h index 1529a270d3..c0a098e5ba 100644 --- a/stepmania/src/ScreenHighScores.h +++ b/stepmania/src/ScreenHighScores.h @@ -15,11 +15,7 @@ class ScreenHighScores : public ScreenAttract { public: - -private: - virtual CString GetMetricName() { return "HighScores"; }; // used to loop up theme metrics - virtual CString GetElementName() { return "high scores"; }; // used to loop up theme elements - + ScreenHighScores() : ScreenAttract("HighScores","high scores") { }; }; diff --git a/stepmania/src/ScreenHowToPlay.h b/stepmania/src/ScreenHowToPlay.h index 1db68e9e65..de6c537532 100644 --- a/stepmania/src/ScreenHowToPlay.h +++ b/stepmania/src/ScreenHowToPlay.h @@ -15,11 +15,7 @@ class ScreenHowToPlay : public ScreenAttract { public: - -private: - virtual CString GetMetricName() { return "HowToPlay"; }; // used to look up theme metrics - virtual CString GetElementName() { return "how to play"; }; // used to look up theme elements - + ScreenHowToPlay() : ScreenAttract("HowToPlay","how to play") {}; }; diff --git a/stepmania/src/ScreenLogo.cpp b/stepmania/src/ScreenLogo.cpp index dd848baac7..0e719b9bde 100644 --- a/stepmania/src/ScreenLogo.cpp +++ b/stepmania/src/ScreenLogo.cpp @@ -24,18 +24,9 @@ #define SONGS_X THEME->GetMetricF("ScreenLogo","SongsX") #define SONGS_Y THEME->GetMetricF("ScreenLogo","SongsY") -ScreenLogo::ScreenLogo() + +ScreenLogo::ScreenLogo() : ScreenAttract("Logo","logo") { - LOG->Trace( "ScreenLogo::ScreenLogo()" ); - -} - -void ScreenLogo::FirstUpdate() -{ - ScreenAttract::FirstUpdate(); - - // we have to do init here because ScreenAttract does it's initialization in FirstUpdate() - m_sprLogo.Load( THEME->GetPathTo("Graphics",ssprintf("logo %s",GAMESTATE->GetCurrentGameDef()->m_szName)) ); m_sprLogo.SetXY( LOGO_X, LOGO_Y ); m_sprLogo.SetGlow( RageColor(1,1,1,1) ); diff --git a/stepmania/src/ScreenLogo.h b/stepmania/src/ScreenLogo.h index 708e37c840..ae6e0391fe 100644 --- a/stepmania/src/ScreenLogo.h +++ b/stepmania/src/ScreenLogo.h @@ -19,12 +19,7 @@ class ScreenLogo : public ScreenAttract public: ScreenLogo(); - virtual void FirstUpdate(); - -private: - virtual CString GetMetricName() { return "Logo"; }; // used to look up theme metrics - virtual CString GetElementName() { return "logo"; }; // used to look up theme elements - +protected: Sprite m_sprLogo; BitmapText m_textVersion; BitmapText m_textSongs; diff --git a/stepmania/src/ScreenMachineOptions.cpp b/stepmania/src/ScreenMachineOptions.cpp index be8828be9c..16a48a543d 100644 --- a/stepmania/src/ScreenMachineOptions.cpp +++ b/stepmania/src/ScreenMachineOptions.cpp @@ -33,6 +33,9 @@ enum { MO_SHOWSTATS, MO_EASTER_EGGS, MO_MARVELOUS, + MO_COIN_MODE, + MO_COINS_PER_CREDIT, + MO_JOINT_PREMIUM, NUM_MACHINE_OPTIONS_LINES }; /* Hmm. Ignore JoyAxes and Back Delayed probably belong in "input options", @@ -47,6 +50,9 @@ OptionRowData g_MachineOptionsLines[NUM_MACHINE_OPTIONS_LINES] = { { "Show\nStats", 2, {"OFF","ON"} }, { "Easter\nEggs", 2, {"OFF","ON"} }, { "Marvelous\nTiming", 2, {"OFF","ON"} }, + { "Coin\nMode", 3, {"HOME","PAY","FREE PLAY"} }, + { "Coins Per\nCredit", 8, {"1","2","3","4","5","6","7","8"} }, + { "Joint\nPremium", 2, {"OFF","ON"} }, }; ScreenMachineOptions::ScreenMachineOptions() : @@ -114,6 +120,9 @@ void ScreenMachineOptions::ImportOptions() m_iSelectedOption[0][MO_SHOWSTATS] = PREFSMAN->m_bShowStats ? 1:0; m_iSelectedOption[0][MO_EASTER_EGGS] = PREFSMAN->m_bEasterEggs ? 1:0; m_iSelectedOption[0][MO_MARVELOUS] = PREFSMAN->m_bMarvelousTiming ? 1:0; + m_iSelectedOption[0][MO_COIN_MODE] = PREFSMAN->m_CoinMode; + m_iSelectedOption[0][MO_COINS_PER_CREDIT] = PREFSMAN->m_iCoinsPerCredit - 1; + m_iSelectedOption[0][MO_JOINT_PREMIUM] = PREFSMAN->m_bJointPremium ? 1:0; } void ScreenMachineOptions::ExportOptions() @@ -152,6 +161,9 @@ void ScreenMachineOptions::ExportOptions() PREFSMAN->m_bShowStats = m_iSelectedOption[0][MO_SHOWSTATS] == 1; PREFSMAN->m_bEasterEggs = m_iSelectedOption[0][MO_EASTER_EGGS] == 1; PREFSMAN->m_bMarvelousTiming = m_iSelectedOption[0][MO_MARVELOUS] == 1; + (int&)PREFSMAN->m_CoinMode = m_iSelectedOption[0][MO_COIN_MODE]; + PREFSMAN->m_iCoinsPerCredit = m_iSelectedOption[0][MO_COINS_PER_CREDIT] + 1; + PREFSMAN->m_bJointPremium = m_iSelectedOption[0][MO_JOINT_PREMIUM] == 1; } void ScreenMachineOptions::GoToPrevState() diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index 2c9b89e917..94aa7e4ff3 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -51,8 +51,8 @@ ScreenManager::ScreenManager() m_textSystemMessage.SetHorizAlign( Actor::align_left ); m_textSystemMessage.SetVertAlign( Actor::align_top ); m_textSystemMessage.SetXY( 4.0f, 4.0f ); - m_textSystemMessage.SetZoom( 0.5f ); - m_textSystemMessage.SetShadowLength( 2 ); + m_textSystemMessage.SetZoom( 1.0f ); +// m_textSystemMessage.SetShadowLength( 2 ); m_textSystemMessage.SetDiffuse( RageColor(1,1,1,0) ); } @@ -248,7 +248,7 @@ Screen* ScreenManager::MakeNewScreen( CString sClassName ) else if( 0==stricmp(sClassName, "ScreenAlbums") ) ret = new ScreenAlbums; 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, "ScreenDemonstration") ) ret = (ScreenGameplay*)new ScreenDemonstration; else if( 0==stricmp(sClassName, "ScreenInstructions") ) ret = new ScreenInstructions; else RageException::Throw( "Invalid Screen class name '%s'", sClassName.GetString() ); @@ -381,10 +381,26 @@ void ScreenManager::RefreshCreditsMessages() m_textCreditInfo[p].SetXY( CREDITS_X(p), CREDITS_Y(p) ); m_textCreditInfo[p].SetZoom( CREDITS_ZOOM ); m_textCreditInfo[p].SetDiffuse( CREDITS_COLOR ); - m_textCreditInfo[p].SetShadowLength( CREDITS_SHADOW_LENGTH ); +// m_textCreditInfo[p].SetShadowLength( CREDITS_SHADOW_LENGTH ); - if( GAMESTATE->m_bSideIsJoined[p] ) m_textCreditInfo[p].SetText( "" ); - else if( GAMESTATE->m_bPlayersCanJoin ) m_textCreditInfo[p].SetText( "PRESS START" ); - else m_textCreditInfo[p].SetText( "CREDIT(S) 0 / 0" ); + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_HOME: + if( GAMESTATE->m_bSideIsJoined[p] ) + m_textCreditInfo[p].SetText( "" ); + else if( GAMESTATE->m_bPlayersCanJoin ) + m_textCreditInfo[p].SetText( "PRESS START" ); + else + m_textCreditInfo[p].SetText( "NOT PRESENT" ); + break; + case PrefsManager::COIN_PAY: + m_textCreditInfo[p].SetText( ssprintf("CREDIT(S) %d / %d", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit ) ); + break; + case PrefsManager::COIN_FREE: + m_textCreditInfo[p].SetText( "FREE PLAY" ); + break; + default: + ASSERT(0); + } } } diff --git a/stepmania/src/ScreenMemoryCard.h b/stepmania/src/ScreenMemoryCard.h index f3ff7bb553..0a51a35922 100644 --- a/stepmania/src/ScreenMemoryCard.h +++ b/stepmania/src/ScreenMemoryCard.h @@ -15,10 +15,7 @@ class ScreenMemoryCard : public ScreenAttract { public: - -private: - virtual CString GetMetricName() { return "MemoryCard"; }; // used to look up theme metrics - virtual CString GetElementName() { return "memory card"; }; // used to look up theme elements + ScreenMemoryCard() : ScreenAttract("MemoryCard","memory card") { }; }; diff --git a/stepmania/src/ScreenSelectGame.cpp b/stepmania/src/ScreenSelectGame.cpp index 25f85e7b2a..7e00fb4f7b 100644 --- a/stepmania/src/ScreenSelectGame.cpp +++ b/stepmania/src/ScreenSelectGame.cpp @@ -101,12 +101,12 @@ void ScreenSelectGame::ExportOptions() void ScreenSelectGame::GoToPrevState() { - Reset(); + ResetGame(); } void ScreenSelectGame::GoToNextState() { - Reset(); + ResetGame(); } diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 5fb35936f6..127f3b2e3e 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -54,7 +54,9 @@ const CString CHOICE_TEXT[ScreenTitleMenu::NUM_TITLE_MENU_CHOICES] = { #define ZOOM_SELECTED THEME->GetMetricF("ScreenTitleMenu","ZoomSelected") #define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("ScreenTitleMenu","SecondsBetweenComments") #define SECONDS_BEFORE_ATTRACT THEME->GetMetricF("ScreenTitleMenu","SecondsBeforeAttract") -#define HELP_TEXT THEME->GetMetric("ScreenTitleMenu","HelpText") +#define HELP_TEXT_HOME THEME->GetMetric("ScreenTitleMenu","HelpTextHome") +#define HELP_TEXT_PAY THEME->GetMetric("ScreenTitleMenu","HelpTextPay") +#define HELP_TEXT_FREE THEME->GetMetric("ScreenTitleMenu","HelpTextFree") #define NEXT_SCREEN THEME->GetMetric("ScreenTitleMenu","NextScreen") const ScreenMessage SM_PlayComment = ScreenMessage(SM_User+1); @@ -65,33 +67,47 @@ const ScreenMessage SM_GoToAttractLoop = ScreenMessage(SM_User+13); ScreenTitleMenu::ScreenTitleMenu() { LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" ); -} -void ScreenTitleMenu::FirstUpdate() -{ - LOG->Trace( "ScreenTitleMenu::FirstUpdate()" ); - ScreenLogo::FirstUpdate(); - - // we have to do init here because ScreenLogo does it's initialization in FirstUpdate() m_textHelp.LoadFromFont( THEME->GetPathTo("Fonts","help") ); - m_textHelp.SetText( HELP_TEXT ); + CString sHelpText; + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_HOME: sHelpText = HELP_TEXT_HOME; break; + case PrefsManager::COIN_PAY: sHelpText = HELP_TEXT_PAY; break; + case PrefsManager::COIN_FREE: sHelpText = HELP_TEXT_FREE; break; + default: ASSERT(0); + } + m_textHelp.SetText( sHelpText ); m_textHelp.SetXY( HELP_X, HELP_Y ); m_textHelp.SetZoom( 0.5f ); m_textHelp.SetEffectBlinking(); + m_textHelp.TurnShadowOn(); m_textHelp.SetShadowLength( 2 ); this->AddChild( &m_textHelp ); - int i; - for( i=0; i< NUM_TITLE_MENU_CHOICES; i++ ) + switch( PREFSMAN->m_CoinMode ) { - m_textChoice[i].LoadFromFont( THEME->GetPathTo("Fonts","titlemenu") ); - m_textChoice[i].SetText( CHOICE_TEXT[i] ); - m_textChoice[i].SetXY( CHOICES_X, CHOICES_START_Y + i*CHOICES_SPACING_Y ); - float fShadowLength = CHOICES_SHADOW_LENGTH; - m_textChoice[i].SetShadowLength( fShadowLength ); - this->AddChild( &m_textChoice[i] ); - } + case PrefsManager::COIN_HOME: + int i; + for( i=0; i< NUM_TITLE_MENU_CHOICES; i++ ) + { + m_textChoice[i].LoadFromFont( THEME->GetPathTo("Fonts","titlemenu") ); + m_textChoice[i].SetText( CHOICE_TEXT[i] ); + m_textChoice[i].SetXY( CHOICES_X, CHOICES_START_Y + i*CHOICES_SPACING_Y ); + m_textChoice[i].SetShadowLength( CHOICES_SHADOW_LENGTH ); + m_textChoice[i].TurnShadowOn(); + this->AddChild( &m_textChoice[i] ); + } + break; + case PrefsManager::COIN_PAY: + break; + case PrefsManager::COIN_FREE: + break; + default: + ASSERT(0); + } + SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("title menu game name") ); @@ -103,7 +119,7 @@ void ScreenTitleMenu::FirstUpdate() m_TitleMenuChoice = CHOICE_GAME_START; - for( i=0; iTrace( "ScreenTitleMenu::Input()" ); LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", DeviceI.device, DeviceI.button ); // debugging gameport joystick problem - if( m_Fade.IsClosing() ) + if( type != IET_FIRST_PRESS ) return; + if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == SDLK_F3 ) + { + (int&)PREFSMAN->m_CoinMode = (PREFSMAN->m_CoinMode+1) % PrefsManager::NUM_COIN_MODES; + ResetGame(); + CString sMessage = "Coin Mode: "; + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_HOME: sMessage += "HOME"; break; + case PrefsManager::COIN_PAY: sMessage += "PAY"; break; + case PrefsManager::COIN_FREE: sMessage += "FREE"; break; + } + SCREENMAN->SystemMessage( sMessage ); + return; + } + + if( !MenuI.IsValid() ) + return; + + switch( MenuI.button ) + { + case MENU_BUTTON_UP: + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_HOME: + TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */ + LoseFocus( m_TitleMenuChoice ); + if( m_TitleMenuChoice == 0 ) // wrap around + m_TitleMenuChoice = (ScreenTitleMenu::TitleMenuChoice)((int)NUM_TITLE_MENU_CHOICES); + m_TitleMenuChoice = TitleMenuChoice( m_TitleMenuChoice-1 ); + m_soundChange.PlayRandom(); + GainFocus( m_TitleMenuChoice ); + break; + case PrefsManager::COIN_PAY: + case PrefsManager::COIN_FREE: + return; // ignore + } + break; + case MENU_BUTTON_DOWN: + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_HOME: + TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */ + LoseFocus( m_TitleMenuChoice ); + if( m_TitleMenuChoice == (int)ScreenTitleMenu::NUM_TITLE_MENU_CHOICES-1 ) + m_TitleMenuChoice = (TitleMenuChoice)-1; // wrap around + m_TitleMenuChoice = TitleMenuChoice( m_TitleMenuChoice+1 ); + m_soundChange.PlayRandom(); + GainFocus( m_TitleMenuChoice ); + break; + case PrefsManager::COIN_PAY: + case PrefsManager::COIN_FREE: + return; // ignore + } + break; + case MENU_BUTTON_BACK: + m_Fade.CloseWipingRight( SM_GoToAttractLoop ); + break; + case MENU_BUTTON_START: + switch( PREFSMAN->m_CoinMode ) + { + case PrefsManager::COIN_PAY: + if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit ) + break; // not enough coins + else + GAMESTATE->m_iCoins -= PREFSMAN->m_iCoinsPerCredit; + // fall through + case PrefsManager::COIN_HOME: + case PrefsManager::COIN_FREE: + GAMESTATE->m_bSideIsJoined[MenuI.player] = true; + GAMESTATE->m_MasterPlayerNumber = MenuI.player; + GAMESTATE->m_bPlayersCanJoin = false; + + switch( m_TitleMenuChoice ) + { + case CHOICE_GAME_START: + case CHOICE_SELECT_GAME: + case CHOICE_MAP_INSTRUMENTS: + case CHOICE_INPUT_OPTIONS: + case CHOICE_MACHINE_OPTIONS: + case CHOICE_GRAPHIC_OPTIONS: + case CHOICE_APPEARANCE_OPTIONS: + #ifdef _DEBUG + case CHOICE_SANDBOX: + #endif + m_soundSelect.PlayRandom(); + m_Fade.CloseWipingRight( SM_GoToNextScreen ); + break; + case CHOICE_EDIT: + if( SONGMAN->m_pSongs.empty() ) + { + m_soundInvalid.PlayRandom(); + } + else + { + m_soundSelect.PlayRandom(); + m_Fade.CloseWipingRight( SM_GoToNextScreen ); + } + break; + case CHOICE_EXIT: + m_soundSelect.PlayRandom(); + ExitGame(); + LOG->Trace("CHOICE_EXIT: shutting down"); + return; + default: + ASSERT(0); + } + break; + default: + ASSERT(0); + } + break; + } + Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); } @@ -218,87 +346,3 @@ void ScreenTitleMenu::GainFocus( int iChoiceIndex ) m_textChoice[iChoiceIndex].SetEffectCamelion( 2.5f, color1, color2 ); } -void ScreenTitleMenu::MenuUp( PlayerNumber pn ) -{ - TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */ - - LoseFocus( m_TitleMenuChoice ); - - if( m_TitleMenuChoice == 0 ) // wrap around - m_TitleMenuChoice = (ScreenTitleMenu::TitleMenuChoice)((int)NUM_TITLE_MENU_CHOICES); - - m_TitleMenuChoice = TitleMenuChoice( m_TitleMenuChoice-1 ); - - m_soundChange.PlayRandom(); - - GainFocus( m_TitleMenuChoice ); -} - - -void ScreenTitleMenu::MenuDown( PlayerNumber pn ) -{ - TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */ - - LoseFocus( m_TitleMenuChoice ); - - if( m_TitleMenuChoice == (int)ScreenTitleMenu::NUM_TITLE_MENU_CHOICES-1 ) - m_TitleMenuChoice = (TitleMenuChoice)-1; // wrap around - - m_TitleMenuChoice = TitleMenuChoice( m_TitleMenuChoice+1 ); - - m_soundChange.PlayRandom(); - - GainFocus( m_TitleMenuChoice ); -} - - -void ScreenTitleMenu::MenuStart( PlayerNumber pn ) -{ - GAMESTATE->m_bSideIsJoined[pn] = true; - GAMESTATE->m_MasterPlayerNumber = pn; - - GAMESTATE->m_bPlayersCanJoin = false; - - - switch( m_TitleMenuChoice ) - { - case CHOICE_GAME_START: - case CHOICE_SELECT_GAME: - case CHOICE_MAP_INSTRUMENTS: - case CHOICE_INPUT_OPTIONS: - case CHOICE_MACHINE_OPTIONS: - case CHOICE_GRAPHIC_OPTIONS: - case CHOICE_APPEARANCE_OPTIONS: - #ifdef _DEBUG - case CHOICE_SANDBOX: - #endif - m_soundSelect.PlayRandom(); - m_Fade.CloseWipingRight( SM_GoToNextScreen ); - break; - case CHOICE_EDIT: - if( SONGMAN->m_pSongs.empty() ) - { - m_soundInvalid.PlayRandom(); - } - else - { - m_soundSelect.PlayRandom(); - m_Fade.CloseWipingRight( SM_GoToNextScreen ); - } - break; - case CHOICE_EXIT: { - m_soundSelect.PlayRandom(); - Exit(); - LOG->Trace("CHOICE_EXIT: shutting down"); - } - return; - default: - ASSERT(0); - } -} - -void ScreenTitleMenu::MenuBack( PlayerNumber pn ) -{ - this->m_Fade.CloseWipingRight( SM_GoToAttractLoop ); -} - diff --git a/stepmania/src/ScreenTitleMenu.h b/stepmania/src/ScreenTitleMenu.h index 94d40b5a33..8b4479d351 100644 --- a/stepmania/src/ScreenTitleMenu.h +++ b/stepmania/src/ScreenTitleMenu.h @@ -24,8 +24,6 @@ public: ScreenTitleMenu(); virtual ~ScreenTitleMenu(); - virtual void FirstUpdate(); - virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); virtual void Update( float fDelta ); virtual void HandleScreenMessage( const ScreenMessage SM ); @@ -49,10 +47,6 @@ public: private: void GainFocus( int iChoiceIndex ); void LoseFocus( int iChoiceIndex ); - void MenuUp( PlayerNumber pn ); - void MenuDown( PlayerNumber pn ); - void MenuBack( PlayerNumber pn ); - void MenuStart( PlayerNumber pn ); TitleMenuChoice m_TitleMenuChoice; diff --git a/stepmania/src/ScreenUnlock.h b/stepmania/src/ScreenUnlock.h index cadb2ff68f..620a60d504 100644 --- a/stepmania/src/ScreenUnlock.h +++ b/stepmania/src/ScreenUnlock.h @@ -15,11 +15,7 @@ class ScreenUnlock : public ScreenAttract { public: - -private: - virtual CString GetMetricName() { return "Unlock"; }; // used to look up theme metrics - virtual CString GetElementName() { return "unlock"; }; // used to look up theme elements - + ScreenUnlock() : ScreenAttract("Unlock","unlock") { }; }; diff --git a/stepmania/src/ScreenWarning.h b/stepmania/src/ScreenWarning.h index 3f83ebee86..f2492cd0ae 100644 --- a/stepmania/src/ScreenWarning.h +++ b/stepmania/src/ScreenWarning.h @@ -15,11 +15,7 @@ class ScreenWarning : public ScreenAttract { public: - -private: - virtual CString GetMetricName() { return "Warning"; }; // used to look up theme metrics - virtual CString GetElementName() { return "warning"; }; // used to look up theme elements - + ScreenWarning() : ScreenAttract("Warning","warning") {}; }; diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 4437429479..f92aef5203 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -108,7 +108,7 @@ void ApplyGraphicOptions() TEXTUREMAN->ReloadAll(); } -void Exit() +void ExitGame() { SDL_Event *event; event = (SDL_Event *) malloc(sizeof(event)); @@ -116,7 +116,7 @@ void Exit() SDL_PushEvent(event); } -void Reset() +void ResetGame() { GAMESTATE->Reset(); PREFSMAN->ReadGamePrefsFromDisk(); @@ -291,7 +291,7 @@ int main(int argc, char* argv[]) * this after loading songs. */ BoostAppPri(); - Reset(); + ResetGame(); /* Run the main loop. */ GameLoop(); @@ -359,6 +359,11 @@ static void HandleInputEvents(float fDeltaTime) DeviceInput DeviceI = (DeviceInput)ieArray[i]; InputEventType type = ieArray[i].type; + // HACK: Numlock is read is being pressed if the NumLock light is on. + // Filter out all NumLock repeat messages + if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == SDLK_NUMLOCK && type != IET_FIRST_PRESS ) + continue; // skip + if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F4)) { if(type != IET_FIRST_PRESS) continue; @@ -464,6 +469,7 @@ static void GameLoop() fDeltaTime /= 4; TEXTUREMAN->Update( fDeltaTime ); + SCREENMAN->Update( fDeltaTime ); SOUNDMAN->Update( fDeltaTime ); HandleInputEvents( fDeltaTime ); diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index ee404e14ef..c280634371 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -14,9 +14,9 @@ void ApplyGraphicOptions(); -void Exit(); +void ExitGame(); -void Reset(); +void ResetGame(); #endif diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index c9fb117546..9265cb4b7e 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -37,7 +37,7 @@ BrowseInformation="0" WarningLevel="4" SuppressStartupBanner="TRUE" - DebugInformationFormat="3"/> + DebugInformationFormat="4"/>