From b3fd7b76f217b2fe3900a22111506e34d47473d0 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 18 Nov 2010 19:43:46 +0000 Subject: Have r_loadmodels load all particle scripts referenced by models. --- src/render/render.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/render') diff --git a/src/render/render.cc b/src/render/render.cc index 2a325e9..7776ef2 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -19,6 +19,7 @@ #include "render/gl.h" #include "render/state.h" #include "render/dust.h" +#include "render/particles.h" #include "render/render.h" #include "render/screenshot.h" #include "render/sky.h" @@ -230,15 +231,27 @@ void load() } // load all models referenced by info records +// this function can be useful when checking models for parsing errors void load_info_models() { - // load info models + // load all models referenced by info records for (core::Info::Registry::iterator it = core::Info::registry().begin(); it != core::Info::registry().end(); it++) { core::Info *info = (*it); if (info->modelname().size()) { model::Model::load(info->modelname()); } } + + // load all particle scripts referenced by models + for (model::Model::Registry::iterator it = model::Model::registry().begin(); it != model::Model::registry().end(); it++) { + + for (model::Model::ParticleSystems::iterator pit = (*it).second->particles().begin(); pit != (*it).second->particles().end(); pit++) { + model::Particles *particles = (*pit); + if (particles->script().size()) { + ParticleScript::load(particles->script()); + } + } + } } -- cgit v1.2.3