diff options
Diffstat (limited to 'include/entities.h')
-rw-r--r-- | include/entities.h | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/include/entities.h b/include/entities.h index 6b8cc32..f26863e 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[32]; + //Texturec *tex; +} __attribute__ ((packed)) EntitySavePacket; + class World; class Particles{ @@ -127,6 +152,7 @@ public: GENDER gender; Texturec *tex; + Texturec *ntex; unsigned int randDialog; @@ -139,9 +165,12 @@ public: virtual void interact(){} virtual ~Entity(){} + + char *baseSave(void); + void baseLoad(char *); }; -class Player : public Entity { +class Player : public Entity{ public: QuestHandler qh; bool light = false; @@ -161,8 +190,18 @@ public: void addAIFunc(int (*func)(NPC *),bool preload); void interact(); void wander(int); + + char *save(unsigned int *size); + void load(unsigned int,char *b); }; +typedef struct { + EntitySavePacket esp; + World *inWorld; + World *inside; + BUILD_SUB bsubtype; +} __attribute__ ((packed)) StructuresSavePacket; + class Structures : public Entity{ public: World *inWorld; @@ -173,6 +212,9 @@ public: ~Structures(); unsigned int spawn(_TYPE, BUILD_SUB, float, float, World *); + + char *save(void); + void load(char *s); }; class Mob : public Entity{ @@ -181,23 +223,44 @@ public: void (*hey)(Mob *callee); Mob(int); - Mob(int,unsigned int); ~Mob(); void wander(int); + + char *save(void); + void load(char *); }; +typedef struct { + EntitySavePacket esp; + double init_y; + //void (*hey)(Mob *callee); +} __attribute__ ((packed)) MobSavePacket; + +typedef struct { + EntitySavePacket esp; + ITEM_ID identifier; + bool questObject; + char pickupDialog[256]; +} __attribute__ ((packed)) ObjectSavePacket; + class Object : public Entity{ private: - int identifier; + ITEM_ID identifier; public: char *pickupDialog; bool questObject = false; + Object(); Object(ITEM_ID id, bool qo, const char *pd); ~Object(); + void reloadTexture(void); + void interact(void); + + char *save(void); + void load(char *); }; #endif // ENTITIES_H |