diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/model.cc | 25 | ||||
-rw-r--r-- | src/core/model.h | 8 |
2 files changed, 29 insertions, 4 deletions
diff --git a/src/core/model.cc b/src/core/model.cc index e956612..c38749b 100644 --- a/src/core/model.cc +++ b/src/core/model.cc @@ -184,6 +184,7 @@ Light::Light(math::Vector3f const & location, math::Color const & color, bool st light_radius = 1.0f; light_frequency = 1.0f; light_offset = 0.0f; + light_time = 0.5f; } Light::~Light() @@ -251,6 +252,7 @@ Model::Model(std::string const & name) : float class_light = 100; float class_frequency = 1.0f; float class_offset = 0; + float class_time = 0.0f; bool brush_detail = false; while (ifs) { @@ -272,6 +274,7 @@ Model::Model(std::string const & name) : class_light = 100; class_offset = 0; class_frequency = 1.0f; + class_time = 0.0f; brush_detail = false; } level ++; @@ -302,7 +305,10 @@ Model::Model(std::string const & name) : 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; - light->light_frequency = class_frequency; + if (class_frequency > 0 ) + light->light_frequency = class_frequency; + if (class_time > 0 ) + light->light_time = class_time; add_light(light); } @@ -399,6 +405,15 @@ Model::Model(std::string const & name) : tmp += c; std::istringstream is(tmp); is >> class_offset; + + } else if (firstword == "\"time\"") { + std::string tmp; + char c; + while ((linestream.get(c)) && (c != '"')); + while ((linestream.get(c)) && (c != '"')) + tmp += c; + std::istringstream is(tmp); + is >> class_time; } else if (firstword == "(") { if ((level == 2) && (class_name == "worldspawn")) { @@ -408,6 +423,7 @@ Model::Model(std::string const & name) : Vector3f p3; std::string tmp; std::string texture; + int n; linestream >> p1; linestream >> tmp; // ) @@ -423,9 +439,10 @@ Model::Model(std::string const & name) : for (int i=0; i < 5; i++) linestream >> tmp; - if (linestream >> tmp) - brush_detail = true; - + if (linestream >> n) { + if (n > 0) + brush_detail = true; + } //cout << data << std::endl; //cout << "(" << p1 << ") (" << p2 << ") (" << p3 << ") " << texture << std::endl; diff --git a/src/core/model.h b/src/core/model.h index 1c56982..6175ec7 100644 --- a/src/core/model.h +++ b/src/core/model.h @@ -119,13 +119,20 @@ public: inline math::Color const & color() const { return light_color; }; + /// true if this is a strobe light inline bool strobe() const { return light_strobe; } + /// size if the light, default is 1.0f inline float radius() const { return light_radius; } + /// strobe time offset, in seconds inline float offset() const { return light_offset; } + /// frequency in strobes per second inline float frequency() const { return light_frequency; } + + /// fraction a strobe light will be on, default is 0.5f + inline float time() const { return light_time; } math::Vector3f light_location; math::Color light_color; @@ -133,6 +140,7 @@ public: float light_radius; float light_frequency; float light_offset; + float light_time; }; |