diff --git a/src/karts/abstract_kart.hpp b/src/karts/abstract_kart.hpp index 9bd0997a2..4e53a20f1 100644 --- a/src/karts/abstract_kart.hpp +++ b/src/karts/abstract_kart.hpp @@ -381,8 +381,6 @@ public: e.g. to calculate the starting point and direction of projectiles. */ virtual btTransform getAlignedTransform(const float customPitch=-1) = 0; // ------------------------------------------------------------------------- - virtual void onFirePressed() = 0; - // ------------------------------------------------------------------------- /** Set a text that is displayed on top of a kart. */ virtual void setOnScreenText(const wchar_t *text) = 0; diff --git a/src/karts/controller/ai_base_controller.cpp b/src/karts/controller/ai_base_controller.cpp index 695641dbe..9155fd333 100644 --- a/src/karts/controller/ai_base_controller.cpp +++ b/src/karts/controller/ai_base_controller.cpp @@ -242,8 +242,6 @@ void AIBaseController::update(float dt) m_next_node_index[m_track_node]==-1) m_track_node = old_node; } - if(m_controls->m_fire) - m_kart->onFirePressed(); } // update //----------------------------------------------------------------------------- diff --git a/src/karts/controller/player_controller.cpp b/src/karts/controller/player_controller.cpp index 57ce3ae70..bad6ef449 100644 --- a/src/karts/controller/player_controller.cpp +++ b/src/karts/controller/player_controller.cpp @@ -195,13 +195,7 @@ void PlayerController::action(PlayerAction action, int value) break; case PA_FIRE: { - bool wasFirePressed = m_controls->m_fire; m_controls->m_fire = (value!=0); - if (m_controls->m_fire && !wasFirePressed) - { - World::getWorld()->onFirePressed(this); - m_kart->onFirePressed(); - } break; } case PA_LOOK_BACK: diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index d9134c15e..08c4c310e 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1070,6 +1070,16 @@ void Kart::update(float dt) updatePhysics(dt); + if(m_controls.m_fire && !m_kart_animation) + { + // use() needs to be called even if there currently is no collecteable + // since use() can test if something needs to be switched on/off. + m_powerup->use() ; + World::getWorld()->onFirePressed(getController()); + } + // Reset the fire button + m_controls.m_fire = 0; + /* (TODO: add back when properly done) for (int n = 0; n < SFXManager::NUM_CUSTOMS; n++) { @@ -1193,19 +1203,6 @@ void Kart::update(float dt) } } // update -//----------------------------------------------------------------------------- -void Kart::onFirePressed() -{ - // On a client fiering is done upon receiving the command from the server. - if (network_manager->getMode()!=NetworkManager::NW_CLIENT - && !getKartAnimation()) - { - // use() needs to be called even if there currently is no collecteable - // since use() can test if something needs to be switched on/off. - m_powerup->use() ; - } -} - //----------------------------------------------------------------------------- /** Show fire to go with a zipper. */ diff --git a/src/karts/kart.hpp b/src/karts/kart.hpp index 8f7577f79..b207e9b99 100644 --- a/src/karts/kart.hpp +++ b/src/karts/kart.hpp @@ -400,8 +400,6 @@ public: /** Returns the terrain info oject. */ TerrainInfo *getTerrainInfo() { return m_terrain_info; } // ------------------------------------------------------------------------ - virtual void onFirePressed(); - // ------------------------------------------------------------------------ virtual void setOnScreenText(const wchar_t *text); }; // Kart