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

Merge pull request #805 from FunkinCrew/bugfix/two-fixes

[PUBLIC PR] Two bug fixes
This commit is contained in:
Cameron Taylor 2024-09-30 10:33:20 -04:00 committed by GitHub
commit 84ff83759f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 18 deletions

View file

@ -430,12 +430,13 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
* @param autoDestroy Whether to destroy this sound when it finishes playing.
* Leave this value set to `false` if you want to re-use this `FunkinSound` instance.
* @param autoPlay Whether to play the sound immediately or wait for a `play()` call.
* @param persist Whether to keep this `FunkinSound` between states, or destroy it.
* @param onComplete Called when the sound finished playing.
* @param onLoad Called when the sound finished loading. Called immediately for succesfully loaded embedded sounds.
* @return A `FunkinSound` object, or `null` if the sound could not be loaded.
*/
public static function load(embeddedSound:FlxSoundAsset, volume:Float = 1.0, looped:Bool = false, autoDestroy:Bool = false, autoPlay:Bool = false,
?onComplete:Void->Void, ?onLoad:Void->Void):Null<FunkinSound>
persist:Bool = false, ?onComplete:Void->Void, ?onLoad:Void->Void):Null<FunkinSound>
{
@:privateAccess
if (SoundMixer.__soundChannels.length >= SoundMixer.MAX_ACTIVE_CHANNELS)
@ -462,7 +463,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
if (autoPlay) sound.play();
sound.volume = volume;
sound.group = FlxG.sound.defaultSoundGroup;
sound.persist = true;
sound.persist = persist;
// Make sure to add the sound to the list.
// If it's already in, it won't get re-added.

View file

@ -233,15 +233,9 @@ class BaseCharacter extends Bopper
*/
public function resetCharacter(resetCamera:Bool = true):Void
{
// Reset the animation offsets. This will modify x and y to be the absolute position of the character.
// this.animOffsets = [0, 0];
// Now we can set the x and y to be their original values without having to account for animOffsets.
// Set the x and y to be their original values.
this.resetPosition();
// Then reapply animOffsets...
// applyAnimationOffsets(getCurrentAnimation());
this.dance(true); // Force to avoid the old animation playing with the wrong offset at the start of the song.
// Make sure we are playing the idle animation
// ...then update the hitbox so that this.width and this.height are correct.

View file

@ -150,11 +150,8 @@ class Bopper extends StageProp implements IPlayStateScriptedClass
*/
public function resetPosition()
{
var oldAnimOffsets = [animOffsets[0], animOffsets[1]];
animOffsets = [0, 0];
this.x = originalPosition.x;
this.y = originalPosition.y;
animOffsets = oldAnimOffsets;
}
function update_shouldAlternate():Void

View file

@ -443,12 +443,7 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
character.x = stageCharData.position[0] - character.characterOrigin.x;
character.y = stageCharData.position[1] - character.characterOrigin.y;
@:privateAccess(funkin.play.stage.Bopper)
{
// Undo animOffsets before saving original position.
character.originalPosition.x = character.x + character.animOffsets[0];
character.originalPosition.y = character.y + character.animOffsets[1];
}
character.originalPosition.set(character.x, character.y);
var finalScale = character.getBaseScale() * stageCharData.scale;
character.setScale(finalScale); // Don't use scale.set for characters!