Make transform attacks obey Attack::fSecsRemaining.
Fix off-by-one error causing phantom "missed notes".
This commit is contained in:
+26
-18
@@ -643,34 +643,42 @@ void GameState::ActivateAttack( PlayerNumber target, int slot, bool ActivingDela
|
||||
else
|
||||
type = START_IMMEDIATELY;
|
||||
|
||||
float StartBeat = 0, EndBeat = 0;
|
||||
switch( type )
|
||||
{
|
||||
case QUEUE_FOR_LATER:
|
||||
StartBeat = this->m_pCurSong->GetBeatFromElapsedTime( a.fStartSecond );
|
||||
EndBeat = this->m_pCurSong->GetBeatFromElapsedTime( a.fStartSecond+a.fSecsRemaining );
|
||||
break;
|
||||
case START_IMMEDIATELY:
|
||||
/* We're setting this effect on the fly. If it's an arrow-changing effect
|
||||
* (transform or note skin), apply it in the future, past what's currently on
|
||||
* screen, so new arrows will scroll on screen with this effect. */
|
||||
GetUndisplayedBeats( target, a.fSecsRemaining, StartBeat, EndBeat );
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Peek at the effect being applied. If it's a transform, add it to
|
||||
// a list of transforms that should be applied by the Player on its
|
||||
// next update.
|
||||
// Peek at the effect being applied.
|
||||
//
|
||||
PlayerOptions po;
|
||||
po.FromString( a.sModifier );
|
||||
if( type != QUEUE_FOR_LATER && po.m_Transform != PlayerOptions::TRANSFORM_NONE )
|
||||
{
|
||||
m_TransformsToApply[target].push_back( po.m_Transform );
|
||||
}
|
||||
|
||||
if( po.m_sNoteSkin != "" )
|
||||
switch( type )
|
||||
{
|
||||
if( type == QUEUE_FOR_LATER )
|
||||
case QUEUE_FOR_LATER:
|
||||
case START_IMMEDIATELY:
|
||||
if( po.m_sNoteSkin != "" )
|
||||
{
|
||||
float StartBeat = this->m_pCurSong->GetBeatFromElapsedTime( a.fStartSecond );
|
||||
float EndBeat = this->m_pCurSong->GetBeatFromElapsedTime( a.fStartSecond+a.fSecsRemaining );
|
||||
LOG->Trace("... x queue at %f..%f", StartBeat, EndBeat );
|
||||
SetNoteSkinForBeatRange( target, po.m_sNoteSkin, StartBeat, EndBeat );
|
||||
LOG->Trace("skin ...");
|
||||
}
|
||||
else if( type == START_IMMEDIATELY )
|
||||
/* If it's a transform, add it to the list of transforms that should be applied
|
||||
* by the Player on its next update. */
|
||||
if( po.m_Transform != PlayerOptions::TRANSFORM_NONE )
|
||||
{
|
||||
/* We're changing note skins on the fly. Add it in the future, past what's
|
||||
* currently on screen, so new arrows will scroll on screen with this skin. */
|
||||
float StartBeat, EndBeat;
|
||||
GetUndisplayedBeats( target, a.fSecsRemaining, StartBeat, EndBeat );
|
||||
SetNoteSkinForBeatRange( target, po.m_sNoteSkin, StartBeat, EndBeat );
|
||||
m_TransformsToApply[target].push_back(
|
||||
TransformToApply_t( po.m_Transform, StartBeat, EndBeat ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,16 @@ public:
|
||||
};
|
||||
enum { MAX_SIMULTANEOUS_ATTACKS=16 };
|
||||
Attack m_ActiveAttacks[NUM_PLAYERS][MAX_SIMULTANEOUS_ATTACKS];
|
||||
vector<PlayerOptions::Transform> m_TransformsToApply[NUM_PLAYERS];
|
||||
|
||||
struct TransformToApply_t
|
||||
{
|
||||
PlayerOptions::Transform trans;
|
||||
float fStartBeat, fEndBeat;
|
||||
TransformToApply_t( PlayerOptions::Transform trans_, float fStartBeat_, float fEndBeat_ ):
|
||||
trans(trans_), fStartBeat(fStartBeat_), fEndBeat(fEndBeat_) { }
|
||||
};
|
||||
vector<TransformToApply_t> m_TransformsToApply[NUM_PLAYERS];
|
||||
|
||||
void ActivateAttack( PlayerNumber target, int slot, bool ActivingDelayedAttack );
|
||||
void SetNoteSkinForBeatRange( PlayerNumber pn, CString sNoteSkin, float StartBeat, float EndBeat );
|
||||
|
||||
|
||||
@@ -507,6 +507,8 @@ void NoteDataUtil::Wide( NoteData &in, float fStartBeat, float fEndBeat )
|
||||
|
||||
in.ConvertHoldNotesTo4s();
|
||||
|
||||
/* Start on an even beat. */
|
||||
fStartBeat = froundf( fStartBeat, 2 );
|
||||
|
||||
int first_row = 0;
|
||||
if( fStartBeat != -1 )
|
||||
@@ -578,6 +580,9 @@ void NoteDataUtil::InsertIntelligentTaps( NoteData &in, float fBeatInterval, flo
|
||||
|
||||
in.ConvertHoldNotesTo4s();
|
||||
|
||||
/* Start on an integral beat. */
|
||||
fStartBeat = roundf( fStartBeat );
|
||||
|
||||
// Insert a beat in the middle of every fBeatInterval.
|
||||
|
||||
int first_row = 0;
|
||||
|
||||
+10
-14
@@ -334,39 +334,35 @@ void PlayerMinus::Update( float fDeltaTime )
|
||||
// process transforms that are waiting to be applied
|
||||
for( unsigned j=0; j<GAMESTATE->m_TransformsToApply[m_PlayerNumber].size(); j++ )
|
||||
{
|
||||
// Start beat needs to be far enough ahead to be off screen so that
|
||||
// addition arrows don't suddenly pop on.
|
||||
float fStartBeat, fEndBeat;
|
||||
GAMESTATE->GetUndisplayedBeats( m_PlayerNumber, 10 /*XXX*/, fStartBeat, fEndBeat );
|
||||
const GameState::TransformToApply_t &tr = GAMESTATE->m_TransformsToApply[m_PlayerNumber][j];
|
||||
|
||||
LOG->Trace( "Applying transform from %f to %f", fStartBeat, fEndBeat );
|
||||
|
||||
switch( GAMESTATE->m_TransformsToApply[m_PlayerNumber][j] )
|
||||
LOG->Trace( "Applying transform from %f to %f", tr.fStartBeat, tr.fEndBeat );
|
||||
switch( tr.trans )
|
||||
{
|
||||
case PlayerOptions::TRANSFORM_LITTLE:
|
||||
NoteDataUtil::Little( *this, fStartBeat, fEndBeat );
|
||||
NoteDataUtil::Little( *this, tr.fStartBeat, tr.fEndBeat );
|
||||
break;
|
||||
case PlayerOptions::TRANSFORM_WIDE:
|
||||
NoteDataUtil::Wide( *this, fStartBeat, fEndBeat );
|
||||
NoteDataUtil::Wide( *this, tr.fStartBeat, tr.fEndBeat );
|
||||
break;
|
||||
case PlayerOptions::TRANSFORM_BIG:
|
||||
NoteDataUtil::Big( *this, fStartBeat, fEndBeat );
|
||||
NoteDataUtil::Big( *this, tr.fStartBeat, tr.fEndBeat );
|
||||
break;
|
||||
case PlayerOptions::TRANSFORM_QUICK:
|
||||
NoteDataUtil::Quick( *this, fStartBeat, fEndBeat );
|
||||
NoteDataUtil::Quick( *this, tr.fStartBeat, tr.fEndBeat );
|
||||
break;
|
||||
case PlayerOptions::TRANSFORM_SKIPPY:
|
||||
NoteDataUtil::Skippy( *this, fStartBeat, fEndBeat );
|
||||
NoteDataUtil::Skippy( *this, tr.fStartBeat, tr.fEndBeat );
|
||||
break;
|
||||
case PlayerOptions::TRANSFORM_MINES:
|
||||
NoteDataUtil::Mines( *this, fStartBeat, fEndBeat );
|
||||
NoteDataUtil::Mines( *this, tr.fStartBeat, tr.fEndBeat );
|
||||
break;
|
||||
case PlayerOptions::TRANSFORM_NONE:
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
m_pNoteField->CopyRange( this, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat), BeatToNoteRow(fStartBeat)-1 );
|
||||
m_pNoteField->CopyRange( this, BeatToNoteRow(tr.fStartBeat), BeatToNoteRow(tr.fEndBeat), BeatToNoteRow(tr.fStartBeat) );
|
||||
}
|
||||
GAMESTATE->m_TransformsToApply[m_PlayerNumber].clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user