more improvements
This commit is contained in:
parent
b6d7834c85
commit
7978c25fc5
@ -679,16 +679,17 @@ void RaceManager::exitRace(bool delete_world)
|
||||
}
|
||||
}
|
||||
|
||||
if (delete_world) World::deleteWorld();
|
||||
delete_world = false;
|
||||
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
|
||||
if (someHumanPlayerWon)
|
||||
{
|
||||
if (delete_world) World::deleteWorld();
|
||||
delete_world = false;
|
||||
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("gpwin", 999, false);
|
||||
GrandPrixWin* scene = GrandPrixWin::getInstance();
|
||||
StateManager::get()->pushScreen(scene);
|
||||
@ -696,14 +697,6 @@ void RaceManager::exitRace(bool delete_world)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (delete_world) World::deleteWorld();
|
||||
delete_world = false;
|
||||
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("gplose", 999, false);
|
||||
GrandPrixLose* scene = GrandPrixLose::getInstance();
|
||||
StateManager::get()->pushScreen(scene);
|
||||
@ -714,10 +707,9 @@ void RaceManager::exitRace(bool delete_world)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "RaceManager::exitRace() : what's going on?? no winners and no losers??\n";
|
||||
std::vector<std::string> karts;
|
||||
karts.push_back(UserConfigParams::m_default_kart);
|
||||
scene->setKarts(karts);
|
||||
Log::error("RaceManager", "There are no winners and no losers."
|
||||
"This should have never happend\n");
|
||||
scene->setKarts({UserConfigParams::m_default_kart});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,25 +85,18 @@ DEFINE_SCREEN_SINGLETON( GrandPrixLose );
|
||||
|
||||
void GrandPrixLose::onCutsceneEnd()
|
||||
{
|
||||
if (m_kart_node[0] != NULL)
|
||||
m_kart_node[0]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
if (m_kart_node[1] != NULL)
|
||||
m_kart_node[1]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
if (m_kart_node[2] != NULL)
|
||||
m_kart_node[2]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
if (m_kart_node[3] != NULL)
|
||||
m_kart_node[3]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (m_kart_node[i] != NULL)
|
||||
m_kart_node[i]->getPresentation<TrackObjectPresentationSceneNode>()->getNode()->remove();
|
||||
m_kart_node[i] = NULL;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i<m_all_kart_models.size(); i++)
|
||||
delete m_all_kart_models[i];
|
||||
|
||||
m_all_kart_models.clear();
|
||||
|
||||
m_kart_node[0] = NULL;
|
||||
m_kart_node[1] = NULL;
|
||||
m_kart_node[2] = NULL;
|
||||
m_kart_node[3] = NULL;
|
||||
}
|
||||
} // onCutsceneEnd
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
|
||||
@ -179,9 +172,7 @@ void GrandPrixLose::setKarts(std::vector<std::string> ident_arg)
|
||||
|
||||
assert(ident_arg.size() > 0);
|
||||
if ((int)ident_arg.size() > MAX_KART_COUNT)
|
||||
{
|
||||
ident_arg.resize(MAX_KART_COUNT);
|
||||
}
|
||||
|
||||
// (there is at least one kart so kart node 0 is sure to be set)
|
||||
m_kart_node[1] = NULL;
|
||||
@ -219,7 +210,8 @@ void GrandPrixLose::setKarts(std::vector<std::string> ident_arg)
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "[GrandPrixLose] WARNING: could not find a kart named '%s'\n", ident_arg[n].c_str());
|
||||
Log::warn("GrandPrixLose", "A kart named '%s' could not be found\n",
|
||||
ident_arg[n].c_str());
|
||||
m_kart_node[n] = NULL;
|
||||
}// if kart !=NULL
|
||||
}
|
||||
|
@ -55,17 +55,11 @@ class GrandPrixLose :
|
||||
float m_kart_x, m_kart_y, m_kart_z;
|
||||
|
||||
public:
|
||||
virtual void onCutsceneEnd() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
|
||||
/** \brief implement optional callback from parent class GUIEngine::Screen */
|
||||
void onUpdate(float dt) OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
// implement callbacks from parent class GUIEngine::Screen
|
||||
void init() OVERRIDE;
|
||||
|
||||
void loadedFromFile() OVERRIDE;
|
||||
void onCutsceneEnd() OVERRIDE;
|
||||
void onUpdate(float dt) OVERRIDE;
|
||||
/** \brief set which karts lost this GP */
|
||||
void setKarts(std::vector<std::string> ident);
|
||||
};
|
||||
|
@ -236,7 +236,8 @@ void GrandPrixWin::onUpdate(float dt)
|
||||
}
|
||||
} // end for
|
||||
|
||||
if (karts_not_yet_done == 0) m_phase = 3;
|
||||
if (karts_not_yet_done == 0)
|
||||
m_phase = 3;
|
||||
}
|
||||
|
||||
// ---- Podium Rises
|
||||
|
@ -61,17 +61,11 @@ class GrandPrixWin :
|
||||
float m_kart_rotation[3];
|
||||
|
||||
public:
|
||||
|
||||
virtual void onCutsceneEnd() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE {};
|
||||
|
||||
/** \brief implement optional callback from parent class GUIEngine::Screen */
|
||||
void onUpdate(float dt) OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
// implement callbacks from parent class GUIEngine::Screen
|
||||
void init() OVERRIDE;
|
||||
void loadedFromFile() OVERRIDE {};
|
||||
void onCutsceneEnd() OVERRIDE;
|
||||
void onUpdate(float dt) OVERRIDE;
|
||||
|
||||
/** \pre must be called after pushing the screen, but before onUpdate had the chance to be invoked */
|
||||
void setKarts(const std::string idents[3]);
|
||||
|
Loading…
Reference in New Issue
Block a user