aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Texture.h6
-rw-r--r--include/common.h6
-rw-r--r--include/entities.h85
-rw-r--r--include/inventory.h9
-rw-r--r--include/ui.h4
-rw-r--r--include/world.h7
6 files changed, 80 insertions, 37 deletions
diff --git a/include/Texture.h b/include/Texture.h
index c590f6a..1a32aae 100644
--- a/include/Texture.h
+++ b/include/Texture.h
@@ -13,13 +13,15 @@ class Texturec{
private:
unsigned int texState;
public:
+ GLuint *image;
+
Texturec(uint amt, ...);
+ ~Texturec();
+
void bindNext();
void bindPrev();
void bind(unsigned int);
void walk();
-
- GLuint *image;
};
#endif //TEXTURE_H
diff --git a/include/common.h b/include/common.h
index 0ddb5e4..52daf4b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -61,8 +61,8 @@ typedef struct {
#define GAME_NAME "Independent Study v.0.4 alpha"
-#define SCREEN_WIDTH 800
-#define SCREEN_HEIGHT 600
+#define SCREEN_WIDTH 1280
+#define SCREEN_HEIGHT 720
//#define FULLSCREEN
@@ -116,6 +116,8 @@ extern vec2 offset;
extern float handAngle;
+extern unsigned int loops;
+
/*
* 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 b9881ea..c593710 100644
--- a/include/entities.h
+++ b/include/entities.h
@@ -38,56 +38,74 @@ class Entity{
public:
Inventory *inv;
- float width; //width and height of the player
+ /*
+ * Movement variables
+ */
+
+ vec2 loc;
+ vec2 vel;
+
+ float width;
float height;
- float speed; //speed of the play
+
+ float speed; // A speed factor for X movement
+
+ /*
+ * Movement flags
+ */
+
+ bool near; // Causes name to display
+ bool canMove; // Enables movement
+ bool right,left; // Direction faced by Entity
+ bool alive;
+ unsigned char ground; // Shows how the Entity is grounded (if it is)
+
+ /*
+ * Health variables
+ */
float health;
float maxHealth;
- int subtype;
- _TYPE type;
- //example:
- //type 1(NPC)
- // |(subtype)
- // |-> 0 Base NPC
- // |-> 1 Merchant
+ /*
+ * Identification variables
+ */
- 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
- unsigned char ground; //variable for testing what ground the entity is on to apply certain traits
+ _TYPE type;
+ int subtype;
- char* name;
- GENDER gender;
- //GLuint texture[3]; //TODO: ADD TEXTURES
- Texturec* tex;
+ char *name;
+ GENDER gender;
+
+ Texturec *tex;
- void spawn(float, float);
void draw(void);
+ void spawn(float, float);
+
+ int ticksToUse; // Used by wander()
+
virtual void wander(int){}
- void getName();
virtual void interact(){}
- int ticksToUse; //The variable for deciding how long an entity should do a certain task
-private:
};
class Player : public Entity {
public:
QuestHandler qh;
+ bool light = false;
+
Player();
+ ~Player();
void interact();
- bool light = false;
};
class NPC : public Entity{
public:
std::vector<int (*)(NPC *)>aiFunc;
+
NPC();
+ ~NPC();
+
void addAIFunc(int (*func)(NPC *),bool preload);
void interact();
void wander(int);
@@ -97,7 +115,10 @@ class Structures : public Entity{
public:
void *inWorld;
void *inside;
+
Structures();
+ ~Structures();
+
unsigned int spawn(_TYPE, float, float);
};
@@ -105,22 +126,28 @@ class Mob : public Entity{
public:
double init_y;
void (*hey)();
+
Mob(int);
Mob(int,unsigned int);
+ ~Mob();
+
void wander(int);
};
class Object : public Entity{
+private:
+ int identifier;
public:
+ char *pickupDialog;
+ bool questObject = false;
+
Object(ITEM_ID id, bool qo, const char *pd);
+ ~Object();
+
void interact(void);
- bool questObject = false;
- char *pickupDialog;
std::thread runInteract() {
return std::thread([=] { interact(); });
}
-private:
- int identifier;
};
#endif // ENTITIES_H
diff --git a/include/inventory.h b/include/inventory.h
index a9a4bcb..cde8d2a 100644
--- a/include/inventory.h
+++ b/include/inventory.h
@@ -49,13 +49,19 @@ public:
int maxStackSize;
char* textureLoc;
Texturec *tex;
+ GLuint text;
int count;
+
Item(ITEM_ID i, const char *n, ITEM_TYPE t, float w, float h, int m, const char *tl);
GLuint rtex(){
return tex->image[0];
}
};
+static Item item[5]= {
+ #include "../config/items.h"
+};
+
struct item_t{
int count;
ITEM_ID id;
@@ -67,14 +73,13 @@ private:
unsigned int size; // Size of 'item' array
item_t *inv;
int os = 0;
- //struct item_t *item; // An array of the items contained in this inventory.
public:
unsigned int sel;
bool invOpen = false;
bool invOpening = false;
Inventory(unsigned int s); // Creates an inventory of size 's'
- ~Inventory(void); // Free's 'item'
+ ~Inventory(void); // Free's allocated memory
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
diff --git a/include/ui.h b/include/ui.h
index c3c8940..4d30b9b 100644
--- a/include/ui.h
+++ b/include/ui.h
@@ -59,7 +59,8 @@ namespace ui {
* limited until a right click is given, closing the box.
*/
- void dialogBox(const char *name,char *opt,const char *text,...);
+ void dialogBox(const char *name,const char *opt,const char *text,...);
+ void waitForDialog(void);
/*
* Draws a larger string in the center of the screen. Drawing is done inside this function.
@@ -76,7 +77,6 @@ namespace ui {
/*
* Handle keyboard/mouse events.
*/
-
void handleEvents(void);
/*
diff --git a/include/world.h b/include/world.h
index a2414e6..6c0395d 100644
--- a/include/world.h
+++ b/include/world.h
@@ -63,6 +63,12 @@ protected:
void singleDetect(Entity *e);
/*
+ * Deletes all entities in the world.
+ */
+
+ void deleteEntities(void);
+
+ /*
* The size of the line array. This is set once by World->generate().
*/
@@ -205,6 +211,7 @@ private:
World *exit;
public:
Arena(World *leave,Player *p);
+ ~Arena(void);
World *exitArena(Player *p);
};