home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / accqc / $pipbomb.qr < prev    next >
Encoding:
Text File  |  1996-08-15  |  2.3 KB  |  86 lines

  1. objdata
  2.   GrenadeSuivante : Object;   // new object data for linked-list of grenades
  3.  
  4. Void function GrenadeTouch();
  5. var
  6.   P : Object;
  7. {
  8.   if (other == self.owner) {
  9.     exit;
  10.     }
  11.  
  12. // no more explosion when touching a monster
  13.  
  14.   sound(self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
  15.   if (self.velocity == VEC_ORIGIN) {
  16.     self.avelocity = VEC_ORIGIN;
  17.     }
  18. }
  19.  
  20. Void function ExploseGrenades();
  21. var
  22.  joueur : Object;
  23. {
  24.   if (self.GrenadeSuivante) {
  25.     joueur = self;
  26.     do {
  27.       sprint(joueur, "Boum ! ");
  28.       self = joueur.GrenadeSuivante;
  29.       joueur.GrenadeSuivante = self.GrenadeSuivante;
  30.       GrenadeExplode();
  31.       } while (joueur.GrenadeSuivante);
  32.     sprint(self = joueur, "|");
  33.     }
  34. }
  35.  
  36. Void function W_FireGrenade();    // replaces W_FireGrenade found in WEAPONS.QC
  37. var
  38.  missile : Object;
  39.  mpuff : Object;
  40. {
  41.   self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  42.   sound(self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  43.   self.punchangle_x = CONTENT_SOLID;
  44.   missile = spawn();
  45.   missile.owner = self;
  46.   missile.movetype = MOVETYPE_BOUNCE;
  47.   missile.solid = SOLID_BBOX;
  48.   missile.classname = "grenade";
  49.   makevectors(self.v_angle);
  50.   if (self.v_angle_x) {
  51.     missile.velocity = v_forward * 600 + v_up * 200 + crandom() * v_right * MOVETYPE_BOUNCE + crandom() * v_up * MOVETYPE_BOUNCE;
  52.     }
  53.   else {
  54.     missile.velocity = aim(self, 10000);
  55.     missile.velocity = missile.velocity * 600;
  56.     missile.velocity_z = 200;
  57.     }
  58.   missile.avelocity = [300 300 300];
  59.   missile.angles = vectoangles(missile.velocity);
  60.   missile.touch = GrenadeTouch;
  61. //  missile.nextthink = time + 2.5;
  62. //  missile.think = GrenadeExplode;
  63.   setmodel(missile, "progs/grenade.mdl");
  64.   setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
  65.   setorigin(missile, self.origin);
  66.  
  67.   missile.GrenadeSuivante = self.GrenadeSuivante;
  68.   self.GrenadeSuivante = missile;
  69. }
  70.  
  71. Void function W_WeaponFrame();   //  replaces W_WeaponFrame found in WEAPONS.QC
  72. {
  73.   if (self.impulse == 12) {      //   This is
  74.     ExploseGrenades();           //   what I
  75.     self.impulse = 0;            //   added here.
  76.     }
  77.   if (time < self.attack_finished) {
  78.     exit;
  79.     }
  80.   ImpulseCommands();
  81.   if (self.button0) {
  82.     SuperDamageSound();
  83.     W_Attack();
  84.     }
  85. }
  86.