home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / qwiz12 / burning.qc < prev    next >
Encoding:
Text File  |  1996-08-16  |  2.7 KB  |  123 lines

  1. /*
  2.  
  3. ==============================================================================
  4.  
  5. Burning Hands
  6.  
  7. ==============================================================================
  8.  
  9. */
  10.  
  11.  
  12. //--------------------------------------------------------------------
  13. // Fire Magic Missile
  14. //--------------------------------------------------------------------
  15.  
  16. void() burning_touch =
  17. {
  18. local float rand;
  19.     if (other == self.owner)
  20.         return;
  21.  
  22.     if (other.solid == SOLID_TRIGGER)
  23.         return;    // trigger field, do nothing
  24.  
  25.     if (pointcontents(self.origin) == CONTENT_SKY)
  26.     {
  27.         remove(self);
  28.         return;
  29.     }
  30.     
  31. // hit something that bleeds
  32.     if (other.takedamage)
  33.     {
  34.         T_Damage (other, self, self.owner, 9);
  35.     }
  36.     else
  37.     {
  38.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  39.         
  40.         if (self.classname == "wizspike")
  41.             WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
  42.         else if (self.classname == "knightspike")
  43.             WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
  44.         else
  45.             WriteByte (MSG_BROADCAST, TE_SPIKE);
  46.         WriteCoord (MSG_BROADCAST, self.origin_x);
  47.         WriteCoord (MSG_BROADCAST, self.origin_y);
  48.         WriteCoord (MSG_BROADCAST, self.origin_z);
  49.     }
  50.  
  51.     remove(self);
  52.  
  53. };
  54.  
  55. void(vector org, vector dir) launch_burning =
  56. {
  57.     newmis = spawn ();
  58.     newmis.owner = self;
  59.     newmis.movetype = MOVETYPE_FLYMISSILE;
  60.     newmis.solid = SOLID_BBOX;
  61.  
  62.     newmis.angles = vectoangles(dir);
  63.     
  64.     newmis.touch = burning_touch;
  65.     newmis.classname = "spike";
  66.     newmis.think = SUB_Remove;
  67.     newmis.nextthink = time + 6;
  68.     setmodel (newmis, "progs/spike.mdl");
  69.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  70.     setorigin (newmis, org);
  71.  
  72.     newmis.velocity = dir * 1000;
  73. };
  74.  
  75.  
  76.  
  77. //-------------------------
  78. //    H Knight shot
  79. //-------------------------
  80.  
  81. void(float offset) burning_shot =
  82. {
  83.     local    vector    offang;
  84.     local    vector    org, vec;
  85.     
  86.     offang = self.v_angle;
  87.     offang_y = offang_y + offset * 6;
  88.     
  89.     makevectors (offang);
  90.  
  91.     org = self.origin + self.mins + self.size*0.5 + v_forward * 20;
  92.  
  93. // set missile speed
  94.     vec = normalize (v_forward);
  95.     vec_z = vec_z + (random() - 0.5)*0.1;
  96.     
  97.     launch_burning (org, vec);
  98.     newmis.classname = "knightspike";
  99.     setmodel (newmis, "progs/k_spike.mdl");
  100.     setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  101.     newmis.velocity = vec*300;
  102.     sound (self, CHAN_WEAPON, "hknight/attack1.wav", 1, ATTN_NORM);
  103. };
  104.  
  105.  
  106. //--------------------------------------------------------------------
  107. // Checks if Burn can be fired
  108. //--------------------------------------------------------------------
  109. void() BurningC = 
  110. {
  111.     if (self.ammo_cells < 10)
  112.     {
  113.         sprint(self,"cells are low\n");
  114.         return;
  115.     }
  116.       self.currentammo = self.ammo_cells = self.ammo_cells - 10;
  117.     W_SetCurrentAmmo();
  118.  
  119.     sound (self, CHAN_WEAPON, "shalrath/attack2.wav", 1, ATTN_NORM);
  120.     burning_shot ();
  121.  
  122. };
  123.