From f37c2cbbf6003d9273e6dbe26e601243f3f97258 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 3 May 2022 14:07:18 -0400 Subject: [PATCH] cameraOffset stuff defaulted properly --- source/funkin/play/PlayState.hx | 27 --------------------------- source/funkin/play/stage/StageData.hx | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 9e35451ad..adeff460c 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1502,10 +1502,6 @@ class PlayState extends MusicBeatState implements IHook if (currentStage == null) return; - // HARDCODED +150, CHANGE LATER??? - var camPosOffsetDad:FlxPoint = FlxPoint.get(150, -100); - var camPosOffsetBF:Float = -100; - var isFocusedOnDad = cameraFollowPoint.x == currentStage.getDad().cameraFocusPoint.x; var isFocusedOnBF = cameraFollowPoint.x == currentStage.getBoyfriend().cameraFocusPoint.x; @@ -1514,21 +1510,6 @@ class PlayState extends MusicBeatState implements IHook // Focus the camera on the player. cameraFollowPoint.setPosition(currentStage.getBoyfriend().cameraFocusPoint.x, currentStage.getBoyfriend().cameraFocusPoint.y); - // ALSO UNHARDCODE THIS CAMERA BULLSHIT TOO - FlxG.camera.targetOffset.x = camPosOffsetBF; - FlxG.camera.targetOffset.y = camPosOffsetBF; - - switch (currentStageId) - { - case 'limo': - FlxG.camera.targetOffset.x = -300; - case 'mall': - FlxG.camera.targetOffset.y = -200; - case 'school' | 'schoolEvil': - FlxG.camera.targetOffset.x = -200; - FlxG.camera.targetOffset.y = 0; - } - // TODO: Un-hardcode this. if (currentSong.song.toLowerCase() == 'tutorial') FlxTween.tween(FlxG.camera, {zoom: 1 * FlxCamera.defaultZoom}, (Conductor.stepCrochet * 4 / 1000), {ease: FlxEase.elasticInOut}); @@ -1538,18 +1519,10 @@ class PlayState extends MusicBeatState implements IHook // Focus the camera on the opponent. cameraFollowPoint.setPosition(currentStage.getDad().cameraFocusPoint.x, currentStage.getDad().cameraFocusPoint.y); - FlxG.camera.targetOffset.set(camPosOffsetDad.x, camPosOffsetDad.y); - // TODO: Un-hardcode this stuff. if (currentStage.getDad().characterId == 'mom') { vocals.volume = 1; - FlxG.camera.targetOffset.y = 0; - } - - if (currentStage.getDad().characterId == "senpai" || currentStage.getDad().characterId == 'senpai-angry') - { - FlxG.camera.targetOffset.y = -30; } if (currentSong.song.toLowerCase() == 'tutorial') diff --git a/source/funkin/play/stage/StageData.hx b/source/funkin/play/stage/StageData.hx index dc5538bac..c03f04512 100644 --- a/source/funkin/play/stage/StageData.hx +++ b/source/funkin/play/stage/StageData.hx @@ -175,6 +175,8 @@ class StageDataParser static final DEFAULT_ISPIXEL:Bool = false; static final DEFAULT_NAME:String = "Untitled Stage"; static final DEFAULT_OFFSETS:Array = [0, 0]; + static final DEFAULT_CAMERA_OFFSETS_BF:Array = [-100, -100]; + static final DEFAULT_CAMERA_OFFSETS_DAD:Array = [150, -100]; static final DEFAULT_POSITION:Array = [0, 0]; static final DEFAULT_SCALE:Float = 1.0; static final DEFAULT_SCROLL:Array = [0, 0]; @@ -339,10 +341,12 @@ class StageDataParser if (input.characters.bf == null) { input.characters.bf = DEFAULT_CHARACTER_DATA; + input.characters.bf.cameraOffsets = DEFAULT_CAMERA_OFFSETS_BF; } if (input.characters.dad == null) { input.characters.dad = DEFAULT_CHARACTER_DATA; + input.characters.dad.cameraOffsets = DEFAULT_CAMERA_OFFSETS_DAD; } if (input.characters.gf == null) { @@ -361,7 +365,14 @@ class StageDataParser } if (inputCharacter.cameraOffsets == null || inputCharacter.cameraOffsets.length != 2) { - inputCharacter.cameraOffsets = [0, 0]; + if (inputCharacter == input.characters.bf) + inputCharacter.cameraOffsets = DEFAULT_CAMERA_OFFSETS_BF; + if (inputCharacter == input.characters.dad) + inputCharacter.cameraOffsets = DEFAULT_CAMERA_OFFSETS_DAD; + else + { + inputCharacter.cameraOffsets = [0, 0]; + } } } @@ -484,7 +495,7 @@ typedef StageDataCharacter = /** * The camera offsets to apply when focusing on the character on this stage. - * @default [0, 0] + * @default [-100, -100] for BF, [100, -100] for DAD/OPPONENT, [0, 0] for GF */ cameraOffsets:Array, };