Don't show an alert when the player uses an offensive powerup
This commit is contained in:
parent
7b62947e08
commit
61df9c4b35
@ -225,6 +225,9 @@ public:
|
|||||||
/** Returns the type of flyable. */
|
/** Returns the type of flyable. */
|
||||||
PowerupManager::PowerupType getType() const {return m_type;}
|
PowerupManager::PowerupType getType() const {return m_type;}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
/** Returns the owner's kart */
|
||||||
|
AbstractKart *getOwner() const { return m_owner;}
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
/** Sets wether Flyable should update TerrainInfo as part of its update
|
/** Sets wether Flyable should update TerrainInfo as part of its update
|
||||||
* call, or if the inheriting object will update TerrainInfo itself
|
* call, or if the inheriting object will update TerrainInfo itself
|
||||||
* (or perhaps not at all if it is not needed). */
|
* (or perhaps not at all if it is not needed). */
|
||||||
|
@ -201,7 +201,8 @@ bool ProjectileManager::projectileIsClose(const AbstractKart * const kart,
|
|||||||
* \param type The type of projectile checked
|
* \param type The type of projectile checked
|
||||||
*/
|
*/
|
||||||
int ProjectileManager::getNearbyProjectileCount(const AbstractKart * const kart,
|
int ProjectileManager::getNearbyProjectileCount(const AbstractKart * const kart,
|
||||||
float radius, PowerupManager::PowerupType type)
|
float radius, PowerupManager::PowerupType type,
|
||||||
|
bool exclude_owned)
|
||||||
{
|
{
|
||||||
float r2 = radius * radius;
|
float r2 = radius * radius;
|
||||||
int projectile_count = 0;
|
int projectile_count = 0;
|
||||||
@ -212,6 +213,9 @@ int ProjectileManager::getNearbyProjectileCount(const AbstractKart * const kart,
|
|||||||
continue;
|
continue;
|
||||||
if (i->second->getType() == type)
|
if (i->second->getType() == type)
|
||||||
{
|
{
|
||||||
|
if (exclude_owned && (i->second->getOwner() == kart))
|
||||||
|
continue;
|
||||||
|
|
||||||
float dist2 = i->second->getXYZ().distance2(kart->getXYZ());
|
float dist2 = i->second->getXYZ().distance2(kart->getXYZ());
|
||||||
if (dist2 < r2)
|
if (dist2 < r2)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,8 @@ public:
|
|||||||
float radius);
|
float radius);
|
||||||
|
|
||||||
int getNearbyProjectileCount(const AbstractKart * const kart,
|
int getNearbyProjectileCount(const AbstractKart * const kart,
|
||||||
float radius, PowerupManager::PowerupType type);
|
float radius, PowerupManager::PowerupType type,
|
||||||
|
bool exclude_owned=false);
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Adds a special hit effect to be shown.
|
/** Adds a special hit effect to be shown.
|
||||||
* \param hit_effect The hit effect to be added. */
|
* \param hit_effect The hit effect to be added. */
|
||||||
|
@ -841,11 +841,14 @@ void RaceGUI::drawMiscInfo(const AbstractKart *kart,
|
|||||||
// and in most cases fly too quickly to make an alert useful
|
// and in most cases fly too quickly to make an alert useful
|
||||||
int projectile_types[3]; //[2] basket, [1] cakes, [0] bowling
|
int projectile_types[3]; //[2] basket, [1] cakes, [0] bowling
|
||||||
projectile_types[0] = projectile_manager->getNearbyProjectileCount(kart, 15.0f /*alert radius*/,
|
projectile_types[0] = projectile_manager->getNearbyProjectileCount(kart, 15.0f /*alert radius*/,
|
||||||
PowerupManager::POWERUP_BOWLING);
|
PowerupManager::POWERUP_BOWLING,
|
||||||
|
true /* exclude if owned by the kart */);
|
||||||
projectile_types[1] = projectile_manager->getNearbyProjectileCount(kart, 25.0f /*alert radius*/,
|
projectile_types[1] = projectile_manager->getNearbyProjectileCount(kart, 25.0f /*alert radius*/,
|
||||||
PowerupManager::POWERUP_CAKE);
|
PowerupManager::POWERUP_CAKE,
|
||||||
|
true /* exclude if owned by the kart */);
|
||||||
projectile_types[2] = projectile_manager->getNearbyProjectileCount(kart, 50.0f /*alert radius*/,
|
projectile_types[2] = projectile_manager->getNearbyProjectileCount(kart, 50.0f /*alert radius*/,
|
||||||
PowerupManager::POWERUP_RUBBERBALL);
|
PowerupManager::POWERUP_RUBBERBALL,
|
||||||
|
true /* exclude if owned by the kart */);
|
||||||
|
|
||||||
int icon_to_use = 2;
|
int icon_to_use = 2;
|
||||||
int projectile_to_show = -1;
|
int projectile_to_show = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user