This commit is contained in:
Alayan
2018-10-13 20:28:35 +02:00
parent f813fbe562
commit 78b1d5c672
3 changed files with 18 additions and 4 deletions

View File

@@ -42,9 +42,9 @@
#include "physics/physics.hpp"
#include "race/history.hpp"
#include "replay/replay_recorder.hpp"
#include "states_screens/dialogs/splitscreen_player_dialog.hpp"
#include "states_screens/kart_selection.hpp"
#include "states_screens/main_menu_screen.hpp"
#include "states_screens/online/networking_lobby.hpp"
#include "states_screens/options/options_screen_device.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/debug.hpp"
@@ -729,10 +729,15 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID,
{
device = m_device_manager->getGamePadFromIrrID(deviceID);
}
if (device && (action == PA_FIRE || action == PA_MENU_SELECT))
if (device && (action == PA_FIRE || action == PA_MENU_SELECT) &&
!GUIEngine::ModalDialog::isADialogActive())
{
if (!GUIEngine::ModalDialog::isADialogActive())
new SplitscreenPlayerDialog(device);
GUIEngine::Screen* screen = GUIEngine::getCurrentScreen();
NetworkingLobby* lobby = dynamic_cast<NetworkingLobby*>(screen);
if (lobby!=NULL)
{
lobby->openSplitscreenDialog(device);
}
return;
}
}

View File

@@ -40,6 +40,7 @@
#include "network/protocols/client_lobby.hpp"
#include "network/server.hpp"
#include "network/stk_host.hpp"
#include "states_screens/dialogs/splitscreen_player_dialog.hpp"
#include "states_screens/state_manager.hpp"
#include "states_screens/dialogs/network_user_dialog.hpp"
#include "utils/translation.hpp"
@@ -500,6 +501,12 @@ void NetworkingLobby::updatePlayers(const std::vector<std::tuple<uint32_t,
updatePlayerPings();
} // updatePlayers
// ----------------------------------------------------------------------------
void NetworkingLobby::openSplitscreenDialog(InputDevice* device)
{
new SplitscreenPlayerDialog(device);
} // openSplitscreenDialog
// ----------------------------------------------------------------------------
void NetworkingLobby::addSplitscreenPlayer(irr::core::stringw name)
{

View File

@@ -25,6 +25,7 @@
#include <tuple>
#include <utility>
class InputDevice;
class Server;
enum KartTeam : int8_t;
@@ -136,6 +137,7 @@ public:
uint32_t/*online id*/, uint32_t/*local player id*/,
core::stringw/*player name*/, int/*icon id*/,
KartTeam> >& p);
void openSplitscreenDialog(InputDevice* device);
void addSplitscreenPlayer(irr::core::stringw name);
void cleanAddedPlayers();
void initAutoStartTimer(bool grand_prix_started, unsigned min_players,