Merge remote-tracking branch 'origin/master' into buffer-log-messages

This commit is contained in:
hiker 2017-12-07 09:39:29 +11:00
commit 2810d2ad7d
4 changed files with 55 additions and 18 deletions

View File

@ -581,20 +581,20 @@ bool FeatureUnlockedCutScene::onEscapePressed()
void FeatureUnlockedCutScene::continueButtonPressed() void FeatureUnlockedCutScene::continueButtonPressed()
{ {
//if (m_global_time < GIFT_EXIT_TO) if (m_global_time < GIFT_EXIT_TO)
//{ {
// // If animation was not over yet, the button is used to skip the animation // If animation was not over yet, the button is used to skip the animation
// while (m_global_time < GIFT_EXIT_TO) while (m_global_time < GIFT_EXIT_TO)
// { {
// // simulate all the steps of the animation until we reach the end // simulate all the steps of the animation until we reach the end
// onUpdate(0.4f); onUpdate(0.4f);
// World::getWorld()->updateWorld(0.4f); World::getWorld()->updateWorld(0.4f);
// } }
//} }
//else else
//{ {
((CutsceneWorld*)World::getWorld())->abortCutscene(); ((CutsceneWorld*)World::getWorld())->abortCutscene();
//} }
} // continueButtonPressed } // continueButtonPressed

View File

@ -1571,6 +1571,39 @@ void Track::createWater(const XMLNode &node)
scene_node->getMaterial(0).setFlag(video::EMF_GOURAUD_SHADING, true); scene_node->getMaterial(0).setFlag(video::EMF_GOURAUD_SHADING, true);
} // createWater } // 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, /** This function load the actual scene, i.e. all parts of the track,
* animations, items, ... It is called from world during initialisation. * 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>(); auto* ln = p.first->getPresentation<TrackObjectPresentationLibraryNode>();
assert(ln); 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(); model_def_loader.cleanLibraryNodesAfterLoad();

View File

@ -374,7 +374,7 @@ private:
/** List of all bezier curves in the track - for e.g. camera, ... */ /** List of all bezier curves in the track - for e.g. camera, ... */
std::vector<BezierCurve*> m_all_curves; 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. /** The number of laps the track will be raced in a random GP.
* m_actual_number_of_laps is initialised with this value.*/ * 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); } void addCachedMesh(scene::IMesh* mesh) { m_all_cached_meshes.push_back(mesh); }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Adds the parent of the meta library for correction later */ /** 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); } { m_meta_library.emplace_back(parent, meta_library); }
}; // class Track }; // class Track

View File

@ -163,8 +163,7 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent,
m_presentation = new TrackObjectPresentationLibraryNode(this, xml_node, model_def_loader); m_presentation = new TrackObjectPresentationLibraryNode(this, xml_node, model_def_loader);
if (parent_library != NULL) if (parent_library != NULL)
{ {
Track::getCurrentTrack()->addMetaLibrary(parent_library, Track::getCurrentTrack()->addMetaLibrary(parent_library, this);
(dynamic_cast<TrackObjectPresentationLibraryNode*>(m_presentation))->getNode());
} }
} }
else if (type == "sfx-emitter") else if (type == "sfx-emitter")