|
|
|
@ -10,7 +10,8 @@ ClassicNote::ClassicNote(const std::vector<microsec>& intervals, microsec perfec
|
|
|
|
|
_evaluator(intervals, _perfect_offset),
|
|
|
|
|
_action(action),
|
|
|
|
|
_state(State::NONE),
|
|
|
|
|
_appearance_time(0)
|
|
|
|
|
_appearance_time(0),
|
|
|
|
|
_last_offset(0)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
bool ClassicNote::isActive(const microsec& music_offset) const
|
|
|
|
@ -18,9 +19,9 @@ bool ClassicNote::isActive(const microsec& music_offset) const
|
|
|
|
|
return _evaluator.isActive(music_offset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int getPt( int n1 , int n2 , float perc )
|
|
|
|
|
static int getPt( float n1 , float n2 , float perc )
|
|
|
|
|
{
|
|
|
|
|
int diff = n2 - n1;
|
|
|
|
|
float diff = n2 - n1;
|
|
|
|
|
|
|
|
|
|
return n1 + ( diff * perc );
|
|
|
|
|
}
|
|
|
|
@ -36,16 +37,29 @@ void ClassicNote::update(const microsec& music_offset)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case State::FLYING:
|
|
|
|
|
{
|
|
|
|
|
float i;
|
|
|
|
|
if (music_offset != _last_offset)
|
|
|
|
|
{
|
|
|
|
|
auto update_time = music_offset - _appearance_time; // This all will be inside ::update
|
|
|
|
|
auto i = update_time / _trail_path_percent / 100; // of an animation object
|
|
|
|
|
i = update_time / _trail_path_percent * 0.01; // of an animation object
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
auto update_time = music_offset + 10000 - _appearance_time;
|
|
|
|
|
i = update_time / _trail_path_percent * 0.01;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_last_offset = music_offset;
|
|
|
|
|
|
|
|
|
|
int xa = getPt( 720./2. , 1280./2. , i );
|
|
|
|
|
int ya = getPt( 0 , 720./2. , i );
|
|
|
|
|
int xb = getPt( 1280./2. , _coordinates.x , i );
|
|
|
|
|
int yb = getPt( 720./2. , _coordinates.y , i );
|
|
|
|
|
float xa = getPt( _coordinates.x + 20. , _coordinates.x + 90. , i );
|
|
|
|
|
float ya = getPt( _coordinates.y - 600. , _coordinates.y - 150. , i );
|
|
|
|
|
float xb = getPt( _coordinates.x + 90. , _coordinates.x , i );
|
|
|
|
|
float yb = getPt( _coordinates.y - 150. , _coordinates.y , i );
|
|
|
|
|
|
|
|
|
|
_sprite->update(getPt( xa , xb , i ), getPt( ya , yb , i ));
|
|
|
|
|
if (i >= 1)
|
|
|
|
|
_sprite->trailFade();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -92,7 +106,7 @@ void ClassicNote::setState(State next_state)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case State::FLYING:
|
|
|
|
|
_sprite->setCoordinates(_coordinates.x, _coordinates.y, 720/2, 50);
|
|
|
|
|
_sprite->setCoordinates(_coordinates.x, _coordinates.y, _coordinates.x + 20, _coordinates.y - 600);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case State::NONE:
|
|
|
|
|