Fix fire button misbehaving when assigned to an analog key
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11132 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -385,7 +385,9 @@ public:
|
||||
and oriented in the direction the kart is going. Can be useful
|
||||
e.g. to calculate the starting point and direction of projectiles. */
|
||||
virtual btTransform getAlignedTransform(const float customPitch=-1) = 0;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
virtual void onFirePressed() = 0;
|
||||
|
||||
}; // AbstractKart
|
||||
|
||||
|
||||
|
||||
@@ -189,12 +189,16 @@ void PlayerController::action(PlayerAction action, int value)
|
||||
m_controls->m_rescue = (value!=0);
|
||||
break;
|
||||
case PA_FIRE:
|
||||
{
|
||||
bool wasFirePressed = m_controls->m_fire;
|
||||
m_controls->m_fire = (value!=0);
|
||||
if (value > 0)
|
||||
if (m_controls->m_fire && !wasFirePressed)
|
||||
{
|
||||
World::getWorld()->onFirePressed(this);
|
||||
m_kart->onFirePressed();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PA_LOOK_BACK:
|
||||
m_controls->m_look_back = (value!=0);
|
||||
break;
|
||||
|
||||
@@ -976,16 +976,6 @@ void Kart::update(float dt)
|
||||
race_state->storeKartControls(*this);
|
||||
}
|
||||
|
||||
// On a client fiering is done upon receiving the command from the server.
|
||||
if ( m_controls.m_fire && 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() ;
|
||||
m_controls.m_fire = false;
|
||||
}
|
||||
|
||||
if (!m_flying)
|
||||
{
|
||||
// When really on air, free fly, when near ground, try to glide / adjust for landing
|
||||
@@ -1161,6 +1151,19 @@ 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.
|
||||
*/
|
||||
|
||||
@@ -401,6 +401,8 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the terrain info oject. */
|
||||
TerrainInfo *getTerrainInfo() { return m_terrain_info; }
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void onFirePressed();
|
||||
}; // Kart
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user