]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
new xml, wip quest menu
authorClyne Sullivan <tullivan99@gmail.com>
Sat, 2 Jul 2016 13:58:12 +0000 (09:58 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Sat, 2 Jul 2016 13:58:12 +0000 (09:58 -0400)
include/ui_quest.hpp [new file with mode: 0644]
src/entities.cpp
src/ui.cpp
xml/!town.xml [new file with mode: 0644]
xml/playerSpawnHill1.xml [deleted file]
xml/playerSpawnHill1_Building1.xml [deleted file]
xml/playerSpawnHill2.xml [deleted file]
xml/town.xml [deleted file]

diff --git a/include/ui_quest.hpp b/include/ui_quest.hpp
new file mode 100644 (file)
index 0000000..a0f3ad4
--- /dev/null
@@ -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_
index e49d0caae881361339fb5d46f31311050517ad46..53d3acae9d8132b92af607f7d6b5999f91161ed3 100644 (file)
@@ -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;
index d5fc2adb346ecbe17da1ecc4140f213135588e2e..098f6505b592b0712b88a4d95c75de0007d1566c 100644 (file)
@@ -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
new file mode 100644 (file)
index 0000000..51fc08d
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<World>
+    <style background="0" bgm="assets/music/embark.wav" folder="assets/style/classic/"/>
+    <generation type="Random" width="1600"/>
+    <time>6000</time>
+    <spawnx>-300</spawnx>
+    <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"/>
+</World>
+
+<Dialog name="Bob">
+    <text id="0" nextid="1" pause="true">
+        <give id="Dank MayMay" count="10"/>
+        <content alive="1">
+                       Hey there! The name's Bob. Good to see you've finally woken up from your nap by the cliff there... lol
+               </content>
+    </text>
+    <text id="1" pause="true" alive="1">
+        <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>
+</Dialog>
+
+<Dialog name="Sanc">
+    <text id="0">
+        <set id="Slow" value="0"/>
+        <set id="canSprint" value="1"/>
+    </text>
+</Dialog>
diff --git a/xml/playerSpawnHill1.xml b/xml/playerSpawnHill1.xml
deleted file mode 100644 (file)
index 9533290..0000000
+++ /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 (file)
index 233595b..0000000
+++ /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 (file)
index c0ef541..0000000
+++ /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>
diff --git a/xml/town.xml b/xml/town.xml
deleted file mode 100644 (file)
index 42d0bef..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<World>
-    <style background="0" bgm="assets/music/embark.wav" folder="assets/style/classic/"/>
-    <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"/>
-    <structure type="1" spawnx="300" alive="1"/>
-    <structure inside="bobshouse.xml" type="1" spawnx="10" alive="1"/>
-    <chest alive="1"/>
-</World>
-
-<Dialog name="Bob">
-    <text id="0" nextid="1" pause="true">
-        <give id="Dank MayMay" count="10"/>
-        <content alive="1">
-                       Hey there! The name's Bob. Good to see you've finally woken up from your nap by the cliff there... lol
-               </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">
-                       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>
-</Dialog>
-
-<Dialog name="Sanc">
-    <text id="0">
-        <set id="Slow" value="0"/>
-        <set id="canSprint" value="1"/>
-    </text>
-</Dialog>