Esempio n. 1
0
/*
================
SpawnBlood
================
*/
void SpawnBlood( vec3_t org, float damage )
{
	trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
	trap_WriteByte( MSG_MULTICAST, TE_BLOOD );
	trap_WriteByte( MSG_MULTICAST, 1 );
	trap_WriteCoord( MSG_MULTICAST, org[0] );
	trap_WriteCoord( MSG_MULTICAST, org[1] );
	trap_WriteCoord( MSG_MULTICAST, org[2] );
	trap_multicast( PASSVEC3( org ), MULTICAST_PVS );
}
Esempio n. 2
0
void LightningHit( gedict_t * from, float damage )
{
	trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
	trap_WriteByte( MSG_MULTICAST, TE_LIGHTNINGBLOOD );
	trap_WriteCoord( MSG_MULTICAST, g_globalvars.trace_endpos[0] );
	trap_WriteCoord( MSG_MULTICAST, g_globalvars.trace_endpos[1] );
	trap_WriteCoord( MSG_MULTICAST, g_globalvars.trace_endpos[2] );
	trap_multicast( PASSVEC3( g_globalvars.trace_endpos ), MULTICAST_PVS );

	T_Damage( PROG_TO_EDICT( g_globalvars.trace_ent ), from, from, damage );
}
Esempio n. 3
0
//=========================================================================
// Ammo/Weapon exploded by the EMP grenade
void EMPExplode(  )
{
    float expsize;

    expsize = 10;
    if ( self->s.v.touch == ( func_t ) weapon_touch )
	expsize = 60;
    else
    {
	if ( streq( self->s.v.classname, "item_shells" ) )
	    expsize = 50 + self->aflag;
	else
	{
	    if ( streq( self->s.v.classname, "item_spikes" ) )
		expsize = 40;
	    else
	    {
		if ( streq( self->s.v.classname, "item_rockets" ) )
		    expsize = 100 + self->aflag * 4;
		else
		{
		    if ( streq( self->s.v.classname, "item_cells" ) )
			expsize = 100 + self->aflag * 3;
		    else
		    {
			if ( streq( self->s.v.classname, "item_weapon" ) )
			    expsize = 60;
			else
			{
			    G_dprintf( "EMPExplode: Attempting to explode a %s\n", self->s.v.classname );
			    return;
			}
		    }
		}
	    }
	}
    }
    tf_data.deathmsg = DMSG_GREN_EMP_AMMO;
    T_RadiusDamage( self, PROG_TO_EDICT( self->s.v.enemy ), expsize, world );
    trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
    trap_WriteByte( MSG_MULTICAST, TE_EXPLOSION );
    trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );
    trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );
    trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] );
    trap_multicast( PASSVEC3( self->s.v.origin ), 1 );

    // Respawn
    Respawn_Item( self, PROG_TO_EDICT( self->s.v.enemy ) );
}
Esempio n. 4
0
void Multi_Finish()
{
	if ( puff_count )
	{
		trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
		trap_WriteByte( MSG_MULTICAST, TE_GUNSHOT );
		trap_WriteByte( MSG_MULTICAST, puff_count );
		trap_WriteCoord( MSG_MULTICAST, puff_org[0] );
		trap_WriteCoord( MSG_MULTICAST, puff_org[1] );
		trap_WriteCoord( MSG_MULTICAST, puff_org[2] );
		trap_multicast( PASSVEC3( puff_org ), MULTICAST_PVS );
	}

	if ( blood_count )
	{
		trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
		trap_WriteByte( MSG_MULTICAST, TE_BLOOD );
		trap_WriteByte( MSG_MULTICAST, blood_count );
		trap_WriteCoord( MSG_MULTICAST, blood_org[0] );
		trap_WriteCoord( MSG_MULTICAST, blood_org[1] );
		trap_WriteCoord( MSG_MULTICAST, blood_org[2] );
		trap_multicast( PASSVEC3( puff_org ), MULTICAST_PVS );
	}
}
Esempio n. 5
0
void spawn_tfog( vec3_t org )
{
	s = spawn();
	VectorCopy( org, s->s.v.origin );
// s->s.v.origin = org;
	s->s.v.nextthink = g_globalvars.time + 0.2;
	s->s.v.think = ( func_t ) play_teleport;

	trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
	trap_WriteByte( MSG_MULTICAST, TE_TELEPORT );
	trap_WriteCoord( MSG_MULTICAST, org[0] );
	trap_WriteCoord( MSG_MULTICAST, org[1] );
	trap_WriteCoord( MSG_MULTICAST, org[2] );
	trap_multicast( PASSVEC3( org ), MULTICAST_PHS );
}
Esempio n. 6
0
File: misc.c Progetto: deurk/ktx
void barrel_explode()
{
	self->s.v.takedamage = DAMAGE_NO;
	self->classname = "explo_box";

	// did say self.owner
	T_RadiusDamage(self, self, 160, world, dtEXPLO_BOX);

	WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
	WriteByte( MSG_MULTICAST, TE_EXPLOSION );
	WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );
	WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );
	WriteCoord( MSG_MULTICAST, self->s.v.origin[2] + 32 );

	trap_multicast( PASSVEC3( self->s.v.origin ), MULTICAST_PHS );

	ent_remove( self );
}
Esempio n. 7
0
/*
================
W_FireAxe
================
*/
void W_FireAxe()
{
	vec3_t          source, dest;
	vec3_t          org;

	makevectors( self->s.v.v_angle );

	VectorCopy( self->s.v.origin, source );
	source[2] += 16;
	VectorScale( g_globalvars.v_forward, 64, dest );
	VectorAdd( dest, source, dest )
	//source = self->s.v.origin + '0 0 16';
	
	traceline( PASSVEC3( source ), PASSVEC3( dest ), false, self );
	if ( g_globalvars.trace_fraction == 1.0 )
		return;

	VectorScale( g_globalvars.v_forward, 4, org );
	VectorSubtract( g_globalvars.trace_endpos, org, org );
// org = trace_endpos - v_forward*4;

	if ( PROG_TO_EDICT( g_globalvars.trace_ent )->s.v.takedamage )
	{
		PROG_TO_EDICT( g_globalvars.trace_ent )->axhitme = 1;
		SpawnBlood( org, 20 );
		if ( deathmatch > 3 )
			T_Damage( PROG_TO_EDICT( g_globalvars.trace_ent ), self, self,
				  75 );
		else
			T_Damage( PROG_TO_EDICT( g_globalvars.trace_ent ), self, self,
				  20 );
	} else
	{			// hit wall
		sound( self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM );

		trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
		trap_WriteByte( MSG_MULTICAST, TE_GUNSHOT );
		trap_WriteByte( MSG_MULTICAST, 3 );
		trap_WriteCoord( MSG_MULTICAST, org[0] );
		trap_WriteCoord( MSG_MULTICAST, org[1] );
		trap_WriteCoord( MSG_MULTICAST, org[2] );
		trap_multicast( PASSVEC3( org ), MULTICAST_PVS );
	}
}
Esempio n. 8
0
void spike_touch()
{
//float rand;
	if ( other == PROG_TO_EDICT( self->s.v.owner ) )
		return;

	if ( self->voided )
	{
		return;
	}
	self->voided = 1;

	if ( other->s.v.solid == SOLID_TRIGGER )
		return;		// trigger field, do nothing

	if ( trap_pointcontents( PASSVEC3( self->s.v.origin ) ) == CONTENT_SKY )
	{
		ent_remove( self );
		return;
	}
// hit something that bleeds
	if ( other->s.v.takedamage )
	{
		spawn_touchblood( 9 );
		other->deathtype = "nail";
		T_Damage( other, self, PROG_TO_EDICT( self->s.v.owner ), 9 );
	} else
	{
		trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
		if ( !strcmp( self->s.v.classname, "wizspike" ) )
			trap_WriteByte( MSG_MULTICAST, TE_WIZSPIKE );
		else if ( !strcmp( self->s.v.classname, "knightspike" ) )
			trap_WriteByte( MSG_MULTICAST, TE_KNIGHTSPIKE );
		else
			trap_WriteByte( MSG_MULTICAST, TE_SPIKE );
		trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );
		trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );
		trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] );
		trap_multicast( PASSVEC3( self->s.v.origin ), MULTICAST_PHS );
	}

	ent_remove( self );

}
Esempio n. 9
0
void GrenadeExplode()
{
	if ( self->voided )
	{
		return;
	}
	self->voided = 1;

	T_RadiusDamage( self, PROG_TO_EDICT( self->s.v.owner ), 120, world, "grenade" );

	trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
	trap_WriteByte( MSG_MULTICAST, TE_EXPLOSION );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] );
	trap_multicast( PASSVEC3( self->s.v.origin ), MULTICAST_PHS );

	ent_remove( self );
}
Esempio n. 10
0
//=========================================================================
// Laserbolt touch function. Just moves through the player and comes out
// the other side.
void LaserBolt_Touch(  )
{
    vec3_t org;

    if ( other == PROG_TO_EDICT( self->s.v.owner ) )
	return;
    // don't explode on same person twice	
    if ( other == PROG_TO_EDICT( self->s.v.enemy ) && self->s.v.enemy )
	return;

    if ( trap_pointcontents( PASSVEC3( self->s.v.origin ) ) == CONTENT_SKY )
    {
	dremove( self );
	return;
    }
    normalize( self->s.v.velocity, org );
    VectorScale( org, 8, org );
    VectorSubtract( self->s.v.origin, org, org );
    if ( other->s.v.health )
    {
	SpawnBlood( org, 15 );
	tf_data.deathmsg = DMSG_LASERBOLT;
	TF_T_Damage( other, self, PROG_TO_EDICT( self->s.v.enemy ), 30, 2, TF_TD_ELECTRICITY );
	VectorCopy( self->s.v.oldorigin, self->s.v.velocity );
	self->s.v.owner = EDICT_TO_PROG( other );
	setmodel( self, "" );
	self->s.v.touch = ( func_t ) SUB_Null;
	self->s.v.nextthink = g_globalvars.time + 0.1;
	self->s.v.think = ( func_t ) LaserBolt_Think;
	return;
    } else
    {
	sound( self, 1, "enforcer/enfstop.wav", 1, 1 );
	trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
	trap_WriteByte( MSG_MULTICAST, 11/*TE_SPIKE*/ );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] );
	trap_multicast( PASSVEC3( self->s.v.origin ), 1 );
    }
    dremove( self );
}
Esempio n. 11
0
////////////////////////////////////////
///		 Hologram
void HoloHumm ( )
{
	gedict_t *owner = PROG_TO_EDICT( self->s.v.owner );

	self->playerclass = self->playerclass + 1;
	self->s.v.nextthink = g_globalvars.time + 1;
	sound( self, 0, "ambient/100hzhum.wav", 1, 1 );
	if ( self->playerclass > 4 ) {
		trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
		trap_WriteByte( MSG_MULTICAST, 11 );
		trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );
		trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );
		trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] );
		trap_multicast( PASSVEC3( self->s.v.origin ), 1 );
		if ( self->playerclass > 4 ) {
			owner->has_holo = 1;
			self->s.v.think = ( func_t ) SUB_Remove;
		}
	}
}
Esempio n. 12
0
File: misc.c Progetto: deurk/ktx
void Laser_Touch()
{
	vec3_t          org;

	if ( other == PROG_TO_EDICT( self->s.v.owner ) )
		return;		// don't explode on owner

	if ( trap_pointcontents( PASSVEC3( self->s.v.origin ) ) == CONTENT_SKY )
	{
		ent_remove( self );
		return;
	}

	sound( self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC );
	
	normalize( self->s.v.velocity, org );
	VectorScale( org, 8, org );
	VectorSubtract( self->s.v.origin, org, org );
	//org = self->s.v.origin - 8*normalize(self->s.v.velocity);

	if ( ISLIVE( other ) )
	{
		SpawnBlood( org, 15 );
		other->deathtype = dtLASER;
		T_Damage( other, self, PROG_TO_EDICT( self->s.v.owner ), 15 );
	} else
	{
		WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
		WriteByte( MSG_MULTICAST, TE_GUNSHOT );
		WriteByte( MSG_MULTICAST, 5 );
		WriteCoord( MSG_MULTICAST, org[0] );
		WriteCoord( MSG_MULTICAST, org[1] );
		WriteCoord( MSG_MULTICAST, org[2] );

		trap_multicast( PASSVEC3( org ), MULTICAST_PVS );
	}

	ent_remove( self );
}
Esempio n. 13
0
// 20mm cannon
// self->nojumptime < - fixes the bh w/ 20mm bug
void BigAssBullet ( vec3_t direction, float damage )
{
	vec3_t org, src, vtemp;

	makevectors( self->s.v.v_angle );
	src[0] = self->s.v.origin[0] + ( g_globalvars.v_forward[0] * 10 );
	src[1] = self->s.v.origin[1] + ( g_globalvars.v_forward[0] * 10 );
	src[2] = self->s.v.absmin[2] + ( self->s.v.size[2] * 0.7 );
	ClearMultiDamage ( );
	VectorScale( direction, 1500, vtemp );
	VectorAdd( vtemp, src, vtemp );
	traceline( PASSVEC3( src ), PASSVEC3( vtemp ), 0, self );
	//traceline( src, (src + (direction * 1500)), 0, self );
	if ( g_globalvars.trace_fraction != 1 )
		TraceAttack ( damage, direction );

	if ( PROG_TO_EDICT( g_globalvars.trace_ent )->s.v.takedamage ) {
		org[0] = g_globalvars.trace_endpos[0] - ( g_globalvars.v_forward[0] * 4 );
		org[1] = g_globalvars.trace_endpos[1] - ( g_globalvars.v_forward[1] * 4 );
		org[2] = g_globalvars.trace_endpos[2] - ( g_globalvars.v_forward[2] * 4 );
		//org = (trace_endpos - (v_forward * 4));
		SpawnBlood ( org, 9 );
	}
	else {
		//org = (trace_endpos - (v_forward * 4));
		org[0] = g_globalvars.trace_endpos[0] - ( g_globalvars.v_forward[0] * 4 );
		org[1] = g_globalvars.trace_endpos[1] - ( g_globalvars.v_forward[1] * 4 );
		org[2] = g_globalvars.trace_endpos[2] - ( g_globalvars.v_forward[0] * 4 );
		trap_WriteByte( MSG_BROADCAST, SVC_TEMPENTITY );
		trap_WriteByte( MSG_BROADCAST, TE_SPIKE );
		trap_WriteCoord( MSG_BROADCAST, org[0] );
		trap_WriteCoord( MSG_BROADCAST, org[1] );
		trap_WriteCoord( MSG_BROADCAST, org[2] );
		trap_multicast( PASSVEC3( g_globalvars.trace_endpos ), MULTICAST_PHS );
	}

	ApplyMultiDamage ( );
}
Esempio n. 14
0
void Dispenser_Explode(  )
{
    float sdmg;

    if ( self->real_owner->has_disconnected != 1 )
    {
	tf_data.deathmsg = DMSG_DISP_EXPLODION;
	sdmg = 25 + self->s.v.ammo_rockets * 1.5 + self->s.v.ammo_cells;
	if ( sdmg > 250 )
	    sdmg = 250;
	T_RadiusDamage( self, self->real_owner, sdmg, self );
    }
    ThrowGib( "progs/dgib1.mdl", -30 );
    ThrowGib( "progs/dgib2.mdl", -50 );
    ThrowGib( "progs/dgib3.mdl", -50 );
    trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
    trap_WriteByte( MSG_MULTICAST, TE_EXPLOSION );
    trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );
    trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );
    trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] );
    trap_multicast( PASSVEC3( self->s.v.origin ), 1 );
    BecomeExplosion(  );
}
Esempio n. 15
0
// spawn the actual holo
void HoloDood ( )
{
	gedict_t *holo;
	vec3_t vtemp;

	sound( self, 1, "weapons/railgr1a.wav", 0.6, 1 );
	holo = spawn(  );
	holo->s.v.owner = EDICT_TO_PROG( self );
	vtemp[0] =
		self->s.v.origin[0];
	vtemp[1] =
		self->s.v.origin[1];
	vtemp[2] =
		self->s.v.origin[2] + 24;
	setorigin( holo, PASSVEC3( vtemp ) );
	holo->s.v.angles[1] = self->s.v.angles[1];
	holo->s.v.angles[0] = self->s.v.angles[0];
	holo->s.v.skin = self->s.v.skin;
	holo->s.v.frame = self->s.v.frame;
	holo->s.v.colormap = self->s.v.colormap;
	holo->s.v.flags = 256;
	holo->s.v.solid = SOLID_TRIGGER;
	holo->s.v.effects = EF_DIMLIGHT;
	holo->s.v.movetype = MOVETYPE_TOSS;
	setmodel( holo, "progs/player.mdl" );
	setsize( holo, -16, -16, -24, 16, 16, 32 );
	holo->s.v.classname = "holo";
	holo->playerclass = 0;
	holo->s.v.nextthink = g_globalvars.time + 1;
	holo->s.v.think = ( func_t ) HoloHumm;
	trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
	trap_WriteByte( MSG_MULTICAST, 11 );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] );
	trap_multicast( PASSVEC3( self->s.v.origin ), 1 );
}
Esempio n. 16
0
//=========================================================================
// EMP Grenade explode function, for when the PRIMETIME runs out
void EMPGrenadeExplode(  )
{
    float expsize;
    gedict_t *te;
    gedict_t *oldself;

    trap_WriteByte( MSG_BROADCAST, SVC_TEMPENTITY );
    trap_WriteByte( MSG_BROADCAST, TE_TAREXPLOSION );
    trap_WriteCoord( MSG_BROADCAST, self->s.v.origin[0] );
    trap_WriteCoord( MSG_BROADCAST, self->s.v.origin[1] );
    trap_WriteCoord( MSG_BROADCAST, self->s.v.origin[2] );
    trap_multicast( PASSVEC3( self->s.v.origin ), 1 );
    for ( te = world; (te = findradius( te, self->s.v.origin, 240 )); )
    {
	if ( te->s.v.touch == ( func_t ) ammo_touch || te->s.v.touch == ( func_t ) weapon_touch )
	{
	    if ( strneq( te->s.v.classname, "item_spikes" ) )
	    {
		te->s.v.solid = SOLID_NOT;
		te->s.v.enemy = self->s.v.owner;
		te->s.v.nextthink = g_globalvars.time + 1 + g_random(  ) * 2;
		te->s.v.think = ( func_t ) EMPExplode;
	    }
	    continue;
	}

	if ( te->s.v.think == ( func_t ) TeamFortress_DetpackExplode )
	{
	    te->s.v.solid = SOLID_NOT;
	    te->s.v.nextthink = g_globalvars.time + 1 + g_random(  ) * 2;
	    dremove( te->oldenemy );
	    continue;
	}
	if ( streq( te->s.v.classname, "pipebomb" ) )
	{
	    te->s.v.nextthink = g_globalvars.time + 0.1;
	    continue;
	}
	// No sentrygun damage in mtf vanilla :(
	// Clan Edition should have tho..
	//				- XavioR
	if ( streq( te->s.v.classname, "building_dispenser" ) /*|| streq( te->s.v.classname, "building_sentrygun" )*/ )
	{
	    if ( !
		 ( ( teamplay & TEAMPLAY_NOEXPLOSIVE ) && te->team_no > 0
		   && te->team_no == PROG_TO_EDICT( self->s.v.owner )->team_no ) )
		TF_T_Damage( te, self, PROG_TO_EDICT( self->s.v.owner ), 200, 0, 4 );
	    continue;
	}
	if ( streq( te->s.v.classname, "ammobox" ) )
	{
	    expsize = 0;
	    expsize = expsize + te->s.v.ammo_shells * 0.75;
	    expsize = expsize + te->s.v.ammo_rockets * 0.75 * 2;
	    expsize = expsize + te->s.v.ammo_cells * 0.75 * 2;
	    if ( expsize > 0 )
	    {
		te->s.v.solid = SOLID_NOT;
		tf_data.deathmsg = DMSG_GREN_EMP;
		T_RadiusDamage( te, PROG_TO_EDICT( self->s.v.owner ), expsize, te );
		te->s.v.think = ( func_t ) TeamFortress_AmmoboxRemove;//SUB_Remove;
		te->s.v.nextthink = g_globalvars.time + 0.1;
		trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
		trap_WriteByte( MSG_MULTICAST, TE_EXPLOSION );
		trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[0] );
		trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[1] );
		trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[2] );
		trap_multicast( PASSVEC3( te->s.v.origin ), 1 );
	    }
	    continue;
	}
	if ( streq( te->s.v.classname, "player" ) || te->s.v.touch == ( func_t ) BackpackTouch )
	{
//	    if ( !( ( teamplay & 16 ) && te->team_no > 0 && te->team_no == PROG_TO_EDICT( self->s.v.owner )->team_no ) )
//	    {
		// ^ yeah it's also kinda dumb that in mtf you can emp teammates but wtva..
		expsize = 0;
		expsize = expsize + te->s.v.ammo_shells * 0.75;
		expsize = expsize + te->s.v.ammo_rockets * 0.75 * 2;
		if ( te->playerclass != PC_ENGINEER )
		    expsize = expsize + te->s.v.ammo_cells * 0.75;
		if ( expsize > 0 )
		{
		    tf_data.deathmsg = DMSG_GREN_EMP;
		    T_RadiusDamage( te, PROG_TO_EDICT( self->s.v.owner ), expsize, te );
		    if ( te->s.v.touch != ( func_t ) BackpackTouch )
		    {
			TF_T_Damage( te, self, PROG_TO_EDICT( self->s.v.owner ), expsize, 2, 4 );
			te->s.v.ammo_shells = ceil( te->s.v.ammo_shells * 0.25 );
			te->s.v.ammo_rockets = ceil( te->s.v.ammo_rockets * 0.25 );
			if ( te->playerclass != 9 )
			    te->s.v.ammo_cells = ceil( te->s.v.ammo_cells * 0.25 );
			oldself = self;
			self = te;
			W_SetCurrentAmmo(  );
			self = oldself;
		    } else
		    {
			te->s.v.think = ( func_t ) SUB_Remove;
			te->s.v.nextthink = g_globalvars.time + 0.1;
		    }
		    trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
		    trap_WriteByte( MSG_MULTICAST, TE_EXPLOSION );
		    trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[0] );
		    trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[1] );
		    trap_WriteCoord( MSG_MULTICAST, te->s.v.origin[2] );
		    trap_multicast( PASSVEC3( te->s.v.origin ), 1 );
		}
//	    }
	    continue;
	}
    }
    dremove( self );
}
Esempio n. 17
0
void    FireSentryLighting( gedict_t * targ )  
{
    vec3_t  src;
    vec3_t  dst;
    vec3_t  dir, end, norm_dir;
    gedict_t*trace_ent;

    switch( tfset_sg_sfire )
    {
        case SG_SFIRE_NEW:
            VectorCopy( self->s.v.angles, self->s.v.v_angle );
            sgAimNew( self, targ, src, dst, norm_dir );

            VectorCopy(dst,end);
            break;
        case SG_SFIRE_MTFL2:
            VectorCopy( self->s.v.angles, self->s.v.v_angle );
            sgAimMTFL2( self, targ, src, dir );

            VectorNormalize( dir );
            VectorScale( dir, 2048, end );
            VectorAdd( end, src, end );
            break;

        case SG_SFIRE_MTFL1:
            VectorCopy( self->s.v.angles, self->s.v.v_angle );
        case SG_SFIRE_281:
            trap_makevectors( self->s.v.v_angle );
            VectorScale( g_globalvars.v_forward, 10, src );
            VectorAdd( self->s.v.origin, src, src );
            src[2] = self->s.v.absmin[2] + self->s.v.size[2] * 0.7;
            VectorSubtract( targ->s.v.origin, self->s.v.origin, dir );
            VectorScale( dir, 2048, end );
            VectorAdd( end, src, end );
            break;
        default:
            return;
    }
    g_globalvars.trace_ent = 0;

    traceline( PASSVEC3( src ), PASSVEC3( end ), 0, self );


    trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
    trap_WriteByte( MSG_MULTICAST, TE_LIGHTNING2 );
    WriteEntity( MSG_MULTICAST, self );
    trap_WriteCoord( MSG_MULTICAST, src[0] );
    trap_WriteCoord( MSG_MULTICAST, src[1] );
    trap_WriteCoord( MSG_MULTICAST, src[2] );
    trap_WriteCoord( MSG_MULTICAST, g_globalvars.trace_endpos[0] );
    trap_WriteCoord( MSG_MULTICAST, g_globalvars.trace_endpos[1] );
    trap_WriteCoord( MSG_MULTICAST, g_globalvars.trace_endpos[2] );
    trap_multicast( PASSVEC3( src ), 1 );
    if ( g_globalvars.trace_ent )
    {
        trace_ent = PROG_TO_EDICT(g_globalvars.trace_ent);
        if ( streq( trace_ent->s.v.classname, "player" ) )
        {
            switch((int)( g_random(  ) * 30) )  
            {
                case 0:
                    sound( trace_ent, 2, "player/pain1.wav" , 1, 1 );
                    break;
                case 1:
                    sound( trace_ent, 2, "player/pain1.wav" , 1, 1 );
                    break;
                case 2:
                    sound( trace_ent, 2, "player/pain2.wav" , 1, 1 );
                    break;
                case 3:
                    sound( trace_ent, 2, "player/pain3.wav" , 1, 1 );
                    break;
                case 4:
                    sound( trace_ent, 2, "player/pain4.wav" , 1, 1 );
                    break;
                case 5:
                    sound( trace_ent, 2, "player/pain5.wav" , 1, 1 );
                    break;
                case 6:
                    sound( trace_ent, 2, "player/pain6.wav" , 1, 1 );
                    break;
                default:break;
            }
        }
    }
}
Esempio n. 18
0
/*
==============================================================================

ROCKETS

==============================================================================
*/
void T_MissileTouch()
{
	float           damg;
	vec3_t          tmp;

// if (deathmatch == 4)
// {
// if ( ((other.weapon == 32) || (other.weapon == 16)))
//  { 
//   if (g_random() < 0.1)
//   {
//    if (other != world)
//    {
// //    bprint (PRINT_HIGH, "Got here\n");
//     other->deathtype = "blaze";
//     T_Damage (other, self, self->s.v.owner, 1000 );
//     T_RadiusDamage (self, self->s.v.owner, 1000, other);
//    }
//   }
//  } 
// }

	if ( other == PROG_TO_EDICT( self->s.v.owner ) )
		return;		// don't explode on owner

	if ( self->voided )
	{
		return;
	}
	self->voided = 1;
	if ( trap_pointcontents( PASSVEC3( self->s.v.origin ) ) == CONTENT_SKY )
	{
		ent_remove( self );
		return;
	}

	damg = 100 + g_random() * 20;

	if ( other->s.v.health )
	{
		other->deathtype = "rocket";
		T_Damage( other, self, PROG_TO_EDICT( self->s.v.owner ), damg );
	}
	// don't do radius damage to the other, because all the damage
	// was done in the impact


	T_RadiusDamage( self, PROG_TO_EDICT( self->s.v.owner ), 120, other, "rocket" );

//  sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
	normalize( self->s.v.velocity, tmp );
	VectorScale( tmp, -8, tmp );
	VectorAdd( self->s.v.origin, tmp, self->s.v.origin )
// self->s.v.origin = self->s.v.origin - 8 * normalize(self->s.v.velocity);
	trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
	trap_WriteByte( MSG_MULTICAST, TE_EXPLOSION );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] );
	trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] );
	trap_multicast( PASSVEC3( self->s.v.origin ), MULTICAST_PHS );

	ent_remove( self );
}
Esempio n. 19
0
File: player.c Progetto: deurk/ktx
void muzzleflash()
{
	WriteByte( MSG_MULTICAST, SVC_MUZZLEFLASH );
	WriteEntity( MSG_MULTICAST, self );
	trap_multicast( PASSVEC3( self->s.v.origin ), MULTICAST_PVS );
}
Esempio n. 20
0
void W_FireLightning()
{
	vec3_t          org;
	float           cells;
	vec3_t          tmp;

	if ( self->s.v.ammo_cells < 1 )
	{
		self->s.v.weapon = W_BestWeapon();
		W_SetCurrentAmmo();
		return;
	}
// explode if under water
	if ( self->s.v.waterlevel > 1 )
	{
		if ( deathmatch > 3 )
		{
			if ( g_random() <= 0.5 )
			{
				self->deathtype = "selfwater";
				T_Damage( self, self, PROG_TO_EDICT( self->s.v.owner ),
					  4000 );
			} else
			{
				cells = self->s.v.ammo_cells;
				self->s.v.ammo_cells = 0;
				W_SetCurrentAmmo();
				T_RadiusDamage( self, self, 35 * cells, world, "" );
				return;
			}
		} else
		{
			cells = self->s.v.ammo_cells;
			self->s.v.ammo_cells = 0;
			W_SetCurrentAmmo();
			T_RadiusDamage( self, self, 35 * cells, world, "" );
			return;
		}
	}

	if ( self->t_width < g_globalvars.time )
	{
		sound( self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM );
		self->t_width = g_globalvars.time + 0.6;
	}
	g_globalvars.msg_entity = EDICT_TO_PROG( self );
	trap_WriteByte( MSG_ONE, SVC_SMALLKICK );

	if ( deathmatch != 4 )
		self->s.v.currentammo = self->s.v.ammo_cells = self->s.v.ammo_cells - 1;

	VectorCopy( self->s.v.origin, org );	//org = self->s.v.origin + '0 0 16';
	org[2] += 16;


	traceline( PASSVEC3( org ), org[0] + g_globalvars.v_forward[0] * 600,
			org[1] + g_globalvars.v_forward[1] * 600,
			org[2] + g_globalvars.v_forward[2] * 600, true, self );

	trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY );
	trap_WriteByte( MSG_MULTICAST, TE_LIGHTNING2 );
	WriteEntity( MSG_MULTICAST, self );
	trap_WriteCoord( MSG_MULTICAST, org[0] );
	trap_WriteCoord( MSG_MULTICAST, org[1] );
	trap_WriteCoord( MSG_MULTICAST, org[2] );
	trap_WriteCoord( MSG_MULTICAST, g_globalvars.trace_endpos[0] );
	trap_WriteCoord( MSG_MULTICAST, g_globalvars.trace_endpos[1] );
	trap_WriteCoord( MSG_MULTICAST, g_globalvars.trace_endpos[2] );

	trap_multicast( PASSVEC3( org ), MULTICAST_PHS );

	VectorScale( g_globalvars.v_forward, 4, tmp );
	VectorAdd( g_globalvars.trace_endpos, tmp, tmp );
	LightningDamage( self->s.v.origin, tmp, self, 30 );
}