1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 08:13:45 +00:00

Video cutscenes in Week 7 no longer broken

This commit is contained in:
EliteMasterEric 2023-07-02 16:46:40 -04:00
parent 49ce962e34
commit bb8b0b59b1
4 changed files with 32 additions and 2 deletions

View file

@ -6,7 +6,8 @@ import openfl.utils.Assets as OpenFlAssets;
class Paths
{
inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end;
public static var SOUND_EXT = #if web "mp3" #else "ogg" #end;
public static var VIDEO_EXT = "mp4";
static var currentLevel:String;
@ -96,6 +97,11 @@ class Paths
return getPath('music/$key.$SOUND_EXT', MUSIC, library);
}
inline static public function videos(key:String, ?library:String)
{
return getPath('videos/$key.$VIDEO_EXT', BINARY, library);
}
inline static public function voices(song:String, ?suffix:String = '')
{
if (suffix == null) suffix = ""; // no suffix, for a sorta backwards compatibility with older-ish voice files

View file

@ -1422,6 +1422,7 @@ class PlayState extends MusicBeatState
// Handle keybinds.
if (!isInCutscene && !disableKeys) keyShit(true);
if (!isInCutscene && !disableKeys) debugKeyShit();
if (isInCutscene && !disableKeys) handleCutsceneKeys(elapsed);
// Dispatch the onUpdate event to scripted elements.
dispatchEvent(new UpdateScriptEvent(elapsed));
@ -1429,6 +1430,23 @@ class PlayState extends MusicBeatState
static final CUTSCENE_KEYS:Array<FlxKey> = [SPACE, ESCAPE, ENTER];
function handleCutsceneKeys(elapsed:Float):Void
{
if (VideoCutscene.isPlaying())
{
// This is a video cutscene.
if (controls.CUTSCENE_SKIP)
{
trySkipVideoCutscene(elapsed);
}
else
{
trySkipVideoCutscene(-1);
}
}
}
public function trySkipVideoCutscene(elapsed:Float):Void
{
if (skipTimer == null || skipTimer.animation == null) return;

View file

@ -30,7 +30,8 @@ class VideoCutscene
if (!openfl.Assets.exists(filePath))
{
trace('ERROR: Video file does not exist: ${filePath}');
// Display a popup.
lime.app.Application.current.window.alert('Video file does not exist: ${filePath}', 'Error playing video');
return;
}

View file

@ -1,6 +1,8 @@
package funkin.play.song;
import flixel.util.typeLimit.OneOfTwo;
import funkin.modding.events.ScriptEvent;
import funkin.modding.events.ScriptEventDispatcher;
import funkin.play.song.ScriptedSong;
import funkin.util.assets.DataAssets;
import haxe.DynamicAccess;
@ -96,6 +98,9 @@ class SongDataParser
{
var song:Song = songCache.get(songId);
trace('Successfully fetch song: ${songId}');
var event:ScriptEvent = new ScriptEvent(ScriptEvent.CREATE, false);
ScriptEventDispatcher.callEvent(song, event);
return song;
}
else