]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
identation fix
authorClyne Sullivan <tullivan99@gmail.com>
Wed, 15 Jun 2016 12:44:34 +0000 (08:44 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Wed, 15 Jun 2016 12:44:34 +0000 (08:44 -0400)
Changelog
brice.dat
main.cpp
src/entities.cpp
xml/000.xml
xml/playerSpawnHill1.xml
xml/playerSpawnHill1_Building1.xml

index 0f6c7484388d6879fbab4a3a338c4857e5654796..d0c136a3953d6331e63e8db6b91b329274649ab8 100644 (file)
--- a/Changelog
+++ b/Changelog
        - worked on better inventory / general ui
 
        ~ more than 10800 lines of code (just counting .hpp's and .cpp's)
+
+6/15/2016:
+==========
+
+       - fixed major indentation problem with tinyxml
+       - windows build actually works first try..???
+       - everybody's pushed and merged and stuff
+       - item rendering stuff
+               "I'm also trying to make it so that other entities can use items.. if that makes sense."
+                       - Andy
index 3b090ad887b4d2aa51cf2d99adc0eeaf055a2798..8c8c69764cdd2b56f8a160b579b7c87cd5f007e2 100644 (file)
--- a/brice.dat
+++ b/brice.dat
@@ -1,7 +1,9 @@
-3
+4
+
+
 canSprint
 0
 canJump
 0
 Slow
-1
+0
index 52841c68fb09e58b236ae20f2e2b83c41e79b863..f4f8e9c583b954d90d30877107554201a6dd8ad0 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -264,8 +264,8 @@ int main(int argc, char *argv[])
                for (const auto &xf : xmlFiles) {
                        if (xf[0] != '.') {
                                XMLDocument xmld;
-                               auto file = xmlFolder + xf;
-                               xmld.LoadFile(file.c_str());
+                               auto file = (xmlFolder + xf).c_str();
+                               xmld.LoadFile(file);
 
                                auto xmle = xmld.FirstChildElement("World");
 
@@ -285,7 +285,7 @@ int main(int argc, char *argv[])
                                        xmle->DeleteAttribute("dindex");
                                        xmle = xmle->NextSiblingElement();
                                }
-                               xmld.SaveFile(file.c_str(), false);
+                               xmld.SaveFile(file, false);
                        }
                }
 
index 90e03ebb841e16ab7d9157f3023bd7509e3a953f..a711fc97266f7d5a3cbc9b927edac46daaf595d3 100644 (file)
@@ -631,7 +631,7 @@ extern int commonAIFunc(NPC *speaker);
 void NPC::interact() { //have the npc's interact back to the player
        std::thread([this]{
                std::vector<XMLElement *> dopt;
-               XMLDocument xml;
+               XMLDocument *xml; 
                XMLElement *exml,*oxml;
 
                static unsigned int oldidx = 9999;
@@ -644,22 +644,27 @@ void NPC::interact() { //have the npc's interact back to the player
 
                loc.y += 5;
 
-               canMove=false;
-               left = (player->loc.x < loc.x);
-               right = !left;
+               // freeze the npc, face the player
+               canMove = false;
+               left    = (player->loc.x < loc.x);
+               right   = !left;
 
+               // if there's actual scripted stuff to do, do it
                if (dialogCount && dialogIndex != 9999) {
                        // load the XML file and find the dialog tags
-                       if (outnabout == 0)
-                               xml.LoadFile(currentXML.c_str());
-                       else if (outnabout < 0)
-                               xml.LoadFile((xmlFolder + currentWorld->getToLeft()).c_str());
-                       else
-                               xml.LoadFile((xmlFolder + currentWorld->getToRight()).c_str());
+                       if (outnabout == 0) {
+                               xml = &currentXMLDoc;
+                       } else if (outnabout < 0) {
+                               xml = new XMLDocument();
+                               xml->LoadFile((xmlFolder + currentWorld->getToLeft()).c_str());
+                       } else {
+                               xml = new XMLDocument();
+                               xml->LoadFile((xmlFolder + currentWorld->getToRight()).c_str());
+                       }
 COMMONAIFUNC:
                        idx = 0;
                        stop = false;
-                       exml = xml.FirstChildElement("Dialog");
+                       exml = xml->FirstChildElement("Dialog");
 
                        // search for the dialog block associated with this npc
                        while (exml->StrAttribute("name") != name)
@@ -726,10 +731,11 @@ COMMONAIFUNC:
                        }
 
                        // asdlfkj
-                       if (exml->GetText() == nullptr)
+                       auto txml = exml->FirstChildElement("content");
+                       if (txml == nullptr)
                                goto OTHERSTUFF;
 
-                       ptr = exml->GetText() - 1;
+                       ptr = txml->GetText() - 1;
                        while (*++ptr && isspace(*ptr));
 
                        // handle dialog options
index 18063327fbbb66494d30c513789c82ee447fd411..de079caae0fccdd39a36ffcb89e97e8dc6401c12 100644 (file)
         <gotox playerMove="0" advance="1">-600</gotox>
     </text>
     <text id="1">
-        ...
-                                                                                                                                                                                                                                                                        <gotox>700</gotox>
+        <gotox>700</gotox>
         <set id="Slow" value="0"/>
+        <content>
+               ...
+       </content>
     </text>
 </Dialog>
index f997b4dda150d7506ec24948799b2ec6c2470c1d..06a27c42be36191150a2c97da60670a133cff3c5 100644 (file)
@@ -19,7 +19,7 @@
     </text>
     <text id="1">
                ...
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       <gotox>1000</gotox>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               <gotox>1000</gotox>
         <set id="Slow" value="0"/>
         <set id="canSprint" value="1"/>
     </text>
index d5c07b33f0bff7d6b419f39685fcc23fd19429a6..0977b8f640e6cbbce6691dd7f817f9f7b5715dfd 100644 (file)
 <Dialog name="Bob">
     <text id="0" nextid="1" pause="true">
        Hey. Have a Dank MayMay :)
-               <give id="Dank MayMay" count="1"/></text>
+                                                                                                       <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>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   <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>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               <give id="Wood Sword" count="1"/></text>
 </Dialog>