add basic survival gameplay

This commit is contained in:
Chris Danford
2005-04-21 04:27:13 +00:00
parent 1b33a59c2c
commit f8904f3b92
12 changed files with 117 additions and 13 deletions
+1
View File
@@ -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. */
+14 -1
View File
@@ -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<msd.GetNumValues(); i++ )
{
CString sValueName = msd.GetParam(i, 0);
@@ -125,6 +134,9 @@ void Course::LoadFromCRSFile( CString sPath )
else if( 0 == stricmp(sValueName, "LIVES") )
m_iLives = atoi( sParams[1] );
else if( 0 == stricmp(sValueName, "GAINSECONDS") )
fGainSeconds = atof( sParams[1] );
else if( 0 == stricmp(sValueName, "METER") )
{
if( sParams.params.size() == 2 )
@@ -275,6 +287,7 @@ void Course::LoadFromCRSFile( CString sPath )
}
new_entry.attacks = attacks;
new_entry.fGainSeconds = fGainSeconds;
attacks.clear();
m_entries.push_back( new_entry );
+4 -1
View File
@@ -23,6 +23,7 @@ enum CourseType
COURSE_TYPE_NONSTOP, // if life meter type is BAR
COURSE_TYPE_ONI, // if life meter type is BATTERY
COURSE_TYPE_ENDLESS, // if set to REPEAT
COURSE_TYPE_SURVIVAL, // if life meter type is TIME
NUM_COURSE_TYPES
};
#define FOREACH_CourseType( i ) FOREACH_ENUM( CourseType, NUM_COURSE_TYPES, i )
@@ -66,7 +67,8 @@ public:
int high_meter; // = -1 if no meter range specified
int players_index; // ignored if type isn't 'best' or 'worst'
CString modifiers; // set player and song options using these
AttackArray attacks; // set timed modifiers
AttackArray attacks; // timed modifiers
float fGainSeconds; // time gained back at the beginning of the song. LifeMeterTime only.
CourseEntry()
{
@@ -80,6 +82,7 @@ public:
high_meter = -1;
players_index = 0;
modifiers = "";
fGainSeconds = 0;
}
};
+5 -2
View File
@@ -900,11 +900,14 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &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
+1
View File
@@ -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. */
+1 -3
View File
@@ -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();
+13 -4
View File
@@ -687,10 +687,19 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
vector<Course*> 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;
}
+30
View File
@@ -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 );
+12
View File
@@ -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;
+19
View File
@@ -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 );
+4
View File
@@ -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;
}
}
+13 -2
View File
@@ -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 {