diff --git a/Project.xml b/Project.xml index 4b956a90..589ea40c 100644 --- a/Project.xml +++ b/Project.xml @@ -138,7 +138,7 @@ - + diff --git a/assets/data/characters/bf-car.xml b/assets/data/characters/bf-car.xml index 65d5adc5..7c7a043f 100644 --- a/assets/data/characters/bf-car.xml +++ b/assets/data/characters/bf-car.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/data/characters/pico.xml b/assets/data/characters/pico.xml index 478bcad6..246a8b41 100644 --- a/assets/data/characters/pico.xml +++ b/assets/data/characters/pico.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/data/charts/bopeebo/hey.hx b/assets/data/charts/bopeebo/hey.hx new file mode 100644 index 00000000..cfff16dd --- /dev/null +++ b/assets/data/charts/bopeebo/hey.hx @@ -0,0 +1,4 @@ +function beatHit(curBeat) { + if (curBeat != 79 && curBeat % 8 == 7) + boyfriend.playAnim("hey"); +} \ No newline at end of file diff --git a/assets/data/charts/tutorial/test.hx b/assets/data/charts/tutorial/test.hx deleted file mode 100644 index c889c5d2..00000000 --- a/assets/data/charts/tutorial/test.hx +++ /dev/null @@ -1,10 +0,0 @@ -import funkin.system.Conductor; -import flixel.tweens.FlxTween; -import funkin.scripting.events.NoteHitEvent; - -function onPlayerHit(event:NoteHitEvent) { - if (event.note.isSustainNote) return; - event.preventDeletion(); - FlxTween.tween(event.note, {strumTime: event.note.strumTime + (Conductor.crochet * 2)}, Conductor.crochet / 500, {ease: FlxEase.cubeOut}); - event.note.wasGoodHit = false; -} \ No newline at end of file diff --git a/assets/data/cutscenes/cocoa.hx b/assets/data/cutscenes/cocoa.hx deleted file mode 100644 index 34cad301..00000000 --- a/assets/data/cutscenes/cocoa.hx +++ /dev/null @@ -1,5 +0,0 @@ -function create() { - startVideo(Paths.video("garfield"), function() { - close(); - }); -} \ No newline at end of file diff --git a/assets/data/stages/mall-evil.xml b/assets/data/stages/mall-evil.xml index 1085d4bf..6596c230 100644 --- a/assets/data/stages/mall-evil.xml +++ b/assets/data/stages/mall-evil.xml @@ -1,6 +1,5 @@ - diff --git a/assets/data/stages/mall.xml b/assets/data/stages/mall.xml index 795baa5f..119eda44 100644 --- a/assets/data/stages/mall.xml +++ b/assets/data/stages/mall.xml @@ -1,19 +1,12 @@ - - - - + - - - + - - - + diff --git a/assets/data/stages/school-evil.xml b/assets/data/stages/school-evil.xml index cf44fa07..1c12d28b 100644 --- a/assets/data/stages/school-evil.xml +++ b/assets/data/stages/school-evil.xml @@ -1,5 +1,5 @@ + antialiasing="false" scale="6" scrollx="0.8" scrolly="0.9" type="loop"/> \ No newline at end of file diff --git a/assets/data/stages/school.xml b/assets/data/stages/school.xml index 5fe4d094..06a043b4 100644 --- a/assets/data/stages/school.xml +++ b/assets/data/stages/school.xml @@ -1,24 +1,24 @@ - - - + antialiasing="false" scale="4.8" scroll="0.9" updateHitbox="true" type="loop"/> + antialiasing="false" scale="8.4" scroll="0.85" updateHitbox="true" type="loop"/> + antialiasing="false" scale="6" scroll="0.85" updateHitbox="true" type="loop"/> - + diff --git a/assets/data/stages/spooky.xml b/assets/data/stages/spooky.xml index 7e566b7a..10015215 100644 --- a/assets/data/stages/spooky.xml +++ b/assets/data/stages/spooky.xml @@ -1,7 +1,7 @@ - - + + \ No newline at end of file diff --git a/assets/data/stages/tank.xml b/assets/data/stages/tank.xml index 40aa95e8..1e973d4a 100644 --- a/assets/data/stages/tank.xml +++ b/assets/data/stages/tank.xml @@ -12,7 +12,7 @@ - + diff --git a/assets/videos/flying ghost.mp4 b/assets/videos/flying ghost.mp4 deleted file mode 100644 index b74ad703..00000000 Binary files a/assets/videos/flying ghost.mp4 and /dev/null differ diff --git a/assets/videos/garfield.mp4 b/assets/videos/garfield.mp4 deleted file mode 100644 index 149dc9e2..00000000 Binary files a/assets/videos/garfield.mp4 and /dev/null differ diff --git a/buildnumber.txt b/buildnumber.txt index 85b0c4bd..6f7cc073 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1462 \ No newline at end of file +1466 \ No newline at end of file diff --git a/source/flx3d/FlxView3D.hx b/source/flx3d/FlxView3D.hx index fb8c1a26..8182918f 100644 --- a/source/flx3d/FlxView3D.hx +++ b/source/flx3d/FlxView3D.hx @@ -58,6 +58,7 @@ class FlxView3D extends FlxSprite { Main.instance.removeChild(view); view.dispose(); + _loader.disposeWithChildren(); super.destroy(); if (bmp != null) { diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 8c5e9eea..8a7bf215 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -792,10 +792,10 @@ class PlayState extends MusicBeatState } } #end - // if (__wasAutoPause && __songPlaying) { - // inst.play(); - // vocals.play(); - // } + if (__wasAutoPause && __songPlaying) { + inst.play(); + vocals.play(); + } super.onFocus(); } @@ -809,11 +809,11 @@ class PlayState extends MusicBeatState DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + difficultyText + ")", iconRPC); } #end - // if (__wasAutoPause = FlxG.autoPause) { - // __songPlaying = inst.playing; - // inst.pause(); - // vocals.pause(); - // } + if (__wasAutoPause = FlxG.autoPause) { + __songPlaying = inst.playing; + inst.pause(); + vocals.pause(); + } super.onFocusLost(); diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index 49e15d08..3eab03a8 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -57,7 +57,7 @@ class Stage extends FlxBasic implements IBeatReceiver { case "sprite" | "spr" | "sparrow": if (!node.has.sprite || !node.has.name || !node.has.x || !node.has.y) continue; - var spr = XMLUtil.createSpriteFromXML(node, spritesParentFolder); + var spr = XMLUtil.createSpriteFromXML(node, spritesParentFolder, BEAT); if (!node.has.zoomfactor && PlayState.instance != null) spr.initialZoom = PlayState.instance.defaultCamZoom; diff --git a/source/funkin/system/XMLSprite.hx b/source/funkin/system/XMLSprite.hx index 0c1e2efe..ccbcdbce 100644 --- a/source/funkin/system/XMLSprite.hx +++ b/source/funkin/system/XMLSprite.hx @@ -8,7 +8,24 @@ import flixel.math.FlxMath; import funkin.interfaces.IBeatReceiver; import flixel.FlxSprite; +@:enum +abstract XMLAnimType(Int) { + var NONE = 0; + var BEAT = 1; + var LOOP = 2; + + public static function fromString(str:String, def:XMLAnimType = NONE) { + return switch(str.trim().toLowerCase()) { + case "none": NONE; + case "beat" | "onbeat": BEAT; + case "loop": LOOP; + default: def; + } + } +} + class XMLSprite extends FlxSprite implements IBeatReceiver { + public var spriteAnimType:XMLAnimType = NONE; public var beatAnims:Array = []; public var name:String; public var zoomFactor:Float = 1; diff --git a/source/funkin/system/XMLUtil.hx b/source/funkin/system/XMLUtil.hx index b8856273..e946b95b 100644 --- a/source/funkin/system/XMLUtil.hx +++ b/source/funkin/system/XMLUtil.hx @@ -1,5 +1,6 @@ package funkin.system; +import funkin.system.XMLSprite.XMLAnimType; import flixel.math.FlxMath; import funkin.interfaces.IBeatReceiver; import haxe.xml.Access; @@ -44,15 +45,19 @@ class XMLUtil { /** * Creates a new sprite based on a XML node. */ - public static function createSpriteFromXML(node:Access, parentFolder:String = "", ?cl:Class):XMLSprite { + public static function createSpriteFromXML(node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT, ?cl:Class):XMLSprite { if (parentFolder == null) parentFolder = ""; - var spr = cl != null ? Type.createInstance(cl, []) : new XMLSprite(); + var spr:XMLSprite = cl != null ? Type.createInstance(cl, []) : new XMLSprite(); spr.name = node.getAtt("name"); spr.antialiasing = true; spr.loadAnimatedGraphic(Paths.image('$parentFolder${node.getAtt("sprite")}', null, true)); + spr.spriteAnimType = defaultAnimType; + if (node.has.type) + spr.spriteAnimType = XMLAnimType.fromString(node.att.type, spr.spriteAnimType); + var x:Null = node.has.x ? Std.parseFloat(node.att.x) : null; var y:Null = node.has.y ? Std.parseFloat(node.att.y) : null; if (x != null) spr.x = x; @@ -91,17 +96,23 @@ class XMLUtil { * @param anim Animation (Must be a `anim` XML node) */ public static function addXMLAnimation(sprite:FlxSprite, anim:Access, loop:Bool = false):ErrorCode { + var animType:XMLAnimType = NONE; + if (sprite is XMLSprite) + animType = cast(sprite, XMLSprite).spriteAnimType; + var animData:AnimData = { name: null, anim: null, fps: 24, loop: loop, + animType: animType, x: 0, y: 0, indices: [] }; if (anim.has.name) animData.name = anim.att.name; + if (anim.has.type) animData.animType = XMLAnimType.fromString(anim.att.type, animData.animType); if (anim.has.anim) animData.anim = anim.att.anim; if (anim.has.fps) animData.fps = Std.parseInt(anim.att.fps); if (anim.has.x) animData.x = Std.parseFloat(anim.att.x); @@ -127,6 +138,17 @@ class XMLUtil { if (sprite is IOffsetCompatible) cast(sprite, IOffsetCompatible).addOffset(animData.name, animData.x, animData.y); + if (sprite is XMLSprite) { + var xmlSpr = cast(sprite, XMLSprite); + switch(animData.animType) { + case BEAT: + xmlSpr.beatAnims.push(animData.name); + case LOOP: + xmlSpr.animation.play(animData.name); + default: + // nothing + } + } return OK; } return MISSING_PROPERTY; @@ -141,4 +163,5 @@ typedef AnimData = { var x:Float; var y:Float; var indices:Array; + var animType:XMLAnimType; } \ No newline at end of file