From 4e60d3e2d3f66471dff75732626451690a5bc8b5 Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Wed, 23 Mar 2016 08:24:55 -0400 Subject: Flickering lights and light that follows player --- include/entities.h | 33 ++++++++++++++++----------------- include/world.h | 36 ++++++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 27 deletions(-) (limited to 'include') diff --git a/include/entities.h b/include/entities.h index 450975f..442219c 100644 --- a/include/entities.h +++ b/include/entities.h @@ -139,10 +139,10 @@ public: vec2 loc; vec2 vel; - + float width; float height; - + float speed; // A speed factor for X movement /* @@ -172,7 +172,7 @@ public: char *name; GENDER gender; - + Texturec *tex; Texturec *ntex; @@ -180,22 +180,21 @@ public: void draw(void); void spawn(float, float); - + int ticksToUse; // Used by wander() - + virtual void wander(int){} virtual void interact(){} void follow(Entity *e); - + virtual ~Entity(){} }; class Player : public Entity{ public: QuestHandler qh; - bool light = false; - + Player(); ~Player(); void save(void); @@ -206,10 +205,10 @@ class NPC : public Entity{ public: std::vectoraiFunc; int dialogIndex; - + NPC(); ~NPC(); - + void addAIFunc(int (*func)(NPC *),bool preload); void clearAIFunc(void); virtual void interact(); @@ -233,10 +232,10 @@ public: World *inWorld; std::string inside; std::string textureLoc; - + Structures(); ~Structures(); - + unsigned int spawn(BUILD_SUB, float, float); }; @@ -246,10 +245,10 @@ public: double init_y; void (*hey)(Mob *callee); std::string heyid; - + Mob(int); ~Mob(); - + void wander(int); }; @@ -259,13 +258,13 @@ private: public: std::string pickupDialog; bool questObject = false; - + Object(); Object(std::string in,std::string pd); ~Object(); - + void reloadTexture(void); - + void interact(void); }; #endif // ENTITIES_H diff --git a/include/world.h b/include/world.h index 152d654..85b5370 100644 --- a/include/world.h +++ b/include/world.h @@ -46,16 +46,6 @@ enum class WorldWeather : unsigned char { Rain /**< Rain (to be implemented)*/ }; -/** - * The light structure, used to store light coordinates and color. - */ - -typedef struct { - vec2 loc; /**< Light location */ - Color color; /**< Light color */ - float radius; -} Light; - /** * The line structure. * This structure is used to store the world's ground, stored in vertical @@ -85,6 +75,32 @@ extern std::string currentXML; // prototype so Village can reference it class World; +/** + * The light structure, used to store light coordinates and color. + */ + +typedef struct { + vec2 loc; /**< Light location */ + Color color; /**< Light color */ + float radius; /**< Light radius */ + + bool belongsTo; + Entity *following; + + bool flame; + float fireFlicker; + vec2 fireLoc; + + // Light(vec2 l, Color c, float r){ + // loc = l; + // color = c; + // radius = r; + // belongsTo = false; + // following = nullptr; + // } +} Light; + + /** * The village class, used to group structures into villages. */ -- cgit v1.2.3