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.cc68
1 files changed, 27 insertions, 41 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index 49122d5..3a8aa40 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -1429,13 +1429,12 @@ Model * MapFile::load(std::string const &name)
Model *model = new Model(name);
mapfile.clear_bbox();
- Dock *tag_dock = 0;
+ Slot *tag_slot = 0;
Particles *tag_particles = 0;
Flare *tag_flare = 0;
Light *tag_light = 0;
SubModel *tag_submodel = 0;
Sound *tag_sound = 0;
- Weapon *tag_weapon = 0;
std::string modelname;
math::Vector3f location;
@@ -1820,25 +1819,25 @@ Model * MapFile::load(std::string const &name)
} else if (mapfile.got_classname("location_dock")) {
// new docking location
- tag_dock = new Dock();
- model->add_dock(tag_dock);
+ tag_slot = new Slot(Slot::Dock);
+ model->add_slot(tag_slot);
} else if (mapfile.classname().compare("location_dock") == 0) {
// dock attributes
- if (mapfile.got_key_axis(tag_dock->get_axis())) {
+ if (mapfile.got_key_axis(tag_slot->get_axis())) {
continue;
} else if (mapfile.got_key_vector3f("origin", location)) {
- tag_dock->get_location().assign(location * SCALE);
+ tag_slot->get_location().assign(location * SCALE);
continue;
} else if (mapfile.got_key_float("radius", r)) {
- tag_dock->set_radius(r * SCALE);
+ tag_slot->set_radius(r * SCALE);
continue;
} else if (mapfile.got_key_string("info", str)) {
- tag_dock->set_info(str);
+ tag_slot->set_info(str);
} else if (mapfile.got_key()) {
mapfile.unknown_key();
@@ -1848,26 +1847,26 @@ Model * MapFile::load(std::string const &name)
} else if (mapfile.got_classname("location_cannon")) {
// new cannon slot
- tag_weapon = new Weapon(Weapon::Cannon);
- model->add_weapon(tag_weapon);
+ tag_slot = new Slot(Slot::Cannon);
+ model->add_slot(tag_slot);
continue;
} else if (mapfile.classname().compare("location_cannon") == 0) {
// cannon options
- if (mapfile.got_key_axis(tag_weapon->get_axis())) {
+ if (mapfile.got_key_axis(tag_slot->get_axis())) {
continue;
} else if (mapfile.got_key_vector3f("origin", location)) {
- tag_weapon->get_location().assign(location * SCALE);
+ tag_slot->get_location().assign(location * SCALE);
continue;
} else if (mapfile.got_key_float("cone", r)) {
- tag_weapon->set_cone(r);
+ tag_slot->set_cone(r);
continue;
} else if (mapfile.got_key_string("info", str)) {
- tag_weapon->set_info(str);
+ tag_slot->set_info(str);
} else if (mapfile.got_key()) {
mapfile.unknown_key();
@@ -1878,26 +1877,26 @@ Model * MapFile::load(std::string const &name)
} else if (mapfile.got_classname("location_turret")) {
// new turret slot
- tag_weapon = new Weapon(Weapon::Turret);
- model->add_weapon(tag_weapon);
+ tag_slot = new Slot(Slot::Turret);
+ model->add_slot(tag_slot);
continue;
} else if (mapfile.classname().compare("location_turret") == 0) {
// turret options
- if (mapfile.got_key_axis(tag_weapon->get_axis())) {
+ if (mapfile.got_key_axis(tag_slot->get_axis())) {
continue;
} else if (mapfile.got_key_vector3f("origin", location)) {
- tag_weapon->get_location().assign(location * SCALE);
+ tag_slot->get_location().assign(location * SCALE);
continue;
} else if (mapfile.got_key_float("cone", r)) {
- tag_weapon->set_cone(r);
+ tag_slot->set_cone(r);
continue;
} else if (mapfile.got_key_string("info", str)) {
- tag_weapon->set_info(str);
+ tag_slot->set_info(str);
} else if (mapfile.got_key()) {
mapfile.unknown_key();
@@ -2048,21 +2047,12 @@ Model * MapFile::load(std::string const &name)
model->add_sound(tag_sound);
}
- // copy dock tags
- for (Model::Docks::const_iterator dit = submodel_model->docks().begin(); dit != submodel_model->docks().end(); ++dit) {
- tag_dock = new Dock(*(*dit));
- tag_dock->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_dock->location() - submodel_model->origin()) * tag_submodel->scale());
- model->add_dock(tag_dock);
+ // copy slot tags
+ for (Model::Slots::const_iterator slit = submodel_model->slots().begin(); slit != submodel_model->slots().end(); ++slit) {
+ tag_slot = new Slot(*(*slit));
+ tag_slot->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_slot->location() - submodel_model->origin()) * tag_submodel->scale());
+ model->add_slot(tag_slot);
}
-
- // copy weapon tags
- 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());
- model->add_weapon(tag_weapon);
- }
-
-
}
delete tag_submodel;
@@ -2124,14 +2114,10 @@ Model * MapFile::load(std::string const &name)
(*sit)->get_location() -= map_center;
}
- for (Model::Docks::iterator dit = model->docks().begin(); dit != model->docks().end(); ++dit) {
- (*dit)->get_location() -= map_center;
+ for (Model::Slots::iterator slit = model->slots().begin(); slit != model->slots().end(); ++slit) {
+ (*slit)->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;