diff --git a/assets/data/dialogue/boxes/default.xml b/assets/data/dialogue/boxes/default.xml index 99cf3859..f40a3196 100644 --- a/assets/data/dialogue/boxes/default.xml +++ b/assets/data/dialogue/boxes/default.xml @@ -2,7 +2,7 @@ + --> + --> diff --git a/assets/data/dialogue/boxes/senpai.xml b/assets/data/dialogue/boxes/senpai.xml index cb163d61..643f860a 100644 --- a/assets/data/dialogue/boxes/senpai.xml +++ b/assets/data/dialogue/boxes/senpai.xml @@ -2,8 +2,8 @@ - + --> + + --> \ No newline at end of file diff --git a/assets/data/dialogue/characters/senpai.xml b/assets/data/dialogue/characters/senpai.xml new file mode 100644 index 00000000..ffe5d244 --- /dev/null +++ b/assets/data/dialogue/characters/senpai.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/assets/images/dialogue/boxes/pixel/dialogueBox.png b/assets/images/dialogue/boxes/pixel/dialogueBox.png index c7d88ff5..dbc7ae3e 100644 Binary files a/assets/images/dialogue/boxes/pixel/dialogueBox.png and b/assets/images/dialogue/boxes/pixel/dialogueBox.png differ diff --git a/assets/images/dialogue/boxes/pixel/dialogueBox.xml b/assets/images/dialogue/boxes/pixel/dialogueBox.xml index 4414787b..50d3f2e9 100644 --- a/assets/images/dialogue/boxes/pixel/dialogueBox.xml +++ b/assets/images/dialogue/boxes/pixel/dialogueBox.xml @@ -1,10 +1,11 @@ - - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/assets/images/dialogue/characters/pixel/boyfriend.png b/assets/images/dialogue/characters/pixel/boyfriend.png new file mode 100644 index 00000000..2756eaf0 Binary files /dev/null and b/assets/images/dialogue/characters/pixel/boyfriend.png differ diff --git a/assets/images/dialogue/characters/pixel/boyfriend.xml b/assets/images/dialogue/characters/pixel/boyfriend.xml new file mode 100644 index 00000000..e4f6210a --- /dev/null +++ b/assets/images/dialogue/characters/pixel/boyfriend.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/dialogue/characters/pixel/senpai.png b/assets/images/dialogue/characters/pixel/senpai.png new file mode 100644 index 00000000..4e60d818 Binary files /dev/null and b/assets/images/dialogue/characters/pixel/senpai.png differ diff --git a/assets/images/dialogue/characters/pixel/senpai.xml b/assets/images/dialogue/characters/pixel/senpai.xml new file mode 100644 index 00000000..0a4916b3 --- /dev/null +++ b/assets/images/dialogue/characters/pixel/senpai.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/songs/roses/dialogue.xml b/assets/songs/roses/dialogue.xml index e058c1d5..4afba293 100644 --- a/assets/songs/roses/dialogue.xml +++ b/assets/songs/roses/dialogue.xml @@ -1,14 +1,14 @@ - + - + Not bad for an ugly worm. - + But this time I'll rip your nuts off right after your girlfriend finishes gargling mine. diff --git a/assets/songs/senpai/dialogue.xml b/assets/songs/senpai/dialogue.xml index 2b2a081a..0a8c62ed 100644 --- a/assets/songs/senpai/dialogue.xml +++ b/assets/songs/senpai/dialogue.xml @@ -1,14 +1,14 @@ - + - + Ah, a new fair maiden has come in search of true love! - + A serenade between gentlemen shall decide where her beautiful heart shall reside. diff --git a/assets/songs/thorns/creepyDialogue.xml b/assets/songs/thorns/creepyDialogue.xml index bfa5c80e..75ee0d15 100644 --- a/assets/songs/thorns/creepyDialogue.xml +++ b/assets/songs/thorns/creepyDialogue.xml @@ -1,22 +1,22 @@ - + - + Direct contact with real humans, after being trapped in here for so long... - + and HER of all people. - + I'll make her father pay for what he's done to me and all the others,,,, - + I'll beat you and make you take my place. - + You don't mind your bodies being borrowed right? It's only fair... \ No newline at end of file diff --git a/source/funkin/backend/utils/XMLUtil.hx b/source/funkin/backend/utils/XMLUtil.hx index 1d9aa526..7058ae28 100644 --- a/source/funkin/backend/utils/XMLUtil.hx +++ b/source/funkin/backend/utils/XMLUtil.hx @@ -1,10 +1,9 @@ package funkin.backend.utils; -import flixel.animation.FlxAnimation; import funkin.backend.FunkinSprite; import funkin.backend.system.ErrorCode; import funkin.backend.FunkinSprite.XMLAnimType; -import funkin.backend.system.interfaces.IBeatReceiver; +import flixel.util.FlxColor; import haxe.xml.Access; import funkin.backend.system.interfaces.IOffsetCompatible; @@ -138,12 +137,15 @@ class XMLUtil { } if (node.has.updateHitbox && node.att.updateHitbox == "true") spr.updateHitbox(); - if(node.has.zoomfactor) + if (node.has.zoomfactor) spr.zoomFactor = Std.parseFloat(node.getAtt("zoomfactor")).getDefault(spr.zoomFactor); if (node.has.alpha) spr.alpha = Std.parseFloat(node.getAtt("alpha")).getDefault(spr.alpha); + if(node.has.color) + spr.color = FlxColor.fromString(node.getAtt("color")).getDefault(0xFFFFFFFF); + if (node.has.playOnCountdown) spr.skipNegativeBeats = node.att.playOnCountdown == "true"; if (node.has.beatInterval) diff --git a/source/funkin/game/cutscenes/dialogue/DialogueBox.hx b/source/funkin/game/cutscenes/dialogue/DialogueBox.hx index 296be07c..f61e65c1 100644 --- a/source/funkin/game/cutscenes/dialogue/DialogueBox.hx +++ b/source/funkin/game/cutscenes/dialogue/DialogueBox.hx @@ -48,6 +48,7 @@ class DialogueBox extends FunkinSprite { text.color = textNode.getAtt("color").getColorFromDynamic().getDefault(0xFF000000); text.size = Std.parseInt(textNode.att.size).getDefault(20); text.font = Paths.font('${textNode.getAtt("font").getDefault("vcr.ttf")}'); + text.delay = Std.parseFloat(textNode.getAtt("delay")).getDefault(0.05); text.antialiasing = textNode.getAtt("antialiasing").getDefault("false") == "true"; text.sounds = [FlxG.sound.load(textTypeSFX)]; if(textNode.has.borderStyle) { diff --git a/source/funkin/game/cutscenes/dialogue/DialogueCharacter.hx b/source/funkin/game/cutscenes/dialogue/DialogueCharacter.hx index 32d241a8..db089b9d 100644 --- a/source/funkin/game/cutscenes/dialogue/DialogueCharacter.hx +++ b/source/funkin/game/cutscenes/dialogue/DialogueCharacter.hx @@ -6,23 +6,30 @@ import haxe.xml.Access; class DialogueCharacter extends FunkinSprite { public var charData:Access; public var curTween:FlxTween; - public var curTweenContext:DialogueCharTweenContext = NONE; + public var curAnimContext:DialogueCharAnimContext = NONE; public var positionName:String; + public var finishCallback:String->Void = null; public function new(name:String, position:String) { super(); this.positionName = position; try { charData = new Access(Xml.parse(Assets.getText(Paths.xml('dialogue/characters/$name'))).firstElement()); - loadSprite(Paths.image('dialogue/characters/${charData.getAtt('sprite').getDefault(name)}')); - antialiasing = charData.getAtt('antialiasing').getDefault('true') == 'true'; - scale.scale(charData.has.scale ? Std.parseFloat(charData.att.scale).getDefault(1) : 1); - updateHitbox(); - offset.set( - charData.has.x ? Std.parseFloat(charData.att.x).getDefault(0) : 0, - (charData.has.y ? Std.parseFloat(charData.att.y).getDefault(0) : 0) + this.height); - for(anim in charData.nodes.anim) - XMLUtil.addXMLAnimation(this, anim, true); + if(!charData.has.sprite) charData.x.set("sprite", name); + if(!charData.has.updateHitbox) charData.x.set("updateHitbox", "true"); + XMLUtil.loadSpriteFromXML(this, charData, "dialogue/characters/", LOOP); + + animation.finishCallback = (name:String) -> { + switch(name) + { + case 'show': hasAnimation('normal') ? playAnim('normal', true) : animation.stop(); + case 'hide': alpha = 0; + } + if(finishCallback != null) finishCallback(name); + } + + offset.set(x, y + height); + x = 0; y = 0; } catch(e) { Logs.trace('Failed to load dialogue character $name: ${e.toString()}', ERROR); } @@ -30,29 +37,33 @@ class DialogueCharacter extends FunkinSprite { } public function show(x:Float, y:Float) { - if (curTweenContext != (curTweenContext = POPIN)) { - setPosition(x, y + 100); - if (curTween != null) - curTween.cancel(); + if (curAnimContext == (curAnimContext = POPIN)) return; + if (hasAnimation('show')) { + playAnim('show', true); + setPosition(x, y); + } else { + setPosition(x, y + 100); + if(curTween != null) curTween.cancel(); + playAnim('normal', true); alpha = 0; - visible = true; - curTween = FlxTween.tween(this, {alpha: 1, y: y}, 0.2, {ease: FlxEase.quintOut}); } + visible = true; } public function hide() { - if (curTweenContext != (curTweenContext = POPOUT)) { - if (curTween != null) - curTween.cancel(); - + if (curAnimContext == (curAnimContext = POPOUT)) return; + + if(hasAnimation('hide')) playAnim('hide', true); + else { + if(curTween != null) curTween.cancel(); curTween = FlxTween.tween(this, {alpha: 0, y: y + 100}, 0.2, {ease: FlxEase.quintIn}); } } } -enum abstract DialogueCharTweenContext(Int) { +enum abstract DialogueCharAnimContext(Int) { var NONE = -1; var POPIN = 0; var POPOUT = 1;