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/model/tags.cc | 52 ++++++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 32 deletions(-) (limited to 'src/model/tags.cc') diff --git a/src/model/tags.cc b/src/model/tags.cc index 7e5a393..f755373 100644 --- a/src/model/tags.cc +++ b/src/model/tags.cc @@ -121,23 +121,6 @@ Particles::~Particles() { } -/* ---- class Dock ------------------------------------------------- */ - -Dock::Dock() : Tag() -{ - dock_radius = 0.01f; -} - -Dock::Dock(const Dock& other) : Tag(other) -{ - dock_radius = other.radius(); - dock_axis.assign(other.axis()); -} - -Dock::~Dock() -{ -} - /* ---- class Sound ------------------------------------------------- */ Sound::Sound() : Tag() @@ -153,36 +136,41 @@ Sound::~Sound() { } -/* ---- class Dock ------------------------------------------------- */ +/* ---- class Slot ------------------------------------------------- */ -Weapon::Weapon(const Type type) : Tag() -{ +Slot::Slot(const Type type) : Tag() +{ + slot_radius = 0.0f; set_type(type); + } -Weapon::Weapon(const Weapon& other) : Tag(other) +Slot::Slot(const Slot& other) : Tag(other) { - weapon_type = other.type(); - weapon_cone = other.cone(); - weapon_axis.assign(other.axis()); + slot_type = other.type(); + slot_axis.assign(other.axis()); + slot_radius = other.radius(); + slot_cone = other.cone(); + } -Weapon::~Weapon() +Slot::~Slot() { } -void Weapon::set_type(const Type type) +void Slot::set_type(const Type type) { - weapon_type = type; - switch (weapon_type) { - case Unmountable: - weapon_cone = 0.0f; + slot_type = type; + switch (slot_type) { + case None: + case Dock: + slot_cone = 0.0f; break; case Cannon: - weapon_cone = 60.0f; // 60 degrees + slot_cone = 60.0f; // 60 degrees break; case Turret: - weapon_cone = 180.0f; // 180 degrees + slot_cone = 180.0f; // 180 degrees break; } } -- cgit v1.2.3