コード例 #1
0
ファイル: turret.cpp プロジェクト: Arkshine/NS
void CBaseTurret::Retire(void)
{
	// make the turret level
	m_vecGoalAngles.x = 0;
	m_vecGoalAngles.y = m_flStartYaw;

	pev->nextthink = gpGlobals->time + 0.1;

	StudioFrameAdvance( );

	EyeOff( );

	if (!MoveTurret())
	{
		if (m_iSpin)
		{
			SpinDownCall();
		}
		else if (pev->sequence != TURRET_ANIM_RETIRE)
		{
			SetTurretAnim(TURRET_ANIM_RETIRE);
			EMIT_SOUND_DYN(ENT(pev), CHAN_BODY, this->GetDeploySound(), TURRET_MACHINE_VOLUME, ATTN_NORM, 0, 120);
			SUB_UseTargets( this, USE_OFF, 0 );
		}
		else if (m_fSequenceFinished) 
		{	
			m_iOn = 0;
			m_flLastSight = 0;
			SetTurretAnim(TURRET_ANIM_NONE);
			pev->maxs.z = m_iRetractHeight;
			pev->mins.z = -m_iRetractHeight;
			UTIL_SetSize(pev, pev->mins, pev->maxs);
			if (m_iAutoStart)
			{
				SetThink(&CBaseTurret::AutoSearchThink);		
				pev->nextthink = gpGlobals->time + .1;
			}
			else
				SetThink(&CBaseTurret::SUB_DoNothing);
		}
	}
	else
	{
		SetTurretAnim(TURRET_ANIM_SPIN);
	}
}
コード例 #2
0
ファイル: weapons.cpp プロジェクト: fmoraw/SpiritOfHalfLife
//=========================================================
// Materialize - make a CBasePlayerItem visible and tangible
//=========================================================
void CBasePlayerItem::Materialize( void )
{
	if ( pev->effects & EF_NODRAW )
	{
		// changing from invisible state to visible.
		EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "items/suitchargeok1.wav", 1, ATTN_NORM, 0, 150 );
		pev->effects &= ~EF_NODRAW;
		pev->effects |= EF_MUZZLEFLASH;
	}

	pev->solid = SOLID_TRIGGER;

	UTIL_SetOrigin( this, pev->origin );// link into world.
	SetTouch(&CBasePlayerItem::DefaultTouch);
	SetThink (NULL);

}
コード例 #3
0
ファイル: squeakgrenade.cpp プロジェクト: suXinjke/HalfPayne
BOOL CSqueak::Deploy( )
{
	// play hunt sound
	float flRndSound = RANDOM_FLOAT ( 0 , 1 );

#ifndef CLIENT_DLL
	EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, gameplayMods::snarkPenguins.isActive() ? RANDOM_SOUND_ARRAY( pPinguHuntSounds ) : RANDOM_SOUND_ARRAY_PAYNED_PAIN_MONSTER( pHuntSounds ), 1, ATTN_NORM, 0, 100 );
#endif // !CLIENT_DLL

	m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME;

	if ( gameplayMods::snarkPenguins.isActive() ) {
		return DefaultDeploy( "models/v_pingu.mdl", "models/p_squeak.mdl", SQUEAK_UP, "squeak" );
	} else {
		return DefaultDeploy( "models/v_squeak.mdl", "models/p_squeak.mdl", SQUEAK_UP, "squeak" );
	}
}
コード例 #4
0
BOOL CPython::Deploy( )
{
#ifdef CLIENT_DLL
	if ( bIsMultiplayer() )
#else
	if ( g_pGameRules->IsMultiplayer() )
#endif
	{
		// enable laser sight geometry.
		pev->body = 1;
	}
	else
	{
		pev->body = 0;
	}
	EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/weapon_deploy.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));
	return DefaultDeploy( "models/weapons/357/v_357.mdl", "models/weapons/357/p_357.mdl", PYTHON_DRAW, "python", UseDecrement(), pev->body );
}
コード例 #5
0
ファイル: turret.cpp プロジェクト: suXinjke/HalfPayne
void CTurret::SpinDownCall(void)
{
	if (m_iSpin)
	{
		SetTurretAnim( TURRET_ANIM_SPIN );
		if (pev->framerate == 1.0)
		{
			EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, "turret/tu_active2.wav", 0, 0, SND_STOP, 100);
			EMIT_SOUND(ENT(pev), CHAN_ITEM, "turret/tu_spindown.wav", TURRET_MACHINE_VOLUME, ATTN_NORM);
		}
		pev->framerate -= 0.02;
		if (pev->framerate <= 0)
		{
			pev->framerate = 0;
			m_iSpin = 0;
		}
	}
}
コード例 #6
0
ファイル: wpn_awp.cpp プロジェクト: johndrinkwater/CSSDK
void CAWP::SecondaryAttack()
{
    switch( m_pPlayer->m_iFOV )
    {
        case 90 : m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 40;
        case 40 : m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 10;
        case 10 : m_pPlayer->m_iFOV = m_pPlayer->pev->fov = 90;
    }
    
    /*! @todo: Implements this :
    if( TheBots )
        TheBots->OnEvent( EVENT_WEAPON_ZOOMED, m_pPlayer->pev, NULL ); */
    
    m_pPlayer->ResetMaxSpeed();

    EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/zoom.wav", VOL_NORM, 2.4, 0, ATTN_NORM );
    m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3;
}
コード例 #7
0
ファイル: gargantua.cpp プロジェクト: ET-NiK/amxxgroup
void CMGargantua::StompAttack( void )
{
	TraceResult trace;

	UTIL_MakeVectors( pev->angles );
	Vector vecStart = pev->origin + Vector(0,0,60) + 35 * gpGlobals->v_forward;
	Vector vecAim = ShootAtEnemy( vecStart );
	Vector vecEnd = (vecAim * 1024) + vecStart;

	UTIL_TraceLine( vecStart, vecEnd, ignore_monsters, edict(), &trace );
	CStomp::StompCreate( vecStart, trace.vecEndPos, 0 );
	UTIL_ScreenShake( pev->origin, 12.0, 100.0, 2.0, 1000 );
	EMIT_SOUND_DYN ( edict(), CHAN_WEAPON, pStompSounds[ RANDOM_LONG(0,ARRAYSIZE(pStompSounds)-1) ], 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG(-10,10) );

	UTIL_TraceLine( pev->origin, pev->origin - Vector(0,0,20), ignore_monsters, edict(), &trace );
	if ( trace.flFraction < 1.0 )
		UTIL_DecalTrace( &trace, DECAL_GARGSTOMP1 );
}
コード例 #8
0
ファイル: bmodels.cpp プロジェクト: XashDev/XashXT
void CFuncRotating :: RampPitchVol( void )
{
	// calc volume and pitch as % of maximum vol and pitch.
	float fpct = fabs( GetLocalAvelocity().Length() ) / m_flMaxSpeed;
	float fvol = bound( 0.0f, m_flVolume * fpct, 1.0f ); // slowdown volume ramps down to 0

	float fpitch = FANPITCHMIN + ( FANPITCHMAX - FANPITCHMIN ) * fpct;	
	
	int pitch = bound( 0, fpitch, 255 );

	if( pitch == PITCH_NORM )
	{
		pitch = PITCH_NORM - 1;
	}

	// change the fan's vol and pitch
	EMIT_SOUND_DYN( edict(), CHAN_STATIC, STRING( pev->noise3 ), fvol, m_flAttenuation, SND_CHANGE_PITCH|SND_CHANGE_VOL, pitch );

}
コード例 #9
0
ファイル: bmodels.cpp プロジェクト: Arkshine/ReGameDLL_CS
/* <1e8f9> ../cstrike/dlls/bmodels.cpp:540 */
void CFuncRotating::RampPitchVol(int fUp)
{
	Vector vecAVel = pev->avelocity;
	float_precision vecCur;
	float_precision vecFinal;
	float_precision fpct;
	float fvol;
	float fpitch;
	int pitch;

	// get current angular velocity
	vecCur = abs((int)(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z)));

	// get target angular velocity
	vecFinal = (pev->movedir.x != 0 ? pev->movedir.x : (pev->movedir.y != 0 ? pev->movedir.y : pev->movedir.z));
	vecFinal *= pev->speed;
	vecFinal = abs((int)vecFinal);

	// calc volume and pitch as % of final vol and pitch
	fpct = vecCur / vecFinal;

	//if (fUp)
	//{
	//	// spinup volume ramps up from 50% max vol
	//	fvol = m_flVolume * (0.5 + fpct/2.0);
	//}
	//else
	{
		// slowdown volume ramps down to 0
		fvol = m_flVolume * fpct;
	}

	fpitch = FANPITCHMIN + (FANPITCHMAX - FANPITCHMIN) * fpct;

	pitch = (int)fpitch;
	if (pitch == PITCH_NORM)
	{
		pitch = PITCH_NORM - 1;
	}

	// change the fan's vol and pitch
	EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning), fvol, m_flAttenuation, (SND_CHANGE_PITCH | SND_CHANGE_VOL), pitch);
}
コード例 #10
0
void CDisplacer::PrimaryAttack()
{
	int flags;
	flags = 0;

	if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < DISPLACER_PRIMARY_USAGE)
	{
		EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "buttons/button11.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
		m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
		return;
	}
	m_iSecondaryMode = TRUE;
	pev->nextthink = gpGlobals->time + 1.05;
	m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.05;
	SetThink( &CDisplacer::FireThink );

	m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.20;
	PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSpinDisplacer, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, m_iBeam, 0, m_iSecondaryMode); 
}
コード例 #11
0
ファイル: headcrab.cpp プロジェクト: FaucetDC/HLDC_SDK
void CHeadCrab :: StartTask ( Task_t *pTask )
{
	m_iTaskStatus = TASKSTATUS_RUNNING;

	switch ( pTask->iTask )
	{
	case TASK_RANGE_ATTACK1:
		{
			EMIT_SOUND_DYN( edict(), CHAN_WEAPON, pAttackSounds[0], GetSoundVolue(), ATTN_IDLE, 0, GetVoicePitch() );
			m_IdealActivity = ACT_RANGE_ATTACK1;
			SetTouch ( LeapTouch );
			break;
		}
	default:
		{
			CBaseMonster :: StartTask( pTask );
		}
	}
}
コード例 #12
0
ファイル: CShockBeam.cpp プロジェクト: swmpdg/HLEnhanced
void CShockBeam::Explode()
{
	const Contents contents = UTIL_PointContents( GetAbsOrigin() );

	if( m_pSprite )
	{
		UTIL_Remove( m_pSprite );
		m_pSprite = nullptr;
	}

	if( m_pBeam1 )
	{
		UTIL_Remove( m_pBeam1 );
		m_pBeam1 = nullptr;
	}

	if( m_pBeam2 )
	{
		UTIL_Remove( m_pBeam2 );
		m_pBeam2 = nullptr;
	}

	SetDamage( 40 );

	MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, GetAbsOrigin() );
	WRITE_BYTE( TE_DLIGHT );
	WRITE_COORD_VECTOR( GetAbsOrigin() );
	WRITE_BYTE( 8 );
	WRITE_BYTE( 0 );
	WRITE_BYTE( 253 );
	WRITE_BYTE( 253 );
	WRITE_BYTE( 5 );
	WRITE_BYTE( 10 );
	MESSAGE_END();

	SetOwner( nullptr );

	EMIT_SOUND_DYN(
		this, CHAN_WEAPON,
		"weapons/shock_impact.wav",
		UTIL_RandomFloat( 0.8, 0.9 ), ATTN_NORM, 0, PITCH_NORM );
}
コード例 #13
0
ファイル: wep_usas.cpp プロジェクト: JoelTroch/am_src_rebirth
BOOL CUsas::Deploy( )
{
#ifdef CLIENT_DLL
	if ( bIsMultiplayer() )
#else
	if ( g_pGameRules->IsMultiplayer() )
#endif
	{
		// enable laser sight geometry.
		pev->body = 3;
	}
	else
	{
		pev->body = 0;
	}

	EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/weapon_deploy.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));
	m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.1;
	return DefaultDeploy( "models/weapons/USAS/v_USAS.mdl", "models/weapons/USAS/p_USAS.mdl", USAS_DEPLOY, "xm4", UseDecrement(), pev->body );
}
コード例 #14
0
void CDiscwarPowerup::PowerupTouch(CBaseEntity *pOther)
{
	if(!pOther->IsPlayer())
		return;

	CBasePlayer *pPlayer = (CBasePlayer *)pOther;

	// Give the powerup to the player
	pPlayer->GivePowerup(m_iPowerupType);
	m_hPlayerIGaveTo = pPlayer;
	SetTouch(NULL);
	pev->effects |= EF_NODRAW;

	// Choose another powerup soon
	SetThink(&CDiscwarPowerup::ChoosePowerupThink);
	pev->nextthink = gpGlobals->time + DISC_POWERUP_RESPAWN_TIME;

	// Play the powerup sound
	EMIT_SOUND_DYN(pOther->edict(), CHAN_STATIC, "powerup.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0, 3));
}
コード例 #15
0
ファイル: wpn_m3.cpp プロジェクト: mittorn/csdm
void CM3::WeaponIdle( void )
{
	ResetEmptySound( );

	m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );

	if ( m_flPumpTime && m_flPumpTime < gpGlobals->time )
	{
		// play pumping sound
		EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/scock1.wav", 1, ATTN_NORM, 0, 95 + RANDOM_LONG(0,0x1f));
		m_flPumpTime = 0;
	}

	if (m_flTimeWeaponIdle <  UTIL_WeaponTimeBase() )
	{
		if (m_iClip == 0 && m_fInSpecialReload == 0 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
		{
			Reload( );
		}
		else if (m_fInSpecialReload != 0)
		{
			if (m_iClip != 8 && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType])
			{
				Reload( );
			}
			else
			{
				// reload debounce has timed out
				SendWeaponAnim( M3_AFTER_RELOAD );
				
				m_fInSpecialReload = 0;
				m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
			}
		}
		else
		{
			m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + (60.0/12.0);
			SendWeaponAnim( M3_IDLE1 );
		}
	}
}
コード例 #16
0
BOOL CAK74::Deploy( )
{
//	CVAR_SET_FLOAT( "in_reload", 1 );

	EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/weapon_deploy.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));

	m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.1;

	if (!FStringNull (v_model) )
	{
		m_pPlayer->pev->viewmodel = v_model;
//		m_pPlayer->pev->weaponmodel = p_model;
	
		SendWeaponAnim( AK_NMC_DEPLOY, 1, 0 );	
		return TRUE;
	}
	else
	{
		return DefaultDeploy( AK74_MODEL_1STPERSON, AK74_MODEL_3RDPERSON, AK_NMC_DEPLOY, "ar25" ); //"mp5"
	}		
}
コード例 #17
0
void CFuncRotating :: RampPitchVol (int fUp)
{
	float fvol;
	float fpitch;
	int pitch;
	float speedfactor = m_fCurSpeed/pev->speed;
	
	fvol = m_flVolume * speedfactor;	  // slowdown volume ramps down to 0

	fpitch = FANPITCHMIN + (FANPITCHMAX - FANPITCHMIN) * speedfactor;
	
	pitch = (int) fpitch;
	if (pitch == PITCH_NORM)
		pitch = PITCH_NORM-1;

	// change the fan's vol and pitch

	EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning), 
		fvol, m_flAttenuation, SND_CHANGE_PITCH | SND_CHANGE_VOL, pitch);

}
コード例 #18
0
ファイル: weapons.cpp プロジェクト: vermagav/mechmod
//=========================================================
// FallThink - Items that have just spawned run this think
// to catch them when they hit the ground. Once we're sure
// that the object is grounded, we change its solid type
// to trigger and set it in a large box that helps the
// player get it.
//=========================================================
void CBasePlayerItem::FallThink ( void )
{
	pev->nextthink = gpGlobals->time + 0.1;

	if ( pev->flags & FL_ONGROUND )
	{
		// clatter if we have an owner (i.e., dropped by someone)
		// don't clatter if the gun is waiting to respawn (if it's waiting, it is invisible!)
		if ( !FNullEnt( pev->owner ) )
		{
			int pitch = 95 + RANDOM_LONG(0,29);
			EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "items/weapondrop1.wav", 1, ATTN_NORM, 0, pitch);	
		}

		// lie flat
		pev->angles.x = 0;
		pev->angles.z = 0;

		Materialize(); 
	}
}
コード例 #19
0
void CNihilanthHVR :: ZapInit( CBaseEntity *pEnemy )
{
	pev->movetype = MOVETYPE_FLY;
	pev->solid = SOLID_BBOX;

	SET_MODEL(edict(), "sprites/nhth1.spr");

	pev->rendercolor.x = 255;
	pev->rendercolor.y = 255;
	pev->rendercolor.z = 255;
	pev->scale = 2.0;

	pev->velocity = (pEnemy->pev->origin - pev->origin).Normalize() * 200;

	m_hEnemy = pEnemy;
	SetThink( &CNihilanthHVR::ZapThink );
	SetTouch( &CNihilanthHVR::ZapTouch );
	pev->nextthink = gpGlobals->time + 0.1;

	EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0, 100 );
}
コード例 #20
0
ファイル: bmodels.cpp プロジェクト: Arkshine/ReGameDLL_CS
/* <1e9c3> ../cstrike/dlls/bmodels.cpp:615 */
void CFuncRotating::SpinDown(void)
{
	//rotational velocity
	Vector vecAVel;
	vec_t vecdir;

	pev->nextthink = pev->ltime + 0.1;

	//spin down slower than spinup
	pev->avelocity = pev->avelocity - (pev->movedir * (pev->speed * m_flFanFriction));

	// cache entity's rotational velocity
	vecAVel = pev->avelocity;

	if (pev->movedir.x != 0)
		vecdir = pev->movedir.x;
	else if (pev->movedir.y != 0)
		vecdir = pev->movedir.y;
	else
		vecdir = pev->movedir.z;

	// if we've met or exceeded target speed, set target speed and stop thinking
	// (note: must check for movedir > 0 or < 0)
	if (((vecdir > 0) && (vecAVel.x <= 0 && vecAVel.y <= 0 && vecAVel.z <= 0))
		|| ((vecdir < 0) && (vecAVel.x >= 0 && vecAVel.y >= 0 && vecAVel.z >= 0)))
	{
		// set speed in case we overshot
		pev->avelocity = g_vecZero;

		// stop sound, we're done
		EMIT_SOUND_DYN(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseRunning), 0, ATTN_NONE, SND_STOP, m_pitch);

		SetThink(&CFuncRotating::Rotate);
		Rotate();
	}
	else
	{
		RampPitchVol(FALSE);
	}
}
コード例 #21
0
ファイル: headcrab.cpp プロジェクト: FaucetDC/HLDC_SDK
//=========================================================
// LeapTouch - this is the headcrab's touch function when it
// is in the air
//=========================================================
void CHeadCrab :: LeapTouch ( CBaseEntity *pOther )
{
	if ( !pOther->pev->takedamage )
	{
		return;
	}

	if ( pOther->Classify() == Classify() )
	{
		return;
	}

	// Don't hit if back on ground
	if ( !FBitSet( pev->flags, FL_ONGROUND ) )
	{
		EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY(pBiteSounds), GetSoundVolue(), ATTN_IDLE, 0, GetVoicePitch() );
		
		pOther->TakeDamage( pev, pev, GetDamageAmount(), DMG_SLASH );
	}

	SetTouch( NULL );
}
コード例 #22
0
ファイル: CGargantua.cpp プロジェクト: oskarlh/HLEnhanced
void CGargantua::TraceAttack( const CTakeDamageInfo& info, Vector vecDir, TraceResult& tr )
{
	ALERT( at_aiconsole, "CGargantua::TraceAttack\n");

	if ( !IsAlive() )
	{
		CBaseMonster::TraceAttack( info, vecDir, tr );
		return;
	}

	CTakeDamageInfo newInfo = info;

	// UNDONE: Hit group specific damage?
	if ( newInfo.GetDamageTypes() & (GARG_DAMAGE|DMG_BLAST) )
	{
		if ( m_painSoundTime < gpGlobals->time )
		{
			EMIT_SOUND_DYN( this, CHAN_VOICE, pPainSounds[ RANDOM_LONG(0,ARRAYSIZE(pPainSounds)-1) ], 1.0, ATTN_GARG, 0, PITCH_NORM );
			m_painSoundTime = gpGlobals->time + RANDOM_FLOAT( 2.5, 4 );
		}
	}

	newInfo.GetMutableDamageTypes() &= GARG_DAMAGE;

	if ( newInfo.GetDamageTypes() == 0)
	{
		if ( GetDamageTime() != gpGlobals->time || (RANDOM_LONG(0,100) < 20) )
		{
			UTIL_Ricochet( tr.vecEndPos, RANDOM_FLOAT(0.5,1.5) );
			SetDamageTime( gpGlobals->time );
//			if ( RANDOM_LONG(0,100) < 25 )
//				EMIT_SOUND_DYN( this, CHAN_BODY, pRicSounds[ RANDOM_LONG(0,ARRAYSIZE(pRicSounds)-1) ], 1.0, ATTN_NORM, 0, PITCH_NORM );
		}
		newInfo.GetMutableDamage() = 0;
	}

	CBaseMonster::TraceAttack( newInfo, vecDir, tr );

}
コード例 #23
0
void CNihilanthHVR :: TeleportInit( CNihilanth *pOwner, CBaseEntity *pEnemy, CBaseEntity *pTarget, CBaseEntity *pTouch )
{
	pev->movetype = MOVETYPE_FLY;
	pev->solid = SOLID_BBOX;

	pev->rendercolor.x = 255;
	pev->rendercolor.y = 255;
	pev->rendercolor.z = 255;
	pev->velocity.z *= 0.2;

	SET_MODEL(edict(), "sprites/exit1.spr");

	m_pNihilanth = pOwner;
	m_hEnemy = pEnemy;
	m_hTargetEnt = pTarget;
	m_hTouch = pTouch;

	SetThink( &CNihilanthHVR::TeleportThink );
	SetTouch( &CNihilanthHVR::TeleportTouch );
	pev->nextthink = gpGlobals->time + 0.1;

	EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "x/x_teleattack1.wav", 1, 0.2, 0, 100 );
}
コード例 #24
0
ファイル: gargantua.cpp プロジェクト: ET-NiK/amxxgroup
void CMGargantua::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType )
{
	ALERT( at_aiconsole, "CMGargantua::TraceAttack\n");

	if ( !IsAlive() )
	{
		CMBaseMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType );
		return;
	}

	// UNDONE: Hit group specific damage?
	if ( bitsDamageType & (GARG_DAMAGE|DMG_BLAST) )
	{
		if ( m_painSoundTime < gpGlobals->time )
		{
			EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, pPainSounds[ RANDOM_LONG(0,ARRAYSIZE(pPainSounds)-1) ], 1.0, ATTN_GARG, 0, PITCH_NORM );
			m_painSoundTime = gpGlobals->time + RANDOM_FLOAT( 2.5, 4 );
		}
	}

	bitsDamageType &= GARG_DAMAGE;

	if ( bitsDamageType == 0)
	{
		if ( pev->dmgtime != gpGlobals->time || (RANDOM_LONG(0,100) < 20) )
		{
			UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT(0.5,1.5) );
			pev->dmgtime = gpGlobals->time;
//			if ( RANDOM_LONG(0,100) < 25 )
//				EMIT_SOUND_DYN( ENT(pev), CHAN_BODY, pRicSounds[ RANDOM_LONG(0,ARRAYSIZE(pRicSounds)-1) ], 1.0, ATTN_NORM, 0, PITCH_NORM );
		}
		flDamage = 0;
	}

	CMBaseMonster::TraceAttack( pevAttacker, flDamage, vecDir, ptr, bitsDamageType );

}
コード例 #25
0
void AvHCocoon::FireProjectiles(void)
{
#ifdef AVH_SERVER
	
	// Make sure we have enough points to shoot this thing
	AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(this->m_pPlayer);
	ASSERT(thePlayer);
	
	vec3_t theNewPoint = this->pev->origin;
	TraceResult	tr;
	
	// Do a traceline to see who to cocoon
	UTIL_MakeVectors(this->pev->angles);

	Vector theForwardDir = (gpGlobals->v_forward + gpGlobals->v_right + gpGlobals->v_up);
	UTIL_TraceLine(this->pev->origin + this->pev->view_ofs, this->pev->origin + this->pev->view_ofs + theForwardDir*128, dont_ignore_monsters, ENT(this->m_pPlayer->pev), &tr);
	if(tr.flFraction != 1.0)
	{
		CBaseEntity* theEntity = CBaseEntity::Instance(tr.pHit);
		if(theEntity)
		{
			AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theEntity);
			if(thePlayer /*&& (thePlayer->pev->team != this->pev->team)*/ && (thePlayer->GetRole() != ROLE_GESTATING) && (thePlayer->GetRole() != ROLE_COCOONED))
			{
				GetGameRules()->MarkDramaticEvent(kCocoonPriority, thePlayer, this->m_pPlayer);

				// Play successful cocoon sound!
				EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, kCocoonSound2, 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-3,3) );
				
				// Yes!
				thePlayer->StartCocooning();
			}
		}
	}
				
	#endif	
}
コード例 #26
0
ファイル: npc_ai.cpp プロジェクト: CCNHsK-Dev/SyPB
bool NPC::AttackAction(edict_t *entity, bool needSetSpeed)
{
	if (FNullEnt(entity) || !IsAlive(entity))
		return false;

	if (!IsOnAttackDistance(entity, m_attackDistance))
		return false;

	if (needSetSpeed)
		m_moveSpeed = 0.0f;

	if ((m_attackTime + m_attackDelayTime) <= gpGlobals->time)
	{
		TraceResult tr;
		UTIL_TraceLine(pev->origin, GetEntityOrigin(entity), ignore_monsters, GetEntity(), &tr);
		if (tr.pHit != entity && tr.flFraction < 1.0f)
			return false;

		g_npcAS |= ASC_ATTACK;
		m_attackTime = gpGlobals->time;
		m_changeActionTime = -1.0f;

		MakeVectors(pev->angles);
		float x = RANDOM_FLOAT(-0.5, 0.5) + RANDOM_FLOAT(-0.5, 0.5);
		float y = RANDOM_FLOAT(-0.5, 0.5) + RANDOM_FLOAT(-0.5, 0.5);
		Vector vecDir = gpGlobals->v_forward + x * 0.15 * gpGlobals->v_right + y * 0.15 * gpGlobals->v_up;

		TakeDamage(m_enemy, GetEntity(), m_attackDamage, 0, tr.vecEndPos, vecDir);

		if (strcmp(m_npcSound[NS_ATTACK], "null") != 0)
			EMIT_SOUND_DYN(GetEntity(), CHAN_WEAPON, m_npcSound[NS_ATTACK], VOL_NORM, ATTN_NORM, 0, 94);

		return true;
	}

	return false;
}
コード例 #27
0
BOOL CMP5::Deploy( )
{
//	m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.3; //delay before fire
	EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/weapon_deploy.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));
    
	if ( m_fDefaultAnim == SILENCER_OFF_FULLAUTO || m_fDefaultAnim == SILENCER_OFF_SEMI )
	{
		if (!FStringNull (v_model) )
		{
			m_pPlayer->pev->viewmodel = v_model;
//			m_pPlayer->pev->weaponmodel = p_model;
		
			SendWeaponAnim( A2_DEPLOY, 1, 0 );	
			return TRUE;
		}
		else
		return DefaultDeploy("models/weapons/MP5/v_MP5.mdl", "models/weapons/MP5/p_MP5.mdl", A2_DEPLOY, "mp5", 3.50f ); //"mp5a4", 3.50f );

	}
    else
	{
		if (!FStringNull (v_model) )
		{
			m_pPlayer->pev->viewmodel = v_model;
//			m_pPlayer->pev->weaponmodel = p_model;
		
			SendWeaponAnim( SD2_DEPLOY, 1, 0 );	
			return TRUE;
		}
		else
		return DefaultDeploy("models/weapons/MP5/v_MP5.mdl", "models/weapons/MP5/p_MP5_2.mdl", SD2_DEPLOY, "mp5", 3.50f );
	}

	 m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );

//	return DefaultDeploy("models/weapons/MP5/v_MP5.mdl", "models/weapons/MP5/p_MP5.mdl", A2_DEPLOY, "mp5a4" );
}
コード例 #28
0
//=========================================================
// Randomly decide what powerup to be
void CDiscwarPowerup::ChoosePowerupThink(void)
{
	int iPowerup   = RANDOM_LONG(0, NUM_POWERUPS - 1);
	m_iPowerupType = (1 << iPowerup);

	SET_MODEL(ENT(pev), szPowerupModels[iPowerup]);
	pev->effects &= ~EF_NODRAW;

	SetTouch(&CDiscwarPowerup::PowerupTouch);

	// Start Animating
	pev->sequence = 0;
	pev->frame    = 0;
	ResetSequenceInfo();

	SetThink(&CDiscwarPowerup::AnimateThink);
	pev->nextthink = gpGlobals->time + 0.1;

	pev->rendermode = kRenderTransAdd;
	pev->renderamt  = 150;

	// Play the powerup appear sound
	EMIT_SOUND_DYN(edict(), CHAN_STATIC, "pspawn.wav", 1.0, ATTN_NORM, 0, 98 + RANDOM_LONG(0, 3));
}
コード例 #29
0
//=========================================================
// PainSound
//=========================================================
void CScientist :: PainSound ( void )
{
	if (gpGlobals->time < m_painTime )
		return;
	
	m_painTime = gpGlobals->time + RANDOM_FLOAT(0.5, 0.75);
	if ( FClassnameIs(pev, "monster_rosenberg"))
		EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "rosenberg/ro_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch());
	else
	{
	switch (RANDOM_LONG(0,4))
		{
		case 0: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "scientist/sci_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
		case 1: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "scientist/sci_pain2.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
		case 2: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "scientist/sci_pain3.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
		case 3: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "scientist/sci_pain4.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
		case 4: EMIT_SOUND_DYN( ENT(pev), CHAN_VOICE, "scientist/sci_pain5.wav", 1, ATTN_NORM, 0, GetVoicePitch()); break;
		}
	}
}
コード例 #30
0
BOOL CSaw :: Deploy ( ) 
{ 
	EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/weapon_deploy.wav", RANDOM_FLOAT(0.95, 1.0), ATTN_NORM, 0, 93 + RANDOM_LONG(0,0xF));

	return DefaultDeploy("models/weapons/saw/v_saw.mdl", "models/weapons/saw/p_saw.mdl", M249_DRAW, "xm4", 3.50f );
}