From 523ef5835f16ece38600b91f84936b7b0d2845a1 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan <tullivan99@gmail.com> Date: Wed, 3 Feb 2016 08:45:55 -0500 Subject: bug fixess --- include/Quest.h | 49 ++++++++----------------------------------------- include/common.h | 8 +------- include/entities.h | 9 ++------- include/inventory.h | 49 ++++--------------------------------------------- include/world.h | 4 ++-- 5 files changed, 17 insertions(+), 102 deletions(-) (limited to 'include') diff --git a/include/Quest.h b/include/Quest.h index d17ade4..cc01d27 100644 --- a/include/Quest.h +++ b/include/Quest.h @@ -20,46 +20,20 @@ #define DEBUG -/** - * The Quest class. - * - * This contains information for a single quest, and should only really be interacted - * with through QuestHandler. - */ +typedef struct { + std::string title; + std::string desc; + struct item_t reward; +} Quest; -class Quest { +/*class Quest { public: - - /** - * Contains the title of the quest. - */ - char *title; - - /** - * Contains the description of the quest. - */ - char *desc; - - /** - * Contains the single item that's given as a reward upon quest completion. - */ - struct item_t reward; - - /** - * Populates the values contained in this class. - */ - Quest(const char *t,const char *d,struct item_t r); - - /** - * Frees memory allocated for the title and description text. - */ - ~Quest(); -}; +};*/ /** * The Quest Handler class. @@ -70,12 +44,7 @@ public: class QuestHandler { public: - - /** - * A vector containing all quests currently being taken by the handler. - */ - - std::vector<const Quest *>current; + std::vector<Quest>current; /** * Adds a quest to the current quest vector by its title. @@ -103,6 +72,4 @@ public: bool hasQuest(const char *t); }; -#include <entities.h> - #endif // QUEST_H diff --git a/include/common.h b/include/common.h index 9f19134..ea3b593 100644 --- a/include/common.h +++ b/include/common.h @@ -38,7 +38,7 @@ typedef unsigned int uint; template<typename N> N abso(N v){ - if(v < 0.0){ + if(v < 0){ return v * -1; }else return v; @@ -92,8 +92,6 @@ struct col{ typedef col Color; -#include <Texture.h> - /** * Define the game's name (displayed in the window title). */ @@ -104,17 +102,14 @@ typedef col Color; * The desired width of the game window. */ -//#define SCREEN_WIDTH 1280 extern unsigned int SCREEN_WIDTH; /** * The desired height of the game window. */ -//#define SCREEN_HEIGHT 720 extern unsigned int SCREEN_HEIGHT; -//#define FULLSCREEN extern bool FULLSCREEN; /** @@ -127,7 +122,6 @@ extern bool FULLSCREEN; * */ -//#define HLINE 3 extern unsigned int HLINE; extern float VOLUME_MASTER; diff --git a/include/entities.h b/include/entities.h index f4959d6..41f2fff 100644 --- a/include/entities.h +++ b/include/entities.h @@ -4,6 +4,7 @@ #include <common.h> #include <Quest.h> #include <inventory.h> +#include <Texture.h> #define DEBUG @@ -14,7 +15,7 @@ #define PLAYER_INV_SIZE 30 // The size of the player's inventory #define NPC_INV_SIZE 3 // Size of an NPC's inventory -enum _TYPE { //these are the main types of entities +enum _TYPE { OBJECTT = -2, STRUCTURET, PLAYERT, @@ -58,7 +59,6 @@ public: float vely; Color color; vec2 index; - //GLuint tex; float duration; bool canMove; bool fountain; @@ -77,13 +77,11 @@ public: gravity = true; behind = false; index = Texture::getIndex(c); - //tex = text; } ~Particles(){ } void draw(){ - //glColor3f(color.red,color.green,color.blue); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, colorIndex); glUseProgram(shaderProgram); @@ -98,7 +96,6 @@ public: glEnd(); glDisable(GL_TEXTURE_2D); glUseProgram(0); - //glRectf(loc.x,loc.y,loc.x+width,loc.y+height); } bool kill(float delta){ duration -= delta; @@ -221,13 +218,11 @@ public: class Object : public Entity{ private: std::string iname; - //ITEM_ID identifier; public: char *pickupDialog; bool questObject = false; Object(); - //Object(ITEM_ID id,const char *pd); Object(std::string in,const char *pd); ~Object(); diff --git a/include/inventory.h b/include/inventory.h index d3bdd4d..e5209de 100644 --- a/include/inventory.h +++ b/include/inventory.h @@ -4,49 +4,12 @@ #include <common.h> #include <string.h> -#define DEBUG - -/*#define ID Item( -#define NAME , -#define TYPE , -#define WIDTH , -#define HEIGHT , -#define STACKSIZE , -#define TEX , -#define ENI ), -#define STOP )*/ - -/* - * A list of all item IDs. -*/ - -/*#define ITEM_COUNT 5 - -enum ITEM_ID { - DEBUG_ITEM = 0, - TEST_ITEM, - PLAYER_BAG, - FLASHLIGHT, - SWORD_WOOD -}; +#include <Texture.h> -enum ITEM_TYPE { - TOOL = 1, - SWORD, - RANGED, - EQUIP, - FOOD -};*/ +#define DEBUG class Item{ -protected: public: - //ITEM_ID id; // ID of the item - //ITEM_TYPE type; // What category the item falls under - - //char *name; - //char *type; - std::string name,type; float width; @@ -56,7 +19,6 @@ public: std::string texloc; Texturec *tex; - //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]; } @@ -64,16 +26,13 @@ public: struct item_t{ uint count; - uint/*ITEM_ID*/ id; + uint id; } __attribute__((packed)); class Inventory { private: - std::vector<item_t> items; - - unsigned int size; // Size of 'item' array - //item_t *inv; + unsigned int size; int os = 0; public: unsigned int sel; diff --git a/include/world.h b/include/world.h index a0c9a63..47e11f5 100644 --- a/include/world.h +++ b/include/world.h @@ -426,8 +426,8 @@ public: class Arena : public World { private: - vec2 pxy; - World *exit; + //vec2 pxy; + //World *exit; Mob *mmob; public: Arena(World *leave,Player *p,Mob *m); -- cgit v1.2.3