mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-25 22:47:52 +00:00
Fixed a bug where beat hit events were called multiple times during the conductor
This commit is contained in:
parent
4852515c42
commit
3e093510af
|
@ -54,9 +54,9 @@ class Countdown
|
|||
|
||||
countdownStep = decrement(countdownStep);
|
||||
|
||||
// Handle onBeatHit events manually
|
||||
@:privateAccess
|
||||
PlayState.instance.dispatchEvent(new SongTimeScriptEvent(ScriptEvent.SONG_BEAT_HIT, 0, 0));
|
||||
// onBeatHit events are now properly dispatched by the Conductor even at negative timestamps,
|
||||
// so calling this is no longer necessary.
|
||||
// PlayState.instance.dispatchEvent(new SongTimeScriptEvent(ScriptEvent.SONG_BEAT_HIT, 0, 0));
|
||||
|
||||
// Countdown graphic.
|
||||
showCountdownGraphic(countdownStep, isPixelStyle);
|
||||
|
|
|
@ -811,16 +811,6 @@ class PlayState extends MusicBeatSubState
|
|||
FlxG.watch.addQuick('bfAnim', currentStage.getBoyfriend().getCurrentAnimation());
|
||||
}
|
||||
|
||||
if (currentStage.getBoyfriend() != null)
|
||||
{
|
||||
FlxG.watch.addQuick('bfCameraFocus', currentStage.getBoyfriend().cameraFocusPoint);
|
||||
}
|
||||
|
||||
if (currentStage.getDad() != null)
|
||||
{
|
||||
FlxG.watch.addQuick('dadCameraFocus', currentStage.getDad().cameraFocusPoint);
|
||||
}
|
||||
|
||||
// TODO: Add a song event for Handle GF dance speed.
|
||||
|
||||
// Handle player death.
|
||||
|
|
|
@ -51,13 +51,23 @@ class Song implements IPlayStateScriptedClass
|
|||
difficultyIds = [];
|
||||
difficulties = new Map<String, SongDifficulty>();
|
||||
|
||||
_metadata = SongDataParser.loadSongMetadata(songId);
|
||||
if (_metadata == null || _metadata.length == 0 && !ignoreErrors)
|
||||
try
|
||||
{
|
||||
_metadata = SongDataParser.loadSongMetadata(songId);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
_metadata = [];
|
||||
}
|
||||
|
||||
if (_metadata.length == 0 && !ignoreErrors)
|
||||
{
|
||||
throw 'Could not find song data for songId: $songId';
|
||||
}
|
||||
|
||||
populateFromMetadata();
|
||||
else
|
||||
{
|
||||
populateFromMetadata();
|
||||
}
|
||||
}
|
||||
|
||||
@:allow(funkin.play.song.Song)
|
||||
|
@ -97,6 +107,8 @@ class Song implements IPlayStateScriptedClass
|
|||
*/
|
||||
function populateFromMetadata():Void
|
||||
{
|
||||
if (_metadata == null || _metadata.length == 0) return;
|
||||
|
||||
// Variations may have different artist, time format, generatedBy, etc.
|
||||
for (metadata in _metadata)
|
||||
{
|
||||
|
|
|
@ -203,10 +203,12 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
|
|||
{
|
||||
if (hasDanced)
|
||||
{
|
||||
trace('DanceRight (alternate)');
|
||||
playAnimation('danceRight$idleSuffix', forceRestart);
|
||||
}
|
||||
else
|
||||
{
|
||||
trace('DanceLeft (alternate)');
|
||||
playAnimation('danceLeft$idleSuffix', forceRestart);
|
||||
}
|
||||
hasDanced = !hasDanced;
|
||||
|
|
|
@ -241,7 +241,11 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass
|
|||
propSprite.animation.play(dataProp.startingAnimation);
|
||||
}
|
||||
|
||||
if (Std.isOfType(propSprite, Bopper))
|
||||
if (Std.isOfType(propSprite, BaseCharacter))
|
||||
{
|
||||
// Character stuff.
|
||||
}
|
||||
else if (Std.isOfType(propSprite, Bopper))
|
||||
{
|
||||
addBopper(cast propSprite, dataProp.name);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue