Moved handling of fire from controller into kart, so now all
events in the KartControl structure are handled by kart. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12772 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f91448c4b3
commit
879e0248aa
@ -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;
|
||||
|
@ -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
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user