From b7bbfd4efdb7c0b76c375e820aed61e656c28f0e Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Tue, 9 Mar 2021 14:08:31 +0800 Subject: [PATCH] Add SetSubtitleNumber(int num, str sound) ACS function. Works exactly like its ZScript counterpart. The activator of the script must be a player. --- src/playsim/p_acs.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index e2bdf3b85..127707906 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -4779,6 +4779,7 @@ enum EACSFunctions ACSF_StartSlideshow, ACSF_GetSectorHealth, ACSF_GetLineHealth, + ACSF_SetSubtitleNumber, // Eternity's ACSF_GetLineX = 300, @@ -6697,6 +6698,27 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) } return DoubleToACS(result); } + + case ACSF_SetSubtitleNumber: + if (argCount >= 2) + { + // only players allowed as activator + if (activator != nullptr && activator->player != nullptr) + { + int logNum = args[0]; + FSoundID sid = 0; + + const char* lookup = Level->Behaviors.LookupString(args[1]); + if (lookup != nullptr) + { + sid = lookup; + } + + activator->player->SetSubtitle(logNum, sid); + } + } + break; + default: break; }