From b43dfc82f8bea46d02a1c391d2dec848f92c8d03 Mon Sep 17 00:00:00 2001 From: Quentin Date: Tue, 10 Oct 2023 21:48:14 +0200 Subject: [PATCH] fix(self menu gui): fix self menu erroring when not yet in the game but still in the main menu / first loading screen (#2235) --- src/views/self/view_self.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/views/self/view_self.cpp b/src/views/self/view_self.cpp index 63d52e38..6025d6cc 100644 --- a/src/views/self/view_self.cpp +++ b/src/views/self/view_self.cpp @@ -30,7 +30,8 @@ namespace big components::command_checkbox<"godmode">(); components::command_checkbox<"otr">(); - if (g.self.off_radar && scr_globals::gpbd_fm_3.as()->Entries[self::id].BossGoon.Boss == self::id) + const auto gpbd_fm_3 = scr_globals::gpbd_fm_3.as(); + if (g.self.off_radar && *g_pointers->m_gta.m_is_session_started && gpbd_fm_3->Entries[self::id].BossGoon.Boss == self::id) components::command_checkbox<"ghostorg">(); components::command_checkbox<"freecam">(); components::command_checkbox<"nophone">(); @@ -40,11 +41,13 @@ namespace big if (g.self.invisibility) components::command_checkbox<"localvis">(); // TODO: does nothing in SP - ImGui::BeginDisabled(scr_globals::gpbd_fm_3.as()->Entries[self::id].BossGoon.Boss != -1 - || gta_util::find_script_thread(RAGE_JOAAT("fm_mission_controller")) - || gta_util::find_script_thread(RAGE_JOAAT("fm_mission_controller_2020"))); - - components::command_checkbox<"passive">(); + // clang-format off + ImGui::BeginDisabled(!*g_pointers->m_gta.m_is_session_started || + gpbd_fm_3->Entries[self::id].BossGoon.Boss != -1 || + gta_util::find_script_thread(RAGE_JOAAT("fm_mission_controller")) || + gta_util::find_script_thread(RAGE_JOAAT("fm_mission_controller_2020"))); + // clang-format on + components::command_checkbox<"passive">(); ImGui::EndDisabled(); ImGui::EndGroup();