Skip to content

Commit 0558db2

Browse files
committed
Display ninja bar in 0.7 servers (DDNet style)
1 parent f691a29 commit 0558db2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/game/client/components/hud.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,17 @@ void CHud::RenderAmmoHealthAndArmor(const CNetObj_Character *pCharacter)
739739
// ammo display
740740
float AmmoOffsetY = GameClient()->m_GameInfo.m_HudHealthArmor ? 24 : 0;
741741
int CurWeapon = pCharacter->m_Weapon % NUM_WEAPONS;
742-
if(CurWeapon >= 0 && m_pClient->m_GameSkin.m_aSpriteWeaponProjectiles[CurWeapon].IsValid())
742+
// 0.7 only
743+
if(CurWeapon == WEAPON_NINJA)
744+
{
745+
if(!GameClient()->m_GameInfo.m_HudDDRace && Client()->IsSixup())
746+
{
747+
const int Max = g_pData->m_Weapons.m_Ninja.m_Duration * Client()->GameTickSpeed() / 1000;
748+
float NinjaProgress = clamp(pCharacter->m_AmmoCount - Client()->GameTick(g_Config.m_ClDummy), 0, Max) / (float)Max;
749+
RenderNinjaBarPos(5 + 10 * 12, 5, 6.f, 24.f, NinjaProgress);
750+
}
751+
}
752+
else if(CurWeapon >= 0 && m_pClient->m_GameSkin.m_aSpriteWeaponProjectiles[CurWeapon].IsValid())
743753
{
744754
Graphics()->TextureSet(m_pClient->m_GameSkin.m_aSpriteWeaponProjectiles[CurWeapon]);
745755
if(AmmoOffsetY > 0)

0 commit comments

Comments
 (0)