aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog10
-rw-r--r--brice.dat6
-rw-r--r--main.cpp6
-rw-r--r--src/entities.cpp32
-rw-r--r--xml/000.xml6
-rw-r--r--xml/playerSpawnHill1.xml2
-rw-r--r--xml/playerSpawnHill1_Building1.xml6
7 files changed, 44 insertions, 24 deletions
diff --git a/Changelog b/Changelog
index 0f6c748..d0c136a 100644
--- a/Changelog
+++ b/Changelog
@@ -1052,3 +1052,13 @@
- 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
diff --git a/brice.dat b/brice.dat
index 3b090ad..8c8c697 100644
--- a/brice.dat
+++ b/brice.dat
@@ -1,7 +1,9 @@
-3
+4
+
+
canSprint
0
canJump
0
Slow
-1
+0
diff --git a/main.cpp b/main.cpp
index 52841c6..f4f8e9c 100644
--- 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);
}
}
diff --git a/src/entities.cpp b/src/entities.cpp
index 90e03eb..a711fc9 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -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
diff --git a/xml/000.xml b/xml/000.xml
index 1806332..de079ca 100644
--- a/xml/000.xml
+++ b/xml/000.xml
@@ -18,8 +18,10 @@
<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>
diff --git a/xml/playerSpawnHill1.xml b/xml/playerSpawnHill1.xml
index f997b4d..06a27c4 100644
--- a/xml/playerSpawnHill1.xml
+++ b/xml/playerSpawnHill1.xml
@@ -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>
diff --git a/xml/playerSpawnHill1_Building1.xml b/xml/playerSpawnHill1_Building1.xml
index d5c07b3..0977b8f 100644
--- a/xml/playerSpawnHill1_Building1.xml
+++ b/xml/playerSpawnHill1_Building1.xml
@@ -10,17 +10,17 @@
<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>