From f7283b2b9a9bf305ac110ef00cd5c21d5304bfbb Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 25 May 2008 16:44:37 +0000 Subject: target_flare --- src/model/map.cc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/model/map.cc') diff --git a/src/model/map.cc b/src/model/map.cc index 4b78f762..6769ba8 100644 --- a/src/model/map.cc +++ b/src/model/map.cc @@ -30,6 +30,7 @@ Model * Map::load(std::string const &name) Model *model = new Model(name); Light *light = 0; + Flare *flare = 0; Engine *engine = 0; unsigned int u; @@ -73,7 +74,48 @@ Model * Map::load(std::string const &name) continue; } + + } else if (mapfile.got_classname("target_flare")) { + + // new flare + flare = new Flare(); + model->add_flare(flare); + + } else if (mapfile.classname().compare("target_flare") == 0 ) { + + // flare attributes + if (mapfile.got_key_vector3f("origin", flare->light_location)) { + flare->light_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); + + } else if (mapfile.got_key_float("radius", flare->light_radius)) { + flare->light_radius /= 100.0f; + + } else if (mapfile.got_key_float("frequency", flare->light_frequency)) { + continue; + } else if (mapfile.got_key_float("offset", flare->light_offset)) { + continue; + + } else if (mapfile.got_key_float("time", flare->light_time)) { + continue; + + } else if (mapfile.got_key_int("flare", flare->light_flare)) { + continue; + + } else if (mapfile.got_key_float("angle", flare->flare_angle)) { + flare->flare_angle = math::degrees360f(flare->flare_angle); + continue; + + } + } else if (mapfile.got_classname("target_engine")) { // new engine engine = new Engine(); @@ -195,6 +237,10 @@ Model * Map::load(std::string const &name) (*lit)->light_location -= center; } + for (std::list::iterator flit = model->model_flare.begin(); flit != model->model_flare.end(); flit++) { + (*flit)->light_location -= center; + } + } con_print << " maps/" << model->name() << ".map " << mapfile.brushes << " brushes " << model->tris() -- cgit v1.2.3