mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-08 18:09:45 +01:00
Refined criteria for choosing custom sound effects
Previously, any number would be interpreted as a stock sound effect ID, causing the side effect of being able to call custom sound effects using numbers over 27 (which is unreliable). Now only numbers that correspond to a stock sound effect ID will be considered (leading zeroes work as well), and everything else will be interpreted as a custom sound effect file name.
This commit is contained in:
parent
b0eb97fa53
commit
92f86079a0
3 changed files with 9 additions and 3 deletions
|
@ -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 = {};
|
||||
|
|
|
@ -65,6 +65,8 @@ public:
|
|||
bool mmmmmm;
|
||||
bool usingmmmmmm;
|
||||
|
||||
int stockSoundTracks;
|
||||
|
||||
binaryBlob pppppp_blob;
|
||||
binaryBlob mmmmmm_blob;
|
||||
int num_pppppp_tracks;
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue