gf pretty printing perhaps

This commit is contained in:
Yoshman29
2022-11-06 23:39:35 +01:00
parent 9f34d0919d
commit c654b99466
9 changed files with 166 additions and 30 deletions
+33 -10
View File
@@ -1,13 +1,36 @@
<!DOCTYPE codename-engine-character>
<character isPlayer="false" flipX="false" isGF="true">
<anim name="cheer" anim="GF Cheer" fps="24" loop="false" />
<anim name="singUP" anim="GF Up Note" fps="24" loop="false" x="0" y="4" />
<anim name="singLEFT" anim="GF left note" fps="24" loop="false" x="0" y="-20" />
<anim name="singRIGHT" anim="GF Right Note" fps="24" loop="false" x="0" y="-20" />
<anim name="singDOWN" anim="GF Down Note" fps="24" loop="false" x="0" y="-20" />
<anim name="danceLeft" anim="GF Dancing Beat" fps="24" loop="false" x="0" y="-9" indices="30,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="GF Dancing Beat" fps="24" loop="false" x="0" y="-9" indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
<anim name="hairBlow" anim="GF Dancing Beat Hair blowing" fps="24" loop="false" x="45" y="-8" indices="0,1,2,3" />
<anim name="hairFall" anim="GF Dancing Beat Hair Landing" fps="24" loop="false" x="0" y="-9" indices="0,1,2,3,4,5,6,7,8,9,10,11" />
<anim name="scared" anim="GF FEAR" fps="24" loop="true" x="-2" y="-17" />
<anim name="cheer" anim="GF Cheer"
fps="24" loop="false" />
<anim name="singUP" anim="GF Up Note"
fps="24" loop="false" x="0" y="4" />
<anim name="singLEFT" anim="GF left note"
fps="24" loop="false" x="0" y="-20" />
<anim name="singRIGHT" anim="GF Right Note"
fps="24" loop="false" x="0" y="-20" />
<anim name="singDOWN" anim="GF Down Note"
fps="24" loop="false" x="0" y="-20" />
<anim name="danceLeft" anim="GF Dancing Beat"
fps="24" loop="false" x="0" y="-9"
indices="30,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14" />
<anim name="danceRight" anim="GF Dancing Beat"
fps="24" loop="false" x="0" y="-9"
indices="15,16,17,18,19,20,21,22,23,24,25,26,27,28,29" />
<anim name="hairBlow" anim="GF Dancing Beat Hair blowing"
fps="24" loop="false" x="45" y="-8"
indices="0,1,2,3" />
<anim name="hairFall" anim="GF Dancing Beat Hair Landing"
fps="24" loop="false" x="0" y="-9"
indices="0,1,2,3,4,5,6,7,8,9,10,11" />
<anim name="scared" anim="GF FEAR"
fps="24" loop="true" x="-2" y="-17" />
</character>
+9
View File
@@ -0,0 +1,9 @@
function create() {
game.camHUD.fade(0xFF000000, 0);
var sound = FlxG.sound.load(Paths.sound('Lights_Shut_off'));
sound.onComplete = function() {
close();
};
sound.play();
}
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
1210
1214
+8 -1
View File
@@ -1,12 +1,19 @@
package funkin.cutscenes;
class Cutscene extends MusicBeatSubstate {
var __callback:Void->Void;
var game:PlayState = PlayState.instance;
public function new(callback:Void->Void) {
super();
__callback = callback;
}
public override function update(elapsed:Float) {
super.update(elapsed);
}
public override function close() {
PlayState.instance.startCountdown();
__callback();
super.close();
}
}
@@ -0,0 +1,49 @@
package funkin.cutscenes;
import funkin.scripting.Script;
class ScriptedCutscene extends Cutscene {
var script:Script;
public function new(scriptPath:String, callback:Void->Void) {
super(callback);
script = Script.create(scriptPath);
script.setPublicMap(PlayState.instance.scripts.publicVariables);
script.setParent(this);
script.load();
}
public override function create() {
super.create();
script.call("create");
}
public override function update(elapsed:Float) {
script.call("update", [elapsed]);
super.update(elapsed);
script.call("updatePost", [elapsed]);
}
public override function beatHit(curBeat:Int) {
super.beatHit(curBeat);
script.call("beatHit", [curBeat]);
}
public override function stepHit(curStep:Int) {
super.stepHit(curStep);
script.call("stepHit", [curStep]);
}
public override function destroy() {
script.call("destroy");
super.destroy();
}
public function startVideo(path:String, ?callback:Void->Void) {
openSubState(new VideoCutscene(path, function() {
if (callback != null)
callback();
}));
}
}
+3 -2
View File
@@ -12,8 +12,9 @@ class VideoCutscene extends Cutscene {
var video:MP4Handler;
var videoSprite:FlxSprite;
var cutsceneCamera:FlxCamera;
public function new(path:String) {
super();
public function new(path:String, callback:Void->Void) {
super(callback);
localPath = Assets.getPath(this.path = path);
}
+63 -16
View File
@@ -198,6 +198,16 @@ class PlayState extends MusicBeatState
detailsText = "Freeplay";
}
// Checks if cutscene files exists
var cutscenePath = Paths.script('data/cutscenes/${SONG.song.toLowerCase()}');
var endCutscenePath = Paths.script('data/cutscenes/${SONG.song.toLowerCase()}-end');
trace(cutscenePath);
trace(endCutscenePath);
if (Assets.exists(cutscenePath))
cutscene = cutscenePath;
if (Assets.exists(endCutscenePath))
endCutscene = endCutscenePath;
// String for when the game is paused
detailsPausedText = "Paused - " + detailsText;
@@ -324,27 +334,57 @@ class PlayState extends MusicBeatState
super.create();
}
// PATH TO STRING CUTSCENE
// PATH TO STRING CUTSCENE (Paths.script
public var playCutscenes:Bool = isStoryMode;
public var cutscene:String = null;
public var endCutscene:String = null;
public override function createPost() {
var videoCutscene = Paths.video('${PlayState.SONG.song.toLowerCase()}-cutscene');
FlxTransitionableState.skipNextTransIn = true;
if (cutscene != null) {
// TODO: Script cutscenes
} else if (Assets.exists(videoCutscene)) {
openSubState(new VideoCutscene(videoCutscene));
persistentUpdate = false;
persistentDraw = false;
} else {
FlxTransitionableState.skipNextTransIn = false;
startCountdown();
}
startCutscene();
super.createPost();
scripts.call("createPost");
}
public function startCutscene() {
if (playCutscenes) {
var videoCutscene = Paths.video('${PlayState.SONG.song.toLowerCase()}-cutscene');
persistentUpdate = false;
if (cutscene != null) {
openSubState(new ScriptedCutscene(cutscene, function() {
nextSong();
}));
} else if (Assets.exists(videoCutscene)) {
FlxTransitionableState.skipNextTransIn = true;
openSubState(new VideoCutscene(videoCutscene, function() {
startCountdown();
}));
persistentDraw = false;
} else {
startCountdown();
}
} else
startCountdown();
}
public function startEndCutscene() {
if (playCutscenes) {
var videoCutscene = Paths.video('${PlayState.SONG.song.toLowerCase()}-end-cutscene');
persistentUpdate = false;
if (endCutscene != null) {
openSubState(new ScriptedCutscene(endCutscene, function() {
nextSong();
}));
} else if (Assets.exists(videoCutscene)) {
openSubState(new VideoCutscene(videoCutscene, function() {
nextSong();
}));
persistentDraw = false;
} else {
nextSong();
}
} else
nextSong();
}
public var startTimer:FlxTimer;
public var perfectMode:Bool = false;
public var introLength:Int = 5;
@@ -1030,8 +1070,11 @@ class PlayState extends MusicBeatState
{
scripts.call("onSongEnd");
canPause = false;
FlxG.sound.music.volume = 0;
inst.volume = 0;
vocals.volume = 0;
inst.pause();
vocals.pause();
if (SONG.validScore)
{
#if !switch
@@ -1043,6 +1086,10 @@ class PlayState extends MusicBeatState
#end
}
startEndCutscene();
}
public function nextSong() {
if (isStoryMode)
{
campaignScore += songScore;