1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 16:24:40 +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); countdownStep = decrement(countdownStep);
// Handle onBeatHit events manually // onBeatHit events are now properly dispatched by the Conductor even at negative timestamps,
@:privateAccess // so calling this is no longer necessary.
PlayState.instance.dispatchEvent(new SongTimeScriptEvent(ScriptEvent.SONG_BEAT_HIT, 0, 0)); // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(ScriptEvent.SONG_BEAT_HIT, 0, 0));
// Countdown graphic. // Countdown graphic.
showCountdownGraphic(countdownStep, isPixelStyle); showCountdownGraphic(countdownStep, isPixelStyle);

View file

@ -811,16 +811,6 @@ class PlayState extends MusicBeatSubState
FlxG.watch.addQuick('bfAnim', currentStage.getBoyfriend().getCurrentAnimation()); 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. // TODO: Add a song event for Handle GF dance speed.
// Handle player death. // Handle player death.

View file

@ -51,13 +51,23 @@ class Song implements IPlayStateScriptedClass
difficultyIds = []; difficultyIds = [];
difficulties = new Map<String, SongDifficulty>(); difficulties = new Map<String, SongDifficulty>();
_metadata = SongDataParser.loadSongMetadata(songId); try
if (_metadata == null || _metadata.length == 0 && !ignoreErrors) {
_metadata = SongDataParser.loadSongMetadata(songId);
}
catch (e)
{
_metadata = [];
}
if (_metadata.length == 0 && !ignoreErrors)
{ {
throw 'Could not find song data for songId: $songId'; throw 'Could not find song data for songId: $songId';
} }
else
populateFromMetadata(); {
populateFromMetadata();
}
} }
@:allow(funkin.play.song.Song) @:allow(funkin.play.song.Song)
@ -97,6 +107,8 @@ class Song implements IPlayStateScriptedClass
*/ */
function populateFromMetadata():Void function populateFromMetadata():Void
{ {
if (_metadata == null || _metadata.length == 0) return;
// Variations may have different artist, time format, generatedBy, etc. // Variations may have different artist, time format, generatedBy, etc.
for (metadata in _metadata) for (metadata in _metadata)
{ {

View file

@ -203,10 +203,12 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
{ {
if (hasDanced) if (hasDanced)
{ {
trace('DanceRight (alternate)');
playAnimation('danceRight$idleSuffix', forceRestart); playAnimation('danceRight$idleSuffix', forceRestart);
} }
else else
{ {
trace('DanceLeft (alternate)');
playAnimation('danceLeft$idleSuffix', forceRestart); playAnimation('danceLeft$idleSuffix', forceRestart);
} }
hasDanced = !hasDanced; hasDanced = !hasDanced;

View file

@ -241,7 +241,11 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass
propSprite.animation.play(dataProp.startingAnimation); 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); addBopper(cast propSprite, dataProp.name);
} }