mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- implemented subtitle display for Blackbird's voiceover messages.
This commit is contained in:
parent
270f8fb381
commit
04334aa0fe
8 changed files with 41 additions and 5 deletions
|
@ -289,6 +289,7 @@ public:
|
|||
void SetLogNumber (int num);
|
||||
void SetLogText (const char *text);
|
||||
void SendPitchLimits() const;
|
||||
void SetSubtitle(int num);
|
||||
|
||||
AActor *mo = nullptr;
|
||||
uint8_t playerstate = 0;
|
||||
|
@ -387,6 +388,8 @@ public:
|
|||
float BlendA = 0;
|
||||
|
||||
FString LogText; // [RH] Log for Strife
|
||||
FString SubtitleText;
|
||||
int SubtitleCounter;
|
||||
|
||||
DAngle MinPitch = 0.; // Viewpitch limits (negative is up, positive is down)
|
||||
DAngle MaxPitch = 0.;
|
||||
|
|
|
@ -84,6 +84,7 @@ EXTERN_CVAR (Bool, am_showtotaltime)
|
|||
EXTERN_CVAR (Bool, noisedebug)
|
||||
EXTERN_CVAR (Int, con_scaletext)
|
||||
EXTERN_CVAR(Bool, vid_fps)
|
||||
EXTERN_CVAR(Bool, inter_subtitles)
|
||||
CVAR(Int, hud_scale, 0, CVAR_ARCHIVE);
|
||||
|
||||
|
||||
|
@ -1216,7 +1217,8 @@ void DBaseStatusBar::DrawLog ()
|
|||
FFont *font = C_GetDefaultHUDFont();
|
||||
|
||||
int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560;
|
||||
auto lines = V_BreakLines (font, linelen, CPlayer->LogText[0] == '$'? GStrings(CPlayer->LogText.GetChars()+1) : CPlayer->LogText.GetChars());
|
||||
const FString & text = (inter_subtitles && CPlayer->SubtitleCounter) ? CPlayer->SubtitleText : CPlayer->LogText;
|
||||
auto lines = V_BreakLines (font, linelen, text[0] == '$'? GStrings(text.GetChars()+1) : text.GetChars());
|
||||
int height = 20;
|
||||
|
||||
for (unsigned i = 0; i < lines.Size(); i++) height += font->GetHeight ();
|
||||
|
@ -1232,7 +1234,7 @@ void DBaseStatusBar::DrawLog ()
|
|||
else
|
||||
{
|
||||
x=(hudwidth>>1)-300;
|
||||
y=hudheight*3/10-(height>>1);
|
||||
y=hudheight/8-(height>>1);
|
||||
if (y<0) y=0;
|
||||
w=600;
|
||||
}
|
||||
|
@ -1242,7 +1244,7 @@ void DBaseStatusBar::DrawLog ()
|
|||
y+=10;
|
||||
for (const FBrokenLines &line : lines)
|
||||
{
|
||||
screen->DrawText (font, CR_UNTRANSLATED, x, y, line.Text,
|
||||
screen->DrawText (font, CPlayer->SubtitleCounter? CR_CYAN : CR_UNTRANSLATED, x, y, line.Text,
|
||||
DTA_KeepRatio, true,
|
||||
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
|
||||
y += font->GetHeight ();
|
||||
|
@ -1321,7 +1323,7 @@ void DBaseStatusBar::DrawTopStuff (EHudState state)
|
|||
|
||||
DrawConsistancy ();
|
||||
DrawWaiting ();
|
||||
if (ShowLog && MustDrawLog(state)) DrawLog ();
|
||||
if ((ShowLog && MustDrawLog(state)) || (inter_subtitles && CPlayer->SubtitleCounter > 0)) DrawLog ();
|
||||
|
||||
if (noisedebug)
|
||||
{
|
||||
|
|
|
@ -3196,6 +3196,7 @@ FUNC(LS_SendToCommunicator)
|
|||
if (it->CheckLocalView())
|
||||
{
|
||||
S_StopSound (CHAN_VOICE);
|
||||
it->player->SetSubtitle(arg0);
|
||||
S_Sound (CHAN_VOICE, name, 1, ATTN_NORM);
|
||||
|
||||
// Get the message from the LANGUAGE lump.
|
||||
|
|
|
@ -421,7 +421,7 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, SetLogNumber)
|
|||
|
||||
void player_t::SetLogText (const char *text)
|
||||
{
|
||||
LogText = text;
|
||||
LogText = text;
|
||||
|
||||
if (mo && mo->CheckLocalView())
|
||||
{
|
||||
|
@ -438,6 +438,30 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, SetLogText)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void player_t::SetSubtitle(int num)
|
||||
{
|
||||
char lumpname[36];
|
||||
|
||||
// Do we have a subtitle for this log entry's voice file?
|
||||
mysnprintf(lumpname, countof(lumpname), "$TXT_SUB_LOG%d", num);
|
||||
auto text = GStrings.GetLanguageString(lumpname+1, FStringTable::default_table);
|
||||
if (text != nullptr)
|
||||
{
|
||||
SubtitleText = lumpname;
|
||||
SubtitleCounter = 7 * TICRATE;
|
||||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_PlayerInfo, SetSubtitleNumber)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(player_t);
|
||||
PARAM_INT(log);
|
||||
self->SetSubtitle(log);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int player_t::GetSpawnClass()
|
||||
{
|
||||
const PClass * type = PlayerClasses[CurrentPlayerClass].Type;
|
||||
|
@ -1633,6 +1657,8 @@ void player_t::Serialize(FSerializer &arc)
|
|||
("blenda", BlendA)
|
||||
("weaponstate", WeaponState)
|
||||
("logtext", LogText)
|
||||
("subtitletext", SubtitleText)
|
||||
("subtitlecounter", SubtitleCounter)
|
||||
("conversionnpc", ConversationNPC)
|
||||
("conversionpc", ConversationPC)
|
||||
("conversionnpcangle", ConversationNPCAngle)
|
||||
|
|
|
@ -2693,6 +2693,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 bool Resurrect();
|
||||
|
||||
native String GetUserName() const;
|
||||
|
|
|
@ -102,6 +102,7 @@ class Acolyte : StrifeHumanoid
|
|||
{
|
||||
players[i].mo.GiveInventoryType ("QuestItem7");
|
||||
players[i].SetLogNumber (14);
|
||||
players[i].SetSubtitleNumber (14);
|
||||
A_StopSound (CHAN_VOICE);
|
||||
A_PlaySound ("svox/voc14", CHAN_VOICE, 1, false, ATTN_NONE);
|
||||
}
|
||||
|
|
|
@ -181,6 +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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1865,6 +1865,7 @@ class PowerCoupling : Actor
|
|||
players[i].mo.GiveInventoryType ("QuestItem6");
|
||||
S_Sound ("svox/voc13", CHAN_VOICE);
|
||||
players[i].SetLogNumber (13);
|
||||
players[i].SetSubtitleNumber (13);
|
||||
A_DropItem ("BrokenPowerCoupling", -1, 256);
|
||||
Destroy ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue