diff options
author | Stijn Buys <ingar@osirion.org> | 2014-12-07 16:12:49 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2014-12-07 16:12:49 +0000 |
commit | 2c98d3eef488233b99a76ca44d69c1c9d53404af (patch) | |
tree | 9259bad9533d1de7381b291eee19fd319b8366eb /src/core/slot.cc | |
parent | acb236d0df275394095ab43e8519aebc4811865d (diff) |
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.
Diffstat (limited to 'src/core/slot.cc')
-rw-r--r-- | src/core/slot.cc | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/core/slot.cc b/src/core/slot.cc index 58bb51c..8907097 100644 --- a/src/core/slot.cc +++ b/src/core/slot.cc @@ -13,16 +13,35 @@ namespace core Slot::Slot() { + clear(); +} + +Slot::~Slot() +{ +} + +void Slot::load(const model::Slot *slot_tag, const float modelscale) +{ + if (slot_tag) { + set_type(slot_tag->type()); + set_location(slot_tag->location() * modelscale); + set_axis(slot_tag->axis()); + set_radius(slot_tag->radius()); + set_cone(slot_tag->cone() * M_PI / 180.0f); + } else { + Slot(); + } +} + +void Slot::clear() +{ slot_item = 0; slot_flags = 0; slot_timestamp = 0; slot_last_fired = 0; slot_cone = 0; - slot_type = model::Weapon::Cannon; -} - -Slot::~Slot() -{ + slot_radius = 1.0f; + slot_type = model::Slot::None; } void Slot::set_flag(const Flags flag) @@ -43,14 +62,4 @@ void Slot::set_item(Item *item) set_timestamp(game() ? game()->timestamp() : 1); } -void Slot::load(const model::Weapon * weapon_tag) -{ - if (weapon_tag) { - set_type(weapon_tag->type()); - set_cone(weapon_tag->cone() * M_PI / 180.0f); - set_location(weapon_tag->location()); - set_axis(weapon_tag->axis()); - } -} - } // namespace core |