From 1802b1702939e04842b17ed1c2567576b7fe067e Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Thu, 16 Jun 2022 16:51:22 +0600 Subject: [PATCH] Fix lag on Teleport/Search --- src/dllmain.cpp | 4 ++-- src/player.cpp | 4 ++-- src/teleport.cpp | 13 +++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 4c8d8c2..4d238fd 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -76,11 +76,11 @@ void MenuThread(void* param) // Checking for updates once a day SYSTEMTIME st; GetSystemTime(&st); - if (gConfig.Get("config.update_date", 0) != st.wDay) + if (gConfig.Get("Menu.LastUpdateChecked", 0) != st.wDay) { Updater::CheckUpdate(); Updater::IncrementDailyUsageCounter(); - gConfig.Set("config.update_date", st.wDay); + gConfig.Set("Menu.LastUpdateChecked", st.wDay); } while (true) diff --git a/src/player.cpp b/src/player.cpp index 11e963d..1981842 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -88,7 +88,7 @@ void Player::Init() #ifdef GTASA // Fix player model being broken after rebuild patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix); - m_bAimSkinChanger = gConfig.Get("aim_skin_changer", false); + m_bAimSkinChanger = gConfig.Get("Features.AimSkinChanger", false); #endif // Custom skins setup @@ -766,7 +766,7 @@ void Player::ShowPage() if (Ui::CheckboxWithHint(TEXT("Player.AimSkinChanger"), &m_bAimSkinChanger, TEXT("Player.AimSkinChangerTip") + aimSkinChanger.Pressed())) { - gConfig.Set("aim_skin_changer", m_bAimSkinChanger); + gConfig.Set("Features.AimSkinChanger", m_bAimSkinChanger); } if (ImGui::BeginTabBar("AppearanceTabBar")) { diff --git a/src/teleport.cpp b/src/teleport.cpp index d818e4d..5e3c4d5 100644 --- a/src/teleport.cpp +++ b/src/teleport.cpp @@ -10,12 +10,12 @@ tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast(patch::GetPo void Teleport::FetchRadarSpriteData() { - uint cur_timer = CTimer::m_snTimeInMilliseconds; - static uint timer = cur_timer; static int maxSprites = *(uint*)0x5D5870; + uint timer = CTimer::m_snTimeInMilliseconds; + static uint lastUpdated = timer; // Update the radar list each 5 seconds - if (cur_timer - timer < 5000) + if (timer - lastUpdated < 5000) { return; } @@ -30,12 +30,13 @@ void Teleport::FetchRadarSpriteData() std::string key = "Radar." + keyName; m_tpData.m_pData->Set(key.c_str(), std::format("0, {}, {}, {}", pos.x, pos.y, pos.z)); } + lastUpdated = timer; } #endif void Teleport::Init() { - m_bQuickTeleport = gConfig.Get("quick_teleport", false); + m_bQuickTeleport = gConfig.Get("Features.QuickTeleport", false); Events::processScriptsEvent += [] { @@ -219,7 +220,7 @@ void Teleport::ShowPage() std::string(TEXT_S("Teleport.QuickTeleportHint") + quickTeleport.GetNameString()).c_str())) { - gConfig.Set("quick_teleport", m_bQuickTeleport); + gConfig.Set("Features.QuickTeleport", m_bQuickTeleport); } #endif ImGui::Columns(1); @@ -297,7 +298,7 @@ void Teleport::ShowPage() } ImGui::Spacing(); - Ui::DrawJSON(m_tpData, TeleportToLocation,RemoveTeleportEntry); + Ui::DrawJSON(m_tpData, TeleportToLocation, RemoveTeleportEntry); ImGui::EndTabItem(); } ImGui::EndTabBar();