From 2c98d3eef488233b99a76ca44d69c1c9d53404af Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 7 Dec 2014 16:12:49 +0000 Subject: Cleanup of the slots code, unified model weapon and dock tags into a single slots list, load dock tags into entity slots, represent entity slot locations in entity coordinate space, have r_slots render fixed-size slot indicators regardless of model scale. --- src/core/slot.h | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'src/core/slot.h') diff --git a/src/core/slot.h b/src/core/slot.h index 5466de8..99353ee 100644 --- a/src/core/slot.h +++ b/src/core/slot.h @@ -23,19 +23,29 @@ namespace core * */ class Slot { public: - enum Flags {Mounted = 1, Active = 2}; + enum Flags {None = 0, Mounted = 1, Active = 2}; /** * @brief default constructor * Creates an empty slot * */ Slot(); - + /** * @brief default destructor * */ ~Slot(); + /** + * @brief load slot configuration from a model slot + * */ + void load(const model::Slot *slot_tag, const float modelscale); + + /** + * @brief clear slot values + * */ + void clear(); + /** * @brief location of the slot within the parent model * */ @@ -85,10 +95,18 @@ public: return slot_last_fired; } + /** + * @brief slot radius + * */ + inline const float radius() const + { + return slot_radius; + } + /** * @brief slot fire cone, in degrees * */ - inline float cone() const + inline const float cone() const { return slot_cone; } @@ -96,7 +114,7 @@ public: /** * @brief weapon slot type * */ - inline const model::Weapon::Type type() const + inline const model::Slot::Type type() const { return slot_type; } @@ -160,10 +178,18 @@ public: slot_cone = cone; } + /** + * @brief set slot slot_radius + * */ + void set_radius(const float radius) + { + slot_radius = radius; + } + /** * @brief set slot type * */ - void set_type(const model::Weapon::Type type) + void set_type(const model::Slot::Type type) { slot_type = type; } @@ -171,13 +197,19 @@ public: /** * @brief load slot parameters from a model weapon tag * */ - void load(const model::Weapon *weapon_tag); + void load(const model::Slot *slot_tag); private: + model::Slot::Type slot_type; + math::Vector3f slot_location; math::Axis slot_axis; + + float slot_radius; + + float slot_cone; // slot flags unsigned int slot_flags; @@ -188,13 +220,8 @@ private: // timestamp indicating when the slot last generated a projectile, server-side unsigned long slot_last_fired; - // item mounted in this slot Item *slot_item; - - model::Weapon::Type slot_type; - - float slot_cone; }; } // namespace core -- cgit v1.2.3