本文整理汇总了C++中SetBits函数的典型用法代码示例。如果您正苦于以下问题:C++ SetBits函数的具体用法?C++ SetBits怎么用?C++ SetBits使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetBits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClearBits
void CSmokeGrenade::ShieldSecondaryFire( int animUp, int animDown )
{
if( !m_pPlayer->HasShield() || m_flStartThrow )
{
return;
}
if( FBitSet( m_fWeaponState, WEAPONSTATE_SHIELD_DRAWN ) )
{
ClearBits( m_fWeaponState, WEAPONSTATE_SHIELD_DRAWN );
ClearBits( m_pPlayer->m_fUserPrefs, USERPREFS_SHIELD_DRAWN );
SendWeaponAnim( animDown, UseDecrement() );
strcpy( m_pPlayer->m_szAnimExtention, "shieldgren" );
m_flWeaponSpeed = 250.0;
}
else
{
SetBits( m_fWeaponState, WEAPONSTATE_SHIELD_DRAWN );
SetBits( m_pPlayer->m_fUserPrefs, USERPREFS_SHIELD_DRAWN );
SendWeaponAnim( animUp, UseDecrement() );
strcpy( m_pPlayer->m_szAnimExtention, "shielded" );
m_flWeaponSpeed = 180.0;
}
m_pPlayer->UpdateShieldCrosshair( ~m_fWeaponState & WEAPONSTATE_SHIELD_DRAWN );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.4;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.4;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;
}
示例2: ATIPTR
/*
* ATIMach64SetupForSolidFill --
*
* This function sets up the draw engine for a series of solid fills.
*/
static void
ATIMach64SetupForSolidFill
(
ScrnInfoPtr pScreenInfo,
int colour,
int rop,
unsigned int planemask
)
{
ATIPtr pATI = ATIPTR(pScreenInfo);
ATIDRISync(pScreenInfo);
ATIMach64WaitForFIFO(pATI, 5);
outf(DP_WRITE_MASK, planemask);
outf(DP_SRC, DP_MONO_SRC_ALLONES |
SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
outf(DP_FRGD_CLR, colour);
outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));
outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);
if (pATI->XModifier == 1)
outf(DST_CNTL, DST_X_DIR | DST_Y_DIR);
}
示例3: Use
void CPathTrack :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
int on;
// Use toggles between two paths
if ( m_paltpath )
{
on = !FBitSet( pev->spawnflags, SF_PATH_ALTERNATE );
if ( ShouldToggle( useType, on ) )
{
if ( on )
SetBits( pev->spawnflags, SF_PATH_ALTERNATE );
else
ClearBits( pev->spawnflags, SF_PATH_ALTERNATE );
}
}
else // Use toggles between enabled/disabled
{
on = !FBitSet( pev->spawnflags, SF_PATH_DISABLED );
if ( ShouldToggle( useType, on ) )
{
if ( on )
SetBits( pev->spawnflags, SF_PATH_DISABLED );
else
ClearBits( pev->spawnflags, SF_PATH_DISABLED );
}
}
}
示例4: Spawn
void CFuncMonsterClip :: Spawn( void )
{
pev->solid = SOLID_BSP;
pev->movetype = MOVETYPE_PUSH;
SetBits( pev->flags, FL_MONSTERCLIP );
SetBits( m_iFlags, MF_TRIGGER );
pev->effects |= EF_NODRAW;
// link into world
SET_MODEL( edict(), GetModel() );
}
示例5: SetBits
uint8_t Via::GetInterruptFlagValue() const {
uint8_t result = 0;
SetBits(result, InterruptFlag::CA1, m_ca1InterruptFlag);
SetBits(result, InterruptFlag::Shift, m_shiftRegister.InterruptFlag());
SetBits(result, InterruptFlag::Timer2, m_timer2.InterruptFlag());
SetBits(result, InterruptFlag::Timer1, m_timer1.InterruptFlag());
// Enable IRQ bit if any IFR bits (set above) are also enabled in IER
SetBits(result, InterruptFlag::IrqEnabled, ((result & m_interruptEnable) & 0x7F) != 0);
return result;
}
示例6: UninstDbgBreakfromThrd
DWORD
UninstDbgBreakfromThrd( DWORD dwThreadId, DWORD dwLineAddr, DWORD dwAccessType)
{
HANDLE hThread;
hThread = OpenThread( THREAD_SET_CONTEXT|THREAD_GET_CONTEXT|THREAD_SUSPEND_RESUME,
FALSE, dwThreadId );
if ( hThread == NULL )
return GetLastError();
if ( -1 == SuspendThread( hThread ))
return GetLastError();
CONTEXT cxt = {0};
cxt.ContextFlags = CONTEXT_DEBUG_REGISTERS|CONTEXT_FULL;
if (!GetThreadContext( hThread, &cxt ))
return GetLastError();
if (cxt.Dr0 == dwLineAddr)
{
if (dwAccessType == GetBits(cxt.Dr7, 16, 2))
{
SetBits(cxt.Dr7, DR7_L0, 1, 0);
}
}
if (cxt.Dr1 == dwLineAddr)
{
if (dwAccessType == GetBits(cxt.Dr7, 20, 2))
{
SetBits(cxt.Dr7, DR7_L1, 1, 0);
}
}
if (cxt.Dr2 == dwLineAddr)
{
if (dwAccessType == GetBits(cxt.Dr7, 24, 2))
{
SetBits(cxt.Dr7, DR7_L2, 1, 0);
}
}
if (cxt.Dr3 == dwLineAddr)
{
if (dwAccessType == GetBits(cxt.Dr7, 28, 2))
{
SetBits(cxt.Dr7, DR7_L3, 1, 0);
}
}
cxt.ContextFlags = CONTEXT_DEBUG_REGISTERS;
if(!SetThreadContext( hThread, &cxt ))
return GetLastError();
if(-1 == ResumeThread( hThread ))
return GetLastError();
return 0;
}
示例7: SetBits
void CBaseEntity::MakeDormant(void)
{
SetBits(pev->flags, FL_DORMANT);
// Don't touch
pev->solid = SOLID_NOT;
// Don't move
pev->movetype = MOVETYPE_NONE;
// Don't draw
SetBits(pev->effects, EF_NODRAW);
// Don't think
pev->nextthink = 0;
// Relink
UTIL_SetOrigin(pev, pev->origin);
}
示例8: assert
void HardwareBreakpoint::Set(void* address, int len, Condition when)
{
// make sure this breakpoint isn't already set
assert(m_index == -1);
CONTEXT cxt;
HANDLE thisThread = GetCurrentThread();
switch (len)
{
case 1: len = 0; break;
case 2: len = 1; break;
case 4: len = 3; break;
default: assert(false); // invalid length
}
// The only registers we care about are the debug registers
cxt.ContextFlags = CONTEXT_DEBUG_REGISTERS;
// Read the register values
if (!GetThreadContext(thisThread, &cxt))
assert(false);
// Find an available hardware register
for (m_index = 0; m_index < 4; ++m_index)
{
if ((cxt.Dr7 & (1 << (m_index*2))) == 0)
break;
}
assert(m_index < 4); // All hardware breakpoint registers are already being used
switch (m_index)
{
case 0: cxt.Dr0 = (DWORD) address; break;
case 1: cxt.Dr1 = (DWORD) address; break;
case 2: cxt.Dr2 = (DWORD) address; break;
case 3: cxt.Dr3 = (DWORD) address; break;
default: assert(false); // m_index has bogus value
}
SetBits(cxt.Dr7, 16 + (m_index*4), 2, when);
SetBits(cxt.Dr7, 18 + (m_index*4), 2, len);
SetBits(cxt.Dr7, m_index*2, 1, 1);
// Write out the new debug registers
if (!SetThreadContext(thisThread, &cxt))
assert(false);
}
示例9: MAKE_STRING
void AvHBaseBuildable::Materialize()
{
this->pev->solid = SOLID_BBOX;
this->pev->movetype = this->GetMoveType();
this->pev->classname = MAKE_STRING(this->mClassName);
this->pev->takedamage = DAMAGE_YES;
SetBits(this->pev->flags, FL_MONSTER);
// Always buildable
this->InternalInitializeBuildable();
this->SetNormalizedBuildPercentage(0.0f);
// NOTE: fuser2 is used for repairing structures
Vector theMinSize, theMaxSize;
//int theSequence = this->GetSequenceForBoundingBox();
// Get height needed for model
//this->ExtractBbox(theSequence, (float*)&theMinSize, (float*)&theMaxSize);
//float theHeight = theMaxSize.z - theMinSize.z;
AvHSHUGetSizeForTech(this->GetMessageID(), theMinSize, theMaxSize);
UTIL_SetSize(pev, theMinSize, theMaxSize);
this->PlayAnimationAtIndex(this->GetSpawnAnimation(), true);
SetUse(&AvHBaseBuildable::ConstructUse);
}
示例10: UTIL_SetAvelocity
void UTIL_SetAvelocity(CBaseEntity *pEnt, const Vector vecSet)
{
Vector vecNew;
if (pEnt->m_pMoveWith)
vecNew = vecSet + pEnt->m_pMoveWith->pev->avelocity;
else
vecNew = vecSet;
// ALERT(at_console, "Setting AVelocity %f %f %f\n", vecNew.x, vecNew.y, vecNew.z);
if (pEnt->m_pChildMoveWith)
{
CBaseEntity *pMoving = pEnt->m_pChildMoveWith;
int sloopbreaker = MAX_MOVEWITH_DEPTH; // LRC - to save us from infinite loops
while (pMoving)
{
UTIL_SetMoveWithAvelocity(pMoving, vecNew, MAX_MOVEWITH_DEPTH);
UTIL_MergePos(pMoving); //force to update
if (vecSet != g_vecZero)SetBits(pMoving->m_iLFlags, LF_PARENTMOVE);
else ClearBits(pMoving->m_iLFlags, LF_PARENTMOVE);
pMoving = pMoving->m_pSiblingMoveWith;
sloopbreaker--;
if (sloopbreaker <= 0)
{
ALERT(at_error, "SetAvelocity: Infinite sibling list for MoveWith!\n");
break;
}
}
}
pEnt->pev->avelocity = vecNew;
}
示例11: FindNearestFriend
//=========================================================
// IdleHello
// Try to greet player first time he's seen
//=========================================================
bool CTalkMonster::FIdleHello()
{
if (!FOkToSpeak())
return false;
// if this is first time scientist has seen player, greet him
if (!FBitSet(m_bitsSaid, bit_saidHelloPlayer))
{
// get a player
CBaseEntity *pPlayer = FindNearestFriend(true);
if (pPlayer)
{
if (FInViewCone(pPlayer) && FVisible(pPlayer))
{
m_hTalkTarget = pPlayer;
if ( GetSpawnFlags().Any( SF_MONSTER_PREDISASTER ) )
PlaySentence( m_szGrp[TLK_PHELLO], RANDOM_FLOAT(3, 3.5), VOL_NORM, ATTN_IDLE );
else
PlaySentence( m_szGrp[TLK_HELLO], RANDOM_FLOAT(3, 3.5), VOL_NORM, ATTN_IDLE );
SetBits(m_bitsSaid, bit_saidHelloPlayer);
return true;
}
}
}
return false;
}
示例12: Spawn
//=========================================================
// Spawn
//=========================================================
void CIchthyosaur :: Spawn()
{
Precache( );
SET_MODEL(ENT(pev), "models/icky.mdl");
UTIL_SetSize( pev, Vector( -32, -32, -32 ), Vector( 32, 32, 32 ) );
pev->solid = SOLID_BBOX;
pev->movetype = MOVETYPE_FLY;
m_bloodColor = BLOOD_COLOR_GREEN;
pev->health = gSkillData.ichthyosaurHealth;
pev->view_ofs = Vector ( 0, 0, 16 );
m_flFieldOfView = VIEW_FIELD_WIDE;
m_MonsterState = MONSTERSTATE_NONE;
SetBits(pev->flags, FL_SWIM);
SetFlyingSpeed( ICHTHYOSAUR_SPEED );
SetFlyingMomentum( 2.5 ); // Set momentum constant
m_afCapability = bits_CAP_RANGE_ATTACK1 | bits_CAP_SWIM;
MonsterInit();
SetTouch( BiteTouch );
SetUse( CombatUse );
m_idealDist = 384;
m_flMinSpeed = 80;
m_flMaxSpeed = 300;
m_flMaxDist = 384;
Vector Forward;
UTIL_MakeVectorsPrivate(pev->angles, Forward, 0, 0);
pev->velocity = m_flightSpeed * Forward.Normalize();
m_SaveVelocity = pev->velocity;
}
示例13: GetCurrentThread
void HardwareBreakpoint::Clear()
{
if (m_index != -1)
{
CONTEXT cxt;
HANDLE thisThread = GetCurrentThread();
// The only registers we care about are the debug registers
cxt.ContextFlags = CONTEXT_DEBUG_REGISTERS;
// Read the register values
if (!GetThreadContext(thisThread, &cxt))
assert(false);
// Zero out the debug register settings for this breakpoint
assert(m_index >= 0 && m_index < 4); // m_index has bogus value
SetBits(cxt.Dr7, m_index*2, 1, 0);
// Write out the new debug registers
if (!SetThreadContext(thisThread, &cxt))
assert(false);
m_index = -1;
}
}
示例14: Precache
void CLeech::Spawn( void )
{
Precache();
SET_MODEL(ENT(pev), "models/leech.mdl");
// Just for fun
// SET_MODEL(ENT(pev), "models/icky.mdl");
// UTIL_SetSize( pev, g_vecZero, g_vecZero );
UTIL_SetSize( pev, Vector(-1,-1,0), Vector(1,1,2));
// Don't push the minz down too much or the water check will fail because this entity is really point-sized
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_FLY;
SetBits(pev->flags, FL_SWIM);
pev->health = gSkillData.leechHealth;
m_flFieldOfView = -0.5; // 180 degree FOV
m_flDistLook = 750;
MonsterInit();
SetThink( &CLeech::SwimThink );
SetUse( NULL );
SetTouch( NULL );
pev->view_ofs = g_vecZero;
m_flTurning = 0;
m_fPathBlocked = FALSE;
SetActivity( ACT_SWIM );
SetState( MONSTERSTATE_IDLE );
m_stateTime = gpGlobals->time + RANDOM_FLOAT( 1, 5 );
}
示例15: SetGuardedMemoryBits
/**
Set corresponding bits in bitmap table to 1 according to given memory range.
@param[in] Address Memory address to guard from.
@param[in] NumberOfPages Number of pages to guard.
@return VOID
**/
VOID
EFIAPI
SetGuardedMemoryBits (
IN EFI_PHYSICAL_ADDRESS Address,
IN UINTN NumberOfPages
)
{
UINT64 *BitMap;
UINTN Bits;
UINTN BitsToUnitEnd;
while (NumberOfPages > 0) {
BitsToUnitEnd = FindGuardedMemoryMap (Address, TRUE, &BitMap);
ASSERT (BitMap != NULL);
if (NumberOfPages > BitsToUnitEnd) {
// Cross map unit
Bits = BitsToUnitEnd;
} else {
Bits = NumberOfPages;
}
SetBits (Address, Bits, BitMap);
NumberOfPages -= Bits;
Address += EFI_PAGES_TO_SIZE (Bits);
}
}