Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5b296b08f9
@ -581,20 +581,20 @@ bool FeatureUnlockedCutScene::onEscapePressed()
|
||||
|
||||
void FeatureUnlockedCutScene::continueButtonPressed()
|
||||
{
|
||||
//if (m_global_time < GIFT_EXIT_TO)
|
||||
//{
|
||||
// // If animation was not over yet, the button is used to skip the animation
|
||||
// while (m_global_time < GIFT_EXIT_TO)
|
||||
// {
|
||||
// // simulate all the steps of the animation until we reach the end
|
||||
// onUpdate(0.4f);
|
||||
// World::getWorld()->updateWorld(0.4f);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
if (m_global_time < GIFT_EXIT_TO)
|
||||
{
|
||||
// If animation was not over yet, the button is used to skip the animation
|
||||
while (m_global_time < GIFT_EXIT_TO)
|
||||
{
|
||||
// simulate all the steps of the animation until we reach the end
|
||||
onUpdate(0.4f);
|
||||
World::getWorld()->updateWorld(0.4f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
//}
|
||||
}
|
||||
|
||||
} // continueButtonPressed
|
||||
|
||||
|
@ -1571,6 +1571,39 @@ void Track::createWater(const XMLNode &node)
|
||||
scene_node->getMaterial(0).setFlag(video::EMF_GOURAUD_SHADING, true);
|
||||
} // createWater
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static void recursiveUpdatePosition(scene::ISceneNode *node)
|
||||
{
|
||||
node->updateAbsolutePosition();
|
||||
|
||||
scene::ISceneNodeList::ConstIterator it = node->getChildren().begin();
|
||||
for (; it != node->getChildren().end(); ++it)
|
||||
{
|
||||
recursiveUpdatePosition(*it);
|
||||
}
|
||||
} // recursiveUpdatePosition
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
static void recursiveUpdatePhysics(std::vector<TrackObject*>& tos)
|
||||
{
|
||||
for (TrackObject* to : tos)
|
||||
{
|
||||
if (to->getPhysicalObject())
|
||||
{
|
||||
TrackObjectPresentationSceneNode* sn = to
|
||||
->getPresentation<TrackObjectPresentationSceneNode>();
|
||||
if (sn)
|
||||
{
|
||||
to->getPhysicalObject()->move(
|
||||
sn->getNode()->getAbsoluteTransformation().getTranslation(),
|
||||
sn->getNode()->getAbsoluteTransformation()
|
||||
.getRotationDegrees());
|
||||
}
|
||||
}
|
||||
recursiveUpdatePhysics(to->getChildren());
|
||||
}
|
||||
} // recursiveUpdatePhysics
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** This function load the actual scene, i.e. all parts of the track,
|
||||
* animations, items, ... It is called from world during initialisation.
|
||||
@ -1763,7 +1796,12 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
|
||||
{
|
||||
auto* ln = p.first->getPresentation<TrackObjectPresentationLibraryNode>();
|
||||
assert(ln);
|
||||
p.second->setParent(ln->getNode());
|
||||
TrackObjectPresentationLibraryNode* meta_ln = p.second
|
||||
->getPresentation<TrackObjectPresentationLibraryNode>();
|
||||
assert(meta_ln);
|
||||
meta_ln->getNode()->setParent(ln->getNode());
|
||||
recursiveUpdatePosition(meta_ln->getNode());
|
||||
recursiveUpdatePhysics(p.second->getChildren());
|
||||
}
|
||||
|
||||
model_def_loader.cleanLibraryNodesAfterLoad();
|
||||
|
@ -374,7 +374,7 @@ private:
|
||||
/** List of all bezier curves in the track - for e.g. camera, ... */
|
||||
std::vector<BezierCurve*> m_all_curves;
|
||||
|
||||
std::vector<std::pair<TrackObject*, scene::ISceneNode*> > m_meta_library;
|
||||
std::vector<std::pair<TrackObject*, TrackObject*> > m_meta_library;
|
||||
|
||||
/** The number of laps the track will be raced in a random GP.
|
||||
* m_actual_number_of_laps is initialised with this value.*/
|
||||
@ -676,7 +676,7 @@ public:
|
||||
void addCachedMesh(scene::IMesh* mesh) { m_all_cached_meshes.push_back(mesh); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Adds the parent of the meta library for correction later */
|
||||
void addMetaLibrary(TrackObject* parent, scene::ISceneNode* meta_library)
|
||||
void addMetaLibrary(TrackObject* parent, TrackObject* meta_library)
|
||||
{ m_meta_library.emplace_back(parent, meta_library); }
|
||||
}; // class Track
|
||||
|
||||
|
@ -163,8 +163,7 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent,
|
||||
m_presentation = new TrackObjectPresentationLibraryNode(this, xml_node, model_def_loader);
|
||||
if (parent_library != NULL)
|
||||
{
|
||||
Track::getCurrentTrack()->addMetaLibrary(parent_library,
|
||||
(dynamic_cast<TrackObjectPresentationLibraryNode*>(m_presentation))->getNode());
|
||||
Track::getCurrentTrack()->addMetaLibrary(parent_library, this);
|
||||
}
|
||||
}
|
||||
else if (type == "sfx-emitter")
|
||||
|
Loading…
Reference in New Issue
Block a user