diff --git a/buildnumber.txt b/buildnumber.txt index 71db39d5..337173d4 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1216 \ No newline at end of file +1225 \ No newline at end of file diff --git a/source/animateatlas/displayobject/SpriteSymbol.hx b/source/animateatlas/displayobject/SpriteSymbol.hx index 4f813c42..e3128fff 100644 --- a/source/animateatlas/displayobject/SpriteSymbol.hx +++ b/source/animateatlas/displayobject/SpriteSymbol.hx @@ -241,6 +241,7 @@ class SpriteSymbol extends Sprite { _bitmap = new Bitmap(new BitmapData(1, 1), PixelSnapping.AUTO, smoothing); addChild(_bitmap); } + if (spriteData == null) return; if (_tempRect.x != spriteData.x || _tempRect.y != spriteData.y || _tempRect.width != spriteData.w || _tempRect.height != spriteData.h) { var clippedTexture = new BitmapData(spriteData.w, spriteData.h); diff --git a/source/funkin/cutscenes/ScriptedCutscene.hx b/source/funkin/cutscenes/ScriptedCutscene.hx index e98d836d..c448f603 100644 --- a/source/funkin/cutscenes/ScriptedCutscene.hx +++ b/source/funkin/cutscenes/ScriptedCutscene.hx @@ -1,14 +1,17 @@ package funkin.cutscenes; +import funkin.scripting.DummyScript; +import flixel.addons.transition.FlxTransitionableState; import funkin.scripting.Script; class ScriptedCutscene extends Cutscene { var script:Script; + var scriptPath:String; public function new(scriptPath:String, callback:Void->Void) { super(callback); - script = Script.create(scriptPath); + script = Script.create(this.scriptPath = scriptPath); script.setPublicMap(PlayState.instance.scripts.publicVariables); script.setParent(this); script.load(); @@ -16,7 +19,12 @@ class ScriptedCutscene extends Cutscene { public override function create() { super.create(); + trace("fuck"); script.call("create"); + if (Std.isOfType(script, DummyScript)) { + Logs.trace('Could not find script for scripted cutscene at ${scriptPath}', ERROR, RED); + close(); + } } public override function update(elapsed:Float) { @@ -41,6 +49,7 @@ class ScriptedCutscene extends Cutscene { } public function startVideo(path:String, ?callback:Void->Void) { + persistentDraw = false; openSubState(new VideoCutscene(path, function() { if (callback != null) callback(); diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 361c9c1a..6b61c50c 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -124,7 +124,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom if (xml.has.antialiasing) antialiasing = (xml.att.antialiasing == "true"); if (xml.has.sprite) sprite = xml.att.sprite; - frames = CoolUtil.loadFrames(Paths.image('characters/$sprite')); + frames = CoolUtil.loadFrames(Paths.image('characters/$sprite', null, true)); for(anim in xml.nodes.anim) { XMLUtil.addXMLAnimation(this, anim); } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 5b86a60c..7b911e52 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -350,7 +350,7 @@ class PlayState extends MusicBeatState persistentUpdate = false; if (cutscene != null) { openSubState(new ScriptedCutscene(cutscene, function() { - nextSong(); + startCountdown(); })); } else if (Assets.exists(videoCutscene)) { FlxTransitionableState.skipNextTransIn = true; @@ -670,6 +670,9 @@ class PlayState extends MusicBeatState { var event = scripts.event("onSubstateOpen", new SubstateEvent(SubState)); + if (!postCreated) + FlxTransitionableState.skipNextTransIn = true; + if (event.cancelled) return; if (paused) @@ -1314,31 +1317,29 @@ class PlayState extends MusicBeatState if (combo == 0 || combo >= 10) { comboGroup.add(comboSpr); for (i in 0...separatedScore.length) - { - break; - - var e = separatedScore.charAt(i); - - var numScore:FlxSprite = new FlxSprite((43 * i) - 90, 80).loadGraphic(Paths.image('${event.ratingPrefix}num$e${event.ratingSuffix}')); - numScore.antialiasing = event.numAntialiasing; - numScore.scale.set(event.numScale, event.numScale); - numScore.updateHitbox(); - - numScore.acceleration.y = FlxG.random.int(200, 300); - numScore.velocity.y -= FlxG.random.int(140, 160); - numScore.velocity.x = FlxG.random.float(-5, 5); - - comboGroup.add(numScore); - - FlxTween.tween(numScore, {alpha: 0}, 0.2, { - onComplete: function(tween:FlxTween) - { - comboGroup.remove(numScore, true); - numScore.destroy(); - }, - startDelay: Conductor.crochet * 0.002 - }); - } + { + var e = separatedScore.charAt(i); + + var numScore:FlxSprite = new FlxSprite((43 * i) - 90, 80).loadGraphic(Paths.image('${event.ratingPrefix}num$e${event.ratingSuffix}')); + numScore.antialiasing = event.numAntialiasing; + numScore.scale.set(event.numScale, event.numScale); + numScore.updateHitbox(); + + numScore.acceleration.y = FlxG.random.int(200, 300); + numScore.velocity.y -= FlxG.random.int(140, 160); + numScore.velocity.x = FlxG.random.float(-5, 5); + + comboGroup.add(numScore); + + FlxTween.tween(numScore, {alpha: 0}, 0.2, { + onComplete: function(tween:FlxTween) + { + comboGroup.remove(numScore, true); + numScore.destroy(); + }, + startDelay: Conductor.crochet * 0.002 + }); + } } comboGroup.add(rating); diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index 90442739..a86a02d0 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -53,7 +53,7 @@ class Stage extends FlxBasic implements IBeatReceiver { if (!node.has.sprite || !node.has.name || !node.has.x || !node.has.y) continue; - spr.loadAnimatedGraphic(Paths.image('$spritesParentFolder${node.att.sprite}')); + spr.loadAnimatedGraphic(Paths.image('$spritesParentFolder${node.att.sprite}', null, true)); var x:Null = Std.parseFloat(node.att.x); var y:Null = Std.parseFloat(node.att.y); diff --git a/source/funkin/menus/StoryMenuState.hx b/source/funkin/menus/StoryMenuState.hx index 7721c016..3ec87496 100644 --- a/source/funkin/menus/StoryMenuState.hx +++ b/source/funkin/menus/StoryMenuState.hx @@ -367,7 +367,7 @@ class MenuItem extends FlxSprite public function new(x:Float, y:Float, path:String) { super(x, y); - CoolUtil.loadAnimatedGraphic(this, Paths.image(path)); + CoolUtil.loadAnimatedGraphic(this, Paths.image(path, null, true)); screenCenter(X); antialiasing = true; } diff --git a/source/funkin/system/Paths.hx b/source/funkin/system/Paths.hx index 18934d3e..a15edbc7 100644 --- a/source/funkin/system/Paths.hx +++ b/source/funkin/system/Paths.hx @@ -111,9 +111,10 @@ class Paths return OpenFlAssets.exists(diff) ? diff : getPath('songs/${song.toLowerCase()}/Inst.$SOUND_EXT', MUSIC, null); } - inline static public function image(key:String, ?library:String) + inline static public function image(key:String, ?library:String, checkForAtlas:Bool = false) { - return getPath('images/$key.png', IMAGE, library); + var atlasPath = checkForAtlas ? getPath('images/$key/spritemap.png', IMAGE, library) : null; + return (checkForAtlas && OpenFlAssets.exists(atlasPath)) ? atlasPath.substr(0, atlasPath.length - 14) : getPath('images/$key.png', IMAGE, library); } inline static public function script(key:String, ?library:String, isAssetsPath:Bool = false) {