scripts.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/scripts.h $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 8/06/01 6:48p $*
  29. * *
  30. * $Revision:: 26 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef SCRIPTS_H
  36. #define SCRIPTS_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef SCRIPTEVENTS_H
  41. #include "scriptevents.h"
  42. #endif
  43. #ifndef SIMPLEVEC_H
  44. #include "simplevec.h"
  45. #endif
  46. /*
  47. **
  48. */
  49. class PhysicalGameObj;
  50. class ChunkSaveClass;
  51. class ChunkLoadClass;
  52. #define SCRIPT_MAX_PARAMS 100
  53. /*
  54. **
  55. */
  56. class ScriptSaver {
  57. public:
  58. ScriptSaver( ChunkSaveClass & csave ) : CSave( csave ) {}
  59. operator ChunkSaveClass & (void) const { return CSave; }
  60. ChunkSaveClass & CSave;
  61. };
  62. class ScriptLoader {
  63. public:
  64. ScriptLoader( ChunkLoadClass & cload ) : CLoad( cload ) {}
  65. operator ChunkLoadClass & (void) const { return CLoad; }
  66. ChunkLoadClass & CLoad;
  67. };
  68. /*
  69. ** Script Manager
  70. */
  71. class ScriptManager {
  72. public:
  73. static void Init( void );
  74. static void Shutdown( void );
  75. // Create a script. Add to the active list
  76. static ScriptClass * Create_Script( const char * script_name );
  77. // Add Script to the Destroy List
  78. static void Request_Destroy_Script( ScriptClass * script );
  79. // Destroy scripts from the destroy list
  80. static void Destroy_Pending( void );
  81. // Save & load all active scripts
  82. static bool Save( ChunkSaveClass & csave );
  83. static bool Load( ChunkLoadClass & cload );
  84. static void Enable_Script_Creation( bool enable ) { EnableScriptCreation = enable; }
  85. private:
  86. static void Load_Scripts(const char * dll_filename);
  87. static LPFN_CREATE_SCRIPT ScriptCreateFunct;
  88. static LPFN_DESTROY_SCRIPT ScriptDestroyFunct;
  89. static SimpleDynVecClass<ScriptClass *> ActiveScriptList;
  90. static SimpleDynVecClass<ScriptClass *> PendingDestroyList;
  91. static bool EnableScriptCreation;
  92. };
  93. #endif // SCRIPTS_H