diff options
Diffstat (limited to 'src/model/model.cc')
-rw-r--r-- | src/model/model.cc | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/model/model.cc b/src/model/model.cc index b3c8b03..8c853f8 100644 --- a/src/model/model.cc +++ b/src/model/model.cc @@ -41,16 +41,6 @@ Triangle::~Triangle() { } - -/* ---------- core::Engine ------------------------------------------ */ - -Engine::Engine(math::Vector3f const & location) : - engine_location(location) -{} - -Engine::~Engine() -{} - /* ---------- core::Model ------------------------------------------ */ std::map<std::string, Model*> Model::registry; @@ -101,7 +91,8 @@ Model::Model(std::string const & name) : float class_angle = 0; math::Color class_color; unsigned int class_spawnflags = 0; - float class_light = 100; + float class_light = 0.0f; + float class_radius = 0.0f; float class_frequency = 1.0f; float class_offset = 0; float class_time = 0.0f; @@ -124,7 +115,8 @@ Model::Model(std::string const & name) : class_origin = math::Vector3f(0,0,0); class_color = math::Color(1, 1, 1); class_spawnflags = 0; - class_light = 100; + class_light = 0.0f; + class_radius = 0.0f; class_offset = 0; class_frequency = 1.0f; class_time = 0.0f; @@ -153,12 +145,19 @@ Model::Model(std::string const & name) : brush_detail = false; } else if ((level == 1) && (class_name == "target_engine")) { - //con_debug << " engine at " << class_origin << "\n"; - add_engine(new Engine(class_origin * model_scale)); + model::Engine *engine = new Engine(class_origin * model_scale); + if (class_radius) + engine->engine_radius = class_radius / 100.0f; + add_engine(engine); + } else if ((level == 1) && (class_name == "light")) { Light *light = new Light(class_origin * model_scale, class_color, (class_spawnflags & 1) == 1); - light->light_radius = class_light / 100.0f; - light->light_offset = class_offset; + if (class_light) + light->light_radius = class_light / 100.0f; + else if (class_radius) + light->light_radius = class_radius / 100.0f; + if (class_offset > 0) + light->light_offset = class_offset; if (class_frequency > 0 ) light->light_frequency = class_frequency; if (class_time > 0 ) @@ -244,6 +243,15 @@ Model::Model(std::string const & name) : std::istringstream is(tmp); is >> class_light; + } else if (firstword == "\"radius\"") { + std::string tmp; + char c; + while ((linestream.get(c)) && (c != '"')); + while ((linestream.get(c)) && (c != '"')) + tmp += c; + std::istringstream is(tmp); + is >> class_radius; + } else if (firstword == "\"frequency\"") { std::string tmp; char c; |