Support for weather effects stored in a separate xml node (track format 5).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7617 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f3663e4f90
commit
f392d5f6fe
@ -67,7 +67,7 @@ void ParticleKindManager::cleanUpTrackSpecificGfx()
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
ParticleKind* ParticleKindManager::getParticles(const char* name)
|
ParticleKind* ParticleKindManager::getParticles(const std::string &name)
|
||||||
{
|
{
|
||||||
Track* t = track_manager->getTrack(race_manager->getTrackName());
|
Track* t = track_manager->getTrack(race_manager->getTrackName());
|
||||||
std::map<std::string, ParticleKind*>::iterator i;
|
std::map<std::string, ParticleKind*>::iterator i;
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
virtual ~ParticleKindManager();
|
virtual ~ParticleKindManager();
|
||||||
|
|
||||||
ParticleKind* getParticles(const char* name);
|
ParticleKind* getParticles(const std::string &name);
|
||||||
|
|
||||||
void cleanUpTrackSpecificGfx();
|
void cleanUpTrackSpecificGfx();
|
||||||
|
|
||||||
|
@ -880,6 +880,19 @@ void Track::loadTrackModel(World* parent, unsigned int mode_id)
|
|||||||
{
|
{
|
||||||
Camera::readEndCamera(*node);
|
Camera::readEndCamera(*node);
|
||||||
}
|
}
|
||||||
|
else if(name=="weather")
|
||||||
|
{
|
||||||
|
std::string sky_particles;
|
||||||
|
node->get("particles", &sky_particles);
|
||||||
|
if (sky_particles.size() ==0)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"Warning: no weather particles found - ignored.\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
m_sky_particles =
|
||||||
|
ParticleKindManager::get()->getParticles(sky_particles);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Warning: while loading track '%s', element '%s' was met but is unknown.\n",
|
fprintf(stderr, "Warning: while loading track '%s', element '%s' was met but is unknown.\n",
|
||||||
@ -1037,14 +1050,6 @@ void Track::handleSky(const XMLNode &xml_node, const std::string &filename)
|
|||||||
xml_node.get("texture-percent", &m_sky_texture_percent);
|
xml_node.get("texture-percent", &m_sky_texture_percent);
|
||||||
xml_node.get("speed-x", &m_sky_dx );
|
xml_node.get("speed-x", &m_sky_dx );
|
||||||
xml_node.get("speed-y", &m_sky_dy);
|
xml_node.get("speed-y", &m_sky_dy);
|
||||||
|
|
||||||
std::string sky_particles;
|
|
||||||
xml_node.get("particles", &sky_particles);
|
|
||||||
if (sky_particles.size() > 0)
|
|
||||||
{
|
|
||||||
m_sky_particles = ParticleKindManager::get()->getParticles(sky_particles.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // if sky-dome
|
} // if sky-dome
|
||||||
else if(xml_node.getName()=="sky-box")
|
else if(xml_node.getName()=="sky-box")
|
||||||
{
|
{
|
||||||
@ -1062,25 +1067,11 @@ void Track::handleSky(const XMLNode &xml_node, const std::string &filename)
|
|||||||
{
|
{
|
||||||
m_sky_type = SKY_BOX;
|
m_sky_type = SKY_BOX;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sky_particles;
|
|
||||||
xml_node.get("particles", &sky_particles);
|
|
||||||
if (sky_particles.size() > 0)
|
|
||||||
{
|
|
||||||
m_sky_particles = ParticleKindManager::get()->getParticles(sky_particles.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (xml_node.getName() == "sky-color")
|
else if (xml_node.getName() == "sky-color")
|
||||||
{
|
{
|
||||||
m_sky_type = SKY_COLOR;
|
m_sky_type = SKY_COLOR;
|
||||||
xml_node.get("rgb", &m_sky_color);
|
xml_node.get("rgb", &m_sky_color);
|
||||||
|
|
||||||
std::string sky_particles;
|
|
||||||
xml_node.get("particles", &sky_particles);
|
|
||||||
if (sky_particles.size() > 0)
|
|
||||||
{
|
|
||||||
m_sky_particles = ParticleKindManager::get()->getParticles(sky_particles.c_str());
|
|
||||||
}
|
|
||||||
} // if sky-box
|
} // if sky-box
|
||||||
} // handleSky
|
} // handleSky
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user