Merge remote-tracking branch 'origin/master' into fix-cannon
This commit is contained in:
commit
9bee42ccb7
@ -20,13 +20,16 @@ out vec2 uv;
|
||||
void main()
|
||||
{
|
||||
|
||||
vec3 test = sin(windDir * (Position.y* 0.5)) * 0.5;
|
||||
test += cos(windDir) * 0.7;
|
||||
|
||||
mat4 new_model_matrix = ModelMatrix;
|
||||
mat4 new_inverse_model_matrix = InverseModelMatrix;
|
||||
new_model_matrix[3].xyz += windDir * Color.r;
|
||||
new_model_matrix[3].xyz += test * Color.r;
|
||||
|
||||
// FIXME doesn't seem to make too much difference in pass 2, because this
|
||||
// affects "nor" which is later only * 0.1 by scattering
|
||||
new_inverse_model_matrix[3].xyz -= windDir * Color.r;
|
||||
new_inverse_model_matrix[3].xyz -= test * Color.r;
|
||||
|
||||
mat4 ModelViewProjectionMatrix = ProjectionViewMatrix * new_model_matrix;
|
||||
mat4 TransposeInverseModelView = transpose(InverseViewMatrix * new_inverse_model_matrix);
|
||||
|
@ -41,8 +41,10 @@ flat out sampler2D thirdhandle;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 ModelMatrix = getWorldMatrix(Origin + windDir * Color.r, Orientation, Scale);
|
||||
mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin + windDir * Color.r, Orientation, Scale) * InverseViewMatrix);
|
||||
vec3 test = sin(windDir * (Position.y* 0.5)) * 0.5;
|
||||
test += cos(windDir) * 0.7;
|
||||
mat4 ModelMatrix = getWorldMatrix(Origin + test * Color.r, Orientation, Scale);
|
||||
mat4 TransposeInverseModelView = transpose(getInverseWorldMatrix(Origin + test * Color.r, Orientation, Scale) * InverseViewMatrix);
|
||||
gl_Position = ProjectionViewMatrix * ModelMatrix * vec4(Position, 1.);
|
||||
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
|
||||
uv = Texcoord;
|
||||
|
@ -40,17 +40,20 @@ flat out uvec2 hdle;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
vec3 test = sin(windDir * (Position.y* 0.5)) * 0.5;
|
||||
test += cos(windDir) * 0.7;
|
||||
mat4 ModelMatrix = getWorldMatrix(Origin, Orientation, Scale);
|
||||
#ifdef VSLayer
|
||||
gl_Layer = layer;
|
||||
gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + windDir * Color.r, 1.);
|
||||
gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + test * Color.r, 1.);
|
||||
uv = Texcoord;
|
||||
#ifdef Use_Bindless_Texture
|
||||
handle = Handle;
|
||||
#endif
|
||||
#else
|
||||
layerId = layer;
|
||||
gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + windDir * Color.r, 1.);
|
||||
gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + test * Color.r, 1.);
|
||||
tc = Texcoord;
|
||||
#ifdef Use_Bindless_Texture
|
||||
hdle = Handle;
|
||||
|
@ -21,13 +21,17 @@ out int layerId;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
vec3 test = sin(windDir * (Position.y* 0.5)) * 0.5;
|
||||
test += cos(windDir) * 0.7;
|
||||
|
||||
#ifdef VSLayer
|
||||
gl_Layer = layer;
|
||||
uv = Texcoord;
|
||||
gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + windDir * Color.r, 1.);
|
||||
gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + test * Color.r, 1.);
|
||||
#else
|
||||
layerId = layer;
|
||||
tc = Texcoord;
|
||||
gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + windDir * Color.r, 1.);
|
||||
gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + test * Color.r, 1.);
|
||||
#endif
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ Material::Material(const XMLNode *node, bool deprecated)
|
||||
if (relativePath.size() == 0)
|
||||
Log::warn("Material", "Cannot determine texture full path : <%s>", m_texname.c_str());
|
||||
else
|
||||
m_full_path = file_manager->getFileSystem()->getAbsolutePath(relativePath.c_str()).c_str();
|
||||
m_full_path = m_original_full_path = file_manager->getFileSystem()->getAbsolutePath(relativePath.c_str()).c_str();
|
||||
|
||||
core::stringc texfname(m_texname.c_str());
|
||||
texfname.make_lower();
|
||||
@ -435,12 +435,12 @@ Material::Material(const std::string& fname, bool is_full_path,
|
||||
if (is_full_path)
|
||||
{
|
||||
m_texname = StringUtils::getBasename(fname);
|
||||
m_full_path = fname;
|
||||
m_full_path = m_original_full_path = fname;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_texname = fname;
|
||||
m_full_path = file_manager->getFileSystem()->getAbsolutePath(
|
||||
m_full_path = m_original_full_path = file_manager->getFileSystem()->getAbsolutePath(
|
||||
file_manager->searchTexture(m_texname).c_str()).c_str();
|
||||
}
|
||||
|
||||
@ -527,7 +527,7 @@ void Material::install(bool srgb, bool premul_alpha)
|
||||
else
|
||||
{
|
||||
m_texture = STKTexManager::getInstance()->getTexture
|
||||
(m_full_path, srgb, premul_alpha, false/*set_material*/,
|
||||
(m_original_full_path, srgb, premul_alpha, false/*set_material*/,
|
||||
srgb/*mesh_tex*/);
|
||||
}
|
||||
|
||||
|
@ -91,6 +91,8 @@ private:
|
||||
std::string m_texname;
|
||||
|
||||
std::string m_full_path;
|
||||
|
||||
std::string m_original_full_path;
|
||||
|
||||
/** Name of a special sfx to play when a kart is on this terrain, or
|
||||
* "" if no special sfx exists. */
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
void setCreationRateAbsolute(float fraction);
|
||||
void setCreationRateRelative(float f);
|
||||
int getCreationRate();
|
||||
float getCreationRateFloat() {return m_min_rate;}
|
||||
|
||||
void setPosition(const Vec3 &pos);
|
||||
void setRotation(const Vec3 &rot);
|
||||
|
@ -337,7 +337,7 @@ core::vector3df getWindDir()
|
||||
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
|
||||
GrassShaderProvider *gsp =
|
||||
(GrassShaderProvider *)Shaders::getCallback(ES_GRASS);
|
||||
return (gsp->getSpeed() * cos(time)) * vector3df(1., 0., 0.);
|
||||
return (gsp->getSpeed() * time * vector3df(1., 0., 0.));
|
||||
} // getWindDir
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -153,6 +153,7 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id,
|
||||
m_reset_transform = init_transform;
|
||||
m_speed = 0.0f;
|
||||
m_smoothed_speed = 0.0f;
|
||||
m_last_factor_engine_sound = 0.0f;
|
||||
|
||||
m_kart_model->setKart(this);
|
||||
|
||||
@ -1384,6 +1385,7 @@ void Kart::update(float dt)
|
||||
fabs(getSpeed()) < 3.0f)
|
||||
{
|
||||
new RescueAnimation(this, /*is_auto_rescue*/true);
|
||||
m_last_factor_engine_sound = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1448,7 +1450,10 @@ void Kart::update(float dt)
|
||||
|
||||
if((min->getY() - getXYZ().getY() > 17 || dist_to_sector > 25) && !m_flying &&
|
||||
!getKartAnimation())
|
||||
{
|
||||
new RescueAnimation(this);
|
||||
m_last_factor_engine_sound = 0.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1467,7 +1472,10 @@ void Kart::update(float dt)
|
||||
} // if !flying
|
||||
handleMaterialSFX(material);
|
||||
if (material->isDriveReset() && isOnGround())
|
||||
{
|
||||
new RescueAnimation(this);
|
||||
m_last_factor_engine_sound = 0.0f;
|
||||
}
|
||||
else if(material->isZipper() && isOnGround())
|
||||
{
|
||||
handleZipper(material);
|
||||
@ -2103,6 +2111,7 @@ void Kart::crashed(const Material *m, const Vec3 &normal)
|
||||
if (m->getCollisionReaction() == Material::RESCUE)
|
||||
{
|
||||
new RescueAnimation(this);
|
||||
m_last_factor_engine_sound = 0.0f;
|
||||
}
|
||||
else if (m->getCollisionReaction() == Material::PUSH_BACK)
|
||||
{
|
||||
@ -2294,7 +2303,7 @@ void Kart::updatePhysics(float dt)
|
||||
m_max_speed->update(dt);
|
||||
|
||||
|
||||
updateEngineSFX();
|
||||
updateEngineSFX(dt);
|
||||
#ifdef XX
|
||||
Log::info("Kart","angVel %f %f %f heading %f suspension %f %f %f %f"
|
||||
,m_body->getAngularVelocity().getX()
|
||||
@ -2313,7 +2322,7 @@ void Kart::updatePhysics(float dt)
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Adjust the engine sound effect depending on the speed of the kart.
|
||||
*/
|
||||
void Kart::updateEngineSFX()
|
||||
void Kart::updateEngineSFX(float dt)
|
||||
{
|
||||
// when going faster, use higher pitch for engine
|
||||
if(!m_engine_sound || !SFXManager::get()->sfxAllowed())
|
||||
@ -2321,7 +2330,7 @@ void Kart::updateEngineSFX()
|
||||
|
||||
if(isOnGround())
|
||||
{
|
||||
float max_speed = m_max_speed->getCurrentMaxSpeed();
|
||||
float max_speed = m_kart_properties->getEngineMaxSpeed();
|
||||
|
||||
// Engine noise is based half in total speed, half in fake gears:
|
||||
// With a sawtooth graph like /|/|/| we get 3 even spaced gears,
|
||||
@ -2329,20 +2338,23 @@ void Kart::updateEngineSFX()
|
||||
// good enough brrrBRRRbrrrBRRR sound effect. Speed factor makes
|
||||
// it a "staired sawtooth", so more acoustically rich.
|
||||
float f = max_speed > 0 ? m_speed/max_speed : 1.0f;
|
||||
// Speed at this stage is not yet capped, so it can be > 1, which
|
||||
// results in odd engine sfx.
|
||||
if (f>1.0f) f=1.0f;
|
||||
// Speed at this stage is not yet capped, reduce the amount beyond 1
|
||||
if (f> 1.0f) f = 1.0f + (1.0f-1.0f/f);
|
||||
|
||||
float gears = 3.0f * fmod(f, 0.333334f);
|
||||
float fc = f;
|
||||
if (fc>1.0f) fc = 1.0f;
|
||||
float gears = 3.0f * fmod(fc, 0.333334f);
|
||||
assert(!std::isnan(f));
|
||||
m_engine_sound->setSpeedPosition(0.6f + (f + gears) * 0.35f, getXYZ());
|
||||
m_last_factor_engine_sound = (0.9*f + gears) * 0.35f;
|
||||
m_engine_sound->setSpeedPosition(0.6f + m_last_factor_engine_sound, getXYZ());
|
||||
}
|
||||
else
|
||||
{
|
||||
// When flying, fixed value but not too high pitch
|
||||
// This gives some variation (vs previous "on wheels" one)
|
||||
m_engine_sound->setSpeedPosition(0.9f, getXYZ());
|
||||
}
|
||||
{
|
||||
// When flying, reduce progressively the sound engine (since we can't accelerate)
|
||||
m_last_factor_engine_sound *= (1.0f-0.1*dt);
|
||||
m_engine_sound->setSpeedPosition(0.6f + m_last_factor_engine_sound, getXYZ());
|
||||
if (m_speed < 0.1f) m_last_factor_engine_sound = 0.0f;
|
||||
}
|
||||
} // updateEngineSFX
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -201,6 +201,9 @@ protected:
|
||||
/** For camera handling an exponentially smoothened value is used, which
|
||||
* reduces stuttering of the camera. */
|
||||
float m_smoothed_speed;
|
||||
|
||||
/** For smoothing engine sound**/
|
||||
float m_last_factor_engine_sound;
|
||||
|
||||
std::vector<SFXBase*> m_custom_sounds;
|
||||
SFXBase *m_beep_sound;
|
||||
@ -226,7 +229,7 @@ protected:
|
||||
void updateFlying();
|
||||
void updateSliding();
|
||||
void updateEnginePowerAndBrakes(float dt);
|
||||
void updateEngineSFX();
|
||||
void updateEngineSFX(float dt);
|
||||
void updateSpeed();
|
||||
void updateNitro(float dt);
|
||||
float getActualWheelForce();
|
||||
|
@ -38,6 +38,14 @@
|
||||
|
||||
KartGFX::KartGFX(const AbstractKart *kart, RaceManager::KartType type, bool is_day)
|
||||
{
|
||||
m_nitro_light = NULL;
|
||||
m_skidding_light_1 = NULL;
|
||||
m_skidding_light_2 = NULL;
|
||||
m_head_light = NULL;
|
||||
m_kart = kart;
|
||||
m_wheel_toggle = 0;
|
||||
m_skid_level = 0;
|
||||
|
||||
//if(!UserConfigParams::m_graphical_effects)
|
||||
//{
|
||||
// for(unsigned int i=0; i<KGFX_COUNT; i++)
|
||||
@ -45,69 +53,52 @@ KartGFX::KartGFX(const AbstractKart *kart, RaceManager::KartType type, bool is_d
|
||||
// return;
|
||||
//}
|
||||
|
||||
m_kart = kart;
|
||||
|
||||
const KartModel *km = m_kart->getKartModel();
|
||||
const float length = km->getLength();
|
||||
|
||||
scene::ISceneNode *node = m_kart->getNode();
|
||||
// Create nitro light
|
||||
core::vector3df location(0.0f, 0.5f, -0.5f*length - 0.05f);
|
||||
#ifndef SERVER_ONLY
|
||||
m_nitro_light = irr_driver->addLight(location, /*force*/ 0.4f,
|
||||
/*radius*/CVS->isGLSL() ? 5.0f : 1.0f,
|
||||
0.0f, 0.4f, 1.0f,
|
||||
false, node);
|
||||
m_nitro_light->setVisible(false);
|
||||
#ifdef DEBUG
|
||||
m_nitro_light->setName( ("nitro emitter (" + m_kart->getIdent()
|
||||
+ ")").c_str() );
|
||||
#endif
|
||||
|
||||
// Create skidding lights
|
||||
// For the first skidding level
|
||||
m_skidding_light_1 =
|
||||
irr_driver->addLight(core::vector3df(0.0f, 0.1f, -0.5f*length - 0.05f),
|
||||
/* force */ 0.3f,
|
||||
/*radius*/CVS->isGLSL() ? 3.0f : 1.0f,
|
||||
1.0f, 0.6f, 0.0f, false, node);
|
||||
m_skidding_light_1->setVisible(false);
|
||||
m_skidding_light_1->setName( ("skidding emitter 1 (" + m_kart->getIdent()
|
||||
+ ")").c_str() );
|
||||
|
||||
// For the second skidding level
|
||||
m_skidding_light_2 =
|
||||
irr_driver->addLight(core::vector3df(0.0f, 0.1f, -0.5f*length - 0.05f),
|
||||
/* force */0.4f,
|
||||
/*radius*/CVS->isGLSL() ? 4.0f : 1.0f,
|
||||
1.0f, 0.0f, 0.0f, false, node);
|
||||
m_skidding_light_2->setVisible(false);
|
||||
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->setName( ("head light " + m_kart->getIdent()
|
||||
+ ")").c_str() );
|
||||
|
||||
if (type == RaceManager::KT_PLAYER && !is_day)
|
||||
{
|
||||
m_head_light->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_head_light->setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
m_nitro_light = irr_driver->addLight(location, /*force*/ 0.4f,
|
||||
/*radius*/ 5.0f, 0.0f, 0.4f, 1.0f,
|
||||
false, node);
|
||||
m_nitro_light->setVisible(false);
|
||||
#ifdef DEBUG
|
||||
m_nitro_light->setName( ("nitro emitter (" + m_kart->getIdent()
|
||||
+ ")").c_str() );
|
||||
#endif
|
||||
|
||||
// Create skidding lights
|
||||
// For the first skidding level
|
||||
m_skidding_light_1 =
|
||||
irr_driver->addLight(core::vector3df(0.0f, 0.1f, -0.5f * length -
|
||||
0.05f), /* force */ 0.3f, /*radius*/ 3.0f,
|
||||
1.0f, 0.6f, 0.0f, false, node);
|
||||
m_skidding_light_1->setVisible(false);
|
||||
m_skidding_light_1->setName(("skidding emitter 1 (" + m_kart->getIdent()
|
||||
+ ")").c_str() );
|
||||
|
||||
// For the second skidding level
|
||||
m_skidding_light_2 =
|
||||
irr_driver->addLight(core::vector3df(0.0f, 0.1f, -0.5f * length -
|
||||
0.05f), /* force */0.4f, /*radius*/4.0f,
|
||||
1.0f, 0.0f, 0.0f, false, node);
|
||||
m_skidding_light_2->setVisible(false);
|
||||
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*/5.0f, 1.0f, 1.0f,
|
||||
1.0f, false, node);
|
||||
m_head_light->setName( ("head light " + m_kart->getIdent()
|
||||
+ ")").c_str() );
|
||||
|
||||
m_head_light->setVisible(type == RaceManager::KT_PLAYER && !is_day);
|
||||
|
||||
m_nitro_light->grab();
|
||||
m_skidding_light_1->grab();
|
||||
m_skidding_light_2->grab();
|
||||
@ -182,7 +173,7 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name,
|
||||
const Vec3 &position, bool important)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
if (!UserConfigParams::m_graphical_effects &&
|
||||
if ((!UserConfigParams::m_graphical_effects || !CVS->isGLSL()) &&
|
||||
(!important || m_kart->getType() == RaceManager::KT_AI ||
|
||||
m_kart->getType() == RaceManager::KT_SPARE_TIRE))
|
||||
{
|
||||
@ -257,6 +248,7 @@ void KartGFX::setSkidLevel(const unsigned int level)
|
||||
{
|
||||
assert(level >= 1);
|
||||
assert(level <= 2);
|
||||
m_skid_level = level;
|
||||
const ParticleKind *pk = level==1 ? m_skid_kind1 : m_skid_kind2;
|
||||
#ifndef SERVER_ONLY
|
||||
if(m_all_emitters[KGFX_SKID1L])
|
||||
@ -309,8 +301,13 @@ void KartGFX::setXYZ(const KartGFXType type, const Vec3 &xyz)
|
||||
void KartGFX::setCreationRateAbsolute(KartGFXType type, float f)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
if(m_all_emitters[type])
|
||||
m_all_emitters[type]->setCreationRateAbsolute(f);
|
||||
if (!m_all_emitters[type])
|
||||
return;
|
||||
|
||||
if (m_all_emitters[type]->getCreationRateFloat() == f)
|
||||
return;
|
||||
|
||||
m_all_emitters[type]->setCreationRateAbsolute(f);
|
||||
#endif
|
||||
} // setCreationRateAbsolute
|
||||
|
||||
@ -428,7 +425,9 @@ void KartGFX::updateNitroGraphics(float nitro_frac)
|
||||
setCreationRateRelative(KartGFX::KGFX_NITRO2, nitro_frac);
|
||||
setCreationRateRelative(KartGFX::KGFX_NITROSMOKE1, nitro_frac);
|
||||
setCreationRateRelative(KartGFX::KGFX_NITROSMOKE2, nitro_frac);
|
||||
m_nitro_light->setVisible(true);
|
||||
|
||||
if (CVS->isGLSL())
|
||||
m_nitro_light->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -436,15 +435,14 @@ void KartGFX::updateNitroGraphics(float nitro_frac)
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITRO2, 0);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE1, 0);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE2, 0);
|
||||
m_nitro_light->setVisible(false);
|
||||
|
||||
if (CVS->isGLSL())
|
||||
m_nitro_light->setVisible(false);
|
||||
}
|
||||
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
// Exhaust is always emitting
|
||||
setCreationRateRelative(KartGFX::KGFX_EXHAUST1, 1.0);
|
||||
setCreationRateRelative(KartGFX::KGFX_EXHAUST2, 1.0);
|
||||
}
|
||||
// Exhaust is always emitting
|
||||
setCreationRateRelative(KartGFX::KGFX_EXHAUST1, 1.0);
|
||||
setCreationRateRelative(KartGFX::KGFX_EXHAUST2, 1.0);
|
||||
#endif
|
||||
} // updateGraphics
|
||||
|
||||
@ -456,8 +454,11 @@ void KartGFX::updateNitroGraphics(float nitro_frac)
|
||||
void KartGFX::updateSkidLight(unsigned int level)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
m_skidding_light_1->setVisible(level == 1);
|
||||
m_skidding_light_2->setVisible(level > 1);
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
m_skidding_light_1->setVisible(level == 1);
|
||||
m_skidding_light_2->setVisible(level > 1);
|
||||
}
|
||||
#endif
|
||||
} // updateSkidLight
|
||||
|
||||
@ -484,7 +485,7 @@ void KartGFX::getGFXStatus(int* nitro, bool* zipper,
|
||||
if (m_all_emitters[KGFX_SKIDL])
|
||||
{
|
||||
s = m_all_emitters[KGFX_SKIDL]->getCreationRate();
|
||||
r = m_skidding_light_2->isVisible();
|
||||
r = m_skid_level == 2;
|
||||
}
|
||||
|
||||
*nitro = n;
|
||||
@ -505,15 +506,19 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITRO2, (float)nitro);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE1, (float)nitro);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE2, (float)nitro);
|
||||
m_nitro_light->setVisible(true);
|
||||
|
||||
if (CVS->isGLSL())
|
||||
m_nitro_light->setVisible(true);
|
||||
}
|
||||
else if (m_nitro_light->isVisible() && nitro == 0)
|
||||
else
|
||||
{
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITRO1, 0.0f);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITRO2, 0.0f);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE1, 0.0f);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_NITROSMOKE2, 0.0f);
|
||||
m_nitro_light->setVisible(false);
|
||||
|
||||
if (CVS->isGLSL())
|
||||
m_nitro_light->setVisible(false);
|
||||
}
|
||||
|
||||
if (zipper)
|
||||
@ -521,36 +526,33 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
|
||||
|
||||
if (skidding > 0)
|
||||
{
|
||||
if (!m_skidding_light_1->isVisible() && !red_skidding)
|
||||
{
|
||||
if (m_all_emitters[KGFX_SKID1L])
|
||||
m_all_emitters[KGFX_SKID1L]->setParticleType(m_skid_kind1);
|
||||
if (m_all_emitters[KGFX_SKID1R])
|
||||
m_all_emitters[KGFX_SKID1R]->setParticleType(m_skid_kind1);
|
||||
const ParticleKind* skid_kind = red_skidding ? m_skid_kind2
|
||||
: m_skid_kind1;
|
||||
|
||||
m_skidding_light_1->setVisible(true);
|
||||
m_skidding_light_2->setVisible(false);
|
||||
}
|
||||
if (!m_skidding_light_2->isVisible() && red_skidding)
|
||||
{
|
||||
if (m_all_emitters[KGFX_SKID1L])
|
||||
m_all_emitters[KGFX_SKID1L]->setParticleType(m_skid_kind2);
|
||||
if (m_all_emitters[KGFX_SKID1R])
|
||||
m_all_emitters[KGFX_SKID1R]->setParticleType(m_skid_kind2);
|
||||
if (m_all_emitters[KGFX_SKID1L])
|
||||
m_all_emitters[KGFX_SKID1L]->setParticleType(skid_kind);
|
||||
if (m_all_emitters[KGFX_SKID1R])
|
||||
m_all_emitters[KGFX_SKID1R]->setParticleType(skid_kind);
|
||||
|
||||
m_skidding_light_1->setVisible(false);
|
||||
m_skidding_light_2->setVisible(true);
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
m_skidding_light_1->setVisible(!red_skidding);
|
||||
m_skidding_light_2->setVisible(red_skidding);
|
||||
}
|
||||
|
||||
setCreationRateAbsolute(KartGFX::KGFX_SKIDL, (float)skidding);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_SKIDR, (float)skidding);
|
||||
}
|
||||
else if ((m_skidding_light_1->isVisible() ||
|
||||
m_skidding_light_2->isVisible()) && skidding == 0)
|
||||
else
|
||||
{
|
||||
setCreationRateAbsolute(KartGFX::KGFX_SKIDL, 0.0f);
|
||||
setCreationRateAbsolute(KartGFX::KGFX_SKIDR, 0.0f);
|
||||
m_skidding_light_1->setVisible(false);
|
||||
m_skidding_light_2->setVisible(false);
|
||||
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
m_skidding_light_1->setVisible(false);
|
||||
m_skidding_light_2->setVisible(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // setGFXFromReplay
|
||||
@ -559,9 +561,12 @@ void KartGFX::setGFXFromReplay(int nitro, bool zipper,
|
||||
void KartGFX::setGFXInvisible()
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
m_nitro_light->setVisible(false);
|
||||
m_skidding_light_1->setVisible(false);
|
||||
m_skidding_light_2->setVisible(false);
|
||||
m_head_light->setVisible(false);
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
m_nitro_light->setVisible(false);
|
||||
m_skidding_light_1->setVisible(false);
|
||||
m_skidding_light_2->setVisible(false);
|
||||
m_head_light->setVisible(false);
|
||||
}
|
||||
#endif
|
||||
} // setGFXInvisible
|
||||
|
@ -77,6 +77,9 @@ private:
|
||||
|
||||
/** Used to alternate particle effects from the rear wheels. */
|
||||
int m_wheel_toggle;
|
||||
|
||||
/** A skid level that is currently in use */
|
||||
int m_skid_level;
|
||||
|
||||
/** A light that's shown when the kart uses nitro. */
|
||||
irr::scene::ISceneNode* m_nitro_light;
|
||||
|
@ -723,11 +723,15 @@ bool onEvent(const SEvent &event)
|
||||
if(!UserConfigParams::m_artist_debug_mode)
|
||||
return true; // keep handling the events
|
||||
|
||||
if(event.EventType == EET_MOUSE_INPUT_EVENT)
|
||||
if (event.EventType == EET_MOUSE_INPUT_EVENT)
|
||||
{
|
||||
// Create the menu (only one menu at a time)
|
||||
if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN &&
|
||||
!g_debug_menu_visible)
|
||||
#ifdef ANDROID
|
||||
if (event.MouseInput.X < 30 && event.MouseInput.Y < 30 &&
|
||||
#else
|
||||
if (event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN &&
|
||||
#endif
|
||||
!g_debug_menu_visible)
|
||||
{
|
||||
irr_driver->getDevice()->getCursorControl()->setVisible(true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user