Skip to content

Commit

Permalink
Reworked Dialogue Music System
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLikesKirby committed Nov 2, 2024
1 parent 84f40e8 commit ded4801
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
1 change: 0 additions & 1 deletion mods/test/data/charts/test-dia.txt

This file was deleted.

1 change: 1 addition & 0 deletions mods/test/data/charts/test-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"songCreators": "Kawai Sprite & MtH",
"songHeadings": "funkinHeading",
"creditsTxt": "The testiest song on the planet",
"dialogueMusic": "DaveDialogue",
"hasNoGf": false,
"intro": "",
"windowName": "",
Expand Down
3 changes: 3 additions & 0 deletions mods/test/data/dialogue/test-endDialogue.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:dave,festival-exhausted:Testing
:generic:Testing
:generic:1 2 3
20 changes: 8 additions & 12 deletions source/DialogueBox.hx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DialogueBox extends FlxSpriteGroup
var debug:Bool = false;

var curshader:Dynamic;
var custom:Array<String>;
var custom:String;

public var rawJsonDial:String;
public var jsonDial:DiaCharacter;
Expand All @@ -78,8 +78,10 @@ class DialogueBox extends FlxSpriteGroup
{
super();

if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-dia.txt')) {
custom = CoolUtil.coolTextFile(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-dia.txt');
if (PlayState.settingsExist && PlayState.jsonSettings.dialogueMusic != null) {
custom = PlayState.jsonSettings.dialogueMusic;
} else {
custom = '';
}

if (playMusic)
Expand Down Expand Up @@ -120,19 +122,13 @@ class DialogueBox extends FlxSpriteGroup
case 'rano':
FlxG.sound.playMusic(Paths.music('stocknightambianceforranolol'), 0);
default:
if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-dia.txt')) {
for (i in 0...custom.length)
{
var data:Array<String> = custom[i].split(':');
if (data[0] == null) {
if (PlayState.settingsExist) {
if (custom == '') {
FlxG.sound.music.stop();
} else {
FlxG.sound.playMusic(Paths.music(data[0]), 0);
FlxG.sound.playMusic(Paths.music(custom), 0);
}
}
} else {
FlxG.sound.music.stop();
}
}
FlxG.sound.music.fadeIn(1, 0, 0.8);
}
Expand Down
1 change: 1 addition & 0 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ typedef Settings = {
var songCreators:String;
var songHeadings:String;
var creditsTxt:String;
var dialogueMusic:String;
var hasNoGf:Bool;
var intro:String;
var windowName:String;
Expand Down

0 comments on commit ded4801

Please sign in to comment.