aboutsummaryrefslogtreecommitdiffstats
path: root/include/inventory.h
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2015-11-20 08:47:34 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2015-11-20 08:47:34 -0500
commit0a30bd1b2e2f02b6f34225d8976f645c99b53b7e (patch)
tree16a47672bf5f5bc65efb245b2e9d84a08c1ce2a6 /include/inventory.h
parent20b29fccb6da62d5a07a02477fabac3a80d350dd (diff)
Started inv ui, new item system
Diffstat (limited to 'include/inventory.h')
-rw-r--r--include/inventory.h68
1 files changed, 62 insertions, 6 deletions
diff --git a/include/inventory.h b/include/inventory.h
index d2b4c28..dc5c04e 100644
--- a/include/inventory.h
+++ b/include/inventory.h
@@ -5,26 +5,82 @@
#define DEBUG
+#define ID Item(
+#define NAME ,
+#define TYPE ,
+#define WIDTH ,
+#define HEIGHT ,
+#define STACKSIZE ,
+#define TEX ,
+#define ENI ),
+#define STOP )
+
/*
* A list of all item IDs.
*/
+static unsigned int sel;
+
enum ITEM_ID {
+ DEBUG_ITEM = 69,
TEST_ITEM = 1,
- SWORD_ITEM = 2
+ PLAYER_BAG = 2,
+ FLASHLIGHT = 3,
+ SWORD_WOOD = 4
+};
+
+enum ITEM_TYPE{
+ TOOL = 1,
+ SWORD = 2,
+ RANGED = 3,
+ EQUIP = 4,
+ FOOD = 5
};
-struct item_t { // Used to define entries in an entity's inventory
- short count; // Quantity of the item in this slot
+class Item{
+protected:
+public:
+ friend class Inventory;
+ friend unsigned int initInventorySprites(void);
ITEM_ID id; // ID of the item
-} __attribute__ ((packed));
+ char *name;
+ ITEM_TYPE type; // What category the item falls under
+ float width;
+ float height;
+ int maxStackSize;
+ char* textureLoc;
+ 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){
+ count = 0;
+ }
+ void addCount(int c){
+ count += c;
+ }
+
+};
+
+static Item item[5]= {
+ #include "../config/items.h"
+};
+
+struct item_t{
+ int count;
+ ITEM_ID itmid;
+ void addC(int c, ITEM_ID i){
+ count = c;
+ itmid = i;
+ item[itmid].addCount(count);
+ }
+} __attribute__((packed));
+
class Inventory {
private:
- unsigned int sel;
unsigned int size; // Size of 'item' array
- struct item_t *item; // An array of the items contained in this inventory.
+ //struct item_t *item; // An array of the items contained in this inventory.
public:
+
Inventory(unsigned int s); // Creates an inventory of size 's'
~Inventory(void); // Free's 'item'