Skip to content

Commit

Permalink
the stage data additions
Browse files Browse the repository at this point in the history
stage files may or may not need to be updated
  • Loading branch information
KoloInDaCrib authored Sep 20, 2024
1 parent a27c4ae commit 6c7e3f9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
30 changes: 30 additions & 0 deletions source/funkin/data/stage/StageData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class StageData
@:optional
public var cameraZoom:Null<Float>;

@:default("shared")
@:optional
public var directory:Null<String>;

public function new()
{
this.version = StageRegistry.STAGE_DATA_VERSION;
Expand Down Expand Up @@ -182,6 +186,32 @@ typedef StageDataProp =
@:default("sparrow")
@:optional
var animType:String;

/**
* The angle of the prop, as a float.
* @default 1.0
*/
@:optional
@:default(0.0)
var angle:Float;

/**
* The blend mode of the prop, as a string.
* Just like in photoshop.
* @default Nothing.
*/
@:default("")
@:optional
var blend:String;

/**
* The color of the prop overlay, as a hex string.
* White overlays, or the ones with the value #FFFFFF, do not appear.
* @default `#FFFFFF`
*/
@:default("#FFFFFF")
@:optional
var color:String;
};

typedef StageDataCharacter =
Expand Down
4 changes: 4 additions & 0 deletions source/funkin/play/stage/Stage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements
propSprite.scrollFactor.x = dataProp.scroll[0];
propSprite.scrollFactor.y = dataProp.scroll[1];

propSprite.angle = dataProp.angle;
propSprite.color = FlxColor.fromString(dataProp.color);
propSprite.blend = BlendMode.fromString(dataProp.blend);

propSprite.zIndex = dataProp.zIndex;

switch (dataProp.animType)
Expand Down
12 changes: 10 additions & 2 deletions source/funkin/ui/transition/LoadingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class LoadingState extends MusicBeatSubState
}

checkLibrary('shared');
checkLibrary(PlayStatePlaylist.campaignId);
checkLibrary(stageDirectory);
checkLibrary('tutorial');

var fadeTime:Float = 0.5;
Expand Down Expand Up @@ -205,6 +205,8 @@ class LoadingState extends MusicBeatSubState
return Paths.inst(PlayState.instance.currentSong.id);
}

static var stageDirectory:String = "shared";

/**
* Starts the transition to a new `PlayState` to start a new song.
* First switches to the `LoadingState` if assets need to be loaded.
Expand All @@ -214,7 +216,13 @@ class LoadingState extends MusicBeatSubState
*/
public static function loadPlayState(params:PlayStateParams, shouldStopMusic = false, asSubState = false, ?onConstruct:PlayState->Void):Void
{
Paths.setCurrentLevel(PlayStatePlaylist.campaignId);
var daChart = params.targetSong.getDifficulty(params.targetDifficulty ?? Constants.DEFAULT_DIFFICULTY,
params.targetVariation ?? Constants.DEFAULT_VARIATION);

var daStage = funkin.data.stage.StageRegistry.instance.fetchEntry(daChart.stage);
stageDirectory = daStage.directory ?? "shared";
Paths.setCurrentLevel(stageDirectory);

var playStateCtor:() -> PlayState = function() {
return new PlayState(params);
};
Expand Down

0 comments on commit 6c7e3f9

Please sign in to comment.