parent
37527baf51
commit
63703f96f3
@ -219,8 +219,7 @@ bool ProjectileManager::projectileIsClose(const AbstractKart * const kart,
|
|||||||
float radius)
|
float radius)
|
||||||
{
|
{
|
||||||
float r2 = radius * radius;
|
float r2 = radius * radius;
|
||||||
for (auto i = m_active_projectiles.begin(); i != m_active_projectiles.end();
|
for (auto i = m_active_projectiles.begin(); i != m_active_projectiles.end(); i++)
|
||||||
i++)
|
|
||||||
{
|
{
|
||||||
if (!i->second->hasServerState())
|
if (!i->second->hasServerState())
|
||||||
continue;
|
continue;
|
||||||
@ -244,8 +243,7 @@ int ProjectileManager::getNearbyProjectileCount(const AbstractKart * const kart,
|
|||||||
{
|
{
|
||||||
float r2 = radius * radius;
|
float r2 = radius * radius;
|
||||||
int projectile_count = 0;
|
int projectile_count = 0;
|
||||||
for (auto i = m_active_projectiles.begin(); i != m_active_projectiles.end();
|
for (auto i = m_active_projectiles.begin(); i != m_active_projectiles.end(); i++)
|
||||||
i++)
|
|
||||||
{
|
{
|
||||||
if (!i->second->hasServerState())
|
if (!i->second->hasServerState())
|
||||||
continue;
|
continue;
|
||||||
@ -264,6 +262,20 @@ int ProjectileManager::getNearbyProjectileCount(const AbstractKart * const kart,
|
|||||||
return projectile_count;
|
return projectile_count;
|
||||||
} // getNearbyProjectileCount
|
} // getNearbyProjectileCount
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
std::vector<Vec3> ProjectileManager::getBasketballPositions()
|
||||||
|
{
|
||||||
|
std::vector<Vec3> positions;
|
||||||
|
for (auto i = m_active_projectiles.begin(); i != m_active_projectiles.end(); i++)
|
||||||
|
{
|
||||||
|
if (!i->second->hasServerState())
|
||||||
|
continue;
|
||||||
|
if (i->second->getType() == PowerupManager::POWERUP_RUBBERBALL)
|
||||||
|
positions.emplace_back(i->second->getXYZ());
|
||||||
|
} // loop over projectiles
|
||||||
|
|
||||||
|
return positions;
|
||||||
|
} // getBasketballPositions
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
std::string ProjectileManager::getUniqueIdentity(AbstractKart* kart,
|
std::string ProjectileManager::getUniqueIdentity(AbstractKart* kart,
|
||||||
PowerupManager::PowerupType t)
|
PowerupManager::PowerupType t)
|
||||||
|
@ -93,6 +93,8 @@ public:
|
|||||||
std::shared_ptr<Flyable> newProjectile(AbstractKart *kart,
|
std::shared_ptr<Flyable> newProjectile(AbstractKart *kart,
|
||||||
PowerupManager::PowerupType type);
|
PowerupManager::PowerupType type);
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
std::vector<Vec3> getBasketballPositions();
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
void addByUID(const std::string& uid, std::shared_ptr<Flyable> f)
|
void addByUID(const std::string& uid, std::shared_ptr<Flyable> f)
|
||||||
{ m_active_projectiles[uid] = f; }
|
{ m_active_projectiles[uid] = f; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -41,6 +41,7 @@ using namespace irr;
|
|||||||
#include "guiengine/scalable_font.hpp"
|
#include "guiengine/scalable_font.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "items/powerup_manager.hpp"
|
#include "items/powerup_manager.hpp"
|
||||||
|
#include "items/projectile_manager.hpp"
|
||||||
#include "karts/abstract_kart.hpp"
|
#include "karts/abstract_kart.hpp"
|
||||||
#include "karts/controller/controller.hpp"
|
#include "karts/controller/controller.hpp"
|
||||||
#include "karts/controller/spare_tire_ai.hpp"
|
#include "karts/controller/spare_tire_ai.hpp"
|
||||||
@ -100,6 +101,7 @@ RaceGUI::RaceGUI()
|
|||||||
m_blue_flag = irr_driver->getTexture(FileManager::GUI_ICON, "blue_flag.png");
|
m_blue_flag = irr_driver->getTexture(FileManager::GUI_ICON, "blue_flag.png");
|
||||||
m_soccer_ball = irr_driver->getTexture(FileManager::GUI_ICON, "soccer_ball_normal.png");
|
m_soccer_ball = irr_driver->getTexture(FileManager::GUI_ICON, "soccer_ball_normal.png");
|
||||||
m_heart_icon = irr_driver->getTexture(FileManager::GUI_ICON, "heart.png");
|
m_heart_icon = irr_driver->getTexture(FileManager::GUI_ICON, "heart.png");
|
||||||
|
m_basket_ball_icon = irr_driver->getTexture(FileManager::GUI_ICON, "rubber_ball-icon.png");
|
||||||
m_champion = irr_driver->getTexture(FileManager::GUI_ICON, "cup_gold.png");
|
m_champion = irr_driver->getTexture(FileManager::GUI_ICON, "cup_gold.png");
|
||||||
} // RaceGUI
|
} // RaceGUI
|
||||||
|
|
||||||
@ -672,7 +674,7 @@ void RaceGUI::drawGlobalMiniMap()
|
|||||||
|
|
||||||
bool has_teams = (ctf_world || soccer_world);
|
bool has_teams = (ctf_world || soccer_world);
|
||||||
|
|
||||||
// Highlight the player icons with some backgorund image.
|
// Highlight the player icons with some background image.
|
||||||
if ((has_teams || is_local) && m_icons_frame != NULL)
|
if ((has_teams || is_local) && m_icons_frame != NULL)
|
||||||
{
|
{
|
||||||
video::SColor color = kart->getKartProperties()->getColor();
|
video::SColor color = kart->getKartProperties()->getColor();
|
||||||
@ -721,6 +723,26 @@ void RaceGUI::drawGlobalMiniMap()
|
|||||||
|
|
||||||
} // for i<getNumKarts
|
} // for i<getNumKarts
|
||||||
|
|
||||||
|
// Draw the basket-ball icons on the minimap
|
||||||
|
std::vector<Vec3> basketballs = ProjectileManager::get()->getBasketballPositions();
|
||||||
|
for(unsigned int i = 0; i != basketballs.size(); i++)
|
||||||
|
{
|
||||||
|
Vec3 draw_at;
|
||||||
|
track->mapPoint2MiniMap(basketballs[i], &draw_at);
|
||||||
|
|
||||||
|
video::ITexture* icon = m_basket_ball_icon;
|
||||||
|
|
||||||
|
core::rect<s32> source(core::position2di(0, 0), icon->getSize());
|
||||||
|
int marker_half_size = m_minimap_player_size / 2;
|
||||||
|
core::rect<s32> position(m_map_left+(int)(draw_at.getX()-marker_half_size),
|
||||||
|
lower_y -(int)(draw_at.getY()+marker_half_size),
|
||||||
|
m_map_left+(int)(draw_at.getX()+marker_half_size),
|
||||||
|
lower_y -(int)(draw_at.getY()-marker_half_size));
|
||||||
|
|
||||||
|
draw2DImage(icon, position, source, NULL, NULL, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the soccer ball icon
|
||||||
if (soccer_world)
|
if (soccer_world)
|
||||||
{
|
{
|
||||||
Vec3 draw_at;
|
Vec3 draw_at;
|
||||||
|
@ -99,6 +99,7 @@ private:
|
|||||||
irr::video::ITexture *m_blue_flag;
|
irr::video::ITexture *m_blue_flag;
|
||||||
irr::video::ITexture *m_soccer_ball;
|
irr::video::ITexture *m_soccer_ball;
|
||||||
irr::video::ITexture *m_heart_icon;
|
irr::video::ITexture *m_heart_icon;
|
||||||
|
irr::video::ITexture *m_basket_ball_icon;
|
||||||
/** Texture for the hit limit icon*/
|
/** Texture for the hit limit icon*/
|
||||||
irr::video::ITexture* m_champion;
|
irr::video::ITexture* m_champion;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user