Move tutorial to help menu

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12489 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2013-02-16 16:43:13 +00:00
parent 6147636454
commit 020fc76df3
4 changed files with 42 additions and 37 deletions

Binary file not shown.

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<stkgui>
<div x="0" y="0" width="100%" height="100%" layout="vertical-row" >
@ -37,8 +38,6 @@
I18N="Main menu button" text="Options" label_location="hover"/>
<icon-button id="help" width="64" height="64" icon="gui/main_help.png" extend_label="50"
I18N="Main menu button" text="Help" label_location="hover"/>
<icon-button id="startTutorial" width="64" height="64" icon="gui/main_help.png" extend_label="150"
I18N="Main menu button" text="Tutorial" label_location="hover"/>
<icon-button id="about" width="64" height="64" icon="gui/main_about.png" extend_label="50"
I18N="Main menu button" text="About" label_location="hover"/>
<icon-button id="quit" width="64" height="64" icon="gui/main_quit.png" extend_label="50"

View File

@ -17,8 +17,14 @@
#include "states_screens/help_screen_1.hpp"
#include "challenges/unlock_manager.hpp"
#include "guiengine/widget.hpp"
#include "guiengine/widgets/ribbon_widget.hpp"
#include "input/device_manager.hpp"
#include "input/input_manager.hpp"
#include "karts/kart_properties_manager.hpp"
#include "network/network_manager.hpp"
#include "race/race_manager.hpp"
#include "states_screens/help_screen_2.hpp"
#include "states_screens/help_screen_3.hpp"
#include "states_screens/help_screen_4.hpp"
@ -44,7 +50,41 @@ void HelpScreen1::loadedFromFile()
void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "category")
if (name == "startTutorial")
{
race_manager->setNumLocalPlayers(1);
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
race_manager->setMinorMode (RaceManager::MINOR_MODE_TUTORIAL);
race_manager->setNumKarts( 1 );
race_manager->setTrack( "tutorial" );
race_manager->setDifficulty(RaceManager::DIFFICULTY_EASY);
// Use keyboard 0 by default (FIXME: let player choose?)
InputDevice* device = input_manager->getDeviceList()->getKeyboard(0);
// Create player and associate player with keyboard
StateManager::get()->createActivePlayer(unlock_manager->getCurrentPlayer(),
device);
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
{
fprintf(stderr, "[MainMenuScreen] WARNING: cannot find kart '%s', will revert to default\n",
UserConfigParams::m_default_kart.c_str());
UserConfigParams::m_default_kart.revertToDefaults();
}
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
// ASSIGN should make sure that only input from assigned devices
// is read.
input_manager->getDeviceList()->setAssignMode(ASSIGN);
input_manager->getDeviceList()
->setSinglePlayer( StateManager::get()->getActivePlayer(0) );
StateManager::get()->enterGameState();
network_manager->setupPlayerKartInfo();
race_manager->startNew(false);
}
else if (name == "category")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();

View File

@ -300,40 +300,6 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
{
StateManager::get()->pushScreen(HelpScreen1::getInstance());
}
else if (selection == "startTutorial")
{
race_manager->setNumLocalPlayers(1);
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
race_manager->setMinorMode (RaceManager::MINOR_MODE_TUTORIAL);
race_manager->setNumKarts( 1 );
race_manager->setTrack( "tutorial" );
race_manager->setDifficulty(RaceManager::DIFFICULTY_EASY);
// Use keyboard 0 by default (FIXME: let player choose?)
InputDevice* device = input_manager->getDeviceList()->getKeyboard(0);
// Create player and associate player with keyboard
StateManager::get()->createActivePlayer(unlock_manager->getCurrentPlayer(),
device);
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
{
fprintf(stderr, "[MainMenuScreen] WARNING: cannot find kart '%s', will revert to default\n",
UserConfigParams::m_default_kart.c_str());
UserConfigParams::m_default_kart.revertToDefaults();
}
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
// ASSIGN should make sure that only input from assigned devices
// is read.
input_manager->getDeviceList()->setAssignMode(ASSIGN);
input_manager->getDeviceList()
->setSinglePlayer( StateManager::get()->getActivePlayer(0) );
StateManager::get()->enterGameState();
network_manager->setupPlayerKartInfo();
race_manager->startNew(false);
}
else if (selection == "story")
{
GameSlot* slot = unlock_manager->getCurrentSlot();