New branch: [sm5a2futures]

Want to make sure we don't cause conflicts for future 1a builds.

This commit: change the sentinel for launching attacks immediately.

This way, songs with negative gaps can have attacks work here.

Thanks to Saturn for the assist.
This commit is contained in:
Jason Felds
2012-02-23 22:50:03 -05:00
parent 4d4856495a
commit 08d3abbe44
4 changed files with 13 additions and 11 deletions
+4 -2
View File
@@ -8,6 +8,8 @@ class PlayerState;
/** @brief An action made against a Player to make things more difficult. */
struct Attack
{
static const int ATTACK_STARTS_NOW = -10000;
AttackLevel level;
/**
* @brief the starting point of this attack.
@@ -25,14 +27,14 @@ struct Attack
void MakeBlank()
{
level = ATTACK_LEVEL_1;
fStartSecond = -1;
fStartSecond = ATTACK_STARTS_NOW;
fSecsRemaining = 0;
sModifiers = RString();
bOn = false;
bGlobal = false;
bShowInAttackList = true;
}
Attack(): level(ATTACK_LEVEL_1), fStartSecond(-1),
Attack(): level(ATTACK_LEVEL_1), fStartSecond(ATTACK_STARTS_NOW),
fSecsRemaining(0), sModifiers(RString()),
bOn(false), bGlobal(false), bShowInAttackList(true)
{} // MakeBlank() is effectively called here.
+1 -1
View File
@@ -2859,7 +2859,7 @@ void Player::UpdateJudgedRows()
Attack attMineAttack;
attMineAttack.sModifiers = ApplyRandomAttack();
attMineAttack.fStartSecond = -1.0f;
attMineAttack.fStartSecond = attMineAttack.ATTACK_STARTS_NOW;
attMineAttack.fSecsRemaining = fAttackRunTime;
m_pPlayerState->LaunchAttack( attMineAttack );
+6 -6
View File
@@ -63,10 +63,10 @@ void PlayerState::Update( float fDelta )
{
Attack &attack = m_ActiveAttacks[s];
// -1 is the "starts now" sentinel value. You must add the attack
// by calling GameState::LaunchAttack, or else the -1 won't be
// You must add sattack by calling GameState::LaunchAttack,
// or else the sentinel value won't be
// converted into the current music time.
ASSERT( attack.fStartSecond != -1 );
ASSERT( attack.fStartSecond != attack.ATTACK_STARTS_NOW );
bool bCurrentlyEnabled =
attack.bGlobal ||
@@ -111,12 +111,12 @@ void PlayerState::LaunchAttack( const Attack& a )
Attack attack = a;
/* If fStartSecond is -1, it means "launch as soon as possible". For m_ActiveAttacks,
/* If fStartSecond is the sentinel, it means "launch as soon as possible". For m_ActiveAttacks,
* mark the real time it's starting (now), so Update() can know when the attack
* started so it can be removed later. For m_ModsToApply, leave the -1 in,
* started so it can be removed later. For m_ModsToApply, leave the sentinel in,
* so Player::Update knows to apply attack transforms correctly. (yuck) */
m_ModsToApply.push_back( attack );
if( attack.fStartSecond == -1 )
if( attack.fStartSecond == attack.ATTACK_STARTS_NOW )
attack.fStartSecond = m_Position.m_fMusicSeconds;
m_ActiveAttacks.push_back( attack );
+2 -2
View File
@@ -968,7 +968,7 @@ void ScreenGameplay::SetupSong( int iSongIndex )
Attack a = pi->m_asModifiersQueue[iSongIndex][i];
if( a.fStartSecond != 0 )
continue;
a.fStartSecond = -1; // now
a.fStartSecond = a.ATTACK_STARTS_NOW; // now
PlayerOptions po;
po.FromString( a.sModifiers );
@@ -1018,7 +1018,7 @@ void ScreenGameplay::SetupSong( int iSongIndex )
{
Attack a = pi->m_asModifiersQueue[iSongIndex][i];
if( a.fStartSecond == 0 )
a.fStartSecond = -1; // now
a.fStartSecond = a.ATTACK_STARTS_NOW; // now
pi->GetPlayerState()->LaunchAttack( a );
GAMESTATE->m_SongOptions.FromString( ModsLevel_Song, a.sModifiers );