diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-03-30 08:41:16 -0400 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-03-30 08:41:16 -0400 |
commit | c35571e37bdd6d2fe9b95e4265c150265585f3a9 (patch) | |
tree | 31478f777e27f345cc20f2eaf796a176b55cb4fe | |
parent | 82c178d797b9a23c31d7dad1cc8cac29d27c6eb1 (diff) |
Inv and textures
-rw-r--r-- | assets/style/classic/bg/bgWoodTile.png | bin | 75181 -> 205428 bytes | |||
-rw-r--r-- | config/items.xml | 40 | ||||
-rw-r--r-- | include/Quest.hpp (renamed from include/Quest.h) | 26 | ||||
-rw-r--r-- | include/Texture.hpp (renamed from include/Texture.h) | 40 | ||||
-rw-r--r-- | include/common.hpp (renamed from include/common.h) | 3 | ||||
-rw-r--r-- | include/config.hpp (renamed from include/config.h) | 0 | ||||
-rw-r--r-- | include/entities.hpp (renamed from include/entities.h) | 10 | ||||
-rw-r--r-- | include/inventory.hpp (renamed from include/inventory.h) | 4 | ||||
-rw-r--r-- | include/threadpool.hpp (renamed from include/threadpool.h) | 0 | ||||
-rw-r--r-- | include/ui.hpp (renamed from include/ui.h) | 8 | ||||
-rw-r--r-- | include/world.hpp (renamed from include/world.h) | 4 | ||||
-rw-r--r-- | main.cpp | 10 | ||||
-rw-r--r-- | src/Quest.cpp | 22 | ||||
-rw-r--r-- | src/Texture.cpp | 2 | ||||
-rw-r--r-- | src/common.cpp | 8 | ||||
-rw-r--r-- | src/config.cpp | 10 | ||||
-rw-r--r-- | src/entities.cpp | 4 | ||||
-rw-r--r-- | src/gameplay.cpp | 14 | ||||
-rw-r--r-- | src/inventory.cpp | 40 | ||||
-rw-r--r-- | src/threadpool.cpp | 2 | ||||
-rw-r--r-- | src/ui.cpp | 2 | ||||
-rw-r--r-- | src/world.cpp | 12 | ||||
-rw-r--r-- | xml/playerSpawnHill1_Building1.xml | 40 |
23 files changed, 198 insertions, 103 deletions
diff --git a/assets/style/classic/bg/bgWoodTile.png b/assets/style/classic/bg/bgWoodTile.png Binary files differindex 5b631bf..95b0667 100644 --- a/assets/style/classic/bg/bgWoodTile.png +++ b/assets/style/classic/bg/bgWoodTile.png diff --git a/config/items.xml b/config/items.xml index eddab3e..b3a10a5 100644 --- a/config/items.xml +++ b/config/items.xml @@ -8,4 +8,42 @@ <item name="Dank MayMay" type="Tool" maxStackSize="420" width="10" height="10" sprite="assets/items/ITEM_TEST.png" /> <item name="Your Bag" type="Equip" maxStackSize="1" width="5" height="5" sprite="assets/items/ITEM_TEST.png" /> <item name="Flashlight" type="Tool" maxStackSize="1" width="4" height="8" sprite="assets/items/flashlight_off.png" /> -<item name="Wood Sword" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword" type="Sword" damage="69" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword2" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword3" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword4" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword5" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword6" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword7" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword8" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword9" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword10" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword11" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword12" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword13" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword14" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword15" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword16" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword17" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword18" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword19" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword20" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword21" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword22" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword23" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword24" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword25" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword26" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword27" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword28" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword29" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword30" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword31" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword32" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword33" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword34" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword35" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword36" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword37" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword38" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> +<item name="Wood Sword39" type="Sword" maxStackSize="1" width="4" height="10" sprite="assets/items/SWORD_WOOD.png" /> diff --git a/include/Quest.h b/include/Quest.hpp index 8b1e142..eaf9426 100644 --- a/include/Quest.h +++ b/include/Quest.hpp @@ -1,17 +1,17 @@ /** @file Quest.h
* @brief The quest handling system.
- *
+ *
* This file contains Quest and QuestHandler, used to manage quests inside the
* game.
*/
-
+
#ifndef QUEST_H
#define QUEST_H
#include <cstring>
-#include <common.h>
-#include <inventory.h>
+#include <common.hpp>
+#include <inventory.hpp>
/**
* When defined, DEBUG allows extra messages to be printed to the terminal for
@@ -34,7 +34,7 @@ typedef struct { /**
* The Quest Handler class.
- *
+ *
* This class handles quests, including the assigning, dropping, and completing
* of the quests.
*/
@@ -42,30 +42,30 @@ typedef struct { class QuestHandler {
public:
std::vector<Quest>current;
-
+
/**
* Adds a quest to the current quest vector by its title.
*/
-
+
int assign(std::string title,std::string desc,std::string req);
-
+
/**
* Drops a quest through its title.
*/
-
+
int drop(std::string title);
-
+
/**
* Finishes a quest through it's title, also giving a pointer to the Entity
* that gave the quest originally.
*/
-
+
int finish(std::string t);
-
+
/**
* Returns true if this handler is currently taking the quest.
*/
-
+
bool hasQuest(std::string t);
};
diff --git a/include/Texture.h b/include/Texture.hpp index 816a8bf..4202043 100644 --- a/include/Texture.h +++ b/include/Texture.hpp @@ -1,13 +1,13 @@ /** @file Texture.h * @brief Defines a method for loading textures. - * + * * This file gives facilities for easily loading and binding textures. */ #ifndef TEXTURE_H #define TEXTURE_H -#include <common.h> +#include <common.hpp> /** * When defined, DEBUG allows extra messages to be printed to the terminal for @@ -21,16 +21,16 @@ */ namespace Texture { - + /** * Loads a texture from the given file name, returning the GLuint used for * later referencing of the texture. */ - + GLuint loadTexture(std::string fileName); - + void freeTextures(void); - + void initColorIndex(); vec2 getIndex(Color c); dim2 imageDim(std::string fileName); @@ -38,7 +38,7 @@ namespace Texture { /** * The Texturec class. - * + * * This class can handle an array of textures and allows easy binding of those * textures. */ @@ -51,7 +51,7 @@ private: */ unsigned int texState; - + public: /** @@ -59,44 +59,44 @@ public: */ std::vector<GLuint> image; - + /** * Populates the image array from a list of strings, with each string as a * separate argument. */ - + Texturec(uint amt, ...); - + /** * Populates the image array from an array of strings. */ - + Texturec(uint amt,const char **paths); Texturec(std::vector<std::string>vec); Texturec( std::initializer_list<std::string> l ); - + /** * Frees memory taken by the image array. */ - + ~Texturec(); - + /** * Binds the next texture in the array, incrementing texState. */ - + void bindNext(); - + /** * Binds the previous texture in the array, decrementing texState. */ - + void bindPrev(); - + /** * Binds the texture with the provided index. */ - + void bind(unsigned int); }; diff --git a/include/common.h b/include/common.hpp index 6f453b0..d69fc91 100644 --- a/include/common.h +++ b/include/common.hpp @@ -19,7 +19,7 @@ #include <mutex> #include <future> #include <math.h> -#include <threadpool.h> +#include <threadpool.hpp> #include <algorithm> #define GLEW_STATIC @@ -40,6 +40,7 @@ typedef unsigned int uint; */ #define SHADERS +#define C(x) std::cout << x << std::endl template<typename N> N abso(N v){ diff --git a/include/config.h b/include/config.hpp index 4d56d9c..4d56d9c 100644 --- a/include/config.h +++ b/include/config.hpp diff --git a/include/entities.h b/include/entities.hpp index 1250708..c62e625 100644 --- a/include/entities.h +++ b/include/entities.hpp @@ -1,10 +1,10 @@ #ifndef ENTITIES_H #define ENTITIES_H -#include <common.h> -#include <Quest.h> -#include <inventory.h> -#include <Texture.h> +#include <common.hpp> +#include <Quest.hpp> +#include <inventory.hpp> +#include <Texture.hpp> #include <sstream> @@ -14,7 +14,7 @@ #define Structurep(n) ((Structures *)n) #define Mobp(n) ((Mob *)n) -#define PLAYER_INV_SIZE 30 // The size of the player's inventory +#define PLAYER_INV_SIZE 43 // The size of the player's inventory #define NPC_INV_SIZE 3 // Size of an NPC's inventory enum _TYPE { diff --git a/include/inventory.h b/include/inventory.hpp index 7369642..cbce9d9 100644 --- a/include/inventory.h +++ b/include/inventory.hpp @@ -1,10 +1,10 @@ #ifndef INVENTORY_H #define INVENTORY_H -#include <common.h> +#include <common.hpp> #include <string.h> -#include <Texture.h> +#include <Texture.hpp> #define DEBUG diff --git a/include/threadpool.h b/include/threadpool.hpp index c341673..c341673 100644 --- a/include/threadpool.h +++ b/include/threadpool.hpp diff --git a/include/ui.h b/include/ui.hpp index 2a7518f..0ab76de 100644 --- a/include/ui.h +++ b/include/ui.hpp @@ -5,12 +5,12 @@ #ifndef UI_H #define UI_H -#include <common.h> -#include <inventory.h> +#include <common.hpp> +#include <inventory.hpp> #include <cstdarg> -#include <config.h> -#include <world.h> +#include <config.hpp> +#include <world.hpp> #include <ft2build.h> #include <SDL2/SDL_opengl.h> #include <thread> diff --git a/include/world.h b/include/world.hpp index 0b87134..c7b0a65 100644 --- a/include/world.h +++ b/include/world.hpp @@ -8,8 +8,8 @@ #ifndef WORLD_H #define WORLD_H -#include <common.h> -#include <entities.h> +#include <common.hpp> +#include <entities.hpp> #define GROUND_HEIGHT_INITIAL 80 #define GROUND_HEIGHT_MINIMUM 60 @@ -18,11 +18,11 @@ using namespace tinyxml2; * Game includes */ -#include <config.h> -#include <common.h> -#include <world.h> -#include <ui.h> -#include <entities.h> +#include <config.hpp> +#include <common.hpp> +#include <world.hpp> +#include <ui.hpp> +#include <entities.hpp> /** * Defines how many game ticks should occur in one second, affecting how often diff --git a/src/Quest.cpp b/src/Quest.cpp index 8f3c33b..781b164 100644 --- a/src/Quest.cpp +++ b/src/Quest.cpp @@ -1,14 +1,14 @@ #include <algorithm>
-#include <Quest.h>
-#include <entities.h>
+#include <Quest.hpp>
+#include <entities.hpp>
extern Player *player;
int QuestHandler::assign(std::string title,std::string desc,std::string req){
Quest tmp;
char *tok;
-
+
tmp.title = title;
tmp.desc = desc;
@@ -17,17 +17,17 @@ int QuestHandler::assign(std::string title,std::string desc,std::string req){ strcpy(buf.get(),req.c_str());
tok = strtok(buf.get(),"\n\r\t,");
tmp.need.push_back({"\0",0});
-
+
while(tok){
if(tmp.need.back().name != "\0"){
tmp.need.back().n = atoi(tok);
tmp.need.push_back({"\0",0});
}else
tmp.need.back().name = tok;
-
+
tok = strtok(NULL,"\n\r\t,");
}
-
+
tmp.need.pop_back();
current.push_back(tmp);
@@ -39,7 +39,7 @@ int QuestHandler::drop(std::string title){ current.end(),
[&](Quest q){ return q.title == title; }),
current.end() );
-
+
return 0;
}
@@ -50,15 +50,15 @@ int QuestHandler::finish(std::string t){ if ( player->inv->hasItem( n.name ) < n.n )
return 0;
}
-
+
for ( auto &n : (*c).need )
player->inv->takeItem( n.name, n.n );
-
+
current.erase( c );
return 1;
}
}
-
+
return 0;
}
@@ -67,6 +67,6 @@ bool QuestHandler::hasQuest(std::string t){ if ( c.title == t )
return true;
}
-
+
return false;
}
diff --git a/src/Texture.cpp b/src/Texture.cpp index 1ae5567..24dbb6a 100644 --- a/src/Texture.cpp +++ b/src/Texture.cpp @@ -1,7 +1,7 @@ #include <algorithm> #include <string> -#include <Texture.h> +#include <Texture.hpp> /** * A structure for keeping track of loaded textures. diff --git a/src/common.cpp b/src/common.cpp index 1c9c2b5..10ff64e 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -9,7 +9,7 @@ # include <vector> #endif // __WIN32__ -#include <common.h> +#include <common.hpp> #ifndef __WIN32__ @@ -80,18 +80,18 @@ const char *readFile(const char *path){ std::ifstream in (path,std::ios::in); unsigned int size; GLchar *buf; - + if(!in.is_open()){ std::cout<<"Error reading file "<<path<<"!"<<std::endl; abort(); } - + in.seekg(0,in.end); buf = new GLchar[(size = in.tellg()) + 1]; in.seekg(0,in.beg); in.read(buf,size); buf[size] = '\0'; - + in.close(); return buf; } diff --git a/src/config.cpp b/src/config.cpp index 45bab3f..5f297b7 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -1,6 +1,6 @@ -#include <config.h> +#include <config.hpp> -#include <ui.h> +#include <ui.hpp> using namespace tinyxml2; @@ -24,7 +24,7 @@ void readConfig(){ xml.LoadFile("config/settings.xml"); scr = xml.FirstChildElement("screen"); - + if(scr->QueryUnsignedAttribute("width",&uval) == XML_NO_ERROR) SCREEN_WIDTH = uval; else SCREEN_WIDTH = 1280; @@ -39,7 +39,7 @@ void readConfig(){ else HLINE = 3; vol = xml.FirstChildElement("volume"); - + if(vol->FirstChildElement("master")->QueryFloatAttribute("volume",&fval) == XML_NO_ERROR) VOLUME_MASTER = fval; else VOLUME_MASTER = 50; @@ -49,7 +49,7 @@ void readConfig(){ if(vol->FirstChildElement("sfx")->QueryFloatAttribute("volume",&fval) == XML_NO_ERROR) VOLUME_SFX = fval; else VOLUME_SFX = 50; - + ui::initFonts(); ui::setFontFace(xml.FirstChildElement("font")->Attribute("path")); updateConfig(); diff --git a/src/entities.cpp b/src/entities.cpp index 5a92c48..6476755 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -1,7 +1,7 @@ #include <istream> -#include <entities.h> -#include <ui.h> +#include <entities.hpp> +#include <ui.hpp> extern std::istream *names; diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 075aec3..f398ca0 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -1,7 +1,7 @@ -#include <common.h> -#include <entities.h> -#include <world.h> -#include <ui.h> +#include <common.hpp> +#include <entities.hpp> +#include <world.hpp> +#include <ui.hpp> #include <tinyxml2.h> using namespace tinyxml2; @@ -212,13 +212,13 @@ CONT: void commonPageFunc( Mob *callee ) { static bool lock = false; - + if ( !lock ) { lock = true; - + ui::drawPage( callee->heyid ); ui::waitForDialog(); - + callee->alive = false; lock = false; } diff --git a/src/inventory.cpp b/src/inventory.cpp index 7ba5909..7317179 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -1,6 +1,6 @@ -#include <inventory.h> -#include <entities.h> -#include <ui.h> +#include <inventory.hpp> +#include <entities.hpp> +#include <ui.hpp> #include <tinyxml2.h> using namespace tinyxml2; @@ -190,7 +190,6 @@ void Inventory::setSelectionDown(){ void Inventory::draw(void){ static unsigned int lop = 0; - //const unsigned int numSlot = 7; static std::vector<int>dfp(numSlot); static std::vector<Ray>iray(numSlot); static std::vector<vec2>curCoord(numSlot); @@ -314,6 +313,28 @@ void Inventory::draw(void){ glVertex2i(mr.x-(itemWide/2)+itemWide,mr.y-(itemWide/2)+itemWide); glVertex2i(mr.x-(itemWide/2), mr.y-(itemWide/2)+itemWide); glEnd(); + if(!items.empty() && a < items.size() && items[a+numSlot].count){ + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, itemtex[items[a+numSlot].id]); + glColor4f(1.0f, 1.0f, 1.0f, ((float)massDfp[a]/(float)(massRange?massRange:1))*0.8f); + glBegin(GL_QUADS); + if(itemMap[items[a].id]->height > itemMap[items[a+numSlot].id]->width){ + glTexCoord2i(0,1);glVertex2i(mr.x-((itemWide/2)*((float)itemMap[items[a+numSlot].id]->width/(float)itemMap[items[a+numSlot].id]->height)), mr.y-(itemWide/2)); + glTexCoord2i(1,1);glVertex2i(mr.x+((itemWide/2)*((float)itemMap[items[a+numSlot].id]->width/(float)itemMap[items[a+numSlot].id]->height)), mr.y-(itemWide/2)); + glTexCoord2i(1,0);glVertex2i(mr.x+((itemWide/2)*((float)itemMap[items[a+numSlot].id]->width/(float)itemMap[items[a+numSlot].id]->height)), mr.y+(itemWide/2)); + glTexCoord2i(0,0);glVertex2i(mr.x-((itemWide/2)*((float)itemMap[items[a+numSlot].id]->width/(float)itemMap[items[a+numSlot].id]->height)), mr.y+(itemWide/2)); + }else{ + glTexCoord2i(0,1);glVertex2i(mr.x-(itemWide/2),mr.y-(itemWide/2)*((float)itemMap[items[a+numSlot].id]->height/(float)itemMap[items[a+numSlot].id]->width)); + glTexCoord2i(1,1);glVertex2i(mr.x+(itemWide/2),mr.y-(itemWide/2)*((float)itemMap[items[a+numSlot].id]->height/(float)itemMap[items[a+numSlot].id]->width)); + glTexCoord2i(1,0);glVertex2i(mr.x+(itemWide/2),mr.y+(itemWide/2)*((float)itemMap[items[a+numSlot].id]->height/(float)itemMap[items[a+numSlot].id]->width)); + glTexCoord2i(0,0);glVertex2i(mr.x-(itemWide/2),mr.y+(itemWide/2)*((float)itemMap[items[a+numSlot].id]->height/(float)itemMap[items[a+numSlot].id]->width)); + } + glEnd(); + glDisable(GL_TEXTURE_2D); + ui::setFontColor(255,255,255,((float)massDfp[a]/(float)(massRange?massRange:1))*255); + ui::putText(mr.x-(itemWide/2)+(itemWide*.85),mr.y-(itemWide/2),"%d",items[a+numSlot].count); + ui::setFontColor(255,255,255,255); + } a++; }a=0; @@ -364,14 +385,16 @@ void Inventory::draw(void){ } glEnd(); glDisable(GL_TEXTURE_2D); - ui::putText(r.end.x-(itemWide/2),r.end.y-(itemWide*.9),"%s",itemMap[items[a].id]->name.c_str()); + ui::setFontColor(255,255,255,((float)dfp[a]/(float)(range?range:1))*255); + ui::putStringCentered(r.end.x,r.end.y-(itemWide*.9),itemMap[items[a].id]->name.c_str()); ui::putText(r.end.x-(itemWide/2)+(itemWide*.85),r.end.y-(itemWide/2),"%d",items[a].count); + ui::setFontColor(255,255,255,255); } if(sel == a){ static float sc = 1; static bool up; - up ? sc += .01 : sc -= .01; + up ? sc += .0005*deltaTime : sc -= .0005*deltaTime; if(sc > 1.2){ up = false; sc = 1.2; @@ -380,10 +403,6 @@ void Inventory::draw(void){ up = true; sc = 1.0; } - glPushMatrix(); - glLoadIdentity(); - //glTranslatef(-sc, -sc, 0); - //glScalef(sc,sc,0.0f); glBegin(GL_QUADS); glColor4f(1.0f, 1.0f, 1.0f, ((float)dfp[a]/(float)(range?range:1))); glVertex2f(r.end.x - (itemWide*sc)/2 - (itemWide*sc)*.09,r.end.y - (itemWide*sc)/2 - (itemWide*sc)*.09); @@ -406,7 +425,6 @@ void Inventory::draw(void){ glVertex2f(r.end.x + (itemWide*sc)/2 + (itemWide*sc)*.09,r.end.y + (itemWide*sc)/2 + (itemWide*sc)*.09); glVertex2f(r.end.x + (itemWide*sc)/2 ,r.end.y + (itemWide*sc)/2 + (itemWide*sc)*.09); glEnd(); - glPopMatrix(); } a++; } diff --git a/src/threadpool.cpp b/src/threadpool.cpp index 619f002..c4f1c4a 100644 --- a/src/threadpool.cpp +++ b/src/threadpool.cpp @@ -1,4 +1,4 @@ -#include "threadpool.h" +#include <threadpool.hpp> /** * Stolen from some guy. @@ -1,4 +1,4 @@ -#include <ui.h> +#include <ui.hpp> /* * Create a macro to easily access SDL keypresses diff --git a/src/world.cpp b/src/world.cpp index d8fd2d3..54ff921 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -1,8 +1,8 @@ #include <algorithm> #include <sstream> -#include <world.h> -#include <ui.h> +#include <world.hpp> +#include <ui.hpp> #include <tinyxml2.h> using namespace tinyxml2; @@ -433,10 +433,10 @@ void World::draw(Player *p){ safeSetColorA( 255, 255, 255, weather == WorldWeather::Snowy ? 150 : 255 - worldShade * 4); glBegin( GL_QUADS ); - glTexCoord2i( 0, 0 ); glVertex2i( worldStart, SCREEN_HEIGHT ); - glTexCoord2i( 1, 0 ); glVertex2i( -worldStart, SCREEN_HEIGHT ); - glTexCoord2i( 1, 1 ); glVertex2i( -worldStart, 0 ); - glTexCoord2i( 0, 1 ); glVertex2i( worldStart, 0 ); + glTexCoord2i( 0, 0 ); glVertex2i( offset.x - SCREEN_WIDTH/2, SCREEN_HEIGHT ); + glTexCoord2i( 1, 0 ); glVertex2i( offset.x + SCREEN_WIDTH/2, SCREEN_HEIGHT ); + glTexCoord2i( 1, 1 ); glVertex2i( offset.x + SCREEN_WIDTH/2, 0 ); + glTexCoord2i( 0, 1 ); glVertex2i( offset.x - SCREEN_WIDTH/2, 0 ); glEnd(); bgTex->bindNext(); diff --git a/xml/playerSpawnHill1_Building1.xml b/xml/playerSpawnHill1_Building1.xml index f0c8a21..cbb41d0 100644 --- a/xml/playerSpawnHill1_Building1.xml +++ b/xml/playerSpawnHill1_Building1.xml @@ -28,7 +28,45 @@ <text id="4"> Have a sword though. - <give id="Wood Sword" count="1" /> + <give id="Wood Sword" count="1"/> + <give id="Wood Sword2" count="1"/> + <give id="Wood Sword3" count="1"/> + <give id="Wood Sword4" count="1"/> + <give id="Wood Sword5" count="1"/> + <give id="Wood Sword6" count="1"/> + <give id="Wood Sword7" count="1"/> + <give id="Wood Sword8" count="1"/> + <give id="Wood Sword9" count="1"/> + <give id="Wood Sword10" count="1"/> + <give id="Wood Sword11" count="1"/> + <give id="Wood Sword12" count="1"/> + <give id="Wood Sword13" count="1"/> + <give id="Wood Sword14" count="1"/> + <give id="Wood Sword15" count="1"/> + <give id="Wood Sword16" count="1"/> + <give id="Wood Sword17" count="1"/> + <give id="Wood Sword18" count="1"/> + <give id="Wood Sword19" count="1"/> + <give id="Wood Sword20" count="1"/> + <give id="Wood Sword21" count="1"/> + <give id="Wood Sword22" count="1"/> + <give id="Wood Sword23" count="1"/> + <give id="Wood Sword24" count="1"/> + <give id="Wood Sword25" count="1"/> + <give id="Wood Sword26" count="1"/> + <give id="Wood Sword27" count="1"/> + <give id="Wood Sword28" count="1"/> + <give id="Wood Sword29" count="1"/> + <give id="Wood Sword30" count="1"/> + <give id="Wood Sword31" count="1"/> + <give id="Wood Sword32" count="1"/> + <give id="Wood Sword33" count="1"/> + <give id="Wood Sword34" count="1"/> + <give id="Wood Sword35" count="1"/> + <give id="Wood Sword36" count="1"/> + <give id="Wood Sword37" count="1"/> + <give id="Wood Sword38" count="1"/> + <give id="Wood Sword39" count="1"/> </text> </Dialog> |