aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2016-01-07 08:33:54 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2016-01-07 08:33:54 -0500
commite043a2432c4dacce56a308948188482fb230ff33 (patch)
treeb8809e54bc3c516dabfa8eace3b51a92d5c8fbcd /include
parentc7e3d72f0ef08cb9463cd8960bc29dad40e3bdcb (diff)
parent45edad31559852d306d59b50f380cb79c9f27dcc (diff)
Hey, that's pretty good lighting!
Diffstat (limited to 'include')
-rw-r--r--include/common.h17
-rw-r--r--include/entities.h39
-rw-r--r--include/inventory.h17
-rw-r--r--include/ui.h2
-rw-r--r--include/world.h16
5 files changed, 87 insertions, 4 deletions
diff --git a/include/common.h b/include/common.h
index 207b95f..0c4d700 100644
--- a/include/common.h
+++ b/include/common.h
@@ -151,6 +151,23 @@ extern unsigned int loops;
extern GLuint shaderProgram;
/**
+ * This class contains a string for identification and a value. It can be used to
+ * save certain events for and decisions so that they can be recalled later.
+ */
+
+class Condition {
+private:
+ char *id;
+ void *value;
+public:
+ Condition(const char *_id,void *val);
+ ~Condition();
+
+ bool sameID(const char *s);
+ void *getValue(void);
+};
+
+/**
* Prints a formatted debug message to the console, along with the callee's file and line
* number.
*/
diff --git a/include/entities.h b/include/entities.h
index a4bc282..90af0f2 100644
--- a/include/entities.h
+++ b/include/entities.h
@@ -32,7 +32,8 @@ enum MOB_SUB {
MS_RABBIT = 1,
MS_BIRD,
MS_TRIGGER,
- MS_DOOR
+ MS_DOOR,
+ MS_PAGE
};
enum BUILD_SUB{
@@ -44,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 +165,9 @@ public:
virtual void interact(){}
virtual ~Entity(){}
+
+ char *baseSave(void);
+ void baseLoad(char *);
};
class Player : public Entity{
@@ -150,6 +179,11 @@ public:
~Player();
void interact();
};
+
+typedef struct {
+ EntitySavePacket esp;
+} __attribute__ ((packed)) NPCSavePacket;
+
class NPC : public Entity{
public:
std::vector<int (*)(NPC *)>aiFunc;
@@ -160,6 +194,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);
diff --git a/include/ui.h b/include/ui.h
index 6a81dab..b769bbf 100644
--- a/include/ui.h
+++ b/include/ui.h
@@ -33,6 +33,8 @@ namespace ui {
extern unsigned char dialogOptChosen;
extern bool dialogImportant;
+ extern unsigned int textWrapLimit;
+
/*
* Initializes the FreeType system.
*/
diff --git a/include/world.h b/include/world.h
index e10d0dc..5021fbb 100644
--- a/include/world.h
+++ b/include/world.h
@@ -8,6 +8,9 @@
#ifndef WORLD_H
#define WORLD_H
+#include <ostream>
+#include <istream>
+
#include <common.h>
#include <entities.h>
@@ -133,6 +136,7 @@ protected:
*/
Texturec *bgTex;
+ WORLD_BG_TYPE bgType;
/**
* The Mix_Music object that holds the background soundtrack for the world.
@@ -173,13 +177,19 @@ public:
std::vector<Light > light;
void addStructure(_TYPE t,BUILD_SUB sub,float x,float y,World *inside);
- void addVillage(int bCount, int npcMin, int npcMax,_TYPE t,float x,float y,World *outside);
+ void addVillage(int bCount, int npcMin, int npcMax,_TYPE t,World *inside);
void addMob(int t,float x,float y);
void addMob(int t,float x,float y,void (*hey)(Mob *));
void addNPC(float x,float y);
void addObject(ITEM_ID, bool, const char *, float, float);
void addParticle(float, float, float, float, float, float, Color color, int);
void addLight(vec2, Color);
+
+ NPC *getAvailableNPC(void);
+
+ /*
+ * Update coordinates of all entities.
+ */
void update(Player *p,unsigned int delta);
@@ -263,8 +273,8 @@ public:
int getTheWidth(void);
- void save(FILE *);
- void load(FILE *);
+ void save(std::ofstream *);
+ void load(std::ifstream *);
};
/*