Advertisement
techforce

Darkplaces random weather sounds, modified by Rook

Aug 15th, 2011
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.07 KB | None | 0 0
  1. // Slightly modified code originally made by Rook, modified a bit by Cobalt
  2.  
  3. //
  4. //placed in subs.qc
  5. //
  6.  
  7. vector  (vector m1, vector m2) Rvec =
  8. {
  9.     local vector v;
  10.     m2 = m2 - m1;
  11.     v_x = m2_x * random() + m1_x;
  12.     v_y = m2_y * random() + m1_y;
  13.     v_z = m2_z * random() + m1_z;
  14.     return  v;
  15. };
  16.  
  17.  
  18. //
  19. // Placed in world.qc
  20. //
  21.  
  22. void () place_weathernoise =
  23. {
  24.  
  25. local vector sound1
  26.  
  27.  
  28. sound1 = Rvec(self.dest1,self.dest2);
  29.  
  30. // coordinate has to be CONTENT_EMPTY, no sense spawning noise inside a solid, or in a liquid
  31. if ((pointcontents (sound1) == -1))
  32. {
  33. // Spawn some test models just so we can assure they are within the bounding box supplied for that map
  34. local entity q;
  35. q = spawn ();
  36. q.classname = "pointsound";
  37. q.origin = sound1;
  38. setorigin (q, sound1);
  39. setmodel (q, "progs/s_bubble.spr");
  40. setsize (q, '-8 -8 -8', '8 8 8');
  41. // Generate the sound
  42. pointsound (sound1,  "weather/nodrip1.wav", 1, 1);
  43. }
  44. else
  45. place_weathernoise ();  // Repeat this function again, till we are in CONTENT_EMPTY location...did not think it would compile but it did !
  46. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement