diff --git a/desktop_version/src/Music.cpp b/desktop_version/src/Music.cpp index b7b676a0..dcb724db 100644 --- a/desktop_version/src/Music.cpp +++ b/desktop_version/src/Music.cpp @@ -614,6 +614,8 @@ musicclass::musicclass(void) quick_fade = true; usingmmmmmm = false; + + stockSoundTracks = 0; } void musicclass::init(void) @@ -659,6 +661,8 @@ void musicclass::init(void) soundTracks.push_back(SoundTrack( "sounds/newrecord.wav" )); soundTracks.push_back(SoundTrack( "sounds/trophy.wav" )); soundTracks.push_back(SoundTrack( "sounds/rescue.wav" )); + + stockSoundTracks = soundTracks.size(); //Here's where we find all the custom sounds in a level's assets folder EnumHandle handle = {}; diff --git a/desktop_version/src/Music.h b/desktop_version/src/Music.h index c7d4ebad..1a4a7a66 100644 --- a/desktop_version/src/Music.h +++ b/desktop_version/src/Music.h @@ -65,6 +65,8 @@ public: bool mmmmmm; bool usingmmmmmm; + int stockSoundTracks; + binaryBlob pppppp_blob; binaryBlob mmmmmm_blob; int num_pppppp_tracks; diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index 4bb0d240..0b3efd27 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -355,13 +355,13 @@ void scriptclass::run(void) } if (words[0] == "playef") { - if (words[1] != "0" && ss_toi(words[1]) == 0) + if (is_number(words[1].c_str()) && ss_toi(words[1]) >= 0 && ss_toi(words[1]) < music.stockSoundTracks) { - music.playef_name(raw_words[1]); + music.playef(ss_toi(words[1])); } else { - music.playef(ss_toi(words[1])); + music.playef_name(raw_words[1]); } } if (words[0] == "play")