diff options
author | Stijn Buys <ingar@osirion.org> | 2010-11-18 19:21:57 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-11-18 19:21:57 +0000 |
commit | a3b3dbf3ced35ae4c0aca148d89509a12f785062 (patch) | |
tree | 6fc93069f70eb6059d056a00790be818df2c2f9f /src/render/particles.cc | |
parent | 138dbc83d5720c8baa7270ece183ce356f619fce (diff) |
Corrected default light and flare radius.
Suppoort for entity, engine and color keys in fx_particles and particle scripts.
Have light, fx_flare and fx_particles color override engine color if the engine spawnflag is set.
Diffstat (limited to 'src/render/particles.cc')
-rw-r--r-- | src/render/particles.cc | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/src/render/particles.cc b/src/render/particles.cc index 7a0094d..2e65449 100644 --- a/src/render/particles.cc +++ b/src/render/particles.cc @@ -171,8 +171,12 @@ 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_float("angle", yaw)) { if (yaw == model::ANGLEUP) { @@ -244,20 +248,21 @@ ParticleScript *ParticleScript::load(const std::string &label) ParticleScript::ParticleScript(const std::string & label) : particlescript_label(label) { + particlescript_entity = false; + particlescript_engine = false; + particlescript_has_color = true; particlescript_radius = 1.0f; particlescript_alpha = 1.0f; particlescript_speed = 0.0f; particlescript_timeout = 2.0f; particlescript_eject = 0.25f; - particlescript_offset = 0.1f; - + particlescript_color.assign(1.0f, 1.0f); + particlescript_cull = model::CullNone; particlescript_next = 0; - - particlescript_cull = model::CullNone; } ParticleScript::~ParticleScript() @@ -284,22 +289,31 @@ ParticleSystem::ParticleSystem(const ParticleScript *script, const core::Entity particlesystem_texture = Textures::load("textures/" + particlesystem_script->texture()); particlesystem_radius = particlesystem_script->radius(); particlesystem_cull = particlesystem_script->cull(); - particlesystem_color.assign(particlesystem_script->color()); + + if (particlesystem_script->entity()) { + particlesystem_color.assign(entity->color()); + } else if (particlesystem_script->has_color()) { + particlesystem_color.assign(particlesystem_script->color()); + } else if (particlesystem_script->engine()) { + particlesystem_color.assign(entity->model()->enginecolor()); + } + particlesystem_axis.assign(particlesystem_script->axis()); } if (particlesystem_modelclass) { - particlesystem_location.assign(modelclass->location()); - - if (modelclass->entity()) { + particlesystem_radius *= particlesystem_modelclass->scale(); + + if (particlesystem_modelclass->entity()) { particlesystem_color.assign(entity->color()); - } - if (modelclass->engine()) { - // FIXME if not modelclass->has_color(); + } else if (particlesystem_modelclass->has_color()) { + particlesystem_color.assign(particlesystem_modelclass->color()); + } else if (particlesystem_modelclass->engine()) { particlesystem_color.assign(entity->model()->enginecolor()); } + + particlesystem_location.assign(modelclass->location()); particlesystem_axis.assign(modelclass->axis() * particlesystem_axis); - particlesystem_radius *= particlesystem_modelclass->scale(); } |