From 235c4c0499442e64c39a1e1a8d7d79e76b27b936 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 2 Feb 2019 16:56:58 +0100 Subject: [PATCH] - allow localization of Strife's log text. --- src/g_statusbar/sbarinfo_commands.cpp | 2 +- src/g_statusbar/shared_sbar.cpp | 3 ++- src/p_user.cpp | 3 ++- wadsrc/static/zscript/statusbar/strife_sbar.txt | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/g_statusbar/sbarinfo_commands.cpp b/src/g_statusbar/sbarinfo_commands.cpp index cc0c8a5cf..ac66ddf94 100644 --- a/src/g_statusbar/sbarinfo_commands.cpp +++ b/src/g_statusbar/sbarinfo_commands.cpp @@ -923,7 +923,7 @@ class CommandDrawString : public SBarInfoCommand break; } case LOGTEXT: - str = statusBar->CPlayer->LogText; + str = GStrings(statusBar->CPlayer->LogText); break; default: break; diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index f9ccf7978..76c8ec20a 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -55,6 +55,7 @@ #include "vm.h" #include "p_acs.h" #include "sbarinfo.h" +#include "gstrings.h" #include "events.h" #include "../version.h" @@ -1064,7 +1065,7 @@ void DBaseStatusBar::DrawLog () hudheight = SCREENHEIGHT / scale; int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560; - auto lines = V_BreakLines (SmallFont, linelen, CPlayer->LogText); + auto lines = V_BreakLines (SmallFont, linelen, GStrings(CPlayer->LogText)); int height = 20; for (unsigned i = 0; i < lines.Size(); i++) height += SmallFont->GetHeight () + 1; diff --git a/src/p_user.cpp b/src/p_user.cpp index 55f643783..d1e20266d 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -89,6 +89,7 @@ #include "actorinlines.h" #include "p_acs.h" #include "events.h" +#include "gstrings.h" static FRandom pr_skullpop ("SkullPop"); @@ -441,7 +442,7 @@ void player_t::SetLogText (const char *text) { // Print log text to console AddToConsole(-1, TEXTCOLOR_GOLD); - AddToConsole(-1, LogText); + AddToConsole(-1, GStrings(LogText)); AddToConsole(-1, "\n"); } } diff --git a/wadsrc/static/zscript/statusbar/strife_sbar.txt b/wadsrc/static/zscript/statusbar/strife_sbar.txt index 866c4a32a..e10e9f2ab 100644 --- a/wadsrc/static/zscript/statusbar/strife_sbar.txt +++ b/wadsrc/static/zscript/statusbar/strife_sbar.txt @@ -432,7 +432,8 @@ class StrifeStatusBar : BaseStatusBar if (CPlayer.LogText.Length() > 0) { - BrokenLines lines = SmallFont2.BreakLines(CPlayer.LogText, 272); + let text = Stringtable.Localize(CPlayer.LogText); + BrokenLines lines = SmallFont2.BreakLines(text, 272); for (i = 0; i < lines.Count(); ++i) { screen.DrawText(SmallFont2, Font.CR_UNTRANSLATED, left + 24 * xscale, top + (18 + i * 12)*yscale,