2019-05-30 19:24:47 +00:00
|
|
|
#include "common.h"
|
2020-04-17 13:31:11 +00:00
|
|
|
|
2020-05-31 17:59:01 +00:00
|
|
|
#include "GameLogic.h"
|
2019-06-07 20:31:03 +00:00
|
|
|
#include "Hud.h"
|
2020-01-07 16:59:03 +00:00
|
|
|
#include "PlayerPed.h"
|
2020-04-18 20:50:37 +00:00
|
|
|
#include "Replay.h"
|
2020-01-07 16:59:03 +00:00
|
|
|
#include "Text.h"
|
2019-06-12 11:46:02 +00:00
|
|
|
#include "User.h"
|
2020-01-07 16:59:03 +00:00
|
|
|
#include "Vehicle.h"
|
|
|
|
#include "World.h"
|
|
|
|
#include "Zones.h"
|
2019-06-07 20:31:03 +00:00
|
|
|
|
2020-10-10 11:23:17 +00:00
|
|
|
// --MIAMI: file done
|
|
|
|
|
2020-04-17 05:54:14 +00:00
|
|
|
CPlaceName CUserDisplay::PlaceName;
|
|
|
|
COnscreenTimer CUserDisplay::OnscnTimer;
|
|
|
|
CPager CUserDisplay::Pager;
|
|
|
|
CCurrentVehicle CUserDisplay::CurrentVehicle;
|
2019-06-07 20:31:03 +00:00
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
CPlaceName::CPlaceName()
|
|
|
|
{
|
|
|
|
Init();
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
void
|
|
|
|
CPlaceName::Init()
|
|
|
|
{
|
|
|
|
m_pZone = nil;
|
|
|
|
m_pZone2 = nil;
|
|
|
|
m_nAdditionalTimer = 0;
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
void
|
|
|
|
CPlaceName::Process()
|
|
|
|
{
|
|
|
|
CVector pos = CWorld::Players[CWorld::PlayerInFocus].GetPos();
|
2020-05-06 10:23:57 +00:00
|
|
|
CZone *navigZone = CTheZones::FindSmallestNavigationZoneForPosition(&pos, false, true);
|
|
|
|
CZone *defaultZone = CTheZones::FindSmallestNavigationZoneForPosition(&pos, true, false);
|
2020-01-07 16:59:03 +00:00
|
|
|
|
|
|
|
if (navigZone == nil) m_pZone = nil;
|
2020-05-06 10:23:57 +00:00
|
|
|
if (defaultZone == nil) m_pZone2 = nil;
|
2020-01-07 16:59:03 +00:00
|
|
|
|
|
|
|
if (navigZone == m_pZone) {
|
2020-05-06 10:23:57 +00:00
|
|
|
if (defaultZone == m_pZone2 || m_pZone != nil) {
|
|
|
|
if (navigZone != nil || defaultZone != nil) {
|
2020-01-07 16:59:03 +00:00
|
|
|
if (m_nAdditionalTimer != 0)
|
|
|
|
m_nAdditionalTimer--;
|
|
|
|
} else {
|
|
|
|
m_nAdditionalTimer = 0;
|
|
|
|
m_pZone = nil;
|
|
|
|
m_pZone2 = nil;
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
2020-01-07 16:59:03 +00:00
|
|
|
} else {
|
2020-05-06 10:23:57 +00:00
|
|
|
m_pZone2 = defaultZone;
|
2020-01-07 16:59:03 +00:00
|
|
|
m_nAdditionalTimer = 250;
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
2020-01-07 16:59:03 +00:00
|
|
|
} else {
|
|
|
|
m_pZone = navigZone;
|
|
|
|
m_nAdditionalTimer = 250;
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
2020-01-07 16:59:03 +00:00
|
|
|
Display();
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
void
|
|
|
|
CPlaceName::Display()
|
|
|
|
{
|
|
|
|
wchar *text;
|
|
|
|
if (m_pZone != nil)
|
|
|
|
text = m_pZone->GetTranslatedName();
|
|
|
|
else if (m_pZone2 != nil)
|
|
|
|
text = m_pZone2->GetTranslatedName();
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
else
|
|
|
|
text = nil;
|
|
|
|
#endif
|
|
|
|
CHud::SetZoneName(text);
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-07-21 02:59:31 +00:00
|
|
|
void
|
|
|
|
CPlaceName::ProcessAfterFrontEndShutDown(void)
|
|
|
|
{
|
|
|
|
CHud::m_pLastZoneName = nil;
|
|
|
|
CHud::m_ZoneState = 0;
|
|
|
|
m_nAdditionalTimer = 250;
|
|
|
|
}
|
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
CCurrentVehicle::CCurrentVehicle()
|
|
|
|
{
|
|
|
|
Init();
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
void
|
|
|
|
CCurrentVehicle::Init()
|
|
|
|
{
|
|
|
|
m_pCurrentVehicle = nil;
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
void
|
|
|
|
CCurrentVehicle::Process()
|
|
|
|
{
|
|
|
|
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->InVehicle())
|
|
|
|
m_pCurrentVehicle = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle;
|
|
|
|
else
|
|
|
|
m_pCurrentVehicle = nil;
|
|
|
|
Display();
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
void
|
|
|
|
CCurrentVehicle::Display()
|
|
|
|
{
|
|
|
|
wchar *text = nil;
|
2020-05-31 17:59:01 +00:00
|
|
|
if (m_pCurrentVehicle != nil && m_pCurrentVehicle != CGameLogic::pShortCutTaxi)
|
2020-01-07 16:59:03 +00:00
|
|
|
text = TheText.Get(((CVehicleModelInfo*)CModelInfo::GetModelInfo(m_pCurrentVehicle->GetModelIndex()))->m_gameName);
|
|
|
|
CHud::SetVehicleName(text);
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
void
|
|
|
|
CUserDisplay::Init()
|
|
|
|
{
|
|
|
|
PlaceName.Init();
|
|
|
|
OnscnTimer.Init();
|
|
|
|
Pager.Init();
|
|
|
|
CurrentVehicle.Init();
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|
|
|
|
|
2020-01-07 16:59:03 +00:00
|
|
|
void
|
|
|
|
CUserDisplay::Process()
|
|
|
|
{
|
2020-04-18 20:50:37 +00:00
|
|
|
#ifdef FIX_BUGS
|
|
|
|
if (CReplay::IsPlayingBack())
|
|
|
|
return;
|
|
|
|
#endif
|
2020-01-07 16:59:03 +00:00
|
|
|
PlaceName.Process();
|
|
|
|
OnscnTimer.Process();
|
|
|
|
Pager.Process();
|
|
|
|
CurrentVehicle.Process();
|
2019-06-07 20:31:03 +00:00
|
|
|
}
|