diff options
author | Stijn Buys <ingar@osirion.org> | 2013-01-01 15:20:14 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-01-01 15:20:14 +0000 |
commit | 614ce1267772d67825a32fb7495a049cd6498fe5 (patch) | |
tree | 20374ef083b62524e831bce2a8a89fcc70a63f42 /src/model/mapfile.cc | |
parent | 18969b1c444597741547598d35e8f0f97acd39dc (diff) |
Initial support for turret-style weapons.
Diffstat (limited to 'src/model/mapfile.cc')
-rw-r--r-- | src/model/mapfile.cc | 15 |
1 files changed, 7 insertions, 8 deletions
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); } |