temporary work around for multiplayer kart selection
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3855 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
808aa8bfea
commit
3119dec5c2
@ -170,7 +170,6 @@ InputDevice *DeviceManager::mapKeyboardInput( int deviceID,
|
||||
if (m_assign_mode == NO_ASSIGN) // Don't set the player in NO_ASSIGN mode
|
||||
{
|
||||
*player = NULL;
|
||||
if (!progGen) m_latest_used_device = keyboard;
|
||||
}
|
||||
else *player = keyboard->m_player;
|
||||
}
|
||||
@ -198,8 +197,6 @@ InputDevice *DeviceManager::mapGamepadInput( Input::InputType type,
|
||||
if (m_assign_mode == NO_ASSIGN) // Don't set the player in NO_ASSIGN mode
|
||||
{
|
||||
*player = NULL;
|
||||
// IT_STICKMOTION happens all the time, don't consider it discrete input
|
||||
if ((!progGen) && (type == Input::IT_STICKBUTTON)) m_latest_used_device = gPad;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -241,6 +238,7 @@ bool DeviceManager::translateInput( Input::InputType type,
|
||||
};
|
||||
|
||||
// Return true if input was successfully translated to an action and player
|
||||
if (device != NULL) m_latest_used_device = device;
|
||||
return (device != NULL);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -382,12 +382,31 @@ class KartHoverListener : public RibbonGridHoverListener
|
||||
public:
|
||||
void onSelectionChanged(RibbonGridWidget* theWidget, const std::string& selectionID)
|
||||
{
|
||||
InputDevice *device;
|
||||
ActivePlayer *player;
|
||||
int pKartIndex = -1;
|
||||
//std::cout << "hovered " << selectionID.c_str() << std::endl;
|
||||
|
||||
if(selectionID.size() == 0) return;
|
||||
// FIXME: temporary work around for multiplayer support on the kart selection screen
|
||||
// The ribbon grid widget needs to be rewritten to support multiple selection boxes
|
||||
|
||||
// TODO : support players other than player 0 (i.e. multiplayer)
|
||||
ModelViewWidget* w3 = g_player_karts[0].modelView;
|
||||
device = input_manager->getDeviceList()->getLatestUsedDevice();
|
||||
if(selectionID.size() == 0) return;
|
||||
if((player = device->getPlayer()) == NULL) return;
|
||||
|
||||
for (int n = 0; (n < g_player_karts.size() && pKartIndex == -1); n++)
|
||||
{
|
||||
if (g_player_karts[n].m_associatedPlayer == player)
|
||||
pKartIndex = n;
|
||||
}
|
||||
if (pKartIndex == -1)
|
||||
{
|
||||
fprintf(stderr, "onSelectionChanged(): Unable to determine kart associated with device\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ModelViewWidget* w3 = g_player_karts[pKartIndex].modelView;
|
||||
assert( w3 != NULL );
|
||||
|
||||
const KartProperties* kart = kart_properties_manager->getKart(selectionID);
|
||||
@ -402,8 +421,8 @@ class KartHoverListener : public RibbonGridHoverListener
|
||||
w3->addModel( kartModel->getWheelModel(3), kartModel->getWheelGraphicsPosition(3) );
|
||||
w3->update(0);
|
||||
|
||||
// TODO : support players other than player 0 (i.e. multiplayer)
|
||||
g_player_karts[0].kartName->setText( kart->getName().c_str() );
|
||||
|
||||
g_player_karts[pKartIndex].kartName->setText( kart->getName().c_str() );
|
||||
}
|
||||
};
|
||||
KartHoverListener* karthoverListener = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user