Merge branch 'master' of github.com:supertuxkart/stk-code

This commit is contained in:
hiker 2015-01-08 08:11:30 +11:00
commit d070474445
5 changed files with 64 additions and 50 deletions

View File

@ -51,8 +51,8 @@ void main(void)
mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin, Orientation, Scale) * InverseViewMatrix);
gl_Position = ProjectionViewMatrix * ModelMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 1.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 1.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 0.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 0.)).xyz;
uv = Texcoord;
uv_bis = SecondTexcoord;
color = Color.zyxw;

View File

@ -48,8 +48,8 @@ void main(void)
mat4 TransposeInverseModelView = transpose(InverseModelMatrix * InverseViewMatrix);
gl_Position = ModelViewProjectionMatrix * vec4(Position, 1.);
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 1.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 1.)).xyz;
tangent = (TransposeInverseModelView * vec4(Tangent, 0.)).xyz;
bitangent = (TransposeInverseModelView * vec4(Bitangent, 0.)).xyz;
uv = (TextureMatrix * vec4(Texcoord, 1., 1.)).xy;
uv_bis = SecondTexcoord;
}

View File

@ -297,6 +297,8 @@ void RaceManager::startNew(bool from_overworld)
m_num_laps = m_grand_prix.getLaps();
m_reverse_track = m_grand_prix.getReverse();
if (!NetworkWorld::getInstance<NetworkWorld>()->isRunning())
{
// We look if Player 1 has a saved version of this GP.
m_saved_gp = SavedGrandPrix::getSavedGP(
StateManager::get()
@ -306,7 +308,7 @@ void RaceManager::startNew(bool from_overworld)
m_player_karts.size());
// Saved GP only in offline mode
if (m_continue_saved_gp && !NetworkWorld::getInstance<NetworkWorld>()->isRunning())
if (m_continue_saved_gp)
{
if (m_saved_gp == NULL)
{
@ -319,11 +321,13 @@ void RaceManager::startNew(bool from_overworld)
{
setNumKarts(m_saved_gp->getTotalKarts());
setupPlayerKartInfo();
m_grand_prix.changeReverse((GrandPrixData::GPReverseType)m_saved_gp->getReverseType());
m_grand_prix.changeReverse((GrandPrixData::GPReverseType)
m_saved_gp->getReverseType());
m_reverse_track = m_grand_prix.getReverse();
}
}
}
}
// command line parameters: negative numbers=all karts
if(m_num_karts < 0 ) m_num_karts = stk_config->m_max_karts;
@ -384,10 +388,18 @@ void RaceManager::startNew(bool from_overworld)
m_track_number = m_saved_gp->getNextTrack();
m_saved_gp->loadKarts(m_kart_status);
}
else if (m_saved_gp != NULL)
else
{
while (m_saved_gp != NULL)
{
m_saved_gp->remove();
m_saved_gp = NULL;
m_saved_gp = SavedGrandPrix::getSavedGP(
StateManager::get()
->getActivePlayerProfile(0)
->getUniqueID(),
m_grand_prix.getId(),
m_player_karts.size());
}
}
}
@ -516,18 +528,8 @@ void RaceManager::next()
if(m_major_mode==MAJOR_MODE_GRAND_PRIX && !NetworkWorld::getInstance()->isRunning())
{
// Saving GP state
// If Player 1 has already saved a GP, we adapt it
if(m_saved_gp != NULL)
{
m_saved_gp->setKarts(m_kart_status);
m_saved_gp->setNextTrack(m_track_number);
user_config->saveConfig();
}
else
{
saveGP();
}
}
startNextRace();
}
else
@ -539,18 +541,26 @@ void RaceManager::next()
//-----------------------------------------------------------------------------
void RaceManager::saveGP()
{
UserConfigParams::m_saved_grand_prix_list.push_back(
new SavedGrandPrix(
StateManager::get()->getActivePlayerProfile(0)
->getUniqueID(),
// If Player 1 has already saved a GP, we adapt it
if (m_saved_gp != NULL)
{
m_saved_gp->setKarts(m_kart_status);
m_saved_gp->setNextTrack(m_track_number);
}
else
{
m_saved_gp = new SavedGrandPrix(
StateManager::get()->getActivePlayerProfile(0)->getUniqueID(),
m_grand_prix.getId(),
m_difficulty,
(int)m_player_karts.size(),
m_track_number,
m_grand_prix.getReverseType(),
m_kart_status
)
);
m_kart_status);
UserConfigParams::m_saved_grand_prix_list.push_back(m_saved_gp);
}
user_config->saveConfig();
}

View File

@ -136,9 +136,13 @@ void GPInfoScreen::beforeAddingWidget()
m_gp.getId(),
race_manager->getNumLocalPlayers());
int tracks = m_gp.getTrackNames().size();
bool continue_visible = saved_gp && saved_gp->getNextTrack() > 0 &&
saved_gp->getNextTrack() < tracks;
RibbonWidget* ribbonButtons = getWidget<RibbonWidget>("buttons");
int id_continue_button = ribbonButtons->findItemNamed("continue");
ribbonButtons->setItemVisible(id_continue_button, saved_gp != NULL);
ribbonButtons->setItemVisible(id_continue_button, continue_visible);
ribbonButtons->setLabel(id_continue_button, _("Continue saved GP"));
}
else

View File

@ -395,7 +395,7 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
void RaceResultGUI::onConfirm()
{
race_manager->saveGP(); // Save the aborted GP
//race_manager->saveGP(); // Save the aborted GP
GUIEngine::ModalDialog::dismiss();
cleanupGPProgress();
StateManager::get()->popMenu();