Adjust attacks on offset change.

Should we ever store the other timing segments in
seconds and not beats in the future, we may want
to use this.
This commit is contained in:
Jason Felds
2011-06-30 13:35:25 -04:00
parent 347a4f1d5c
commit 0f6d4cd813
3 changed files with 31 additions and 0 deletions
+8
View File
@@ -104,6 +104,14 @@ vector<RString> AttackArray::ToVectorString() const
return ret;
}
void AttackArray::UpdateStartTimes(float delta)
{
FOREACH(Attack, *this, a)
{
a->fStartSecond += delta;
}
}
/*
* (c) 2003-2004 Chris Danford
* All rights reserved.
+5
View File
@@ -76,6 +76,11 @@ struct AttackArray : public vector<Attack>
* @brief Return a string representation used for simfiles.
* @return the string representation. */
vector<RString> ToVectorString() const;
/**
* @brief Adjust the starting time of all attacks.
* @param delta the amount to change. */
void UpdateStartTimes(float delta);
};
#endif
+18
View File
@@ -1936,6 +1936,14 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
}
GetAppropriateTiming().m_fBeat0OffsetInSeconds += fDelta;
(fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play();
if (GAMESTATE->m_bIsUsingStepTiming)
{
GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks.UpdateStartTimes(fDelta);
}
else
{
GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(fDelta);
}
SetDirty( true );
}
break;
@@ -3430,7 +3438,17 @@ static void ChangeBeat0Offset( const RString &sNew )
TimingData &timing = (GAMESTATE->m_bIsUsingStepTiming ?
GAMESTATE->m_pCurSteps[PLAYER_1]->m_Timing :
GAMESTATE->m_pCurSong->m_SongTiming);
float old = timing.m_fBeat0OffsetInSeconds;
timing.m_fBeat0OffsetInSeconds = StringToFloat( sNew );
float delta = timing.m_fBeat0OffsetInSeconds - old;
if (GAMESTATE->m_bIsUsingStepTiming)
{
GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks.UpdateStartTimes(delta);
}
else
{
GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(delta);
}
}
static void ChangeLastSecondHint( const RString &sNew )