diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-11-30 21:34:43 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-11-30 21:34:43 -0500 |
commit | cc2a768ff19e9fc83661a51d4cb4fef9b354ff30 (patch) | |
tree | 36a29f6c442c9e1386d00348b3db93fd12ab4979 /src/components.cpp | |
parent | 1024fe8305e5b0a7bb1f660a1cee077172d84534 (diff) |
quest work
Diffstat (limited to 'src/components.cpp')
-rw-r--r-- | src/components.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/components.cpp b/src/components.cpp index eb9fb0e..a398bec 100644 --- a/src/components.cpp +++ b/src/components.cpp @@ -93,7 +93,7 @@ void RenderSystem::update(entityx::EntityManager &en, entityx::EventManager &ev, if (entity.has_component<Animate>()) { sprite.sprite = entity.component<Animate>().get()->nextFrame(); } - + for (auto &S : sprite.sprite) { float width = HLINES(S.first.size.x); float height = HLINES(S.first.size.y); @@ -115,9 +115,9 @@ void RenderSystem::update(entityx::EntityManager &en, entityx::EventManager &ev, float flashAmt = 1-(hitDuration/maxHitDuration); glUniform4f(Render::worldShader.uniform[WU_tex_color], 1.0, flashAmt, flashAmt, 1.0); }*/ - + glBindTexture(GL_TEXTURE_2D, S.first.pic); - + glUniform1i(Render::worldShader.uniform[WU_texture], 0); Render::worldShader.enable(); @@ -187,24 +187,29 @@ void DialogSystem::receive(const MouseClickEvent &mce) auto qxml = exml->FirstChildElement("quest"); if (qxml != nullptr) { - std::string qname; + const char *qname; auto qsys = game::engine.getSystem<QuestSystem>(); do { // assign quest - qname = qxml->StrAttribute("assign"); - if (!qname.empty()) { + qname = qxml->Attribute("assign"); + if (qname != nullptr) { questAssignedText = qname; - qsys->assign(qname, qxml->StrAttribute("desc"), "req"); // gettext() for req + auto req = qxml->GetText(); + qsys->assign(qname, qxml->StrAttribute("desc"), req ? req : ""); } // check / finish quest else { - qname = qxml->StrAttribute("check"); - if (!(qname.empty() && qsys->hasQuest(qname) && qsys->finish(qname))) { - ui::dialogBox(name.name, "", false, "Finish my quest u nug"); - ui::waitForDialog(); - return; + qname = qxml->Attribute("check"); + if (qname != nullptr) { + if (qname != nullptr && qsys->hasQuest(qname) && qsys->finish(qname) == 0) { + d.index = 9999; + } else { + ui::dialogBox(name.name, "", false, "Finish my quest u nug"); + ui::waitForDialog(); + return; + } // oldidx = d.index; // d.index = qxml->UnsignedAttribute("fail"); // goto COMMONAIFUNC; @@ -226,7 +231,7 @@ void DialogSystem::receive(const MouseClickEvent &mce) ui::waitForDialog(); if (!questAssignedText.empty()) - ui::passiveImportantText(4000, ("Quest assigned:\n\"" + questAssignedText + "\"").c_str()); + ui::passiveImportantText(5000, ("Quest assigned:\n\"" + questAssignedText + "\"").c_str()); if (exml->QueryIntAttribute("nextid", &newIndex) == XML_NO_ERROR) d.index = newIndex; @@ -272,7 +277,7 @@ std::vector<Frame> developFrame(XMLElement* xml) tmp.push_back(tmpf); } // if it's not a frame we don't care - + // parse next frame framexml = framexml->NextSiblingElement(); } |