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; }
/* * 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); }
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 ); } } }
/* * ATIMach64SetupForSolidLine -- * * This function sets up the draw engine for a series of solid lines. It is * not used for 24bpp because the engine doesn't support it. */ static void ATIMach64SetupForSolidLine ( 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); ATIMach64ValidateClip(pATI, pATI->NewHW.sc_left, pATI->NewHW.sc_right, pATI->NewHW.sc_top, pATI->NewHW.sc_bottom); }
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() ); }
/* * ATIMach64SetupForScreenToScreenCopy -- * * This function sets up the draw engine for a series of screen-to-screen copy * operations. */ static void ATIMach64SetupForScreenToScreenCopy ( ScrnInfoPtr pScreenInfo, int xdir, int ydir, int rop, unsigned int planemask, int TransparencyColour ) { ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRISync(pScreenInfo); ATIMach64WaitForFIFO(pATI, 3); outf(DP_WRITE_MASK, planemask); outf(DP_SRC, DP_MONO_SRC_ALLONES | SetBits(SRC_BLIT, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); #ifdef AVOID_DGA if (TransparencyColour == -1) #else /* AVOID_DGA */ if (!pATI->XAAForceTransBlit && (TransparencyColour == -1)) #endif /* AVOID_DGA */ { outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); } else { ATIMach64WaitForFIFO(pATI, 2); outf(CLR_CMP_CLR, TransparencyColour); outf(CLR_CMP_CNTL, CLR_CMP_FN_EQUAL | CLR_CMP_SRC_2D); } pATI->dst_cntl = 0; if (ydir > 0) pATI->dst_cntl |= DST_Y_DIR; if (xdir > 0) pATI->dst_cntl |= DST_X_DIR; if (pATI->XModifier == 1) outf(DST_CNTL, pATI->dst_cntl); else pATI->dst_cntl |= DST_24_ROT_EN; }
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; }
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; }
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); }
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); }
/* * ATIMach64SubsequentMono8x8PatternFillRect -- * * This function performs an 8x8 1bpp pattern fill. */ static void ATIMach64SubsequentMono8x8PatternFillRect ( ScrnInfoPtr pScreenInfo, int patx, int paty, int x, int y, int w, int h ) { ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRISync(pScreenInfo); if (pATI->XModifier != 1) { x *= pATI->XModifier; w *= pATI->XModifier; outf(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) | (DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN)); } /* Disable clipping if it gets in the way */ ATIMach64ValidateClip(pATI, x, x + w - 1, y, y + h - 1); ATIMach64WaitForFIFO(pATI, 2); outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); }
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); }
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; }
//========================================================= // 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; }
//========================================================= // 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; }
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; } }
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 ); }
/** 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); } }
//========================================================= // IdleHello // Try to greet player first time he's seen //========================================================= int CMTalkMonster :: FIdleHello( void ) { if (!FOkToSpeak()) return FALSE; // if this is first time scientist has seen player, greet him if (!FBitSet(m_bitsSaid, bit_saidHelloPlayer)) { // get a player edict_t *pPlayer = FindNearestFriend(TRUE); if (pPlayer) { if (UTIL_FInViewCone(pPlayer, this->edict(), m_flFieldOfView) && UTIL_FVisible(pPlayer, this->edict())) { m_hTalkTarget = pPlayer; if (FBitSet(pev->spawnflags, 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; }
void CMultiSource :: Spawn() { // set up think for later registration SetBits( pev->spawnflags, SF_MULTI_INIT ); // until it's initialized SetThink( &CMultiSource::Register ); SetNextThink( 0.1 ); }
void CTalkMonster :: FollowerUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { // Don't allow use during a scripted_sentence if ( m_useTime > gpGlobals->time ) return; if ( pCaller != NULL && pCaller->IsPlayer() ) { // Pre-disaster followers can't be used if ( GetSpawnFlags().Any( SF_MONSTER_PREDISASTER ) ) { DeclineFollowing(); } else if ( CanFollow() ) { LimitFollowers( pCaller , 1 ); if ( m_afMemory & bits_MEMORY_PROVOKED ) ALERT( at_console, "I'm not following you, you evil person!\n" ); else { StartFollowing( pCaller ); SetBits(m_bitsSaid, bit_saidHelloPlayer); // Don't say hi after you've started following } } else { StopFollowing( true ); } } }
void CUSP::SecondaryAttack() { if( ShieldSecondaryFire( GUN_SHIELD_UP, GUN_SHIELD_DOWN ) ) { return; } int anim; if( FBitSet( m_fWeaponState, WEAPONSTATE_USP_SILENCED ) ) { ClearBits( m_fWeaponState, WEAPONSTATE_USP_SILENCED ); anim = USP_DETACH_SILENCER; } else { SetBits( m_fWeaponState, WEAPONSTATE_USP_SILENCED ); anim = USP_ADD_SILENCER; } SendWeaponAnim( anim, UseDecrement() ); strcpy( m_pPlayer->m_szAnimExtention, "onehanded" ); m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 3.0; m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 3.0; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0; }
void AvHPushableBuildable::SetConstructionComplete() { AvHBaseBuildable::SetConstructionComplete(); // if ( pev->spawnflags & SF_PUSH_BREAKABLE ) // AvHBaseBuildable::Spawn(); // else // Precache( ); //pev->movetype = MOVETYPE_PUSHSTEP; this->pev->movetype = MOVETYPE_TOSS; pev->solid = SOLID_BBOX; //SET_MODEL( ENT(pev), STRING(pev->model) ); SET_MODEL( ENT(pev), this->GetModelName()); Vector theMinSize, theMaxSize; AvHSHUGetSizeForTech(this->GetMessageID(), theMinSize, theMaxSize); UTIL_SetSize(this->pev, theMinSize, theMaxSize); if ( pev->friction > 399 ) pev->friction = 399; m_maxSpeed = 100;//400 - pev->friction; SetBits( pev->flags, FL_FLOAT ); pev->friction = 0; pev->origin.z += 1; // Pick up off of the floor UTIL_SetOrigin( pev, pev->origin ); // Multiply by area of the box's cross-section (assume 1000 units^3 standard volume) pev->skin = ( pev->skin * (pev->maxs.x - pev->mins.x) * (pev->maxs.y - pev->mins.y) ) * 0.0005; m_soundTime = 0; }
//LRC void UTIL_SetVelocity(CBaseEntity *pEnt, const Vector vecSet) { Vector vecNew; if (pEnt->m_pMoveWith) vecNew = vecSet + pEnt->m_pMoveWith->pev->velocity; else vecNew = vecSet; // ALERT(at_console,"SetV: %s is sent (%f,%f,%f) - goes from (%f,%f,%f) to (%f,%f,%f)\n", // STRING(pEnt->pev->targetname), vecSet.x, vecSet.y, vecSet.z, // pEnt->pev->velocity.x, pEnt->pev->velocity.y, pEnt->pev->velocity.z, // 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_SetMoveWithVelocity(pMoving, vecNew, MAX_MOVEWITH_DEPTH); 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, "SetVelocity: Infinite sibling list for MoveWith!\n"); break; } } } pEnt->pev->velocity = vecNew; }
/* * RebuildOFV * * Description: * This function will rebuild the overflow vector of the * specified dynamic count filter with a new counter size. * * Parameters: * dcf: [in/out] * The dynamic count filter whose overflow vector is * to be rebuilt. * counterSize: [in] * The new counter size of the overflow vector. * * Returns: * Nothing. * * Comments: * */ void RebuildOFV(DynamicCountFilter *dcf, unsigned counterSize) { if (counterSize == 0) /* delete OFV */ { free(dcf->OFV); dcf->OFV = NULL; } else if (counterSize == 1 && dcf->OFV_Counter_Size == 0) /* create OFV */ { dcf->OFV = (char *)calloc(dcf->Length / 8, 1); } else /* rebuild OFV */ { unsigned i, counter; char *newOFV = (char *)calloc(dcf->Length / 8 * counterSize, 1); for (i = 0; i < dcf->Length; i++) { counter = GetBits((unsigned *)dcf->OFV, i * dcf->OFV_Counter_Size, dcf->OFV_Counter_Size); if (counter > 0) SetBits((unsigned *)newOFV, i * counterSize, counterSize, counter); } free(dcf->OFV); dcf->OFV = newOFV; } dcf->OFV_Counter_Size = counterSize; }
bool AvHHive::StartSpawningForTeam(AvHTeamNumber inTeam, bool inForce) { bool theSuccess = false; if(this->SetSolid(inForce)) { this->pev->team = inTeam; this->pev->takedamage = DAMAGE_YES; this->pev->rendermode = kRenderNormal; this->pev->renderamt = 0; SetBits(pev->flags, FL_MONSTER); SetUpgradeMask(&this->pev->iuser4, MASK_BUILDABLE); this->mSpawning = true; this->pev->health = kBaseHealthPercentage*this->mBaseHealth; // Looping, growing animation this->pev->sequence = 0; this->pev->frame = 0; ResetSequenceInfo(); this->pev->nextthink = gpGlobals->time + kHiveAliveThinkInterval; SetThink(&AvHHive::HiveAliveThink); SetUse(&AvHHive::TeleportUse); theSuccess = true; } return theSuccess; }
void CBaseTurret::Spawn() { Precache( ); pev->nextthink = gpGlobals->time + 1; pev->movetype = MOVETYPE_FLY; pev->sequence = 0; pev->frame = 0; pev->solid = SOLID_SLIDEBOX; pev->takedamage = DAMAGE_AIM; SetBits (pev->flags, FL_MONSTER); SetUse( &CBaseTurret::TurretUse ); if (( pev->spawnflags & SF_MONSTER_TURRET_AUTOACTIVATE ) && !( pev->spawnflags & SF_MONSTER_TURRET_STARTINACTIVE )) { m_iAutoStart = TRUE; } ResetSequenceInfo( ); SetBoneController( 0, 0 ); SetBoneController( 1, 0 ); m_flFieldOfView = VIEW_FIELD_FULL; // m_flSightRange = TURRET_RANGE; }
void CPushable :: Spawn( void ) { if ( pev->spawnflags & SF_PUSH_BREAKABLE ) CBreakable::Spawn(); else Precache( ); pev->movetype = MOVETYPE_PUSHSTEP; pev->solid = SOLID_BBOX; SET_MODEL( ENT(pev), STRING(pev->model) ); if ( pev->friction > 399 ) pev->friction = 399; m_maxSpeed = 400 - pev->friction; SetBits( pev->flags, FL_FLOAT ); pev->friction = 0; pev->origin.z += 1; // Pick up off of the floor UTIL_SetOrigin( pev, pev->origin ); // Multiply by area of the box's cross-section (assume 1000 units^3 standard volume) pev->skin = ( pev->skin * (pev->maxs.x - pev->mins.x) * (pev->maxs.y - pev->mins.y) ) * 0.0005; m_soundTime = 0; }
// // Train next - path corner needs to change to next target // void CFuncTrain::Next( void ) { CBaseEntity *pTarg; // now find our next target //TODO: this entity is supposed to work with path_corner only. Other entities will work, but will probably misbehave. - Solokiller //Check for classname and ignore others? pTarg = GetNextTarget(); if( !pTarg ) { if( pev->noiseMovement ) STOP_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ) ); // Play stop sound if( pev->noiseStopMoving ) EMIT_SOUND( this, CHAN_VOICE, ( char* ) STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM ); return; } // Save last target in case we need to find it again pev->message = pev->target; pev->target = pTarg->pev->target; m_flWait = pTarg->GetDelay(); if( m_pevCurrentTarget && m_pevCurrentTarget->speed != 0 ) {// don't copy speed from target if it is 0 (uninitialized) pev->speed = m_pevCurrentTarget->speed; ALERT( at_aiconsole, "Train %s speed to %4.2f\n", GetTargetname(), pev->speed ); } m_pevCurrentTarget = pTarg->pev;// keep track of this since path corners change our target for us. pev->enemy = pTarg->edict();//hack if( FBitSet( m_pevCurrentTarget->spawnflags, SF_CORNER_TELEPORT ) ) { // Path corner has indicated a teleport to the next corner. SetBits( pev->effects, EF_NOINTERP ); SetAbsOrigin( pTarg->GetAbsOrigin() - ( pev->mins + pev->maxs )* 0.5 ); Wait(); // Get on with doing the next path corner. } else { // Normal linear move. // CHANGED this from CHAN_VOICE to CHAN_STATIC around OEM beta time because trains should // use CHAN_STATIC for their movement sounds to prevent sound field problems. // this is not a hack or temporary fix, this is how things should be. (sjb). if( pev->noiseMovement ) { STOP_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ) ); EMIT_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ), m_volume, ATTN_NORM ); } ClearBits( pev->effects, EF_NOINTERP ); SetMoveDone( &CFuncTrain::Wait ); LinearMove( pTarg->GetAbsOrigin() - ( pev->mins + pev->maxs )* 0.5, pev->speed ); } }
// Drop bombs from above void CFuncMortarField :: Spawn( void ) { pev->solid = SOLID_NOT; SET_MODEL(ENT(pev), STRING(pev->model)); // set size and link into world pev->movetype = MOVETYPE_NONE; SetBits( pev->effects, EF_NODRAW ); SetUse( &CFuncMortarField::FieldUse ); Precache(); }