SceneSetup.cpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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 : G *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/max2w3d/SceneSetup.cpp $*
  25. * *
  26. * $Author:: Andre_a $*
  27. * *
  28. * $Modtime:: 10/15/99 3:33p $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * wwSceneSetup -- Allows the user to select how many LOD and damage models to create. *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. /*
  37. ** SceneSetup.cpp - Implements the "wwSceneSetup" MAXScript function to
  38. ** present a nice dialog to the user for getting a number of parameters
  39. ** that will governs the number, placement, and type of LOD and Damage
  40. ** models created in the scene.
  41. */
  42. #include "SceneSetupDlg.h"
  43. #undef STRICT
  44. #include <MaxScrpt.h>
  45. #include <Numbers.h>
  46. #include <Arrays.h>
  47. #include <definsfn.h>
  48. /*
  49. ** Let MAXScript know we're implementing new built-in functions.
  50. */
  51. def_visible_primitive(scene_setup, "wwSceneSetup");
  52. /***********************************************************************************************
  53. * scene_setup_cf - MAXScript function wwSceneSetup *
  54. * *
  55. * wwSceneSetup - Usage: wwSceneSetup arg_array *
  56. * *
  57. * INPUT: *
  58. * The contents of the given array is assumed to be as follows: *
  59. * lod_count (int) - the number of LOD models that will be created *
  60. * lod_offset (float) - X offset to move the LODs by *
  61. * lod_clone (int) - 1==copy 2==instance 3==reference *
  62. * damage_count (int) - the number of damage models that will be created *
  63. * damage_offset (float) - Y offset to move the LODs by *
  64. * damage_clone (int) - 1==copy 2==instance 3==reference *
  65. * *
  66. * OUTPUT: *
  67. * The function returns an array of the new values the user selected in the same format as *
  68. * above.
  69. * *
  70. * WARNINGS: *
  71. * *
  72. * HISTORY: *
  73. * 9/27/1999 AJA : Created. *
  74. *=============================================================================================*/
  75. Value * scene_setup_cf (Value **arg_list, int count)
  76. {
  77. // We don't want any arguments for this function.
  78. check_arg_count("wwSceneSetup", 1, count);
  79. type_check(arg_list[0], Array, "Parameter array");
  80. SceneSetupDlg dlg(MAXScript_interface);
  81. one_typed_value_local(Array* result);
  82. // Read the initial values out of the array.
  83. Array *args = (Array*)(arg_list[0]);
  84. dlg.m_LodCount = (args->get(1))->to_int();
  85. dlg.m_LodOffset = (args->get(2))->to_float();
  86. dlg.m_LodProc = (args->get(3))->to_int();
  87. dlg.m_DamageCount = (args->get(4))->to_int();
  88. dlg.m_DamageOffset = (args->get(5))->to_float();
  89. dlg.m_DamageProc = (args->get(6))->to_int();
  90. // Display the dialog
  91. if (dlg.DoModal() == IDCANCEL)
  92. {
  93. pop_value_locals();
  94. return &undefined;
  95. }
  96. // Stuff the values the user chose into the array we'll return.
  97. vl.result = new Array(6);
  98. vl.result->append(Integer::intern(dlg.m_LodCount));
  99. vl.result->append(Float::intern(dlg.m_LodOffset));
  100. vl.result->append(Integer::intern(dlg.m_LodProc));
  101. vl.result->append(Integer::intern(dlg.m_DamageCount));
  102. vl.result->append(Float::intern(dlg.m_DamageOffset));
  103. vl.result->append(Integer::intern(dlg.m_DamageProc));
  104. // Return the array of new values.
  105. return_value(vl.result);
  106. }