diff --git a/src/playsim/d_player.h b/src/playsim/d_player.h index f701d89f9..3bd6431aa 100644 --- a/src/playsim/d_player.h +++ b/src/playsim/d_player.h @@ -289,7 +289,7 @@ public: void SetLogNumber (int num); void SetLogText (const char *text); void SendPitchLimits() const; - void SetSubtitle(int num); + void SetSubtitle(int num, FSoundID soundid); AActor *mo = nullptr; uint8_t playerstate = 0; diff --git a/src/playsim/p_lnspec.cpp b/src/playsim/p_lnspec.cpp index 623095b1f..33b8d4b9e 100644 --- a/src/playsim/p_lnspec.cpp +++ b/src/playsim/p_lnspec.cpp @@ -3196,7 +3196,7 @@ FUNC(LS_SendToCommunicator) if (it->CheckLocalView()) { S_StopSound (CHAN_VOICE); - it->player->SetSubtitle(arg0); + it->player->SetSubtitle(arg0, name); S_Sound (CHAN_VOICE, name, 1, ATTN_NORM); // Get the message from the LANGUAGE lump. diff --git a/src/playsim/p_user.cpp b/src/playsim/p_user.cpp index 031f88059..8834e423a 100644 --- a/src/playsim/p_user.cpp +++ b/src/playsim/p_user.cpp @@ -437,7 +437,7 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, SetLogText) return 0; } -void player_t::SetSubtitle(int num) +void player_t::SetSubtitle(int num, FSoundID soundid) { char lumpname[36]; @@ -449,7 +449,7 @@ void player_t::SetSubtitle(int num) if (text != nullptr) { SubtitleText = lumpname; - SubtitleCounter = 7 * TICRATE; + SubtitleCounter = soundid == 0 ? 7 * TICRATE : S_GetMSLength(soundid) * TICRATE / 1000; } } @@ -457,7 +457,8 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, SetSubtitleNumber) { PARAM_SELF_STRUCT_PROLOGUE(player_t); PARAM_INT(log); - self->SetSubtitle(log); + PARAM_SOUND(soundid); + self->SetSubtitle(log, soundid); return 0; } diff --git a/wadsrc/static/zscript/actors/player/player.zs b/wadsrc/static/zscript/actors/player/player.zs index 1fa785f6e..0036f922a 100644 --- a/wadsrc/static/zscript/actors/player/player.zs +++ b/wadsrc/static/zscript/actors/player/player.zs @@ -2692,7 +2692,7 @@ struct PlayerInfo native play // self is what internally is known as player_t native PSprite FindPSprite(int id) const; native void SetLogNumber (int text); native void SetLogText (String text); - native void SetSubtitleNumber (int text); + native void SetSubtitleNumber (int text, Sound sound_id = 0); native bool Resurrect(); native String GetUserName() const; diff --git a/wadsrc/static/zscript/actors/strife/acolyte.zs b/wadsrc/static/zscript/actors/strife/acolyte.zs index b2951a9b1..877a44304 100644 --- a/wadsrc/static/zscript/actors/strife/acolyte.zs +++ b/wadsrc/static/zscript/actors/strife/acolyte.zs @@ -102,7 +102,7 @@ class Acolyte : StrifeHumanoid { players[i].mo.GiveInventoryType ("QuestItem7"); players[i].SetLogNumber (14); - players[i].SetSubtitleNumber (14); + players[i].SetSubtitleNumber (14, "svox/voc14"); A_StopSound (CHAN_VOICE); A_PlaySound ("svox/voc14", CHAN_VOICE, 1, false, ATTN_NONE); } diff --git a/wadsrc/static/zscript/actors/strife/alienspectres.zs b/wadsrc/static/zscript/actors/strife/alienspectres.zs index 16b4668dc..160ca9529 100644 --- a/wadsrc/static/zscript/actors/strife/alienspectres.zs +++ b/wadsrc/static/zscript/actors/strife/alienspectres.zs @@ -181,7 +181,7 @@ class AlienSpectre1 : SpectralMonster String voc = "svox/voc" .. log; A_PlaySound(voc, CHAN_VOICE, 1, false, ATTN_NONE); player.player.SetLogNumber (log); - player.player.SetSubtitleNumber (log); + player.player.SetSubtitleNumber (log, voc); } } diff --git a/wadsrc/static/zscript/actors/strife/strifestuff.zs b/wadsrc/static/zscript/actors/strife/strifestuff.zs index 9c35145ab..e760bdbc1 100644 --- a/wadsrc/static/zscript/actors/strife/strifestuff.zs +++ b/wadsrc/static/zscript/actors/strife/strifestuff.zs @@ -1865,7 +1865,7 @@ class PowerCoupling : Actor players[i].mo.GiveInventoryType ("QuestItem6"); S_Sound ("svox/voc13", CHAN_VOICE); players[i].SetLogNumber (13); - players[i].SetSubtitleNumber (13); + players[i].SetSubtitleNumber (13, "svox/voc13"); A_DropItem ("BrokenPowerCoupling", -1, 256); Destroy (); }