mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-07-28 09:59:29 +03:00
Add warning for playef command and lower sound IDs
Ethan mentioned how case sensitivity could be a concern -- this commit lowers the filename to create the sound ID, and also strips spaces. Script arguments are always lowered, and the spaces get removed, so the IDs are modified to match this behavior. If someone types in the command `playef(horses REALLY COOL)`, the argument will get converted to `horsesreallycool`. Likewise, the filename "horses REALLY COOL.wav" will get converted to `horsesreallycool`. To the level creator, they can just enter the same name twice and their sound will play. This commit also adds a warning for the `playef` script command. While most creators do not open the console, some warning somewhere is better than nothing. I do think we should eventually have some sort of system where it's easier to view level warnings, but for now this should be sufficient.
This commit is contained in:
@@ -447,13 +447,20 @@ void scriptclass::run(void)
|
||||
}
|
||||
if (words[0] == "playef")
|
||||
{
|
||||
bool played = false;
|
||||
int sound_id = help.Int(words[1].c_str(), -1);
|
||||
|
||||
if (music.soundidexists(words[1].c_str()))
|
||||
{
|
||||
music.playefid(words[1].c_str());
|
||||
played = music.playefid(words[1].c_str());
|
||||
}
|
||||
else if (!music.soundisextra(ss_toi(words[1])))
|
||||
else if (!music.soundisextra(sound_id))
|
||||
{
|
||||
music.playef(ss_toi(words[1]));
|
||||
played = music.playef(sound_id);
|
||||
}
|
||||
if (!played)
|
||||
{
|
||||
vlog_error("playef() couldn't play sound: %s", words[1].c_str());
|
||||
}
|
||||
}
|
||||
if (words[0] == "play")
|
||||
|
||||
Reference in New Issue
Block a user