mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- added ability to specify display duration of subtitles
Duration of sound playback and subtitles display will be synchronized if sound id is specified For existing Strife messages this works out of the box https://forum.zdoom.org/viewtopic.php?t=65379
This commit is contained in:
parent
4964c840e5
commit
222dfd17b7
7 changed files with 10 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue