diff --git a/BigBaseV2/src/backend/looped/hud/hud_transition_state.cpp b/BigBaseV2/src/backend/looped/hud/hud_transition_state.cpp index 9b7d48d2..b2101380 100644 --- a/BigBaseV2/src/backend/looped/hud/hud_transition_state.cpp +++ b/BigBaseV2/src/backend/looped/hud/hud_transition_state.cpp @@ -78,33 +78,44 @@ namespace big }; auto transition_state = script_global(1574988); - eTransitionState last_state = eTransitionState::TRANSITION_STATE_MAX; + eTransitionState last_state = eTransitionState::TRANSITION_STATE_EMPTY; void looped::hud_transition_state() { const auto state = *transition_state.as(); - if (last_state == eTransitionState::TRANSITION_STATE_MAX) - last_state = state; // When freemode script loaded remove loading screen. - if (state == eTransitionState::TRANSITION_STATE_WAIT_JOIN_FM_SESSION && DLC::GET_IS_LOADING_SCREEN_ACTIVE()) + if (state == eTransitionState::TRANSITION_STATE_WAIT_JOIN_FM_SESSION + && DLC::GET_IS_LOADING_SCREEN_ACTIVE()) + { SCRIPT::SHUTDOWN_LOADING_SCREEN(); + } - if (last_state == state || state == eTransitionState::TRANSITION_STATE_EMPTY || state > eTransitionState::TRANSITION_STATE_DLC_INTRO_BINK) + if (last_state == state + || state == eTransitionState::TRANSITION_STATE_EMPTY + || state > eTransitionState::TRANSITION_STATE_DLC_INTRO_BINK) + { return; + } if (HUD::BUSYSPINNER_IS_ON()) + { HUD::BUSYSPINNER_OFF(); + } // sometimes when going into a single player mission or transition this one remains on screen permanently if (state == eTransitionState::TRANSITION_STATE_TERMINATE_MAINTRANSITION) + { return; + } - HUD::BEGIN_TEXT_COMMAND_BUSYSPINNER_ON("STRING"); - HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME( - fmt::format("{} | {}", transition_states[(int)state], state).c_str() - ); - HUD::END_TEXT_COMMAND_BUSYSPINNER_ON(5); + if ((int)state > 0 && (int)std::size(transition_states)) + { + HUD::BEGIN_TEXT_COMMAND_BUSYSPINNER_ON("STRING"); + auto const spinner_text = fmt::format("{} | {}", transition_states[(int)state], state); + HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(spinner_text.c_str()); + HUD::END_TEXT_COMMAND_BUSYSPINNER_ON(5); + } last_state = state; } -} \ No newline at end of file +} diff --git a/BigBaseV2/src/core/enums.hpp b/BigBaseV2/src/core/enums.hpp index 030d20c1..6611d8c4 100644 --- a/BigBaseV2/src/core/enums.hpp +++ b/BigBaseV2/src/core/enums.hpp @@ -104,8 +104,7 @@ namespace big TRANSITION_STATE_WAITING_FOR_EXTERNAL_TERMINATION_CALL, TRANSITION_STATE_TERMINATE_MAINTRANSITION, TRANSITION_STATE_WAIT_FOR_DIRTY_LOAD_CONFIRM, - TRANSITION_STATE_DLC_INTRO_BINK, - TRANSITION_STATE_MAX = INT_MAX + TRANSITION_STATE_DLC_INTRO_BINK }; enum eVehicleFlags