diff options
Diffstat (limited to 'src/model/mapfile.cc')
-rw-r--r-- | src/model/mapfile.cc | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 271af06..36dc536 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -920,6 +920,7 @@ Model * MapFile::load(std::string const &name) std::string modelname; math::Vector3f location; + math::Color color; typedef std::list<SubModel *> SubModelList; SubModelList submodel_list; @@ -1021,17 +1022,17 @@ Model * MapFile::load(std::string const &name) } else if (mapfile.classname().compare("light") == 0) { // light attributes - if (mapfile.got_key_vector3f("origin", light->light_location)) { - light->light_location *= SCALE; + if (mapfile.got_key_vector3f("origin", location)) { + light->set_location(location * SCALE); continue; } else if (mapfile.got_key_color("_color", light->light_color)) { continue; } else if (mapfile.got_key_int("spawnflags", u)) { - light->light_strobe = spawnflag_isset(u, 1); - light->light_entity = spawnflag_isset(u, 2); - light->light_engine = spawnflag_isset(u, 4); + light->set_strobe(spawnflag_isset(u, 1)); + light->set_entity(spawnflag_isset(u, 2)); + light->set_engine(spawnflag_isset(u, 4)); } else if (mapfile.got_key_float("light", light->light_radius)) { light->light_radius *= LIGHTSCALE; @@ -1105,17 +1106,17 @@ Model * MapFile::load(std::string const &name) } else if (mapfile.classname().compare("fx_flare") == 0) { // flare attributes - if (mapfile.got_key_vector3f("origin", flare->light_location)) { - flare->light_location *= SCALE; + if (mapfile.got_key_vector3f("origin", location)) { + flare->set_location(location * SCALE); continue; } else if (mapfile.got_key_color("_color", flare->light_color)) { continue; } else if (mapfile.got_key_int("spawnflags", u)) { - flare->light_strobe = spawnflag_isset(u, 1); - flare->light_entity = spawnflag_isset(u, 2); - flare->flare_engine = spawnflag_isset(u, 4); + flare->set_strobe(spawnflag_isset(u, 1)); + flare->set_entity(spawnflag_isset(u, 2)); + flare->set_engine(spawnflag_isset(u, 4)); } else if (mapfile.got_key_float("radius", flare->light_radius)) { flare->light_radius *= LIGHTSCALE; @@ -1134,30 +1135,30 @@ Model * MapFile::load(std::string const &name) } else if (mapfile.got_key_float("angle", angle)) { if (angle == ANGLEUP) { - flare->flare_axis.change_pitch(90.0f); + flare->get_axis().change_pitch(90.0f); } else if (angle == ANGLEDOWN) { - flare->flare_axis.change_pitch(-90.0f); + flare->get_axis().change_pitch(-90.0f); } else { - flare->flare_axis.change_direction(angle); + flare->get_axis().change_direction(angle); } } else if (mapfile.got_key_float("direction", angle)) { - flare->flare_axis.change_direction(angle); + flare->get_axis().change_direction(angle); } else if (mapfile.got_key_float("pitch", angle)) { - flare->flare_axis.change_pitch(angle); + flare->get_axis().change_pitch(angle); } else if (mapfile.got_key_float("roll", angle)) { - flare->flare_axis.change_roll(angle); + flare->get_axis().change_roll(angle); } else if (mapfile.got_key_string("cull", str)) { aux::to_lowercase(str); if (str.compare("none") == 0) { - flare->flare_cull = CullNone; + flare->set_cull(CullNone); } else if (str.compare("back") == 0) { - flare->flare_cull = CullBack; + flare->set_cull(CullBack); } else if (str.compare("front") == 0) { - flare->flare_cull = CullFront; + flare->set_cull(CullFront); } else { mapfile.unknown_value(); } @@ -1215,31 +1216,31 @@ Model * MapFile::load(std::string const &name) } else if (mapfile.classname().compare("fx_particles") == 0) { // particle system attributes - if (mapfile.got_key_vector3f("origin", particles->particles_location)) { - particles->particles_location *= SCALE; + if (mapfile.got_key_vector3f("origin", location)) { + particles->set_location(location * SCALE); continue; } else if (mapfile.got_key_string("script", particles->particles_script)) { continue; } else if (mapfile.got_key_float("angle", angle)) { if (angle == ANGLEUP) { - particles->particles_axis.change_pitch(90.0f); + particles->get_axis().change_pitch(90.0f); } else if (angle == ANGLEDOWN) { - particles->particles_axis.change_pitch(-90.0f); + particles->get_axis().change_pitch(-90.0f); } else { - particles->particles_axis.change_direction(angle); + particles->get_axis().change_direction(angle); } } else if (mapfile.got_key_float("direction", angle)) { - particles->particles_axis.change_direction(angle); + particles->get_axis().change_direction(angle); } else if (mapfile.got_key_float("pitch", angle)) { - particles->particles_axis.change_pitch(angle); + particles->get_axis().change_pitch(angle); } else if (mapfile.got_key_float("roll", angle)) { - particles->particles_axis.change_roll(angle); + particles->get_axis().change_roll(angle); } else if (mapfile.got_key_int("spawnflags", u)) { - particles->particles_entity = spawnflag_isset(u, 2); - particles->particles_engine = spawnflag_isset(u, 4); + particles->set_entity(spawnflag_isset(u, 2)); + particles->set_engine(spawnflag_isset(u, 4)); } else if (mapfile.got_key_float("radius", r)) { particles->set_radius(r * LIGHTSCALE); @@ -1248,11 +1249,11 @@ Model * MapFile::load(std::string const &name) aux::to_lowercase(str); if (str.compare("none") == 0) { - particles->particles_cull = CullNone; + particles->set_cull(CullNone); } else if (str.compare("back") == 0) { - particles->particles_cull = CullBack; + particles->set_cull(CullBack); } else if (str.compare("front") == 0) { - particles->particles_cull = CullFront; + particles->set_cull(CullFront); } else { mapfile.unknown_value(); } @@ -1269,15 +1270,15 @@ Model * MapFile::load(std::string const &name) // reposition docks, lights, flares and particles according to the model center for (Model::Lights::iterator lit = model->lights().begin(); lit != model->lights().end(); lit++) { - (*lit)->light_location -= mapfile.map_center; + (*lit)->get_location() -= mapfile.map_center; } for (Model::Flares::iterator flit = model->flares().begin(); flit != model->flares().end(); flit++) { - (*flit)->light_location -= mapfile.map_center; + (*flit)->get_location() -= mapfile.map_center; } for (Model::ParticleSystems::iterator pit = model->particles().begin(); pit != model->particles().end(); pit++) { - (*pit)->particles_location -= mapfile.map_center; + (*pit)->get_location() -= mapfile.map_center; } for (Model::Docks::iterator dit = model->docks().begin(); dit != model->docks().end(); dit++) { |