diff options
Diffstat (limited to 'include/inventory.h')
-rw-r--r-- | include/inventory.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/include/inventory.h b/include/inventory.h index 46053f6..2793ad7 100644 --- a/include/inventory.h +++ b/include/inventory.h @@ -2,6 +2,7 @@ #define INVENTORY_H #include <common.h> +#include <string.h> #define DEBUG @@ -19,8 +20,6 @@ * A list of all item IDs. */ -static unsigned int sel; - enum ITEM_ID { DEBUG_ITEM = 69, TEST_ITEM = 1, @@ -49,28 +48,41 @@ public: float height; int maxStackSize; char* textureLoc; + Texturec *tex; int count; Item(ITEM_ID i, char* n, ITEM_TYPE t, float w, float h, int m, char* tl): - id(i), name(n), type(t), width(w), height(h), maxStackSize(m), textureLoc(tl){ + id(i), type(t), width(w), height(h), maxStackSize(m){ count = 0; + + name = (char*)calloc(strlen(n ),sizeof(char)); + textureLoc = (char*)calloc(strlen(tl),sizeof(char)); + + strcpy(name,n); + strcpy(textureLoc,tl); + + tex= new Texturec(1,textureLoc); } - void addCount(int c){ - count += c; + GLuint rtex(){ + return tex->image[0]; } - }; struct item_t{ int count; - ITEM_ID itmid; + ITEM_ID id; } __attribute__((packed)); class Inventory { private: unsigned int size; // Size of 'item' array + item_t *inv; + int os = 0; //struct item_t *item; // An array of the items contained in this inventory. public: + unsigned int sel; + bool invOpen = false; + bool invOpening = false; Inventory(unsigned int s); // Creates an inventory of size 's' ~Inventory(void); // Free's 'item' @@ -88,7 +100,6 @@ public: }; -unsigned int initInventorySprites(void); // Loads as many inventory textures as it can find, returns count void itemUse(void *p); #endif // INVENTORY_H |