mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-09-05 21:37:58 +00:00
Compare commits
3 commits
5fd2ea0bcf
...
21333ee8dc
Author | SHA1 | Date | |
---|---|---|---|
|
21333ee8dc | ||
|
eaf998adf7 | ||
|
96de434d75 |
|
@ -827,6 +827,8 @@ class PlayState extends MusicBeatSubState
|
|||
{
|
||||
if (!assertChartExists()) return;
|
||||
|
||||
prevScrollTargets = [];
|
||||
|
||||
dispatchEvent(new ScriptEvent(SONG_RETRY));
|
||||
|
||||
resetCamera();
|
||||
|
@ -3259,6 +3261,8 @@ class PlayState extends MusicBeatSubState
|
|||
cancelCameraZoomTween();
|
||||
}
|
||||
|
||||
var prevScrollTargets:Array<Dynamic> = []; // used to snap scroll speed when things go unruely
|
||||
|
||||
/**
|
||||
* The magical function that shall tween the scroll speed.
|
||||
*/
|
||||
|
@ -3266,6 +3270,18 @@ class PlayState extends MusicBeatSubState
|
|||
{
|
||||
// Cancel the current tween if it's active.
|
||||
cancelScrollSpeedTweens();
|
||||
|
||||
// Snap to previous event value to prevent the tween breaking when another event cancels the previous tween.
|
||||
for (i in prevScrollTargets)
|
||||
{
|
||||
var value:Float = i[0];
|
||||
var strum:Strumline = Reflect.getProperty(this, i[1]);
|
||||
strum.scrollSpeed = value;
|
||||
}
|
||||
|
||||
// for next event, clean array.
|
||||
prevScrollTargets = [];
|
||||
|
||||
for (i in strumlines)
|
||||
{
|
||||
var value:Float = speed;
|
||||
|
@ -3282,6 +3298,8 @@ class PlayState extends MusicBeatSubState
|
|||
'scrollSpeed': value
|
||||
}, duration, {ease: ease}));
|
||||
}
|
||||
// make sure charts dont break if the charter is dumb and stupid
|
||||
prevScrollTargets.push([value, i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ class ScrollSpeedEvent extends SongEvent
|
|||
static final DEFAULT_SCROLL:Float = 1;
|
||||
static final DEFAULT_DURATION:Float = 4.0;
|
||||
static final DEFAULT_EASE:String = 'linear';
|
||||
static final DEFAULT_ABSOLUTE:Bool = false;
|
||||
static final DEFAULT_STRUMLINE:String = 'both'; // my special little trick
|
||||
|
||||
public override function handleEvent(data:SongEventData):Void
|
||||
|
@ -51,12 +52,14 @@ class ScrollSpeedEvent extends SongEvent
|
|||
|
||||
var strumline:String = data.getString('strumline') ?? DEFAULT_STRUMLINE;
|
||||
|
||||
var absolute:Bool = data.getBool('absolute') ?? DEFAULT_ABSOLUTE;
|
||||
|
||||
var strumlineNames:Array<String> = [];
|
||||
|
||||
if (scroll == 0)
|
||||
if (!absolute)
|
||||
{
|
||||
// if the parameter is set to 0, reset the scroll speed to normal.
|
||||
scroll = PlayState.instance?.currentChart?.scrollSpeed ?? 1.0;
|
||||
// If absolute is set to false, do the awesome multiplicative thing
|
||||
scroll = scroll * (PlayState.instance?.currentChart?.scrollSpeed ?? 1.0);
|
||||
}
|
||||
|
||||
switch (strumline)
|
||||
|
@ -103,8 +106,8 @@ class ScrollSpeedEvent extends SongEvent
|
|||
return new SongEventSchema([
|
||||
{
|
||||
name: 'scroll',
|
||||
title: 'Scroll Amount',
|
||||
defaultValue: 0.0,
|
||||
title: 'Target Value',
|
||||
defaultValue: 1.0,
|
||||
step: 0.1,
|
||||
type: SongEventFieldType.FLOAT,
|
||||
units: 'x'
|
||||
|
@ -157,6 +160,12 @@ class ScrollSpeedEvent extends SongEvent
|
|||
defaultValue: 'both',
|
||||
type: SongEventFieldType.ENUM,
|
||||
keys: ['Both' => 'both', 'Player' => 'player', 'Opponent' => 'opponent']
|
||||
},
|
||||
{
|
||||
name: 'absolute',
|
||||
title: 'Absolute',
|
||||
defaultValue: false,
|
||||
type: SongEventFieldType.BOOL,
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -168,7 +168,6 @@ class SustainTrail extends FlxSprite
|
|||
if (s < 0.0) s = 0.0;
|
||||
|
||||
if (sustainLength == s) return s;
|
||||
graphicHeight = sustainHeight(s, parentStrumline?.scrollSpeed ?? 1.0);
|
||||
this.sustainLength = s;
|
||||
triggerRedraw();
|
||||
return this.sustainLength;
|
||||
|
@ -176,6 +175,7 @@ class SustainTrail extends FlxSprite
|
|||
|
||||
function triggerRedraw()
|
||||
{
|
||||
graphicHeight = sustainHeight(sustainLength, parentStrumline?.scrollSpeed ?? 1.0);
|
||||
updateClipping();
|
||||
updateHitbox();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue