Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/entity.cc2
-rw-r--r--src/core/entity.h7
-rw-r--r--src/core/model.cc42
-rw-r--r--src/core/model.h9
4 files changed, 59 insertions, 1 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index b186c64..ea5b9bc 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -102,6 +102,7 @@ Entity::Entity(unsigned int flags) :
entity_name.clear();
entity_renderstate = 0;
+ entity_renderfuzz = math::randomf();
add(this);
}
@@ -140,6 +141,7 @@ Entity::Entity(std::istream & is)
entity_dirty = false;
entity_renderstate = 0;
+ entity_renderfuzz = math::randomf();
add(this, entity_id);
}
diff --git a/src/core/entity.h b/src/core/entity.h
index 05ca641..e71b034 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -61,6 +61,12 @@ public:
/// core type id
virtual inline unsigned int type() const { return Default; }
+ /// client state
+ inline unsigned int state() const { return entity_renderstate; }
+
+ /// client render fuzz factor
+ inline float fuzz() const { return entity_renderfuzz; };
+
/// entity flags
inline unsigned int flags() const { return entity_flags; }
@@ -150,6 +156,7 @@ public:
bool entity_destroyed;
unsigned int entity_renderstate;
+ float entity_renderfuzz;
private:
/// add an entity to the registry
diff --git a/src/core/model.cc b/src/core/model.cc
index a09c7fd..e956612 100644
--- a/src/core/model.cc
+++ b/src/core/model.cc
@@ -181,6 +181,9 @@ Light::Light(math::Vector3f const & location, math::Color const & color, bool st
light_color(color)
{
light_strobe = strobe;
+ light_radius = 1.0f;
+ light_frequency = 1.0f;
+ light_offset = 0.0f;
}
Light::~Light()
@@ -245,6 +248,9 @@ 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_frequency = 1.0f;
+ float class_offset = 0;
bool brush_detail = false;
while (ifs) {
@@ -263,6 +269,9 @@ 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_offset = 0;
+ class_frequency = 1.0f;
brush_detail = false;
}
level ++;
@@ -290,7 +299,11 @@ 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, (class_spawnflags & 1) == 1));
+ 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;
+ add_light(light);
}
if (level == 1) {
@@ -360,6 +373,33 @@ Model::Model(std::string const & name) :
is >> class_spawnflags;
//con_debug << " spawnflags '" << class_spawnflags << "'" << std::endl;
+ } else if (firstword == "\"light\"") {
+ std::string tmp;
+ char c;
+ while ((linestream.get(c)) && (c != '"'));
+ while ((linestream.get(c)) && (c != '"'))
+ tmp += c;
+ std::istringstream is(tmp);
+ is >> class_light;
+
+ } else if (firstword == "\"frequency\"") {
+ std::string tmp;
+ char c;
+ while ((linestream.get(c)) && (c != '"'));
+ while ((linestream.get(c)) && (c != '"'))
+ tmp += c;
+ std::istringstream is(tmp);
+ is >> class_frequency;
+
+ } else if (firstword == "\"offset\"") {
+ std::string tmp;
+ char c;
+ while ((linestream.get(c)) && (c != '"'));
+ while ((linestream.get(c)) && (c != '"'))
+ tmp += c;
+ std::istringstream is(tmp);
+ is >> class_offset;
+
} else if (firstword == "(") {
if ((level == 2) && (class_name == "worldspawn")) {
//cout << " BRUSH PLANE" << std::endl;
diff --git a/src/core/model.h b/src/core/model.h
index 60746ae..1c56982 100644
--- a/src/core/model.h
+++ b/src/core/model.h
@@ -120,10 +120,19 @@ public:
inline math::Color const & color() const { return light_color; };
inline bool strobe() const { return light_strobe; }
+
+ inline float radius() const { return light_radius; }
+
+ inline float offset() const { return light_offset; }
+
+ inline float frequency() const { return light_frequency; }
math::Vector3f light_location;
math::Color light_color;
bool light_strobe;
+ float light_radius;
+ float light_frequency;
+ float light_offset;
};