Fix weird glitches with hud & radar flags

This commit is contained in:
Grinch_ 2021-07-11 15:43:41 +06:00
parent 13c191d0dd
commit a4c28025bc
3 changed files with 22 additions and 14 deletions

View File

@ -135,10 +135,16 @@ Game::Game()
m_Freecam::m_bEnabled = false;
ClearFreecamStuff();
}
else m_Freecam::m_bEnabled = true;
else
{
m_Freecam::m_bEnabled = true;
}
}
if (m_Freecam::m_bEnabled)
{
FreeCam();
}
};
}
@ -167,10 +173,10 @@ void Game::FreeCam()
{
CPlayerPed* player = FindPlayerPed(-1);
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, true);
m_Freecam::m_bHudState = CHud::m_Wants_To_Draw_Hud;
m_Freecam::m_bRadarState = CHud::bScriptDontDisplayRadar;
CHud::bScriptDontDisplayRadar = true;
CHud::m_Wants_To_Draw_Hud = false;
m_Freecam::m_bHudState = patch::Get<BYTE>(0xBA6769); // hud
m_Freecam::m_bRadarState = patch::Get<BYTE>(0xBA676C); // radar
patch::Set<BYTE>(0xBA6769, 0); // hud
patch::Set<BYTE>(0xBA676C, 2); // radar
CVector player_pos = player->GetPosition();
CPad::GetPad(0)->DisablePlayerControls = true;
@ -278,8 +284,8 @@ void Game::ClearFreecamStuff()
{
m_Freecam::m_bInitDone = false;
Command<Commands::SET_EVERYONE_IGNORE_PLAYER>(0, false);
CHud::bScriptDontDisplayRadar = m_Freecam::m_bRadarState;
CHud::m_Wants_To_Draw_Hud = m_Freecam::m_bHudState;
patch::Set<BYTE>(0xBA6769, m_Freecam::m_bHudState); // hud
patch::Set<BYTE>(0xBA676C, m_Freecam::m_bRadarState); // radar
CPad::GetPad(0)->DisablePlayerControls = false;
Command<Commands::DELETE_CHAR>(m_Freecam::m_nPed);

View File

@ -25,8 +25,8 @@ public:
inline static int m_nPed = -1;
inline static CVector m_fMouse;
inline static CVector m_fTotalMouse;
inline static bool m_bHudState;
inline static bool m_bRadarState;
inline static BYTE m_bHudState;
inline static BYTE m_bRadarState;
};
struct m_HardMode
{

View File

@ -213,15 +213,17 @@ void Visual::Draw()
if (Ui::CheckboxWithHint("Hide veh names", &CHud::bScriptDontDisplayVehicleName))
Command<Commands::DISPLAY_CAR_NAMES>(!CHud::bScriptDontDisplayVehicleName);
if (Ui::CheckboxWithHint("Hide radar", &CHud::bScriptDontDisplayRadar))
Command<Commands::DISPLAY_RADAR>(!CHud::bScriptDontDisplayRadar);
Ui::CheckboxAddressEx("Hide wanted level", 0x58DD1B, 0x90, 1);
if (Ui::CheckboxWithHint("Lock weather", &m_bLockWeather))
m_nBacWeatherType = CWeather::OldWeatherType;
if (Ui::CheckboxWithHint("Show hud", &CHud::m_Wants_To_Draw_Hud))
Command<Commands::DISPLAY_HUD>(CHud::m_Wants_To_Draw_Hud);
bool radar_state = (patch::Get<BYTE>(0xBA676C) != 2);
if (Ui::CheckboxWithHint("Show radar", &radar_state))
{
patch::Set<BYTE>(0xBA676C, radar_state == true ? 0 : 2);
}
Ui::CheckboxAddress("Show hud", 0xBA6769);
ImGui::Columns(1);
ImGui::EndTabItem();