2019-05-30 21:24:47 +02:00
|
|
|
#include "common.h"
|
|
|
|
#include "patcher.h"
|
|
|
|
|
2019-06-07 22:31:03 +02:00
|
|
|
#include "Hud.h"
|
2020-01-07 17:59:03 +01:00
|
|
|
#include "PlayerPed.h"
|
|
|
|
#include "Text.h"
|
2019-06-12 13:46:02 +02:00
|
|
|
#include "User.h"
|
2020-01-07 17:59:03 +01:00
|
|
|
#include "Vehicle.h"
|
|
|
|
#include "World.h"
|
|
|
|
#include "Zones.h"
|
2019-06-07 22:31:03 +02:00
|
|
|
|
2020-04-17 07:54:14 +02:00
|
|
|
CPlaceName CUserDisplay::PlaceName;
|
|
|
|
COnscreenTimer CUserDisplay::OnscnTimer;
|
|
|
|
CPager CUserDisplay::Pager;
|
|
|
|
CCurrentVehicle CUserDisplay::CurrentVehicle;
|
2019-06-07 22:31:03 +02:00
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
CPlaceName::CPlaceName()
|
|
|
|
{
|
|
|
|
Init();
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
void
|
|
|
|
CPlaceName::Init()
|
|
|
|
{
|
|
|
|
m_pZone = nil;
|
|
|
|
m_pZone2 = nil;
|
|
|
|
m_nAdditionalTimer = 0;
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
void
|
|
|
|
CPlaceName::Process()
|
|
|
|
{
|
|
|
|
CVector pos = CWorld::Players[CWorld::PlayerInFocus].GetPos();
|
|
|
|
CZone *navigZone = CTheZones::FindSmallestZonePositionType(&pos, ZONE_TYPE1);
|
|
|
|
CZone *audioZone = CTheZones::FindSmallestZonePositionType(&pos, ZONE_AUDIO);
|
|
|
|
|
|
|
|
if (navigZone == nil) m_pZone = nil;
|
|
|
|
if (audioZone == nil) m_pZone2 = nil;
|
|
|
|
|
|
|
|
if (navigZone == m_pZone) {
|
|
|
|
if (audioZone == m_pZone2 || m_pZone != nil) {
|
|
|
|
if (navigZone != nil || audioZone != nil) {
|
|
|
|
if (m_nAdditionalTimer != 0)
|
|
|
|
m_nAdditionalTimer--;
|
|
|
|
} else {
|
|
|
|
m_nAdditionalTimer = 0;
|
|
|
|
m_pZone = nil;
|
|
|
|
m_pZone2 = nil;
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
2020-01-07 17:59:03 +01:00
|
|
|
} else {
|
|
|
|
m_pZone2 = audioZone;
|
|
|
|
m_nAdditionalTimer = 250;
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
2020-01-07 17:59:03 +01:00
|
|
|
} else {
|
|
|
|
m_pZone = navigZone;
|
|
|
|
m_nAdditionalTimer = 250;
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
2020-01-07 17:59:03 +01:00
|
|
|
Display();
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01: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 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
CCurrentVehicle::CCurrentVehicle()
|
|
|
|
{
|
|
|
|
Init();
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
void
|
|
|
|
CCurrentVehicle::Init()
|
|
|
|
{
|
|
|
|
m_pCurrentVehicle = nil;
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01: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 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
void
|
|
|
|
CCurrentVehicle::Display()
|
|
|
|
{
|
|
|
|
wchar *text = nil;
|
|
|
|
if (m_pCurrentVehicle != nil)
|
|
|
|
text = TheText.Get(((CVehicleModelInfo*)CModelInfo::GetModelInfo(m_pCurrentVehicle->GetModelIndex()))->m_gameName);
|
|
|
|
CHud::SetVehicleName(text);
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
void
|
|
|
|
CUserDisplay::Init()
|
|
|
|
{
|
|
|
|
PlaceName.Init();
|
|
|
|
OnscnTimer.Init();
|
|
|
|
Pager.Init();
|
|
|
|
CurrentVehicle.Init();
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
void
|
|
|
|
CUserDisplay::Process()
|
|
|
|
{
|
|
|
|
PlaceName.Process();
|
|
|
|
OnscnTimer.Process();
|
|
|
|
Pager.Process();
|
|
|
|
CurrentVehicle.Process();
|
2019-06-07 22:31:03 +02:00
|
|
|
}
|
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
STARTPATCHES
|
|
|
|
InjectHook(0x4AD4C0, &CPlaceName::Init, PATCH_JUMP);
|
|
|
|
InjectHook(0x4AD4E0, &CPlaceName::Process, PATCH_JUMP);
|
|
|
|
InjectHook(0x4AD5B0, &CPlaceName::Display, PATCH_JUMP);
|
2020-01-07 15:23:09 +01:00
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
InjectHook(0x4AD5F0, &CCurrentVehicle::Init, PATCH_JUMP);
|
|
|
|
InjectHook(0x4AD600, &CCurrentVehicle::Process, PATCH_JUMP);
|
|
|
|
InjectHook(0x4AD630, &CCurrentVehicle::Display, PATCH_JUMP);
|
2019-06-07 22:31:03 +02:00
|
|
|
|
2020-01-07 17:59:03 +01:00
|
|
|
InjectHook(0x4AD660, &CUserDisplay::Init, PATCH_JUMP);
|
|
|
|
InjectHook(0x4AD690, &CUserDisplay::Process, PATCH_JUMP);
|
|
|
|
ENDPATCHES
|