コード例 #1
0
ファイル: mtf_hwguy.c プロジェクト: MrPnut/QHome
void W_FireBigAss ( )
{
	vec3_t dir, vtemp;

	if ( self->s.v.ammo_shells < 10 )
	{
		make_explosion ( );
//		G_sprint (self, 2, "Ammo chamber jammed!\n"); // I just don't like excess messages
		sound ( self, 1, "weapons/asscan4.wav", 1, 1 );
		stuffcmd ( self, "bf\n" );
		self->option4 = 0;
		return;
	}

	self->nojumptime = ( g_globalvars.time + 0.75 );		// stops the 10.30.98 20mm speed "bug"

	// "weapons/sgun1.wav" was the old sound, this is 11.11.04's sound
	sound( self, 1, "weapons/20mm.wav", 1, 1 );

	KickPlayer( -5, self );
	muzzleflash( );
	stuffcmd (self, "bf\n");
//	self.ammo_shells = (self.ammo_shells - 10);
//	self.currentammo = (self.ammo_shells - 10);
	//self->s.v.currentammo = self->s.v.ammo_shells - 10;
	self->s.v.ammo_shells = self->s.v.ammo_shells - 10;
	self->s.v.currentammo = self->s.v.ammo_shells;

	makevectors( self->s.v.v_angle );
	dir[0] = g_globalvars.v_forward[0];dir[1] = g_globalvars.v_forward[1];dir[2] = g_globalvars.v_forward[2];
	mtf_deathmsg( 46 );
	BigAssBullet( dir, 50 );
	EjectShell ( );

	//self->s.v.velocity = (self.velocity - (v_forward * 200));
	VectorScale( g_globalvars.v_forward, 200, vtemp );
	VectorSubtract( self->s.v.velocity, vtemp, vtemp );
	self->s.v.velocity[0] = vtemp[0];
	self->s.v.velocity[1] = vtemp[1];
	if ( vtemp[2] > 179.9 && self->s.v.button2 )
		vtemp[2] = vtemp[2] * 2.1;		// "fixes" 20mm jump when facing down
	self->s.v.velocity[2] = vtemp[2];

	if ( self->s.v.ammo_shells == 0 )
		self->s.v.ammo_shells = 1;
}
コード例 #2
0
//=========================================================
// Shoot
//=========================================================
void CNPC_HAssassin::Shoot ( void )
{
	Vector vForward, vRight, vUp;
	Vector vecShootOrigin;
	QAngle vAngles;

	if ( GetEnemy() == NULL)
	{
		return;
	}

	GetAttachment( "guntip", vecShootOrigin, vAngles );
	
	Vector vecShootDir = GetShootEnemyDir( vecShootOrigin );

	if (m_flLastShot + 2 < gpGlobals->curtime)
	{
		m_flDiviation = 0.10;
	}
	else
	{
		m_flDiviation -= 0.01;
		if (m_flDiviation < 0.02)
			m_flDiviation = 0.02;
	}
	m_flLastShot = gpGlobals->curtime;

	AngleVectors( GetAbsAngles(), &vForward, &vRight, &vUp );

	Vector	vecShellVelocity = vRight * random->RandomFloat(40,90) + vUp * random->RandomFloat(75,200) + vForward * random->RandomFloat(-40, 40);
	EjectShell( GetAbsOrigin() + vUp * 32 + vForward * 12, vecShellVelocity, GetAbsAngles().y, 0 ); 
	FireBullets( 1, vecShootOrigin, vecShootDir, Vector( m_flDiviation, m_flDiviation, m_flDiviation ), 2048, m_iAmmoType ); // shoot +-8 degrees

	//NDebugOverlay::Line( vecShootOrigin, vecShootOrigin + vecShootDir * 2048, 255, 0, 0, true, 2.0 );

	CPASAttenuationFilter filter( this );
	EmitSound( filter, entindex(), "HAssassin.Shot" );

	DoMuzzleFlash();

	VectorAngles( vecShootDir, vAngles );
	SetPoseParameter( "shoot", vecShootDir.x );

	m_cAmmoLoaded--;
}