Merge branch 'local-music-patch' into 'master'

ACS music functions: add optional bool to only affect player activator

See merge request KartKrew/Kart!1531
This commit is contained in:
toaster 2023-09-26 22:08:14 +00:00
commit 50ae488934

View file

@ -339,8 +339,6 @@ static bool ACS_CountThing(mobj_t *mobj, mobjtype_t type)
return false;
}
// Unused, but it's here if you need it.
#if 0
/*--------------------------------------------------
static bool ACS_ActivatorIsLocal(ACSVM::Thread *thread)
@ -368,7 +366,6 @@ static bool ACS_ActivatorIsLocal(ACSVM::Thread *thread)
return false;
}
#endif
/*--------------------------------------------------
static UINT32 ACS_SectorThingCounter(sector_t *sec, mtag_t thingTag, bool (*filter)(mobj_t *))
@ -2184,6 +2181,14 @@ bool CallFunc_MusicPlay(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::W
{
ACSVM::MapScope *map = thread->scopeMap;
// 0: str tune - id for the tune to play
// 1: [bool foractivator] - only do this if the activator is a player and is being viewed
if (argC > 1 && argV[1] && !ACS_ActivatorIsLocal(thread))
{
return false;
}
Music_Play(map->getString(argV[0])->str);
return false;
@ -2196,6 +2201,13 @@ bool CallFunc_MusicPlay(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::W
--------------------------------------------------*/
bool CallFunc_MusicStopAll(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::Word argC)
{
// 0: [bool foractivator] - only do this if the activator is a player and is being viewed
if (argC > 0 && argV[0] && !ACS_ActivatorIsLocal(thread))
{
return false;
}
Music_StopAll();
return false;
@ -2210,6 +2222,15 @@ bool CallFunc_MusicRemap(ACSVM::Thread *thread, const ACSVM::Word *argV, ACSVM::
{
ACSVM::MapScope *map = thread->scopeMap;
// 0: str tune - id for the tune to play
// 1: str song - lump name for the song to map to
// 2: [bool foractivator] - only do this if the activator is a player and is being viewed
if (argC > 2 && argV[2] && !ACS_ActivatorIsLocal(thread))
{
return false;
}
Music_Remap(map->getString(argV[0])->str, map->getString(argV[1])->str);
return false;