コード例 #1
0
ファイル: weapons.c プロジェクト: stayoutEE/qwprogs-qvm
void W_FireSpikes( float ox )
{
	vec3_t          dir, tmp;

// gedict_t*    old;

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

	if ( self->s.v.ammo_nails >= 2 && self->s.v.weapon == IT_SUPER_NAILGUN )
	{
		W_FireSuperSpikes();
		return;
	}

	if ( self->s.v.ammo_nails < 1 )
	{
		self->s.v.weapon = W_BestWeapon();
		W_SetCurrentAmmo();
		return;
	}

	sound( self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM );
	self->attack_finished = g_globalvars.time + 0.2;
	if ( deathmatch != 4 )
		self->s.v.currentammo = self->s.v.ammo_nails = self->s.v.ammo_nails - 1;
	aim( dir );		// dir = aim (self, 1000);
	VectorScale( g_globalvars.v_right, ox, tmp );
	VectorAdd( tmp, self->s.v.origin, tmp );
	tmp[2] += 16;
	launch_spike( tmp, dir );

	g_globalvars.msg_entity = EDICT_TO_PROG( self );
	trap_WriteByte( MSG_ONE, SVC_SMALLKICK );
}
コード例 #2
0
ファイル: view.c プロジェクト: toneddu2000/DPTECH
void View_ThirdPerson ()
{
	local float dist, dist2;
	local vector view, add_h;

	dist = 50;

	view = input_angles;
	view_x = view_x * (-1);

	makevectors (view);

	view = '0 0 0';
	view_z = input_angles_x * 0.1;

	traceline(player.origin + '0 0 40' + v_right*(dist/6), player.origin + '0 0 40' + view - v_forward*dist - v_up*(input_angles_x/6) + v_right*(dist/3), TRUE, self);

	dist2 = vlen(trace_endpos - (player.origin + '0 0 40' + v_right*(dist/6))) ;
	add_h_z = 35 + (dist2 * 2 * (input_angles_x * 0.01));

	traceline(player.origin + '0 0 40' + v_right*(dist/6), player.origin + add_h + view - v_forward*dist2 - v_up*(input_angles_x/6) + v_right*(dist/3), TRUE, self);

	CSQC_VIEW = trace_endpos;
	CSQC_VIEW = CSQC_VIEW + v_forward*4;
}
コード例 #3
0
ファイル: weapons.c プロジェクト: stayoutEE/qwprogs-qvm
/*
================
SpawnMeatSpray
================
*/
void SpawnMeatSpray( vec3_t org, vec3_t vel )
{
	gedict_t       *missile;

	//vec3_t  org;

	missile = spawn();
	missile->s.v.owner = EDICT_TO_PROG( self );
	missile->s.v.movetype = MOVETYPE_BOUNCE;
	missile->s.v.solid = SOLID_NOT;

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

	VectorCopy( vel, missile->s.v.velocity );
// missile->s.v.velocity = vel;
	missile->s.v.velocity[2] = missile->s.v.velocity[2] + 250 + 50 * g_random();

	SetVector( missile->s.v.avelocity, 3000, 1000, 2000 );
// missile.avelocity = '3000 1000 2000';

// set missile duration
	missile->s.v.nextthink = g_globalvars.time + 1;
	missile->s.v.think = ( func_t ) SUB_Remove;

	setmodel( missile, "progs/zom_gib.mdl" );
	setsize( missile, 0, 0, 0, 0, 0, 0 );
	setorigin( missile, PASSVEC3( org ) );
}
コード例 #4
0
ファイル: drop2.c プロジェクト: MrPnut/QHome
// Throw Toaster
void Toaster ( )
{
	gedict_t *missile;
	if ( self->no_grenades_2 < 2 ) {
		G_sprint( self, 1, "Not enough type 2 grenades... get more\n" );
		return;
	}
	if (!tf_data.drop2)
	{
		G_sprint (self, 2, "Toasters have been disabled by the admin!\n");
		return;
	}
	self->no_grenades_2 = self->no_grenades_2 - 2;
	sound( self, CHAN_WEAPON, "misc/power.wav", 1, ATTN_NORM );
	missile = spawn(  );
	missile->s.v.owner = EDICT_TO_PROG( self );
	missile->s.v.movetype = 10;
	missile->s.v.solid = 2;
	missile->s.v.classname = "grenade";
	missile->s.v.effects = 8;

	// throw that toaster!
	makevectors( self->s.v.v_angle );
	if (self->s.v.v_angle[0]) {
		missile->s.v.velocity[0] =
		    g_globalvars.v_forward[0] * 600 + g_globalvars.v_up[0] * 200 +
		    crandom(  ) * g_globalvars.v_right[0] * 10 + crandom(  ) * g_globalvars.v_up[0] * 10;
		missile->s.v.velocity[1] =
		    g_globalvars.v_forward[1] * 600 + g_globalvars.v_up[1] * 200 +
		    crandom(  ) * g_globalvars.v_right[1] * 10 + crandom(  ) * g_globalvars.v_up[1] * 10;
		missile->s.v.velocity[2] =
		    g_globalvars.v_forward[2] * 600 + g_globalvars.v_up[2] * 200 +
		    crandom(  ) * g_globalvars.v_right[2] * 10 + crandom(  ) * g_globalvars.v_up[0] * 10;
	}
	else {
		//missile->s.v.velocity = aim(self, 10000);
		aim( self->s.v.velocity );	// = aim(self, 10000);
		missile->s.v.velocity[0] = missile->s.v.velocity[0] * 600;
		missile->s.v.velocity[1] = missile->s.v.velocity[1] * 600;
//		missile->s.v.velocity[2] = missile->s.v.velocity[2] * 600;
		missile->s.v.velocity[2] = 200;
	}
	SetVector( missile->s.v.avelocity, 300, 300, 300 );
	//missile.angles = vectoangles(missile.velocity);
	vectoangles( missile->s.v.velocity, missile->s.v.angles );
	missile->s.v.touch = ( func_t ) ToasterTouch;
	missile->s.v.nextthink = g_globalvars.time + 3;
	missile->s.v.think = ( func_t ) ToasterElec;
	setmodel( missile, "progs/v_spike.mdl" );
	setsize( missile, 0, 0, 0, 0, 0, 0 );
	setorigin( missile, self->s.v.origin[0], self->s.v.origin[1], self->s.v.origin[2]);
}
コード例 #5
0
ファイル: subs.c プロジェクト: angeld29/qwprogs-qvm
/*
QuakeEd only writes a single float for angles (bad idea), so up and down are
just constant angles.
*/
void SetMovedir()
{
	if ( VectorCompareF( self->s.v.angles, 0, -1, 0 ) )
		SetVector( self->s.v.movedir, 0, 0, 1 );
	else if ( VectorCompareF( self->s.v.angles, 0, -2, 0 ) )
		SetVector( self->s.v.movedir, 0, 0, -1 );
	else
	{
		makevectors( self->s.v.angles );
		VectorCopy( g_globalvars.v_forward, self->s.v.movedir );
	}
	SetVector( self->s.v.angles, 0, 0, 0 );
}
コード例 #6
0
ファイル: mtf_hwguy.c プロジェクト: MrPnut/QHome
void BigAssCarry ( )
{
	vec3_t vtemp;

	makevectors ( PROG_TO_EDICT( self->s.v.owner )->s.v.v_angle );
	vtemp[0] = ( PROG_TO_EDICT( self->s.v.owner )->s.v.origin[0] + ( g_globalvars.v_forward[0] * 12 ) + 0 ) + ( g_globalvars.v_right[0] * 5 );
	vtemp[1] = ( PROG_TO_EDICT( self->s.v.owner )->s.v.origin[1] + ( g_globalvars.v_forward[1] * 12 ) + 0 ) + ( g_globalvars.v_right[1] * 5 );
	vtemp[2] = ( PROG_TO_EDICT( self->s.v.owner )->s.v.origin[2] + ( g_globalvars.v_forward[2] * 12 ) + 20 ) + ( g_globalvars.v_right[2] * 5 );

	setorigin (self, PASSVEC3( vtemp ) );
	VectorCopy( PROG_TO_EDICT( self->s.v.owner )->s.v.angles, self->s.v.angles );
	//self->s.v.angles = PROG_TO_EDICT( self->s.v.owner )->s.v.angles;
	self->s.v.think = ( func_t ) BigAssCarry;
	self->s.v.nextthink = g_globalvars.time + 0.02;
}
コード例 #7
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;
}
コード例 #8
0
ファイル: engineer.c プロジェクト: MrPnut/QHome
//=========================================================================
// Fire a laserbolt		 -- mtf style
void W_FireLaser(  )
{
    vec3_t vec;
    vec3_t org;

    self->s.v.currentammo = --( self->s.v.ammo_nails );

    makevectors( self->s.v.v_angle );
    VectorScale( g_globalvars.v_forward, 8, org );
    VectorAdd( self->s.v.origin, org, org );
    aim( vec );
    VectorNormalize( vec );

    newmis = spawn(  );
    newmis->s.v.owner = EDICT_TO_PROG( self );
    newmis->s.v.enemy = EDICT_TO_PROG( self ); // The real owner
    newmis->s.v.movetype = MOVETYPE_FLYMISSILE;
    newmis->s.v.solid = SOLID_TRIGGER;

	// set model, skin, and effects
    setmodel( newmis, "progs/beam.mdl" );
	if ( tf_data.coloredlights == TRUE ) {
		if ( self->team_no == 1 )
			newmis->s.v.effects = 64;
		else {
			if ( self->team_no == 2 )
				newmis->s.v.effects = 128;
			else
				newmis->s.v.effects = 2;
		}
	}
	else
		newmis->s.v.effects = 2;
	newmis->s.v.skin = self->team_no - 1;

	SetVector( newmis->s.v.avelocity, 0, 0, 500 );
    setsize( newmis, 0, 0, 0, 0, 0, 0 );
    setorigin( newmis, org[0], org[1], org[2] + 16 );
    VectorScale( vec, 1500, newmis->s.v.velocity );
    vectoangles( newmis->s.v.velocity, newmis->s.v.angles );
	newmis->s.v.angles[1] += 0.1;
    VectorCopy( newmis->s.v.velocity, newmis->s.v.oldorigin );
    newmis->s.v.nextthink = g_globalvars.time + 5;
    newmis->s.v.think = ( func_t ) SUB_Remove;
    newmis->s.v.touch = ( func_t ) LaserBolt_Touch;
}
コード例 #9
0
ファイル: weapons.c プロジェクト: stayoutEE/qwprogs-qvm
/*
================
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 );
	}
}
コード例 #10
0
ファイル: triggers.c プロジェクト: angeld29/qwprogs-qvm
void multi_touch()
{
	if ( !other->s.v.classname )
		return;
	if ( strneq( other->s.v.classname, "player" ) )
		return;

// if the trigger has an angles field, check player's facing direction
	if ( self->s.v.movedir[0] != 0 && self->s.v.movedir[1] != 0
	     && self->s.v.movedir[2] != 0 )
	{
		makevectors( other->s.v.angles );
		if ( DotProduct( g_globalvars.v_forward, self->s.v.movedir ) < 0 )
			return;	// not facing the right way
	}

	self->s.v.enemy = EDICT_TO_PROG( other );
	multi_trigger();
}
コード例 #11
0
ファイル: weapons.c プロジェクト: stayoutEE/qwprogs-qvm
void W_FireRocket()
{
	if ( deathmatch != 4 )
		self->s.v.currentammo = self->s.v.ammo_rockets =
		    self->s.v.ammo_rockets - 1;

	sound( self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM );

	g_globalvars.msg_entity = EDICT_TO_PROG( self );
	trap_WriteByte( MSG_ONE, SVC_SMALLKICK );

	newmis = spawn();
	g_globalvars.newmis = EDICT_TO_PROG( newmis );
	newmis->s.v.owner = EDICT_TO_PROG( self );
	newmis->s.v.movetype = MOVETYPE_FLYMISSILE;
	newmis->s.v.solid = SOLID_BBOX;

// set newmis speed     
	makevectors( self->s.v.v_angle );
	aim( newmis->s.v.velocity );	// = aim(self, 1000);
	VectorScale( newmis->s.v.velocity, 1000, newmis->s.v.velocity );
// newmis->s.v.velocity = newmis->s.v.velocity * 1000;

	vectoangles( newmis->s.v.velocity, newmis->s.v.angles );
	
	newmis->s.v.touch = ( func_t ) T_MissileTouch;
	newmis->voided = 0;

// set newmis duration
	newmis->s.v.nextthink = g_globalvars.time + 5;
	newmis->s.v.think = ( func_t ) SUB_Remove;
	newmis->s.v.classname = "rocket";

	setmodel( newmis, "progs/missile.mdl" );
	setsize( newmis, 0, 0, 0, 0, 0, 0 );

// setorigin (newmis, self->s.v.origin + v_forward*8 + '0 0 16');
	setorigin( newmis, self->s.v.origin[0] + g_globalvars.v_forward[0] * 8,
			self->s.v.origin[1] + g_globalvars.v_forward[1] * 8,
			self->s.v.origin[2] + g_globalvars.v_forward[2] * 8 + 16 );
}
コード例 #12
0
ファイル: weapons.c プロジェクト: stayoutEE/qwprogs-qvm
/*
================
FireBullets

Used by shotgun, super shotgun, and enemy soldier firing
Go to the trouble of combining multiple pellets into a single damage call.
================
*/
void FireBullets( float shotcount, vec3_t dir, float spread_x, float spread_y,
		  float spread_z )
{
	vec3_t          direction;
	vec3_t          src, tmp;

	makevectors( self->s.v.v_angle );
	VectorScale( g_globalvars.v_forward, 10, tmp );
	VectorAdd( self->s.v.origin, tmp, src );
	//src = self->s.v.origin + v_forward*10;
	src[2] = self->s.v.absmin[2] + self->s.v.size[2] * 0.7;

	ClearMultiDamage();

	traceline( PASSVEC3( src ), src[0] + dir[0] * 2048, src[1] + dir[1] * 2048,
			src[2] + dir[2] * 2048, false, self );
	VectorScale( dir, 4, tmp );
	VectorSubtract( g_globalvars.trace_endpos, tmp, puff_org );	// puff_org = trace_endpos - dir*4;

	while ( shotcount > 0 )
	{
		VectorScale( g_globalvars.v_right, crandom() * spread_x, tmp );
		VectorAdd( dir, tmp, direction );
		VectorScale( g_globalvars.v_up, crandom() * spread_y, tmp );
		VectorAdd( direction, tmp, direction );

//  direction = dir + crandom()*spread[0]*v_right + crandom()*spread[1]*v_up;
		VectorScale( direction, 2048, tmp );
		VectorAdd( src, tmp, tmp );
		traceline( PASSVEC3( src ), PASSVEC3( tmp ), false, self );
		if ( g_globalvars.trace_fraction != 1.0 )
			TraceAttack( 4, direction );

		shotcount = shotcount - 1;
	}
	ApplyMultiDamage();
	Multi_Finish();
}
コード例 #13
0
ファイル: mtf_hwguy.c プロジェクト: MrPnut/QHome
// 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 ( );
}
コード例 #14
0
ファイル: engineer.c プロジェクト: MrPnut/QHome
void TeamFortress_Build( int objtobuild )
{
    float btime;

//      gedict_t *te;
    vec3_t tmp1;
    vec3_t tmp2;

    newmis = spawn(  );
    g_globalvars.newmis = EDICT_TO_PROG( newmis );

    // get an origin
    makevectors( self->s.v.v_angle );
    g_globalvars.v_forward[2] = 0;
    VectorNormalize( g_globalvars.v_forward );
    VectorScale( g_globalvars.v_forward, 64, g_globalvars.v_forward );
    VectorAdd( self->s.v.origin, g_globalvars.v_forward, newmis->s.v.origin );

    if ( objtobuild == BUILD_DISPENSER )
    {
        if( self->has_dispenser && !tg_data.tg_enabled)
	{
	    G_sprint( self, 2, "You can only have one dispenser.\nTry dismantling your old one.\n" );
	    return;
	}
	SetVector( tmp1, -8, -8, 0 );
	SetVector( tmp2, 8, 8, 24 );
//	newmis->mdl = "progs/disp.mdl";
	newmis->mdl = "progs/dispencr.mdl";		// megatf disp!
	newmis->s.v.netname = "dispenser";
	btime = g_globalvars.time + BUILD_TIME_DISPENSER;
	if( tg_data.tg_enabled )
		btime = g_globalvars.time;
    } else
    {
	if ( objtobuild == BUILD_SENTRYGUN )
	{
           if( self->has_sentry && !tg_data.tg_enabled)
	    {
		G_sprint( self, 2, "You can only have one sentry gun.\nTry dismantling your old one.\n" );
		return;
	    }
	    SetVector( tmp1, -16, -16, 0 );
	    SetVector( tmp2, 16, 16, 48 );
	    newmis->mdl = "progs/turrbase.mdl";
	    newmis->s.v.netname = "sentrygun";
	    btime = g_globalvars.time + BUILD_TIME_SENTRYGUN;
	    if( tg_data.tg_enabled )
	    	btime = g_globalvars.time;
	}else
	{
		G_Error("Unknown objtobuild in TeamFortress_Build\n");
		return;
	}

    }
    VectorCopy(tmp1,newmis->s.v.mins);
    VectorCopy(tmp2,newmis->s.v.maxs);
    // before we start building it, check it out
    // check for validity of point
    if ( !CheckArea( newmis, self ) )
    {
	G_sprint( self, 2, "Not enough room to build here\n" );
	dremove( newmis );
	return;
    }

    if ( !( ( int ) self->s.v.flags & FL_ONGROUND ) )
    {
	CenterPrint( self, "You can't build in the air!\n\n" );
	return;
    }
    self->is_building = 1;
    self->tfstate = self->tfstate | TFSTATE_CANT_MOVE;
    // Save the current weapon and remove it
    self->s.v.weapon = self->current_weapon;
    self->current_weapon = 0;
    self->s.v.weaponmodel = "";
    self->s.v.weaponframe = 0;

    TeamFortress_SetSpeed( self );
    newmis->s.v.owner = EDICT_TO_PROG( self );
    newmis->s.v.classname = "timer";
    newmis->s.v.netname = "build_timer";
    newmis->s.v.nextthink = btime;
    newmis->s.v.think = ( func_t ) TeamFortress_FinishedBuilding;
    newmis->s.v.colormap = self->s.v.colormap;
    newmis->s.v.weapon = objtobuild;
    newmis->s.v.angles[1] = anglemod( self->s.v.angles[1] + 180 );
    SetVector( newmis->s.v.velocity, 0, 0, 8 );
    newmis->s.v.movetype = MOVETYPE_TOSS;
    newmis->s.v.solid = SOLID_BBOX;
    setmodel( newmis, newmis->mdl );
    setsize( newmis, PASSVEC3( tmp1 ), PASSVEC3( tmp2 ) );
    setorigin( newmis, PASSVEC3( newmis->s.v.origin ) );
    newmis->s.v.flags = ( int ) newmis->s.v.flags - ( ( int ) newmis->s.v.flags & FL_ONGROUND );
}
コード例 #15
0
ファイル: common.c プロジェクト: MrPnut/QHome
void EjectShell ( )
{
	vec3_t	s_org;

	newmis = spawn (  );
	newmis->s.v.movetype = MOVETYPE_BOUNCE;
	newmis->s.v.solid = SOLID_TRIGGER;
	newmis->team_no = self->team_no;
	makevectors( self->s.v.v_angle );

	if ( self->s.v.v_angle[0] )	{
		if ( self->current_weapon == WEAP_SNIPER_RIFLE )
		{
			newmis->s.v.velocity[0] = g_globalvars.v_forward[0] * 70 + g_globalvars.v_up[0] * 90 + ( ( g_random( ) * g_globalvars.v_right[0] ) * -150 );
			newmis->s.v.velocity[1] = g_globalvars.v_forward[1] * 70 + g_globalvars.v_up[1] * 90 + ( ( g_random( ) * g_globalvars.v_right[1] ) * -150 );
			newmis->s.v.velocity[2] = g_globalvars.v_forward[2] * 70 + g_globalvars.v_up[2] * 90 + ( ( g_random( ) * g_globalvars.v_right[2] ) * -150 );
		}
		else
		{
			newmis->s.v.velocity[0] = g_globalvars.v_forward[0] * 70 + g_globalvars.v_up[0] * 90 + ( ( g_random( ) * g_globalvars.v_right[0] ) * 150 );
			newmis->s.v.velocity[1] = g_globalvars.v_forward[1] * 70 + g_globalvars.v_up[1] * 90 + ( ( g_random( ) * g_globalvars.v_right[1] ) * 150 );
			newmis->s.v.velocity[2] = g_globalvars.v_forward[2] * 70 + g_globalvars.v_up[2] * 90 + ( ( g_random( ) * g_globalvars.v_right[2] ) * 150 );
		}
	}
	else {
		aim( newmis->s.v.velocity );
		if ( self->current_weapon == WEAP_SNIPER_RIFLE )
		{
			newmis->s.v.velocity[0] = g_globalvars.v_forward[0] * 70 + g_globalvars.v_up[0] * 90 + ( ( g_random( ) * g_globalvars.v_right[0] ) * -150 );
			newmis->s.v.velocity[1] = g_globalvars.v_forward[1] * 70 + g_globalvars.v_up[1] * 90 + ( ( g_random( ) * g_globalvars.v_right[1] ) * -150 );
			newmis->s.v.velocity[2] = g_globalvars.v_forward[2] * 70 + g_globalvars.v_up[2] * 90 + ( ( g_random( ) * g_globalvars.v_right[2] ) * -150 );
		}
		else
		{
			newmis->s.v.velocity[0] = g_globalvars.v_forward[0] * 70 + g_globalvars.v_up[0] * 90 + ( ( g_random( ) * g_globalvars.v_right[0] ) * 150 );
			newmis->s.v.velocity[1] = g_globalvars.v_forward[1] * 70 + g_globalvars.v_up[1] * 90 + ( ( g_random( ) * g_globalvars.v_right[1] ) * 150 );
			newmis->s.v.velocity[2] = g_globalvars.v_forward[2] * 70 + g_globalvars.v_up[2] * 90 + ( ( g_random( ) * g_globalvars.v_right[2] ) * 150 );
		}
		newmis->s.v.velocity[2] = g_random(  ) * 90;
	}
	if ( g_random(  ) < 0.3 )
		SetVector( newmis->s.v.avelocity, 2000, 3000, 4000 );
	else
	{
		if ( g_random(  ) < 0.6 )
			SetVector( newmis->s.v.avelocity, 4000, 2000, 3000 );
		else
			SetVector( newmis->s.v.avelocity, 7000, 5000, 1000 );
	}

	s_org[0] = self->s.v.origin[0] + ( g_globalvars.v_forward[0] * 10 ) + 0;
	s_org[1] = self->s.v.origin[1] + ( g_globalvars.v_forward[1] * 10 ) + 0;
	s_org[2] = self->s.v.origin[2] + ( g_globalvars.v_forward[2] * 10 ) + 20;
	setsize( newmis, 0, 0, 0, 0, 0, 0 );
	//setorigin( newmis, ( ( self->s.v.origin + ( v_forward * 10 ) ) + '0 0 20' ) );
	setorigin( newmis, PASSVEC3( s_org ) );

	if ( self->playerclass == PC_HVYWEAP ) {
		newmis->s.v.nextthink = g_globalvars.time + 1.5;
		setmodel( newmis, "progs/20mmcase.mdl" );
	}
	else {
		newmis->s.v.nextthink = g_globalvars.time + 3;
		setmodel( newmis, "progs/shell2.mdl" );
	}

	newmis->s.v.think = ( func_t ) SUB_Remove;
	newmis->s.v.touch = ( func_t ) ShellHit;
	if ( self->current_weapon == WEAP_SHOTGUN || self->current_weapon == WEAP_SUPER_SHOTGUN )
		newmis->s.v.skin = 0;
	else
		newmis->s.v.skin = 1;
}
コード例 #16
0
ファイル: triggers.c プロジェクト: angeld29/qwprogs-qvm
void teleport_touch()
{
	gedict_t       *t;
	vec3_t          org;

	if ( self->s.v.targetname )
	{
		if ( self->s.v.nextthink < g_globalvars.time )
		{
			return;	// not fired yet
		}
	}

	if ( ( int ) ( self->s.v.spawnflags ) & PLAYER_ONLY )
	{
		if ( strneq( other->s.v.classname, "player" ) )
			return;
	}
// only teleport living creatures
	if ( other->s.v.health <= 0 || other->s.v.solid != SOLID_SLIDEBOX )
		return;

// activator = other;
	SUB_UseTargets();

	//put a tfog where the player was
	spawn_tfog( other->s.v.origin );

	t = find( world, FOFS( s.v.targetname ), self->s.v.target );
	if ( !t )
		G_Error( "couldn't find target" );

// spawn a tfog flash in front of the destination
	makevectors( t->mangle );
	org[0] = t->s.v.origin[0] + 32 * g_globalvars.v_forward[0];
	org[1] = t->s.v.origin[1] + 32 * g_globalvars.v_forward[1];
	org[2] = t->s.v.origin[2] + 32 * g_globalvars.v_forward[2];

	spawn_tfog( org );
	spawn_tdeath( t->s.v.origin, other );

// move the player and lock him down for a little while
	if ( !other->s.v.health )
	{
		VectorCopy( t->s.v.origin, other->s.v.origin );
		other->s.v.velocity[0] =
		    ( g_globalvars.v_forward[0] * other->s.v.velocity[0] ) +
		    ( g_globalvars.v_forward[0] * other->s.v.velocity[1] );
		other->s.v.velocity[1] =
		    ( g_globalvars.v_forward[1] * other->s.v.velocity[0] ) +
		    ( g_globalvars.v_forward[1] * other->s.v.velocity[1] );
		other->s.v.velocity[2] =
		    ( g_globalvars.v_forward[2] * other->s.v.velocity[0] ) +
		    ( g_globalvars.v_forward[2] * other->s.v.velocity[1] );

		//other->s.v.velocity = (v_forward * other->s.v.velocity[0]) + (v_forward * other->s.v.velocity[1]);
		return;
	}

	setorigin( other, PASSVEC3( t->s.v.origin ) );
	VectorCopy( t->mangle, other->s.v.angles );
// other.angles = t.mangle;
	if ( streq( other->s.v.classname, "player" ) )
	{
		other->s.v.fixangle = 1;	// turn this way immediately
		other->s.v.teleport_time = g_globalvars.time + 0.7;
		if ( ( int ) other->s.v.flags & FL_ONGROUND )
			other->s.v.flags = other->s.v.flags - FL_ONGROUND;
		VectorScale( g_globalvars.v_forward, 300, other->s.v.velocity );
//  other->s.v.velocity = v_forward * 300;
	}
	other->s.v.flags -= ( int ) other->s.v.flags & FL_ONGROUND;
}
コード例 #17
0
ファイル: weapons.c プロジェクト: stayoutEE/qwprogs-qvm
/*
================
W_FireGrenade
================
*/
void W_FireGrenade()
{
	if ( deathmatch != 4 )
		self->s.v.currentammo = self->s.v.ammo_rockets =
		    self->s.v.ammo_rockets - 1;

	sound( self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM );

	g_globalvars.msg_entity = EDICT_TO_PROG( self );

	trap_WriteByte( MSG_ONE, SVC_SMALLKICK );

	newmis = spawn();
	g_globalvars.newmis = EDICT_TO_PROG( newmis );
	newmis->voided = 0;
	newmis->s.v.owner = EDICT_TO_PROG( self );
	newmis->s.v.movetype = MOVETYPE_BOUNCE;
	newmis->s.v.solid = SOLID_BBOX;
	newmis->s.v.classname = "grenade";

// set newmis speed     

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

	if ( self->s.v.v_angle[0] )
	{
		newmis->s.v.velocity[0] =
		    g_globalvars.v_forward[0] * 600 + g_globalvars.v_up[0] * 200 +
		    crandom() * g_globalvars.v_right[0] * 10 +
		    crandom() * g_globalvars.v_up[0] * 10;
		newmis->s.v.velocity[1] =
		    g_globalvars.v_forward[1] * 600 + g_globalvars.v_up[1] * 200 +
		    crandom() * g_globalvars.v_right[1] * 10 +
		    crandom() * g_globalvars.v_up[1] * 10;
		newmis->s.v.velocity[2] =
		    g_globalvars.v_forward[2] * 600 + g_globalvars.v_up[2] * 200 +
		    crandom() * g_globalvars.v_right[2] * 10 +
		    crandom() * g_globalvars.v_up[0] * 10;
	} else
	{
		aim( newmis->s.v.velocity );	// = aim(self, 10000);
		VectorScale( newmis->s.v.velocity, 600, newmis->s.v.velocity );	// * 600;
		newmis->s.v.velocity[2] = 200;
	}
	SetVector( newmis->s.v.avelocity, 300, 300, 300 );
// newmis.avelocity = '300 300 300';

	vectoangles( newmis->s.v.velocity, newmis->s.v.angles );

	newmis->s.v.touch = ( func_t ) GrenadeTouch;

// set newmis duration
	if ( deathmatch == 4 )
	{
		newmis->s.v.nextthink = g_globalvars.time + 2.5;
		self->attack_finished = g_globalvars.time + 1.1;
//  self->s.v.health = self->s.v.health - 1;
		T_Damage( self, self, PROG_TO_EDICT( self->s.v.owner ), 10 );
	} else
		newmis->s.v.nextthink = g_globalvars.time + 2.5;

	newmis->s.v.think = ( func_t ) GrenadeExplode;

	setmodel( newmis, "progs/grenade.mdl" );
	setsize( newmis, 0, 0, 0, 0, 0, 0 );
	setorigin( newmis, PASSVEC3( self->s.v.origin ) );
}
コード例 #18
0
ファイル: centerstar.c プロジェクト: calkan/gentools
int main(int argc, char **argv){
  char str[1000];
  FILE *fasta;
  FILE *hor;
  FILE *log;
  FILE *aligned;
  int i,j;
  int count;
  int nseq, nhor;
  int *freqs;
  int swapfreq;
  int mismatch;
  int trim;
  /* pattern match stuff */

  FILE *clusterFile;
  char cfbase[100];
  struct cluster *allclusters;
  struct cluster *prevcluster;
  struct cluster *current;
  struct cmember *cm;
  struct wgsread *allreads;
  struct wgsread *wgs1, *wgs2;
  struct asatseq *asat;
  struct asatseq *patternasat;
  char *wgsname;
  int wgsstart, wgsend;
  int iflag;
  int isInserted;
  int cluster_id;
  int pattern_id;
  int occurance;
  int isFINALHOR;

  /* pattern match stuff ends here */

  if (argc != 3 && argc!=4){
    fprintf(stderr, "Aligns sequences to the given center star given a two fasta-centroid files.\nThen dumps the alignments\n");
    fprintf(stderr, "%s [fasta file][hor fasta] <-trim>\n", argv[0]);
    exit(0);
  }
  
  trim = 0;
  fasta = fopen(argv[1], "r");
  hor = fopen(argv[2], "r");
  if (argc == 4 && !strcmp(argv[3], "-trim"))
    trim = 1;
  if (fasta == NULL || hor == NULL)
    return 0;


  strcpy(str, argv[1]);
  for (i=strlen(str)-1;i>=0;i--)
    if (str[i]=='.'){ 
      str[i] = 0;
      break;
    }

  if (trim)
    fprintf(stdout, "Will trim.\n");
  
  makevectors();  

  strcat(str, ".log");
  log = fopen(str, "w");
  sprintf(str, "center-%s", argv[1]);
  aligned = fopen(str, "w");

  readFasta(fasta, hor, &nseq, &nhor);
  fprintf(stderr, "%d monomers, and the center are read into memory.\n", nseq);

  for (i=0;i<nseq;i++){
    align(seqs[i], horseqs[0]);
    /* aligned seq is in Sp, aligned center is in Tp */
    fprintf(aligned, ">%s\n", names[i]);
    fprintf(log, "%s\t%s\n%s\t%s\n", names[i], Sp, hornames[0], Tp);
    for (j=strlen(Sp)-1;j>=0;j--){
      if (!trim)
	fprintf(aligned, "%c", Sp[j]);
      else if (Tp[j]!='-')
 	fprintf(aligned, "%c", Sp[j]);
     if ((strlen(Sp)-j)%60 == 0 && j!=strlen(Sp)-1)
	fprintf(aligned, "\n");
    }
    fprintf(aligned, "\n");    
    if (strchr(Tp, '-')!=NULL)
      fprintf(log, "%s\n", names[i]);
    fprintf(stderr, "\r%d\tof\t%d", (i+1), nseq);
  }
  fprintf(stderr, "\n");    
  fclose(log);
  fclose(aligned);
  return 1;
}
コード例 #19
0
ファイル: weapons.c プロジェクト: stayoutEE/qwprogs-qvm
/*
============
W_Attack

An attack impulse can be triggered now
============
*/
void W_Attack()
{
	float           r;

	if ( !W_CheckNoAmmo() )
		return;

	makevectors( self->s.v.v_angle );	// calculate forward angle for velocity
	self->show_hostile = g_globalvars.time + 1;	// wake monsters up

	switch ( ( int ) self->s.v.weapon )
	{
	case IT_AXE:
		self->attack_finished = g_globalvars.time + 0.5;
		sound( self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM );
		r = g_random();
		if ( r < 0.25 )
			player_axe1();
		else if ( r < 0.5 )
			player_axeb1();
		else if ( r < 0.75 )
			player_axec1();
		else
			player_axed1();
		break;

	case IT_SHOTGUN:
		player_shot1();
		self->attack_finished = g_globalvars.time + 0.5;
		W_FireShotgun();
		break;

	case IT_SUPER_SHOTGUN:
		player_shot1();
		self->attack_finished = g_globalvars.time + 0.7;
		W_FireSuperShotgun();
		break;

	case IT_NAILGUN:
		player_nail1();
		break;

	case IT_SUPER_NAILGUN:
		player_nail1();
		break;

	case IT_GRENADE_LAUNCHER:
		player_rocket1();
		self->attack_finished = g_globalvars.time + 0.6;
		W_FireGrenade();
		break;

	case IT_ROCKET_LAUNCHER:
		player_rocket1();
		self->attack_finished = g_globalvars.time + 0.8;
		W_FireRocket();
		break;

	case IT_LIGHTNING:
		self->attack_finished = g_globalvars.time + 0.1;
		sound( self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM );
		player_light1();
		break;
	}
}
コード例 #20
0
ファイル: doors.c プロジェクト: stayoutEE/qwprogs-qvm
void fd_secret_use( gedict_t * attacker, float take )
{
	float           temp;

	self->s.v.health = 10000;

	// exit if still moving around...
	if ( !VectorCompare( self->s.v.origin, self->oldorigin ) )
		return;

	self->s.v.message = 0;	// no more message
	//activator=attacker;
	SUB_UseTargets();	// fire all targets / killtargets

	if ( !( ( int ) ( self->s.v.spawnflags ) & SECRET_NO_SHOOT ) )
	{
		self->th_pain = NULL;	//SUB_Null;
		self->s.v.takedamage = DAMAGE_NO;
	}

	VectorClear( self->s.v.velocity );

	// Make a sound, wait a little...

	sound( self, CHAN_VOICE, self->s.v.noise1, 1, ATTN_NORM );
	self->s.v.nextthink = self->s.v.ltime + 0.1;

	temp = 1 - ( ( int ) ( self->s.v.spawnflags ) & SECRET_1ST_LEFT );	// 1 or -1
	makevectors( self->mangle );

	if ( self->t_width == 0 )
	{
		if ( ( int ) ( self->s.v.spawnflags ) & SECRET_1ST_DOWN )
			self->t_width =  fabs( DotProduct( g_globalvars.v_up, self->s.v.size ) );
		else
			self->t_width =  fabs( DotProduct( g_globalvars.v_right, self->s.v.size ));
	}

	if ( self->t_length == 0 )
		self->t_length =
		    fabs( DotProduct( g_globalvars.v_forward, self->s.v.size ) );

	if ( ( int ) ( self->s.v.spawnflags ) & SECRET_1ST_DOWN )
	{
		self->dest1[0] =
		    self->s.v.origin[0] - g_globalvars.v_up[0] * self->t_width;
		self->dest1[1] =
		    self->s.v.origin[1] - g_globalvars.v_up[1] * self->t_width;
		self->dest1[2] =
		    self->s.v.origin[2] - g_globalvars.v_up[2] * self->t_width;
	} else
	{
		self->dest1[0] =
		    self->s.v.origin[0] +
		    g_globalvars.v_right[0] * ( self->t_width * temp );
		self->dest1[1] =
		    self->s.v.origin[1] +
		    g_globalvars.v_right[1] * ( self->t_width * temp );
		self->dest1[2] =
		    self->s.v.origin[2] +
		    g_globalvars.v_right[2] * ( self->t_width * temp );
	}

	self->dest2[0] = self->dest1[0] + g_globalvars.v_forward[0] * self->t_length;
	self->dest2[1] = self->dest1[1] + g_globalvars.v_forward[1] * self->t_length;
	self->dest2[2] = self->dest1[2] + g_globalvars.v_forward[2] * self->t_length;

	SUB_CalcMove( self->dest1, self->speed, fd_secret_move1 );
	sound( self, CHAN_VOICE, self->s.v.noise2, 1, ATTN_NORM );
}
コード例 #21
0
ファイル: animation.c プロジェクト: toneddu2000/DPTECH
void Player_AnimationBlendCyclesIQM()
{
	local vector vc_vel, ang, body_ang;
	local vector ang_pelvis;
	local float fl_vel, vel_F, legsang_y, weap, diff, trans;
	//bones - IMPORTANT: Spine uses Z as rotation axes, torso instead uses Y
	local float root = skel_find_bone(self.skeletonindex, "root");
	local float pelvis = skel_find_bone(self.skeletonindex, "pelvis");
	local float spine = skel_find_bone(self.skeletonindex, "spine");
	local float torso = skel_find_bone(self.skeletonindex, "torso");
	local float head = skel_find_bone(self.skeletonindex, "head");
	local float thighright = skel_find_bone(self.skeletonindex, "legthigh_r");
	local float thighleft = skel_find_bone(self.skeletonindex, "legthigh_l");
	local float handright = skel_find_bone(self.skeletonindex, "armhand_r");
	local float handleft = skel_find_bone(self.skeletonindex, "armhand_l");
	//bone rotation vectors
	local vector ang_pelvis,ang_spine,ang_torso,ang_head;
	
	vc_vel = self.velocity;
	vc_vel_z = 0;
	fl_vel = vlen(vc_vel);
	// LEGS
	if (time > self.legs_nextfr_time)
	{	
		if (fl_vel < 6){
			// STANDING STILL
			self.frame = frameforname(self.modelindex,"idle");
		}
		else{
			//WALKING/RUNNING
			if (fl_vel < 260 ){
			//WALKING
				if(input_movevalues_x > 0){
					// WALKING FORWARD
					self.frame = frameforname(self.modelindex,"walk");					
				}
				else if(input_movevalues_x < 0){
					// WALKING BACKWARD
					self.frame = frameforname(self.modelindex,"walk");					
				}
				else if(input_movevalues_y > 0){
					// WALKING RIGHT STEP
					self.frame = frameforname(self.modelindex,"walk");					
				}
				else if(input_movevalues_y < 0){
					// WALKING LEFT STEP
					self.frame = frameforname(self.modelindex,"walk");					
				}
			}
			else{
				// RUNNING
				//SPINE	
				if(input_movevalues_x > 0){
					// RUNNING FORWARD
					self.frame = frameforname(self.modelindex,"run");					
				}
				else if(input_movevalues_x < 0){
					// RUNNING BACKWARD
					self.frame = frameforname(self.modelindex,"run");					
				}
				else if(input_movevalues_y > 0){
					// RUNNING RIGHT STEP
					self.frame = frameforname(self.modelindex,"run");					
				}
				else if(input_movevalues_y < 0){
					// RUNNING LEFT STEP
					self.frame = frameforname(self.modelindex,"run");					
				}
			}
		}
		skel_build(self.skeletonindex, self, self.modelindex, 0.3, 0, pelvis); // Fix position of the pivot on the ground.
		skel_build(self.skeletonindex, self, self.modelindex, 0.4, pelvis, thighright);
	}
	// TORSO
	if (time > self.torso_nextfr_time)
	{
		//weapon holder switch
		if (self.bCanShoot == 1) {
			// FIX ME ... export weapon in use - as a byte from ssqc
			self.frame = frameforname(self.modelindex,"shoot");
		}
		skel_build(self.skeletonindex, self, self.modelindex, 0.2, pelvis, handright); 
	}
	//SPINE	
	gettaginfo(self, torso);//captures bone
	ang_spine_z = -input_angles_x * torso; // makes the spine bend
	makevectors(ang_spine); //put the angles origin at the spine
	//should prevent spine to rotate in excess but it doesn't work	
	if(ang_spine_z < 14 || ang_spine_z > -20){
		skel_mul_bone(self.skeletonindex,spine, '0.0 0.0 0.0');//rotates spine bone
	}
	//TORSO	
	gettaginfo(self, torso);//captures bone
	ang_torso_y = -input_angles_x * torso * 0.2; // makes the torso bend according to mouse input
	makevectors(ang_torso);//put the angles origin at the torso
	//should prevent torso to rotate in excess but it doesn't work	
	if(ang_torso_y < 15 || ang_torso_y > -15){
		skel_mul_bone(self.skeletonindex,torso, '0.0 0.0 0.0');//rotates torso bone
	}
	//HEAD
	gettaginfo(self, head);//captures bone
	ang_head_y = -input_angles_x * head; // makes the head bend according to mouse input
	makevectors(ang_head);
	skel_set_bone(self.skeletonindex,head, '1.1 11.8 0.0');//rotates head bone 
}