CON: Add "actorsound" command.

Patch from Striker.

git-svn-id: https://svn.eduke32.com/eduke32@6504 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-11-29 07:28:58 +00:00
parent bad61e3934
commit 38df0b7e82
3 changed files with 20 additions and 0 deletions

View file

@ -118,6 +118,7 @@ static tokenmap_t const vm_keywords[] =
{ "activatebysector", CON_ACTIVATEBYSECTOR },
{ "activatecheat", CON_ACTIVATECHEAT },
{ "actor", CON_ACTOR },
{ "actorsound", CON_ACTORSOUND },
{ "addammo", CON_ADDAMMO },
{ "addinventory", CON_ADDINVENTORY },
{ "addkills", CON_ADDKILLS },
@ -4111,6 +4112,7 @@ DO_DEFSTATE:
case CON_QSTRCAT:
case CON_QSTRCPY:
case CON_QGETSYSSTR:
case CON_ACTORSOUND:
case CON_STOPACTORSOUND:
case CON_STARTTRACKSLOT:
C_GetManyVars(2);

View file

@ -1145,6 +1145,7 @@ enum ScriptKeywords_t
CON_DRAWLINERGB, // 405
CON_STARTTRACKSLOT, // 406
CON_STOPALLMUSIC, // 407
CON_ACTORSOUND, // 408
CON_END
};
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua

View file

@ -1679,6 +1679,23 @@ skip_check:
continue;
}
case CON_ACTORSOUND:
insptr++;
{
int const spriteNum = (*insptr++ != g_thisActorVarID) ? Gv_GetVarX(*(insptr - 1)) : vm.spriteNum;
int const soundNum = Gv_GetVarX(*insptr++);
if (EDUKE32_PREDICT_FALSE((unsigned)soundNum >= MAXSOUNDS))
{
CON_ERRPRINTF("invalid sound %d\n", soundNum);
continue;
}
A_PlaySound(soundNum, spriteNum);
continue;
}
case CON_SETACTORSOUNDPITCH:
insptr++;
{