aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Quest.h8
-rw-r--r--include/entities.h11
-rw-r--r--include/inventory.h29
3 files changed, 44 insertions, 4 deletions
diff --git a/include/Quest.h b/include/Quest.h
index c4b8780..11d04a6 100644
--- a/include/Quest.h
+++ b/include/Quest.h
@@ -5,13 +5,15 @@
#include <cstdlib>
#include <cstring>
+#include <inventory.h>
+
#define TOTAL_QUESTS 1
class Quest {
public:
char *title,*desc;
- unsigned int reward;
- Quest(const char *t,const char *d,unsigned int r);
+ struct item_t reward;
+ Quest(const char *t,const char *d,struct item_t r);
~Quest();
};
@@ -20,7 +22,7 @@ public:
std::vector<const Quest *>current;
int assign(const char *t);
int drop(const char *t);
- int finish(const char *t);
+ int finish(const char *t,void *completer);
bool hasQuest(const char *t);
};
diff --git a/include/entities.h b/include/entities.h
index b58d569..4c1b484 100644
--- a/include/entities.h
+++ b/include/entities.h
@@ -2,18 +2,25 @@
#define ENTITIES_H
#include <common.h>
+#include <inventory.h>
#define NPCp(n) ((NPC *)n)
+#define PLAYER_INV_SIZE 30 // The size of the player's inventory
+#define NPC_INV_SIZE 3 // Size of an NPC's inventory
+
extern FILE* names;
class Entity{
public:
+ Inventory *inv;
+
void *inWorld;
+
float width; //width and height of the player
float height;
float speed; //speed of the play
- //type and subtype
+
int subtype;
_TYPE type;
//example:
@@ -21,8 +28,10 @@ public:
// |(subtype)
// |-> 0 Base NPC
// |-> 1 Merchant
+
vec2 loc; //location and velocity of the entity
vec2 vel;
+
bool near;
bool right,left, canMove; //movement variables
bool alive; //the flag for whether or not the entity is alive
diff --git a/include/inventory.h b/include/inventory.h
new file mode 100644
index 0000000..8f42cc5
--- /dev/null
+++ b/include/inventory.h
@@ -0,0 +1,29 @@
+#ifndef INVENTORY_H
+#define INVENTORY_H
+
+#include <cstdlib>
+
+enum ITEM_ID { // Contains item IDs for every item in the game, this is how items are stored. IDs are also used to lookup item strings
+ TEST_ITEM = 1 // A test item (duh)
+};
+
+struct item_t { // Used to define entries in an entity's inventory
+ short count; // Quantity of the item in this slot
+ ITEM_ID id; // ID of the item
+} __attribute__ ((packed));
+
+class Inventory {
+private:
+ unsigned int size; // Size of 'item' array
+ 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'
+
+ int addItem(ITEM_ID id,unsigned char count); // Add 'count' items with an id of 'id' to the inventory
+ int takeItem(ITEM_ID id,unsigned char count); // Take 'count' items with an id of 'id' from the inventory
+
+ void draw(void); // Draws a text list of items in this inventory (should only be called for the player for now)
+};
+
+#endif // INVENTORY_H