From 56d34b56e82821797bc97be7e36138057109f87e Mon Sep 17 00:00:00 2001
From: Clyne Sullivan <tullivan99@gmail.com>
Date: Fri, 24 Jun 2016 08:26:45 -0400
Subject: xml story writing stuff

---
 brice.dat                          |  6 +--
 main.cpp                           | 40 +++++++++--------
 src/entities.cpp                   | 15 ++++---
 src/mob.cpp                        |  4 +-
 src/ui.cpp                         |  2 +-
 src/world.cpp                      | 90 ++++++++++++++++++--------------------
 xml/000.xml                        | 27 ------------
 xml/001.xml                        |  7 ---
 xml/bobshouse.xml                  | 34 ++++++++++++++
 xml/playerSpawnHill1.xml           |  6 +--
 xml/playerSpawnHill1_Building1.xml |  6 +--
 xml/town.xml                       | 34 ++++++++++++++
 xml/town.xml.save                  | 11 +++++
 13 files changed, 165 insertions(+), 117 deletions(-)
 delete mode 100644 xml/000.xml
 delete mode 100644 xml/001.xml
 create mode 100644 xml/bobshouse.xml
 create mode 100644 xml/town.xml
 create mode 100644 xml/town.xml.save

diff --git a/brice.dat b/brice.dat
index 3679e63..4dad711 100644
--- a/brice.dat
+++ b/brice.dat
@@ -1,9 +1,7 @@
-4
-
-
+3
 Slow
 0
 canJump
 0
 canSprint
-0
+1
diff --git a/main.cpp b/main.cpp
index f4f8e9c..3b98b94 100644
--- a/main.cpp
+++ b/main.cpp
@@ -121,18 +121,19 @@ int main(int argc, char *argv[])
 {
 	static SDL_GLContext mainGLContext = NULL;
 	static bool worldReset = false, worldDontReallyRun = false;
+	std::string worldActuallyUseThisXMLFile;
 
 	// handle command line arguments
 	if (argc > 1) {
-		std::vector<std::string> args (argc, "");
-		for (int i = 1; i < argc; i++)
-			args[i] = argv[i];
+		for (int i = 1; i < argc; i++) {
+			std::string s = argv[i];
 
-		for (const auto &s : args) {
 			if (s == "--reset" || s == "-r")
 				worldReset = true;
 			else if (s == "--dontrun" || s == "-d")
 				worldDontReallyRun = true;
+			else if (s == "--xml" || s == "-x")
+				worldActuallyUseThisXMLFile = argv[i + 1];
 		}
 	}
 
@@ -298,8 +299,11 @@ int main(int argc, char *argv[])
 	if (worldDontReallyRun)
 		return 0;
 
-	if (currentWorld == nullptr) {
-		
+	if (!worldActuallyUseThisXMLFile.empty()) {
+		delete currentWorld;
+		currentWorld = loadWorldFromXML(worldActuallyUseThisXMLFile);
+	} else if (currentWorld == nullptr) {
+
 		// load the first valid XML file for the world
 		for (const auto &xf : xmlFiles) {
 			if (xf[0] != '.') {
@@ -334,7 +338,7 @@ int main(int argc, char *argv[])
 
 	// the debug loop, gets debug screen values
 	std::thread([&]{
-		while (gameRunning) {	
+		while (gameRunning) {
 			fps = 1000 / game::time::getDeltaTime();
 			debugY = player->loc.y;
 
@@ -408,8 +412,8 @@ void render() {
 										floor(offset.x+SCREEN_WIDTH/2), 	//right
 										floor(offset.y-SCREEN_HEIGHT/2), 	//bottom
 										floor(offset.y+SCREEN_HEIGHT/2), 	//top
-										10.0f,								//near
-										-10.0f);							//far
+										10.0,								//near
+										-10.0);								//far
 
 	glm::mat4 view = glm::lookAt(glm::vec3(0,0,0.0f),  //pos
 								 glm::vec3(0,0,-10.0f), //looking at
@@ -428,14 +432,14 @@ void render() {
     glUseProgram(worldShader);
 	glUniformMatrix4fv(worldShader_uniform_ortho, 1, GL_FALSE, glm::value_ptr(ortho));
 	glUniformMatrix4fv(worldShader_uniform_transform, 1, GL_FALSE, glm::value_ptr(glm::mat4(1.0f)));
-	
+
 	glUniform4f(worldShader_uniform_color, 1.0, 1.0, 1.0, 1.0);
 	glUniform4f(worldShader_uniform_ambient, ambient.red, ambient.green, ambient.blue, 1.0);
 	glUniform1f(worldShader_uniform_light_impact, 1.0);
-	
+
 	/*static GLfloat l[]  = {460.0, 100.0, 0.0, 300.0};
 	static GLfloat lc[] = {1.0, 1.0, 1.0, 1.0};
-	glUniform4fv(worldShader_uniform_light, 1, l); 
+	glUniform4fv(worldShader_uniform_light, 1, l);
 	glUniform4fv(worldShader_uniform_light_color, 1, lc);
 	glUniform1i(worldShader_uniform_light_amt, 1);
 	*/
@@ -505,10 +509,10 @@ void render() {
 				*(tp++) = 1.0;
 			}
 		}
-		
+
 		glEnableVertexAttribArray(worldShader_attribute_coord);
 		glEnableVertexAttribArray(worldShader_attribute_coord);
-		
+
 		glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), &tpoint[0]);
 		glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), &tpoint[3]);
 		glDrawArrays(GL_LINES, 0, es * 2);
@@ -516,7 +520,7 @@ void render() {
 		glDisableVertexAttribArray(worldShader_attribute_tex);
 		glDisableVertexAttribArray(worldShader_attribute_tex);
 		glUseProgram(0);
-		
+
 	}
 
 
@@ -624,11 +628,11 @@ void logic(){
 	// calculate the world shading value
 	worldShade = 50 * sin((game::time::getTickCount() + (DAY_CYCLE / 2)) / (DAY_CYCLE / PI));
 
-	float ws = 75 * sin((game::time::getTickCount() + (DAY_CYCLE / 2)) / (DAY_CYCLE / PI));	
-	
+	float ws = 75 * sin((game::time::getTickCount() + (DAY_CYCLE / 2)) / (DAY_CYCLE / PI));
+
 	float ambRG = std::clamp(.5f + (-ws / 100.0f), 0.01f, .9f);
 	float ambB =	std::clamp(.5f + (-ws / 80.0f), 0.03f, .9f);
-		
+
 	ambient = Color(ambRG, ambRG, ambB, 1.0f);
 
 	// update fades
diff --git a/src/entities.cpp b/src/entities.cpp
index a711fc9..cfc5922 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -181,7 +181,7 @@ Player::Player() : Entity()
 	dim2 tmpDim = Texture::imageDim(tex.getTexturePath(0));
 	width = HLINES(tmpDim.x/2);
 	height = HLINES(tmpDim.y/2);
-	
+
 	z = -2.0;
 }
 
@@ -311,6 +311,7 @@ void Merchant::saveToXML(void){}
 
 Structures::Structures() : Entity()
 {
+	type = STRUCTURET;
 	canMove = false;
 	health = maxHealth = 1;
 }
@@ -324,7 +325,7 @@ void Structures::createFromXML(XMLElement *e, World *w)
 	float spawnx;
 
 	if (e->QueryBoolAttribute("alive", &alive) == XML_NO_ERROR && !alive) {
-		die();
+		//die();
 		return;
 	}
 
@@ -368,7 +369,7 @@ Object::~Object()
 }
 
 void Object::createFromXML(XMLElement *e, World *w=nullptr)
-{	
+{
 	(void)e;
 	(void)w;
 }
@@ -631,7 +632,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;
@@ -661,6 +662,7 @@ void NPC::interact() { //have the npc's interact back to the player
 				xml = new XMLDocument();
 				xml->LoadFile((xmlFolder + currentWorld->getToRight()).c_str());
 			}
+
 COMMONAIFUNC:
 			idx = 0;
 			stop = false;
@@ -677,6 +679,7 @@ COMMONAIFUNC:
 					break;
 			} while ((exml = exml->NextSiblingElement()));
 
+			std::cout << "b\n";
 			// handle quest tags
 			if ((oxml = exml->FirstChildElement("quest"))) {
 				std::string qname;
@@ -730,6 +733,7 @@ COMMONAIFUNC:
 				game::briceUpdate();
 			}
 
+			std::cout << "a\n";
 			// asdlfkj
 			auto txml = exml->FirstChildElement("content");
 			if (txml == nullptr)
@@ -817,8 +821,9 @@ OTHERSTUFF:
 			}
 
 			// advance if desired
-			if (advance)
+			else if (advance) {
 				goto COMMONAIFUNC;
+			}
 
 			// stop talking
 			else {
diff --git a/src/mob.cpp b/src/mob.cpp
index 798f09a..eba970e 100644
--- a/src/mob.cpp
+++ b/src/mob.cpp
@@ -301,8 +301,8 @@ bool Bird::bindTex(void)
 void Bird::createFromXML(XMLElement *e, World *w=nullptr)
 {
 	(void)w;
-    float Xlocx, Xhealth;
-	
+    float Xlocx;
+
 	xmle = e;
 
 	if (e->QueryFloatAttribute("x", &Xlocx) == XML_NO_ERROR)
diff --git a/src/ui.cpp b/src/ui.cpp
index 392cb13..b484982 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -1447,7 +1447,7 @@ EXIT:
 								if (thing.first != currentWorld)
 									worldSwitch(thing);
 							}).detach();
-						} else {
+						} else if (!fadeIntensity) {
 							std::thread([&](void){
 								auto thing = currentWorld->goInsideStructure(player);
 								if (thing.first != currentWorld)
diff --git a/src/world.cpp b/src/world.cpp
index 8c6a548..7c62739 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -283,7 +283,7 @@ void World::drawBackgrounds(void)
 
 	// TODO scroll backdrop
 	GLfloat bgOff = game::time::getTickCount()/24000.0f;
-	
+
 	GLfloat topS = .125f + bgOff;
 	GLfloat bottomS = 0.0f + bgOff;
 
@@ -294,11 +294,11 @@ void World::drawBackgrounds(void)
 	GLfloat scrolling_tex_coord[] = {0.0f,  bottomS,
 									 1.0f,  bottomS,
 									 1.0f,  bottomS,
-									 
+
 									 1.0f,  bottomS,
 									 0.0f,  bottomS,
 									 0.0f,  bottomS};
-   
+
    	vec2 bg_tex_coord[] = { vec2(0.0f, 0.0f),
                             vec2(1.0f, 0.0f),
                             vec2(1.0f, 1.0f),
@@ -322,7 +322,7 @@ void World::drawBackgrounds(void)
                                 offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y, 9.8f,
                                 offset.x - backgroundOffset.x - 5, offset.y - backgroundOffset.y, 9.8f,
                                 offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y, 9.8f};
-    
+
 	glUseProgram(worldShader);
 	glUniform1f(worldShader_uniform_light_impact, 0.0f);
 	glUniform4f(worldShader_uniform_ambient, 1.0, 1.0, 1.0, 1.0);
@@ -341,7 +341,7 @@ void World::drawBackgrounds(void)
 
 	bgTex++;
 	glUniform4f(worldShader_uniform_color, 1.0, 1.0, 1.0, 1.3 - static_cast<float>(alpha)/255.0f);
-	
+
 	glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, fron_tex_coord);
     glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, tex_coord);
     glDrawArrays(GL_TRIANGLES, 0 , 6);
@@ -351,7 +351,7 @@ void World::drawBackgrounds(void)
 	static GLuint starTex = Texture::loadTexture("assets/style/classic/bg/star.png");
 	const static float stardim = 24;
 	GLfloat star_coord[star.size() * 5 * 6 + 1];
-    GLfloat *si = &star_coord[0];		
+    GLfloat *si = &star_coord[0];
 
 	if (worldShade > 0) {
 
@@ -364,39 +364,39 @@ void World::drawBackgrounds(void)
 
 			*(si++) = 0.0;
 			*(si++) = 0.0;
-			
+
 			*(si++) = s.x + xcoord + stardim;
 			*(si++) = s.y,
 			*(si++) = 9.7f;
-			
+
 			*(si++) = 1.0;
 			*(si++) = 0.0;
-			
+
 			*(si++) = s.x + xcoord + stardim;
 			*(si++) = s.y + stardim,
 			*(si++) = 9.7f;
-			
+
 			*(si++) = 1.0;
 			*(si++) = 1.0;
-			
+
 			*(si++) = s.x + xcoord + stardim;
 			*(si++) = s.y + stardim,
 			*(si++) = 9.7f;
-			
+
 			*(si++) = 1.0;
 			*(si++) = 1.0;
-			
+
 			*(si++) = s.x + xcoord;
 			*(si++) = s.y + stardim,
 			*(si++) = 9.7f;
-			
+
 			*(si++) = 0.0;
 			*(si++) = 1.0;
-			
+
 			*(si++) = s.x + xcoord;
 			*(si++) = s.y,
 			*(si++) = 9.7f;
-			
+
 			*(si++) = 0.0;
 			*(si++) = 0.0;
 		}
@@ -407,9 +407,9 @@ void World::drawBackgrounds(void)
 		glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), &star_coord[0]);
 		glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), &star_coord[3]);
 		glDrawArrays(GL_TRIANGLES, 0, star.size() * 6);
-		
+
 	}
-    
+
 	glDisableVertexAttribArray(worldShader_attribute_coord);
     glDisableVertexAttribArray(worldShader_attribute_tex);
 
@@ -523,7 +523,7 @@ void World::draw(Player *p)
 	drawBackgrounds();
 
 	uint ls = light.size();
-	
+
 	GLfloat *lightCoords = new GLfloat[ls * 4];
 	GLfloat *lightColors = new GLfloat[ls * 4];
 
@@ -547,8 +547,8 @@ void World::draw(Player *p)
 		lightCoords[lpIndex++] = l.loc.x;
 		lightCoords[lpIndex++] = l.loc.y;
 		lightCoords[lpIndex++] = 0.0;
-		lightCoords[lpIndex++] = l.radius; 
-    
+		lightCoords[lpIndex++] = l.radius;
+
 		lightColors[lcIndex++] = l.color.red;
 		lightColors[lcIndex++] = l.color.green;
 		lightColors[lcIndex++] = l.color.blue;
@@ -556,7 +556,7 @@ void World::draw(Player *p)
 	}
 
 	glUseProgram(worldShader);
-	
+
 	glUniform4fv(worldShader_uniform_light, ls, lightCoords);
 	glUniform4fv(worldShader_uniform_light_color, ls, lightColors);
 	glUniform1i(worldShader_uniform_light_amt, ls);
@@ -788,9 +788,9 @@ void World::draw(Player *p)
 
 	partMutex.lock();
 	uint ps = particles.size();
-    uint pss = ps * 6 * 5;	
+    uint pss = ps * 6 * 5;
 	uint pc = 0;
-	
+
 	std::vector<GLfloat> partVec(pss);
 	auto *pIndex = &partVec[0];
 	for (uint i = 0; i < ps; i++) {
@@ -813,7 +813,7 @@ void World::draw(Player *p)
 
 	glUniform4f(worldShader_uniform_color, 1.0, 1.0, 1.0, 1.0);
 
-    glUseProgram(0);    
+    glUseProgram(0);
 }
 
 /**
@@ -1242,7 +1242,7 @@ void World::setWeather(const std::string &s)
 			weather = static_cast<WorldWeather>(i);
 			return;
 		}
-	} 
+	}
 	weather = WorldWeather::None;
 }
 
@@ -1375,14 +1375,13 @@ WorldSwitchInfo World::goInsideStructure(Player *p)
         auto d = std::find_if(std::begin(build), std::end(build), [p](const Structures *s) {
             return ((p->loc.x > s->loc.x) && (p->loc.x + p->width < s->loc.x + s->width));
         });
-        auto b = *d;
 
-        if ((d == std::end(build)) || b->inside.empty())
+        if ((d == std::end(build)) || (*d)->inside.empty())
             return std::make_pair(this, vec2 {0, 0});
 
         // +size cuts folder prefix
 		inside.push_back(&currentXML[xmlFolder.size()]);
-		tmp = loadWorldFromXML(b->inside);
+		tmp = loadWorldFromXML((*d)->inside);
 
 		return std::make_pair(tmp, vec2 {0, 100});
 	}
@@ -1675,7 +1674,7 @@ draw(Player *p)
         glUniform1fv(glGetUniformLocation(shaderProgram, "fireFlicker"), light.size(), flameArray);
 	}
 */
-	
+
 	glUseProgram(worldShader);
 
 	glActiveTexture(GL_TEXTURE0);
@@ -1690,7 +1689,7 @@ draw(Player *p)
 	GLfloat backTile[] = {worldStart - SCREEN_WIDTH / 2,  	0, 									9.9,
 						  -worldStart + SCREEN_WIDTH / 2, 	0, 									9.9,
 						  -worldStart + SCREEN_WIDTH / 2, 	static_cast<float>(SCREEN_HEIGHT), 	9.9,
-						  
+
 						  -worldStart + SCREEN_WIDTH / 2, 	static_cast<float>(SCREEN_HEIGHT), 	9.9,
 						  worldStart - SCREEN_WIDTH / 2,	static_cast<float>(SCREEN_HEIGHT), 	9.9,
 						  worldStart - SCREEN_WIDTH / 2,	0,									9.9};
@@ -1732,34 +1731,31 @@ draw(Player *p)
         i = 0;
     	for (const auto &h : floor[fl]) {
     		x = worldStart + fstart[fl] * HLINE + HLINES(i);
-    		
+
 			f.emplace_back(x);
     		f.emplace_back(h);
 			f.emplace_back(-3);
 			f.emplace_back(0);
 			f.emplace_back(0);
-    		
+
 			f.emplace_back(x + HLINE);
 			f.emplace_back(h);
 			f.emplace_back(-3);
  		   	f.emplace_back(1);
 			f.emplace_back(0);
-			
+
 			f.emplace_back(x + HLINE);
 			f.emplace_back(h - INDOOR_FLOOR_THICKNESS);
 			f.emplace_back(-3);
  		   	f.emplace_back(1);
 			f.emplace_back(1);
 
-
 			f.emplace_back(x + HLINE);
 			f.emplace_back(h - INDOOR_FLOOR_THICKNESS);
 			f.emplace_back(-3);
  		   	f.emplace_back(1);
 			f.emplace_back(1);
-			
-			f.emplace_back(x);
-        	f.emplace_back(h - INDOOR_FLOOR_THICKNESS);
+
 			f.emplace_back(-3);
 			f.emplace_back(0);
  		   	f.emplace_back(1);
@@ -1773,7 +1769,7 @@ draw(Player *p)
 			i++;
     	}
     }
-	
+
 	glEnableVertexAttribArray(worldShader_attribute_coord);
 	glEnableVertexAttribArray(worldShader_attribute_tex);
 
@@ -1789,7 +1785,7 @@ draw(Player *p)
 	/*
 	 *	Draw all entities.
 	*/
-    
+
 	// TODO draw particles
 	// glBindTexture(GL_TEXTURE_2D, colorIndex);
 
@@ -1856,7 +1852,7 @@ World *loadWorldFromXML(std::string path) {
 World *loadWorldFromPtr(World *ptr)
 {
 	currentWorld->save(); // save the current world to the current xml path
-	
+
 	if (ptr->getToLeft() == currentXML) {
 		currentWorldToLeft = currentWorld;
 		loadedRight = true;
@@ -1995,7 +1991,7 @@ loadWorldFromXMLNoSave(std::string path) {
         else if (name == "generation") {
             // random gen.
 			if (!Indoor && wxml->StrAttribute("type") == "Random")
-				tmp->generate(wxml->UnsignedAttribute("width"));
+				tmp->generate(wxml->UnsignedAttribute("width") / game::HLINE);
             else {
                 if (Indoor)
                     UserError("XML Error: <generation> tags can't be in <IndoorWorld> tags (in " + _currentXML + ")!");
@@ -2043,12 +2039,12 @@ loadWorldFromXMLNoSave(std::string path) {
 		else if (name == "hill") {
 			tmp->addHill(ivec2 { wxml->IntAttribute("peakx"), wxml->IntAttribute("peaky") }, wxml->UnsignedAttribute("width"));
 		}
-		
+
 		// time setting
 		else if (name == "time" && !(loadedLeft | loadedRight)) {
             game::time::setTickCount(std::stoi(wxml->GetText()));
         }
-		
+
 		// floor adding
 		else if (Indoor && name == "floor") {
             if (wxml->QueryFloatAttribute("start",&spawnx) == XML_NO_ERROR)
@@ -2058,8 +2054,8 @@ loadWorldFromXMLNoSave(std::string path) {
         }
 
 		if (newEntity != nullptr) {
-			bool alive = true;
-			if (wxml->QueryBoolAttribute("alive", &alive) != XML_NO_ERROR || alive) {
+			//bool alive = true;
+			//if (wxml->QueryBoolAttribute("alive", &alive) != XML_NO_ERROR || alive) {
 				switch (newEntity->type) {
 				case NPCT:
 					tmp->addNPC(dynamic_cast<NPC *>(newEntity));
@@ -2075,7 +2071,7 @@ loadWorldFromXMLNoSave(std::string path) {
 				}
 
 				newEntity->createFromXML(wxml, tmp);
-			}
+			//}
 		}
 
         spawnx = 0;
diff --git a/xml/000.xml b/xml/000.xml
deleted file mode 100644
index de079ca..0000000
--- a/xml/000.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<World>
-    <style background="0" bgm="assets/music/embark.wav" folder="assets/style/classic/"/>
-    <generation type="Random" width="400"/>
-    <hill peakx="0" peaky="1000" width="50"/>
-    <link right="001.xml"/>
-    <weather>Rainy</weather>
-    <time>3400</time>
-    <spawnx>-650</spawnx>
-    <trigger spawnx="-630" 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" pause="true">
-        <gotox playerMove="0" advance="1">-600</gotox>
-    </text>
-    <text id="1">
-        <gotox>700</gotox>
-        <set id="Slow" value="0"/>
-        <content>
-		...
-	</content>
-    </text>
-</Dialog>
diff --git a/xml/001.xml b/xml/001.xml
deleted file mode 100644
index aeb0a85..0000000
--- a/xml/001.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<World>
-    <style background="0" bgm="assets/music/embark.wav" folder="assets/style/classic/"/>
-    <generation type="Random" width="600"/>
-    <link left="000.xml"/>
-    <weather>Rainy</weather>
-</World>
diff --git a/xml/bobshouse.xml b/xml/bobshouse.xml
new file mode 100644
index 0000000..2e7e576
--- /dev/null
+++ b/xml/bobshouse.xml
@@ -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" health="1" x="607.58258" y="68.099052" dindex="9999"/>
+    <npc name="Bob" hasDialog="true" spawnx="30" health="1" x="-117.91962" y="63.499046" dindex="9999"/>
+    <structure type="1" spawnx="300" alive="1"/>
+    <structure inside="bobshouse.xml" type="1" spawnx="10" alive="1"/>
+</World>
+
+<Dialog name="Bob">
+    <text id="0" nextid="1" pause="true">
+        <content>
+			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">
+        <quest assign="Check out m&apos;swag, man!">
+			No description
+		</quest>
+        <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
index 83acc7a..afd4898 100644
--- a/xml/playerSpawnHill1.xml
+++ b/xml/playerSpawnHill1.xml
@@ -16,11 +16,11 @@
 <Dialog name="Guy">
     <text id="0" nextid="1">
 		Hello there! My name is Ralph.
-		                                                                                                                                                                                                                                                                                                                                <gotox>300</gotox>
+		                                                                                                                                                                                                                                                                                                                                                                                                                                        <gotox>300</gotox>
     </text>
     <text id="1">
 		...
-		                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <gotox>1000</gotox>
+		                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <gotox>1000</gotox>
         <set id="Slow" value="0"/>
         <set id="canSprint" value="1"/>
     </text>
@@ -33,5 +33,5 @@
     <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>
+		                                                                                                                                                                                                                                                                                                                                                                                                                                        <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
index 0977b8f..7c69919 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>
diff --git a/xml/town.xml b/xml/town.xml
new file mode 100644
index 0000000..b6f17de
--- /dev/null
+++ b/xml/town.xml
@@ -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" health="1" x="648.92395" y="68.298882" dindex="9999"/>
+    <npc name="Bob" hasDialog="true" spawnx="30" health="1" x="-159.27541" y="65.598969" dindex="9999"/>
+    <structure type="1" spawnx="300" alive="1"/>
+    <structure inside="bobshouse.xml" type="1" spawnx="10" alive="1"/>
+</World>
+
+<Dialog name="Bob">
+    <text id="0" nextid="1" pause="true">
+        <content>
+			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">
+        <quest assign="Check out m&apos;swag, man!">
+			No description
+		</quest>
+        <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/town.xml.save b/xml/town.xml.save
new file mode 100644
index 0000000..4800462
--- /dev/null
+++ b/xml/town.xml.save
@@ -0,0 +1,11 @@
+<?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"/>
+    <structure type="1" spawnx="300"/>
+    <structure type="1" spawnx="10"/>
+</World>
-- 
cgit v1.2.3