Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gennariarmando committed Jan 10, 2022
1 parent 345521d commit e76265e
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 21 deletions.
14 changes: 7 additions & 7 deletions resources/VHud/data/hud.dat
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ HUD_RADAR_FOREGROUND 89.0 264.0 373.0 52.8 HUD_COLOUR_WHITE
HUD_RADAR_BACKGROUND 96.0 72.0 366.0 54.5 HUD_COLOUR_BLACK 150
HUD_RADAR_BACKGROUND_P2 96.0 261.0 366.0 243.5 HUD_COLOUR_BLACK 150

HUD_RADAR_BLIPS_SIZE 0.0 0.0 11.0 11.0 HUD_COLOUR_WHITE 255
HUD_RADAR_BLIPS_LEVEL_SIZE 0.0 0.0 7.0 7.0 HUD_COLOUR_WHITE 255
HUD_RADAR_BLIPS_SIZE 0.0 0.0 12.0 12.0 HUD_COLOUR_WHITE 255
HUD_RADAR_BLIPS_LEVEL_SIZE 0.0 0.0 8.0 8.0 HUD_COLOUR_WHITE 255
HUD_RADAR_BLIPS_COP_SIZE 0.0 0.0 8.0 8.0 HUD_COLOUR_WHITE 255
HUD_RADAR_BLIPS_COP_HELI_SIZE 0.0 0.0 13.5 13.5 HUD_COLOUR_WHITE 255
HUD_RADAR_BLIPS_BORDER_SIZE 0.0 0.0 24.0 12.0 HUD_COLOUR_WHITE 255
Expand All @@ -39,7 +39,7 @@ HUD_RADAR_GPS_RECT 96.0 94.0 366.0 72.0 HUD_COLOUR_BLACK
HUD_RADAR_GPS_DIST_TEXT 129.0 103.0 0.61 1.3 HUD_COLOUR_WHITE 200
HUD_RADAR_GPS_DIST_ARROW 116.0 88.0 15.0 15.0 HUD_COLOUR_WHITE 200

HUD_SUBTITLES 0.0 91.0 0.94 1.90 HUD_COLOUR_WHITE 255
HUD_SUBTITLES 0.0 91.0 0.92 1.88 HUD_COLOUR_WHITE 255
HUD_WANTED_STARS 96.0 54.0 32.0 33.0 HUD_COLOUR_WHITE 255
HUD_CASH 96.0 54.0 1.02 2.1 HUD_COLOUR_WHITE 255
HUD_AMMO 96.0 54.0 0.86 1.80 HUD_COLOUR_WHITE 255
Expand All @@ -49,9 +49,9 @@ HUD_WEAPON_WHEEL 0.0 -92.0 0.0 0.0 HUD_COLOUR_WHITE
HUD_WEAPON_STATS_BOX 284.0 48.0 188.0 184.0 HUD_COLOUR_BLACK 150
HUD_WEAPON_STATS_BAR 12.0 36.0 164.0 10.0 HUD_COLOUR_WHITE 255

HUD_VEHICLE_NAME 106.0 163.0 1.02 2.1 HUD_COLOUR_WHITE 255
HUD_ZONE_NAME 106.0 125.0 1.02 2.1 HUD_COLOUR_WHITE 255
HUD_LEVEL_NAME 106.0 89.0 1.02 2.1 HUD_COLOUR_WHITE 255
HUD_VEHICLE_NAME 106.0 163.0 1.1 2.3 HUD_COLOUR_WHITE 255
HUD_ZONE_NAME 106.0 125.0 1.1 2.3 HUD_COLOUR_WHITE 255
HUD_LEVEL_NAME 106.0 89.0 1.1 2.3 HUD_COLOUR_WHITE 255

HUD_HELP_BOX_TEXT 96.0 54.0 0.70 1.38 HUD_COLOUR_WHITE 255
HUD_HELP_BOX_BORDER 12.0 6.0 12.0 12.0 HUD_COLOUR_BLACK 180
Expand All @@ -70,7 +70,7 @@ HUD_BUSTED_TEXT 0.0 -78.0 3.4 6.6 HUD_COLOUR_BLUE

HUD_BIG_MESSAGE 0.0 -78.0 2.8 6.0 HUD_COLOUR_WHITE 150

HUD_MISSION_TITLE 106.0 88.0 1.02 2.1 HUD_COLOUR_WHITE 255
HUD_MISSION_TITLE 106.0 88.0 1.1 2.3 HUD_COLOUR_WHITE 255

HUD_MISSION_TIMERS 96.0 54.0 378.0 39.0 HUD_COLOUR_WHITE 180

Expand Down
11 changes: 8 additions & 3 deletions source/FontNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ void CFontNew::Init() {


m_pSprite = new CD3DSprite();
m_pSprite->AddRef();

char* path = "VHud\\buttons\\xbox";
for (int i = 0; i < NUM_BUTTONS; i++) {
Expand Down Expand Up @@ -384,6 +383,7 @@ void CFontNew::SetTokenToIgnore(char t1, char t2) {
}

int CFontNew::PrintString(float x, float y, const char* s) {
int n = 0;
if (*s != '*') {
if (Details.background) {
CRect rect;
Expand All @@ -395,8 +395,12 @@ int CFontNew::PrintString(float x, float y, const char* s) {
else
CSprite2d::DrawRect(rect, Details.backgroundColor);
}
return GetNumberLines(true, x, y, s);
m_pSprite->AddRef();
n = GetNumberLines(true, x, y, s);
m_pSprite->Flush();
}

return n;
}

int CFontNew::GetNumberLines(bool print, float xstart, float ystart, const char* s) {
Expand Down Expand Up @@ -908,7 +912,8 @@ float CFontNew::PrintChar(float& x, float y, char c) {

float CFontNew::DrawChar(bool print, bool calc, float x, float y, char c, int style, CRGBA const& col) {
float characterSize = 0.0f;
char s[2]{ c };
static char s[2];
s[0] = c;

if (c != '~') {
//x += SCREEN_WIDTH * 0.002f;
Expand Down
4 changes: 2 additions & 2 deletions source/GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ void CGPS::DrawDistanceFromWaypoint() {
CFontNew::SetFontStyle(CFontNew::FONT_4);
CFontNew::SetAlignment(CFontNew::ALIGN_LEFT);
CFontNew::SetColor(GET_SETTING(HUD_RADAR_GPS_DIST_TEXT).col);
CFontNew::SetOutline(false);
CFontNew::SetOutline(0.0f);
CFontNew::SetDropColor(CRGBA(0, 0, 0, 255));
CFontNew::SetDropShadow(SCREEN_COORD(0.6f));
CFontNew::SetDropShadow(SCREEN_COORD(1.0f));
w = GET_SETTING(HUD_RADAR_GPS_DIST_TEXT).w;
h = GET_SETTING(HUD_RADAR_GPS_DIST_TEXT).h;
CFontNew::SetScale(SCREEN_MULTIPLIER(w), SCREEN_MULTIPLIER(h));
Expand Down
16 changes: 9 additions & 7 deletions source/HudNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ int CHudNew::m_nPreviousMoney;
int CHudNew::m_nDiffMoney;
int CHudNew::nTargettedEntityDeathTime;

bool CHudNew::m_bShowMissionText;
char CHudNew::m_LastMissionName[128];
bool CHudNew::m_bShowWastedBusted;
bool CHudNew::m_bShowSuccessFailed;
Expand Down Expand Up @@ -212,6 +213,8 @@ void CHudNew::ReInit() {
m_bShowWastedBusted = false;
m_bShowSuccessFailed = false;

m_bShowMissionText = false;

for (int i = 0; i < 4; i++) {
previousModelIndex[i] = MODEL_NULL;
}
Expand Down Expand Up @@ -351,7 +354,7 @@ void CHudNew::Draw() {
}

if (!CHud::bDrawingVitalStats && !CellPhone.bActive) {
if (!CUserDisplay::OnscnTimer.m_bDisplay) {
if (!CUserDisplay::OnscnTimer.m_bDisplay && !m_bShowMissionText) {
if (!CHud::bScriptDontDisplayVehicleName)
DrawVehicleName();

Expand Down Expand Up @@ -1765,7 +1768,7 @@ void CHudNew::DrawSuccessFailedMessage() {
CFontNew::SetFontStyle(CFontNew::FONT_1);
CFontNew::SetDropColor(CRGBA(0, 0, 0, 255));
CFontNew::SetColor(HudColourNew.GetRGB(HUD_COLOUR_WHITE, 255));
CFontNew::SetScale(SCREEN_MULTIPLIER(0.96f), SCREEN_MULTIPLIER(1.8f));
CFontNew::SetScale(SCREEN_MULTIPLIER(0.9f), SCREEN_MULTIPLIER(1.6f));
CFontNew::PrintString(SCREEN_COORD_CENTER_LEFT(GET_SETTING(HUD_BIG_MESSAGE).x), SCREEN_COORD_CENTER_DOWN(offset + GET_SETTING(HUD_BIG_MESSAGE).y + 114.0f), bottomText);
}

Expand Down Expand Up @@ -2007,28 +2010,27 @@ void CHudNew::DrawWastedBustedText() {
}

void CHudNew::DrawMissionTitle() {
static bool showText = false;
static float alpha = 0.0f;
static int time = -1;

if (CHud::m_BigMessage[1][0]) {
if (!showText) {
if (!m_bShowMissionText) {
strcpy(m_LastMissionName, CHud::m_BigMessage[1]);

if (time == -1)
time = CTimer::m_snTimeInMilliseconds + 4000;

CHud::m_BigMessage[1][0] = NULL;
showText = true;
m_bShowMissionText = true;
}
}

if (showText) {
if (m_bShowMissionText) {
if (time < CTimer::m_snTimeInMilliseconds) {
alpha -= CTimer::ms_fTimeStep * 0.02f * 255.0f;

if (alpha <= 0.0f)
showText = false;
m_bShowMissionText = false;
}
else {
alpha += CTimer::ms_fTimeStep * 0.02f * 255.0f;
Expand Down
1 change: 1 addition & 0 deletions source/HudNew.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class CHudNew : CHud {

static int nTargettedEntityDeathTime;

static bool m_bShowMissionText;
static char m_LastMissionName[128];

static bool m_bShowWastedBusted;
Expand Down
20 changes: 18 additions & 2 deletions source/PadNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
using namespace plugin;
using namespace pugi;

bool CPadNew::bInitialised;

IGInputPad* GInputPad[2] = { NULL, NULL };
GINPUT_PAD_SETTINGS GInputPadSettings[2];
bool GINPUT = false;
Expand Down Expand Up @@ -171,9 +173,22 @@ CPadNew::CPadNew() {
}

void CPadNew::Init() {
if (bInitialised)
return;

for (int i = 0; i < NUM_CONTROL_ACTIONS; i++) {
Copy(&DefaultControls[i], &Controls[i]);
}

bInitialised = true;
}

void CPadNew::Shutdown() {
if (!bInitialised)
return;


bInitialised = false;
}

void CPadNew::SaveSettings() {
Expand Down Expand Up @@ -257,12 +272,13 @@ const char* CPadNew::KeyToString(int key) {
}
else {
char c = (char)key;
static char s[2];
s[0] = c;

if (c == ' ')
return "SPACEBAR";

char buff[2]{ c };
return buff;
return s;
}
}

Expand Down
4 changes: 4 additions & 0 deletions source/PadNew.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ class CPadNew : public CPad {
int Id;
bool DisablePlayerAim;

public:
static bool bInitialised;

public:
CPadNew();
static void Init();
static void Shutdown();
static void SaveSettings();
static void LoadSettings();
static void Copy(CControls* dst, const CControls* src);
Expand Down
1 change: 1 addition & 0 deletions source/VHud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ VHud::VHud() {
CMenuPanels::Shutdown();
Audio.Shutdown();
MarkersNew.Shutdown();
CPadNew::Shutdown();

rwQuit = true;
};
Expand Down

0 comments on commit e76265e

Please sign in to comment.