From 18377e3c0efe9359c341c0c330f6de1697afb788 Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Thu, 16 Jun 2016 08:49:43 -0400 Subject: Changes --- include/entities.hpp | 100 +++++++++++++++++++++++++++++---------------------- include/world.hpp | 1 + 2 files changed, 58 insertions(+), 43 deletions(-) (limited to 'include') diff --git a/include/entities.hpp b/include/entities.hpp index 7e68be3..2523364 100644 --- a/include/entities.hpp +++ b/include/entities.hpp @@ -108,6 +108,60 @@ extern const unsigned int NPC_INV_SIZE; // a prototype of the world class, necessary for some function prototypes class World; +/** + * The light structure, used to store light coordinates and color. + */ + +class Light{ +public: + vec2 loc; /**< Light location */ + Color color; /**< Light color */ + float radius; /**< Light radius */ + + bool belongsTo; + Entity *following; + + bool flame; + float fireFlicker; + vec2 fireLoc; + Light() + { + loc = vec2(0,0); + color = Color(1.0, 1.0, 1.0); + radius = 0; + + belongsTo = false; + following = nullptr; + + flame = false; + } + + Light(vec2 l, float r, Color c) + { + loc = l; + color = c; + radius = r; + + belongsTo = false; + following = nullptr; + + flame = false; + } + + void follow(Entity *f) + { + following = f; + belongsTo = true; + } + + void makeFlame(void) + { + flame = true; + } + + void createFromXML(XMLElement *e); +}; + /** * The entity class. * This class contains common functions and variables for all types of @@ -174,6 +228,9 @@ public: // the entity's inventory Inventory *inv; + // the entity's light + Light light; + // the entity's health float health; @@ -348,49 +405,6 @@ public: void saveToXML(void); }; -/** - * The light structure, used to store light coordinates and color. - */ - -class Light{ -public: - 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, float r, Color c) - { - loc = l; - color = c; - radius = r; - - belongsTo = false; - following = nullptr; - - flame = false; - } - - void follow(Entity *f) - { - following = f; - belongsTo = true; - } - - void makeFlame(void) - { - flame = true; - } - - void createFromXML(XMLElement *e); -}; - /** * The particle class, handles a single particle. */ diff --git a/include/world.hpp b/include/world.hpp index cea79c1..34a597d 100644 --- a/include/world.hpp +++ b/include/world.hpp @@ -137,6 +137,7 @@ public: * drawing. */ class World { +friend class ItemLight; protected: /** -- cgit v1.2.3