本文整理汇总了C++中WeaponsResource类的典型用法代码示例。如果您正苦于以下问题:C++ WeaponsResource类的具体用法?C++ WeaponsResource怎么用?C++ WeaponsResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WeaponsResource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetNextActivePos
WEAPON *WeaponsResource::GetNextActivePos(int iSlot, int iSlotPos)
{
if(iSlotPos >= MAX_WEAPON_POSITIONS || iSlot >= MAX_WEAPON_SLOTS)
return NULL;
WEAPON *p = gWR.rgSlots[iSlot][iSlotPos + 1];
if(!p || !gWR.HasAmmo(p))
return GetNextActivePos(iSlot, iSlotPos + 1);
return p;
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:12,代码来源:ammo.cpp
示例2: 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);
}
}
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:26,代码来源:ammo.cpp
示例3: VidInit
int CHudAmmo::VidInit(void)
{
// Load sprites for buckets (top row of weapon menu)
m_HUD_bucket0 = gHUD.GetSpriteIndex("bucket1");
m_HUD_selection = gHUD.GetSpriteIndex("selection");
ghsprBuckets = gHUD.GetSprite(m_HUD_bucket0);
giBucketWidth = gHUD.GetSpriteRect(m_HUD_bucket0).right - gHUD.GetSpriteRect(m_HUD_bucket0).left;
giBucketHeight = gHUD.GetSpriteRect(m_HUD_bucket0).bottom - gHUD.GetSpriteRect(m_HUD_bucket0).top;
gHR.iHistoryGap = max(gHR.iHistoryGap, gHUD.GetSpriteRect(m_HUD_bucket0).bottom - gHUD.GetSpriteRect(m_HUD_bucket0).top);
// If we've already loaded weapons, let's get new sprites
gWR.LoadAllWeaponSprites();
if(ScreenWidth >= 640)
{
giABWidth = 20;
giABHeight = 4;
}
else
{
giABWidth = 10;
giABHeight = 2;
}
return 1;
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:28,代码来源:ammo.cpp
示例4: MsgFunc_WeaponList
//
// WeaponList -- Tells the hud about a new weapon type.
//
int CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf)
{
BEGIN_READ(pbuf, iSize);
WEAPON Weapon;
strcpy(Weapon.szName, READ_STRING());
Weapon.iAmmoType = (int)READ_CHAR();
Weapon.iMax1 = READ_BYTE();
if(Weapon.iMax1 == 255)
Weapon.iMax1 = -1;
Weapon.iAmmo2Type = READ_CHAR();
Weapon.iMax2 = READ_BYTE();
if(Weapon.iMax2 == 255)
Weapon.iMax2 = -1;
Weapon.iSlot = READ_CHAR();
Weapon.iSlotPos = READ_CHAR();
Weapon.iId = READ_CHAR();
Weapon.iFlags = READ_BYTE();
Weapon.iClip = 0;
gWR.AddWeapon(&Weapon);
return 1;
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:31,代码来源:ammo.cpp
示例5: Think
//
// Think:
// Used for selection of weapon menu item.
//
void CHudAmmo::Think(void)
{
if ( gHUD.m_fPlayerDead )
return;
if ( gHUD.m_iWeaponBits != gWR.iOldWeaponBits )
{
gWR.iOldWeaponBits = gHUD.m_iWeaponBits;
for (int i = 0; i < MAX_WEAPONS-1; i++ )
{
WEAPON *p = gWR.GetWeapon(i);
if ( p )
{
if ( gHUD.m_iWeaponBits & ( 1 << p->iId ) )
{
gWR.PickupWeapon( p );
}
else
{
gWR.DropWeapon( p );
}
}
}
}
if (!gpActiveSel)
return;
// has the player selected one?
if (gHUD.m_iKeyBits & IN_ATTACK)
{
if (gpActiveSel != (WEAPON *)1)
{
ServerCmd(gpActiveSel->szName);
g_weaponselect = gpActiveSel->iId;
}
gpLastSel = gpActiveSel;
gpActiveSel = NULL;
gHUD.m_iKeyBits &= ~IN_ATTACK;
PlaySound("common/wpn_select.wav", 1);
}
}
开发者ID:izogain,项目名称:cs16-client,代码行数:51,代码来源:ammo.cpp
示例6: SlotInput
//------------------------------------------------------------------------
// Command Handlers
//------------------------------------------------------------------------
// Slot button pressed
void CHudAmmo::SlotInput( int iSlot )
{
// Let the Viewport use it first, for menus
if ( gViewPort && gViewPort->SlotInput( iSlot ) )
return;
gWR.SelectSlot(iSlot, FALSE, 1);
}
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:12,代码来源:ammo.cpp
示例7: Init
int CHudAmmo::Init(void)
{
gHUD.AddHudElem(this);
HOOK_MESSAGE(CurWeapon);
HOOK_MESSAGE(WeaponList);
HOOK_MESSAGE(AmmoPickup);
HOOK_MESSAGE(WeapPickup);
HOOK_MESSAGE(ItemPickup);
HOOK_MESSAGE(HideWeapon);
HOOK_MESSAGE(AmmoX);
HOOK_MESSAGE(Crosshair);
HOOK_MESSAGE(Brass);
HOOK_COMMAND("slot1", Slot1);
HOOK_COMMAND("slot2", Slot2);
HOOK_COMMAND("slot3", Slot3);
HOOK_COMMAND("slot4", Slot4);
HOOK_COMMAND("slot5", Slot5);
HOOK_COMMAND("slot6", Slot6);
HOOK_COMMAND("slot7", Slot7);
HOOK_COMMAND("slot8", Slot8);
HOOK_COMMAND("slot9", Slot9);
HOOK_COMMAND("slot10", Slot10);
HOOK_COMMAND("cancelselect", Close);
HOOK_COMMAND("invnext", NextWeapon);
HOOK_COMMAND("invprev", PrevWeapon);
HOOK_COMMAND("adjust_crosshair", Adjust_Crosshair);
HOOK_COMMAND("rebuy", Rebuy);
HOOK_COMMAND("autobuy", Autobuy);
Reset();
m_pHud_DrawHistory_Time = CVAR_CREATE( "hud_drawhistory_time", HISTORY_DRAW_TIME, 0 );
m_pHud_FastSwitch = CVAR_CREATE( "hud_fastswitch", "0", FCVAR_ARCHIVE ); // controls whether or not weapons can be selected in one keypress
CVAR_CREATE( "cl_observercrosshair", "1", 0 );
m_pClCrosshairColor = CVAR_CREATE( "cl_crosshair_color", "50 250 50", FCVAR_ARCHIVE );
m_pClCrosshairTranslucent = CVAR_CREATE( "cl_crosshair_translucent", "1", FCVAR_ARCHIVE );
m_pClCrosshairSize = CVAR_CREATE( "cl_crosshair_size", "auto", FCVAR_ARCHIVE );
m_pClDynamicCrosshair = CVAR_CREATE("cl_dynamiccrosshair", "1", FCVAR_ARCHIVE);
m_iFlags |= HUD_ACTIVE; //!!!
m_R = 50;
m_G = 250;
m_B = 50;
m_iAlpha = 200;
m_cvarB = m_cvarR = m_cvarG = -1;
m_iCurrentCrosshair = 0;
m_bAdditive = 1;
m_iCrosshairScaleBase = 1024;
m_bDrawCrosshair = true;
gWR.Init();
gHR.Init();
return 1;
};
开发者ID:izogain,项目名称:cs16-client,代码行数:58,代码来源:ammo.cpp
示例8: Think
//
// Think:
// Used for selection of weapon menu item.
//
void CHudAmmo::Think(void)
{
if ( gHUD.m_fPlayerDead )
return;
if ( gHUD.m_iWeaponBits != gWR.iOldWeaponBits )
{
gWR.iOldWeaponBits = gHUD.m_iWeaponBits;
for (int i = MAX_WEAPONS-1; i > 0; i-- )
{
WEAPON *p = gWR.GetWeapon(i);
if ( p )
{
if ( gHUD.m_iWeaponBits & ( 1 << p->iId ) )
gWR.PickupWeapon( p );
else
gWR.DropWeapon( p );
}
}
}
if (!gpActiveSel)
return;
// has the player selected one?
if (gHUD.m_iKeyBits & IN_ATTACK)
{
if (gpActiveSel != (WEAPON *)1)
{
ServerCmd(gpActiveSel->szName);
g_weaponselect = gpActiveSel->iId;
}
gpLastSel = gpActiveSel;
gpActiveSel = NULL;
gHUD.m_iKeyBits &= ~IN_ATTACK;
// Fograin92: Replaced with new audio engine
gSoundEngine.PlaySound("common/wpn_select.wav", g_vecZero, SND_2D, 0, CVAR_GET_FLOAT("sm_snd_sfx"));
}
}
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:48,代码来源:ammo.cpp
示例9: MsgFunc_AmmoX
//
// AmmoX -- Update the count of a known type of ammo
//
int CHudAmmo::MsgFunc_AmmoX(const char *pszName, int iSize, void *pbuf)
{
BEGIN_READ(pbuf, iSize);
int iIndex = READ_BYTE();
int iCount = READ_BYTE();
gWR.SetAmmo(iIndex, abs(iCount));
return 1;
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:14,代码来源:ammo.cpp
示例10: Update
void CDiscPanel::Update( int iDiscNo, bool bGlow, int iPowerup )
{
int iDiscs = gWR.GetAmmo( 1 );
// Grey disc for missing discs
if ( iDiscs < iDiscNo+1 )
{
setImage( m_pDiscTGA_Grey );
}
// Powerups override team colored discs
else if ( iPowerup & POW_TRIPLE )
{
setImage( m_pDiscTGA_Triple );
}
else if ( iPowerup & POW_FAST )
{
setImage( m_pDiscTGA_Fast );
}
else if ( iPowerup & POW_FREEZE )
{
setImage( m_pDiscTGA_Freeze );
}
else if ( iPowerup & POW_HARD )
{
setImage( m_pDiscTGA_Hard );
}
else if (g_iTeamNumber == 1)
{
if ( gWR.GetAmmo( 1 ) == 3 )
setImage( m_pDiscTGA_RedGlow );
else
setImage( m_pDiscTGA_Red );
}
else
{
if ( gWR.GetAmmo( 1 ) == 3 )
setImage( m_pDiscTGA_BlueGlow );
else
setImage( m_pDiscTGA_Blue );
}
}
开发者ID:6779660,项目名称:halflife,代码行数:41,代码来源:vgui_discobjects.cpp
示例11: UserCmd_NextWeapon
// Selects the next item in the weapon menu
void CHudAmmo::UserCmd_NextWeapon( void )
{
if( gHUD.m_fPlayerDead || ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )))
return;
if( !gpActiveSel || gpActiveSel == (WEAPON *)1 )
gpActiveSel = m_pWeapon;
int pos = 0;
int slot = 0;
if( gpActiveSel )
{
pos = gpActiveSel->iSlotPos + 1;
slot = gpActiveSel->iSlot;
}
for( int loop = 0; loop <= 1; loop++ )
{
for( ; slot < MAX_WEAPON_SLOTS; slot++ )
{
for( ; pos < MAX_WEAPON_POSITIONS; pos++ )
{
WEAPON *wsp = gWR.GetWeaponSlot( slot, pos );
if( wsp && gWR.HasAmmo( wsp ))
{
gpActiveSel = wsp;
return;
}
}
pos = 0;
}
slot = 0; // start looking from the first slot again
}
gpActiveSel = NULL;
}
开发者ID:ptitSeb,项目名称:XashXT,代码行数:41,代码来源:ammo.cpp
示例12: UserCmd_PrevWeapon
// Selects the previous item in the menu
void CHudAmmo::UserCmd_PrevWeapon( void )
{
if( gHUD.m_fPlayerDead || ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )))
return;
if( !gpActiveSel || gpActiveSel == (WEAPON *)1 )
gpActiveSel = m_pWeapon;
int pos = MAX_WEAPON_POSITIONS - 1;
int slot = MAX_WEAPON_SLOTS - 1;
if( gpActiveSel )
{
pos = gpActiveSel->iSlotPos - 1;
slot = gpActiveSel->iSlot;
}
for( int loop = 0; loop <= 1; loop++ )
{
for( ; slot >= 0; slot-- )
{
for( ; pos >= 0; pos-- )
{
WEAPON *wsp = gWR.GetWeaponSlot( slot, pos );
if( wsp && gWR.HasAmmo( wsp ))
{
gpActiveSel = wsp;
return;
}
}
pos = MAX_WEAPON_POSITIONS - 1;
}
slot = MAX_WEAPON_SLOTS - 1;
}
gpActiveSel = NULL;
}
开发者ID:ptitSeb,项目名称:XashXT,代码行数:41,代码来源:ammo.cpp
示例13: MsgFunc_CurWeapon
//
// CurWeapon: Update hud state with the current weapon and clip count. Ammo
// counts are updated with AmmoX. Server assures that the Weapon ammo type
// numbers match a real ammo type.
//
int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf)
{
static wrect_t nullrc;
int fOnTarget = FALSE;
BEGIN_READ(pbuf, iSize);
int iState = READ_BYTE();
int iId = READ_BYTE();
int iClip = READ_CHAR();
// detect if we're also on target
if(iState > 1)
{
fOnTarget = TRUE;
}
if(iId < 1)
{
SetCrosshair(0, nullrc, 0, 0, 0);
return 0;
}
// Is player dead???
if((iId == -1) && (iClip == -1))
{
gHUD.m_fPlayerDead = TRUE;
gpActiveSel = NULL;
return 1;
}
gHUD.m_fPlayerDead = FALSE;
WEAPON *pWeapon = gWR.GetWeapon(iId);
if(!pWeapon)
return 0;
if(iClip < -1)
pWeapon->iClip = abs(iClip);
else
pWeapon->iClip = iClip;
if(iState == 0) // we're not the current weapon, so update no more
return 1;
m_pWeapon = pWeapon;
m_fFade = 200.0f; //!!!
m_iFlags |= HUD_ACTIVE;
return 1;
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:57,代码来源:ammo.cpp
示例14: Reset
void CHudAmmo::Reset(void)
{
m_fFade = 0;
m_iFlags |= HUD_ACTIVE; //!!!
gpActiveSel = NULL;
gHUD.m_iHideHUDDisplay = 0;
gWR.Reset();
gHR.Reset();
// VidInit();
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:13,代码来源:ammo.cpp
示例15: Reset
void CHudAmmo::Reset( void )
{
m_fFade = 0;
m_iFlags |= HUD_ACTIVE; //!!!
gpActiveSel = NULL;
gHUD.m_iHideHUDDisplay = 0;
gWR.Reset();
gHR.Reset();
SetCrosshair( 0, nullRc, 0, 0, 0 ); // reset crosshair
m_pWeapon = NULL; // reset last weapon
}
开发者ID:ptitSeb,项目名称:XashXT,代码行数:14,代码来源:ammo.cpp
示例16: Reset
void CHudAmmo::Reset(void)
{
m_fFade = 0;
m_iFlags |= HUD_ACTIVE; //!!!
m_pWeapon = NULL; // Vit_amiN: reset the crosshair
gpActiveSel = NULL;
gHUD.m_iHideHUDDisplay = 0;
gWR.Reset();
gHR.Reset();
// VidInit();
}
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:15,代码来源:ammo.cpp
示例17: Reset
void CHudAmmo::Reset(void)
{
m_fFade = 0;
m_iFlags |= HUD_ACTIVE; //!!!
gpActiveSel = NULL;
gHUD.m_iHideHUDDisplay = 0;
// Added by Pcjoe
m_blSliding = false;
m_blSlideIn = false;
m_blPrevStatus = false;
m_flSlideTime = 0;
m_flLastSelect = 0;
gWR.Reset();
gHR.Reset();
}
开发者ID:vermagav,项目名称:mechmod,代码行数:17,代码来源:ammo.cpp
示例18: Init
int CHudAmmo::Init( void )
{
gHUD.AddHudElem( this );
HOOK_MESSAGE( CurWeapon );
HOOK_MESSAGE( WeaponList );
HOOK_MESSAGE( AmmoPickup );
HOOK_MESSAGE( WeapPickup );
HOOK_MESSAGE( ItemPickup );
HOOK_MESSAGE( HideWeapon );
HOOK_MESSAGE( AmmoX );
HOOK_COMMAND( "slot1", Slot1 );
HOOK_COMMAND( "slot2", Slot2 );
HOOK_COMMAND( "slot3", Slot3 );
HOOK_COMMAND( "slot4", Slot4 );
HOOK_COMMAND( "slot5", Slot5 );
HOOK_COMMAND( "slot6", Slot6 );
HOOK_COMMAND( "slot7", Slot7 );
HOOK_COMMAND( "slot8", Slot8 );
HOOK_COMMAND( "slot9", Slot9 );
HOOK_COMMAND( "slot10", Slot10 );
HOOK_COMMAND( "cancelselect", Close );
HOOK_COMMAND( "invnext", NextWeapon );
HOOK_COMMAND( "invprev", PrevWeapon );
Reset();
CVAR_REGISTER( "hud_drawhistory_time", HISTORY_DRAW_TIME, 0 );
// controls whether or not weapons can be selected in one keypress
CVAR_REGISTER( "hud_fastswitch", "0", FCVAR_ARCHIVE );
m_iFlags |= HUD_ACTIVE; //!!!
gWR.Init();
gHR.Init();
return 1;
}
开发者ID:ptitSeb,项目名称:XashXT,代码行数:40,代码来源:ammo.cpp
示例19: 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);
}
//.........这里部分代码省略.........
开发者ID:Fograin,项目名称:hl-subsmod-ex,代码行数:101,代码来源:ammo.cpp
示例20:
void CHudAmmo::UserCmd_Slot10(void)
{
gWR.SelectSlot(9, FALSE, 1);
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:4,代码来源:ammo.cpp
注:本文中的WeaponsResource类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论