Minor changes in soccer mode

- scoring points correctly
 - goal text only on the center of screen, not everywhere
 - soccer mode enabled only in multiplayer
 - disable rotating after player confirmation - should look the same as in kart selection
 - restore master-player-only after back to race setup

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13680 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
deveee 2013-09-14 12:08:22 +00:00
parent bf11fb4076
commit 07a3c4f3d5
3 changed files with 11 additions and 7 deletions

View File

@ -105,9 +105,9 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal)
{ {
//I18N: soccer mode //I18N: soccer mode
m_race_gui->addMessage(_("GOAL!"), NULL, m_race_gui->addMessage(_("GOAL!"), NULL,
/* time */ 3.0f, /* time */ 5.0f,
video::SColor(255,255,255,255), video::SColor(255,255,255,255),
/*important*/ true, /*important*/ false,
/*big font*/ true); /*big font*/ true);
m_team_goals[first_goal ? 0 : 1]++; m_team_goals[first_goal ? 0 : 1]++;
//printf("Score:\nTeam One %d : %d Team Two\n", m_team_goals[0], m_team_goals[1]); //printf("Score:\nTeam One %d : %d Team Two\n", m_team_goals[0], m_team_goals[1]);
@ -390,11 +390,11 @@ AbstractKart *SoccerWorld::createKart(const std::string &kart_ident, int index,
int posIndex = index; int posIndex = index;
if(race_manager->getLocalKartInfo(index).getSoccerTeam() == SOCCER_TEAM_RED) if(race_manager->getLocalKartInfo(index).getSoccerTeam() == SOCCER_TEAM_RED)
{ {
if(index % 2 != 0) posIndex += 1; if(index % 2 != 1) posIndex += 1;
} }
else if(race_manager->getLocalKartInfo(index).getSoccerTeam() == SOCCER_TEAM_BLUE) else if(race_manager->getLocalKartInfo(index).getSoccerTeam() == SOCCER_TEAM_BLUE)
{ {
if(index % 2 != 1) posIndex += 1; if(index % 2 != 0) posIndex += 1;
} }
int position = index+1; int position = index+1;
btTransform init_pos = m_track->getStartTransform(posIndex); btTransform init_pos = m_track->getStartTransform(posIndex);

View File

@ -19,6 +19,7 @@
#include "guiengine/widgets/dynamic_ribbon_widget.hpp" #include "guiengine/widgets/dynamic_ribbon_widget.hpp"
#include "guiengine/widgets/ribbon_widget.hpp" #include "guiengine/widgets/ribbon_widget.hpp"
#include "guiengine/widgets/spinner_widget.hpp" #include "guiengine/widgets/spinner_widget.hpp"
#include "input/input_manager.hpp"
#include "io/file_manager.hpp" #include "io/file_manager.hpp"
#include "race/race_manager.hpp" #include "race/race_manager.hpp"
#include "states_screens/arenas_screen.hpp" #include "states_screens/arenas_screen.hpp"
@ -222,6 +223,7 @@ void RaceSetupScreen::onGameModeChanged()
void RaceSetupScreen::init() void RaceSetupScreen::init()
{ {
Screen::init(); Screen::init();
input_manager->setMasterPlayerOnly(true);
RibbonWidget* w = getWidget<RibbonWidget>("difficulty"); RibbonWidget* w = getWidget<RibbonWidget>("difficulty");
assert( w != NULL ); assert( w != NULL );
@ -288,6 +290,7 @@ void RaceSetupScreen::init()
} }
#ifdef ENABLE_SOCCER_MODE #ifdef ENABLE_SOCCER_MODE
if (race_manager->getNumLocalPlayers() > 1 || UserConfigParams::m_artist_debug_mode)
{ {
irr::core::stringw name5 = irr::core::stringw( irr::core::stringw name5 = irr::core::stringw(
RaceManager::getNameOf(RaceManager::MINOR_MODE_SOCCER)) + L"\n"; RaceManager::getNameOf(RaceManager::MINOR_MODE_SOCCER)) + L"\n";

View File

@ -35,7 +35,7 @@ using namespace GUIEngine;
DEFINE_SCREEN_SINGLETON( SoccerSetupScreen ); DEFINE_SCREEN_SINGLETON( SoccerSetupScreen );
#define KART_CONTINUOUS_ROTATION_SPEED 35.f #define KART_CONTINUOUS_ROTATION_SPEED 35.f
#define KART_CONFIRMATION_ROTATION_SPEED 4.f #define KART_CONFIRMATION_ROTATION_SPEED 0.f
#define KART_CONFIRMATION_TARGET_ANGLE 10.f #define KART_CONFIRMATION_TARGET_ANGLE 10.f
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -57,6 +57,7 @@ void SoccerSetupScreen::eventCallback(Widget* widget, const std::string& name, c
{ {
StateManager::get()->pushScreen( ArenasScreen::getInstance() ); StateManager::get()->pushScreen( ArenasScreen::getInstance() );
race_manager->setMaxGoal(getWidget<SpinnerWidget>("goalamount")->getValue()); race_manager->setMaxGoal(getWidget<SpinnerWidget>("goalamount")->getValue());
input_manager->setMasterPlayerOnly(true);
} }
else if (name == "back") else if (name == "back")
{ {
@ -147,7 +148,7 @@ void SoccerSetupScreen::init()
bt_continue->setDeactivated(); bt_continue->setDeactivated();
// We need players to be able to choose their teams // We need players to be able to choose their teams
input_manager->getDeviceList()->setAssignMode(ASSIGN); //~ input_manager->getDeviceList()->setAssignMode(ASSIGN);
input_manager->setMasterPlayerOnly(false); input_manager->setMasterPlayerOnly(false);
} }
@ -244,7 +245,7 @@ GUIEngine::EventPropagation SoccerSetupScreen::filterActions( PlayerAction acti
ButtonWidget* bt_continue = getWidget<ButtonWidget>("continue"); ButtonWidget* bt_continue = getWidget<ButtonWidget>("continue");
if(areAllKartsConfirmed()) if(areAllKartsConfirmed())
{ {
bt_continue->setFocusForPlayer(PLAYER_ID_GAME_MASTER); //~ bt_continue->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
bt_continue->setActivated(); bt_continue->setActivated();
for(int i=0 ; i < nb_players ; i++) for(int i=0 ; i < nb_players ; i++)