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:
+4
-2
@@ -8,6 +8,8 @@ class PlayerState;
|
|||||||
/** @brief An action made against a Player to make things more difficult. */
|
/** @brief An action made against a Player to make things more difficult. */
|
||||||
struct Attack
|
struct Attack
|
||||||
{
|
{
|
||||||
|
static const int ATTACK_STARTS_NOW = -10000;
|
||||||
|
|
||||||
AttackLevel level;
|
AttackLevel level;
|
||||||
/**
|
/**
|
||||||
* @brief the starting point of this attack.
|
* @brief the starting point of this attack.
|
||||||
@@ -25,14 +27,14 @@ struct Attack
|
|||||||
void MakeBlank()
|
void MakeBlank()
|
||||||
{
|
{
|
||||||
level = ATTACK_LEVEL_1;
|
level = ATTACK_LEVEL_1;
|
||||||
fStartSecond = -1;
|
fStartSecond = ATTACK_STARTS_NOW;
|
||||||
fSecsRemaining = 0;
|
fSecsRemaining = 0;
|
||||||
sModifiers = RString();
|
sModifiers = RString();
|
||||||
bOn = false;
|
bOn = false;
|
||||||
bGlobal = false;
|
bGlobal = false;
|
||||||
bShowInAttackList = true;
|
bShowInAttackList = true;
|
||||||
}
|
}
|
||||||
Attack(): level(ATTACK_LEVEL_1), fStartSecond(-1),
|
Attack(): level(ATTACK_LEVEL_1), fStartSecond(ATTACK_STARTS_NOW),
|
||||||
fSecsRemaining(0), sModifiers(RString()),
|
fSecsRemaining(0), sModifiers(RString()),
|
||||||
bOn(false), bGlobal(false), bShowInAttackList(true)
|
bOn(false), bGlobal(false), bShowInAttackList(true)
|
||||||
{} // MakeBlank() is effectively called here.
|
{} // MakeBlank() is effectively called here.
|
||||||
|
|||||||
+1
-1
@@ -2859,7 +2859,7 @@ void Player::UpdateJudgedRows()
|
|||||||
|
|
||||||
Attack attMineAttack;
|
Attack attMineAttack;
|
||||||
attMineAttack.sModifiers = ApplyRandomAttack();
|
attMineAttack.sModifiers = ApplyRandomAttack();
|
||||||
attMineAttack.fStartSecond = -1.0f;
|
attMineAttack.fStartSecond = attMineAttack.ATTACK_STARTS_NOW;
|
||||||
attMineAttack.fSecsRemaining = fAttackRunTime;
|
attMineAttack.fSecsRemaining = fAttackRunTime;
|
||||||
|
|
||||||
m_pPlayerState->LaunchAttack( attMineAttack );
|
m_pPlayerState->LaunchAttack( attMineAttack );
|
||||||
|
|||||||
+6
-6
@@ -63,10 +63,10 @@ void PlayerState::Update( float fDelta )
|
|||||||
{
|
{
|
||||||
Attack &attack = m_ActiveAttacks[s];
|
Attack &attack = m_ActiveAttacks[s];
|
||||||
|
|
||||||
// -1 is the "starts now" sentinel value. You must add the attack
|
// You must add sattack by calling GameState::LaunchAttack,
|
||||||
// by calling GameState::LaunchAttack, or else the -1 won't be
|
// or else the sentinel value won't be
|
||||||
// converted into the current music time.
|
// converted into the current music time.
|
||||||
ASSERT( attack.fStartSecond != -1 );
|
ASSERT( attack.fStartSecond != attack.ATTACK_STARTS_NOW );
|
||||||
|
|
||||||
bool bCurrentlyEnabled =
|
bool bCurrentlyEnabled =
|
||||||
attack.bGlobal ||
|
attack.bGlobal ||
|
||||||
@@ -111,12 +111,12 @@ void PlayerState::LaunchAttack( const Attack& a )
|
|||||||
|
|
||||||
Attack 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
|
* 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) */
|
* so Player::Update knows to apply attack transforms correctly. (yuck) */
|
||||||
m_ModsToApply.push_back( attack );
|
m_ModsToApply.push_back( attack );
|
||||||
if( attack.fStartSecond == -1 )
|
if( attack.fStartSecond == attack.ATTACK_STARTS_NOW )
|
||||||
attack.fStartSecond = m_Position.m_fMusicSeconds;
|
attack.fStartSecond = m_Position.m_fMusicSeconds;
|
||||||
m_ActiveAttacks.push_back( attack );
|
m_ActiveAttacks.push_back( attack );
|
||||||
|
|
||||||
|
|||||||
@@ -968,7 +968,7 @@ void ScreenGameplay::SetupSong( int iSongIndex )
|
|||||||
Attack a = pi->m_asModifiersQueue[iSongIndex][i];
|
Attack a = pi->m_asModifiersQueue[iSongIndex][i];
|
||||||
if( a.fStartSecond != 0 )
|
if( a.fStartSecond != 0 )
|
||||||
continue;
|
continue;
|
||||||
a.fStartSecond = -1; // now
|
a.fStartSecond = a.ATTACK_STARTS_NOW; // now
|
||||||
|
|
||||||
PlayerOptions po;
|
PlayerOptions po;
|
||||||
po.FromString( a.sModifiers );
|
po.FromString( a.sModifiers );
|
||||||
@@ -1018,7 +1018,7 @@ void ScreenGameplay::SetupSong( int iSongIndex )
|
|||||||
{
|
{
|
||||||
Attack a = pi->m_asModifiersQueue[iSongIndex][i];
|
Attack a = pi->m_asModifiersQueue[iSongIndex][i];
|
||||||
if( a.fStartSecond == 0 )
|
if( a.fStartSecond == 0 )
|
||||||
a.fStartSecond = -1; // now
|
a.fStartSecond = a.ATTACK_STARTS_NOW; // now
|
||||||
|
|
||||||
pi->GetPlayerState()->LaunchAttack( a );
|
pi->GetPlayerState()->LaunchAttack( a );
|
||||||
GAMESTATE->m_SongOptions.FromString( ModsLevel_Song, a.sModifiers );
|
GAMESTATE->m_SongOptions.FromString( ModsLevel_Song, a.sModifiers );
|
||||||
|
|||||||
Reference in New Issue
Block a user