only allow one attack at a time in Rave

This commit is contained in:
Chris Danford
2003-07-28 07:56:25 +00:00
parent 793107c826
commit 05a6e8957d
3 changed files with 35 additions and 9 deletions
+22 -8
View File
@@ -284,6 +284,23 @@ const StyleDef* GameState::GetCurrentStyleDef()
bool GameState::IsPlayable( const ModeChoice& mc )
{
if( mc.pm == PLAY_MODE_RAVE )
{
// Can't play Rave without characters for attack definitions.
if( m_pCharacters.empty() )
return false;
// Can't play rave unless there is room for two players
if( mc.style != STYLE_INVALID &&
GAMEMAN->GetStyleDefForStyle(mc.style)->m_StyleType == StyleDef::ONE_PLAYER_TWO_CREDITS )
return false;
// Can't play rave unless there is room for two players
if( m_CurStyle != STYLE_INVALID &&
GAMEMAN->GetStyleDefForStyle(m_CurStyle)->m_StyleType == StyleDef::ONE_PLAYER_TWO_CREDITS )
return false;
}
return mc.numSidesJoinedToPlay == GAMESTATE->GetNumSidesJoined();
}
@@ -499,17 +516,14 @@ void GameState::LaunchAttack( PlayerNumber target, Attack a )
}
}
void GameState::RemoveAllActiveAttacks()
void GameState::RemoveActiveAttacksForPlayer( PlayerNumber pn )
{
for( int p=0; p<NUM_PLAYERS; p++ )
for( unsigned s=0; s<NUM_INVENTORY_SLOTS; s++ )
{
for( unsigned s=0; s<NUM_INVENTORY_SLOTS; s++ )
{
m_ActiveAttacks[p][s].fSecsRemaining = 0;
m_ActiveAttacks[p][s].sModifier = "";
}
RebuildPlayerOptionsFromActiveAttacks( (PlayerNumber)p );
m_ActiveAttacks[pn][s].fSecsRemaining = 0;
m_ActiveAttacks[pn][s].sModifier = "";
}
RebuildPlayerOptionsFromActiveAttacks( (PlayerNumber)pn );
}
void GameState::RemoveAllInventory()
+6 -1
View File
@@ -175,7 +175,12 @@ public:
bool m_bActiveAttackEndedThisUpdate[NUM_PLAYERS]; // flag for other objects to watch (play sounds)
void LaunchAttack( PlayerNumber target, Attack aa );
void RebuildPlayerOptionsFromActiveAttacks( PlayerNumber pn );
void RemoveAllActiveAttacks(); // called on end of song
void RemoveAllActiveAttacks() // called on end of song
{
for( int p=0; p<NUM_PLAYERS; p++ )
RemoveActiveAttacksForPlayer( (PlayerNumber)p );
}
void RemoveActiveAttacksForPlayer( PlayerNumber pn );
void RemoveAllInventory();
int GetSumOfActiveAttackLevels( PlayerNumber pn );
PlayerNumber GetBestPlayer();
+7
View File
@@ -15,6 +15,7 @@
#include "RageUtil.h"
#include "GameState.h"
#include "Character.h"
#include "ScreenManager.h"
CachedThemeMetricF ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
@@ -87,7 +88,13 @@ void ScoreKeeperRave::LaunchAttack( AttackLevel al )
a.fSecsRemaining = ATTACK_DURATION_SECONDS;
a.sModifier = sAttackToGive;
// remove current attack (if any)
GAMESTATE->RemoveActiveAttacksForPlayer( pnToAttack );
// apply new attack
GAMESTATE->LaunchAttack( pnToAttack, a );
SCREENMAN->SystemMessage( ssprintf( "attacking %d with %s", pnToAttack, sAttackToGive.c_str() ) );
m_soundLaunchAttack.Play();
}