1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 08:13:45 +00:00

Fixed a bug where beat hit events were called multiple times during the conductor

This commit is contained in:
EliteMasterEric 2023-08-04 12:35:01 -04:00
parent 4852515c42
commit 3e093510af
5 changed files with 26 additions and 18 deletions

View file

@ -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);

View file

@ -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.

View file

@ -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)
{

View file

@ -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;

View file

@ -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);
}