本文整理汇总了C++中WeaponsResource::CountAmmo方法的典型用法代码示例。如果您正苦于以下问题:C++ WeaponsResource::CountAmmo方法的具体用法?C++ WeaponsResource::CountAmmo怎么用?C++ WeaponsResource::CountAmmo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WeaponsResource
的用法示例。
在下文中一共展示了WeaponsResource::CountAmmo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawAmmoBar
void DrawAmmoBar(WEAPON *p, int x, int y, int width, int height)
{
if(!p)
return;
if(p->iAmmoType != -1)
{
if(!gWR.CountAmmo(p->iAmmoType))
return;
float f = (float)gWR.CountAmmo(p->iAmmoType) / (float)p->iMax1;
x = DrawBar(x, y, width, height, f);
// Do we have secondary ammo too?
if(p->iAmmo2Type != -1)
{
f = (float)gWR.CountAmmo(p->iAmmo2Type) / (float)p->iMax2;
x += 5; //!!!
DrawBar(x, y, width, height, f);
}
}
}
示例2: Draw
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;
// Fograin92: We're rendering ammo counters using new HUD, begone with this thing!
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);
// Fograin92: A little changes
//UnpackRGB(r,g,b, RGB_YELLOWISH);
r = SM_HUDcolor(1);
g = SM_HUDcolor(2);
b = SM_HUDcolor(3);
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 - (8 * AmmoWidth) - iIconWidth;
x = gHUD.DrawHudNumber(x, y, iFlags | DHN_3DIGITS, pw->iClip, 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;
// Fograin92: A little changes
//UnpackRGB(r,g,b, RGB_YELLOWISH);
r = SM_HUDcolor(1);
g = SM_HUDcolor(2);
b = SM_HUDcolor(3);
// 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 );
x = gHUD.DrawHudNumber(x, y, 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);
}
//.........这里部分代码省略.........
示例3: Draw
int CHudAmmo::Draw(float flTime)
{
int a, x, y, r, g, b;
int AmmoWidth;
int iCrossX;
int iCrossY;
int iCrossLength;
char *chCrossHair = "+"; // Heh
/*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;
/******************* DRAW CROSSHAIR *********************/
iCrossLength = gHUD.m_scrinfo.charWidths[*chCrossHair];
iCrossY = ScreenHeight / 2 - gHUD.m_scrinfo.iCharHeight / 2;
iCrossX = ScreenWidth / 2 - iCrossLength / 2;
gHUD.DrawHudString(iCrossX, iCrossY, iCrossX + 50, chCrossHair, 170, 170, 170);
/******************* DRAW CROSSHAIR *********************/
// 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)
{
x = ScreenWidth - (8 * AmmoWidth) - iIconWidth;
UnpackRGB(r, g, b, RGB_YELLOWISH);
// GL Seems to need this
ScaleColors(r, g, b, a);
m_iNumberXPosition = 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);
m_iXPosition = x;
}
return 1;
}
示例4: Draw
int CHudAmmo::Draw(float flTime)
{
wrect_t nullrc;
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;
if( gHUD.m_iFOV > 40 )
{
SetCrosshair( 0, nullrc, 0, 0, 0);
DrawCrosshair(flTime, m_pWeapon->iId); // draw a dynamic crosshair
}
else
{
SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255);
}
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);
DrawUtils::DrawUtils::UnpackRGB(r,g,b, RGB_YELLOWISH);
DrawUtils::DrawUtils::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 - (8 * AmmoWidth) - iIconWidth;
x = DrawUtils::DrawHudNumber(x, y, iFlags | DHN_3DIGITS, pw->iClip, r, g, b);
int iBarWidth = AmmoWidth/10;
x += AmmoWidth/2;
DrawUtils::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
DrawUtils::ScaleColors(r, g, b, a );
x = DrawUtils::DrawHudNumber(x, y, iFlags | DHN_3DIGITS, gWR.CountAmmo(pw->iAmmoType), r, g, b);
}
else
{
// SPR_Draw a bullets only line
x = ScreenWidth - 4 * AmmoWidth - iIconWidth;
x = DrawUtils::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)
//.........这里部分代码省略.........