X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FScene.cc;h=afbfa440f9f915f949feda5e459b7c4fa1d80c2e;hp=7b23ab6431e7a88da48ae3a5fdd38fc7e41a6b3d;hb=90b2c7fb10b244b781b84965a0d36f1f323ee94d;hpb=837bae9f2bf7b25e1d3d2625eeaf39c1d2f48827 diff --git a/src/Scene.cc b/src/Scene.cc index 7b23ab6..afbfa44 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -156,7 +156,7 @@ struct Scene::Impl : public Mf::Manager void init(const std::string& name) {} - void importSceneBindings(Mf::Script& script) + void importSceneBindings(Mf::Settings& settings, Mf::Script& script) { script.importFunction("SetBounds", boost::bind(&Impl::setBounds, this, _1)); @@ -176,7 +176,7 @@ struct Scene::Impl : public Mf::Manager boost::bind(&Impl::drawTile, this, _1)); int detail = 3; - Mf::settings.get("detail", detail); + settings.get("detail", detail); script.push(detail); script.set("detail"); script.push(1); script.set("LOW"); @@ -193,17 +193,17 @@ struct Scene::Impl : public Mf::Manager } - Mf::Script::Result load(Mf::Script& script) + Mf::Script::Result load(Mf::Settings& settings, Mf::Script& script) { - std::string filePath = Scene::getPath(getName()); - if (filePath == "") + std::string path(getName()); + if (!Scene::getPath(path)) { script.push("the scene file could not be found"); return Mf::Script::FILE_ERROR; } - importSceneBindings(script); - return script.doFile(filePath); + importSceneBindings(settings, script); + return script.doFile(path); } @@ -482,10 +482,10 @@ Scene::Scene(const std::string& name) : mImpl(Scene::Impl::getInstance(name)) {} -Mf::Script::Result Scene::load(Mf::Script& script) +Mf::Script::Result Scene::load(Mf::Settings& settings, Mf::Script& script) { // pass through - return mImpl->load(script); + return mImpl->load(settings, script); } @@ -526,14 +526,14 @@ void Scene::drawIfVisible(Mf::Scalar alpha, bool Scene::castRay(const Mf::Ray<2>& ray, - std::list::Intersection>& hits) const + std::list::Contact>& hits) const { std::list< Mf::Line<2> >& lines = mImpl->mLines; std::list< Mf::Line<2> >::const_iterator it; for (it = lines.begin(); it != lines.end(); ++it) { - Mf::Ray<2>::Intersection hit; + Mf::Ray<2>::Contact hit; Mf::Scalar d = (*it).intersectRay(ray, hit); if (d > 0.0) { @@ -609,8 +609,8 @@ bool Scene::checkForCollision(Character& character) } -std::string Scene::getPath(const std::string& name) +bool Scene::getPath(std::string& name) { - return Mf::Resource::getPath("scenes/" + name + ".lua"); + return Mf::Resource::getPath(name, "scenes/", "lua"); }