Advertisement
techforce

Darkplaces random rainsound ver 1.1

Aug 14th, 2011
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void () place_weathernoise =
  2. {
  3.  
  4. local vector sound1,sound2
  5.  
  6. local float xfactor,yfactor,zfactor,xmax,ymax,zmax
  7.  
  8. // X, Y and Z factor determine which value is the lowest of the 2, for purposes of bumping up the final calculation so that the cordinate is within the rainfall bounding box
  9.  
  10. // X,Y and Z max determine which of the 2 are the larger values for purposes of calculating the max random number.
  11.  
  12. //Determine X
  13. if (self.dest1_x  > self.dest2_x)
  14. {
  15. xfactor = self.dest2_x;
  16. xmax = self.dest1_x;
  17. }
  18. if (self.dest1_x  < self.dest2_x)
  19. {
  20. xfactor = self.dest1_x;
  21. xmax = self.dest2_x;
  22. }
  23.  
  24. // Calculate Y
  25. if (self.dest1_y  > self.dest2_y)
  26. {
  27. yfactor = self.dest2_y;
  28. ymax = self.dest1_y;
  29. }
  30. if (self.dest1_y  < self.dest2_y)
  31. {
  32. yfactor = self.dest1_y;
  33. ymax = self.dest2_y;
  34. }
  35. // Calculate Z
  36. if (self.dest1_z  > self.dest2_z)
  37. {
  38. zfactor = self.dest2_z;
  39. zmax = self.dest1_z;
  40. }
  41. if (self.dest1_z  < self.dest2_z)
  42. {
  43. zfactor = self.dest1_z;
  44. zmax = self.dest2_z;
  45. }
  46.  
  47.  
  48.  
  49. sound1_x = vrandom (xmax ) + xfactor;
  50. sound1_y = vrandom (ymax ) + yfactor;
  51. sound1_z = vrandom (zmax ) + zfactor;
  52.  
  53.  
  54.  
  55.  
  56. spawn_tfog (sound1);
  57.  
  58.  
  59. pointsound (sound1,  "weather/nodrip1.wav", 1, 1);
  60.  
  61. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement