scriptevents.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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/scriptevents.h $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 11/02/00 6:18p $*
  29. * *
  30. * $Revision:: 56 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef SCRIPTEVENTS_H
  36. #define SCRIPTEVENTS_H
  37. #include "gameobjobserver.h"
  38. /*
  39. ** Types
  40. */
  41. class ScriptCommandsClass;
  42. class ScriptSaver;
  43. class ScriptLoader;
  44. /*
  45. ** Script Class
  46. */
  47. class ScriptClass : public GameObjObserverClass
  48. {
  49. public:
  50. virtual ~ScriptClass() {}
  51. // virtual const char* Get_Name(void) = 0;
  52. virtual GameObject* Owner() = 0;
  53. virtual GameObject** Get_Owner_Ptr() = 0;
  54. virtual void Set_Parameters_String(const char* params) = 0;
  55. virtual void Get_Parameters_String(char* buffer, unsigned int size) = 0;
  56. // Save and Load specific script
  57. virtual void Save(ScriptSaver& saver) = 0;
  58. virtual void Load(ScriptLoader& loader) = 0;
  59. };
  60. /*
  61. ** DLL import/export macros
  62. */
  63. #ifdef BUILDING_DLL
  64. #define SCRIPT_DLL_FUNCT extern "C" _declspec(dllexport)
  65. #else
  66. #define SCRIPT_DLL_FUNCT _declspec(dllimport)
  67. #endif
  68. const char* const LPSTR_CREATE_SCRIPT = "Create_Script";
  69. typedef ScriptClass* (*LPFN_CREATE_SCRIPT)(const char*);
  70. SCRIPT_DLL_FUNCT ScriptClass* Create_Script(const char* name);
  71. const char* const LPSTR_DESTROY_SCRIPT = "Destroy_Script";
  72. typedef void (*LPFN_DESTROY_SCRIPT)(ScriptClass*);
  73. SCRIPT_DLL_FUNCT void Destroy_Script(ScriptClass* script);
  74. const char* const LPSTR_SET_SCRIPT_COMMANDS = "Set_Script_Commands";
  75. typedef bool (*LPFN_SET_SCRIPT_COMMANDS)(ScriptCommandsClass*);
  76. SCRIPT_DLL_FUNCT bool Set_Script_Commands(ScriptCommandsClass* commands);
  77. const char* const LPSTR_SET_REQUEST_DESTROY_FUNC = "Set_Request_Destroy_Func";
  78. typedef void (*LPFN_SET_REQUEST_DESTROY_FUNC)(void (*function)(ScriptClass*));
  79. SCRIPT_DLL_FUNCT void Set_Request_Destroy_Func(void (*function)(ScriptClass*));
  80. const char* const LPSTR_GET_SCRIPT_COUNT = "Get_Script_Count";
  81. typedef int (*LPFN_GET_SCRIPT_COUNT)(void);
  82. SCRIPT_DLL_FUNCT int Get_Script_Count(void);
  83. const char* const LPSTR_GET_SCRIPT_NAME = "Get_Script_Name";
  84. typedef const char* (*LPFN_GET_SCRIPT_NAME)(int);
  85. SCRIPT_DLL_FUNCT const char* Get_Script_Name(int index);
  86. const char* const LPSTR_GET_SCRIPT_PARAM_DESCRIPTION = "Get_Script_Param_Description";
  87. typedef const char* (*LPFN_GET_SCRIPT_PARAM_DESCRIPTION)(int);
  88. SCRIPT_DLL_FUNCT const char* Get_Script_Param_Description(int index);
  89. /*
  90. ** Script parameter datatype definitions
  91. */
  92. typedef enum
  93. {
  94. PARAM_TYPE_INT = 0,
  95. PARAM_TYPE_FLOAT,
  96. PARAM_TYPE_STRING,
  97. PARAM_TYPE_BOOL,
  98. PARAM_TYPE_ID,
  99. PARAM_TYPE_VECTOR3,
  100. PARAM_TYPE_ENUM,
  101. PARAM_TYPE_EMITTER,
  102. PARAM_TYPE_WEAPON,
  103. PARAM_TYPE_AMMO,
  104. PARAM_TYPE_EXPLOSION,
  105. PARAM_TYPE_ANIMATION,
  106. PARAM_TYPE_GANG,
  107. PARAM_TYPE_FILE,
  108. PARAM_TYPE_SOUND,
  109. PARAM_TYPE_COLOR,
  110. PARAM_TYPE_COUNT
  111. } PARAM_TYPES;
  112. const char * const PARAM_TYPE_STRINGS[PARAM_TYPE_COUNT] =
  113. {
  114. "int",
  115. "float",
  116. "string",
  117. "bool",
  118. "ID",
  119. "vector3",
  120. "enum",
  121. "emitter",
  122. "weapon",
  123. "ammo",
  124. "explosion",
  125. "animation",
  126. "gang",
  127. "file",
  128. "sound",
  129. "color",
  130. };
  131. #endif // SCRIPTEVENTS_H