Make karts powerup in gui an option

This commit is contained in:
Benau 2019-10-18 12:03:36 +08:00
parent d1487a9801
commit 1a7a8bdc14
4 changed files with 23 additions and 4 deletions

View File

@ -75,6 +75,12 @@
<label height="100%" I18N="In the ui settings" text="Multiplayer splits screen horizontally" word_wrap="true"/>
</div>
<div layout="horizontal-row" width="100%" height="fit">
<checkbox id="karts_powerup_gui"/>
<spacer width="1%" height="100%" />
<label height="100%" I18N="In the ui settings" text="Show other karts' held powerups" word_wrap="true"/>
</div>
<spacer width="5" height="2%"/>
</box>
</div>

View File

@ -450,11 +450,14 @@ namespace UserConfigParams
PARAM_DEFAULT( StringUserConfigParam("all", "last_kart_group",
"Last selected kart group") );
PARAM_PREFIX IntUserConfigParam m_soccer_red_ai_num
PARAM_DEFAULT( IntUserConfigParam(0, "m_soccer_red_ai_num",
PARAM_DEFAULT( IntUserConfigParam(0, "soccer-red-ai-num",
&m_race_setup_group, "Number of red AI karts in soccer mode.") );
PARAM_PREFIX IntUserConfigParam m_soccer_blue_ai_num
PARAM_DEFAULT( IntUserConfigParam(0, "m_soccer_blue_ai_num",
PARAM_DEFAULT( IntUserConfigParam(0, "soccer-blue-ai-num",
&m_race_setup_group, "Number of blue AI karts in soccer mode.") );
PARAM_PREFIX BoolUserConfigParam m_karts_powerup_gui
PARAM_DEFAULT( BoolUserConfigParam(false, "karts-powerup-gui",
&m_race_setup_group, "Show other karts' held powerups in race gui.") );
// ---- Wiimote data
PARAM_PREFIX GroupUserConfigParam m_wiimote_group

View File

@ -231,6 +231,10 @@ void OptionsScreenUI::init()
assert(splitscreen_method != NULL);
splitscreen_method->setState(UserConfigParams::split_screen_horizontally);
CheckBoxWidget* karts_powerup_gui = getWidget<CheckBoxWidget>("karts_powerup_gui");
assert(karts_powerup_gui != NULL);
karts_powerup_gui->setState(UserConfigParams::m_karts_powerup_gui);
//Forbid changing this setting in game
splitscreen_method->setActive(!in_game);
@ -374,7 +378,12 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
CheckBoxWidget* split_screen_horizontally = getWidget<CheckBoxWidget>("split_screen_horizontally");
assert(split_screen_horizontally != NULL);
UserConfigParams::split_screen_horizontally = split_screen_horizontally->getState();
}
else if (name == "karts_powerup_gui")
{
CheckBoxWidget* karts_powerup_gui = getWidget<CheckBoxWidget>("karts_powerup_gui");
assert(karts_powerup_gui != NULL);
UserConfigParams::m_karts_powerup_gui = karts_powerup_gui->getState();
}
else if (name == "showfps")
{

View File

@ -1077,7 +1077,8 @@ void RaceGUIBase::drawPlayerIcon(AbstractKart *kart, int x, int y, int w,
// Current item(s) and how many if > 1
const Powerup* powerup = kart->getPowerup();
if (powerup->getType() != PowerupManager::POWERUP_NOTHING && !kart->hasFinishedRace())
if (UserConfigParams::m_karts_powerup_gui &&
powerup->getType() != PowerupManager::POWERUP_NOTHING && !kart->hasFinishedRace())
{
int numberItems = kart->getPowerup()->getNum();
video::ITexture *iconItem = powerup->getIcon()->getTexture();