Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/particles.cc22
-rw-r--r--src/render/particles.h21
2 files changed, 29 insertions, 14 deletions
diff --git a/src/render/particles.cc b/src/render/particles.cc
index 6681a4f..d5db8cf 100644
--- a/src/render/particles.cc
+++ b/src/render/particles.cc
@@ -104,6 +104,7 @@ ParticleScript *ParticleScript::load(const std::string &label)
ParticleScript *script = 0;
std::string strval;
float pitch, yaw, roll = 0.0f;
+ bool b;
while (inifile.getline()) {
@@ -173,12 +174,19 @@ ParticleScript *ParticleScript::load(const std::string &label)
} else if (inifile.got_key_float("timeout", script->particlescript_timeout)) {
continue;
} else if (inifile.got_key_color("color", script->particlescript_color)) {
- script->particlescript_has_color = true;
continue;
} else if (inifile.got_key_bool("engine", script->particlescript_engine)) {
continue;
} else if (inifile.got_key_bool("entity", script->particlescript_entity)) {
continue;
+ } else if (inifile.got_key_bool("entitysecond", script->particlescript_entity_second)) {
+ continue;
+ } else if (inifile.got_key_bool("entitythird", b)) {
+ if (b) {
+ script->particlescript_entity = true;
+ script->particlescript_entity_second = true;
+ }
+ continue;
} else if (inifile.got_key_float("angle", yaw)) {
if (yaw == model::ANGLEUP) {
@@ -251,8 +259,8 @@ ParticleScript *ParticleScript::load(const std::string &label)
ParticleScript::ParticleScript(const std::string & label) : particlescript_label(label)
{
particlescript_entity = false;
+ particlescript_entity_second = false;
particlescript_engine = false;
- particlescript_has_color = true;
particlescript_radius = 1.0f;
particlescript_alpha = 1.0f;
@@ -295,12 +303,12 @@ ParticleSystem::ParticleSystem(const ParticleScript *script, const core::Entity
// allow the script to override itself
if (particlesystem_script->entity()) {
particlesystem_color.assign(entity->color());
- }
- if (particlesystem_script->has_color()) {
- particlesystem_color.assign(particlesystem_script->color());
- }
- if (particlesystem_script->engine()) {
+ } else if (particlesystem_script->entity_second()) {
+ particlesystem_color.assign(entity->color_second());
+ } else if (particlesystem_script->engine()) {
particlesystem_color.assign(entity->model()->enginecolor());
+ } else {
+ particlesystem_color.assign(particlesystem_script->color());
}
particlesystem_axis.assign(particlesystem_script->axis());
diff --git a/src/render/particles.h b/src/render/particles.h
index c2d9c02..4c3de0e 100644
--- a/src/render/particles.h
+++ b/src/render/particles.h
@@ -72,10 +72,6 @@ public:
return particlescript_color;
}
- inline bool has_color() const {
- return particlescript_has_color;
- }
-
/// axis transformation relative to the ejector
inline const math::Axis &axis() const {
return particlescript_axis;
@@ -86,11 +82,22 @@ public:
return particlescript_engine;
}
- /// true if engine color is to be applied
- inline bool entity() const {
+ /**
+ * @brief true if entity primary color is to be applied
+ * */
+ inline bool entity() const
+ {
return particlescript_entity;
}
+ /**
+ * @brief true if entity secondary color is to be applied
+ * */
+ inline bool entity_second() const
+ {
+ return particlescript_entity_second;
+ }
+
inline float radius() const {
return particlescript_radius;
}
@@ -142,8 +149,8 @@ private:
math::Axis particlescript_axis;
bool particlescript_entity;
+ bool particlescript_entity_second;
bool particlescript_engine;
- bool particlescript_has_color;
float particlescript_radius;
float particlescript_timeout;