Vector3RndCombo.cpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : WW3DView *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/W3DView/Vector3RndCombo.cpp $Modtime:: $*
  25. * *
  26. * $Revision:: 2 $*
  27. * *
  28. *---------------------------------------------------------------------------------------------*
  29. * Functions: *
  30. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  31. #include "StdAfx.H"
  32. #include "Vector3RndCombo.H"
  33. #include "V3_Rnd.H"
  34. const char * const RANDOMIZER_NAMES[Vector3Randomizer::CLASSID_MAXKNOWN] =
  35. {
  36. "Solid Box",
  37. "Solid Sphere",
  38. "Hollow Sphere",
  39. "Solid Cylinder",
  40. };
  41. ////////////////////////////////////////////////////////////////////
  42. //
  43. // Fill_Vector3_Rnd_Combo
  44. //
  45. ////////////////////////////////////////////////////////////////////
  46. void
  47. Fill_Vector3_Rnd_Combo (HWND hcombobox)
  48. {
  49. ASSERT (Vector3Randomizer::CLASSID_MAXKNOWN == (sizeof (RANDOMIZER_NAMES) / sizeof (char *)));
  50. //
  51. // Add all the strings to the combobox
  52. //
  53. for (int index = 0; index < Vector3Randomizer::CLASSID_MAXKNOWN; index ++) {
  54. ::SendMessage (hcombobox, CB_ADDSTRING, 0, (LPARAM)RANDOMIZER_NAMES[index]);
  55. }
  56. return ;
  57. }
  58. ////////////////////////////////////////////////////////////////////
  59. //
  60. // Combo_Index_From_Vector3_Rnd
  61. //
  62. ////////////////////////////////////////////////////////////////////
  63. int
  64. Combo_Index_From_Vector3_Rnd (Vector3Randomizer *randomizer)
  65. {
  66. int index = 0;
  67. if (randomizer != NULL) {
  68. index = (int)randomizer->Class_ID ();
  69. }
  70. // Return the index to the caller
  71. return index;
  72. }
  73. ////////////////////////////////////////////////////////////////////
  74. //
  75. // Vector3_Rnd_From_Combo_Index
  76. //
  77. ////////////////////////////////////////////////////////////////////
  78. Vector3Randomizer *
  79. Vector3_Rnd_From_Combo_Index (int index, float value1, float value2, float value3)
  80. {
  81. Vector3Randomizer *randomizer = NULL;
  82. //
  83. // What type of randomizer should we create?
  84. //
  85. switch (index)
  86. {
  87. case Vector3Randomizer::CLASSID_SOLIDBOX:
  88. randomizer = new Vector3SolidBoxRandomizer (Vector3 (value1, value2, value3));
  89. break;
  90. case Vector3Randomizer::CLASSID_SOLIDSPHERE:
  91. randomizer = new Vector3SolidSphereRandomizer (value1);
  92. break;
  93. case Vector3Randomizer::CLASSID_HOLLOWSPHERE:
  94. randomizer = new Vector3HollowSphereRandomizer (value1);
  95. break;
  96. case Vector3Randomizer::CLASSID_SOLIDCYLINDER:
  97. randomizer = new Vector3SolidCylinderRandomizer (value1, value2);
  98. break;
  99. }
  100. // Return a pointer to the new randomizer
  101. return randomizer;
  102. }