Merge branch 'camera-helpies' into rewrite/master

This commit is contained in:
Cameron Taylor 2024-09-06 19:12:59 -04:00
commit 55c5e01bd5
2 changed files with 43 additions and 26 deletions

View file

@ -503,6 +503,12 @@ class PlayState extends MusicBeatSubState
*/ */
public var camGame:FlxCamera; public var camGame:FlxCamera;
/**
* Simple helper debug variable, to be able to move the camera around for debug purposes
* without worrying about the camera tweening back to the follow point.
*/
public var debugUnbindCameraZoom:Bool = false;
/** /**
* The camera which contains, and controls visibility of, a video cutscene, dialogue, pause menu and sticker transition. * The camera which contains, and controls visibility of, a video cutscene, dialogue, pause menu and sticker transition.
*/ */
@ -992,7 +998,7 @@ class PlayState extends MusicBeatSubState
{ {
cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, 0.95); // Lerp bop multiplier back to 1.0x cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, 0.95); // Lerp bop multiplier back to 1.0x
var zoomPlusBop = currentCameraZoom * cameraBopMultiplier; // Apply camera bop multiplier. var zoomPlusBop = currentCameraZoom * cameraBopMultiplier; // Apply camera bop multiplier.
FlxG.camera.zoom = zoomPlusBop; // Actually apply the zoom to the camera. if (!debugUnbindCameraZoom) 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);
} }
@ -1458,6 +1464,13 @@ class PlayState extends MusicBeatSubState
super.destroy(); super.destroy();
} }
public override function initConsoleHelpers():Void
{
FlxG.console.registerFunction("debugUnbindCameraZoom", () -> {
debugUnbindCameraZoom = !debugUnbindCameraZoom;
});
};
/** /**
* Initializes the game and HUD cameras. * Initializes the game and HUD cameras.
*/ */

View file

@ -56,6 +56,8 @@ class MusicBeatSubState extends FlxSubState implements IEventHandler
Conductor.beatHit.add(this.beatHit); Conductor.beatHit.add(this.beatHit);
Conductor.stepHit.add(this.stepHit); Conductor.stepHit.add(this.stepHit);
initConsoleHelpers();
} }
public override function destroy():Void public override function destroy():Void
@ -79,6 +81,8 @@ class MusicBeatSubState extends FlxSubState implements IEventHandler
dispatchEvent(new UpdateScriptEvent(elapsed)); dispatchEvent(new UpdateScriptEvent(elapsed));
} }
public function initConsoleHelpers():Void {}
function reloadAssets() function reloadAssets()
{ {
PolymodHandler.forceReloadAssets(); PolymodHandler.forceReloadAssets();