fixed stuff for porting WIP 9

new stage xml camera starting point
This commit is contained in:
⍚~Nex
2024-02-25 16:43:00 +01:00
parent 4831faeb8c
commit e18e1a2c7a
15 changed files with 31 additions and 39 deletions
+10 -13
View File
@@ -563,19 +563,22 @@ class PlayState extends MusicBeatState
comboGroup.maxSize = 25;
#end
// SCRIPTS & STAGE INITIALISATION
// CAMERA, SCRIPTS & STAGE INITIALISATION
#if REGION
camFollow = new FlxObject(0, 0, 2, 2);
add(camFollow);
if (SONG.stage == null || SONG.stage.trim() == "") SONG.stage = "stage";
add(stage = new Stage(SONG.stage));
// var camPos:FlxPoint = new FlxPoint(dadMidpoint.x, dadMidpoint.y);
// dadMidpoint.put();
var camPos:FlxPoint = new FlxPoint(0, 0);
FlxG.camera.follow(camFollow, LOCKON, 0.04);
FlxG.camera.zoom = defaultCamZoom;
// camHUD.zoom = defaultHudZoom;
if (!chartingMode || Options.charterEnablePlaytestScripts) {
switch(SONG.meta.name) {
// case "":
// ADD YOUR HARDCODED SCRIPTSa HERE!
// ADD YOUR HARDCODED SCRIPTS HERE!
default:
var scriptsFolders:Array<String> = ['songs/${SONG.meta.name.toLowerCase()}/scripts', 'data/charts/', 'songs/'];
@@ -675,7 +678,7 @@ class PlayState extends MusicBeatState
scripts.call("create");
#end
// CAMERA & HUD INITIALISATION
// HUD INITIALISATION & CAMERA FINALISATION
#if REGION
var event = EventManager.get(AmountEvent).recycle(4);
if (!scripts.event("onPreGenerateStrums", event).cancelled) {
@@ -686,13 +689,7 @@ class PlayState extends MusicBeatState
for(str in strumLines)
str.generate(str.data, (chartingMode && Charter.startHere) ? Charter.startTime : null);
camFollow = new FlxObject(0, 0, 2, 2);
camFollow.setPosition(camPos.x, camPos.y);
add(camFollow);
FlxG.camera.follow(camFollow, LOCKON, 0.04);
FlxG.camera.zoom = defaultCamZoom;
// camHUD.zoom = defaultHudZoom;
// Its after all of that code for scripts stuff - Nex
if (smoothTransitionData != null && smoothTransitionData.stage == curStage) {
FlxG.camera.scroll.set(smoothTransitionData.camX, smoothTransitionData.camY);
FlxG.camera.zoom = smoothTransitionData.camZoom;
+4 -4
View File
@@ -48,10 +48,10 @@ class Stage extends FlxBasic implements IBeatReceiver {
if (stageXML != null) {
if (PlayState.instance != null) {
if (stageXML.has.zoom) {
var parsed:Null<Float> = Std.parseFloat(stageXML.att.zoom);
if (parsed != null && PlayState.instance != null) PlayState.instance.defaultCamZoom = parsed;
}
var parsed:Null<Float>;
if(stageXML.has.startCamPosX && (parsed = Std.parseFloat(stageXML.att.startCamPosX)) != null) PlayState.instance.camFollow.x = parsed;
if(stageXML.has.startCamPosY && (parsed = Std.parseFloat(stageXML.att.startCamPosY)) != null) PlayState.instance.camFollow.y = parsed;
if(stageXML.has.zoom && (parsed = Std.parseFloat(stageXML.att.zoom)) != null) PlayState.instance.defaultCamZoom = parsed;
PlayState.instance.curStage = stageXML.has.name ? stageXML.att.name : stage;
}
if (stageXML.has.folder) {