From 5af7a99be246c70256ecb0b42a46740ad153a271 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 13 Jun 2004 05:05:42 +0000 Subject: [PATCH] add ScreenInsertCredit --- stepmania/Themes/default/metrics.ini | 6 ++++ stepmania/src/Makefile.am | 3 +- stepmania/src/Screen.cpp | 2 ++ stepmania/src/ScreenInsertCredit.cpp | 47 ++++++++++++++++++++++++++++ stepmania/src/ScreenInsertCredit.h | 38 ++++++++++++++++++++++ stepmania/src/StepMania.cpp | 21 +++++++++---- stepmania/src/StepMania.h | 3 ++ 7 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 stepmania/src/ScreenInsertCredit.cpp create mode 100644 stepmania/src/ScreenInsertCredit.h diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 0ced01b612..708d199c14 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -4393,6 +4393,9 @@ Clear Machine Stats,1=screen,ScreenClearMachineStats;name,ClearMachineStats Input Options=1,together Input OptionsDefault= Input Options,1=screen,ScreenInputOptions;name,InputOptions +Insert Credit=1,together +Insert CreditDefault= +Insert Credit,1=screen,ScreenInsertCredit;name,InsertCredit Gameplay Options=1,together Gameplay OptionsDefault= Gameplay Options,1=screen,ScreenGameplayOptions;name,GameplayOptions @@ -4498,6 +4501,9 @@ NoData=NO DATA [HighScore] EmptyName=STEP +[ScreenInsertCredit] +NextScreen=ScreenOptionsMenu + [ScreenDownloadMachineStats] NextScreen=ScreenOptionsMenu diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index bb6693c835..2139d94b74 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -32,7 +32,8 @@ ScreenEditMenu.cpp ScreenEditMenu.h ScreenEnding.cpp ScreenEnding.h \ ScreenEndlessBreak.cpp ScreenEndlessBreak.h ScreenEvaluation.cpp ScreenEvaluation.h ScreenExit.cpp ScreenExit.h \ ScreenEz2SelectMusic.cpp ScreenEz2SelectMusic.h ScreenEz2SelectPlayer.cpp ScreenEz2SelectPlayer.h \ ScreenGameOver.cpp ScreenGameOver.h ScreenGameplay.cpp ScreenGameplay.h ScreenHowToPlay.cpp ScreenHowToPlay.h \ -ScreenInstructions.cpp ScreenInstructions.h ScreenJukebox.cpp ScreenJukebox.h \ +ScreenInstructions.cpp ScreenInstructions.h ScreenInsertCredit.cpp ScreenInsertCredit.h \ +ScreenJukebox.cpp ScreenJukebox.h \ ScreenJukeboxMenu.cpp ScreenJukeboxMenu.h ScreenLogo.cpp ScreenLogo.h ScreenMapControllers.cpp ScreenMapControllers.h \ ScreenMessage.h ScreenMiniMenu.cpp ScreenMiniMenu.h ScreenMusicScroll.cpp ScreenMusicScroll.h \ ScreenNameEntry.cpp ScreenNameEntry.h ScreenNameEntryTraditional.cpp ScreenNameEntryTraditional.h \ diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index ddc5fa1cec..fb2396df56 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -301,6 +301,7 @@ void Screen::ClearMessageQueue( const ScreenMessage SM ) #include "ScreenClearMachineStats.h" #include "ScreenResetToDefaults.h" #include "ScreenClearBookkeepingData.h" +#include "ScreenInsertCredit.h" Screen* Screen::Create( CString sClassName ) { @@ -369,6 +370,7 @@ Screen* Screen::Create( CString sClassName ) IF_RETURN( ScreenClearMachineStats ); IF_RETURN( ScreenResetToDefaults ); IF_RETURN( ScreenClearBookkeepingData ); + IF_RETURN( ScreenInsertCredit ); RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() ); } diff --git a/stepmania/src/ScreenInsertCredit.cpp b/stepmania/src/ScreenInsertCredit.cpp new file mode 100644 index 0000000000..ca31f5c681 --- /dev/null +++ b/stepmania/src/ScreenInsertCredit.cpp @@ -0,0 +1,47 @@ +#include "global.h" +#include "ScreenInsertCredit.h" +#include "ProfileManager.h" +#include "ScreenManager.h" +#include "MemoryCardManager.h" +#include "ThemeManager.h" +#include "PrefsManager.h" +#include "StepMania.h" + +#define NEXT_SCREEN THEME->GetMetric(m_sName,"NextScreen") + +static void SaveMachineStatsToFirstMemCard() +{ + InsertCredit(); +} + +ScreenInsertCredit::ScreenInsertCredit( CString sName ): Screen( sName ) +{ + SaveMachineStatsToFirstMemCard(); + + SCREENMAN->SetNewScreen( NEXT_SCREEN ); +} + +/* + * (c) 2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/ScreenInsertCredit.h b/stepmania/src/ScreenInsertCredit.h new file mode 100644 index 0000000000..5a28cfea78 --- /dev/null +++ b/stepmania/src/ScreenInsertCredit.h @@ -0,0 +1,38 @@ +#ifndef ScreenInsertCredit_H +#define ScreenInsertCredit_H + +#include "Screen.h" + +class ScreenInsertCredit: public Screen +{ +public: + ScreenInsertCredit( CString sName ); +}; + + +#endif + +/* + * (c) 2004 Chris Danford + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index ebb4c088be..cf9a9d62b8 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -1283,6 +1283,20 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, return sFileName; } +void InsertCoin( int iNum ) +{ + GAMESTATE->m_iCoins += iNum; + LOG->Trace("%i coins inserted, %i needed to play", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit); + BOOKKEEPER->CoinInserted(); + SCREENMAN->RefreshCreditsMessages(); + SCREENMAN->PlayCoinSound(); +} + +void InsertCredit() +{ + GAMESTATE->m_iCoins += PREFSMAN->m_iCoinsPerCredit; +} + /* Returns true if the key has been handled and should be discarded, false if * the key should be sent on to screens. */ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput GameI, MenuInput MenuI, StyleInput StyleI ) @@ -1313,12 +1327,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam LOG->Trace( "Ignored coin insertion (editing)" ); break; } - - GAMESTATE->m_iCoins++; - LOG->Trace("%i coins inserted, %i needed to play", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit); - BOOKKEEPER->CoinInserted(); - SCREENMAN->RefreshCreditsMessages(); - SCREENMAN->PlayCoinSound(); + InsertCoin(); return false; // Attract need to know because they go to TitleMenu on > 1 credit } diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index e9d72e0a15..fbe3ba235c 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -15,6 +15,9 @@ void ChangeCurrentGame( Game g ); // If successful, return filename of screenshot in sDir, else return "" CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, int iIndex = -1 ); +void InsertCoin( int iNum = 1 ); +void InsertCredit(); + #if defined(_WINDOWS) #include "windows.h" extern HWND g_hWndMain;