Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Commit

Permalink
custom countdown sounds for songs
Browse files Browse the repository at this point in the history
  • Loading branch information
notweuz committed Apr 28, 2022
1 parent 3b23754 commit f6e4c8a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using StringTools;

class MainMenuState extends MusicBeatState
{
public static var osEngineVesrion:String = '0.1.0'; //This is also used for Discord RPC
public static var osEngineVesrion:String = '0.1.2'; //This is also used for Discord RPC
public static var curSelected:Int = 0;

var menuItems:FlxTypedGroup<FlxSprite>;
Expand Down
4 changes: 4 additions & 0 deletions source/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,10 @@ class Paths
return modFolders('data/' + key + '.json');
}

inline static public function modsSongs(song:String, key:String) {
return modFolders('songs/' + song + '/' + key + '.' + SOUND_EXT);
}

inline static public function modsVideo(key:String) {
return modFolders('videos/' + key + '.' + VIDEO_EXT);
}
Expand Down
28 changes: 23 additions & 5 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,7 @@ class PlayState extends MusicBeatState
callOnLuas('onStartCountdown', []);
return;
}
var songName:String = Paths.formatToSongPath(SONG.song).toLowerCase();

inCutscene = false;
var ret:Dynamic = callOnLuas('onStartCountdown', []);
Expand Down Expand Up @@ -1492,8 +1493,13 @@ class PlayState extends MusicBeatState

switch (swagCounter)
{
case 0:
FlxG.sound.play(Paths.sound('intro3' + introSoundsSuffix), 0.6);
case 0:
//trace(songName);
if (FileSystem.exists(Paths.modsSounds('sounds', songName + '+' + 'intro3'))) {
FlxG.sound.play(Paths.sound(songName + '+' + 'intro3', 'ogg'), 0.6);
} else {
FlxG.sound.play(Paths.sound('intro3' + introSoundsSuffix), 0.6);
}
case 1:
countdownReady = new FlxSprite().loadGraphic(Paths.image(introAlts[0]));
countdownReady.scrollFactor.set();
Expand All @@ -1513,7 +1519,11 @@ class PlayState extends MusicBeatState
countdownReady.destroy();
}
});
FlxG.sound.play(Paths.sound('intro2' + introSoundsSuffix), 0.6);
if (FileSystem.exists(Paths.modsSounds('sounds', songName + '+' + 'intro2'))) {
FlxG.sound.play(Paths.sound(songName + '+' + 'intro2', 'ogg'), 0.6);
} else {
FlxG.sound.play(Paths.sound('intro2' + introSoundsSuffix), 0.6);
}
case 2:
countdownSet = new FlxSprite().loadGraphic(Paths.image(introAlts[1]));
countdownSet.scrollFactor.set();
Expand All @@ -1532,7 +1542,11 @@ class PlayState extends MusicBeatState
countdownSet.destroy();
}
});
FlxG.sound.play(Paths.sound('intro1' + introSoundsSuffix), 0.6);
if (FileSystem.exists(Paths.modsSounds('sounds', songName + '+' + 'intro1'))) {
FlxG.sound.play(Paths.sound(songName + '+' + 'intro1', 'ogg'), 0.6);
} else {
FlxG.sound.play(Paths.sound('intro1' + introSoundsSuffix), 0.6);
}
case 3:
countdownGo = new FlxSprite().loadGraphic(Paths.image(introAlts[2]));
countdownGo.scrollFactor.set();
Expand All @@ -1553,7 +1567,11 @@ class PlayState extends MusicBeatState
countdownGo.destroy();
}
});
FlxG.sound.play(Paths.sound('introGo' + introSoundsSuffix), 0.6);
if (FileSystem.exists(Paths.modsSounds('sounds', songName + '+' + 'introGo'))) {
FlxG.sound.play(Paths.sound(songName + '+' + 'introGo', 'ogg'), 0.6);
} else {
FlxG.sound.play(Paths.sound('introGo' + introSoundsSuffix), 0.6);
}
case 4:
}

Expand Down
2 changes: 1 addition & 1 deletion source/editors/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2712,7 +2712,7 @@ class ChartingState extends MusicBeatState
function loadJson(song:String):Void
{
//make it look sexier if possible
if (CoolUtil.difficulties[PlayState.storyDifficulty] != "Normal"){
if (CoolUtil.difficulties[PlayState.storyDifficulty] != null && CoolUtil.difficulties[PlayState.storyDifficulty] != "Normal"){
PlayState.SONG = Song.loadFromJson(song.toLowerCase()+"-"+CoolUtil.difficulties[PlayState.storyDifficulty], song.toLowerCase());

}else{
Expand Down

0 comments on commit f6e4c8a

Please sign in to comment.