diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/entities.h | 5 | ||||
-rw-r--r-- | include/inventory.h | 68 | ||||
-rw-r--r-- | include/world.h | 2 |
3 files changed, 67 insertions, 8 deletions
diff --git a/include/entities.h b/include/entities.h index c2de1b1..403c3c5 100644 --- a/include/entities.h +++ b/include/entities.h @@ -113,9 +113,12 @@ public: class Object : public Entity{ public: Object(int); + Object(int, bool, char*); void interact(); + bool questObject = false; + char *pickupDialog; private: - int ID; + int identifier; }; #endif // ENTITIES_H 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' diff --git a/include/world.h b/include/world.h index 1a96252..4c82b2c 100644 --- a/include/world.h +++ b/include/world.h @@ -102,7 +102,7 @@ public: void addMob(int t,float x,float y); void addMob(int t,float x,float y,void (*hey)()); void addNPC(float x,float y); - void addObject(int, float, float); + void addObject(int, bool, char*, float, float); void update(Player *p,unsigned int delta); |