From f8904f3b92d0b0a61e089dfaf1034fa41f0c1925 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 21 Apr 2005 04:27:13 +0000 Subject: [PATCH] add basic survival gameplay --- stepmania/src/CombinedLifeMeter.h | 1 + stepmania/src/Course.cpp | 15 ++++++++++++++- stepmania/src/Course.h | 5 ++++- stepmania/src/GameCommand.cpp | 7 +++++-- stepmania/src/LifeMeter.h | 1 + stepmania/src/LifeMeterBattery.h | 4 +--- stepmania/src/MusicWheel.cpp | 17 +++++++++++++---- stepmania/src/PrefsManager.cpp | 30 ++++++++++++++++++++++++++++++ stepmania/src/PrefsManager.h | 12 ++++++++++++ stepmania/src/ScreenGameplay.cpp | 19 +++++++++++++++++++ stepmania/src/SongOptions.cpp | 4 ++++ stepmania/src/SongOptions.h | 15 +++++++++++++-- 12 files changed, 117 insertions(+), 13 deletions(-) diff --git a/stepmania/src/CombinedLifeMeter.h b/stepmania/src/CombinedLifeMeter.h index c44749e651..04c5537cde 100644 --- a/stepmania/src/CombinedLifeMeter.h +++ b/stepmania/src/CombinedLifeMeter.h @@ -12,6 +12,7 @@ public: CombinedLifeMeter() {}; virtual ~CombinedLifeMeter() {}; + virtual void OnLoadSong() {}; virtual void OnSongEnded() {}; /* Change life after receiving a tap note grade. This *is* called for * the head of hold notes. */ diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 7f0bc7b380..34c2f8115a 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -44,7 +44,14 @@ CourseType Course::GetCourseType() const { if( m_bRepeat ) return COURSE_TYPE_ENDLESS; - return m_iLives > 0? COURSE_TYPE_ONI:COURSE_TYPE_NONSTOP; + if( m_iLives > 0 ) + return COURSE_TYPE_ONI; + FOREACH_CONST( CourseEntry, m_entries, e ) + { + if( e->fGainSeconds > 0 ) + return COURSE_TYPE_SURVIVAL; + } + return COURSE_TYPE_NONSTOP; } PlayMode Course::GetPlayMode() const @@ -53,6 +60,7 @@ PlayMode Course::GetPlayMode() const { case COURSE_TYPE_ENDLESS: return PLAY_MODE_ENDLESS; case COURSE_TYPE_ONI: return PLAY_MODE_ONI; + case COURSE_TYPE_SURVIVAL: return PLAY_MODE_ONI; case COURSE_TYPE_NONSTOP: return PLAY_MODE_NONSTOP; default: ASSERT(0); return PLAY_MODE_INVALID; } @@ -104,6 +112,7 @@ void Course::LoadFromCRSFile( CString sPath ) m_sBannerPath = arrayPossibleBanners[0]; AttackArray attacks; + float fGainSeconds = 0; for( unsigned i=0; i &vpns ) const GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers ); GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers ); } - // HACK: Set life type to BATTERY just once here so it happens once and // we don't override the user's changes if they back out. - if( GAMESTATE->m_PlayMode == PLAY_MODE_ONI && GAMESTATE->m_PlayMode != OldPlayMode ) + if( GAMESTATE->m_PlayMode == PLAY_MODE_ONI && + GAMESTATE->m_PlayMode != OldPlayMode && + GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BAR ) + { GAMESTATE->m_SongOptions.m_LifeType = SongOptions::LIFE_BATTERY; + } } bool GameCommand::IsZero() const diff --git a/stepmania/src/LifeMeter.h b/stepmania/src/LifeMeter.h index 2ce2e92ac6..e4dd2adcf6 100644 --- a/stepmania/src/LifeMeter.h +++ b/stepmania/src/LifeMeter.h @@ -13,6 +13,7 @@ public: virtual ~LifeMeter() {}; virtual void Load( PlayerNumber pn ) { m_PlayerNumber = pn; } + virtual void OnLoadSong() {}; virtual void OnSongEnded() {}; /* Change life after receiving a tap note grade. This *is* called for * the head of hold notes. */ diff --git a/stepmania/src/LifeMeterBattery.h b/stepmania/src/LifeMeterBattery.h index fa18efa36e..20f755cc92 100644 --- a/stepmania/src/LifeMeterBattery.h +++ b/stepmania/src/LifeMeterBattery.h @@ -27,10 +27,8 @@ public: virtual bool IsInDanger() const; virtual bool IsHot() const; virtual bool IsFailing() const; - - virtual void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty) { }; - virtual float GetLife() const; + virtual void UpdateNonstopLifebar(int cleared, int total, int ProgressiveLifebarDifficulty) { }; void Refresh(); diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 899dbe5843..24d6bd4480 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -687,10 +687,19 @@ void MusicWheel::BuildWheelItemDatas( vector &arrayWheelItemDatas vector apCourses; switch( so ) { - case SORT_NONSTOP_COURSES: SONGMAN->GetCourses( COURSE_TYPE_NONSTOP, apCourses, PREFSMAN->m_bAutogenGroupCourses ); break; - case SORT_ONI_COURSES: SONGMAN->GetCourses( COURSE_TYPE_ONI, apCourses, PREFSMAN->m_bAutogenGroupCourses ); break; - case SORT_ENDLESS_COURSES: SONGMAN->GetCourses( COURSE_TYPE_ENDLESS, apCourses, PREFSMAN->m_bAutogenGroupCourses ); break; - case SORT_ALL_COURSES: SONGMAN->GetAllCourses( apCourses, PREFSMAN->m_bAutogenGroupCourses ); break; + case SORT_NONSTOP_COURSES: + SONGMAN->GetCourses( COURSE_TYPE_NONSTOP, apCourses, PREFSMAN->m_bAutogenGroupCourses ); + break; + case SORT_ONI_COURSES: + SONGMAN->GetCourses( COURSE_TYPE_ONI, apCourses, PREFSMAN->m_bAutogenGroupCourses ); + SONGMAN->GetCourses( COURSE_TYPE_SURVIVAL, apCourses, PREFSMAN->m_bAutogenGroupCourses ); + break; + case SORT_ENDLESS_COURSES: + SONGMAN->GetCourses( COURSE_TYPE_ENDLESS, apCourses, PREFSMAN->m_bAutogenGroupCourses ); + break; + case SORT_ALL_COURSES: + SONGMAN->GetAllCourses( apCourses, PREFSMAN->m_bAutogenGroupCourses ); + break; default: ASSERT(0); break; } diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index ade12ed8e7..4b9e260afb 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -184,6 +184,16 @@ void PrefsManager::Init() m_fSuperMeterPercentChangeNG = -0.20f; m_bMercifulSuperMeter = true; + m_fTimeMeterSecondsChangeMarvelous = -0.0f; + m_fTimeMeterSecondsChangePerfect = -0.25f; + m_fTimeMeterSecondsChangeGreat = -0.5f; + m_fTimeMeterSecondsChangeGood = -1.0f; + m_fTimeMeterSecondsChangeBoo = -2.0f; + m_fTimeMeterSecondsChangeMiss = -4.0f; + m_fTimeMeterSecondsChangeHitMine = -2.0f; + m_fTimeMeterSecondsChangeOK = -0.0f; + m_fTimeMeterSecondsChangeNG = -4.0f; + m_bDelayedBack = true; m_bShowInstructions = true; m_bShowSelectGroup = true; @@ -419,6 +429,16 @@ void PrefsManager::ReadGlobalPrefsFromIni( const IniFile &ini ) ini.GetValue( "Options", "SuperMeterPercentChangeNG", m_fSuperMeterPercentChangeNG ); ini.GetValue( "Options", "MercifulSuperMeter", m_bMercifulSuperMeter ); + ini.GetValue( "Options", "TimeMeterSecondsChangeMarvelous", m_fTimeMeterSecondsChangeMarvelous ); + ini.GetValue( "Options", "TimeMeterSecondsChangePerfect", m_fTimeMeterSecondsChangePerfect ); + ini.GetValue( "Options", "TimeMeterSecondsChangeGreat", m_fTimeMeterSecondsChangeGreat ); + ini.GetValue( "Options", "TimeMeterSecondsChangeGood", m_fTimeMeterSecondsChangeGood ); + ini.GetValue( "Options", "TimeMeterSecondsChangeBoo", m_fTimeMeterSecondsChangeBoo ); + ini.GetValue( "Options", "TimeMeterSecondsChangeMiss", m_fTimeMeterSecondsChangeMiss ); + ini.GetValue( "Options", "TimeMeterSecondsChangeHitMine", m_fTimeMeterSecondsChangeHitMine ); + ini.GetValue( "Options", "TimeMeterSecondsChangeOK", m_fTimeMeterSecondsChangeOK ); + ini.GetValue( "Options", "TimeMeterSecondsChangeNG", m_fTimeMeterSecondsChangeNG ); + ini.GetValue( "Options", "DelayedEscape", m_bDelayedBack ); ini.GetValue( "Options", "ShowInstructions", m_bShowInstructions ); ini.GetValue( "Options", "ShowSelectGroup", m_bShowSelectGroup ); @@ -639,6 +659,16 @@ void PrefsManager::SaveGlobalPrefsToIni( IniFile &ini ) const ini.SetValue( "Options", "SuperMeterPercentChangeNG", m_fSuperMeterPercentChangeNG ); ini.SetValue( "Options", "MercifulSuperMeter", m_bMercifulSuperMeter ); + ini.SetValue( "Options", "TimeMeterSecondsChangeMarvelous", m_fTimeMeterSecondsChangeMarvelous ); + ini.SetValue( "Options", "TimeMeterSecondsChangePerfect", m_fTimeMeterSecondsChangePerfect ); + ini.SetValue( "Options", "TimeMeterSecondsChangeGreat", m_fTimeMeterSecondsChangeGreat ); + ini.SetValue( "Options", "TimeMeterSecondsChangeGood", m_fTimeMeterSecondsChangeGood ); + ini.SetValue( "Options", "TimeMeterSecondsChangeBoo", m_fTimeMeterSecondsChangeBoo ); + ini.SetValue( "Options", "TimeMeterSecondsChangeMiss", m_fTimeMeterSecondsChangeMiss ); + ini.SetValue( "Options", "TimeMeterSecondsChangeHitMine", m_fTimeMeterSecondsChangeHitMine ); + ini.SetValue( "Options", "TimeMeterSecondsChangeOK", m_fTimeMeterSecondsChangeOK ); + ini.SetValue( "Options", "TimeMeterSecondsChangeNG", m_fTimeMeterSecondsChangeNG ); + ini.SetValue( "Options", "DelayedEscape", m_bDelayedBack ); ini.SetValue( "Options", "HiddenSongs", m_bHiddenSongs ); ini.SetValue( "Options", "Vsync", m_bVsync ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index f42457a955..5ffea8ecdd 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -122,6 +122,7 @@ public: int m_iGradeWeightOK; int m_iGradeWeightNG; + // super meter used in rave float m_fSuperMeterPercentChangeMarvelous; float m_fSuperMeterPercentChangePerfect; float m_fSuperMeterPercentChangeGreat; @@ -133,6 +134,17 @@ public: float m_fSuperMeterPercentChangeNG; bool m_bMercifulSuperMeter; // negative super deltas are scaled by the players life percentage + // time meter used in survival + float m_fTimeMeterSecondsChangeMarvelous; + float m_fTimeMeterSecondsChangePerfect; + float m_fTimeMeterSecondsChangeGreat; + float m_fTimeMeterSecondsChangeGood; + float m_fTimeMeterSecondsChangeBoo; + float m_fTimeMeterSecondsChangeMiss; + float m_fTimeMeterSecondsChangeHitMine; + float m_fTimeMeterSecondsChangeOK; + float m_fTimeMeterSecondsChangeNG; + bool m_bAutoPlay; bool m_bDelayedBack; bool m_bShowInstructions, m_bShowSelectGroup; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 289e11b8ae..b375bc91b2 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -9,6 +9,7 @@ #include "RageLog.h" #include "LifeMeterBar.h" #include "LifeMeterBattery.h" +#include "LifeMeterTime.h" #include "GameState.h" #include "ScoreDisplayNormal.h" #include "ScoreDisplayPercentage.h" @@ -349,6 +350,9 @@ void ScreenGameplay::Init() case SongOptions::LIFE_BATTERY: m_pLifeMeter[p] = new LifeMeterBattery; break; + case SongOptions::LIFE_TIME: + m_pLifeMeter[p] = new LifeMeterTime; + break; default: ASSERT(0); } @@ -1030,7 +1034,22 @@ void ScreenGameplay::LoadNextSong() } } else + { m_BeginnerHelper.SetHidden( false ); + } + + FOREACH_EnabledPlayer(p) + { + if( !STATSMAN->m_CurStageStats.m_player[p].bFailed ) + { + // give a little life back between stages + if( m_pLifeMeter[p] ) + m_pLifeMeter[p]->OnLoadSong(); + if( m_pCombinedLifeMeter ) + m_pCombinedLifeMeter->OnLoadSong(); + } + } + m_SongForeground.LoadFromSong( GAMESTATE->m_pCurSong ); diff --git a/stepmania/src/SongOptions.cpp b/stepmania/src/SongOptions.cpp index d0fdd8c205..2e3717eddf 100644 --- a/stepmania/src/SongOptions.cpp +++ b/stepmania/src/SongOptions.cpp @@ -32,6 +32,9 @@ CString SongOptions::GetString() const case LIFE_BATTERY: sReturn += ssprintf( "%dLives, ", m_iBatteryLives ); break; + case LIFE_TIME: + sReturn += "LifeTime, "; + break; default: ASSERT(0); } @@ -136,6 +139,7 @@ void SongOptions::FromString( CString sOptions ) else if( sBit == "savescore" ) m_bSaveScore = on; else if( sBit == "bar" ) m_LifeType = LIFE_BAR; else if( sBit == "battery" ) m_LifeType = LIFE_BATTERY; + else if( sBit == "lifetime" ) m_LifeType = LIFE_TIME; } } diff --git a/stepmania/src/SongOptions.h b/stepmania/src/SongOptions.h index e114bc405f..6b88de13f4 100644 --- a/stepmania/src/SongOptions.h +++ b/stepmania/src/SongOptions.h @@ -5,9 +5,20 @@ struct SongOptions { - enum LifeType { LIFE_BAR=0, LIFE_BATTERY, NUM_LIFE_TYPES }; + enum LifeType + { + LIFE_BAR=0, + LIFE_BATTERY, + LIFE_TIME, + NUM_LIFE_TYPES + }; LifeType m_LifeType; - enum DrainType { DRAIN_NORMAL, DRAIN_NO_RECOVER, DRAIN_SUDDEN_DEATH }; + enum DrainType + { + DRAIN_NORMAL, + DRAIN_NO_RECOVER, + DRAIN_SUDDEN_DEATH + }; DrainType m_DrainType; // only used with LifeBar int m_iBatteryLives; enum FailType {