Skip to content

Commit

Permalink
tried something but :(
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby committed Jun 5, 2024
1 parent d2ba5d4 commit 4b135e8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 20 deletions.
1 change: 1 addition & 0 deletions mods/test/data/customStageList.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
Empty file removed mods/test/data/stages/not yet.txt
Empty file.
18 changes: 18 additions & 0 deletions mods/test/data/stages/test.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
bgZoom = 0.9;
stageName = 'stage';

var bg:BGSprite = new BGSprite('bg', -600, -200, Paths.image('backgrounds/stage/stageback'), null, 0.9, 0.9);
sprites.add(bg);
add(bg);

var stageFront:BGSprite = new BGSprite('stageFront', -650, 600, Paths.image('backgrounds/stage/stagefront'), null, 0.9, 0.9);
stageFront.setGraphicSize(Std.int(stageFront.width * 1.1));
stageFront.updateHitbox();
sprites.add(stageFront);
add(stageFront);

var stageCurtains:BGSprite = new BGSprite('stageCurtains', -500, -300, Paths.image('backgrounds/stage/stagecurtains'), null, 1.3, 1.3);
stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9));
stageCurtains.updateHitbox();
sprites.add(stageCurtains);
add(stageCurtains);
13 changes: 12 additions & 1 deletion source/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ class ChartingState extends MusicBeatState
var c:Array<String>;
var cm:Array<String>;

var cStage:Array<String>;
var cmStage:Array<String>;

override function create()
{
curSection = lastSection;
Expand Down Expand Up @@ -342,7 +345,15 @@ class ChartingState extends MusicBeatState

var characters:Array<String> = c.concat(cm);

var stages:Array<String> = CoolUtil.coolTextFile(Paths.txt('stageList'));
cStage = CoolUtil.coolTextFile(Paths.txt('stageList'));

if (FileSystem.exists(TitleState.modFolder + '/data/customStageList.txt')) {
cmStage = CoolUtil.coolTextFile(TitleState.modFolder + '/data/customStageList.txt');
} else {
cmStage = [''];
}

var stages:Array<String> = cStage.concat(cmStage);

var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String)
{
Expand Down
31 changes: 12 additions & 19 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import flixel.group.FlxSpriteGroup;
import lime.tools.ApplicationData;
import flixel.effects.particles.FlxParticle;
import hscript.Printer;
import hscript.*;
import openfl.desktop.Clipboard;
import flixel.system.debug.Window;
#if desktop
Expand Down Expand Up @@ -96,7 +97,7 @@ import vlc.MP4Handler;

using StringTools;

typedef StageJson =
/*typedef StageJson =
{
var bgZoom:Float;
var backgrounds:Array<BackgroundJson>;
Expand All @@ -112,7 +113,7 @@ typedef BackgroundJson =
var scrollX:Float;
var scrollY:Float;
var antialiasing:Bool;
}
} */

typedef Settings = {
var songCreators:String;
Expand Down Expand Up @@ -374,8 +375,8 @@ class PlayState extends MusicBeatState
var originBambiPos:FlxPoint;
var originBFPos:FlxPoint;

public var rawJsonStage:String;
public var jsonStage:StageJson;
/*public var rawJsonStage:String;
public var jsonStage:StageJson; */

var rawJsonSettings:String;
var jsonSettings:Settings;
Expand Down Expand Up @@ -2208,22 +2209,14 @@ class PlayState extends MusicBeatState
sprites.add(stfu);
add(stfu);
default:
// I don't know how to do this some one help

/*if (FileSystem.exists(TitleState.modFolder + '/data/stages/' + bgName + '.json')) {
rawJsonStage = File.getContent(TitleState.modFolder + '/data/stages/' + bgName + '.json');
jsonStage = cast Json.parse(rawJsonStage);
/*if (FileSystem.exists(TitleState.modFolder + '/data/stages/' + bgName + '.hx')) {
// should make a custom stage
var parser = new Parser();
var interp = new Interp();
bgZoom = jsonStage.bgZoom;
stageName = bgName;
var expr = parser.parseString(File.getContent(TitleState.modFolder + '/data/stages/' + bgName + '.hx'));
for (i in jsonStage.backgrounds) {
var spriteName:BGSprite = new BGSprite('spriteName', i.posX, i.posY, TitleState.modFolder + '/images/stages/' + bgName + '/' + i.image, null, i.scrollX, i.scrollY, i.antialiasing);
spriteName.setGraphicSize(Std.int(spriteName.width * 0.9));
spriteName.updateHitbox();
sprites.add(spriteName);
add(spriteName);
}
interp.execute(expr);
} else { */
bgZoom = 0.9;
Expand All @@ -2244,7 +2237,7 @@ class PlayState extends MusicBeatState
stageCurtains.updateHitbox();
sprites.add(stageCurtains);
add(stageCurtains);
// }
//}
}
if (!revertedBG)
{
Expand Down

0 comments on commit 4b135e8

Please sign in to comment.