summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Font.h24
-rw-r--r--src/render/Hud.cpp43
-rw-r--r--src/render/Hud.h6
3 files changed, 52 insertions, 21 deletions
diff --git a/src/render/Font.h b/src/render/Font.h
index 2e698533..11c0f8ec 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -33,6 +33,12 @@ enum {
FONT_HEADING,
};
+enum {
+ ALIGN_LEFT,
+ ALIGN_CENTER,
+ ALIGN_RIGHT,
+};
+
class CFont
{
static CFontDetails &Details;
@@ -56,6 +62,7 @@ public:
static void DrawFonts(void);
static uint16 character_code(uint8 c);
+ static CFontDetails GetDetails() { return Details; }
static void SetScale(float x, float y) { Details.scaleX = x; Details.scaleY = y; }
static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; }
static void SetSlant(float s) { Details.slant = s; }
@@ -86,6 +93,23 @@ public:
static void SetCentreOff(void) {
Details.centre = false;
}
+ static void SetAlignment(uint8 alignment) {
+ if (alignment == ALIGN_LEFT) {
+ CFont::Details.justify = true;
+ CFont::Details.centre = false;
+ CFont::Details.rightJustify = false;
+ }
+ else if (alignment == ALIGN_CENTER) {
+ CFont::Details.justify = false;
+ CFont::Details.centre = true;
+ CFont::Details.rightJustify = false;
+ }
+ else if (alignment == ALIGN_RIGHT) {
+ CFont::Details.justify = false;
+ CFont::Details.centre = false;
+ CFont::Details.rightJustify = true;
+ }
+ }
static void SetWrapx(float x) { Details.wrapX = x; }
static void SetCentreSize(float s) { Details.centreSize = s; }
static void SetBackgroundOn(void) { Details.background = true; }
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index a17d5c2c..9243bc3a 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -53,9 +53,9 @@ wchar *CHud::m_PagerMessage = (wchar*)0x878840;
bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89;
bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62;
wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0;
-float *CHud::BigMessageInUse = (float*)0x862140;
-float *CHud::BigMessageAlpha = (float*)0x862108;
-float *CHud::BigMessageX = (float*)0x773248;
+float CHud::BigMessageInUse[6];
+float CHud::BigMessageAlpha[6];
+float CHud::BigMessageX[6];
float &CHud::OddJob2OffTimer = *(float*)0x942FA0;
int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67;
@@ -231,8 +231,8 @@ void CHud::Draw()
CRect rect;
float fWidescreenOffset[2] = { 0.0f, 0.0f };
-
- if (CMenuManager::m_PrefsUseWideScreen) {
+
+ if (FrontEndMenuManager.m_PrefsUseWideScreen) {
fWidescreenOffset[0] = 0.0f;
fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f);
}
@@ -362,25 +362,32 @@ void CHud::Draw()
/*
DrawAmmo
*/
+ int16 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition;
int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip;
int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
+ int32 Ammo, Clip;
- if (AmmoInClip <= 1 || AmmoInClip >= 1000) {
+ if (AmmoAmount <= 1 || AmmoAmount >= 1000)
sprintf(sTemp, "%d", TotalAmmo);
- }
else {
if (WeaponType == WEAPONTYPE_FLAMETHROWER) {
- int tot_min_clip_div_10 = (TotalAmmo - AmmoInClip) / 10;
- if (tot_min_clip_div_10 > 9999)
- tot_min_clip_div_10 = 9999;
+ Clip = AmmoInClip / 10;
- sprintf(sTemp, "%d-%d", tot_min_clip_div_10, AmmoInClip / 10);
+ if ((TotalAmmo - AmmoInClip) / 10 <= 9999)
+ Ammo = (TotalAmmo - AmmoInClip) / 10;
+ else
+ Ammo = 9999;
}
else {
- if (AmmoInClip > 9999)
- AmmoInClip = 9999;
- sprintf(sTemp, "%d-%d", (TotalAmmo - AmmoInClip), AmmoInClip);
+ Clip = AmmoInClip;
+
+ if (TotalAmmo - AmmoInClip > 9999)
+ Ammo = 9999;
+ else
+ Ammo = TotalAmmo - AmmoInClip;
}
+
+ sprintf(sTemp, "%d-%d", Ammo, Clip);
}
AsciiToUnicode(sTemp, sPrint);
@@ -580,7 +587,7 @@ void CHud::Draw()
CFont::SetPropOn();
CFont::SetBackgroundOff();
- if (CMenuManager::m_PrefsLanguage == 4)
+ if (FrontEndMenuManager.m_PrefsLanguage == 4)
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f));
else
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
@@ -676,7 +683,7 @@ void CHud::Draw()
CFont::SetPropOn();
CFont::SetBackgroundOff();
- if (CMenuManager::m_PrefsLanguage != 3 && CMenuManager::m_PrefsLanguage != 4)
+ if (FrontEndMenuManager.m_PrefsLanguage != 3 && FrontEndMenuManager.m_PrefsLanguage != 4)
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
else
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f));
@@ -976,7 +983,7 @@ void CHud::Draw()
DrawBigMessage
*/
// MissionCompleteFailedText
- if (CHud::m_BigMessage[0][0]) {
+ if (m_BigMessage[0][0]) {
if (BigMessageInUse[0] != 0.0f) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
@@ -1251,7 +1258,7 @@ void CHud::DrawAfterFade()
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
- if (CGame::frenchGame || CMenuManager::m_PrefsLanguage == 4)
+ if (CGame::frenchGame || FrontEndMenuManager.m_PrefsLanguage == 4)
CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f));
else
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));
diff --git a/src/render/Hud.h b/src/render/Hud.h
index 8f4b6fb6..260e5312 100644
--- a/src/render/Hud.h
+++ b/src/render/Hud.h
@@ -62,9 +62,9 @@ public:
static bool &m_Wants_To_Draw_Hud;
static bool &m_Wants_To_Draw_3dMarkers;
static wchar(*m_BigMessage)[128];
- static float *BigMessageInUse;
- static float *BigMessageAlpha;
- static float *BigMessageX;
+ static float BigMessageInUse[6];
+ static float BigMessageAlpha[6];
+ static float BigMessageX[6];
static float &OddJob2OffTimer;
static int8 &CounterOnLastFrame;
static float &OddJob2XOffset;