home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / quake / programs / ricochet / ricochet.dif next >
Encoding:
Text File  |  1981-01-11  |  3.5 KB  |  150 lines

  1. diff -u ./weapons.qc ./weapons.qc
  2. --- ./weapons.qc    Wed Jul 24 23:51:24 1996
  3. +++ ./weapons.qc    Sun Jan 11 06:50:32 1981
  4. @@ -202,26 +202,41 @@
  5.  void(float damage, vector dir) TraceAttack =
  6.  {
  7.      local    vector    vel, org;
  8. +    local    vector    direction;
  9. +    local    float    num_ricochets;
  10.      
  11. -    vel = normalize(dir + v_up*crandom() + v_right*crandom());
  12. -    vel = vel + 2*trace_plane_normal;
  13. -    vel = vel * 200;
  14. +    num_ricochets = 0;
  15.  
  16. -    org = trace_endpos - dir*4;
  17. -
  18. -    if (trace_ent.takedamage)
  19. -    {
  20. -        SpawnBlood (org, vel*0.2, damage);
  21. -        AddMultiDamage (trace_ent, damage);
  22. -    }
  23. -    else
  24. +    do
  25.      {
  26. +        org = trace_endpos - dir*4;
  27. +
  28. +        if (trace_ent.takedamage)
  29. +        {
  30. +            vel = normalize(dir + v_up*crandom() + v_right*crandom());
  31. +            vel = vel + 2*trace_plane_normal;
  32. +            vel = vel * 200;
  33. +
  34. +            SpawnBlood (org, vel*0.2, damage);
  35. +            AddMultiDamage (trace_ent, damage);
  36. +            return;
  37. +        }
  38. +        if (pointcontents(org) == CONTENT_SKY)
  39. +            return;
  40.          WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  41.          WriteByte (MSG_BROADCAST, TE_GUNSHOT);
  42.          WriteCoord (MSG_BROADCAST, org_x);
  43.          WriteCoord (MSG_BROADCAST, org_y);
  44.          WriteCoord (MSG_BROADCAST, org_z);
  45. -    }
  46. +
  47. +        makevectors ('360 360 360' - self.v_angle);
  48. +        dir = v_forward;
  49. +
  50. +        traceline (org, org + (dir * 2048), FALSE, self);
  51. +
  52. +        num_ricochets = num_ricochets + 1;
  53. +
  54. +    } while (num_ricochets <= 5);
  55.  };
  56.  
  57.  /*
  58. @@ -608,11 +623,13 @@
  59.      newmis.solid = SOLID_BBOX;
  60.  
  61.      newmis.angles = vectoangles(dir);
  62. +    newmis.v_angle = self.v_angle;
  63.      
  64.      newmis.touch = spike_touch;
  65.      newmis.classname = "spike";
  66.      newmis.think = SUB_Remove;
  67.      newmis.nextthink = time + 6;
  68. +    newmis.frags = 0;        // .frags used as ricochet count
  69.      setmodel (newmis, "progs/spike.mdl");
  70.      setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  71.      setorigin (newmis, org);
  72. @@ -670,7 +687,7 @@
  73.  .float hit_z;
  74.  void() spike_touch =
  75.  {
  76. -local float rand;
  77. +local vector spike_dir;
  78.      if (other == self.owner)
  79.          return;
  80.  
  81. @@ -688,6 +705,7 @@
  82.      {
  83.          spawn_touchblood (9);
  84.          T_Damage (other, self, self.owner, 9);
  85. +        remove(self);
  86.      }
  87.      else
  88.      {
  89. @@ -702,15 +720,23 @@
  90.          WriteCoord (MSG_BROADCAST, self.origin_x);
  91.          WriteCoord (MSG_BROADCAST, self.origin_y);
  92.          WriteCoord (MSG_BROADCAST, self.origin_z);
  93. -    }
  94. -
  95. -    remove(self);
  96.  
  97. +        remove(self);
  98. +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  99. +        self.frags = self.frags + 1;    // frags is used as a
  100. +        if (self.frags <= 5)        // ricochet count
  101. +        {
  102. +            self.v_angle = '360 360 360' - self.v_angle;
  103. +            spike_dir = aim (self, 1000);
  104. +            launch_spike(self.origin, spike_dir);
  105. +        }
  106. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  107. +    }
  108.  };
  109.  
  110.  void() superspike_touch =
  111.  {
  112. -local float rand;
  113. +local vector spike_dir;
  114.      if (other == self.owner)
  115.          return;
  116.  
  117. @@ -728,6 +754,7 @@
  118.      {
  119.          spawn_touchblood (18);
  120.          T_Damage (other, self, self.owner, 18);
  121. +        remove(self);
  122.      }
  123.      else
  124.      {
  125. @@ -736,10 +763,21 @@
  126.          WriteCoord (MSG_BROADCAST, self.origin_x);
  127.          WriteCoord (MSG_BROADCAST, self.origin_y);
  128.          WriteCoord (MSG_BROADCAST, self.origin_z);
  129. -    }
  130. -
  131. -    remove(self);
  132.  
  133. +        remove(self);
  134. +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  135. +        self.frags = self.frags + 1;    // frags is used as a
  136. +        if (self.frags <= 5)        // ricochet count
  137. +        {
  138. +            self.v_angle = '360 360 360' - self.v_angle;
  139. +            spike_dir = aim (self, 1000);
  140. +            launch_spike(self.origin, spike_dir);
  141. +            newmis.touch = superspike_touch;
  142. +            setmodel (newmis, "progs/s_spike.mdl");
  143. +            setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
  144. +        }
  145. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  146. +    }
  147.  };
  148.  
  149.  
  150.