more cutscene fixes
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
//
|
||||
import flixel.addons.util.FlxSimplex;
|
||||
|
||||
var self = this;
|
||||
__script__.setParent(PlayState.instance);
|
||||
|
||||
var scream:FlxSound;
|
||||
var red:FlxSprite;
|
||||
var senpaiEvil:FlxSprite;
|
||||
var timers:Array<FlxTimers> = [];
|
||||
var dfx = 0;
|
||||
var dfy = 0;
|
||||
|
||||
function create() {
|
||||
camHUD.visible = false;
|
||||
|
||||
var red:FlxSprite = new FlxSprite().makeSolid(FlxG.width + 100, FlxG.height + 100, 0xFFff1b31);
|
||||
red = new FlxSprite().makeSolid(FlxG.width + 100, FlxG.height + 100, 0xFFff1b31);
|
||||
red.screenCenter();
|
||||
red.scrollFactor.set();
|
||||
add(red);
|
||||
@@ -28,7 +32,7 @@ function create() {
|
||||
dfy = senpaiEvil.y;
|
||||
add(senpaiEvil);
|
||||
|
||||
new FlxTimer().start(3.2, function(deadTime:FlxTimer)
|
||||
timers.push(new FlxTimer().start(3.2, function(deadTime:FlxTimer)
|
||||
{
|
||||
FlxG.camera.fade(FlxColor.WHITE, 1.6, false, function() {
|
||||
remove(senpaiEvil, true);
|
||||
@@ -38,18 +42,20 @@ function create() {
|
||||
|
||||
FlxG.camera._fxFadeAlpha = 1;
|
||||
});
|
||||
});
|
||||
timers.remove(deadTime);
|
||||
}));
|
||||
scream = FlxG.sound.play(Paths.sound('cutscenes/weeb/Senpai_Dies'), 1, false, null, true, function()
|
||||
{
|
||||
new FlxTimer().start(0.4, function(swagTimer:FlxTimer) {
|
||||
timers.push(new FlxTimer().start(0.4, function(swagTimer:FlxTimer) {
|
||||
FlxG.camera._fxFadeAlpha -= 0.15;
|
||||
|
||||
if(FlxG.camera._fxFadeAlpha > 0.3) swagTimer.reset();
|
||||
if (FlxG.camera._fxFadeAlpha > 0.3) swagTimer.reset();
|
||||
else {
|
||||
timers.remove(swagTimer);
|
||||
camHUD.visible = true;
|
||||
self.startDialogue("assets/songs/" + PlayState.instance.SONG.meta.name.toLowerCase() + "/creepyDialogue.xml", self.close);
|
||||
}
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -67,4 +73,13 @@ function update(elapsed:Float) {
|
||||
|
||||
senpaiEvil.setPosition(dfx + vx, dfy + vy);
|
||||
}
|
||||
}
|
||||
|
||||
function destroy() { // Since you can skip the cutscene - Nex
|
||||
for (timer in timers) timer.cancel();
|
||||
senpaiEvil?.destroy();
|
||||
red?.destroy();
|
||||
FlxG.camera.stopFade();
|
||||
scream?.destroy();
|
||||
camHUD.visible = true;
|
||||
}
|
||||
@@ -859,8 +859,9 @@ class PlayState extends MusicBeatState
|
||||
* @param cutsceneScriptPath Optional: Custom script path.
|
||||
* @param callback Callback called after the cutscene ended. If equals to `null`, `startCountdown` will be called.
|
||||
* @param checkSeen Bool that by default is false, if true and `seenCutscene` is also true, it won't play the cutscene but directly call `callback` (PS: `seenCutscene` becomes true if the cutscene gets played and `checkSeen` was true)
|
||||
* @param canSkipTransIn Bool that by default is true makes the in transition skip on certain types of cutscenes like dialogues.
|
||||
*/
|
||||
public function startCutscene(prefix:String = "", ?cutsceneScriptPath:String, ?callback:Void->Void, checkSeen:Bool = false) {
|
||||
public function startCutscene(prefix:String = "", ?cutsceneScriptPath:String, ?callback:Void->Void, checkSeen:Bool = false, canSkipTransIn:Bool = true) {
|
||||
if (callback == null) callback = startCountdown;
|
||||
if ((checkSeen && seenCutscene) || !playCutscenes) {
|
||||
callback();
|
||||
@@ -885,15 +886,15 @@ class PlayState extends MusicBeatState
|
||||
if (cutsceneScriptPath != null && Assets.exists(cutsceneScriptPath)) {
|
||||
openSubState(new ScriptedCutscene(cutsceneScriptPath, toCall));
|
||||
} else if (Assets.exists(dialogue)) {
|
||||
MusicBeatState.skipTransIn = true;
|
||||
if (canSkipTransIn) MusicBeatState.skipTransIn = true;
|
||||
openSubState(new DialogueCutscene(dialogue, toCall));
|
||||
} else if (Assets.exists(videoCutsceneAlt)) {
|
||||
MusicBeatState.skipTransIn = true;
|
||||
if (canSkipTransIn) MusicBeatState.skipTransIn = true;
|
||||
persistentUpdate = false;
|
||||
openSubState(new VideoCutscene(videoCutsceneAlt, toCall));
|
||||
persistentDraw = false;
|
||||
} else if (Assets.exists(videoCutscene)) {
|
||||
MusicBeatState.skipTransIn = true;
|
||||
if (canSkipTransIn) MusicBeatState.skipTransIn = true;
|
||||
persistentUpdate = false;
|
||||
openSubState(new VideoCutscene(videoCutscene, toCall));
|
||||
persistentDraw = false;
|
||||
@@ -1525,8 +1526,7 @@ class PlayState extends MusicBeatState
|
||||
#end
|
||||
}
|
||||
|
||||
startCutscene("end-", endCutscene, nextSong);
|
||||
resetSongInfos();
|
||||
startCutscene("end-", endCutscene, nextSong, false, false);
|
||||
}
|
||||
|
||||
private static inline function getSongChanges():Array<HighscoreChange> {
|
||||
@@ -1542,6 +1542,8 @@ class PlayState extends MusicBeatState
|
||||
* Immediately switches to the next song, or goes back to the Story/Freeplay menu.
|
||||
*/
|
||||
public function nextSong() {
|
||||
resetSongInfos();
|
||||
|
||||
if (isStoryMode)
|
||||
{
|
||||
campaignScore += songScore;
|
||||
|
||||
@@ -25,8 +25,11 @@ class Cutscene extends MusicBeatSubstate {
|
||||
super();
|
||||
canOpenCustomTransition = true;
|
||||
|
||||
__callback = callback;
|
||||
__pausable = allowPause;
|
||||
__callback = function() {
|
||||
canOpenCustomTransition = false;
|
||||
callback();
|
||||
};
|
||||
|
||||
pauseItems = Flags.DEFAULT_CUTSCENE_PAUSE_ITEMS;
|
||||
skippable = canSkip;
|
||||
|
||||
@@ -50,7 +50,7 @@ class DialogueCutscene extends ScriptedCutscene {
|
||||
}
|
||||
|
||||
public override function onErrorScriptLoading() {
|
||||
Logs.trace('Could not find script for dialogue cutscene at "${scriptPath}"', WARNING, YELLOW);
|
||||
//Logs.trace('Could not find script for dialogue cutscene at "${scriptPath}"', WARNING, YELLOW); // Too many warnings honestly, stawp - Nex
|
||||
}
|
||||
|
||||
var parentDisabler:FunkinParentDisabler;
|
||||
@@ -62,26 +62,26 @@ class DialogueCutscene extends ScriptedCutscene {
|
||||
var event = EventManager.get(DialogueStructureEvent).recycle(dialogueData);
|
||||
event.dialogueData = new Access(Xml.parse(Assets.getText(dialoguePath)).firstElement());
|
||||
dialogueScript.call('structureLoaded', [event]);
|
||||
if(event.cancelled) return;
|
||||
if (event.cancelled) return;
|
||||
dialogueData = event.dialogueData;
|
||||
|
||||
// Add characters
|
||||
for(char in dialogueData.nodes.char) {
|
||||
for (char in dialogueData.nodes.char) {
|
||||
if (!char.has.name) continue;
|
||||
if (charMap.exists(char.att.name))
|
||||
Logs.trace('2 dialogue characters share the same name (${char.att.name}, ${char.att.name}). The old character has been replaced.');
|
||||
|
||||
var leChar:DialogueCharacter = new DialogueCharacter(char.att.name, char.getAtt('position').getDefault('default'));
|
||||
if(char.has.defaultAnim) leChar.defaultAnim = char.att.defaultAnim;
|
||||
if (char.has.defaultAnim) leChar.defaultAnim = char.att.defaultAnim;
|
||||
add(charMap[char.att.name] = leChar);
|
||||
}
|
||||
|
||||
var useDef:Bool = false;
|
||||
if(dialogueData.has.forceBoxDefaultTxtSound && dialogueData.att.forceBoxDefaultTxtSound == "true")
|
||||
if (dialogueData.has.forceBoxDefaultTxtSound && dialogueData.att.forceBoxDefaultTxtSound == "true")
|
||||
useDef = true;
|
||||
|
||||
// Add lines
|
||||
for(node in dialogueData.nodes.line) {
|
||||
for (node in dialogueData.nodes.line) {
|
||||
var formats = XMLUtil.getTextFormats(XMLUtil.fixSpacingInNode(node));
|
||||
var volume:Null<Float> = 0.8;
|
||||
var line:DialogueLine = {
|
||||
@@ -99,8 +99,8 @@ class DialogueCutscene extends ScriptedCutscene {
|
||||
textSound: null
|
||||
};
|
||||
|
||||
if(node.has.textSound) line.textSound = FlxG.sound.load(Paths.sound(node.att.textSound));
|
||||
else if(!useDef) {
|
||||
if (node.has.textSound) line.textSound = FlxG.sound.load(Paths.sound(node.att.textSound));
|
||||
else if (!useDef) {
|
||||
var char:DialogueCharacter = charMap[line.char];
|
||||
if(char != null && char.charData != null && char.charData.has.textSound)
|
||||
line.textSound = FlxG.sound.load(Paths.sound(char.charData.att.textSound));
|
||||
@@ -188,16 +188,16 @@ class DialogueCutscene extends ScriptedCutscene {
|
||||
|
||||
public override function close() {
|
||||
var event = new CancellableEvent();
|
||||
for(c in charMap) c.dialogueCharScript.call("close", [event]);
|
||||
dialogueBox.dialogueBoxScript.call("close", [event]);
|
||||
for (c in charMap) c.dialogueCharScript.call("close", [event]);
|
||||
if (dialogueBox != null) dialogueBox.dialogueBoxScript.call("close", [event]);
|
||||
dialogueScript.call("close", [event]);
|
||||
if(event.cancelled) return;
|
||||
if (event.cancelled) return;
|
||||
|
||||
super.close();
|
||||
}
|
||||
|
||||
public override function destroy() {
|
||||
if(curMusic != null && !curMusic.persist) curMusic.destroy();
|
||||
if (curMusic != null && !curMusic.persist) curMusic.destroy();
|
||||
|
||||
super.destroy();
|
||||
cutscene = null;
|
||||
|
||||
Reference in New Issue
Block a user