mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
multiplicative added!! + sum tween fixes
This commit is contained in:
parent
5fd2ea0bcf
commit
96de434d75
2 changed files with 30 additions and 5 deletions
|
@ -3259,6 +3259,8 @@ class PlayState extends MusicBeatSubState
|
||||||
cancelCameraZoomTween();
|
cancelCameraZoomTween();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var prevScrollTargets:Array<Dynamic> = []; // used to snap scroll speed when things go unruely
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The magical function that shall tween the scroll speed.
|
* The magical function that shall tween the scroll speed.
|
||||||
*/
|
*/
|
||||||
|
@ -3266,6 +3268,18 @@ class PlayState extends MusicBeatSubState
|
||||||
{
|
{
|
||||||
// Cancel the current tween if it's active.
|
// Cancel the current tween if it's active.
|
||||||
cancelScrollSpeedTweens();
|
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[1];
|
||||||
|
var strum:Strumline = Reflect.getProperty(this, i[0]);
|
||||||
|
strum.scrollSpeed = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for next event, clean array.
|
||||||
|
prevScrollTargets = [];
|
||||||
|
|
||||||
for (i in strumlines)
|
for (i in strumlines)
|
||||||
{
|
{
|
||||||
var value:Float = speed;
|
var value:Float = speed;
|
||||||
|
@ -3282,6 +3296,8 @@ class PlayState extends MusicBeatSubState
|
||||||
'scrollSpeed': value
|
'scrollSpeed': value
|
||||||
}, duration, {ease: ease}));
|
}, 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_SCROLL:Float = 1;
|
||||||
static final DEFAULT_DURATION:Float = 4.0;
|
static final DEFAULT_DURATION:Float = 4.0;
|
||||||
static final DEFAULT_EASE:String = 'linear';
|
static final DEFAULT_EASE:String = 'linear';
|
||||||
|
static final DEFAULT_ABSOLUTE:Bool = false;
|
||||||
static final DEFAULT_STRUMLINE:String = 'both'; // my special little trick
|
static final DEFAULT_STRUMLINE:String = 'both'; // my special little trick
|
||||||
|
|
||||||
public override function handleEvent(data:SongEventData):Void
|
public override function handleEvent(data:SongEventData):Void
|
||||||
|
@ -51,12 +52,14 @@ class ScrollSpeedEvent extends SongEvent
|
||||||
|
|
||||||
var strumline:String = data.getString('strumline') ?? DEFAULT_STRUMLINE;
|
var strumline:String = data.getString('strumline') ?? DEFAULT_STRUMLINE;
|
||||||
|
|
||||||
|
var absolute:Bool = data.getBool('absolute') ?? DEFAULT_ABSOLUTE;
|
||||||
|
|
||||||
var strumlineNames:Array<String> = [];
|
var strumlineNames:Array<String> = [];
|
||||||
|
|
||||||
if (scroll == 0)
|
if (!absolute)
|
||||||
{
|
{
|
||||||
// if the parameter is set to 0, reset the scroll speed to normal.
|
// If absolute is set to false, do the awesome multiplicative thing
|
||||||
scroll = PlayState.instance?.currentChart?.scrollSpeed ?? 1.0;
|
scroll = scroll * (PlayState.instance?.currentChart?.scrollSpeed ?? 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (strumline)
|
switch (strumline)
|
||||||
|
@ -103,8 +106,8 @@ class ScrollSpeedEvent extends SongEvent
|
||||||
return new SongEventSchema([
|
return new SongEventSchema([
|
||||||
{
|
{
|
||||||
name: 'scroll',
|
name: 'scroll',
|
||||||
title: 'Scroll Amount',
|
title: 'Target Value',
|
||||||
defaultValue: 0.0,
|
defaultValue: 1.0,
|
||||||
step: 0.1,
|
step: 0.1,
|
||||||
type: SongEventFieldType.FLOAT,
|
type: SongEventFieldType.FLOAT,
|
||||||
units: 'x'
|
units: 'x'
|
||||||
|
@ -157,6 +160,12 @@ class ScrollSpeedEvent extends SongEvent
|
||||||
defaultValue: 'both',
|
defaultValue: 'both',
|
||||||
type: SongEventFieldType.ENUM,
|
type: SongEventFieldType.ENUM,
|
||||||
keys: ['Both' => 'both', 'Player' => 'player', 'Opponent' => 'opponent']
|
keys: ['Both' => 'both', 'Player' => 'player', 'Opponent' => 'opponent']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'absolute',
|
||||||
|
title: 'Absolute',
|
||||||
|
defaultValue: false,
|
||||||
|
type: SongEventFieldType.BOOL,
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue