mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-19 21:33:06 +00:00
assets submod
This commit is contained in:
commit
fe52fdfbad
|
@ -119,7 +119,7 @@
|
||||||
<haxelib name="flixel-text-input" /> <!-- Improved text field rendering for HaxeUI -->
|
<haxelib name="flixel-text-input" /> <!-- Improved text field rendering for HaxeUI -->
|
||||||
<haxelib name="polymod" /> <!-- Modding framework -->
|
<haxelib name="polymod" /> <!-- Modding framework -->
|
||||||
<haxelib name="flxanimate" /> <!-- Texture atlas rendering -->
|
<haxelib name="flxanimate" /> <!-- Texture atlas rendering -->
|
||||||
<haxelib name="hxCodec" if="desktop" /> <!-- Video playback -->
|
<haxelib name="hxCodec" if="desktop" unless="hl" /> <!-- Video playback -->
|
||||||
|
|
||||||
<haxelib name="json2object" /> <!-- JSON parsing -->
|
<haxelib name="json2object" /> <!-- JSON parsing -->
|
||||||
<haxelib name="thx.semver" /> <!-- Version string handling -->
|
<haxelib name="thx.semver" /> <!-- Version string handling -->
|
||||||
|
|
|
@ -20,6 +20,6 @@ class GaussianBlurShader extends FlxRuntimeShader
|
||||||
public function setAmount(value:Float):Void
|
public function setAmount(value:Float):Void
|
||||||
{
|
{
|
||||||
this.amount = value;
|
this.amount = value;
|
||||||
this.setFloat("amount", amount);
|
this.setFloat("_amount", amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,6 @@ class Grayscale extends FlxRuntimeShader
|
||||||
public function setAmount(value:Float):Void
|
public function setAmount(value:Float):Void
|
||||||
{
|
{
|
||||||
amount = value;
|
amount = value;
|
||||||
this.setFloat("amount", amount);
|
this.setFloat("_amount", amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class HSVShader extends FlxRuntimeShader
|
||||||
|
|
||||||
function set_hue(value:Float):Float
|
function set_hue(value:Float):Float
|
||||||
{
|
{
|
||||||
this.setFloat('hue', value);
|
this.setFloat('_hue', value);
|
||||||
this.hue = value;
|
this.hue = value;
|
||||||
|
|
||||||
return this.hue;
|
return this.hue;
|
||||||
|
|
|
@ -245,20 +245,26 @@ class PlayState extends MusicBeatSubState
|
||||||
/**
|
/**
|
||||||
* The current camera zoom level without any modifiers applied.
|
* The current camera zoom level without any modifiers applied.
|
||||||
*/
|
*/
|
||||||
public var currentCameraZoom:Float = FlxCamera.defaultZoom * 1.05;
|
public var currentCameraZoom:Float = FlxCamera.defaultZoom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* currentCameraZoom is increased every beat, and lerped back to this value every frame, creating a smooth 'zoom-in' effect.
|
* Multiplier for currentCameraZoom for camera bops.
|
||||||
* Defaults to 1.05, but may be larger or smaller depending on the current stage.
|
* Lerped back to 1.0x every frame.
|
||||||
* Tweened via the `ZoomCamera` song event in direct mode.
|
|
||||||
*/
|
*/
|
||||||
public var defaultCameraZoom:Float = FlxCamera.defaultZoom * 1.05;
|
public var cameraBopMultiplier:Float = 1.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Camera zoom applied on top of currentCameraZoom.
|
* Default camera zoom for the current stage.
|
||||||
* Tweened via the `ZoomCamera` song event in additive mode.
|
* If we aren't in a stage, just use the default zoom (1.05x).
|
||||||
*/
|
*/
|
||||||
public var additiveCameraZoom:Float = 0;
|
public var stageZoom(get, never):Float;
|
||||||
|
|
||||||
|
function get_stageZoom():Float
|
||||||
|
{
|
||||||
|
if (currentStage != null) return currentStage.camZoom;
|
||||||
|
else
|
||||||
|
return FlxCamera.defaultZoom * 1.05;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current HUD camera zoom level.
|
* The current HUD camera zoom level.
|
||||||
|
@ -268,16 +274,18 @@ class PlayState extends MusicBeatSubState
|
||||||
public var defaultHUDCameraZoom:Float = FlxCamera.defaultZoom * 1.0;
|
public var defaultHUDCameraZoom:Float = FlxCamera.defaultZoom * 1.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intensity of the gameplay camera zoom.
|
* Camera bop intensity multiplier.
|
||||||
* @default `1.5%`
|
* Applied to cameraBopMultiplier on camera bops (usually every beat).
|
||||||
|
* @default `101.5%`
|
||||||
*/
|
*/
|
||||||
public var cameraZoomIntensity:Float = Constants.DEFAULT_ZOOM_INTENSITY;
|
public var cameraBopIntensity:Float = Constants.DEFAULT_BOP_INTENSITY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intensity of the HUD camera zoom.
|
* Intensity of the HUD camera zoom.
|
||||||
|
* Need to make this a multiplier later. Just shoving in 0.015 for now so it doesn't break.
|
||||||
* @default `3.0%`
|
* @default `3.0%`
|
||||||
*/
|
*/
|
||||||
public var hudCameraZoomIntensity:Float = Constants.DEFAULT_ZOOM_INTENSITY * 2.0;
|
public var hudCameraZoomIntensity:Float = 0.015 * 2.0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How many beats (quarter notes) between camera zooms.
|
* How many beats (quarter notes) between camera zooms.
|
||||||
|
@ -861,8 +869,8 @@ class PlayState extends MusicBeatSubState
|
||||||
regenNoteData();
|
regenNoteData();
|
||||||
|
|
||||||
// Reset camera zooming
|
// Reset camera zooming
|
||||||
cameraZoomIntensity = Constants.DEFAULT_ZOOM_INTENSITY;
|
cameraBopIntensity = Constants.DEFAULT_BOP_INTENSITY;
|
||||||
hudCameraZoomIntensity = Constants.DEFAULT_ZOOM_INTENSITY * 2.0;
|
hudCameraZoomIntensity = (cameraBopIntensity - 1.0) * 2.0;
|
||||||
cameraZoomRate = Constants.DEFAULT_ZOOM_RATE;
|
cameraZoomRate = Constants.DEFAULT_ZOOM_RATE;
|
||||||
|
|
||||||
health = Constants.HEALTH_STARTING;
|
health = Constants.HEALTH_STARTING;
|
||||||
|
@ -957,11 +965,12 @@ class PlayState extends MusicBeatSubState
|
||||||
if (health > Constants.HEALTH_MAX) health = Constants.HEALTH_MAX;
|
if (health > Constants.HEALTH_MAX) health = Constants.HEALTH_MAX;
|
||||||
if (health < Constants.HEALTH_MIN) health = Constants.HEALTH_MIN;
|
if (health < Constants.HEALTH_MIN) health = Constants.HEALTH_MIN;
|
||||||
|
|
||||||
// Lerp the camera zoom towards the target level.
|
// Apply camera zoom + multipliers.
|
||||||
if (subState == null)
|
if (subState == null)
|
||||||
{
|
{
|
||||||
currentCameraZoom = FlxMath.lerp(defaultCameraZoom, currentCameraZoom, 0.95);
|
cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, 0.95); // Lerp bop multiplier back to 1.0x
|
||||||
FlxG.camera.zoom = currentCameraZoom + additiveCameraZoom;
|
var zoomPlusBop = currentCameraZoom * cameraBopMultiplier; // Apply camera bop multiplier.
|
||||||
|
FlxG.camera.zoom = zoomPlusBop; // Actually apply the zoom to the camera.
|
||||||
|
|
||||||
camHUD.zoom = FlxMath.lerp(defaultHUDCameraZoom, camHUD.zoom, 0.95);
|
camHUD.zoom = FlxMath.lerp(defaultHUDCameraZoom, camHUD.zoom, 0.95);
|
||||||
}
|
}
|
||||||
|
@ -971,6 +980,7 @@ class PlayState extends MusicBeatSubState
|
||||||
FlxG.watch.addQuick('bfAnim', currentStage.getBoyfriend().getCurrentAnimation());
|
FlxG.watch.addQuick('bfAnim', currentStage.getBoyfriend().getCurrentAnimation());
|
||||||
}
|
}
|
||||||
FlxG.watch.addQuick('health', health);
|
FlxG.watch.addQuick('health', health);
|
||||||
|
FlxG.watch.addQuick('cameraBopIntensity', cameraBopIntensity);
|
||||||
|
|
||||||
// TODO: Add a song event for Handle GF dance speed.
|
// TODO: Add a song event for Handle GF dance speed.
|
||||||
|
|
||||||
|
@ -1367,15 +1377,15 @@ class PlayState extends MusicBeatSubState
|
||||||
// activeNotes.sort(SortUtil.byStrumtime, FlxSort.DESCENDING);
|
// activeNotes.sort(SortUtil.byStrumtime, FlxSort.DESCENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only zoom camera if we are zoomed by less than 35%.
|
// Only bop camera if zoom level is below 135%
|
||||||
if (Preferences.zoomCamera
|
if (Preferences.zoomCamera
|
||||||
&& FlxG.camera.zoom < (1.35 * defaultCameraZoom)
|
&& FlxG.camera.zoom < (1.35 * FlxCamera.defaultZoom)
|
||||||
&& cameraZoomRate > 0
|
&& cameraZoomRate > 0
|
||||||
&& Conductor.instance.currentBeat % cameraZoomRate == 0)
|
&& Conductor.instance.currentBeat % cameraZoomRate == 0)
|
||||||
{
|
{
|
||||||
// Zoom camera in (1.5%)
|
// Set zoom multiplier for camera bop.
|
||||||
currentCameraZoom += cameraZoomIntensity * defaultCameraZoom;
|
cameraBopMultiplier = cameraBopIntensity;
|
||||||
// Hud zooms double (3%)
|
// HUD camera zoom still uses old system. To change. (+3%)
|
||||||
camHUD.zoom += hudCameraZoomIntensity * defaultHUDCameraZoom;
|
camHUD.zoom += hudCameraZoomIntensity * defaultHUDCameraZoom;
|
||||||
}
|
}
|
||||||
// trace('Not bopping camera: ${FlxG.camera.zoom} < ${(1.35 * defaultCameraZoom)} && ${cameraZoomRate} > 0 && ${Conductor.instance.currentBeat} % ${cameraZoomRate} == ${Conductor.instance.currentBeat % cameraZoomRate}}');
|
// trace('Not bopping camera: ${FlxG.camera.zoom} < ${(1.35 * defaultCameraZoom)} && ${cameraZoomRate} > 0 && ${Conductor.instance.currentBeat} % ${cameraZoomRate} == ${Conductor.instance.currentBeat % cameraZoomRate}}');
|
||||||
|
@ -1566,12 +1576,11 @@ class PlayState extends MusicBeatSubState
|
||||||
{
|
{
|
||||||
if (PlayState.instance.isMinimalMode) return;
|
if (PlayState.instance.isMinimalMode) return;
|
||||||
// Apply camera zoom level from stage data.
|
// Apply camera zoom level from stage data.
|
||||||
defaultCameraZoom = currentStage?.camZoom ?? 1.0;
|
currentCameraZoom = stageZoom;
|
||||||
currentCameraZoom = defaultCameraZoom;
|
|
||||||
FlxG.camera.zoom = currentCameraZoom;
|
FlxG.camera.zoom = currentCameraZoom;
|
||||||
|
|
||||||
// Reset additive zoom.
|
// Reset bop multiplier.
|
||||||
additiveCameraZoom = 0;
|
cameraBopMultiplier = 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3116,6 +3125,15 @@ class PlayState extends MusicBeatSubState
|
||||||
FlxG.camera.focusOn(cameraFollowPoint.getPosition());
|
FlxG.camera.focusOn(cameraFollowPoint.getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the camera follow point's position and tweens the camera there.
|
||||||
|
*/
|
||||||
|
public function tweenCameraToPosition(?x:Float, ?y:Float, ?duration:Float, ?ease:Null<Float->Float>):Void
|
||||||
|
{
|
||||||
|
cameraFollowPoint.setPosition(x, y);
|
||||||
|
tweenCameraToFollowPoint(duration, ease);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables camera following and tweens the camera to the follow point manually.
|
* Disables camera following and tweens the camera to the follow point manually.
|
||||||
*/
|
*/
|
||||||
|
@ -3157,38 +3175,24 @@ class PlayState extends MusicBeatSubState
|
||||||
/**
|
/**
|
||||||
* Tweens the camera zoom to the desired amount.
|
* Tweens the camera zoom to the desired amount.
|
||||||
*/
|
*/
|
||||||
public function tweenCameraZoom(?zoom:Float, ?duration:Float, ?directMode:Bool, ?ease:Null<Float->Float>):Void
|
public function tweenCameraZoom(?zoom:Float, ?duration:Float, ?direct:Bool, ?ease:Null<Float->Float>):Void
|
||||||
{
|
{
|
||||||
// Cancel the current tween if it's active.
|
// Cancel the current tween if it's active.
|
||||||
cancelCameraZoomTween();
|
cancelCameraZoomTween();
|
||||||
|
|
||||||
var targetZoom = zoom * FlxCamera.defaultZoom;
|
// Direct mode: Set zoom directly.
|
||||||
|
// Stage mode: Set zoom as a multiplier of the current stage's default zoom.
|
||||||
|
var targetZoom = zoom * (direct ? FlxCamera.defaultZoom : stageZoom);
|
||||||
|
|
||||||
if (directMode) // Direct mode: Tween defaultCameraZoom for basic "smooth" zooms.
|
|
||||||
{
|
|
||||||
if (duration == 0)
|
if (duration == 0)
|
||||||
{
|
{
|
||||||
// Instant zoom. No tween needed.
|
// Instant zoom. No tween needed.
|
||||||
defaultCameraZoom = targetZoom;
|
currentCameraZoom = targetZoom;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Zoom tween! Caching it so we can cancel/pause it later if needed.
|
// Zoom tween! Caching it so we can cancel/pause it later if needed.
|
||||||
cameraZoomTween = FlxTween.tween(this, {defaultCameraZoom: targetZoom}, duration, {ease: ease});
|
cameraZoomTween = FlxTween.tween(this, {currentCameraZoom: targetZoom}, duration, {ease: ease});
|
||||||
}
|
|
||||||
}
|
|
||||||
else // Additive mode: Tween additiveCameraZoom for ease-based zooms.
|
|
||||||
{
|
|
||||||
if (duration == 0)
|
|
||||||
{
|
|
||||||
// Instant zoom. No tween needed.
|
|
||||||
additiveCameraZoom = targetZoom;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Zoom tween! Caching it so we can cancel/pause it later if needed.
|
|
||||||
cameraZoomTween = FlxTween.tween(this, {additiveCameraZoom: targetZoom}, duration, {ease: ease});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ class VideoCutscene
|
||||||
blackScreen = null;
|
blackScreen = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FlxTween.tween(FlxG.camera, {zoom: PlayState.instance.defaultCameraZoom}, transitionTime,
|
FlxTween.tween(FlxG.camera, {zoom: PlayState.instance.stageZoom}, transitionTime,
|
||||||
{
|
{
|
||||||
ease: FlxEase.quadInOut,
|
ease: FlxEase.quadInOut,
|
||||||
onComplete: function(twn:FlxTween) {
|
onComplete: function(twn:FlxTween) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import funkin.modding.IScriptedClass.IDialogueScriptedClass;
|
||||||
import funkin.modding.IScriptedClass.IEventHandler;
|
import funkin.modding.IScriptedClass.IEventHandler;
|
||||||
import funkin.play.cutscene.dialogue.DialogueBox;
|
import funkin.play.cutscene.dialogue.DialogueBox;
|
||||||
import funkin.util.SortUtil;
|
import funkin.util.SortUtil;
|
||||||
|
import funkin.util.EaseUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A high-level handler for dialogue.
|
* A high-level handler for dialogue.
|
||||||
|
@ -179,7 +180,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass impl
|
||||||
if (backdropData.fadeTime > 0.0)
|
if (backdropData.fadeTime > 0.0)
|
||||||
{
|
{
|
||||||
backdrop.alpha = 0.0;
|
backdrop.alpha = 0.0;
|
||||||
FlxTween.tween(backdrop, {alpha: 1.0}, backdropData.fadeTime, {ease: FlxEase.linear});
|
FlxTween.tween(backdrop, {alpha: 1.0}, backdropData.fadeTime, {ease: EaseUtil.stepped(10)});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -403,6 +404,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass impl
|
||||||
type: ONESHOT, // holy shit like the game no way
|
type: ONESHOT, // holy shit like the game no way
|
||||||
startDelay: 0,
|
startDelay: 0,
|
||||||
onComplete: (_) -> endOutro(),
|
onComplete: (_) -> endOutro(),
|
||||||
|
ease: EaseUtil.stepped(8)
|
||||||
});
|
});
|
||||||
|
|
||||||
FlxTween.tween(this.music, {volume: 0.0}, outroData.fadeTime);
|
FlxTween.tween(this.music, {volume: 0.0}, outroData.fadeTime);
|
||||||
|
|
|
@ -70,80 +70,76 @@ class FocusCameraSongEvent extends SongEvent
|
||||||
|
|
||||||
if (char == null) char = cast data.value;
|
if (char == null) char = cast data.value;
|
||||||
|
|
||||||
var useTween:Null<Bool> = data.getBool('useTween');
|
|
||||||
if (useTween == null) useTween = false;
|
|
||||||
var duration:Null<Float> = data.getFloat('duration');
|
var duration:Null<Float> = data.getFloat('duration');
|
||||||
if (duration == null) duration = 4.0;
|
if (duration == null) duration = 4.0;
|
||||||
var ease:Null<String> = data.getString('ease');
|
var ease:Null<String> = data.getString('ease');
|
||||||
if (ease == null) ease = 'linear';
|
if (ease == null) ease = 'CLASSIC';
|
||||||
|
|
||||||
|
var currentStage = PlayState.instance.currentStage;
|
||||||
|
|
||||||
|
// Get target position based on char.
|
||||||
|
var targetX:Float = posX;
|
||||||
|
var targetY:Float = posY;
|
||||||
|
|
||||||
switch (char)
|
switch (char)
|
||||||
{
|
{
|
||||||
case -1: // Position
|
case -1: // Position ("focus" on origin)
|
||||||
trace('Focusing camera on static position.');
|
trace('Focusing camera on static position.');
|
||||||
var xTarget:Float = posX;
|
|
||||||
var yTarget:Float = posY;
|
|
||||||
|
|
||||||
PlayState.instance.cameraFollowPoint.setPosition(xTarget, yTarget);
|
case 0: // Boyfriend (focus on player)
|
||||||
case 0: // Boyfriend
|
if (currentStage.getBoyfriend() == null)
|
||||||
// Focus the camera on the player.
|
|
||||||
if (PlayState.instance.currentStage.getBoyfriend() == null)
|
|
||||||
{
|
{
|
||||||
trace('No BF to focus on.');
|
trace('No BF to focus on.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trace('Focusing camera on player.');
|
trace('Focusing camera on player.');
|
||||||
var xTarget:Float = PlayState.instance.currentStage.getBoyfriend().cameraFocusPoint.x + posX;
|
var bfPoint = currentStage.getBoyfriend().cameraFocusPoint;
|
||||||
var yTarget:Float = PlayState.instance.currentStage.getBoyfriend().cameraFocusPoint.y + posY;
|
targetX += bfPoint.x;
|
||||||
|
targetY += bfPoint.y;
|
||||||
|
|
||||||
PlayState.instance.cameraFollowPoint.setPosition(xTarget, yTarget);
|
case 1: // Dad (focus on opponent)
|
||||||
case 1: // Dad
|
if (currentStage.getDad() == null)
|
||||||
// Focus the camera on the dad.
|
|
||||||
if (PlayState.instance.currentStage.getDad() == null)
|
|
||||||
{
|
{
|
||||||
trace('No dad to focus on.');
|
trace('No dad to focus on.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trace('Focusing camera on dad.');
|
trace('Focusing camera on opponent.');
|
||||||
trace(PlayState.instance.currentStage.getDad());
|
var dadPoint = currentStage.getDad().cameraFocusPoint;
|
||||||
var xTarget:Float = PlayState.instance.currentStage.getDad().cameraFocusPoint.x + posX;
|
targetX += dadPoint.x;
|
||||||
var yTarget:Float = PlayState.instance.currentStage.getDad().cameraFocusPoint.y + posY;
|
targetY += dadPoint.y;
|
||||||
|
|
||||||
PlayState.instance.cameraFollowPoint.setPosition(xTarget, yTarget);
|
case 2: // Girlfriend (focus on girlfriend)
|
||||||
case 2: // Girlfriend
|
if (currentStage.getGirlfriend() == null)
|
||||||
// Focus the camera on the girlfriend.
|
|
||||||
if (PlayState.instance.currentStage.getGirlfriend() == null)
|
|
||||||
{
|
{
|
||||||
trace('No GF to focus on.');
|
trace('No GF to focus on.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
trace('Focusing camera on girlfriend.');
|
trace('Focusing camera on girlfriend.');
|
||||||
var xTarget:Float = PlayState.instance.currentStage.getGirlfriend().cameraFocusPoint.x + posX;
|
var gfPoint = currentStage.getGirlfriend().cameraFocusPoint;
|
||||||
var yTarget:Float = PlayState.instance.currentStage.getGirlfriend().cameraFocusPoint.y + posY;
|
targetX += gfPoint.x;
|
||||||
|
targetY += gfPoint.y;
|
||||||
|
|
||||||
PlayState.instance.cameraFollowPoint.setPosition(xTarget, yTarget);
|
|
||||||
default:
|
default:
|
||||||
trace('Unknown camera focus: ' + data);
|
trace('Unknown camera focus: ' + data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useTween)
|
// Apply tween based on ease.
|
||||||
{
|
|
||||||
switch (ease)
|
switch (ease)
|
||||||
{
|
{
|
||||||
case 'INSTANT':
|
case 'CLASSIC': // Old-school. No ease. Just set follow point.
|
||||||
PlayState.instance.tweenCameraToFollowPoint(0);
|
PlayState.instance.cancelCameraFollowTween();
|
||||||
|
PlayState.instance.cameraFollowPoint.setPosition(targetX, targetY);
|
||||||
|
case 'INSTANT': // Instant ease. Duration is automatically 0.
|
||||||
|
PlayState.instance.tweenCameraToPosition(targetX, targetY, 0);
|
||||||
default:
|
default:
|
||||||
var durSeconds = Conductor.instance.stepLengthMs * duration / 1000;
|
var durSeconds = Conductor.instance.stepLengthMs * duration / 1000;
|
||||||
|
|
||||||
var easeFunction:Null<Float->Float> = Reflect.field(FlxEase, ease);
|
var easeFunction:Null<Float->Float> = Reflect.field(FlxEase, ease);
|
||||||
if (easeFunction == null)
|
if (easeFunction == null)
|
||||||
{
|
{
|
||||||
trace('Invalid ease function: $ease');
|
trace('Invalid ease function: $ease');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
PlayState.instance.tweenCameraToPosition(targetX, targetY, durSeconds, easeFunction);
|
||||||
PlayState.instance.tweenCameraToFollowPoint(durSeconds, easeFunction);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,12 +183,6 @@ class FocusCameraSongEvent extends SongEvent
|
||||||
type: SongEventFieldType.FLOAT,
|
type: SongEventFieldType.FLOAT,
|
||||||
units: "px"
|
units: "px"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'useTween',
|
|
||||||
title: 'Use Tween',
|
|
||||||
type: SongEventFieldType.BOOL,
|
|
||||||
defaultValue: false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'duration',
|
name: 'duration',
|
||||||
title: 'Duration',
|
title: 'Duration',
|
||||||
|
@ -208,7 +198,9 @@ class FocusCameraSongEvent extends SongEvent
|
||||||
type: SongEventFieldType.ENUM,
|
type: SongEventFieldType.ENUM,
|
||||||
keys: [
|
keys: [
|
||||||
'Linear' => 'linear',
|
'Linear' => 'linear',
|
||||||
'Instant' => 'INSTANT',
|
'Sine In' => 'sineIn',
|
||||||
|
'Sine Out' => 'sineOut',
|
||||||
|
'Sine In/Out' => 'sineInOut',
|
||||||
'Quad In' => 'quadIn',
|
'Quad In' => 'quadIn',
|
||||||
'Quad Out' => 'quadOut',
|
'Quad Out' => 'quadOut',
|
||||||
'Quad In/Out' => 'quadInOut',
|
'Quad In/Out' => 'quadInOut',
|
||||||
|
@ -221,15 +213,17 @@ class FocusCameraSongEvent extends SongEvent
|
||||||
'Quint In' => 'quintIn',
|
'Quint In' => 'quintIn',
|
||||||
'Quint Out' => 'quintOut',
|
'Quint Out' => 'quintOut',
|
||||||
'Quint In/Out' => 'quintInOut',
|
'Quint In/Out' => 'quintInOut',
|
||||||
|
'Expo In' => 'expoIn',
|
||||||
|
'Expo Out' => 'expoOut',
|
||||||
|
'Expo In/Out' => 'expoInOut',
|
||||||
'Smooth Step In' => 'smoothStepIn',
|
'Smooth Step In' => 'smoothStepIn',
|
||||||
'Smooth Step Out' => 'smoothStepOut',
|
'Smooth Step Out' => 'smoothStepOut',
|
||||||
'Smooth Step In/Out' => 'smoothStepInOut',
|
'Smooth Step In/Out' => 'smoothStepInOut',
|
||||||
'Sine In' => 'sineIn',
|
|
||||||
'Sine Out' => 'sineOut',
|
|
||||||
'Sine In/Out' => 'sineInOut',
|
|
||||||
'Elastic In' => 'elasticIn',
|
'Elastic In' => 'elasticIn',
|
||||||
'Elastic Out' => 'elasticOut',
|
'Elastic Out' => 'elasticOut',
|
||||||
'Elastic In/Out' => 'elasticInOut',
|
'Elastic In/Out' => 'elasticInOut',
|
||||||
|
'Instant (Ignores duration)' => 'INSTANT',
|
||||||
|
'Classic (Ignores duration)' => 'CLASSIC'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -50,8 +50,8 @@ class SetCameraBopSongEvent extends SongEvent
|
||||||
var intensity:Null<Float> = data.getFloat('intensity');
|
var intensity:Null<Float> = data.getFloat('intensity');
|
||||||
if (intensity == null) intensity = 1.0;
|
if (intensity == null) intensity = 1.0;
|
||||||
|
|
||||||
PlayState.instance.cameraZoomIntensity = Constants.DEFAULT_ZOOM_INTENSITY * intensity;
|
PlayState.instance.cameraBopIntensity = (Constants.DEFAULT_BOP_INTENSITY - 1.0) * intensity + 1.0;
|
||||||
PlayState.instance.hudCameraZoomIntensity = Constants.DEFAULT_ZOOM_INTENSITY * intensity * 2.0;
|
PlayState.instance.hudCameraZoomIntensity = (Constants.DEFAULT_BOP_INTENSITY - 1.0) * intensity * 2.0;
|
||||||
PlayState.instance.cameraZoomRate = rate;
|
PlayState.instance.cameraZoomRate = rate;
|
||||||
trace('Set camera zoom rate to ${PlayState.instance.cameraZoomRate}');
|
trace('Set camera zoom rate to ${PlayState.instance.cameraZoomRate}');
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,6 @@ class ZoomCameraSongEvent extends SongEvent
|
||||||
PlayState.instance.tweenCameraZoom(zoom, 0, isDirectMode);
|
PlayState.instance.tweenCameraZoom(zoom, 0, isDirectMode);
|
||||||
default:
|
default:
|
||||||
var durSeconds = Conductor.instance.stepLengthMs * duration / 1000;
|
var durSeconds = Conductor.instance.stepLengthMs * duration / 1000;
|
||||||
|
|
||||||
var easeFunction:Null<Float->Float> = Reflect.field(FlxEase, ease);
|
var easeFunction:Null<Float->Float> = Reflect.field(FlxEase, ease);
|
||||||
if (easeFunction == null)
|
if (easeFunction == null)
|
||||||
{
|
{
|
||||||
|
@ -102,9 +101,9 @@ class ZoomCameraSongEvent extends SongEvent
|
||||||
* ```
|
* ```
|
||||||
* {
|
* {
|
||||||
* 'zoom': FLOAT, // Target zoom level.
|
* 'zoom': FLOAT, // Target zoom level.
|
||||||
* 'duration': FLOAT, // Optional duration in steps.
|
* 'duration': FLOAT, // Duration in steps.
|
||||||
* 'mode': ENUM, // Whether to set additive zoom or direct zoom.
|
* 'mode': ENUM, // Whether zoom is relative to the stage or absolute zoom.
|
||||||
* 'ease': ENUM, // Optional easing function.
|
* 'ease': ENUM, // Easing function.
|
||||||
* }
|
* }
|
||||||
* @return SongEventSchema
|
* @return SongEventSchema
|
||||||
*/
|
*/
|
||||||
|
@ -130,9 +129,9 @@ class ZoomCameraSongEvent extends SongEvent
|
||||||
{
|
{
|
||||||
name: 'mode',
|
name: 'mode',
|
||||||
title: 'Mode',
|
title: 'Mode',
|
||||||
defaultValue: 'direct',
|
defaultValue: 'stage',
|
||||||
type: SongEventFieldType.ENUM,
|
type: SongEventFieldType.ENUM,
|
||||||
keys: ['Additive' => 'additive', 'Direct' => 'direct']
|
keys: ['Stage zoom' => 'stage', 'Absolute zoom' => 'direct']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ease',
|
name: 'ease',
|
||||||
|
@ -142,6 +141,9 @@ class ZoomCameraSongEvent extends SongEvent
|
||||||
keys: [
|
keys: [
|
||||||
'Linear' => 'linear',
|
'Linear' => 'linear',
|
||||||
'Instant' => 'INSTANT',
|
'Instant' => 'INSTANT',
|
||||||
|
'Sine In' => 'sineIn',
|
||||||
|
'Sine Out' => 'sineOut',
|
||||||
|
'Sine In/Out' => 'sineInOut',
|
||||||
'Quad In' => 'quadIn',
|
'Quad In' => 'quadIn',
|
||||||
'Quad Out' => 'quadOut',
|
'Quad Out' => 'quadOut',
|
||||||
'Quad In/Out' => 'quadInOut',
|
'Quad In/Out' => 'quadInOut',
|
||||||
|
@ -154,15 +156,15 @@ class ZoomCameraSongEvent extends SongEvent
|
||||||
'Quint In' => 'quintIn',
|
'Quint In' => 'quintIn',
|
||||||
'Quint Out' => 'quintOut',
|
'Quint Out' => 'quintOut',
|
||||||
'Quint In/Out' => 'quintInOut',
|
'Quint In/Out' => 'quintInOut',
|
||||||
|
'Expo In' => 'expoIn',
|
||||||
|
'Expo Out' => 'expoOut',
|
||||||
|
'Expo In/Out' => 'expoInOut',
|
||||||
'Smooth Step In' => 'smoothStepIn',
|
'Smooth Step In' => 'smoothStepIn',
|
||||||
'Smooth Step Out' => 'smoothStepOut',
|
'Smooth Step Out' => 'smoothStepOut',
|
||||||
'Smooth Step In/Out' => 'smoothStepInOut',
|
'Smooth Step In/Out' => 'smoothStepInOut',
|
||||||
'Sine In' => 'sineIn',
|
|
||||||
'Sine Out' => 'sineOut',
|
|
||||||
'Sine In/Out' => 'sineInOut',
|
|
||||||
'Elastic In' => 'elasticIn',
|
'Elastic In' => 'elasticIn',
|
||||||
'Elastic Out' => 'elasticOut',
|
'Elastic Out' => 'elasticOut',
|
||||||
'Elastic In/Out' => 'elasticInOut',
|
'Elastic In/Out' => 'elasticInOut'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -223,9 +223,10 @@ class Constants
|
||||||
public static final DEFAULT_VARIATION_LIST:Array<String> = ['default', 'erect', 'pico'];
|
public static final DEFAULT_VARIATION_LIST:Array<String> = ['default', 'erect', 'pico'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default intensity for camera zooms.
|
* The default intensity multiplier for camera bops.
|
||||||
|
* Prolly needs to be tuned bc it's a multiplier now.
|
||||||
*/
|
*/
|
||||||
public static final DEFAULT_ZOOM_INTENSITY:Float = 0.015;
|
public static final DEFAULT_BOP_INTENSITY:Float = 1.015;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default rate for camera zooms (in beats per zoom).
|
* The default rate for camera zooms (in beats per zoom).
|
||||||
|
|
17
source/funkin/util/EaseUtil.hx
Normal file
17
source/funkin/util/EaseUtil.hx
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package funkin.util;
|
||||||
|
|
||||||
|
class EaseUtil
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns an ease function that eases via steps.
|
||||||
|
* Useful for "retro" style fades (week 6!)
|
||||||
|
* @param steps how many steps to ease over
|
||||||
|
* @return Float->Float
|
||||||
|
*/
|
||||||
|
public static inline function stepped(steps:Int):Float->Float
|
||||||
|
{
|
||||||
|
return function(t:Float):Float {
|
||||||
|
return Math.floor(t * steps) / steps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue