Add support for day/night notion in tracks

This commit is contained in:
samuncle 2017-01-22 19:28:08 -05:00
parent 4f1101d62b
commit 979f61b8c1
5 changed files with 10 additions and 4 deletions

View File

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

View File

@ -36,7 +36,7 @@
#include <iostream>
KartGFX::KartGFX(const AbstractKart *kart, RaceManager::KartType type)
KartGFX::KartGFX(const AbstractKart *kart, RaceManager::KartType type, bool is_day)
{
//if(!UserConfigParams::m_graphical_effects)
//{
@ -93,7 +93,7 @@ KartGFX::KartGFX(const AbstractKart *kart, RaceManager::KartType type)
m_head_light->setName( ("head light " + m_kart->getIdent()
+ ")").c_str() );
if (type == RaceManager::KT_PLAYER)
if (type == RaceManager::KT_PLAYER && !is_day)
{
m_head_light->setVisible(true);
}

View File

@ -93,7 +93,7 @@ private:
void resizeBox(const KartGFXType type, float new_size);
public:
KartGFX(const AbstractKart *kart, RaceManager::KartType type);
KartGFX(const AbstractKart *kart, RaceManager::KartType type, bool is_day);
~KartGFX();
void reset();
void setSkidLevel(const unsigned int level);

View File

@ -481,6 +481,7 @@ void Track::loadTrackInfo()
m_gravity = 9.80665f;
m_smooth_normals = false;
m_godrays = false;
m_is_day = true;
m_godrays_opacity = 1.0f;
m_godrays_color = video::SColor(255, 255, 255, 255);
/* ARGB */
@ -526,6 +527,7 @@ void Track::loadTrackInfo()
root->get("bloom", &m_bloom);
root->get("bloom-threshold", &m_bloom_threshold);
root->get("shadows", &m_shadows);
root->get("is-during-day", &m_is_day);
root->get("displacement-speed", &m_displacement_speed);
root->get("caustics-speed", &m_caustics_speed);
root->get("color-level-in", &m_color_inlevel);

View File

@ -107,6 +107,7 @@ private:
float m_gravity;
std::string m_ident;
std::string m_screenshot;
bool m_is_day;
std::vector<MusicInformation*> m_music;
/** Will only be used on overworld */
@ -485,6 +486,9 @@ public:
/** Returns an absolute path to the screenshot file of this track */
const std::string& getScreenshotFile () const {return m_screenshot; }
// ------------------------------------------------------------------------
/** Returns if the track is during day time */
const bool getIsDuringDay () const {return m_is_day; }
// ------------------------------------------------------------------------
/** Returns the start coordinates for a kart with a given index.
* \param index Index of kart ranging from 0 to kart_num-1. */
const btTransform& getStartTransform (unsigned int index) const