diff options
-rw-r--r-- | Changelog | 16 | ||||
-rw-r--r-- | config/settings.xml | 4 | ||||
-rw-r--r-- | include/common.h | 8 | ||||
-rw-r--r-- | main.cpp | 14 | ||||
-rw-r--r-- | src/gameplay.cpp | 13 | ||||
-rw-r--r-- | xml/playerSpawnHill1.xml | 4 |
6 files changed, 48 insertions, 11 deletions
@@ -515,3 +515,19 @@ - WIP xml'd world linking - textures? - music? + +1/12/2015: +========== + + - world linking xml'd + - xml'ing indoors + - shaderssss + - more music + +1/13/2015: +========== + + - discovered how intel and nvidia gpus handle lighting + - xml'd buildings and their indoors + - xml'd settings for screen dimensions + - xml'd item giving through npc dialog diff --git a/config/settings.xml b/config/settings.xml new file mode 100644 index 0000000..82363a8 --- /dev/null +++ b/config/settings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0"?> + +<screen width="1024" height="720" /> +<hline value="3" /> diff --git a/include/common.h b/include/common.h index be32019..bfd0126 100644 --- a/include/common.h +++ b/include/common.h @@ -78,13 +78,15 @@ typedef struct{ * The desired width of the game window. */ -#define SCREEN_WIDTH 1280 +//#define SCREEN_WIDTH 1280 +extern unsigned int SCREEN_WIDTH; /** * The desired height of the game window. */ -#define SCREEN_HEIGHT 720 +//#define SCREEN_HEIGHT 720 +extern unsigned int SCREEN_HEIGHT; //#define FULLSCREEN @@ -98,7 +100,7 @@ typedef struct{ * */ -#define HLINE 3 +#define HLINE 1 /** * A 'wrapper' for libc's srand(), as we hope to eventually have our own random number @@ -11,6 +11,9 @@ #include <world.h> #include <ui.h> #include <entities.h> +#include <tinyxml2.h> + +using namespace tinyxml2; /* * TICKS_PER_SEC & MSEC_PER_TICK @@ -196,12 +199,21 @@ extern bool fadeWhite; extern bool fadeFast; extern int fadeIntensity; +unsigned int SCREEN_WIDTH; +unsigned int SCREEN_HEIGHT; + /******************************************************************************* * MAIN ************************************************************************ *******************************************************************************/ int main(/*int argc, char *argv[]*/){ //*argv = (char *)argc; + gameRunning=false; + + XMLDocument xml; + xml.LoadFile("config/settings.xml"); + SCREEN_WIDTH = xml.FirstChildElement("screen")->UnsignedAttribute("width"); + SCREEN_HEIGHT = xml.FirstChildElement("screen")->UnsignedAttribute("height"); /*! * (Attempt to) Initialize SDL libraries so that we can use SDL facilities and eventually @@ -529,7 +541,7 @@ void render(){ * see past the world render */ - if(currentWorld->getTheWidth() < SCREEN_WIDTH){ + if(currentWorld->getTheWidth() < (int)SCREEN_WIDTH){ offset.x = 0; }else if(!worldInside){ if(player->loc.x - SCREEN_WIDTH/2 < currentWorld->getTheWidth() * -0.5f) diff --git a/src/gameplay.cpp b/src/gameplay.cpp index c4249a4..6626811 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -75,6 +75,13 @@ int commonAIFunc(NPC *speaker){ if(!strcmp(exml->Name(),"text")){ if(exml->UnsignedAttribute("id") == idx){ + if((oxml = exml->FirstChildElement("give"))){ + while(oxml){ + player->inv->addItem((ITEM_ID)oxml->UnsignedAttribute("id"),oxml->UnsignedAttribute("count")); + oxml = oxml->NextSiblingElement(); + } + } + if((oxml = exml->FirstChildElement("option"))){ const char *op; char *bp1 = new char[1],*bp2,*tmp; @@ -281,12 +288,6 @@ SKIP: } } } - /*for(auto &l : earthlnk){ - if(!strcmp(file+4,l.name)){ - yoyo2 = &l.ptr; - break; - } - }*/ if(wxml->QueryFloatAttribute("x",&spawnx) != XML_NO_ERROR) earth.back()->addStructure((BUILD_SUB)wxml->UnsignedAttribute("type"),getRand() % earth.back()->getTheWidth() / 2.0f,100,yoyo);//,yoyo2); else diff --git a/xml/playerSpawnHill1.xml b/xml/playerSpawnHill1.xml index 12d55fc..e96d6a5 100644 --- a/xml/playerSpawnHill1.xml +++ b/xml/playerSpawnHill1.xml @@ -3,7 +3,7 @@ <style background="0" bgm="assets/music/embark.wav" /> <generation type="Random" width="800" /> - <!--<link right="playerSpawnHill2.xml" />--> + <link right="playerSpawnHill2.xml" /> <mob type="1" /> @@ -38,5 +38,7 @@ <text id="1" > My name's Johnny. + + <give id="0" count="1" /> </text> </Dialog> |