From 5bd8f589238b35a6b266d9d7d0044d3be7f261e0 Mon Sep 17 00:00:00 2001 From: auria Date: Fri, 12 Apr 2013 21:24:21 +0000 Subject: [PATCH] Tweaked skidding particles by Deve git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12642 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- data/gfx/skid1.xml | 8 ++++---- data/gfx/skid2.xml | 8 ++++---- src/karts/kart_gfx.cpp | 28 +++++++++++++++++++--------- src/karts/kart_gfx.hpp | 9 ++++++--- src/karts/skidding.cpp | 18 +++++++++++++----- 5 files changed, 46 insertions(+), 25 deletions(-) diff --git a/data/gfx/skid1.xml b/data/gfx/skid1.xml index 91e5a2d38..29bd39e39 100644 --- a/data/gfx/skid1.xml +++ b/data/gfx/skid1.xml @@ -1,7 +1,7 @@ - + - + - + diff --git a/data/gfx/skid2.xml b/data/gfx/skid2.xml index 62fe9b6e4..be3d0c7b3 100644 --- a/data/gfx/skid2.xml +++ b/data/gfx/skid2.xml @@ -1,7 +1,7 @@ - + - + - + diff --git a/src/karts/kart_gfx.cpp b/src/karts/kart_gfx.cpp index 8a0cbf330..e24f6f0f2 100644 --- a/src/karts/kart_gfx.cpp +++ b/src/karts/kart_gfx.cpp @@ -41,6 +41,12 @@ KartGFX::KartGFX(const AbstractKart *kart) m_kart = kart; + Vec3 rear_left(-(kart->getKartWidth()+0.20)*0.35f, (kart->getKartHeight()-0.6)*0.35f, + -kart->getKartLength()*0.35f); + + Vec3 rear_right((kart->getKartWidth()+0.20)*0.35f, (kart->getKartHeight()-0.6)*0.35f, + -kart->getKartLength()*0.35f); + Vec3 rear_center(0, kart->getKartHeight()*0.35f, -kart->getKartLength()*0.35f); @@ -49,9 +55,10 @@ KartGFX::KartGFX(const AbstractKart *kart) addEffect(KGFX_NITRO, "nitro.xml", rear_center); addEffect(KGFX_ZIPPER, "zipper_fire.xml", rear_center); addEffect(KGFX_TERRAIN, "smoke.xml", Vec3(0,0,0)); - addEffect(KGFX_SKID1, "skid1.xml", rear_center); - addEffect(KGFX_SKID2, "skid2.xml", rear_center); - + addEffect(KGFX_SKID1L, "skid1.xml", rear_left); + addEffect(KGFX_SKID1R, "skid1.xml", rear_right); + addEffect(KGFX_SKID2L, "skid2.xml", rear_left); + addEffect(KGFX_SKID2R, "skid2.xml", rear_right); } // KartGFX // ---------------------------------------------------------------------------- @@ -86,7 +93,7 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name, //kind = new ParticleKind(file_manager->getGfxFile(file_name)); // Skid2 is only used to store the emitter type, and a wheeless // kart has no terrain effects. - if(type==KGFX_SKID2 || (type==KGFX_TERRAIN && m_kart->isWheeless()) ) + if(type==KGFX_SKID2L || type==KGFX_SKID2R || (type==KGFX_TERRAIN && m_kart->isWheeless()) ) emitter = NULL; else if(type==KGFX_TERRAIN) // Terrain is NOT a child of the kart, since bullet returns the @@ -107,9 +114,9 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name, } assert((int)m_all_emitters.size()==type); m_all_emitters.push_back(emitter); - if(type==KGFX_SKID1) + if(type==KGFX_SKID1L or type==KGFX_SKID1R) m_skid_kind1 = kind; - else if (type==KGFX_SKID2) + else if (type==KGFX_SKID2L or type==KGFX_SKID2R) m_skid_kind2 = kind; } // addEffect @@ -139,11 +146,14 @@ void KartGFX::setSkidLevel(const unsigned int level) assert(level >= 1); assert(level <= 2); const ParticleKind *pk = level==1 ? m_skid_kind1 : m_skid_kind2; - if(m_all_emitters[KGFX_SKID1]) - m_all_emitters[KGFX_SKID1]->setParticleType(pk); + if(m_all_emitters[KGFX_SKID1L]) + m_all_emitters[KGFX_SKID1L]->setParticleType(pk); + if(m_all_emitters[KGFX_SKID1R]) + m_all_emitters[KGFX_SKID1R]->setParticleType(pk); // Relative 0 means it will emitt the minimum rate, i.e. the rate // set to indicate that the bonus is now available. - setCreationRateRelative(KartGFX::KGFX_SKID, 0.0f); + setCreationRateRelative(KartGFX::KGFX_SKIDL, 0.0f); + setCreationRateRelative(KartGFX::KGFX_SKIDR, 0.0f); } // setSkidLevel // ---------------------------------------------------------------------------- diff --git a/src/karts/kart_gfx.hpp b/src/karts/kart_gfx.hpp index 342228c03..84929fab3 100644 --- a/src/karts/kart_gfx.hpp +++ b/src/karts/kart_gfx.hpp @@ -42,9 +42,12 @@ public: enum KartGFXType { KGFX_NITRO=0, KGFX_ZIPPER, KGFX_TERRAIN, - KGFX_SKID, - KGFX_SKID1=KGFX_SKID, - KGFX_SKID2, + KGFX_SKIDL, + KGFX_SKIDR, + KGFX_SKID1L = KGFX_SKIDL, + KGFX_SKID1R = KGFX_SKIDR, + KGFX_SKID2L, + KGFX_SKID2R, KGFX_COUNT}; private: diff --git a/src/karts/skidding.cpp b/src/karts/skidding.cpp index 5f13f5ba5..593390f01 100644 --- a/src/karts/skidding.cpp +++ b/src/karts/skidding.cpp @@ -71,7 +71,8 @@ void Skidding::reset() m_gfx_jump_offset = 0.0f; m_remaining_jump_time = 0.0f; m_jump_speed = 0.0f; - m_kart->getKartGFX()->setCreationRateAbsolute(KartGFX::KGFX_SKID, 0); + m_kart->getKartGFX()->setCreationRateAbsolute(KartGFX::KGFX_SKIDL, 0); + m_kart->getKartGFX()->setCreationRateAbsolute(KartGFX::KGFX_SKIDR, 0); } // reset // ---------------------------------------------------------------------------- @@ -376,16 +377,21 @@ void Skidding::update(float dt, bool is_on_ground, if(bonus_time>0) { m_kart->getKartGFX() - ->setCreationRateRelative(KartGFX::KGFX_SKID, 1.0f); + ->setCreationRateRelative(KartGFX::KGFX_SKIDL, 1.0f); + m_kart->getKartGFX() + ->setCreationRateRelative(KartGFX::KGFX_SKIDR, 1.0f); m_kart->m_max_speed-> instantSpeedIncrease(MaxSpeed::MS_INCREASE_SKIDDING, bonus_speed, bonus_speed, bonus_force, bonus_time, /*fade-out-time*/ 1.0f); } - else + else { m_kart->getKartGFX() - ->setCreationRateAbsolute(KartGFX::KGFX_SKID, 0); + ->setCreationRateAbsolute(KartGFX::KGFX_SKIDL, 0); + m_kart->getKartGFX() + ->setCreationRateAbsolute(KartGFX::KGFX_SKIDR, 0); + } } break; } // case @@ -396,7 +402,9 @@ void Skidding::update(float dt, bool is_on_ground, { m_skid_time = 0; m_kart->getKartGFX() - ->setCreationRateAbsolute(KartGFX::KGFX_SKID, 0); + ->setCreationRateAbsolute(KartGFX::KGFX_SKIDL, 0); + m_kart->getKartGFX() + ->setCreationRateAbsolute(KartGFX::KGFX_SKIDR, 0); m_skid_state = SKID_NONE; } } // switch