summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/config.h1
-rw-r--r--src/render/Font.cpp34
-rw-r--r--src/render/Font.h4
-rw-r--r--src/render/Hud.cpp12
4 files changed, 50 insertions, 1 deletions
diff --git a/src/core/config.h b/src/core/config.h
index 3da9bcb1..db6e5490 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -262,6 +262,7 @@ enum Config {
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
// #define BETA_SLIDING_TEXT
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
+// #define XBOX_SUBTITLES // the infamous outlines
#define PC_MENU
#ifndef PC_MENU
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index fbcc38e4..42ddd0fb 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -942,6 +942,40 @@ CFont::PrintString(float x, float y, wchar *start, wchar *end, float spwidth)
}
#endif
+#ifdef XBOX_SUBTITLES
+void
+CFont::PrintStringFromBottom(float x, float y, wchar *str)
+{
+#ifdef MORE_LANGUAGES
+ if (IsJapaneseFont())
+ y -= (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * GetNumberLines(x, y, str);
+ else
+#endif
+ y -= (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * GetNumberLines(x, y, str);
+ PrintString(x, y, str);
+}
+
+void
+CFont::PrintOutlinedString(float x, float y, wchar *str, float outlineStrength, bool fromBottom, CRGBA outlineColor)
+{
+ CRGBA textColor = Details.color;
+ SetColor(outlineColor);
+ CVector2D offsets[] = { {1.f, 1.f}, {1.f, -1.f}, {-1.f, 1.f}, {-1.f, -1.f} };
+ for(int i = 0; i < ARRAY_SIZE(offsets); i++){
+ if (fromBottom)
+ PrintStringFromBottom(x + SCREEN_SCALE_X(offsets[i].x * outlineStrength), y + SCREEN_SCALE_Y(offsets[i].y * outlineStrength), str);
+ else
+ PrintString(x + SCREEN_SCALE_X(offsets[i].x * outlineStrength), y + SCREEN_SCALE_Y(offsets[i].y * outlineStrength), str);
+ }
+ SetColor(textColor);
+
+ if (fromBottom)
+ PrintStringFromBottom(x, y, str);
+ else
+ PrintString(x, y, str);
+}
+#endif
+
float
CFont::GetCharacterWidth(wchar c)
{
diff --git a/src/render/Font.h b/src/render/Font.h
index bf747859..7b67e310 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -116,6 +116,10 @@ public:
static void InitPerFrame(void);
static void PrintChar(float x, float y, wchar c);
static void PrintString(float x, float y, wchar *s);
+#ifdef XBOX_SUBTITLES
+ static void PrintStringFromBottom(float x, float y, wchar *str);
+ static void PrintOutlinedString(float x, float y, wchar *str, float outlineStrength, bool fromBottom, CRGBA outlineColor);
+#endif
static int GetNumberLines(float xstart, float ystart, wchar *s);
static void GetTextRect(CRect *rect, float xstart, float ystart, wchar *s);
#ifdef MORE_LANGUAGES
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index de3128ce..1a39e1c7 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -926,11 +926,20 @@ void CHud::Draw()
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128));
- CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.120f));
+ CFont::SetScale(SCREEN_SCALE_X(0.48f), SCREEN_SCALE_Y(1.12f));
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
+#ifdef XBOX_SUBTITLES
+ float radarBulge = SCREEN_SCALE_X(45.0f) + SCREEN_SCALE_X(16.0f);
+ float rectWidth = SCREEN_WIDTH - SCREEN_SCALE_X(45.0f) - SCREEN_SCALE_X(16.0f) - radarBulge;
+ CFont::SetCentreSize(rectWidth);
+ CFont::SetColor(CRGBA(180, 180, 180, 255));
+
+ CFont::PrintOutlinedString(rectWidth / 2.0f + radarBulge, SCREEN_SCALE_Y(4.0f) + SCREEN_SCALE_FROM_BOTTOM(48.0f) - SCREEN_SCALE_Y(1), m_Message,
+ 2.0f, true, CRGBA(0, 0, 0, 255));
+#else
float radarBulge = SCREEN_SCALE_X(40.0f) + SCREEN_SCALE_X(8.0f);
float rectWidth = SCREEN_WIDTH - SCREEN_SCALE_X(50.0f) - SCREEN_SCALE_X(8.0f) - radarBulge;
CFont::SetCentreSize(rectWidth);
@@ -943,6 +952,7 @@ void CHud::Draw()
// I'm not sure shadow substaction was intentional here, might be a leftover if CFont::PrintString was used for a shadow draw call
CFont::PrintString(rectWidth / 2.0f + radarBulge - SCREEN_SCALE_X(shadow), SCREEN_SCALE_Y(4.0f) + SCREEN_SCALE_FROM_BOTTOM(68.0f) - SCREEN_SCALE_Y(shadow), m_Message);
CFont::SetDropShadowPosition(0);
+#endif
}
/*