diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 701f2f928e..f150a590ce 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -3624,6 +3624,17 @@ TimerSeconds=24 MaxRankingNameLength=4 StyleIcon=1 MemoryCardIcons=1 +NextScreen=ScreenRemoveMemoryCard + +[ScreenRemoveMemoryCard] +NextScreen=ScreenBranchEnding@ScreenBranch + +[ScreenBranchEnding] +Choices=Credits,MusicScroll +ConditionCredits=topgrade,>=,AA +ConditionMusicScroll= +NextScreenCredits=ScreenCredits +NextScreenMusicScroll=ScreenMusicScroll [EditMenu] Arrows1X=190 diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index c9d9e4efe5..665e0fd8f9 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -29,7 +29,7 @@ $(srcdir)/libresample/libresample.a: Screens = \ Screen.cpp Screen.h ScreenAttract.cpp ScreenAttract.h ScreenBookkeeping.h ScreenBookkeeping.cpp \ -ScreenCaution.cpp ScreenCaution.h ScreencenterImage.h ScreenCenterImage.cpp ScreenCredits.cpp ScreenCredits.h ScreenDemonstration.cpp ScreenDemonstration.h \ +ScreenBranch.cpp ScreenBranch.h ScreenCaution.cpp ScreenCaution.h ScreencenterImage.h ScreenCenterImage.cpp ScreenCredits.cpp ScreenCredits.h ScreenDemonstration.cpp ScreenDemonstration.h \ ScreenDimensions.h ScreenEdit.cpp ScreenEdit.h ScreenEditCoursesMenu.cpp ScreenEditCoursesMenu.h \ ScreenEditMenu.cpp ScreenEditMenu.h ScreenEndlessBreak.cpp ScreenEndlessBreak.h ScreenEvaluation.cpp ScreenEvaluation.h \ ScreenExit.cpp ScreenExit.h ScreenEz2SelectMusic.cpp ScreenEz2SelectMusic.h ScreenEz2SelectPlayer.cpp ScreenEz2SelectPlayer.h \ @@ -42,7 +42,7 @@ ScreenMusicScroll.cpp ScreenMusicScroll.h ScreenNameEntry.cpp ScreenNameEntry.h ScreenOptionsMaster.cpp ScreenOptionsMaster.h ScreenOptionsMasterPrefs.cpp ScreenOptionsMasterPrefs.h \ ScreenPlayerOptions.cpp ScreenPlayerOptions.h ScreenPrompt.cpp ScreenPrompt.h \ ScreenProfileOptions.cpp ScreenProfileOptions.h ScreenRanking.cpp ScreenRanking.h ScreenRaveOptions.cpp ScreenRaveOptions.h \ -ScreenReloadSongs.cpp ScreenReloadSongs.h ScreenSandbox.cpp ScreenSandbox.h ScreenSelect.cpp ScreenSelect.h \ +ScreenReloadSongs.cpp ScreenReloadSongs.h ScreenRemoveMemoryCard.cpp ScreenRemoveMemoryCard.h ScreenSandbox.cpp ScreenSandbox.h ScreenSelect.cpp ScreenSelect.h \ ScreenSelectCharacter.cpp ScreenSelectCharacter.h ScreenSelectCourse.cpp ScreenSelectCourse.h \ ScreenSelectDifficulty.cpp ScreenSelectDifficulty.h ScreenSelectDifficultyEX.cpp ScreenSelectDifficultyEX.h \ ScreenSelectGroup.cpp ScreenSelectGroup.h ScreenSelectMaster.cpp ScreenSelectMaster.h \ diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index 8c935aaadf..9c463a8a83 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -287,6 +287,8 @@ void Screen::ClearMessageQueue( const ScreenMessage SM ) #include "ScreenCenterImage.h" #include "ScreenTestInput.h" #include "ScreenBookkeeping.h" +#include "ScreenRemoveMemoryCard.h" +#include "ScreenBranch.h" Screen* Screen::Create( CString sClassName ) { @@ -390,6 +392,8 @@ Screen* Screen::Create( CString sClassName ) IF_RETURN( ScreenCenterImage ); IF_RETURN( ScreenTestInput ); IF_RETURN( ScreenBookkeeping ); + IF_RETURN( ScreenRemoveMemoryCard ); + IF_RETURN( ScreenBranch ); RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() ); } diff --git a/stepmania/src/ScreenBookkeeping.h b/stepmania/src/ScreenBookkeeping.h index 9d0f2b1beb..4d5b170037 100644 --- a/stepmania/src/ScreenBookkeeping.h +++ b/stepmania/src/ScreenBookkeeping.h @@ -2,7 +2,7 @@ ----------------------------------------------------------------------------- Class: ScreenBookkeeping - Desc: Where the player maps device input to instrument buttons. + Desc: Show coin drop stats. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford diff --git a/stepmania/src/ScreenBranch.cpp b/stepmania/src/ScreenBranch.cpp new file mode 100644 index 0000000000..40364944d5 --- /dev/null +++ b/stepmania/src/ScreenBranch.cpp @@ -0,0 +1,92 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: ScreenBranch + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ScreenBranch.h" +#include "RageLog.h" +#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" +#include "ScreenManager.h" +#include "ThemeManager.h" +#include "Grade.h" +#include "GameState.h" +#include "StageStats.h" + +#define CHOICES THEME->GetMetric (m_sName,"Choices") +#define CONDITION(choice) THEME->GetMetric (m_sName,"Condition"+choice) +#define NEXT_SCREEN(choice) THEME->GetMetric (m_sName,"NextScreen"+choice) + +bool EvaluateCondition( CString sCondition ) +{ + // For now, empty expresions evaluate to true. Is there a better way to handle this? + if( sCondition.empty() ) + return true; + + // TODO: Make this a general expression evaluator + CStringArray as; + split( sCondition, ",", as, false ); + + if( as.size()==3 && as[0].CompareNoCase("topgrade")==0 ) + { + Grade top_grade = GRADE_E; + vector vSongs; + StageStats stats; + GAMESTATE->GetFinalEvalStatsAndSongs( stats, vSongs ); + for( int p=0; pIsHumanPlayer(p) ) + top_grade = max( top_grade, stats.GetGrade((PlayerNumber)p) ); + + CString &sOp = as[1]; + + Grade grade = StringToGrade(as[2]); + + if( sOp == ">=" ) + return top_grade >= grade; + } + + RageException::Throw( "Condition '%s' is invalid", sCondition.c_str() ); +} + +ScreenBranch::ScreenBranch( CString sClassName ) : Screen( sClassName ) +{ + LOG->Trace( "ScreenBranch::ScreenBranch()" ); + + CStringArray as; + split( CHOICES, ",", as, true ); + for( unsigned i=0; iTrace( "Branching to '%s'", sNextScreen.c_str() ); + SCREENMAN->SetNewScreen( sNextScreen ); + } + break; + } +} diff --git a/stepmania/src/ScreenBranch.h b/stepmania/src/ScreenBranch.h new file mode 100644 index 0000000000..a8c413e6f7 --- /dev/null +++ b/stepmania/src/ScreenBranch.h @@ -0,0 +1,26 @@ +/* +----------------------------------------------------------------------------- + Class: ScreenBranch + + Desc: Load one of several screens. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Screen.h" +#include "MenuElements.h" + + +class ScreenBranch : public Screen +{ +public: + ScreenBranch( CString sName ); + + virtual void HandleScreenMessage( const ScreenMessage SM ); + +private: + CString m_sChoice; +}; + diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index 4bda892a77..3cc6f713b5 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -48,6 +48,7 @@ #define FAKE_BEATS_PER_SEC THEME->GetMetricF("ScreenNameEntry","FakeBeatsPerSec") #define TIMER_SECONDS THEME->GetMetricI("ScreenNameEntry","TimerSeconds") #define MAX_RANKING_NAME_LENGTH THEME->GetMetricI(m_sName,"MaxRankingNameLength") +#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen") // cache for frequently used metrics @@ -395,25 +396,15 @@ void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM ) { GAMESTATE->RestoreSelectedOptions(); - /* Hack: go back to the select course screen in event mode. */ - if( PREFSMAN->m_bEventMode && GAMESTATE->IsCourseMode() ) - { - SCREENMAN->SetNewScreen( "ScreenSelectCourse" ); - break; - } + // There shouldn't be NameEntry in event mode. -Chris +// /* Hack: go back to the select course screen in event mode. */ +// if( PREFSMAN->m_bEventMode && GAMESTATE->IsCourseMode() ) +// { +// SCREENMAN->SetNewScreen( "ScreenSelectCourse" ); +// break; +// } - Grade max_grade = GRADE_E; - vector vSongs; - StageStats stats; - GAMESTATE->GetFinalEvalStatsAndSongs( stats, vSongs ); - - for( int p=0; pIsHumanPlayer(p) ) - max_grade = max( max_grade, stats.GetGrade((PlayerNumber)p) ); - if( max_grade >= GRADE_AA ) - SCREENMAN->SetNewScreen( "ScreenCredits" ); - else - SCREENMAN->SetNewScreen( "ScreenMusicScroll" ); + SCREENMAN->SetNewScreen( NEXT_SCREEN ); } break; } diff --git a/stepmania/src/ScreenRemoveMemoryCard.cpp b/stepmania/src/ScreenRemoveMemoryCard.cpp new file mode 100644 index 0000000000..c6ea8e8082 --- /dev/null +++ b/stepmania/src/ScreenRemoveMemoryCard.cpp @@ -0,0 +1,101 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: ScreenRemoveMemoryCard + + Desc: Where the player maps device input to pad input. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ScreenRemoveMemoryCard.h" +#include "MemoryCardManager.h" +#include "RageLog.h" +#include "RageSounds.h" +#include "ThemeManager.h" +#include "GameConstantsAndTypes.h" +#include "PlayerNumber.h" +#include "ScreenManager.h" + +#define NEXT_SCREEN THEME->GetMetric (m_sName,"NextScreen") + +ScreenRemoveMemoryCard::ScreenRemoveMemoryCard( CString sClassName ) : Screen( sClassName ) +{ + if( !AnyCardsInserted() ) + { + HandleScreenMessage( SM_GoToNextScreen ); // Don't show this screen + return; + } + + LOG->Trace( "ScreenRemoveMemoryCard::ScreenRemoveMemoryCard()" ); + + m_Menu.Load( "ScreenRemoveMemoryCard" ); + this->AddChild( &m_Menu ); + + SOUND->PlayMusic( THEME->GetPathToS("ScreenRemoveMemoryCard music") ); +} + +ScreenRemoveMemoryCard::~ScreenRemoveMemoryCard() +{ + LOG->Trace( "ScreenRemoveMemoryCard::~ScreenRemoveMemoryCard()" ); +} + +void ScreenRemoveMemoryCard::DrawPrimitives() +{ + m_Menu.DrawBottomLayer(); + Screen::DrawPrimitives(); + m_Menu.DrawTopLayer(); +} + +void ScreenRemoveMemoryCard::Update( float fDelta ) +{ + Screen::Update( fDelta ); + + if( !AnyCardsInserted() ) // all cards are pulled out + { + if( !m_Menu.IsTransitioning() ) + m_Menu.StartTransitioning( SM_GoToPrevScreen ); + } +} + +void ScreenRemoveMemoryCard::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) +{ + if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT ) + return; // ignore + + Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler +} + +void ScreenRemoveMemoryCard::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_GoToNextScreen: + SCREENMAN->SetNewScreen( NEXT_SCREEN ); + break; + } +} + +void ScreenRemoveMemoryCard::MenuStart( PlayerNumber pn ) +{ + MenuBack( pn ); +} + +void ScreenRemoveMemoryCard::MenuBack( PlayerNumber pn ) +{ + if(!m_Menu.IsTransitioning()) + { + m_Menu.StartTransitioning( SM_GoToPrevScreen ); + } +} + +bool ScreenRemoveMemoryCard::AnyCardsInserted() +{ + for( int p=0; pGetCardState((PlayerNumber)p) != MEMORY_CARD_STATE_NO_CARD ) + return true; + + return false; +} diff --git a/stepmania/src/ScreenRemoveMemoryCard.h b/stepmania/src/ScreenRemoveMemoryCard.h new file mode 100644 index 0000000000..146351a624 --- /dev/null +++ b/stepmania/src/ScreenRemoveMemoryCard.h @@ -0,0 +1,35 @@ +/* +----------------------------------------------------------------------------- + Class: ScreenRemoveMemoryCard + + Desc: Remind the player to remove their memory card. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Screen.h" +#include "MenuElements.h" + + +class ScreenRemoveMemoryCard : public Screen +{ +public: + ScreenRemoveMemoryCard( CString sName ); + virtual ~ScreenRemoveMemoryCard(); + + virtual void DrawPrimitives(); + virtual void Update( float fDelta ); + virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); + virtual void HandleScreenMessage( const ScreenMessage SM ); + + virtual void MenuStart( PlayerNumber pn ); + virtual void MenuBack( PlayerNumber pn ); + +private: + bool AnyCardsInserted(); + + MenuElements m_Menu; +}; + diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index ca8a7429b7..46c9ee14ca 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -58,14 +58,14 @@ BSC32=bscmake.exe LINK32=link.exe # ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe" # SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib -# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../../itg/Program/StepMania-debug.exe" +# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../Program/StepMania-debug.exe" # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\stepmania\itg\Program +TargetDir=\stepmania\stepmania\Program 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 # End Special Build Tool @@ -102,8 +102,8 @@ IntDir=.\Debug TargetDir=\stepmania\stepmania TargetName=default 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 @@ -143,7 +143,7 @@ IntDir=.\../Release6 TargetDir=\stepmania\stepmania\Program 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 # End Special Build Tool @@ -184,8 +184,8 @@ IntDir=.\StepMania___Xbox_Release TargetDir=\stepmania\stepmania TargetName=default 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 @@ -1871,25 +1871,6 @@ SOURCE=.\MsdFile.cpp SOURCE=.\MsdFile.h # End Source File -# Begin Source File - -SOURCE=.\XmlFile.cpp - -!IF "$(CFG)" == "StepMania - Win32 Debug" - -!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" - -!ELSEIF "$(CFG)" == "StepMania - Win32 Release" - -!ELSEIF "$(CFG)" == "StepMania - Xbox Release" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\XmlFile.h -# End Source File # End Group # Begin Group "StepMania" @@ -2885,25 +2866,6 @@ SOURCE=.\BitmapText.h # End Source File # Begin Source File -SOURCE=.\mathlib.c - -!IF "$(CFG)" == "StepMania - Win32 Debug" - -!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" - -!ELSEIF "$(CFG)" == "StepMania - Win32 Release" - -!ELSEIF "$(CFG)" == "StepMania - Xbox Release" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\mathlib.h -# End Source File -# Begin Source File - SOURCE=.\Model.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" @@ -4448,6 +4410,25 @@ SOURCE=.\ScreenBookkeeping.h # End Source File # Begin Source File +SOURCE=.\ScreenBranch.cpp + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ScreenBranch.h +# End Source File +# Begin Source File + SOURCE=.\ScreenCaution.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" @@ -4831,10 +4812,6 @@ SOURCE=.\ScreenMapControllers.h # End Source File # Begin Source File -SOURCE=.\ScreenMemoryCard.h -# End Source File -# Begin Source File - SOURCE=.\ScreenMessage.h # End Source File # Begin Source File @@ -5086,6 +5063,25 @@ SOURCE=.\ScreenReloadSongs.h # End Source File # Begin Source File +SOURCE=.\ScreenRemoveMemoryCard.cpp + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\ScreenRemoveMemoryCard.h +# End Source File +# Begin Source File + SOURCE=.\ScreenSandbox.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 8549eccb0c..0c7e4cdd90 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -181,6 +181,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + @@ -382,6 +388,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + +