// ---------------------------------------------------------------------------- // void MainMenuScreen::init() { Screen::init(); m_user_id = getWidget<ButtonWidget>("user-id"); assert(m_user_id); // reset in case we're coming back from a race StateManager::get()->resetActivePlayers(); input_manager->getDeviceManager()->setAssignMode(NO_ASSIGN); input_manager->getDeviceManager()->setSinglePlayer( NULL ); input_manager->setMasterPlayerOnly(false); // Avoid incorrect behaviour in certain race circumstances: // If a multi-player game is played with two keyboards, the 2nd // player selects his kart last, and only the keyboard is used // to select all other settings - then if the next time the kart // selection screen comes up, the default device will still be // the 2nd player. So if the first player presses 'select', it // will instead add a second player (so basically the key // binding for the second player become the default, so pressing // select will add a new player). See bug 3090931 // To avoid this, we will clean the last used device, making // the key bindings for the first player the default again. input_manager->getDeviceManager()->clearLatestUsedDevice(); if (addons_manager->isLoading()) { IconButtonWidget* w = getWidget<IconButtonWidget>("addons"); w->setDeactivated(); w->resetAllBadges(); w->setBadge(LOADING_BADGE); } m_online = getWidget<IconButtonWidget>("online"); if(!m_enable_online) m_online->setDeactivated(); LabelWidget* w = getWidget<LabelWidget>("info_addons"); const core::stringw &news_text = NewsManager::get()->getNextNewsMessage(); w->setText(news_text, true); w->update(0.01f); RibbonWidget* r = getWidget<RibbonWidget>("menu_bottomrow"); // FIXME: why do I need to do this manually ((IconButtonWidget*)r->getChildren().get(0))->unfocused(PLAYER_ID_GAME_MASTER, NULL); ((IconButtonWidget*)r->getChildren().get(1))->unfocused(PLAYER_ID_GAME_MASTER, NULL); ((IconButtonWidget*)r->getChildren().get(2))->unfocused(PLAYER_ID_GAME_MASTER, NULL); r = getWidget<RibbonWidget>("menu_toprow"); r->setFocusForPlayer(PLAYER_ID_GAME_MASTER); DemoWorld::resetIdleTime(); #if _IRR_MATERIAL_MAX_TEXTURES_ < 8 getWidget<IconButtonWidget>("logo")->setImage("gui/logo_broken.png", IconButtonWidget::ICON_PATH_TYPE_RELATIVE); #endif } // init
void RaceSetupScreen::init() { Screen::init(); input_manager->setMasterPlayerOnly(true); RibbonWidget* w = getWidget<RibbonWidget>("difficulty"); assert( w != NULL ); race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE); if (UserConfigParams::m_difficulty == RaceManager::DIFFICULTY_BEST && PlayerManager::getCurrentPlayer()->isLocked("difficulty_best")) { w->setSelection(RaceManager::DIFFICULTY_HARD, PLAYER_ID_GAME_MASTER); } else { w->setSelection( UserConfigParams::m_difficulty, PLAYER_ID_GAME_MASTER ); } DynamicRibbonWidget* w2 = getWidget<DynamicRibbonWidget>("gamemode"); assert( w2 != NULL ); w2->clearItems(); // ---- Add game modes irr::core::stringw name1 = irr::core::stringw( RaceManager::getNameOf(RaceManager::MINOR_MODE_NORMAL_RACE)) + L"\n"; //FIXME: avoid duplicating descriptions from the help menu! name1 += _("All blows allowed, so catch weapons and make clever use of them!"); w2->addItem( name1, IDENT_STD, RaceManager::getIconOf(RaceManager::MINOR_MODE_NORMAL_RACE)); irr::core::stringw name2 = irr::core::stringw( RaceManager::getNameOf(RaceManager::MINOR_MODE_TIME_TRIAL)) + L"\n"; //FIXME: avoid duplicating descriptions from the help menu! name2 += _("Contains no powerups, so only your driving skills matter!"); w2->addItem( name2, IDENT_TTRIAL, RaceManager::getIconOf(RaceManager::MINOR_MODE_TIME_TRIAL)); if (PlayerManager::getCurrentPlayer()->isLocked(IDENT_FTL)) { w2->addItem( _("Locked : solve active challenges to gain access to more!"), "locked", RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), true); } else { irr::core::stringw name3 = irr::core::stringw( RaceManager::getNameOf(RaceManager::MINOR_MODE_FOLLOW_LEADER)) + L"\n"; //I18N: short definition for follow-the-leader game mode name3 += _("Keep up with the leader kart but don't overtake it!"); w2->addItem(name3, IDENT_FTL, RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), false); } irr::core::stringw name4 = irr::core::stringw(_("Battle")) + L"\n"; //FIXME: avoid duplicating descriptions from the help menu! name4 += _("Hit others with weapons until they lose all their lives."); w2->addItem( name4, IDENT_STRIKES, RaceManager::getIconOf(RaceManager::MINOR_MODE_FREE_FOR_ALL)); irr::core::stringw name5 = irr::core::stringw( RaceManager::getNameOf(RaceManager::MINOR_MODE_SOCCER)) + L"\n"; name5 += _("Push the ball into the opposite cage to score goals."); w2->addItem( name5, IDENT_SOCCER, RaceManager::getIconOf(RaceManager::MINOR_MODE_SOCCER)); #define ENABLE_EASTER_EGG_MODE #ifdef ENABLE_EASTER_EGG_MODE if(race_manager->getNumLocalPlayers() == 1) { irr::core::stringw name1 = irr::core::stringw( RaceManager::getNameOf(RaceManager::MINOR_MODE_EASTER_EGG)) + L"\n"; //FIXME: avoid duplicating descriptions from the help menu! name1 += _("Explore tracks to find all hidden eggs"); w2->addItem( name1, IDENT_EASTER, RaceManager::getIconOf(RaceManager::MINOR_MODE_EASTER_EGG)); } #endif irr::core::stringw name6 = irr::core::stringw( _("Ghost replay race")) + L"\n"; name6 += _("Race against ghost karts and try to beat them!"); w2->addItem( name6, IDENT_GHOST, "/gui/icons/mode_ghost.png"); w2->updateItemDisplay(); // restore saved game mode switch (UserConfigParams::m_game_mode) { case CONFIG_CODE_NORMAL : w2->setSelection(IDENT_STD, PLAYER_ID_GAME_MASTER, true); break; case CONFIG_CODE_TIMETRIAL : w2->setSelection(IDENT_TTRIAL, PLAYER_ID_GAME_MASTER, true); break; case CONFIG_CODE_FTL : w2->setSelection(IDENT_FTL, PLAYER_ID_GAME_MASTER, true); break; case CONFIG_CODE_3STRIKES : w2->setSelection(IDENT_STRIKES, PLAYER_ID_GAME_MASTER, true); break; case CONFIG_CODE_EASTER : w2->setSelection(IDENT_EASTER, PLAYER_ID_GAME_MASTER, true); break; case CONFIG_CODE_SOCCER : w2->setSelection(IDENT_SOCCER, PLAYER_ID_GAME_MASTER, true); break; case CONFIG_CODE_GHOST : w2->setSelection(IDENT_GHOST, PLAYER_ID_GAME_MASTER, true); break; } { RibbonWidget* w = getWidget<RibbonWidget>("difficulty"); assert(w != NULL); int index = w->findItemNamed("best"); Widget* hardestWidget = &w->getChildren()[index]; if (PlayerManager::getCurrentPlayer()->isLocked("difficulty_best")) { hardestWidget->setBadge(LOCKED_BADGE); hardestWidget->setActive(false); } else { hardestWidget->unsetBadge(LOCKED_BADGE); hardestWidget->setActive(true); } } } // init