Merge branch 'master' of github.com:GTAmodding/re3

This commit is contained in:
aap 2020-11-19 15:21:22 +01:00
commit 856e424c76
4 changed files with 50 additions and 1 deletions

View File

@ -262,6 +262,7 @@ enum Config {
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better. #define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
// #define BETA_SLIDING_TEXT // #define BETA_SLIDING_TEXT
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC #define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
// #define XBOX_SUBTITLES // the infamous outlines
#define PC_MENU #define PC_MENU
#ifndef PC_MENU #ifndef PC_MENU

View File

@ -942,6 +942,40 @@ CFont::PrintString(float x, float y, wchar *start, wchar *end, float spwidth)
} }
#endif #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 float
CFont::GetCharacterWidth(wchar c) CFont::GetCharacterWidth(wchar c)
{ {

View File

@ -116,6 +116,10 @@ public:
static void InitPerFrame(void); static void InitPerFrame(void);
static void PrintChar(float x, float y, wchar c); static void PrintChar(float x, float y, wchar c);
static void PrintString(float x, float y, wchar *s); 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 int GetNumberLines(float xstart, float ystart, wchar *s);
static void GetTextRect(CRect *rect, float xstart, float ystart, wchar *s); static void GetTextRect(CRect *rect, float xstart, float ystart, wchar *s);
#ifdef MORE_LANGUAGES #ifdef MORE_LANGUAGES

View File

@ -926,11 +926,20 @@ void CHud::Draw()
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128)); 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::SetCentreOn();
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK)); 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 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; float rectWidth = SCREEN_WIDTH - SCREEN_SCALE_X(50.0f) - SCREEN_SCALE_X(8.0f) - radarBulge;
CFont::SetCentreSize(rectWidth); 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 // 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::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); CFont::SetDropShadowPosition(0);
#endif
} }
/* /*