working karts online selection

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13405 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hilnius 2013-08-01 23:28:21 +00:00
parent 55bd9e18fd
commit 9ec58bbcb1
2 changed files with 53 additions and 51 deletions

View File

@ -1504,6 +1504,59 @@ void KartSelectionScreen::playerConfirm(const int playerID)
if (allPlayersReady && (!m_multiplayer || amount > 1)) allPlayersDone();
} // playerConfirm
// ----------------------------------------------------------------------------
void KartSelectionScreen::considerKartHovered(uint8_t widget_id, std::string selection)
{
ModelViewWidget* w3 = m_kart_widgets[widget_id].m_model_view;
assert( w3 != NULL );
if (selection == RANDOM_KART_ID)
{
// Random kart
scene::IMesh* model =
ItemManager::getItemModel(Item::ITEM_BONUS_BOX);
w3->clearModels();
w3->addModel( model, Vec3(0.0f, -12.0f, 0.0f),
Vec3(35.0f, 35.0f, 35.0f) );
w3->update(0);
m_kart_widgets[widget_id].m_kart_name->setText(
_("Random Kart"), false );
}
else
{
const KartProperties *kp =
kart_properties_manager->getKart(selection);
if (kp != NULL)
{
const KartModel &kart_model = kp->getMasterKartModel();
w3->clearModels();
w3->addModel( kart_model.getModel(), Vec3(0,0,0),
Vec3(35.0f, 35.0f, 35.0f),
kart_model.getBaseFrame() );
w3->addModel( kart_model.getWheelModel(0),
kart_model.getWheelGraphicsPosition(0) );
w3->addModel( kart_model.getWheelModel(1),
kart_model.getWheelGraphicsPosition(1) );
w3->addModel( kart_model.getWheelModel(2),
kart_model.getWheelGraphicsPosition(2) );
w3->addModel( kart_model.getWheelModel(3),
kart_model.getWheelGraphicsPosition(3) );
w3->update(0);
m_kart_widgets[widget_id].m_kart_name->setText(
selection.c_str(), false );
}
else
{
fprintf(stderr, "[KartSelectionScreen] WARNING: could not "
"find a kart named '%s'\n",
selection.c_str());
}
}
}
// ----------------------------------------------------------------------------
/**
* Callback handling events from the kart selection menu

View File

@ -132,57 +132,6 @@ void NetworkKartSelectionScreen::playerConfirm(const int playerID)
}
}
void NetworkKartSelectionScreen::considerKartHovered(uint8_t widget_id, std::string selection)
{
ModelViewWidget* w3 = m_kart_widgets[widget_id].m_model_view;
assert( w3 != NULL );
if (selection == RANDOM_KART_ID)
{
// Random kart
scene::IMesh* model =
ItemManager::getItemModel(Item::ITEM_BONUS_BOX);
w3->clearModels();
w3->addModel( model, Vec3(0.0f, -12.0f, 0.0f),
Vec3(35.0f, 35.0f, 35.0f) );
w3->update(0);
m_kart_widgets[widget_id].m_kart_name->setText(
_("Random Kart"), false );
}
else
{
const KartProperties *kp =
kart_properties_manager->getKart(selection);
if (kp != NULL)
{
const KartModel &kart_model = kp->getMasterKartModel();
//w3->clearModels();
w3->addModel( kart_model.getModel(), Vec3(0,0,0),
Vec3(35.0f, 35.0f, 35.0f),
kart_model.getBaseFrame() );
w3->addModel( kart_model.getWheelModel(0),
kart_model.getWheelGraphicsPosition(0) );
w3->addModel( kart_model.getWheelModel(1),
kart_model.getWheelGraphicsPosition(1) );
w3->addModel( kart_model.getWheelModel(2),
kart_model.getWheelGraphicsPosition(2) );
w3->addModel( kart_model.getWheelModel(3),
kart_model.getWheelGraphicsPosition(3) );
w3->update(0);
m_kart_widgets[widget_id].m_kart_name->setText(
selection.c_str(), false );
}
else
{
fprintf(stderr, "[KartSelectionScreen] WARNING: could not "
"find a kart named '%s'\n",
selection.c_str());
}
}
}
void NetworkKartSelectionScreen::playerSelected(uint8_t race_id, std::string kart_name)
{
uint8_t widget_id = -1;