Fix redone + add hud fix
This commit is contained in:
parent
cacec36dd1
commit
f741101e44
@ -41,11 +41,6 @@ cAudioManager::cAudioManager()
|
||||
m_bFifthFrameFlag = FALSE;
|
||||
m_bTimerJustReset = FALSE;
|
||||
m_nTimer = 0;
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
m_LogicalFrameCounter = 0;
|
||||
m_bLogicalFrameUpdate = FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
cAudioManager::~cAudioManager()
|
||||
@ -105,12 +100,6 @@ cAudioManager::Terminate()
|
||||
void
|
||||
cAudioManager::Service()
|
||||
{
|
||||
#ifdef FIX_BUGS
|
||||
m_bLogicalFrameUpdate = m_LogicalFrameCounter != CTimer::GetLogicalFrameCounter();
|
||||
if(m_bLogicalFrameUpdate)
|
||||
m_LogicalFrameCounter = CTimer::GetLogicalFrameCounter();
|
||||
#endif
|
||||
|
||||
GenerateIntegerRandomNumberTable();
|
||||
if (m_bTimerJustReset) {
|
||||
ResetAudioLogicTimers(m_nTimer);
|
||||
@ -435,7 +424,7 @@ void
|
||||
cAudioManager::ServiceSoundEffects()
|
||||
{
|
||||
#ifdef FIX_BUGS
|
||||
if(m_bLogicalFrameUpdate)
|
||||
if(CTimer::GetLogicalFramesPassed() != 0)
|
||||
#endif
|
||||
m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0;
|
||||
if (m_nUserPause && !m_nPreviousUserPause) {
|
||||
@ -741,7 +730,7 @@ cAudioManager::AddReleasingSounds()
|
||||
sample.m_nVolume -= sample.m_nVolumeChange;
|
||||
}
|
||||
#ifdef FIX_BUGS
|
||||
if(m_bLogicalFrameUpdate)
|
||||
if(CTimer::GetLogicalFramesPassed() != 0)
|
||||
#endif
|
||||
--sample.m_nReleasingVolumeDivider;
|
||||
if (m_bFifthFrameFlag) {
|
||||
|
@ -223,10 +223,6 @@ public:
|
||||
uint8 m_nUserPause;
|
||||
uint8 m_nPreviousUserPause;
|
||||
uint32 m_FrameCounter;
|
||||
#ifdef FIX_BUGS
|
||||
uint32 m_LogicalFrameCounter;
|
||||
bool8 m_bLogicalFrameUpdate;
|
||||
#endif
|
||||
|
||||
cAudioManager();
|
||||
~cAudioManager();
|
||||
|
@ -195,7 +195,11 @@ cMusicManager::DisplayRadioStationName()
|
||||
cDisplay = 60;
|
||||
} else {
|
||||
if(cDisplay == 0) return;
|
||||
#ifdef FIX_BUGS
|
||||
cDisplay -= CTimer::GetLogicalFramesPassed();
|
||||
#else
|
||||
cDisplay--;
|
||||
#endif
|
||||
}
|
||||
|
||||
CFont::SetJustifyOff();
|
||||
|
@ -18,6 +18,7 @@ bool CTimer::m_UserPause;
|
||||
bool CTimer::m_CodePause;
|
||||
#ifdef FIX_BUGS
|
||||
uint32 CTimer::m_LogicalFrameCounter;
|
||||
uint32 CTimer::m_LogicalFramesPassed;
|
||||
#endif
|
||||
|
||||
uint32 _nCyclesPerMS = 1;
|
||||
@ -54,6 +55,7 @@ void CTimer::Initialise(void)
|
||||
m_snTimeInMilliseconds = 1;
|
||||
#ifdef FIX_BUGS
|
||||
m_LogicalFrameCounter = 0;
|
||||
m_LogicalFramesPassed = 0;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -109,12 +111,14 @@ void CTimer::Update(void)
|
||||
frameTime = updInCyclesScaled / (double)_nCyclesPerMS;
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
m_LogicalFramesPassed = 0;
|
||||
static double frameTimeLogical = 0.0;
|
||||
frameTimeLogical += ((double)updInCycles / (double)_nCyclesPerMS);
|
||||
while (frameTimeLogical >= 1000.0 / 30.0) {
|
||||
frameTimeLogical -= 1000.0 / 30.0;
|
||||
m_LogicalFrameCounter++;
|
||||
m_LogicalFramesPassed++;
|
||||
}
|
||||
m_LogicalFrameCounter += m_LogicalFramesPassed;
|
||||
#endif
|
||||
|
||||
m_snTimeInMillisecondsPauseMode = m_snTimeInMillisecondsPauseMode + frameTime;
|
||||
@ -142,12 +146,14 @@ void CTimer::Update(void)
|
||||
frameTime = (double)updInMs * ms_fTimeScale;
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
m_LogicalFramesPassed = 0;
|
||||
static double frameTimeLogical = 0.0;
|
||||
frameTimeLogical += (double)updInMs;
|
||||
while(frameTimeLogical >= 1000.0 / 30.0) {
|
||||
frameTimeLogical -= 1000.0 / 30.0;
|
||||
m_LogicalFrameCounter++;
|
||||
m_LogicalFramesPassed++;
|
||||
}
|
||||
m_LogicalFrameCounter += m_LogicalFramesPassed;
|
||||
#endif
|
||||
|
||||
oldPcTimer = timer;
|
||||
|
@ -13,6 +13,7 @@ class CTimer
|
||||
static float ms_fTimeStepNonClipped;
|
||||
#ifdef FIX_BUGS
|
||||
static uint32 m_LogicalFrameCounter;
|
||||
static uint32 m_LogicalFramesPassed;
|
||||
#endif
|
||||
public:
|
||||
static bool m_UserPause;
|
||||
@ -65,6 +66,7 @@ public:
|
||||
static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; }
|
||||
static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); }
|
||||
static uint32 GetLogicalFrameCounter(void) { return m_LogicalFrameCounter; }
|
||||
static uint32 GetLogicalFramesPassed(void) { return m_LogicalFramesPassed; }
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -75,6 +75,12 @@
|
||||
#define SCALE_AND_CENTER_X_FIX(a) (a)
|
||||
#endif
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
#define FRAMECOUNTER CTimer::GetLogicalFrameCounter()
|
||||
#else
|
||||
#define FRAMECOUNTER CTimer::GetFrameCounter()
|
||||
#endif
|
||||
|
||||
// Game has colors inlined in code.
|
||||
// For easier modification we collect them here:
|
||||
CRGBA MONEY_COLOR(89, 115, 150, 255);
|
||||
@ -577,12 +583,12 @@ void CHud::Draw()
|
||||
CFont::SetPropOff();
|
||||
CFont::SetFontStyle(FONT_HEADING);
|
||||
|
||||
if (m_ItemToFlash == ITEM_HEALTH && CTimer::GetFrameCounter() & 8
|
||||
if (m_ItemToFlash == ITEM_HEALTH && FRAMECOUNTER & 8
|
||||
|| m_ItemToFlash != ITEM_HEALTH
|
||||
|| FindPlayerPed()->m_fHealth < 10
|
||||
&& CTimer::GetFrameCounter() & 8) {
|
||||
&& FRAMECOUNTER & 8) {
|
||||
if (FindPlayerPed()->m_fHealth >= 10
|
||||
|| FindPlayerPed()->m_fHealth < 10 && CTimer::GetFrameCounter() & 8) {
|
||||
|| FindPlayerPed()->m_fHealth < 10 && FRAMECOUNTER & 8) {
|
||||
|
||||
AsciiToUnicode("{", sPrintIcon);
|
||||
#ifdef FIX_BUGS
|
||||
@ -594,14 +600,14 @@ void CHud::Draw()
|
||||
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrint);
|
||||
|
||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4)
|
||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || FRAMECOUNTER & 4)
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X_FIX(2.0f) - SCREEN_SCALE_X(56.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrintIcon);
|
||||
|
||||
CFont::SetColor(HEALTH_COLOR);
|
||||
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X), SCREEN_SCALE_Y(65.0f), sPrint);
|
||||
|
||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4)
|
||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || FRAMECOUNTER & 4)
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(HEALTH_X) + SCREEN_SCALE_X_FIX(2.0f) - SCREEN_SCALE_X(56.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
|
||||
}
|
||||
}
|
||||
@ -609,7 +615,7 @@ void CHud::Draw()
|
||||
/*
|
||||
DrawArmour
|
||||
*/
|
||||
if (m_ItemToFlash == ITEM_ARMOUR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_ARMOUR) {
|
||||
if (m_ItemToFlash == ITEM_ARMOUR && FRAMECOUNTER & 8 || m_ItemToFlash != ITEM_ARMOUR) {
|
||||
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
|
||||
if (FindPlayerPed()->m_fArmour > 1.0f) {
|
||||
AsciiToUnicode("[", sPrintIcon);
|
||||
@ -623,14 +629,14 @@ void CHud::Draw()
|
||||
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + SCREEN_SCALE_X_FIX(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrint);
|
||||
|
||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4)
|
||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || FRAMECOUNTER & 4)
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) + SCREEN_SCALE_X_FIX(2.0f) - SCREEN_SCALE_X(54.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f) + SCREEN_SCALE_Y_FIX(2.0f), sPrintIcon);
|
||||
|
||||
CFont::SetColor(ARMOUR_COLOR);
|
||||
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint);
|
||||
|
||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) {
|
||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || FRAMECOUNTER & 1) {
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f) - SCREEN_SCALE_X(54.0f) + SCREEN_SCALE_X(2.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
|
||||
}
|
||||
}
|
||||
@ -657,7 +663,7 @@ void CHud::Draw()
|
||||
|
||||
if (FindPlayerPed()->m_pWanted->GetWantedLevel() > i
|
||||
&& (CTimer::GetTimeInMilliseconds() > FindPlayerPed()->m_pWanted->m_nLastWantedLevelChange
|
||||
+ 2000 || CTimer::GetFrameCounter() & 4)) {
|
||||
+ 2000 || FRAMECOUNTER & 4)) {
|
||||
|
||||
CFont::SetColor(WANTED_COLOR);
|
||||
CFont::PrintString(fStarsX, SCREEN_SCALE_Y(87.0f), sPrintIcon);
|
||||
@ -904,7 +910,7 @@ void CHud::Draw()
|
||||
TimerFlashTimer = 0;
|
||||
}
|
||||
|
||||
if (CTimer::GetFrameCounter() & 4 || !TimerFlashTimer) {
|
||||
if (FRAMECOUNTER & 4 || !TimerFlashTimer) {
|
||||
AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerBuffer, sTimer);
|
||||
CFont::SetPropOn();
|
||||
CFont::SetBackgroundOff();
|
||||
@ -941,7 +947,7 @@ void CHud::Draw()
|
||||
CounterFlashTimer = 0;
|
||||
}
|
||||
|
||||
if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) {
|
||||
if (FRAMECOUNTER & 4 || !CounterFlashTimer) {
|
||||
if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType == COUNTER_DISPLAY_NUMBER) {
|
||||
AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer);
|
||||
CFont::SetPropOn();
|
||||
@ -1053,7 +1059,7 @@ void CHud::Draw()
|
||||
/*
|
||||
DrawRadar
|
||||
*/
|
||||
if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) {
|
||||
if (m_ItemToFlash == ITEM_RADAR && FRAMECOUNTER & 8 || m_ItemToFlash != ITEM_RADAR) {
|
||||
CRadar::DrawMap();
|
||||
CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT));
|
||||
rect.Translate(SCREEN_SCALE_X_FIX(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
|
||||
|
Loading…
Reference in New Issue
Block a user