Exemple #1
0
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 );
		}
	}
}
Exemple #2
0
void InitSensors( void )
{
    TWCR = 0;   // Force TWI off (AD4 & 5 share the TWI pins)

    // For DDRx pins, 1 = output, 0 = input.
    // For input pins, PORTx = 0 = pullup disabled
    //                 PORTx = 1 = pullup enabled 

    DDRC  = 0;  // All input pins
    PORTC = 0;  // All pullups off

    {
        // Setup the input pins on Port D

        uns8 pins = ( 1 <<  PgmSelect1  )
                  | ( 1 <<  PgmSelect2  )
                  | ( 1 <<  PgmSelect4  )
                  | ( 1 <<  BlackButton  );

        ClearBits( DDRD, pins );    // Configure inputs
        ClearBits( PORTD, pins );   // Disable pullups
    }
    ADC_Init( ADC_PRESCALAR_AUTO );

    // Delay for a short time to allow the ADC to initialize

    ms_spin( 1 );
}
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;
}
Exemple #4
0
void CRotButton::Spawn( void )
{
	Precache();

	// set the axis of rotation
	AxisDir( pev );

	// check for clockwise rotation
	if( FBitSet( pev->spawnflags, SF_ROTBUTTON_ROTATE_BACKWARDS ))
		pev->movedir = pev->movedir * -1;

	pev->movetype = MOVETYPE_PUSH;
	
	if( FBitSet( pev->spawnflags, SF_ROTBUTTON_PASSABLE ))
		pev->solid = SOLID_NOT;
	else pev->solid = SOLID_BSP;

	// shared code use this flag as BUTTON_DONTMOVE so we need to clear it here
	ClearBits( pev->spawnflags, SF_ROTBUTTON_PASSABLE );
	ClearBits( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF );
	ClearBits( pev->spawnflags, SF_BUTTON_DAMAGED_AT_LASER );

	SET_MODEL( edict(), GetModel() );
	
	if( pev->speed == 0 )
		pev->speed = 40;

	if( m_flWait == 0 )
		m_flWait = 1;

	if( pev->health > 0 )
	{
		pev->takedamage = DAMAGE_YES;
	}

	m_iState = STATE_OFF;
	m_vecAngle1 = GetLocalAngles();
	m_vecAngle2 = GetLocalAngles() + pev->movedir * m_flMoveDistance;

	ASSERTSZ( m_vecAngle1 != m_vecAngle2, "rotating button start/end positions are equal" );

	m_fStayPushed = (m_flWait == -1) ? TRUE : FALSE;
	m_fRotating = TRUE;

	// if the button is flagged for USE button activation only, take away it's touch function and add a use function
	if( !FBitSet( pev->spawnflags, SF_BUTTON_TOUCH_ONLY ))
	{
		SetTouch( NULL );
		SetUse( &CBaseButton::ButtonUse );
	}
	else
	{	
		// touchable button
		SetTouch( &CBaseButton::ButtonTouch );
	}

	UTIL_SetOrigin( this, GetLocalOrigin( ));
	m_pUserData = WorldPhysic->CreateKinematicBodyFromEntity( this );
}
Exemple #5
0
bool BitTest::test_ClearBits()
{
    int x = 3, y = 5;
    ClearBits(x,0,1);
    ClearBits(y,1,2);

    return (x == 0 & y == 1);
}
BOOL CSmokeGrenade::Deploy()
{
    m_flReleaseThrow = -1.0;
    m_flWeaponSpeed  = SMOKEGRENADE_PLAYER_SPEED;

    ClearBits( m_fWeaponState, WEAPONSTATE_SHIELD_DRAWN );
    ClearBits( m_pPlayer->m_fUserPrefs, USERPREFS_SHIELD_DRAWN );

    if( m_pPlayer->HasShield() )
        return DefaultDeploy( "models/shield/v_shield_smokegrenade.mdl", "models/shield/p_shield_smokegrenade.mdl", GRENADE_DRAW, "shieldgren", UseDecrement() );
    else
        return DefaultDeploy( "models/v_smokegrenade.mdl", "models/p_smokegrenade.mdl", SMOKEGRENADE_DEPLOY, "grenade", UseDecrement() );
}
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;
}
//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;
}
Exemple #9
0
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
void CHeadCrab :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
	switch( pEvent->event )
	{
		case HC_AE_JUMPATTACK:
		{
			ClearBits( pev->flags, FL_ONGROUND );

			UTIL_SetOrigin (pev, pev->origin + Vector ( 0 , 0 , 1) );// take him off ground so engine doesn't instantly reset onground 
			UTIL_MakeVectors ( pev->angles );

			Vector vecJumpDir;
			if (m_hEnemy != NULL)
			{
				float gravity = g_psv_gravity->value;
				if (gravity <= 1)
					gravity = 1;

				// How fast does the headcrab need to travel to reach that height given gravity?
				float height = (m_hEnemy->pev->origin.z + m_hEnemy->pev->view_ofs.z - pev->origin.z);
				if (height < 16)
					height = 16;
				float speed = sqrt( 2 * gravity * height );
				float time = speed / gravity;

				// Scale the sideways velocity to get there at the right time
				vecJumpDir = (m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs - pev->origin);
				vecJumpDir = vecJumpDir * ( 1.0 / time );

				// Speed to offset gravity at the desired height
				vecJumpDir.z = speed;

				// Don't jump too far/fast
				float distance = vecJumpDir.Length();
				
				if (distance > 650)
				{
					vecJumpDir = vecJumpDir * ( 650.0 / distance );
				}
			}
			else
			{
				// jump hop, don't care where
				vecJumpDir = Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, gpGlobals->v_up.z ) * 350;
			}

			int iSound = RANDOM_LONG(0,2);
			if ( iSound != 0 )
				EMIT_SOUND_DYN( edict(), CHAN_VOICE, pAttackSounds[iSound], GetSoundVolue(), ATTN_IDLE, 0, GetVoicePitch() );

			pev->velocity = vecJumpDir;
			m_flNextAttack = gpGlobals->time + 2;
		}
		break;

		default:
			CBaseMonster::HandleAnimEvent( pEvent );
			break;
	}
}
void CTriggerCamera::TurnOn( void )
{
	pev->dmgtime = gpGlobals->time;
	pev->armorvalue = pev->speed;
	pev->frags = 0;

	// copy over player information
	if ( pev->spawnflags & SF_CAMERA_PLAYER_POSITION )
	{
		UTIL_SetOrigin( this, m_hActivator->pev->origin + m_hActivator->pev->view_ofs );
		pev->angles.x = -m_hActivator->pev->angles.x;
		pev->angles.y = m_hActivator->pev->angles.y;
		pev->angles.z = 0;
		pev->velocity = m_hActivator->pev->velocity;
		ClearBits( pev->spawnflags, SF_CAMERA_PLAYER_POSITION );
	}
	
	// time-based camera
	if( m_flWait ) pev->teleport_time = gpGlobals->time + m_flWait;

	Move();
	UpdatePlayerView();
	m_iState = STATE_ON;
	SetNextThink( gpGlobals->frametime );
}
Exemple #11
0
void CLeech::Killed(entvars_t *pevAttacker, int iGib)
{
	Vector			vecSplatDir;
	TraceResult		tr;

	//ALERT(at_aiconsole, "Leech: killed\n");
	// tell owner ( if any ) that we're dead.This is mostly for MonsterMaker functionality.
	CBaseEntity *pOwner = CBaseEntity::Instance(pev->owner);
	if (pOwner)
		pOwner->DeathNotice(pev);

	// When we hit the ground, play the "death_end" activity
	if ( pev->waterlevel )
	{
		pev->angles.z = 0;
		pev->angles.x = 0;
		pev->origin.z += 1;
		pev->avelocity = g_vecZero;
		if ( RANDOM_LONG( 0, 99 ) < 70 )
			pev->avelocity.y = RANDOM_LONG( -720, 720 );

		pev->gravity = 0.02;
		ClearBits(pev->flags, FL_ONGROUND);
		SetActivity( ACT_DIESIMPLE );
	}
	else
		SetActivity( ACT_DIEFORWARD );
	
	pev->movetype = MOVETYPE_TOSS;
	pev->takedamage = DAMAGE_NO;
	SetThink( &CLeech::DeadThink );
}
/**
  Clear corresponding bits in bitmap table according to given memory range.

  @param[in]  Address       Memory address to unset from.
  @param[in]  NumberOfPages Number of pages to unset guard.

  @return VOID
**/
VOID
EFIAPI
ClearGuardedMemoryBits (
  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;
    }

    ClearBits (Address, Bits, BitMap);

    NumberOfPages -= Bits;
    Address       += EFI_PAGES_TO_SIZE (Bits);
  }
}
Exemple #13
0
int CSentry::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
	if ( !pev->takedamage )
		return 0;

//	if (!m_iOn)
//	{
//		SetThink( Deploy );
//		SetUse( NULL );
//		pev->nextthink = gpGlobals->time + 0.1;
//	}

	pev->health -= flDamage;
	if (pev->health <= 0)
	{
		pev->health = 0;
		pev->takedamage = DAMAGE_NO;
		pev->dmgtime = gpGlobals->time;

		ClearBits (pev->flags, FL_MONSTER); // why are they set in the first place???

		SetUse(NULL);
		SetThink(&CSentry::SentryDeath);
		SUB_UseTargets( this, USE_ON, 0 ); // wake up others
		pev->nextthink = gpGlobals->time + 0.1;

		return 0;
	}

	return 1;
}
Exemple #14
0
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;
}
Exemple #15
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 );
	}
}
void CFlyingMonster :: Killed( entvars_t *pevAttacker, int iGib )
{
	pev->movetype = MOVETYPE_STEP;
	ClearBits( pev->flags, FL_ONGROUND );
	pev->angles.z = 0;
	pev->angles.x = 0;
	CBaseMonster::Killed( pevAttacker, iGib );
}
Exemple #17
0
BOOL CUSP::Deploy()
{
    m_flAccuracy    = USP_MAX_INACCURACY;
    m_flWeaponSpeed = USP_PLAYER_SPEED;

    ClearBits( m_fWeaponState, WEAPONSTATE_SHIELD_DRAWN );
    ClearBits( m_pPlayer->m_fUserPrefs, USERPREFS_SHIELD_DRAWN );

    if( m_pPlayer->HasShield() )
    {
        return DefaultDeploy( "models/shield/v_shield_usp.mdl", "models/shield/p_shield_usp.mdl", GUN_RELOAD, "shieldgun", UseDecrement() );
    }
    else
    {
        int animDraw = FBitSet( m_fWeaponState, WEAPONSTATE_USP_SILENCED ) ? USP_DRAW : USP_DRAW_UNSIL;
        return DefaultDeploy( "models/v_usp.mdl", "models/p_usp.mdl", animDraw, "onehanded", UseDecrement() );
    }
}
Exemple #18
0
//	Note:  .Cut support has not been tested yet!
// A .cut can only have 1 bpp.
//	We need to add support for the .pal's PSP outputs with these...
ILboolean iLoadCutInternal()
{
	CUT_HEAD	Header;
	ILuint		Size, i = 0, j;
	ILubyte		Count, Run;

	if (iCurImage == NULL) {
		ilSetError(IL_ILLEGAL_OPERATION);
		return IL_FALSE;
	}

	Header.Width = GetLittleShort();
	Header.Height = GetLittleShort();
	Header.Dummy = GetLittleInt();

	if (Header.Width == 0 || Header.Height == 0) {
		ilSetError(IL_INVALID_FILE_HEADER);
		return IL_FALSE;
	}

	if (!ilTexImage(Header.Width, Header.Height, 1, 1, IL_COLOUR_INDEX, IL_UNSIGNED_BYTE, NULL)) {  // always 1 bpp
		return IL_FALSE;
	}
	iCurImage->Origin = IL_ORIGIN_LOWER_LEFT;

	Size = Header.Width * Header.Height;

	while (i < Size) {
		Count = igetc();
		if (Count == 0) { // end of row
			igetc();  // Not supposed to be here, but
			igetc();  //  PSP is putting these two bytes here...WHY?!
			continue;
		}
		if (Count & BIT_7) {  // rle-compressed
			ClearBits(Count, BIT_7);
			Run = igetc();
			for (j = 0; j < Count; j++) {
				iCurImage->Data[i++] = Run;
			}
		}
		else {  // run of pixels
			for (j = 0; j < Count; j++) {
				iCurImage->Data[i++] = igetc();
			}
		}
	}

	iCurImage->Origin = IL_ORIGIN_UPPER_LEFT;  // Not sure

	/*iCurImage->Pal.Palette = SharedPal.Palette;
	iCurImage->Pal.PalSize = SharedPal.PalSize;
	iCurImage->Pal.PalType = SharedPal.PalType;*/

	return ilFixImage();
}
Exemple #19
0
void EnableRightEye( int enable )
{
    if ( enable )
    {
        SetBits( PORTD, ( 1 <<  RightEyeEnable ) );
    }
    else
    {
        ClearBits( PORTD, ( 1 <<  RightEyeEnable ) );
    }
}
void CSmokeGrenade::Holster()
{
    m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;

    if( !m_pPlayer->m_rgAmmo[ m_iPrimaryAmmoType ] )
    {
        ClearBits( m_pPlayer->pev->weapons, 1 << WEAPON_SMOKEGRENADE );
        DestroyItem();
    }

    m_flStartThrow   = 0;
    m_flReleaseThrow = -1.0;
}
Exemple #21
0
void CUSP::Spawn()
{
    Precache();
    m_iId = WEAPON_USP;

    SET_MODEL( ENT( pev ), "models/w_usp.mdl" );

    m_flAccuracy   = USP_MAX_INACCURACY;
    m_iDefaultAmmo = USP_DEFAULT_GIVE;

    ClearBits( m_fWeaponState, WEAPONSTATE_SHIELD_DRAWN );

    FallInit();
}
Exemple #22
0
BOOL CSmokeGrenade::Deploy( void )
{
    ClearBits( m_iWeaponState, WPNSTATE_SHIELD_DRAWN );

    m_flReleaseThrow = -1;
    m_fMaxSpeed      = SMOKEGRENADE_MAX_SPEED;

    m_pPlayer->m_bShieldDrawn = false;

    if( m_pPlayer->HasShield() )
        return DefaultDeploy( "models/shield/v_shield_smokegrenade.mdl", "models/shield/p_shield_smokegrenade.mdl", SMOKEGRENADE_DRAW, "shieldgren", UseDecrement() != FALSE );
    else
        return DefaultDeploy( "models/v_smokegrenade.mdl", "models/p_smokegrenade.mdl", SMOKEGRENADE_DRAW, "grenade", UseDecrement() != FALSE );
}
Exemple #23
0
BOOL CDEAGLE::Deploy( void )
{
    m_flAccuracy    = 0.9;
    m_fMaxSpeed     = DEAGLE_MAX_SPEED;

    ClearBits( m_iWeaponState, WPNSTATE_SHIELD_DRAWN );

    m_pPlayer->m_bShieldDrawn = false;

    if( m_pPlayer->HasShield() )
        return DefaultDeploy( "models/shield/v_shield_deagle.mdl", "models/shield/p_shield_deagle.mdl", DEAGLE_DRAW, "shieldgun", UseDecrement() != FALSE );
    else
        return DefaultDeploy( "models/v_deagle.mdl", "models/p_deagle.mdl", DEAGLE_DRAW, "onehanded", UseDecrement() != FALSE );
}
Exemple #24
0
BOOL CFiveSeven::Deploy( void )
{
    m_flAccuracy = 0.92;
    m_fMaxSpeed  = FIVESEVEN_MAX_SPEED;

    ClearBits( m_iWeaponState, WPNSTATE_SHIELD_DRAWN );

    m_pPlayer->m_bShieldDrawn = false;

    if( m_pPlayer->HasShield() )
        return DefaultDeploy( "models/shield/v_shield_fiveseven.mdl", "models/shield/p_shield_fiveseven.mdl", FIVESEVEN_DRAW, "shieldgun", UseDecrement() != FALSE );
    else
        return DefaultDeploy( "models/v_fiveseven.mdl", "models/p_fiveseven.mdl", FIVESEVEN_DRAW, "onehanded", UseDecrement() != FALSE );
}
Exemple #25
0
void CFamas::SecondaryAttack()
{
    if( FBitSet( m_fWeaponState, WEAPONSTATE_FAMAS_BURST_MODE ) )
    {
        ClientPrint( m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_FullAuto" );
        ClearBits( m_fWeaponState, WEAPONSTATE_FAMAS_BURST_MODE );
    }
    else
    {
        ClientPrint( m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_BurstFire" );
        SetBits( m_fWeaponState, WEAPONSTATE_FAMAS_BURST_MODE );
    }

    m_flNextSecondaryAttack = gpGlobals->time + 0.3;
}
Exemple #26
0
void CP228::Spawn(void)
{
	pev->classname = MAKE_STRING("weapon_p228");

	Precache();
	m_iId = WEAPON_P228;
	SET_MODEL(ENT(pev), "models/w_p228.mdl");

	ClearBits(m_iWeaponState, WPNSTATE_SHIELD_DRAWN);

	m_iDefaultAmmo = P228_DEFAULT_GIVE;
	m_flAccuracy   = 0.9;

	FallInit();
}
Exemple #27
0
void CFiveSeven::Spawn( void )
{
    pev->classname = MAKE_STRING( "weapon_fiveseven" );

    Precache();
    m_iId = WEAPON_FIVESEVEN;
    SET_MODEL( edict(), "models/w_fiveseven.mdl" );

    m_iDefaultAmmo = FIVESEVEN_DEFAULT_GIVE;
    m_flAccuracy   = 0.92;

    ClearBits( m_iWeaponState, WPNSTATE_SHIELD_DRAWN );

    FallInit();
}
void CSmokeGrenade::Spawn()
{
    Precache();
    m_iId = WEAPON_SMOKEGRENADE;

    SET_MODEL( ENT( pev ), "models/w_smokegrenade.mdl" );

    pev->dmg = 4.0;

    m_iDefaultAmmo   = SMOKEGRENADE_DEFAULT_GIVE;
    m_flStartThrow   = 0;
    m_flReleaseThrow = -1.0;

    ClearBits( m_fWeaponState, WEAPONSTATE_SHIELD_DRAWN );

    FallInit();
}
Exemple #29
0
void CSmokeGrenade::Spawn( void )
{
    pev->classname = MAKE_STRING( "weapon_smokegrenade" );

    Precache();
    m_iId = WEAPON_SMOKEGRENADE;
    SET_MODEL( edict(), "models/w_smokegrenade.mdl" );

    pev->dmg = 4;

    ClearBits( m_iWeaponState, WPNSTATE_SHIELD_DRAWN );

    m_iDefaultAmmo   = SMOKEGRENADE_DEFAULT_GIVE;
    m_flStartThrow   = 0;
    m_flReleaseThrow = -1;

    FallInit();
}
Exemple #30
0
// try to smell something
void CTalkMonster :: TrySmellTalk( void )
{
	if ( !FOkToSpeak() )
		return;

	// clear smell bits periodically
	if ( gpGlobals->time > m_flLastSaidSmelled  )
	{
//		ALERT ( at_aiconsole, "Clear smell bits\n" );
		ClearBits(m_bitsSaid, bit_saidSmelled);
	}
	// smelled something?
	if (!FBitSet(m_bitsSaid, bit_saidSmelled) && HasConditions ( bits_COND_SMELL ))
	{
		PlaySentence( m_szGrp[TLK_SMELL], RANDOM_FLOAT(2.8, 3.2), VOL_NORM, ATTN_IDLE );
		m_flLastSaidSmelled = gpGlobals->time + 60;// don't talk about the stinky for a while.
		SetBits(m_bitsSaid, bit_saidSmelled);
	}
}