From 614ce1267772d67825a32fb7495a049cd6498fe5 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 1 Jan 2013 15:20:14 +0000 Subject: Initial support for turret-style weapons. --- src/model/mapfile.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/model/mapfile.cc') diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 3df2659..e06de58 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -1834,7 +1834,7 @@ Model * MapFile::load(std::string const &name) } else if (mapfile.got_classname("location_cannon")) { // new cannon slot - tag_weapon = new Weapon(); + tag_weapon = new Weapon(Weapon::Cannon); model->add_weapon(tag_weapon); continue; @@ -1848,8 +1848,8 @@ Model * MapFile::load(std::string const &name) tag_weapon->get_location().assign(location * SCALE); continue; - } else if (mapfile.got_key_float("radius", r)) { - tag_weapon->set_radius(r * SCALE); + } else if (mapfile.got_key_float("cone", r)) { + tag_weapon->set_cone(r); continue; } else if (mapfile.got_key()) { @@ -1858,10 +1858,10 @@ Model * MapFile::load(std::string const &name) } continue; - } else if (mapfile.got_classname("location_turret")) { + } else if (mapfile.got_classname("location_turret")) { // new turret slot - tag_weapon = new Weapon(); + tag_weapon = new Weapon(Weapon::Turret); model->add_weapon(tag_weapon); continue; @@ -1875,8 +1875,8 @@ Model * MapFile::load(std::string const &name) tag_weapon->get_location().assign(location * SCALE); continue; - } else if (mapfile.got_key_float("radius", r)) { - tag_weapon->set_radius(r * SCALE); + } else if (mapfile.got_key_float("cone", r)) { + tag_weapon->set_cone(r); continue; } else if (mapfile.got_key()) { @@ -2039,7 +2039,6 @@ Model * MapFile::load(std::string const &name) for (Model::Weapons::const_iterator wit = submodel_model->weapons().begin(); wit != submodel_model->weapons().end(); wit++) { tag_weapon = new Weapon(*(*wit)); tag_weapon->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_weapon->location() - submodel_model->origin()) * tag_submodel->scale()); - tag_weapon->set_radius(tag_weapon->radius() * tag_submodel->scale()); model->add_weapon(tag_weapon); } -- cgit v1.2.3