Moved nitro_light from Kart into KartGFX.
This commit is contained in:
parent
42114c163c
commit
b41035a008
@ -129,7 +129,6 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
||||
m_min_nitro_time = 0.0f;
|
||||
m_fire_clicked = 0;
|
||||
m_wrongway_counter = 0;
|
||||
m_nitro_light = NULL;
|
||||
m_skidding_light_1 = NULL;
|
||||
m_skidding_light_2 = NULL;
|
||||
m_type = RaceManager::KT_AI;
|
||||
@ -2408,12 +2407,6 @@ void Kart::loadData(RaceManager::KartType type, bool is_animated_model)
|
||||
bool always_animated = (type == RaceManager::KT_PLAYER && race_manager->getNumPlayers() == 1);
|
||||
m_node = m_kart_model->attachModel(is_animated_model, always_animated);
|
||||
|
||||
// Create nitro light
|
||||
m_nitro_light = irr_driver->addLight(core::vector3df(0.0f, 0.5f, m_kart_model->getLength()*-0.5f - 0.05f),
|
||||
0.4f /* force */, 5.0f /* radius */, 0.0f, 0.4f, 1.0f, false, m_node);
|
||||
m_nitro_light->setVisible(false);
|
||||
m_nitro_light->setName( ("nitro emitter (" + getIdent() + ")").c_str() );
|
||||
|
||||
// Create skidding lights
|
||||
// For the first skidding level
|
||||
m_skidding_light_1 = irr_driver->addLight(core::vector3df(0.0f, 0.1f, m_kart_model->getLength()*-0.5f - 0.05f),
|
||||
@ -2549,11 +2542,6 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
|
||||
// The speed of the kart can be higher (due to powerups) than
|
||||
// the normal maximum speed of the kart.
|
||||
if(nitro_frac>1.0f) nitro_frac = 1.0f;
|
||||
m_nitro_light->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_nitro_light->setVisible(false);
|
||||
}
|
||||
// speed * dt is the new size of the box in which particles start
|
||||
m_kart_gfx->updateNitroGraphics(nitro_frac, getSpeed()*dt);
|
||||
|
@ -219,9 +219,6 @@ private:
|
||||
/** To prevent using nitro in too short bursts */
|
||||
float m_min_nitro_time;
|
||||
|
||||
/** A light that's shown when the kart uses nitro. */
|
||||
scene::ISceneNode* m_nitro_light;
|
||||
|
||||
/** Lights that are shown when the kart is skidding. */
|
||||
scene::ISceneNode* m_skidding_light_1;
|
||||
/** A light that's shown on the second skid-level with another color. */
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/particle_emitter.hpp"
|
||||
#include "graphics/particle_kind.hpp"
|
||||
#include "graphics/particle_kind_manager.hpp"
|
||||
@ -44,6 +45,17 @@ KartGFX::KartGFX(const AbstractKart *kart)
|
||||
|
||||
m_kart = kart;
|
||||
|
||||
// Create nitro light
|
||||
core::vector3df location(0.0f, 0.5f,
|
||||
m_kart->getKartModel()->getLength()*-0.5f - 0.05f);
|
||||
m_nitro_light = irr_driver->addLight(location, /*force*/ 0.4f,
|
||||
/*radius*/5.0f, 0.0f, 0.4f, 1.0f,
|
||||
false, m_kart->getNode());
|
||||
m_nitro_light->setVisible(false);
|
||||
#ifdef DEBUG
|
||||
m_nitro_light->setName( ("nitro emitter (" + m_kart->getIdent() + ")").c_str() );
|
||||
#endif
|
||||
|
||||
Vec3 rear_left(kart->getWheelGraphicsPosition(3).getX(), 0.05f,
|
||||
kart->getWheelGraphicsPosition(3).getZ()-0.1f );
|
||||
Vec3 rear_right(kart->getWheelGraphicsPosition(2).getX(), 0.05f,
|
||||
@ -327,6 +339,7 @@ void KartGFX::updateNitroGraphics(float nitro_frac, float new_size)
|
||||
setCreationRateRelative(KartGFX::KGFX_NITRO2, nitro_frac);
|
||||
setCreationRateRelative(KartGFX::KGFX_NITROSMOKE1, nitro_frac);
|
||||
setCreationRateRelative(KartGFX::KGFX_NITROSMOKE2, nitro_frac);
|
||||
m_nitro_light->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -334,7 +347,7 @@ void KartGFX::updateNitroGraphics(float nitro_frac, float new_size)
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITRO2, 0);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE1, 0);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE2, 0);
|
||||
|
||||
m_nitro_light->setVisible(false);
|
||||
}
|
||||
resizeBox(KartGFX::KGFX_NITRO1, new_size);
|
||||
resizeBox(KartGFX::KGFX_NITRO2, new_size);
|
||||
|
@ -30,6 +30,12 @@ class ParticleEmitter;
|
||||
class ParticleKind;
|
||||
class Vec3;
|
||||
|
||||
namespace irr {
|
||||
namespace scene {
|
||||
class ISceneNode;
|
||||
}
|
||||
}
|
||||
|
||||
class KartGFX
|
||||
{
|
||||
public:
|
||||
@ -69,6 +75,10 @@ private:
|
||||
/** Used to alternate particle effects from the rear wheels. */
|
||||
int m_wheel_toggle;
|
||||
|
||||
/** A light that's shown when the kart uses nitro. */
|
||||
irr::scene::ISceneNode* m_nitro_light;
|
||||
|
||||
|
||||
void addEffect(KartGFXType type, const std::string &file_name,
|
||||
const Vec3 &position, bool important);
|
||||
void resizeBox(const KartGFXType type, float new_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user