diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/entity.cc | 2 | ||||
-rw-r--r-- | src/core/entity.h | 4 | ||||
-rw-r--r-- | src/core/slot.cc | 23 | ||||
-rw-r--r-- | src/core/slot.h | 73 | ||||
-rw-r--r-- | src/core/slots.cc | 2 |
5 files changed, 89 insertions, 15 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc index feff172..7ed1328 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -1013,6 +1013,7 @@ EntityControlable::EntityControlable() : EntityDynamic() entity_owner = 0; entity_actioninterface = 0; + entity_controlflags = 0; } EntityControlable::EntityControlable(std::istream & is) : @@ -1032,6 +1033,7 @@ EntityControlable::EntityControlable(std::istream & is) : entity_owner = 0; entity_actioninterface = 0; + entity_controlflags = 0; } diff --git a/src/core/entity.h b/src/core/entity.h index 72553fa..d90de8b 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -703,8 +703,8 @@ public: } /// returns true if the specified control flag is set - inline bool has_controlflag(ControlFlags flag) const { - return ((flag && entity_controlflags) == flag); + inline bool has_controlflag(ControlFlags controlflag) const { + return ((controlflag & entity_controlflags) == controlflag); } /// physics action diff --git a/src/core/slot.cc b/src/core/slot.cc index 89f885c..ace3be2 100644 --- a/src/core/slot.cc +++ b/src/core/slot.cc @@ -6,6 +6,7 @@ #include "core/slot.h" #include "core/item.h" +#include "core/application.h" namespace core { @@ -13,24 +14,40 @@ namespace core Slot::Slot() { slot_item = 0; - slot_active = true; + slot_flags = 0; slot_timestamp = 0; + slot_last_fired = 0; + + slot_interval = 0; + slot_lifespan = 0; + slot_speed = 0.0f; + + } Slot::Slot(const math::Vector3f & location) : slot_location(location) { slot_item = 0; - slot_active = true; + slot_flags = 0; slot_timestamp = 0; + slot_last_fired = 0; + slot_interval = 0;; + slot_lifespan = 0; + slot_speed = 0.0f; } Slot::~Slot() { slot_item = 0; - slot_active = false; + slot_flags = 0; slot_timestamp = 0; + slot_last_fired = 0; + + slot_interval = 0; + slot_lifespan = 0; + slot_speed = 0.0f; } void Slot::set_item(Item *item) diff --git a/src/core/slot.h b/src/core/slot.h index d0f2fdc..6b6c47b 100644 --- a/src/core/slot.h +++ b/src/core/slot.h @@ -22,6 +22,8 @@ namespace core * */ class Slot { public: + enum Flags {Active = 1}; + /** * @brief default constructor * Creates an empty slot @@ -59,6 +61,27 @@ public: * projectiles generated by this slot * */ + /** + * */ + inline unsigned long last_fired() const + { + return slot_last_fired; + } + + inline unsigned long interval() const + { + return slot_interval; + } + + inline unsigned long lifespan() const + { + return slot_lifespan; + } + + inline float speed() const + { + return slot_speed; + } /* --- mutators -------------------------------------------- */ @@ -86,28 +109,60 @@ public: { slot_timestamp = timestamp; } - + + /** + * @brief + * */ + inline void set_last_fired(unsigned long last_fired) + { + slot_last_fired = last_fired; + } + + inline void set_interval(unsigned long interval) + { + slot_interval = interval; + } + + inline void set_lifespan(unsigned long lifespan) + { + slot_lifespan = lifespan; + } + + inline void set_speed(float speed) + { + slot_speed = speed; + } + /** * @brief set the item this slot is holding * */ - inline void set_item(Item *item); + void set_item(Item *item); private: math::Vector3f slot_location; + math::Axis slot_axis; + + // slot flags + unsigned int slot_flags; unsigned long slot_timestamp; - // FIXME consolidate into slot_flags - bool slot_active; - std::string slot_particlesystem_name; + unsigned long slot_last_fired; - // fire rate, in projectiles per second - float slot_fire_rate; - // fire range, in game units - float slot_fire_range; + // interval between two shots, in milliseconds + unsigned long slot_interval; + // projectile lifespane + unsigned long slot_lifespan; + + // projectile speed, in gameunits / second + float slot_speed; + + // item mounted in this slot Item *slot_item; + + std::string slot_particlesystem_name; }; } // namespace core diff --git a/src/core/slots.cc b/src/core/slots.cc index 031aba2..afbc29f 100644 --- a/src/core/slots.cc +++ b/src/core/slots.cc @@ -25,7 +25,7 @@ void Slots::load(model::Model *model) Slot *slot = new Slot((*it)->location()); slots_container.push_back(slot); } - //con_debug << " loaded " << slots_container.size() << " entity slots" << std::endl; + con_debug << " loaded " << slots_container.size() << " entity slots" << std::endl; } void Slots::clear() |