Zoom Multiplier for camZooming
This commit is contained in:
@@ -136,6 +136,9 @@ class Flags {
|
||||
public static var DEFAULT_CAM_ZOOM_STRENGTH:Int = 1;
|
||||
public static var DEFAULT_CAM_ZOOM:Float = 1.05; // what zoom level it defaults to
|
||||
public static var DEFAULT_HUD_ZOOM:Float = 1.0;
|
||||
public static var DEFAULT_ZOOM:Float = 1.0;
|
||||
public static var DEFAULT_ZOOM_LERP:Float = 0.05;
|
||||
public static var USE_CAM_ZOOM_MULT:Bool = true;
|
||||
public static var MAX_CAMERA_ZOOM_MULT:Float = 1.35;
|
||||
|
||||
// to translate these you need to convert them into ids
|
||||
|
||||
@@ -372,6 +372,17 @@ class PlayState extends MusicBeatState
|
||||
*/
|
||||
public var camHUDZoomLerp:Float = Flags.DEFAULT_HUD_ZOOM_LERP;
|
||||
|
||||
/**
|
||||
* Camera zoom at which the cameras that zooms lerps to.
|
||||
* (Only used if useCamZoomMult is on).
|
||||
*/
|
||||
public var defaultZoom:Float = Flags.DEFAULT_ZOOM;
|
||||
/**
|
||||
* Speed at which the cameras that zooms zoom lerps to.
|
||||
* (Only used if useCamZoomMult is on).
|
||||
*/
|
||||
public var camZoomLerp:Float = Flags.DEFAULT_ZOOM_LERP;
|
||||
|
||||
/**
|
||||
* Whenever cam zooming is enabled, enables on a note hit if not cancelled.
|
||||
*/
|
||||
@@ -401,12 +412,21 @@ class PlayState extends MusicBeatState
|
||||
*/
|
||||
public var camZoomingStrength:Float = Flags.DEFAULT_CAM_ZOOM_STRENGTH;
|
||||
/**
|
||||
* Default multiplier for `maxCamZoom`.
|
||||
*/
|
||||
* Default multiplier for `maxCamZoom`.
|
||||
*/
|
||||
public var maxCamZoomMult:Float = Flags.MAX_CAMERA_ZOOM_MULT;
|
||||
/**
|
||||
* Maximum amount of zoom for the camera (based on `maxCamZoomMult` and the camera's zoom IF not set).
|
||||
*/
|
||||
* Whether it should use a implementation where it multiplies the current camera zoom instead.
|
||||
*/
|
||||
public var useCamZoomMult:Bool = Flags.USE_CAM_ZOOM_MULT;
|
||||
/**
|
||||
* The current multiplier for cam zooming.
|
||||
* (Only used if useCamZoomMult is on).
|
||||
*/
|
||||
public var camZoomingMult:Float = Flags.DEFAULT_ZOOM;
|
||||
/**
|
||||
* Maximum amount of zoom for the camera (based on `maxCamZoomMult` and the camera's zoom IF not set).
|
||||
*/
|
||||
public var maxCamZoom(get, default):Float = Math.NaN;
|
||||
|
||||
private inline function get_maxCamZoom() return Math.isNaN(maxCamZoom) ? maxCamZoomMult * defaultCamZoom : maxCamZoom;
|
||||
@@ -1324,12 +1344,15 @@ class PlayState extends MusicBeatState
|
||||
if (canAccessDebugMenus && chartingMode && controls.DEV_ACCESS)
|
||||
FlxG.switchState(new funkin.editors.charter.Charter(SONG.meta.name, difficulty, false));
|
||||
|
||||
if (Options.camZoomOnBeat && camZooming && FlxG.camera.zoom < maxCamZoom) {
|
||||
if (Options.camZoomOnBeat && camZooming) {
|
||||
var beat = Conductor.getBeats(camZoomingEvery, camZoomingInterval, camZoomingOffset);
|
||||
if (camZoomingLastBeat != beat) {
|
||||
camZoomingLastBeat = beat;
|
||||
FlxG.camera.zoom += 0.015 * camZoomingStrength;
|
||||
camHUD.zoom += 0.03 * camZoomingStrength;
|
||||
if (useCamZoomMult) camZoomingMult = Math.min(camZoomingMult + camZoomingStrength, defaultZoom + camZoomingStrength);
|
||||
else if (FlxG.camera.zoom < maxCamZoom) {
|
||||
FlxG.camera.zoom += 0.015 * camZoomingStrength;
|
||||
camHUD.zoom += 0.03 * camZoomingStrength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1372,6 +1395,12 @@ class PlayState extends MusicBeatState
|
||||
moveCamera();
|
||||
|
||||
if (camZooming) {
|
||||
if (useCamZoomMult) {
|
||||
camZoomingMult = lerp(camZoomingMult, defaultZoom, camZoomLerp) - defaultZoom;
|
||||
FlxG.camera.zoomMultiplier = camZoomingMult * 0.015 + defaultZoom;
|
||||
camHUD.zoomMultiplier = camZoomingMult * 0.03 + defaultZoom;
|
||||
camZoomingMult += defaultZoom;
|
||||
}
|
||||
FlxG.camera.zoom = lerp(FlxG.camera.zoom, defaultCamZoom, camGameZoomLerp);
|
||||
camHUD.zoom = lerp(camHUD.zoom, defaultHudZoom, camHUDZoomLerp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user