1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-02-11 14:02:51 +00:00

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.
*/ */
@ -2224,10 +2237,10 @@ class PlayState extends MusicBeatSubState
// Skip handling the miss in botplay! // Skip handling the miss in botplay!
if (!isBotPlayMode) if (!isBotPlayMode)
{ {
// Judge the miss. // Judge the miss.
// NOTE: This is what handles the scoring. // NOTE: This is what handles the scoring.
trace('Missed note! ${note.noteData}'); trace('Missed note! ${note.noteData}');
onNoteMiss(note, event.playSound, event.healthChange); onNoteMiss(note, event.playSound, event.healthChange);
} }
note.handledMiss = true; note.handledMiss = true;
@ -2344,31 +2357,31 @@ class PlayState extends MusicBeatSubState
playerStrumline.playPress(input.noteDirection); playerStrumline.playPress(input.noteDirection);
trace('PENALTY Score: ${songScore}'); trace('PENALTY Score: ${songScore}');
} }
else if (notesInDirection.length == 0) else if (notesInDirection.length == 0)
{ {
// Press a key with no penalty. // Press a key with no penalty.
// Play the strumline animation. // Play the strumline animation.
playerStrumline.playPress(input.noteDirection); playerStrumline.playPress(input.noteDirection);
trace('NO PENALTY Score: ${songScore}'); trace('NO PENALTY Score: ${songScore}');
} }
else else
{ {
// Choose the first note, deprioritizing low priority notes. // Choose the first note, deprioritizing low priority notes.
var targetNote:Null<NoteSprite> = notesInDirection.find((note) -> !note.lowPriority); var targetNote:Null<NoteSprite> = notesInDirection.find((note) -> !note.lowPriority);
if (targetNote == null) targetNote = notesInDirection[0]; if (targetNote == null) targetNote = notesInDirection[0];
if (targetNote == null) continue; if (targetNote == null) continue;
// Judge and hit the note. // Judge and hit the note.
trace('Hit note! ${targetNote.noteData}'); trace('Hit note! ${targetNote.noteData}');
goodNoteHit(targetNote, input); goodNoteHit(targetNote, input);
trace('Score: ${songScore}'); trace('Score: ${songScore}');
notesInDirection.remove(targetNote); notesInDirection.remove(targetNote);
// Play the strumline animation. // Play the strumline animation.
playerStrumline.playConfirm(input.noteDirection); playerStrumline.playConfirm(input.noteDirection);
} }
} }
while (inputReleaseQueue.length > 0) while (inputReleaseQueue.length > 0)

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();