Merge branch 'master' of github.com:supertuxkart/stk-code
This commit is contained in:
commit
d070474445
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -297,30 +297,34 @@ void RaceManager::startNew(bool from_overworld)
|
||||
m_num_laps = m_grand_prix.getLaps();
|
||||
m_reverse_track = m_grand_prix.getReverse();
|
||||
|
||||
// We look if Player 1 has a saved version of this GP.
|
||||
m_saved_gp = SavedGrandPrix::getSavedGP(
|
||||
StateManager::get()
|
||||
->getActivePlayerProfile(0)
|
||||
->getUniqueID(),
|
||||
m_grand_prix.getId(),
|
||||
m_player_karts.size());
|
||||
|
||||
// Saved GP only in offline mode
|
||||
if (m_continue_saved_gp && !NetworkWorld::getInstance<NetworkWorld>()->isRunning())
|
||||
if (!NetworkWorld::getInstance<NetworkWorld>()->isRunning())
|
||||
{
|
||||
if (m_saved_gp == NULL)
|
||||
// We look if Player 1 has a saved version of this GP.
|
||||
m_saved_gp = SavedGrandPrix::getSavedGP(
|
||||
StateManager::get()
|
||||
->getActivePlayerProfile(0)
|
||||
->getUniqueID(),
|
||||
m_grand_prix.getId(),
|
||||
m_player_karts.size());
|
||||
|
||||
// Saved GP only in offline mode
|
||||
if (m_continue_saved_gp)
|
||||
{
|
||||
Log::error("Race Manager", "Can not continue Grand Prix '%s'"
|
||||
"because it could not exist",
|
||||
m_grand_prix.getId().c_str());
|
||||
m_continue_saved_gp = false; // simple and working
|
||||
}
|
||||
else
|
||||
{
|
||||
setNumKarts(m_saved_gp->getTotalKarts());
|
||||
setupPlayerKartInfo();
|
||||
m_grand_prix.changeReverse((GrandPrixData::GPReverseType)m_saved_gp->getReverseType());
|
||||
m_reverse_track = m_grand_prix.getReverse();
|
||||
if (m_saved_gp == NULL)
|
||||
{
|
||||
Log::error("Race Manager", "Can not continue Grand Prix '%s'"
|
||||
"because it could not exist",
|
||||
m_grand_prix.getId().c_str());
|
||||
m_continue_saved_gp = false; // simple and working
|
||||
}
|
||||
else
|
||||
{
|
||||
setNumKarts(m_saved_gp->getTotalKarts());
|
||||
setupPlayerKartInfo();
|
||||
m_grand_prix.changeReverse((GrandPrixData::GPReverseType)
|
||||
m_saved_gp->getReverseType());
|
||||
m_reverse_track = m_grand_prix.getReverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -381,13 +385,21 @@ void RaceManager::startNew(bool from_overworld)
|
||||
{
|
||||
if (m_continue_saved_gp)
|
||||
{
|
||||
m_track_number = m_saved_gp->getNextTrack();
|
||||
m_track_number = m_saved_gp->getNextTrack();
|
||||
m_saved_gp->loadKarts(m_kart_status);
|
||||
}
|
||||
else if (m_saved_gp != NULL)
|
||||
else
|
||||
{
|
||||
m_saved_gp->remove();
|
||||
m_saved_gp = NULL;
|
||||
while (m_saved_gp != NULL)
|
||||
{
|
||||
m_saved_gp->remove();
|
||||
m_saved_gp = SavedGrandPrix::getSavedGP(
|
||||
StateManager::get()
|
||||
->getActivePlayerProfile(0)
|
||||
->getUniqueID(),
|
||||
m_grand_prix.getId(),
|
||||
m_player_karts.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -516,17 +528,7 @@ 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();
|
||||
}
|
||||
saveGP();
|
||||
}
|
||||
startNextRace();
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
@ -135,10 +135,14 @@ void GPInfoScreen::beforeAddingWidget()
|
||||
StateManager::get()->getActivePlayerProfile(0)->getUniqueID(),
|
||||
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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user