diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/entities.h | 35 | ||||
-rw-r--r-- | include/inventory.h | 17 |
2 files changed, 52 insertions, 0 deletions
diff --git a/include/entities.h b/include/entities.h index 6b8cc32..894dc16 100644 --- a/include/entities.h +++ b/include/entities.h @@ -45,6 +45,31 @@ enum BUILD_SUB{ FOUNTAIN }; +typedef struct { + InventorySavePacket isp; + vec2 loc; + vec2 vel; + float width; + float height; + float speed; + float health; + float maxHealth; + int subtype; + int ticksToUse; + unsigned int randDialog; + unsigned char ground; + bool near; + bool canMove; + bool right,left; + bool alive; + bool hit; + _TYPE type; + GENDER gender; + size_t nameSize; + //char *name; + //Texturec *tex; +} __attribute__ ((packed)) EntitySavePacket; + class World; class Particles{ @@ -139,6 +164,9 @@ public: virtual void interact(){} virtual ~Entity(){} + + char *baseSave(void); + void baseLoad(char *); }; class Player : public Entity { @@ -151,6 +179,10 @@ public: void interact(); }; +typedef struct { + EntitySavePacket esp; +} __attribute__ ((packed)) NPCSavePacket; + class NPC : public Entity{ public: std::vector<int (*)(NPC *)>aiFunc; @@ -161,6 +193,9 @@ public: void addAIFunc(int (*func)(NPC *),bool preload); void interact(); void wander(int); + + char *save(unsigned int *size); + void load(char *b); }; class Structures : public Entity{ diff --git a/include/inventory.h b/include/inventory.h index 31b7d88..b035f91 100644 --- a/include/inventory.h +++ b/include/inventory.h @@ -60,6 +60,11 @@ struct item_t{ ITEM_ID id; } __attribute__((packed)); +typedef struct { + unsigned int size; + int os; + unsigned int sel; +} __attribute__ ((packed)) InventorySavePacket; class Inventory { private: @@ -87,6 +92,18 @@ public: void draw(void); // Draws a text list of items in this inventory (should only be called for the player for now) + char *save(void){ + static InventorySavePacket *isp = new InventorySavePacket(); + isp->size = size; + isp->os = os; + isp->sel = sel; + return (char *)isp; + } + void load(InventorySavePacket *isp){ + size = isp->size; + os = isp->os; + sel = isp->sel; + } }; void itemUse(void *p); |