Split DrawGlobalPlayerIcons
This commit is contained in:
parent
0c5b1a3999
commit
6445fb059d
@ -670,8 +670,8 @@ void RaceGUIBase::drawGlobalReadySetGo()
|
|||||||
} // drawGlobalReadySetGo
|
} // drawGlobalReadySetGo
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Draw players icons and their times (if defined in the current mode).
|
/** Draw players icons and, depending on the current mode, their time
|
||||||
* Also takes care of icon looking different due to plumber, squashing, ...
|
* or their score (battle lives, egg collected, etc.).
|
||||||
*/
|
*/
|
||||||
void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
|
void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
|
||||||
{
|
{
|
||||||
@ -717,7 +717,6 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
|
|||||||
int ICON_WIDTH = ICON_PLAYER_WIDTH * 5 / 6;
|
int ICON_WIDTH = ICON_PLAYER_WIDTH * 5 / 6;
|
||||||
|
|
||||||
WorldWithRank* world = dynamic_cast<WorldWithRank*>(World::getWorld());
|
WorldWithRank* world = dynamic_cast<WorldWithRank*>(World::getWorld());
|
||||||
CaptureTheFlag* ctf = dynamic_cast<CaptureTheFlag*>(World::getWorld());
|
|
||||||
|
|
||||||
//initialize m_previous_icons_position
|
//initialize m_previous_icons_position
|
||||||
if(m_previous_icons_position.size()==0)
|
if(m_previous_icons_position.size()==0)
|
||||||
@ -865,12 +864,25 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
|
|||||||
true /* ignore RTL */);
|
true /* ignore RTL */);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw icon
|
|
||||||
video::ITexture *icon =
|
|
||||||
kart->getKartProperties()->getIconMaterial()->getTexture();
|
|
||||||
int w = kart->getController()
|
int w = kart->getController()
|
||||||
->isLocalPlayerController() ? ICON_PLAYER_WIDTH
|
->isLocalPlayerController() ? ICON_PLAYER_WIDTH
|
||||||
: ICON_WIDTH;
|
: ICON_WIDTH;
|
||||||
|
drawPlayerIcon(kart, x, y, w);
|
||||||
|
} //next position
|
||||||
|
#endif
|
||||||
|
} // drawGlobalPlayerIcons
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Draw one player icon
|
||||||
|
* Takes care of icon looking different due to plumber, squashing, ...
|
||||||
|
*/
|
||||||
|
void RaceGUIBase::drawPlayerIcon(AbstractKart *kart, int x, int y, int w)
|
||||||
|
{
|
||||||
|
video::ITexture *icon =
|
||||||
|
kart->getKartProperties()->getIconMaterial()->getTexture();
|
||||||
|
|
||||||
|
CaptureTheFlag* ctf = dynamic_cast<CaptureTheFlag*>(World::getWorld());
|
||||||
|
unsigned int kart_id = kart->getWorldKartId();
|
||||||
|
|
||||||
// CTF
|
// CTF
|
||||||
if (ctf)
|
if (ctf)
|
||||||
@ -987,7 +999,7 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Plunger
|
//Plunger
|
||||||
if (kart->getGraphicalViewBlockedByPlunger() > 0.0f)
|
if (kart->getBlockedByPlungerTicks()>0)
|
||||||
{
|
{
|
||||||
video::ITexture *icon_plunger =
|
video::ITexture *icon_plunger =
|
||||||
powerup_manager->getIcon(PowerupManager::POWERUP_PLUNGER)->getTexture();
|
powerup_manager->getIcon(PowerupManager::POWERUP_PLUNGER)->getTexture();
|
||||||
@ -1017,10 +1029,7 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
|
|||||||
NULL, true);
|
NULL, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // drawPlayerIcon
|
||||||
} //next position
|
|
||||||
#endif
|
|
||||||
} // drawGlobalPlayerIcons
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -1031,7 +1040,7 @@ void RaceGUIBase::drawPlungerInFace(const Camera *camera, float dt)
|
|||||||
{
|
{
|
||||||
#ifndef SERVER_ONLY
|
#ifndef SERVER_ONLY
|
||||||
const AbstractKart *kart = camera->getKart();
|
const AbstractKart *kart = camera->getKart();
|
||||||
if (kart->getGraphicalViewBlockedByPlunger() <= 0.0f)
|
if (kart->getBlockedByPlungerTicks()<=0)
|
||||||
{
|
{
|
||||||
m_plunger_state = PLUNGER_STATE_INIT;
|
m_plunger_state = PLUNGER_STATE_INIT;
|
||||||
return;
|
return;
|
||||||
@ -1056,7 +1065,7 @@ void RaceGUIBase::drawPlungerInFace(const Camera *camera, float dt)
|
|||||||
if(m_plunger_move_time < dt && m_plunger_state!=PLUNGER_STATE_FAST)
|
if(m_plunger_move_time < dt && m_plunger_state!=PLUNGER_STATE_FAST)
|
||||||
{
|
{
|
||||||
const float fast_time = 0.3f;
|
const float fast_time = 0.3f;
|
||||||
if (kart->getGraphicalViewBlockedByPlunger() < fast_time)
|
if(kart->getBlockedByPlungerTicks()<stk_config->time2Ticks(fast_time))
|
||||||
{
|
{
|
||||||
// First time we reach faste state: select random target point
|
// First time we reach faste state: select random target point
|
||||||
// at top of screen and set speed accordingly
|
// at top of screen and set speed accordingly
|
||||||
@ -1129,3 +1138,4 @@ void RaceGUIBase::removeReferee()
|
|||||||
m_referee->removeFromSceneGraph();
|
m_referee->removeFromSceneGraph();
|
||||||
}
|
}
|
||||||
} // removeReferee
|
} // removeReferee
|
||||||
|
|
||||||
|
@ -246,6 +246,7 @@ public:
|
|||||||
virtual void clearAllMessages() { m_messages.clear(); }
|
virtual void clearAllMessages() { m_messages.clear(); }
|
||||||
|
|
||||||
void drawGlobalPlayerIcons(int bottom_margin);
|
void drawGlobalPlayerIcons(int bottom_margin);
|
||||||
|
void drawPlayerIcon(AbstractKart *kart, int x, int y, int w);
|
||||||
|
|
||||||
virtual void drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
virtual void drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
||||||
const core::recti &viewport,
|
const core::recti &viewport,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user