int CHudAmmo::Draw(float flTime) { int a, x, y, r, g, b; int AmmoWidth; if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) )) return 1; if ( (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) ) return 1; // Draw Weapon Menu DrawWList(flTime); // Draw ammo pickup history gHR.DrawAmmoHistory( flTime ); if (!(m_iFlags & HUD_ACTIVE)) return 0; if (!m_pWeapon) return 0; WEAPON *pw = m_pWeapon; // shorthand // SPR_Draw Ammo if ((pw->iAmmoType < 0) && (pw->iAmmo2Type < 0)) return 0; int iFlags = DHN_DRAWZERO; // draw 0 values AmmoWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left; a = (int) max( MIN_ALPHA, m_fFade ); if (m_fFade > 0) m_fFade -= (gHUD.m_flTimeDelta * 20); UnpackRGB(r,g,b, RGB_YELLOWISH); ScaleColors(r, g, b, a ); // Does this weapon have a clip? y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight/2; // Does weapon have any ammo at all? if (m_pWeapon->iAmmoType > 0) { int iIconWidth = m_pWeapon->rcAmmo.right - m_pWeapon->rcAmmo.left; if (pw->iClip >= 0) { // room for the number and the '|' and the current ammo x = ScreenWidth - 20; char *showPA = "Primary"; char *lol = "a"; //Primary 20 | 20 gHUD.DrawHudString(x - 300, 20, 150, showPA, 255, 255, 255); gHUD.DrawHudNumberString(x - 60, 20, DHN_3DIGITS, pw->iClip, r, g, b); //gHUD.DrawHudString(x - 40, 20, DHN_DRAWZERO, lol, r, g, b); //x = gHUD.DrawHudNumber(x, 2, iFlags | DHN_3DIGITS, lill, r, g, b); //wrect_t rc; //rc.top = 0; //rc.left = 0; //rc.right = AmmoWidth; //rc.bottom = 100; //int iBarWidth = AmmoWidth/10; //x += AmmoWidth/2; UnpackRGB(r,g,b, RGB_YELLOWISH); // draw the | bar //FillRGBA(x, y, iBarWidth, gHUD.m_iFontHeight, r, g, b, a); //x += iBarWidth + AmmoWidth/2;; // GL Seems to need this ScaleColors(r, g, b, a ); gHUD.DrawHudNumberString(x, 20, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b); } else { // SPR_Draw a bullets only line x = ScreenWidth - 4 * AmmoWidth - iIconWidth; x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b); } // Draw the ammo Icon int iOffset = (m_pWeapon->rcAmmo.bottom - m_pWeapon->rcAmmo.top)/8; SPR_Set(m_pWeapon->hAmmo, r, g, b); SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo); } // Does weapon have seconday ammo? if (pw->iAmmo2Type > 0) { int iIconWidth = m_pWeapon->rcAmmo2.right - m_pWeapon->rcAmmo2.left; // Do we have secondary ammo? if ((pw->iAmmo2Type != 0) && (gWR.CountAmmo(pw->iAmmo2Type) > 0)) { y -= gHUD.m_iFontHeight + gHUD.m_iFontHeight/4; x = ScreenWidth - 4 * AmmoWidth - iIconWidth; x = gHUD.DrawHudNumber(x, y, iFlags|DHN_3DIGITS, gWR.CountAmmo(pw->iAmmo2Type), r, g, b); // Draw the ammo Icon SPR_Set(m_pWeapon->hAmmo2, r, g, b); int iOffset = (m_pWeapon->rcAmmo2.bottom - m_pWeapon->rcAmmo2.top)/8; SPR_DrawAdditive(0, x, y - iOffset, &m_pWeapon->rcAmmo2); } } return 1; }