Common.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /******************************************************************************
  19. *
  20. * FILE
  21. * Common.cpp
  22. *
  23. * DESCRIPTION
  24. * Programmer Inserted Common Scripting Functions
  25. *
  26. * PROGRAMMER
  27. * Programming Team
  28. *
  29. * VERSION INFO
  30. * $Author: Rich_d $
  31. * $Revision: 14 $
  32. * $Modtime: 6/13/00 11:46a $
  33. * $Archive: /Commando/Code/Scripts/Common.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "common.h"
  37. /******************************************************************************
  38. *
  39. * NAME
  40. * RandomVector3
  41. *
  42. * DESCRIPTION
  43. * Generate a random vector.
  44. *
  45. * INPUTS
  46. * xRange - Maximum X extent.
  47. * yRange - Maximum Y extent.
  48. * zRange - Maximum Z extent.
  49. *
  50. * RESULTS
  51. * Vector - Randomized vector
  52. *
  53. ******************************************************************************/
  54. Vector3 RandomVector3(float xRange, float yRange, float zRange)
  55. {
  56. float x = Commands->Get_Random(-xRange, xRange);
  57. float y = Commands->Get_Random(-yRange, yRange);
  58. float z = Commands->Get_Random(-zRange, zRange);
  59. return Vector3(x, y, z);
  60. }