Пример #1
0
void ThrowClientHead( edict_t *self, int damage )
{
	vec3_t vd;

	self->s.modelindex = 1;
	self->s.modelindex2 = 0;
	self->s.skinnum = 0;

	self->s.origin[2] += 32;
	self->s.frame = 0;

	VectorSet( self->r.mins, -16, -16, 0 );
	VectorSet( self->r.maxs, 16, 16, 16 );

	self->takedamage = DAMAGE_NO;
	self->r.solid = SOLID_NOT;
	self->s.type = ET_GIB;
	self->s.sound = 0;
	self->s.effects = 0;
	self->flags |= FL_NO_KNOCKBACK;

	self->movetype = MOVETYPE_BOUNCE;
	VelocityForDamage( max( damage, 50 ), vd );
	VectorAdd( self->velocity, vd, self->velocity );

	G_AddEvent( self, EV_GIB, 0, false );
	GClip_LinkEntity( self );
}
Пример #2
0
void ThrowClientHead (edict_t *self, int damage)
{
	vec3_t	vd;
	char	*gibname;

	gibname = "models/objects/gibs/skull/tris.md2";
	self->s.skinnum = 0;

	self->s.origin[2] += 32;
	self->s.frame = 0;
	gi.setmodel (self, gibname);
	VectorSet (self->mins, -16, -16, 0);
	VectorSet (self->maxs, 16, 16, 16);

	self->takedamage = DAMAGE_NO;
	self->solid = SOLID_NOT;
	self->s.effects = EF_GIB;
	self->s.sound = 0;
	self->flags |= FL_NO_KNOCKBACK;

	self->movetype = MOVETYPE_BOUNCE;
	VelocityForDamage (damage, vd);
	VectorAdd (self->velocity, vd, self->velocity);

	if (self->client)	// bodies in the queue don't have a client anymore
	{
		self->client->anim_priority = ANIM_DEATH;
		self->client->anim_end = self->s.frame;
	}

	gi.linkentity (self);
}
Пример #3
0
void ThrowClientHead (edict_t *self, int damage)
{
	vec3_t	vd;
	char	*gibname;

	if (genrand_int32()&1)
	{
		gibname = "models/objects/gibs/head2/tris.md2";
		self->s.skinnum = 1;		// second skin is player
	}
	else
	{
		gibname = "models/objects/gibs/skull/tris.md2";
		self->s.skinnum = 0;
	}

	self->s.origin[2] += 32;
	self->s.frame = 0;
	gi.setmodel (self, gibname);
	VectorSet (self->mins, -16, -16, 0);
	VectorSet (self->maxs, 16, 16, 16);

	self->takedamage = DAMAGE_NO;
	self->solid = SOLID_NOT;
	self->s.effects = EF_GIB;
	self->s.sound = 0;
	self->flags |= FL_NO_KNOCKBACK;

	//this fixes heads floating in air, i hope!
	self->clipmask = MASK_SOLID;
	self->groundentity = NULL;

	self->movetype = MOVETYPE_BOUNCE;
	VelocityForDamage (damage, vd);
	VectorAdd (self->velocity, vd, self->velocity);

	if (self->client)	// bodies in the queue don't have a client anymore
	{
		self->client->anim_priority = ANIM_DEATH;
		self->client->anim_end = self->s.frame;
	}
	else
	{
		self->think = NULL;
		self->nextthink = 0;
	}

	gi.linkentity (self);
}
Пример #4
0
void
ThrowGib (edict_t * self, char *gibname, int damage, int type)
{
  edict_t *gib;
  vec3_t vd;
  vec3_t origin;
  vec3_t size;
  float vscale;

  gib = G_Spawn ();

  VectorScale (self->size, 0.5, size);
  VectorAdd (self->absmin, size, origin);
  gib->s.origin[0] = origin[0] + crandom () * size[0];
  gib->s.origin[1] = origin[1] + crandom () * size[1];
  gib->s.origin[2] = origin[2] + crandom () * size[2];
  VectorCopy( gib->s.origin, gib->old_origin );

  gi.setmodel (gib, gibname);
  gib->solid = SOLID_NOT;
  gib->s.effects |= EF_GIB;
  gib->flags |= FL_NO_KNOCKBACK;
  gib->takedamage = DAMAGE_YES;
  gib->die = gib_die;

  if (type == GIB_ORGANIC)
    {
      gib->movetype = MOVETYPE_TOSS;
      gib->touch = gib_touch;
      vscale = 0.5;
    }
  else
    {
      gib->movetype = MOVETYPE_BOUNCE;
      vscale = 1.0;
    }

  VelocityForDamage (damage, vd);
  VectorMA (self->velocity, vscale, vd, gib->velocity);
  ClipGibVelocity (gib);
  gib->avelocity[0] = random () * 600;
  gib->avelocity[1] = random () * 600;
  gib->avelocity[2] = random () * 600;

  gib->think = G_FreeEdict;
  gib->nextthink = level.framenum + (10 + random() * 10) * HZ;

  gi.linkentity (gib);
}
Пример #5
0
Файл: player.c Проект: deurk/ktx
void ThrowHead( char *gibname, float dm )
{
	setmodel( self, gibname );
	self->s.v.frame = 0;
	self->s.v.movetype = MOVETYPE_BOUNCE;
// qqshka: NO, you can't do that, that NOT projectile, its player entity!
//	self->isMissile = true;
	self->s.v.takedamage = DAMAGE_NO;
	self->s.v.solid = SOLID_NOT;
	SetVector( self->s.v.view_ofs, 0, 0, 8 );
	setsize( self, -16, -16, 0, 16, 16, 56 );
	VelocityForDamage( dm, self->s.v.velocity );
	self->s.v.origin[2] = self->s.v.origin[2] - 24;
	self->s.v.flags -= ( ( int ) ( self->s.v.flags ) ) & FL_ONGROUND;

	SetVector( self->s.v.avelocity, 0, crandom() * 600, 0 );
}
Пример #6
0
void ThrowHead (edict_t *self, char *gibname, int damage, int type)
{
	vec3_t	vd;
	float	vscale;

	self->s.skinnum = 0;
	self->s.frame = 0;
	VectorClear (self->mins);
	VectorClear (self->maxs);

	self->s.modelindex2 = 0;
	gi.setmodel (self, gibname);
	self->solid = SOLID_NOT;
	self->s.effects |= EF_GIB;
	self->s.effects &= ~EF_FLIES;
	self->s.sound = 0;
	self->flags |= FL_NO_KNOCKBACK;
	self->svflags &= ~SVF_MONSTER;
	//self->takedamage = DAMAGE_YES;
	//self->die = gib_die;
	self->enttype = ENT_GIB;

	if (type == GIB_ORGANIC)
	{
		self->movetype = MOVETYPE_TOSS;
		//self->touch = gib_touch;
		vscale = 0.5;
	}
	else
	{
		self->movetype = MOVETYPE_BOUNCE;
		vscale = 1.0;
	}

	VelocityForDamage (damage, vd);
	VectorMA (self->velocity, vscale, vd, self->velocity);
	ClipGibVelocity (self);

	self->avelocity[YAW] = crandom()*600;

	self->think = G_FreeEdict;
	self->nextthink = level.time + (10 + random()*10) * (1 * SERVER_FPS);

	gi.linkentity (self);
}
Пример #7
0
Файл: player.c Проект: deurk/ktx
gedict_t *ThrowGib( char *gibname, float dm )
{
	gedict_t       *newent;
	int			    k_short_gib = cvar( "k_short_gib" ); // if set - remove faster

	newent = spawn();
	VectorCopy( self->s.v.origin, newent->s.v.origin );
	setmodel( newent, gibname );
	setsize( newent, 0, 0, 0, 0, 0, 0 );
	VelocityForDamage( dm, newent->s.v.velocity );
	newent->s.v.movetype = MOVETYPE_BOUNCE;
	newent->isMissile = true;
	newent->s.v.solid = SOLID_NOT;
	newent->s.v.avelocity[0] = g_random() * 600;
	newent->s.v.avelocity[1] = g_random() * 600;
	newent->s.v.avelocity[2] = g_random() * 600;
	newent->think = ( func_t ) SUB_Remove;
	newent->s.v.ltime = g_globalvars.time;
	newent->s.v.nextthink = g_globalvars.time + ( k_short_gib ? 2 : ( 10 + g_random() * 10 ) );
	newent->s.v.frame = 0;
	newent->s.v.flags = 0;

	return newent;
}