Fix local hitsound priority

Local hitsounds (/hitsound 2) work by running CubeScript
command `sound`, passing hitsound sound number and
priority (highest). However, `sound` command doesn't actually
take the second priority argument and always uses default normal
priority.

This commit adds the second prioity argument to `sound`.
It accepts numeric priority levels as well as string names.

Also use highest priority for server hitsounds (to be consistent with
local hitsounds).

(was pull request #164)

DOCREF sound
This commit is contained in:
gy_be
2017-04-20 13:53:55 +02:00
committed by ac-stef
parent c2d64d3a2b
commit 9820e59adb
3 changed files with 9 additions and 6 deletions
+5 -2
View File
@@ -773,9 +773,12 @@ bool staticreference::operator==(const worldobjreference &other)
audiomanager audiomgr;
COMMANDF(sound, "i", (int *n)
const char *soundprioritynames[] = {"LOW", "NORMAL", "HIGH", "HIGHEST", ""}; // keep in sync with enum { SP_LOW = 0, SP_NORMAL, SP_HIGH, SP_HIGHEST }
COMMANDF(sound, "is", (int *n, char *priorityname)
{
audiomgr.playsound(*n);
int priority = getlistindex(priorityname, soundprioritynames, true, SP_NORMAL);
audiomgr.playsound(*n, priority);
});
COMMANDF(applymapsoundchanges, "", (){