CHud: timer and damage fixes

This commit is contained in:
Sergeanur 2019-10-06 15:45:53 +03:00
parent 90aa16b9b0
commit 5b49c972a0

View File

@ -272,19 +272,6 @@ void CHud::Draw()
CFont::SetColor(CRGBA(89, 115, 150, 255)); CFont::SetColor(CRGBA(89, 115, 150, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f), SCREEN_SCALE_Y(43.0f), sPrint);
/*
DrawClock
*/
sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes());
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f - 2.0f), SCREEN_SCALE_Y(22.0f + 2.0f), sPrint);
CFont::SetColor(CRGBA(194, 165, 120, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
/* /*
DrawAmmo DrawAmmo
*/ */
@ -519,19 +506,19 @@ void CHud::Draw()
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha)); CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f - 1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f - 1.0f), m_ZoneToPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f) + SCREEN_SCALE_Y(1.0f), m_ZoneToPrint);
CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha)); CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), m_ZoneToPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(30.0f), m_ZoneToPrint);
} }
} }
} }
else { /*else {
m_pLastZoneName = nil; m_pLastZoneName = nil;
m_ZoneState = 0; m_ZoneState = 0;
m_ZoneFadeTimer = 0; m_ZoneFadeTimer = 0;
m_ZoneNameTimer = 0; m_ZoneNameTimer = 0;
} }*/
/* /*
DrawVehicleName DrawVehicleName
@ -615,7 +602,7 @@ void CHud::Draw()
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha)); CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f - 1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f - 1.0f), m_pVehicleNameToPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f) + SCREEN_SCALE_X(1.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f) + SCREEN_SCALE_Y(1.0f), m_pVehicleNameToPrint);
CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha)); CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), m_pVehicleNameToPrint); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(32.0f), SCREEN_SCALE_FROM_BOTTOM(55.0f), m_pVehicleNameToPrint);
@ -629,27 +616,41 @@ void CHud::Draw()
m_VehicleNameTimer = 0; m_VehicleNameTimer = 0;
} }
/*
DrawClock
*/
CFont::SetJustifyOff();
CFont::SetCentreOff();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetBackGroundOnlyTextOff();
CFont::SetPropOff();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0);
sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes());
AsciiToUnicode(sTemp, sPrint);
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(22.0f) + SCREEN_SCALE_Y(2.0f), sPrint);
CFont::SetColor(CRGBA(194, 165, 120, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(111.0f), SCREEN_SCALE_Y(22.0f), sPrint);
/* /*
DrawOnScreenTimer DrawOnScreenTimer
*/ */
wchar sTimer[16]; wchar sTimer[16];
CFont::SetPropOn();
CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOn();
CFont::SetAlignment(ALIGN_RIGHT);
CFont::SetRightJustifyWrap(-SCREEN_WIDTH);
CFont::SetFontStyle(FONT_HEADING);
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed) if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed)
TimerOnLastFrame = 0; TimerOnLastFrame = 0;
if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed) if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed)
CounterOnLastFrame = 0; CounterOnLastFrame = 0;
float AlignToHUD = SCREEN_SCALE_X(-12.0f); if (CUserDisplay::OnscnTimer.m_bProcessed) {
if (CUserDisplay::OnscnTimer.m_bProcessed == 1) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed) {
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed == 1) {
if (!TimerOnLastFrame) if (!TimerOnLastFrame)
TimerFlashTimer = 1; TimerFlashTimer = 1;
@ -662,22 +663,32 @@ void CHud::Draw()
if (CTimer::GetFrameCounter() & 4 || !TimerFlashTimer) { if (CTimer::GetFrameCounter() & 4 || !TimerFlashTimer) {
AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerBuffer, sTimer); AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerBuffer, sTimer);
CFont::SetPropOn();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetFontStyle(FONT_HEADING);
CFont::SetPropOff();
CFont::SetBackGroundOnlyTextOn();
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(25.0f) + AlignToHUD, SCREEN_SCALE_Y(112.0f), sTimer); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), sTimer);
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetColor(CRGBA(186, 101, 50, 255)); CFont::SetColor(CRGBA(186, 101, 50, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + AlignToHUD, SCREEN_SCALE_Y(110.0f), sTimer); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f), SCREEN_SCALE_Y(110.0f), sTimer);
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) {
CFont::SetPropOn();
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(105.0f) + AlignToHUD, SCREEN_SCALE_Y(112.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(80.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(110.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
CFont::SetColor(CRGBA(186, 101, 50, 255)); CFont::SetColor(CRGBA(186, 101, 50, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(107.0f) + AlignToHUD, SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(80.0f), SCREEN_SCALE_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
} }
} }
} }
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed == 1) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed) {
if (!CounterOnLastFrame) if (!CounterOnLastFrame)
CounterFlashTimer = 1; CounterFlashTimer = 1;
@ -690,25 +701,38 @@ void CHud::Draw()
if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) { if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) {
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) {
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(73.0f) + AlignToHUD, SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT(23.0f) + AlignToHUD, SCREEN_SCALE_Y(151.0f)), CRGBA(0, 106, 164, 80)); CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_FROM_RIGHT(27.0f) + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 80));
CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(73.0f) + AlignToHUD, SCREEN_SCALE_Y(140.0f), SCREEN_SCALE_FROM_RIGHT((-atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) * 0.5f) + 73.0f) + AlignToHUD, SCREEN_SCALE_Y(151.0f)), CRGBA(0, 106, 164, 255)); CSprite2d::DrawRect(CRect(SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(8.0f), SCREEN_SCALE_X(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer)) / 2 + SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(100.0f) / 2 + SCREEN_SCALE_X(4.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(11.0f) + SCREEN_SCALE_Y(8.0f)), CRGBA(0, 106, 164, 255));
} } else {
else {
AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer); AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer);
CFont::SetPropOn();
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetBackgroundOff();
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(25.0f) + AlignToHUD, SCREEN_SCALE_Y(134.0f), sTimer); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
CFont::SetRightJustifyWrap(0.0f);
CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(244, 20, 20, 255));
CFont::SetWrapx(SCREEN_SCALE_X(640.0f));
CFont::SetPropOff();
CFont::SetBackGroundOnlyTextOn();
CFont::SetColor(CRGBA(0, 106, 164, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + AlignToHUD, SCREEN_SCALE_Y(132.0f), sTimer); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), sTimer);
CFont::SetColor(CRGBA(0, 106, 164, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f), SCREEN_SCALE_Y(132.0f), sTimer);
} }
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) { if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) {
CFont::SetPropOn();
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(86.0f) + AlignToHUD, SCREEN_SCALE_Y(134.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(61.0f) + SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(132.0f) + SCREEN_SCALE_Y(2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
CFont::SetColor(CRGBA(0, 106, 164, 255)); CFont::SetColor(CRGBA(0, 106, 164, 255));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(88.0f) + AlignToHUD, SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText)); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(27.0f) - SCREEN_SCALE_X(61.0f), SCREEN_SCALE_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
} }
} }
} }