home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / corpse / corpse.qc next >
Encoding:
Text File  |  1996-07-29  |  1.9 KB  |  82 lines

  1. /*
  2.  * Corpse-related material
  3.  * By AsmodeusB
  4.  * It's a solid corpse which can be gibbed, and moved (by running into it).
  5.  * Also, it falls down if you push it off a cliff. ;)
  6.  */
  7.  
  8.  
  9. void() CorpsePain =
  10. {
  11.  SpawnMeatSpray (self.origin, crandom() * 100 * v_right);
  12. };
  13.  
  14. void() CorpseMove = 
  15. {
  16.  local float dir;
  17.  
  18.  if(other.takedamage != DAMAGE_AIM)    // not living
  19.    return;
  20.  
  21.  self.origin_z = self.origin_z + 1;        // lift off of the ground
  22.  self.velocity_x = other.velocity_x/3;
  23.  self.velocity_y = other.velocity_y/3;
  24.  // no z or we can push the corpse into the ground
  25.  
  26.  self.velocity = self.velocity + '0 0 7';    // add lift
  27.  
  28.  if(self.flags & FL_ONGROUND)
  29.    self.flags = self.flags - FL_ONGROUND;
  30. };
  31.  
  32. void() CorpseDie =
  33. {
  34.  local float i;
  35.  local float j;
  36.  
  37.  sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
  38.  // MakeSolidCorpse() sets netname to the head model
  39.  ThrowHead (self.netname, self.health);
  40.  i = 0;
  41.  while(i<3)
  42.  {
  43.   j = random();
  44.   if(j > 0.6)
  45.     ThrowGib ("progs/gib3.mdl", self.health);
  46.   else if(j > 0.3)
  47.     ThrowGib ("progs/gib3.mdl", self.health);
  48.   else
  49.     ThrowGib ("progs/gib3.mdl", self.health);
  50.   i = i + 1;
  51.  }
  52. };
  53.  
  54.  
  55. /*
  56.  * This uses entity.netname to hold the head file (for CorpseDie())
  57.  * hack so that we don't have to set anything outside this function.
  58.  */
  59.  
  60. void(string headmdl) MakeSolidCorpse =
  61. {
  62. // Make a gibbable corpse, change the size so we can jump on it
  63.  
  64.     self.health = 40;
  65. // DAMAGE_AIM so that grenades don't bounce off like they do for DAMAGE_YES
  66.     self.takedamage = DAMAGE_AIM;
  67.     self.solid = SOLID_BBOX;
  68.     self.movetype = MOVETYPE_STEP;
  69.     self.flags = self.flags & (!FL_MONSTER);
  70.     setsize (self, '-32 -32 -24', '32 32 10');
  71.     self.th_stand = SUB_Null;
  72.     self.th_walk = SUB_Null;
  73.     self.th_run = SUB_Null;
  74.     self.th_pain = CorpsePain;
  75.     self.th_melee = SUB_Null;
  76.     self.th_missile = SUB_Null;
  77.     self.th_die = CorpseDie;
  78.     self.touch = CorpseMove;
  79.     self.netname = headmdl;
  80. };
  81.  
  82.