Fix warning and removed non-existent transition state. (#308)

This commit is contained in:
Maddy 2022-07-02 15:12:50 -04:00 committed by GitHub
parent d015450c14
commit 9363f4797a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 13 deletions

View File

@ -78,33 +78,44 @@ namespace big
}; };
auto transition_state = script_global(1574988); 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() void looped::hud_transition_state()
{ {
const auto state = *transition_state.as<eTransitionState*>(); const auto state = *transition_state.as<eTransitionState*>();
if (last_state == eTransitionState::TRANSITION_STATE_MAX)
last_state = state;
// When freemode script loaded remove loading screen. // 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(); 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; return;
}
if (HUD::BUSYSPINNER_IS_ON()) if (HUD::BUSYSPINNER_IS_ON())
{
HUD::BUSYSPINNER_OFF(); HUD::BUSYSPINNER_OFF();
}
// sometimes when going into a single player mission or transition this one remains on screen permanently // sometimes when going into a single player mission or transition this one remains on screen permanently
if (state == eTransitionState::TRANSITION_STATE_TERMINATE_MAINTRANSITION) if (state == eTransitionState::TRANSITION_STATE_TERMINATE_MAINTRANSITION)
{
return; return;
}
HUD::BEGIN_TEXT_COMMAND_BUSYSPINNER_ON("STRING"); if ((int)state > 0 && (int)std::size(transition_states))
HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME( {
fmt::format("{} | {}", transition_states[(int)state], state).c_str() HUD::BEGIN_TEXT_COMMAND_BUSYSPINNER_ON("STRING");
); auto const spinner_text = fmt::format("{} | {}", transition_states[(int)state], state);
HUD::END_TEXT_COMMAND_BUSYSPINNER_ON(5); HUD::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME(spinner_text.c_str());
HUD::END_TEXT_COMMAND_BUSYSPINNER_ON(5);
}
last_state = state; last_state = state;
} }
} }

View File

@ -104,8 +104,7 @@ namespace big
TRANSITION_STATE_WAITING_FOR_EXTERNAL_TERMINATION_CALL, TRANSITION_STATE_WAITING_FOR_EXTERNAL_TERMINATION_CALL,
TRANSITION_STATE_TERMINATE_MAINTRANSITION, TRANSITION_STATE_TERMINATE_MAINTRANSITION,
TRANSITION_STATE_WAIT_FOR_DIRTY_LOAD_CONFIRM, TRANSITION_STATE_WAIT_FOR_DIRTY_LOAD_CONFIRM,
TRANSITION_STATE_DLC_INTRO_BINK, TRANSITION_STATE_DLC_INTRO_BINK
TRANSITION_STATE_MAX = INT_MAX
}; };
enum eVehicleFlags enum eVehicleFlags