Activate headlight only for the player

This commit is contained in:
samuncle 2017-01-22 10:09:32 -05:00
parent 93011e934e
commit 4f1101d62b
3 changed files with 15 additions and 8 deletions

View File

@ -228,7 +228,7 @@ void Kart::init(RaceManager::KartType type)
}
loadData(type, animations);
m_kart_gfx = new KartGFX(this);
m_kart_gfx = new KartGFX(this, m_type);
m_skidding = new Skidding(this);
// Create the stars effect
m_stars_effect = new Stars(this);

View File

@ -32,10 +32,11 @@
#include "karts/skidding.hpp"
#include "physics/btKart.hpp"
#include "utils/log.hpp"
#include "race/race_manager.hpp"
#include <iostream>
KartGFX::KartGFX(const AbstractKart *kart)
KartGFX::KartGFX(const AbstractKart *kart, RaceManager::KartType type)
{
//if(!UserConfigParams::m_graphical_effects)
//{
@ -84,16 +85,24 @@ KartGFX::KartGFX(const AbstractKart *kart)
m_skidding_light_2->setName( ("skidding emitter 2 (" + m_kart->getIdent()
+ ")").c_str() );
m_head_light =
irr_driver->addLight(core::vector3df(0.0f, 0.2f, 1.5f*length),
/* force */ 0.5f,
/*radius*/CVS->isGLSL() ? 5.0f : 1.0f,
1.0f, 1.0f, 1.0f, false, node);
m_head_light->setVisible(true);
m_head_light->setName( ("head light " + m_kart->getIdent()
+ ")").c_str() );
if (type == RaceManager::KT_PLAYER)
{
m_head_light->setVisible(true);
}
else
{
m_head_light->setVisible(false);
}
#endif
#ifndef SERVER_ONLY
@ -510,7 +519,6 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
m_skidding_light_1->setVisible(true);
m_skidding_light_2->setVisible(false);
m_head_light->setVisible(false);
}
if (!m_skidding_light_2->isVisible() && red_skidding)
{
@ -521,7 +529,6 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
m_skidding_light_1->setVisible(false);
m_skidding_light_2->setVisible(true);
m_head_light->setVisible(false);
}
setCreationRateAbsolute(KartGFX::KGFX_SKIDL, (float)skidding);
setCreationRateAbsolute(KartGFX::KGFX_SKIDR, (float)skidding);
@ -533,7 +540,6 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
setCreationRateAbsolute(KartGFX::KGFX_SKIDR, 0.0f);
m_skidding_light_1->setVisible(false);
m_skidding_light_2->setVisible(false);
m_head_light->setVisible(true);
}
#endif
} // setGFXFromReplay

View File

@ -24,6 +24,7 @@
#include <vector>
#include <string>
#include "race/race_manager.hpp"
class AbstractKart;
class ParticleEmitter;
@ -92,7 +93,7 @@ private:
void resizeBox(const KartGFXType type, float new_size);
public:
KartGFX(const AbstractKart *kart);
KartGFX(const AbstractKart *kart, RaceManager::KartType type);
~KartGFX();
void reset();
void setSkidLevel(const unsigned int level);