aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-07-02 09:58:12 -0400
committerClyne Sullivan <tullivan99@gmail.com>2016-07-02 09:58:12 -0400
commit6f13e748c526576198d197ad194f4c1d8fdadec0 (patch)
treee3f0d95544eb7e2e5125e739b2c73574d2e47fe0
parent40e0c5d15ee6cd24bdc305e40ae6895aca18e669 (diff)
new xml, wip quest menu
-rw-r--r--include/ui_quest.hpp38
-rw-r--r--src/entities.cpp3
-rw-r--r--src/ui.cpp6
-rw-r--r--xml/!town.xml (renamed from xml/town.xml)10
-rw-r--r--xml/playerSpawnHill1.xml37
-rw-r--r--xml/playerSpawnHill1_Building1.xml26
-rw-r--r--xml/playerSpawnHill2.xml8
7 files changed, 50 insertions, 78 deletions
diff --git a/include/ui_quest.hpp b/include/ui_quest.hpp
new file mode 100644
index 0000000..a0f3ad4
--- /dev/null
+++ b/include/ui_quest.hpp
@@ -0,0 +1,38 @@
+#ifndef UI_QUEST_HPP_
+#define UI_QUEST_HPP_
+
+#include <ui.hpp>
+#include <common.hpp>
+
+namespace ui {
+ namespace quest {
+ bool _toggle = false;
+
+ void toggle(void) {
+ _toggle ^= true;
+ }
+
+ void draw(void) {
+ if (!_toggle)
+ return;
+
+ float top_y = offset.y + 200;
+ ui::drawNiceBox(vec2 {offset.x - 200, top_y },
+ vec2 {offset.x + 200, offset.y - 200 },
+ -0.7f);
+
+ ui::putStringCentered(offset.x, top_y - 40, "Current Quests:");
+
+ auto y = top_y - 100;
+ const auto x = offset.x - 180;
+ for (const auto &q : player->qh.current) {
+ ui::putText(x, y, q.title.c_str());
+ y -= 20;
+ ui::putText(x + 40, y, q.desc.c_str());
+ y -= 40;
+ }
+ }
+ }
+}
+
+#endif // UI_QUEST_HPP_
diff --git a/src/entities.cpp b/src/entities.cpp
index e49d0ca..53d3aca 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -711,7 +711,7 @@ COMMONAIFUNC:
goto COMMONAIFUNC;
}
}
- } while((oxml = oxml->NextSiblingElement()));
+ } while((oxml = oxml->NextSiblingElement("quest")));
}
// handle give tags
@@ -743,6 +743,7 @@ COMMONAIFUNC:
}
// asdlfkj
+
auto txml = exml->FirstChildElement("content");
if (txml == nullptr)
goto OTHERSTUFF;
diff --git a/src/ui.cpp b/src/ui.cpp
index d5fc2ad..098f650 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -1,5 +1,6 @@
#include <ui.hpp>
+#include <ui_quest.hpp>
#include <brice.hpp>
#include <world.hpp>
#include <gametime.hpp>
@@ -909,6 +910,9 @@ namespace ui {
// will return if not toggled
action::draw(vec2 {player->loc.x + player->width / 2, player->loc.y + player->height + game::HLINE});
+ // will return if not toggled
+ quest::draw();
+
if (pageTexReady) {
GLfloat page_loc[] = {offset.x - 300, SCREEN_HEIGHT - 100, -6.0,
@@ -1540,6 +1544,8 @@ EXIT:
currentWorld->addObject(item->name, "o shit waddup",
player->loc.x + player->width / 2, player->loc.y + player->height / 2);
}
+ } else if (SDL_KEY == SDLK_h) {
+ quest::toggle();
} else switch (SDL_KEY) {
case SDLK_F3:
debug ^= true;
diff --git a/xml/town.xml b/xml/!town.xml
index 42d0bef..51fc08d 100644
--- a/xml/town.xml
+++ b/xml/!town.xml
@@ -4,8 +4,8 @@
<generation type="Random" width="1600"/>
<time>6000</time>
<spawnx>-300</spawnx>
- <npc name="Sanc" hasDialog="true" health="1" x="220.66983" y="63.798996" dindex="0"/>
- <npc name="Bob" hasDialog="true" spawnx="30" health="1" x="-118.29799" y="62.499027" dindex="9999"/>
+ <npc name="Sanc" hasDialog="true"/>
+ <npc name="Bob" hasDialog="true" spawnx="30"/>
<structure type="1" spawnx="300" alive="1"/>
<structure inside="bobshouse.xml" type="1" spawnx="10" alive="1"/>
<chest alive="1"/>
@@ -19,10 +19,8 @@
</content>
</text>
<text id="1" pause="true" alive="1">
- <quest assign="Check out m&apos;swag, man!" health="1" x="-197.83293" y="71.963989" dindex="0">
- No description
- </quest>
- <content health="1" x="-206.1515" y="70.798996" dindex="0">
+ <quest assign="Check out m&apos;swag, man!" desc="Go inside Bob&apos;s house and check out the stuff he has."/>
+ <content>
Looks like you've got yourself pretty empty handed... you know, I have a simple solution for that. Come on inside, I have somethin' to show you.
</content>
</text>
diff --git a/xml/playerSpawnHill1.xml b/xml/playerSpawnHill1.xml
deleted file mode 100644
index 9533290..0000000
--- a/xml/playerSpawnHill1.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<World>
- <style background="0" bgm="assets/music/embark.wav" folder="assets/style/classic/"/>
- <generation type="Random" width="500"/>
- <link right="playerSpawnHill2.xml"/>
- <hill peakx="0" peaky="1000" width="50"/>
- <weather>Rainy</weather>
- <time>3400</time>
- <spawnx>-880</spawnx>
- <trigger spawnx="-850" id="first" notext="1"/>
- <npc name="Guy" hasDialog="true" spawnx="0" canMove="false"/>
-</World>
-
-<Trigger id="first">Guy</Trigger>
-
-<Dialog name="Guy">
- <text id="0" nextid="1">
- Hello there! My name is Ralph.
- <gotox>300</gotox>
- </text>
- <text id="1">
- ...
- <gotox>1000</gotox>
- <set id="Slow" value="0"/>
- <set id="canSprint" value="1"/>
- </text>
- <text id="1" nextid="1" pause="true">
- Broooooooooooooo...
- </text>
-</Dialog>
-
-<Dialog name="Big Dave">
- <text id="0" stop="true">
- Hey friend! It's dangerous out there, here take these!
- Wait, promise you'll stop by my stand in the local market!
- <give id="Wood Sword" count="1"/> <give id="Hunters Bow" count="1"/> <give id="Crude Arrow" count="110"/> <give id="Fried Chicken" count="1"/> <give id="Mossy Torch" count="1"/></text>
-</Dialog>
diff --git a/xml/playerSpawnHill1_Building1.xml b/xml/playerSpawnHill1_Building1.xml
deleted file mode 100644
index 233595b..0000000
--- a/xml/playerSpawnHill1_Building1.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<IndoorWorld>
- <style background="1" bgm="assets/music/theme_jazz.wav"/>
- <link outside="playerSpawnHill1.xml"/>
- <floor width="300"/>
- <floor width="200" start="100"/>
- <npc name="Bob" hasDialog="true" floor="2"/>
-</IndoorWorld>
-
-<Dialog name="Bob">
- <text id="0" nextid="1" pause="true">
- Hey. Have a Dank MayMay :)
- <give id="Dank MayMay" count="1"/></text>
- <text id="1" nextid="2">
- What? You want another Dank MayMay?
- </text>
- <text id="2" nextid="3" pause="true">
- K.
- <give id="Dank MayMay" count="1"/></text>
- <text id="3" nextid="4">
- Well... I'm out of Dank MayMays.
- </text>
- <text id="4">
- Have a sword though.
- <give id="Wood Sword" count="1"/></text>
-</Dialog>
diff --git a/xml/playerSpawnHill2.xml b/xml/playerSpawnHill2.xml
deleted file mode 100644
index c0ef541..0000000
--- a/xml/playerSpawnHill2.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<World>
- <style background="0" bgm="assets/music/embark.wav" folder="assets/style/rustic/"/>
- <generation type="Random" width="1000"/>
- <structure type="5" inside="playerSpawnHill1_Building1.xml"/>
- <npc name="Swag"/>
- <link left="playerSpawnHill1.xml"/>
-</World>