Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/mapfile.cc')
-rw-r--r--src/model/mapfile.cc53
1 files changed, 48 insertions, 5 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index d24a684..fd82036 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -1439,6 +1439,7 @@ Model * MapFile::load(std::string const &name)
Light *tag_light = 0;
SubModel *tag_submodel = 0;
Sound *tag_sound = 0;
+ Weapon *tag_weapon = 0;
std::string modelname;
math::Vector3f location;
@@ -1828,19 +1829,57 @@ Model * MapFile::load(std::string const &name)
}
} else if (mapfile.got_classname("location_cannon")) {
- // TODO cannon attachment point
+
+ // new cannon slot
+ tag_weapon = new Weapon();
+ model->add_weapon(tag_weapon);
continue;
} else if (mapfile.classname().compare("location_cannon") == 0) {
- // TODO cannon options
+
+ // cannon options
+ if (mapfile.got_key_axis(tag_weapon->get_axis())) {
+ continue;
+
+ } else if (mapfile.got_key_vector3f("origin", location)) {
+ tag_weapon->get_location().assign(location * SCALE);
+ continue;
+
+ } else if (mapfile.got_key_float("radius", r)) {
+ tag_weapon->set_radius(r * SCALE);
+ continue;
+
+ } else if (mapfile.got_key()) {
+ mapfile.unknown_key();
+
+ }
continue;
- } else if (mapfile.got_classname("location_turret")) {
- // TODO turret attachment point
+ } else if (mapfile.got_classname("location_turret")) {
+
+ // new turret slot
+ tag_weapon = new Weapon();
+ model->add_weapon(tag_weapon);
continue;
} else if (mapfile.classname().compare("location_turret") == 0) {
- // TODO turret options
+
+ // turret options
+ if (mapfile.got_key_axis(tag_weapon->get_axis())) {
+ continue;
+
+ } else if (mapfile.got_key_vector3f("origin", location)) {
+ tag_weapon->get_location().assign(location * SCALE);
+ continue;
+
+ } else if (mapfile.got_key_float("radius", r)) {
+ tag_weapon->set_radius(r * SCALE);
+ continue;
+
+ } else if (mapfile.got_key()) {
+ mapfile.unknown_key();
+
+ }
continue;
} else if (mapfile.got_classname("location_cockpit")) {
@@ -2031,6 +2070,10 @@ Model * MapFile::load(std::string const &name)
for (Model::Docks::iterator dit = model->docks().begin(); dit != model->docks().end(); dit++) {
(*dit)->get_location() -= map_center;
}
+
+ for (Model::Weapons::iterator wit = model->weapons().begin(); wit != model->weapons().end(); wit++) {
+ (*wit)->get_location() -= map_center;
+ }
if (mapfile.warning_q2brush)
con_warn << mapfile.name() << " quake2 style brushes detected" << std::endl;