From 5a099735d5457298b87a33884356ff29417143e6 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 23 Mar 2008 22:24:13 +0000 Subject: strobe lights --- src/core/model.cc | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/core/model.cc') diff --git a/src/core/model.cc b/src/core/model.cc index 686cbfd..7c83edd 100644 --- a/src/core/model.cc +++ b/src/core/model.cc @@ -82,10 +82,12 @@ void VertexArray::add_evertex(math::Vector3f const &v, math::Vector3f const &n) /* ---------- core::Light ------------------------------------------ */ -Light::Light(math::Vector3f const & location, math::Color const & color) : +Light::Light(math::Vector3f const & location, math::Color const & color, bool strobe) : light_location(location), light_color(color) -{} +{ + light_strobe = strobe; +} Light::~Light() {} @@ -144,6 +146,7 @@ Model::Model(std::string const & name) : math::Vector3f class_origin; float class_angle; math::Color class_color; + unsigned int class_spawnflags; model_first_evertex = VertexArray::evertex_index/3; model_first_vertex = VertexArray::vertex_index/3; @@ -163,6 +166,7 @@ Model::Model(std::string const & name) : class_name.clear(); class_origin = math::Vector3f(0,0,0); class_color = math::Color(1, 1, 1); + class_spawnflags = 0; } level ++; //cout << " LEVEL +" << level << std::endl; @@ -188,13 +192,15 @@ Model::Model(std::string const & name) : //con_debug << " engine at " << class_origin << "\n"; add_engine(new Engine(class_origin * model_scale)); } else if ((level == 1) && (class_name == "light")) { - add_light(new Light(class_origin * model_scale, class_color)); + add_light(new Light(class_origin * model_scale, class_color, (class_spawnflags & 1) == 1)); } if (level == 1) { class_angle = 0; class_name.clear(); class_origin = Vector3f(0,0,0); + class_color = math::Color(1, 1, 1); + class_spawnflags = 0; } level--; @@ -246,6 +252,16 @@ Model::Model(std::string const & name) : is >> class_angle; //con_debug << " angle '" << class_angle << "'" << std::endl; + } else if (firstword == "\"spawnflags\"") { + std::string tmp; + char c; + while ((linestream.get(c)) && (c != '"')); + while ((linestream.get(c)) && (c != '"')) + tmp += c; + std::istringstream is(tmp); + is >> class_spawnflags; + //con_debug << " spawnflags '" << class_spawnflags << "'" << std::endl; + } else if (firstword == "(") { if ((level == 2) && (class_name == "worldspawn")) { //cout << " BRUSH PLANE" << std::endl; @@ -318,6 +334,11 @@ void Model::make_face(math::Plane3f *face, std::vector & planes return; } + // FIXME clip should be parsed as collision blocks + if (face->texture() == "common/clip") { + return; + } + // using suggestions from // http://www.flipcode.com/archives/Level_Editing.shtml -- cgit v1.2.3