Guest User

SC2 Native List

a guest
Apr 24th, 2010
548
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 179.86 KB | None | 0 0
  1. //==================================================================================================
  2. // Native Function Prototypes
  3. //==================================================================================================
  4. include "TriggerLibs/GameData/GameDataAllNatives.galaxy"
  5.  
  6. //--------------------------------------------------------------------------------------------------
  7. // Contents
  8. //--------------------------------------------------------------------------------------------------
  9. // - About Types
  10. // - Common
  11. // - Achievements
  12. // - Actor
  13. // - Animation
  14. // - Bank
  15. // - Boards
  16. // - Camera
  17. // - Campaign
  18. // - Catalogs
  19. // - Cinematics
  20. // - Conversions
  21. // - Conversation
  22. // - Data Table
  23. // - Dialogs
  24. // - Environment
  25. // - Game
  26. // - Looping
  27. // - Markers
  28. // - Math
  29. // - Melee
  30. // - Minimap
  31. // - Movie
  32. // - Objectives
  33. // - Orders
  34. // - Ping
  35. // - Planet
  36. // - Players
  37. // - Player Groups
  38. // - Points
  39. // - Portraits
  40. // - Preload
  41. // - PurchaseItems
  42. // - Regions
  43. // - Sound
  44. // - Story Mode
  45. // - Strings
  46. // - Tech Tree
  47. // - Text Tags
  48. // - Timing
  49. // - Transmission
  50. // - Triggers
  51. // - Units
  52. // - Unit Filters
  53. // - Unit Groups
  54. // - Unit Reference
  55. // - Unit Selection
  56. // - User Interface
  57. // - Visibility
  58. //
  59. //--------------------------------------------------------------------------------------------------
  60. // About Types
  61. //--------------------------------------------------------------------------------------------------
  62. //
  63. // -- Complex types and automatic deletion --
  64. //
  65. // Many native types represent "complex" objects (i.e. larger than 4 bytes).  The script language
  66. // automatically keeps track of these objects and deletes them from memory when they are no longer
  67. // used (that is, when nothing in the script references them any longer).  The types which benefit
  68. // from automatic deletion are:
  69. //
  70. //      abilcmd, bank, camerainfo, marker, order, playergroup, point,
  71. //      region, soundlink, string, text, timer, transmissionsource, unitfilter, unitgroup, unitref,
  72. //      waveinfo, wavetarget
  73. //
  74. // Other object types must be explicitly destroyed with the appropriate native function when you
  75. // are done using them.
  76. //
  77. //
  78. // -- Complex types and equality --
  79. //
  80. // Normally, comparing two "complex" objects with the == or != operators will only compare the
  81. // object reference, not the contained object data.  However, a few types will compare the contained
  82. // data instead.  These types are:
  83. //
  84. //      abilcmd, point, string, unitfilter, unitref
  85. //
  86. // Examples:
  87. //
  88. //      Point(1, 2) == Point(1, 2)                              // True
  89. //      "test string" == "test string"                          // True (note: this is case sensitive)
  90. //      AbilityCommand("move", 0) == AbilityCommand("move", 0)  // True
  91. //      Order(abilCmd) == Order(abilCmd)                        // False (two different order instances)
  92. //      RegionEmpty() == RegionEmpty()                          // False (two different region instances)
  93. //
  94. //
  95. // -- Complex types and +/- operators --
  96. //
  97. // Besides numerical types (byte, int, fixed), a few complex types support + and/or - operators:
  98. //
  99. //      string, text    + operator will concatenate the strings or text
  100. //      point           +/- operators will add or subtract the x and y components of the points
  101. //
  102.  
  103. //--------------------------------------------------------------------------------------------------
  104. // Common
  105. // - Constants used in multiple sections
  106. //--------------------------------------------------------------------------------------------------
  107. // Alignment
  108. const int c_alignLeft   = 0;
  109. const int c_alignTop    = 0;
  110. const int c_alignRight  = 1;
  111. const int c_alignBottom = 1;
  112. const int c_alignCenter = 2;
  113.  
  114. // Anchor
  115. const int c_anchorTopLeft       = 0;
  116. const int c_anchorTop           = 1;
  117. const int c_anchorTopRight      = 2;
  118. const int c_anchorLeft          = 3;
  119. const int c_anchorCenter        = 4;
  120. const int c_anchorRight         = 5;
  121. const int c_anchorBottomLeft    = 6;
  122. const int c_anchorBottom        = 7;
  123. const int c_anchorBottomRight   = 8;
  124.  
  125. //--------------------------------------------------------------------------------------------------
  126. // Achievements
  127. //--------------------------------------------------------------------------------------------------
  128. native void AchievementPanelSetVisible (playergroup players, bool visible);
  129. native void AchievementsDisable (int player);
  130.  
  131. //--------------------------------------------------------------------------------------------------
  132. // Actor
  133. // - Can send actor messages through API that is temporarily similar to the animation API.
  134. //
  135. // Design Comments
  136. // - Trigger code is synchronous and actors are asynchronous.  This means we can't have any
  137. //   routines that return any results, since anything from the actor system is suspect.
  138. //   This includes even the existence of actors themselves; an actor might only be created on
  139. //   machines with good graphics cards, for instance.
  140. // - This also means collection classes are out, since we can't return a count that is guaranteed
  141. //   to match.  (Technically, we could still have them, but just not populate them via "query".
  142. //   The value at this point is unfortunately low enough to not be worth the complexity.)
  143. // - We can return actors and scopes, but these will be opaque values that might even be NULL.
  144. //   The client can do stuff with them, but won't be guaranteed to have them work.  In other
  145. //   words, the client always appears to get a valid object, but the user has no way of actually
  146. //   knowing whether it was valid, except to look at the screen.  Testing against null only
  147. //   determines whether there has ever been an attempt to assign these values.
  148. //
  149. // FAQ
  150. //
  151. // Q01  Why do we not use scope names to get a hold of scopes?
  152. // A01  Scope names started as a debugging tool.  We want to see if we can get by with that.
  153. //      Until there's a super compelling need, we want to get by without exposing a whole new
  154. //      namespace.
  155. //
  156. // Q02  Why does ::LastCreated only get set with new values if they are successfully created?
  157. //      Won't this create subtle bugs where we send messages to the prior actor that was created,
  158. //      b/c we are accidentally not creating a new one?
  159. // A02  Well, it might.  But it's also a simply explained rule.  No one will remember the
  160. //      alternative, which is something like actors/scopes created by ActorCreate, and create
  161. //      messages sent by the user.  It also leads to simpler, less bug-prone C++ code on my end. :)
  162. //
  163. // Q03  Why does ActorCreate have 3 content params?  Is that many really necessary?
  164. // A03  It is exactly enough to create a beam with a custom model and two custom sites.
  165. //--------------------------------------------------------------------------------------------------
  166. native actorscope   ActorScopeCreate (string name);
  167. native actorscope   ActorScopeFrom (string name);
  168. native actorscope   ActorScopeFromActor (actor a);
  169. native actorscope   ActorScopeFromUnit (unit u);
  170. native actorscope   ActorScopeFromPortrait (int p);
  171. native text         ActorScopeGetText (actorscope as);
  172. native void         ActorScopeKill (actorscope as);
  173. native void         ActorScopeOrphan (actorscope as);
  174. native actor        ActorScopeRefGet (actorscope as, string refName);
  175. native void         ActorScopeRefSet (actorscope as, string refName, actor aValue);
  176. native void         ActorScopeSend (actorscope as, string msg);
  177. native actor        ActorCreate (actorscope as, string actorName, string content1Name, string content2Name, string content3Name);
  178. native actor        ActorFrom (string name);
  179. native actor        ActorFromActor (actor a, string name);
  180. native actor        ActorFromScope (actorscope as, string name);
  181. native actor        ActorFromDoodad (doodad d);
  182. native actor        ActorFromPortrait (int p);
  183. native text         ActorGetText (actor a);
  184. native actor        ActorRefGet (actor a, string refName);
  185. native void         ActorRefSet (actor a, string refName, actor aValue);
  186. native void         ActorSend (actor a, string msg);
  187. native void         ActorSendTo (actor a, string refName, string msg);
  188. native void         ActorLookAtStart (actor s, string lookAt, int weight, fixed time, actor t);
  189. native void         ActorLookAtStop (actor s, string lookAt, int weight, fixed time);
  190. native void         ActorLookAtTypeStart (actor s, string type, actor t);
  191. native void         ActorLookAtTypeStop (actor s, string type);
  192. native void         ActorTextureGroupApplyGlobal (string textureProps);
  193. native void         ActorTextureGroupRemoveGlobal (string textureProps);
  194. native void         ActorWorldParticleFXDestroy ();
  195.  
  196. native actor        ActorRegionCreate (actorscope as, string actorName, region r);
  197. native void         ActorRegionSend (actor a, int intersect, string msg, string filters, string terms);
  198.  
  199. const int c_actorIntersectAgainstCenter             = 0;
  200. const int c_actorIntersectAgainstRadiusContact      = 1;
  201. const int c_actorIntersectAgainstRadiusGame         = 2;
  202. const int c_actorIntersectAgainstRadiusVisual       = 3;
  203.  
  204. const int c_animTimeVariantAsAutomatic              = 0;
  205. const int c_animTimeVariantAsDuration               = 1;
  206. const int c_animTimeVariantAsTimeScale              = 2;
  207.  
  208. const int c_animTransitionFlagInstant               = (1 << 0);
  209.  
  210. const int c_animBracketStartFlagClosingFull         = (1 << 0);
  211. const int c_animBracketStartFlagContentNonLooping   = (1 << 1);
  212. const int c_animBracketStartFlagContentPlayOnce     = (1 << 2);
  213. const int c_animBracketStartFlagOpeningPlayForever  = (1 << 3);
  214. const int c_animBracketStartFlagInstant             = (1 << 4);
  215.  
  216. const int c_animGroupApplyFlagClosingFull           = (1 << 0);
  217. const int c_animGroupApplyFlagInstant               = (1 << 1);
  218.  
  219. const int c_animFlagFullMatch                       = (1 << 0);
  220. const int c_animFlagPlayForever                     = (1 << 1);
  221. const int c_animFlagNonLooping                      = (1 << 2);
  222. const int c_animFlagAssetDrivenLooping              = (1 << 3);
  223. const int c_animFlagRandomStartOffset               = (1 << 4);
  224.  
  225. // Currently unused.
  226. const int e_actorRefFlagGroup                       = (1 << 1);
  227.  
  228. const int c_actorRefSpaceGlobal                     = 1;
  229. const int c_actorRefSpaceScope                      = 2;
  230. const int c_actorRefSpaceActor                      = 3;
  231.  
  232. const int c_actorRequestScopeImplicit               = 0;
  233. const int c_actorRequestScopeCaster                 = 1;
  234. const int c_actorRequestScopeEffect                 = 2;
  235. const int c_actorRequestScopeMissile                = 3;
  236. const int c_actorRequestScopeOuter                  = 4;
  237. const int c_actorRequestScopeSource                 = 5;
  238. const int c_actorRequestScopeTarget                 = 6;
  239.  
  240. const int c_actorRequestActorImplicit               = 0;
  241. const int c_actorRequestActorCreate                 = 1;
  242. const int c_actorRequestActorFind                   = 2;
  243.  
  244. const int c_textureVideoPlayFlagLooping             = (1 << 0);
  245. const int c_textureVideoPlayFlagSynced              = (1 << 1);
  246.  
  247. const int c_physicsDisabled                         = 0;
  248. const int e_physicsKeyframed                        = 1;
  249. const int e_physicsSimulated                        = 2;
  250.  
  251. const int c_actorTransitionIn                       = 0;
  252. const int c_actorTransitionOut                      = 1;
  253.  
  254. const int c_textureSlotComponentDefault             = 0;
  255. const int c_textureSlotComponentDiffuse             = 1;
  256. const int c_textureSlotComponentEmissive            = 2;
  257. const int c_textureSlotComponentNormal              = 3;
  258. const int c_textureSlotComponentSpecular            = 4;
  259.  
  260. native string       MakeMsgAnimBracketResume (
  261.                         string animName,
  262.                         int animTransitionFlags,
  263.                         fixed timeVariant,
  264.                         int timeType
  265.                     );
  266.  
  267. native string       MakeMsgAnimBracketStart (
  268.                         string animName,
  269.                         string propsOpening,
  270.                         string propsContent,
  271.                         string propsClosing,
  272.                         int animBracketStartFlags,
  273.                         fixed timeVariant,
  274.                         int timeType
  275.                     );
  276.  
  277. native string       MakeMsgAnimBracketStop (
  278.                         string animName,
  279.                         int animTransitionFlags,
  280.                         fixed timeVariant,
  281.                         int timeType
  282.                     );
  283.  
  284. native string       MakeMsgAnimGroupApply (
  285.                         string animGroup,
  286.                         string atApply,
  287.                         string atRemove,
  288.                         int animGroupApplyFlags,
  289.                         fixed timeVariant,
  290.                         int timeType
  291.                     );
  292.  
  293. native string       MakeMsgAnimGroupRemove (
  294.                         string animGroup,
  295.                         int animTransitionFlags,
  296.                         fixed timeVariant,
  297.                         int timeType
  298.                     );
  299.  
  300. native string       MakeMsgAnimPlay (
  301.                         string animName,
  302.                         string animProps,
  303.                         int animFlags,
  304.                         fixed blendIn,
  305.                         fixed blendOut,
  306.                         fixed timeVariant,
  307.                         int timeType
  308.                     );
  309.  
  310. native string       MakeMsgRefCreate (string refName);
  311. native string       MakeMsgRefSetFromRequest (
  312.                         string refName,
  313.                         string subject,
  314.                         string effectName,
  315.                         int requestScope,
  316.                         int requestActor
  317.                     );
  318. native string       MakeMsgRefTableDump (int space);
  319. native string       MakeMsgSetPhysicsState (int physicsState, fixed delayLow, fixed delayHigh);
  320. native string       MakeMsgTextureSelectByMatch (
  321.                         string slotName,
  322.                         int slotComponent,
  323.                         string sourceSlotName,
  324.                         int sourceSlotComponent
  325.                     );
  326. native string       MakeMsgTextureSelectBySlot (
  327.                         string slotName,
  328.                         int slotComponent,
  329.                         string textureExpression
  330.                     );
  331. native string       MakeMsgTextureVideoPlay (
  332.                         string slotName,
  333.                          int slotComponent,
  334.                          int fps,
  335.                          int textureVideoPlayFlags,
  336.                          int videoSoundType,
  337.                          string attachQuery
  338.                     );
  339. native string       MakeMsgTextureVideoStop (string slotName, int slotComponent);
  340. native string       MakeMsgTextureVideoSetFrame (string slotName, int slotComponent, int frame);
  341. native string       MakeMsgTextureVideoSetPaused (string slotName, int slotComponent, bool isPaused);
  342. native string       MakeMsgTextureVideoSetTime (string slotName, int slotComponent, fixed time);
  343. native string       MakeMsgTransition (int transitionType, fixed durationBase, fixed durationRange);
  344.  
  345. native string       TextureGetSlotName (string textureLink);
  346. native int          TextureGetSlotComponent (string textureLink);
  347.  
  348. native doodad       DoodadFromId (int id);
  349.  
  350. //--------------------------------------------------------------------------------------------------
  351. // Animation
  352. //--------------------------------------------------------------------------------------------------
  353. const fixed c_animTimeDefault           = -1;
  354.  
  355. const string c_animNameDefault          = "Default";
  356.  
  357. native void     ModelAnimationLoad (string modelPath, string animPath);
  358. native void     ModelAnimationUnload (string modelPath, string animPath);
  359.  
  360. //--------------------------------------------------------------------------------------------------
  361. // Bank
  362. //--------------------------------------------------------------------------------------------------
  363. const int c_bankTypeFixed   = 0;
  364. const int c_bankTypeFlag    = 1;
  365. const int c_bankTypeInt     = 2;
  366. const int c_bankTypeString  = 3;
  367. const int c_bankTypeUnit    = 4;
  368. const int c_bankTypePoint   = 5;
  369. const int c_bankTypeText    = 6;
  370.  
  371. native bool     BankExists (string name, int player);
  372. native bank     BankLastCreated ();
  373. native bank     BankLoad (string name, int player);
  374. native string   BankName (bank b);
  375. native int      BankPlayer (bank b);
  376. native void     BankRemove (bank b);
  377. native void     BankSave (bank b);
  378.  
  379. native int      BankSectionCount (bank b);
  380. native bool     BankSectionExists (bank b, string section);
  381. native string   BankSectionName (bank b, int index);
  382. native void     BankSectionRemove (bank b, string section);
  383.  
  384. native int      BankKeyCount (bank b, string section);
  385. native bool     BankKeyExists (bank b, string section, string key);
  386. native string   BankKeyName (bank b, string section, int index);
  387. native void     BankKeyRemove (bank b, string section, string key);
  388.  
  389. native bool     BankValueIsType (bank b, string section, string key, int type);
  390.  
  391. native fixed    BankValueGetAsFixed (bank b, string section, string key);
  392. native void     BankValueSetFromFixed (bank b, string section, string key, fixed value);
  393.  
  394. native bool     BankValueGetAsFlag (bank b, string section, string key);
  395. native void     BankValueSetFromFlag (bank b, string section, string key, bool value);
  396.  
  397. native int      BankValueGetAsInt (bank b, string section, string key);
  398. native void     BankValueSetFromInt (bank b, string section, string key, int value);
  399.  
  400. native point    BankValueGetAsPoint (bank b, string section, string key);
  401. native void     BankValueSetFromPoint (bank b, string section, string key, point value);
  402.  
  403. native string   BankValueGetAsString (bank b, string section, string key);
  404. native void     BankValueSetFromString (bank b, string section, string key, string value);
  405.  
  406. native text     BankValueGetAsText (bank b, string section, string key);
  407. native void     BankValueSetFromText (bank b, string section, string key, text value);
  408.  
  409. native unit     BankLastRestoredUnit ();
  410. native unit     BankValueGetAsUnit (bank b, string section, string key, int player, point p, fixed facing);
  411. native void     BankValueSetFromUnit (bank b, string section, string key, unit value);
  412.  
  413. //--------------------------------------------------------------------------------------------------
  414. // Battle Report
  415. //--------------------------------------------------------------------------------------------------
  416. const int c_invalidBattleReportId       = 0;
  417.  
  418. const int c_battleReportStateNormal     = 0;
  419. const int c_battleReportStateCompleted  = 1;
  420. const int c_battleReportStateHidden     = 2;
  421.  
  422. const int c_battleReportTypeMission     = 0;
  423. const int c_battleReportTypeScene       = 1;
  424.  
  425. native void     BattleReportPanelSetSelectedBattleReport (playergroup players, int inBattleReport);
  426. native int      BattleReportPanelGetSelectedBattleReport (int inPlayer);
  427.  
  428. native int      BattleReportCreate (playergroup inPlayerGroup, text inText, int inType, int inState);
  429. native int      BattleReportLastCreated ();
  430. native void     BattleReportDestroy (int inBattleReportId);
  431.  
  432. native void     BattleReportSetState (int inBattleReportId, int inState);
  433. native void     BattleReportSetPriority (int inBattleReportId, int inPriority);
  434. native void     BattleReportSetButtonText (int inBattleReportId, text inText);
  435. native void     BattleReportSetButtonImage (int inBattleReportId, string inImage);
  436.  
  437. native void     BattleReportSetMissionText (int inBattleReportId, text inText);
  438. native void     BattleReportSetResearchTitle (int inBattleReportId, text inText);
  439. native void     BattleReportSetResearchText (int inBattleReportId, text inText);
  440. native void     BattleReportSetBonusTitle (int inBattleReportId, text inText);
  441. native void     BattleReportSetBonusText (int inBattleReportId, text inText);
  442. native void     BattleReportSetWorldText (int inBattleReportId, text inText);
  443. native void     BattleReportSetObjectiveTitle (int inBattleReportId, text inText);
  444. native void     BattleReportSetObjectiveText (int inBattleReportId, text inText);
  445. native void     BattleReportSetAchievementTitle (int inBattleReportId, text inText);
  446. native void     BattleReportSetBestTimeText (int inBattleReportId, text inText);
  447. native void     BattleReportSetMissionImage (int inBattleReportId, string inImage);
  448. native void     BattleReportSetDifficultyLevelCompleted (int inBattleReportId, int inDifficultyLevel, bool inCompleted);
  449. native void     BattleReportSetDifficultyLevelBestTimeText (int inBattleReportId, int inDifficultyLevel, text inText);
  450. native void     BattleReportAddAchievement (int inBattleReportId, string inAchievement);
  451.  
  452. native void     BattleReportSetSceneText (int inBattleReportId, text inText);
  453. native void     BattleReportSetSceneImage (int inBattleReportId, string inImage);
  454.  
  455. // Battle Report events
  456. native void     TriggerAddEventBattleReportPanelExit (trigger t, int inPlayer);
  457. native void     TriggerAddEventBattleReportPanelPlayMission (trigger t, int inPlayer);
  458. native void     TriggerAddEventBattleReportPanelPlayScene (trigger t, int inPlayer);
  459. native void     TriggerAddEventBattleReportPanelSelectionChanged (trigger t, int inPlayer);
  460.  
  461. native int      EventBattleReportPanelMissionSelected ();
  462. native int      EventBattleReportPanelDifficultySelected ();
  463. native int      EventBattleReportPanelSceneSelected ();
  464.  
  465. //--------------------------------------------------------------------------------------------------
  466. // Boards
  467. //--------------------------------------------------------------------------------------------------
  468. const int c_boardNone = 0;
  469.  
  470. native int          BoardCreate (int inCols, int inRows, text inName, color inColor);
  471. native int          BoardLastCreated ();
  472. native void         BoardDestroy (int inBoard);
  473.  
  474. native void         BoardShowAll (bool inShow, playergroup inPlayers);
  475.  
  476. // Board title
  477. const int c_boardColorText          = 0;
  478. const int c_boardColorBackground    = 1;
  479.  
  480. const int c_boardIconPosLeft        = 0;
  481. const int c_boardIconPosRight       = 1;
  482.  
  483. native void         BoardTitleShow (int inBoard, playergroup inPlayers, bool inShow);
  484. native void         BoardTitleSetText (int inBoard, text inText);
  485. native void         BoardTitleSetColor (int inBoard, int inType, color inColor);
  486. native void         BoardTitleSetIcon (int inBoard, string inIcon);
  487. native void         BoardTitleSetAlignment (int inBoard, int inAlign, int inIconPos);
  488. native void         BoardTitleSetClickable (int inBoard, bool inClickable);
  489.  
  490. // Board properties
  491. native void         BoardSetName (int inBoard, text inName, color inColor);
  492.  
  493. const int c_boardStateShowing       = 0;
  494. const int c_boardStateShowTitle     = 1;
  495. const int c_boardStateShowMinimize  = 2;
  496. const int c_boardStateMinimized     = 3;
  497. const int c_boardStateShowHeader    = 4;
  498. const int c_boardStateSorted        = 5;
  499.  
  500. native void         BoardSetState (int inBoard, playergroup inPlayers, int inState, bool inVal);
  501.  
  502. // Board minimize button
  503. native void         BoardMinimizeShow (int inBoard, playergroup inPlayers, bool inShow);
  504. native void         BoardMinimizeEnable (int inBoard, playergroup inPlayers, bool inEnable);
  505. native void         BoardMinimizeSetState (int inBoard, playergroup inPlayers, bool inVal);
  506. native void         BoardMinimizeSetColor (int inBoard, color inColor);
  507.  
  508. // Board columns and rows
  509. native void         BoardSetColumnCount (int inBoard, int inCols);
  510. native void         BoardSetRowCount (int inBoard, int inRows);
  511.  
  512. const fixed c_boardWidthAuto    = 0; // Automatically size the column to fit all items
  513.  
  514. native void         BoardSetColumnWidth (int inBoard, int inCol, fixed inWidth);
  515.  
  516. // Board row groups
  517. native void         BoardSetGroupCount (int inBoard, int inGroups);
  518. native void         BoardRowSetGroup (int inBoard, int inRow, int inGroup);
  519.  
  520. // Board items
  521. const int c_boardColGroups  = -3; // Use as column value to treat row value as group instead
  522. const int c_boardItemAll    = -2; // Use as row or column value to modify all items
  523. const int c_boardRowHeader  = -1; // Use as row value to access header items
  524.  
  525. native void         BoardItemSetText (int inBoard, int inCol, int inRow, text inText);
  526. native void         BoardItemSetTextColor (int inBoard, int inCol, int inRow, color inColor);
  527. native void         BoardItemSetBackgroundColor (int inBoard, int inCol, int inRow, color inColor);
  528. native void         BoardItemSetIcon (int inBoard, int inCol, int inRow, string inIcon, bool inLeft);
  529. native void         BoardItemSetAlignment (int inBoard, int inCol, int inRow, int inAlign);
  530. native void         BoardItemSetFontSize (int inBoard, int inCol, int inRow, int inSize);
  531. native void         BoardItemSetSortValue (int inBoard, int inCol, int inRow, int inVal);
  532.  
  533. native void         BoardItemSetProgressShow (int inBoard, int inCol, int inRow, bool inShow);
  534. native void         BoardItemSetProgressRange (int inBoard, int inCol, int inRow, fixed inMin, fixed inMax);
  535. native void         BoardItemSetProgressValue (int inBoard, int inCol, int inRow, fixed inVal);
  536. native void         BoardItemSetProgressColor (int inBoard, int inCol, int inRow, color inColor, int inStep);
  537.  
  538. // Board sorting
  539. // Note: inPriority defines multi-column sorting behavior.  If two items are identical, the next
  540. //       sort priority is used (lowest priority value comes first).  inPriority should range
  541. //       from 1 to the number of columns.
  542. //
  543. native void         BoardSort (int inBoard, int inCol, bool inAscending, int inPriority);
  544.  
  545. // Automatic player column
  546. // Note: Once a player column has been added, the "row" values passed in to the functions above
  547. //       should be the player id instead.
  548. //
  549. native void         BoardSetPlayerColumn (int inBoard, int inCol, bool inGroupByTeams);
  550. native void         BoardPlayerAdd (int inBoard, int inPlayer);
  551. native void         BoardPlayerRemove (int inBoard, int inPlayer);
  552.  
  553. //--------------------------------------------------------------------------------------------------
  554. // Camera
  555. //--------------------------------------------------------------------------------------------------
  556. const int c_cameraValueFieldOfView      = 0;
  557. const int c_cameraValueNearClip         = 1;
  558. const int c_cameraValueFarClip          = 2;
  559. const int c_cameraValueShadowClip       = 3;
  560. const int c_cameraValueDistance         = 4;
  561. const int c_cameraValuePitch            = 5;
  562. const int c_cameraValueYaw              = 6;
  563. const int c_cameraValueRoll             = 7;
  564. const int c_cameraValueHeightOffset     = 8;
  565. const int c_cameraValueDepthOfField     = 9;
  566. const int c_cameraValueFocalDepth       = 10;
  567. const int c_cameraValueFalloffStart     = 11;
  568. const int c_cameraValueFalloffEnd       = 12;
  569.  
  570. const int c_cameraPositionEye           = 0;
  571. const int c_cameraPositionTarget        = 1;
  572. const int c_cameraPositionBoth          = 2;
  573.  
  574. const int c_cameraDirectionX            = 0;
  575. const int c_cameraDirectionY            = 1;
  576. const int c_cameraDirectionZ            = 2;
  577. const int c_cameraDirectionXY           = 3;
  578. const int c_cameraDirectionXZ           = 4;
  579. const int c_cameraDirectionYZ           = 5;
  580. const int c_cameraDirectionXYZ          = 6;
  581.  
  582. const int c_cameraRotationPitch         = 0;
  583. const int c_cameraRotationRoll          = 1;
  584. const int c_cameraRotationYaw           = 2;
  585.  
  586. // Camera Info
  587. native camerainfo   CameraInfoDefault ();
  588. native camerainfo   CameraInfoFromId (int id);
  589.  
  590. native void         CameraInfoSetValue (camerainfo c, int type, fixed value);
  591. native fixed        CameraInfoGetValue (camerainfo c, int type);
  592.  
  593. native void         CameraInfoSetTarget (camerainfo c, point p);
  594. native point        CameraInfoGetTarget (camerainfo c);
  595.  
  596. // Player Camera
  597. native void         CameraApplyInfo (int player, camerainfo c, fixed duration, fixed velocity, fixed decelerate, bool useTarget);
  598. native void         CameraPan (int player, point p, fixed duration, fixed velocity, fixed decelerate, bool smart);
  599. native void         CameraSetValue (int player, int type, fixed value, fixed duration, fixed velocity, fixed decelerate);
  600. native void         CameraUseModel (int player, unit u, string name, fixed duration);
  601.  
  602. native void         CameraForceMouseRelative (int player, bool value);
  603. native void         CameraLockInput (int player, bool lock);
  604. native void         CameraSetMouseRotates (int player, bool value);
  605. native void         CameraSetMouseRotationSpeed (int player, int direction, fixed value);
  606. native void         CameraSetVerticalFieldOfView (int player, bool value);
  607. native void         CameraUseHeightDisplacement (int player, bool value);
  608. native void         CameraUseHeightSmoothing (int player, bool value);
  609.  
  610. native void         CameraSetChannel (int player, unit cameraUnit, string cameraName, int channel, fixed aspectRatio);
  611. native void         CameraClearChannel (int player, int channel);
  612.  
  613. native void         CameraSetChannelOnPortrait (int player, camerainfo c, fixed aspectRatio, int portraitId, int channel);
  614. native void         CameraClearChannelOnPortrait (int player, int portraitId, int channel);
  615.  
  616. native void         CameraShakeStart (
  617.                         int player,
  618.                         int position,           // c_cameraPosition*
  619.                         int direction,          // c_cameraDirection*
  620.                         fixed amplitude,
  621.                         fixed frequency,
  622.                         fixed randomPercent,
  623.                         fixed duration
  624.                     );
  625. native void         CameraShakeStop (int player);
  626.  
  627. // - CameraSave saves the current camera settings for the given player,
  628. //   which can later be restored using CameraRestore.
  629. //
  630. native void         CameraSave (int player);
  631. native void         CameraRestore (int player, fixed duration, fixed velocity, fixed decelerate);
  632.  
  633. // - CameraGetTarget returns the synchronized target for the given player
  634. //
  635. native point        CameraGetTarget (int player);
  636. native fixed        CameraGetPitch (int player);
  637. native fixed        CameraGetYaw (int player);
  638.  
  639. // Camera Bounds, optionally adjusting the minimap as well
  640. // Camera bounds can never extend beyond the playable map area
  641. //
  642. native void         CameraSetBounds (playergroup players, region bounds, bool includeMinimap);
  643.  
  644. // Force the camera to start/stop following a group of units
  645. //
  646. native void         CameraFollowUnitGroup (int player, unitgroup group, bool follow, bool isOffset);
  647.  
  648. native void         CameraLookAt (int player, point p, fixed duration, fixed velocity, fixed decelerate);
  649. // Make the camera look at an actor or unit, updating as it moves. Use null to stop looking.
  650. //
  651. native void         CameraLookAtActor (int player, actor a);
  652. native void         CameraLookAtUnit (int player, unit u);
  653.  
  654. // Camera movement events
  655. const int c_cameraMoveReasonAny             = -1;
  656. const int c_cameraMoveReasonAlert           = 0;
  657. const int c_cameraMoveReasonKeyScroll       = 1;
  658. const int c_cameraMoveReasonMinimap         = 2;
  659. const int c_cameraMoveReasonMouseScroll     = 3;
  660. const int c_cameraMoveReasonSelection       = 4;
  661. const int c_cameraMoveReasonTown            = 5;
  662. const int c_cameraMoveReasonView            = 6;
  663.  
  664. native void         TriggerAddEventCameraMove (trigger t, int player, int reason);
  665. native int          EventCameraMoveReason ();
  666.  
  667. //--------------------------------------------------------------------------------------------------
  668. // Campaign
  669. //
  670. // Game initialization and configuration associated with standard campaign games
  671. //--------------------------------------------------------------------------------------------------
  672. native void     CampaignInitAI ();
  673. native void     CampaignProgressSetText (playergroup players, string campaignId, text inText); // Blizzard maps only
  674. native void     CampaignProgressSetImageFilePath (playergroup players, string campaignId, string inFilePath); // Blizzard maps only
  675. native void     CampaignProgressSetTutorialFinished (playergroup players, string campaignId, bool inFinished); // Blizzard maps only
  676. native void     CampaignProgressSetCampaignFinished (playergroup players, string campaignId, bool inFinished); // Blizzard maps only
  677.  
  678. //--------------------------------------------------------------------------------------------------
  679. // Catalogs
  680. //
  681. // Note: The catalog entry table includes references to entries from other fields,
  682. //       even if that entry is not actually defined.  This means it is possible that
  683. //       enumerating entries via CatalogEntryCount and CatalogEntryGet may return entries
  684. //       that don't actually exist.  Use CatalogEntryIsValid to check for this case.
  685. //
  686. //--------------------------------------------------------------------------------------------------
  687. native int AbilityClass (string ability);
  688.  
  689. native int CatalogEntryCount (int catalog);
  690. native string CatalogEntryGet (int catalog, int index);
  691.  
  692. native bool CatalogEntryIsValid (int catalog, string entry);
  693. native int CatalogEntryClass (int catalog, string entry);
  694. native string CatalogEntryParent (int catalog, string entry);
  695. native string CatalogEntryScope (int catalog, string entry);
  696.  
  697. native int CatalogFieldCount (string scope);
  698. native string CatalogFieldGet (string scope, int index);
  699. native bool CatalogFieldIsArray (string scope, string field);
  700. native bool CatalogFieldIsScope (string scope, string field);
  701. native string CatalogFieldType (string scope, string field);
  702.  
  703. native int CatalogFieldValueCount (int catalog, string entry, string fieldPath, int player);
  704. native string CatalogFieldValueGet (int catalog, string entry, string fieldPath, int player);
  705. native bool CatalogFieldValueSet (int catalog, string entry, string fieldPath, int player, string value);
  706.  
  707. //--------------------------------------------------------------------------------------------------
  708. // CharacterSheet
  709. //--------------------------------------------------------------------------------------------------
  710. native void     CharacterSheetPanelSetNameText (playergroup players, text inText);
  711. native void     CharacterSheetPanelSetDescriptionText (playergroup players, text inText);
  712. native void     CharacterSheetPanelSetPortraitModelLink (playergroup players, string inModelLink);
  713.  
  714. //--------------------------------------------------------------------------------------------------
  715. // Cinematics
  716. //--------------------------------------------------------------------------------------------------
  717. native void CinematicMode (playergroup players, bool cinematicMode, fixed duration);
  718.  
  719. const int c_fadeStyleNormal         = 0;
  720. const int c_fadeStyleExponential    = 1;
  721. const int c_fadeStyleSine           = 2;
  722. const int c_fadeStyleSquareRoot     = 3;
  723.  
  724. native void CinematicFade (
  725.     bool fadeIn,
  726.     fixed duration,
  727.     int style,
  728.     color inColor,
  729.     fixed transparency,
  730.     bool waitUntilDone
  731. );
  732.  
  733. native void CinematicOverlay (
  734.     bool fadeIn,
  735.     fixed duration,
  736.     string imagePath,
  737.     fixed transparency,
  738.     bool waitUntilDone
  739. );
  740.  
  741. native void CinematicDataRun (int id, playergroup players, bool waitUntilDone);
  742. native void CinematicDataStop ();
  743.  
  744. //--------------------------------------------------------------------------------------------------
  745. // Conversions
  746. //--------------------------------------------------------------------------------------------------
  747. native int      BoolToInt (bool f);
  748. native int      Color255FromFixed (fixed f);
  749.  
  750. native fixed    IntToFixed (int x);
  751. native string   IntToString (int x);
  752. native text     IntToText (int x);
  753.  
  754. const int c_fixedPrecisionAny = -1;
  755. native int      FixedToInt (fixed x);
  756. native string   FixedToString (fixed x, int precision);
  757. native text     FixedToText (fixed x, int precision);
  758.  
  759. native int      StringToInt (string x);
  760. native fixed    StringToFixed (string x);
  761.  
  762. // Color
  763. // Note: Component values are in percent (0-100)
  764. //
  765. const int c_colorComponentRed   = 0;
  766. const int c_colorComponentGreen = 1;
  767. const int c_colorComponentBlue  = 2;
  768. const int c_colorComponentAlpha = 3;
  769.  
  770. native color    Color (fixed r, fixed g, fixed b);
  771. native color    ColorWithAlpha (fixed r, fixed g, fixed b, fixed a);
  772. native color    ColorFromIndex (int inIndex, int inType);
  773. native fixed    ColorGetComponent (color c, int component);
  774.  
  775. native text     FormatNumber (int number);
  776. native text     FormatDuration (int seconds);
  777.  
  778. //--------------------------------------------------------------------------------------------------
  779. // Conversations
  780. //--------------------------------------------------------------------------------------------------
  781. const int c_invalidConversationId           = 0;
  782. const int c_invalidReplyId                  = 0;
  783.  
  784. const int c_conversationReplyStateUnread    = 0;
  785. const int c_conversationReplyStateRead      = 1;
  786. const int c_conversationReplyStateOld       = 2;
  787.  
  788. native int          ConversationCreate (bool visible);
  789. native int          ConversationLastCreated ();
  790. native void         ConversationDestroy (int intId);
  791. native void         ConversationDestroyAll ();
  792.  
  793. native void         ConversationShow (int intId, playergroup to, bool visible);
  794. native bool         ConversationVisible (int intId, int player);
  795.  
  796. native int          ConversationReplyCreate (int intId, text inText);
  797. native int          ConversationReplyLastCreated ();
  798. native void         ConversationReplyDestroy (int intId, int replyId);
  799. native void         ConversationReplyDestroyAll (int intId);
  800.  
  801. native void         ConversationReplySetText (int intId, int replyId, text inText);
  802. native text         ConversationReplyGetText (int intId, int replyId);
  803.  
  804. native void         ConversationReplySetState (int intId, int replyId, int state);
  805. native int          ConversationReplyGetState (int intId, int replyId);
  806.  
  807. // Conversation events
  808. native void         TriggerAddEventConversationReplySelected (trigger t, int player, int intId, int replyId);
  809.  
  810. native int          EventConversation ();
  811. native int          EventConversationReply ();
  812.  
  813. native int          ConversationReplyGetIndex (int intId, int replyId);
  814.  
  815. // Data-driven conversations
  816. // Note: The stateIndex parameters specify the state id and the index id (if any), separated by "|".
  817. //       ConversationDataStateIndex may be used to assemble the proper string for a given numerical
  818. //       index in the state definition.
  819. //
  820. native int          ConversationDataStateIndexCount (string inStateId);
  821. native string       ConversationDataStateIndex (string inStateId, int inIndex);
  822.  
  823. native text         ConversationDataStateName (string stateIndex);
  824. native text         ConversationDataStateText (string stateIndex, string inInfoName);
  825. native fixed        ConversationDataStateFixedValue (string stateIndex, string inInfoName);
  826. native string       ConversationDataStateImagePath (string stateIndex);
  827. native int          ConversationDataStateImageEdge (string stateIndex);
  828. native string       ConversationDataStateAttachPoint (string stateIndex);
  829. native string       ConversationDataStateMoviePath (string stateIndex);
  830. native string       ConversationDataStateModel (string stateIndex, string inInfoName);
  831. native string       ConversationDataStateUpgrade (string stateIndex, string inInfoName);
  832. native abilcmd      ConversationDataStateAbilCmd (string stateIndex, string inInfoName);
  833.  
  834. native void         ConversationDataRegisterCamera (string camIndex, string charIndex, camerainfo c, trigger t, bool wait);
  835. native void         ConversationDataRegisterUnit (string stateIndex, unit u);
  836. native void         ConversationDataRegisterPortrait (string stateIndex, int p);
  837.  
  838. native void         ConversationDataStateSetValue (string stateIndex, int value);
  839. native int          ConversationDataStateGetValue (string stateIndex);
  840.  
  841. native int          ConversationDataChoiceCount (string convId);
  842. native string       ConversationDataChoiceId (string convId, int index);
  843. native void         ConversationDataChoiceSetState (string convId, string choiceId, int state);
  844. native int          ConversationDataChoiceGetState (string convId, string choiceId);
  845. native void         ConversationDataChoiceSetPicked (string convId, string choiceId, bool picked);
  846. native bool         ConversationDataChoiceGetPicked (string convId, string choiceId);
  847. native void         ConversationDataChoiceSetPickedCount (string convId, string choiceId, int count);
  848. native int          ConversationDataChoiceGetPickedCount (string convId, string choiceId);
  849.  
  850. native int          ConversationDataLineCount (string convId);
  851. native string       ConversationDataLineId (string convId, int index);
  852. native void         ConversationDataLineSetPickedCount (string convId, string lineId, int count);
  853. native int          ConversationDataLineGetPickedCount (string convId, string lineId);
  854.  
  855. // State save/load via bank
  856. // - State values are the arbitrary integer values associated with state objects.
  857. //
  858. native void         ConversationDataSaveStateValues (string stateId, bank b, string section);
  859. native void         ConversationDataLoadStateValues (string stateId, bank b, string section);
  860.  
  861. native void         ConversationDataResetStateValues (string stateId);
  862.  
  863. // - Node state is the read/unread and picked state associated with lines and choices (nodes)
  864. //   within a given conversation.
  865. //
  866. native void         ConversationDataSaveNodeState (string convId, bank b, string section);
  867. native void         ConversationDataLoadNodeState (string convId, bank b, string section);
  868.  
  869. native void         ConversationDataResetNodeState (string convId);
  870.  
  871. // ConversationDataPreloadLines preloads sounds for all lines that are available to run given
  872. // the current state.
  873. //
  874. native void         ConversationDataPreloadLines (string convId);
  875.  
  876. // ConversationDataCanRun returns true if the given conversation has any lines or choices available
  877. // to run given the current state.
  878. //
  879. native bool         ConversationDataCanRun (string convId, bool unpickedOnly);
  880.  
  881. const int c_conversationSkipNone    = 0;    // Skipping not allowed
  882. const int c_conversationSkipSimple  = 1;    // Skipping only allowed for all lines (esc key),
  883.                                             // not individual lines (space bar, left click)
  884. const int c_conversationSkipFull    = 2;    // Skipping allowed for all lines or individual lines
  885.  
  886. native void         ConversationDataRun (string convId, playergroup players, int skipType, bool waitUntilDone);
  887. native void         ConversationDataStop ();
  888.  
  889. native string       ConversationDataActiveSound ();     // Sound id associated with the active line
  890. native string       ConversationDataActiveCamera ();    // Last camera state to be applied
  891.  
  892. // Data Conversation events
  893. native void         TriggerAddEventConversationStateChanged (trigger t, string stateIndex);
  894.  
  895. native string       EventConversationState ();
  896.  
  897. //--------------------------------------------------------------------------------------------------
  898. // Data Table
  899. // - Data tables provide named storage for any script type.
  900. //   Table access may be either global or thread-local.
  901. //--------------------------------------------------------------------------------------------------
  902. // Types
  903. const int c_dataTypeUnknown             = -1;
  904. const int c_dataTypeAbilCmd             =  0;
  905. const int c_dataTypeActor               =  1;
  906. const int c_dataTypeActorScope          =  2;
  907. const int c_dataTypeAIFilter            =  3;
  908. const int c_dataTypeBank                =  4;
  909. const int c_dataTypeBool                =  5;
  910. const int c_dataTypeByte                =  6;
  911. const int c_dataTypeCameraInfo          =  7;
  912. const int c_dataTypeCinematic           =  8;
  913. const int c_dataTypeColor               =  9;
  914. const int c_dataTypeControl             = 10;
  915. const int c_dataTypeConversation        = 11;
  916. const int c_dataTypeDialog              = 12;
  917. const int c_dataTypeDoodad              = 13;
  918. const int c_dataTypeFixed               = 14;
  919. const int c_dataTypeInt                 = 15;
  920. const int c_dataTypeMarker              = 16;
  921. const int c_dataTypeObjective           = 17;
  922. const int c_dataTypeOrder               = 18;
  923. const int c_dataTypePing                = 19;
  924. const int c_dataTypePlanet              = 20;
  925. const int c_dataTypePlayerGroup         = 21;
  926. const int c_dataTypePoint               = 22;
  927. const int c_dataTypePortrait            = 23;
  928. const int c_dataTypeRegion              = 24;
  929. const int c_dataTypeReply               = 25;
  930. const int c_dataTypeRevealer            = 26;
  931. const int c_dataTypeRoom                = 27;
  932. const int c_dataTypeSound               = 28;
  933. const int c_dataTypeSoundLink           = 29;
  934. const int c_dataTypeString              = 30;
  935. const int c_dataTypeText                = 31;
  936. const int c_dataTypeTimer               = 32;
  937. const int c_dataTypeTransmission        = 33;
  938. const int c_dataTypeTransmissionSource  = 34;
  939. const int c_dataTypeTrigger             = 35;
  940. const int c_dataTypeUnit                = 36;
  941. const int c_dataTypeUnitFilter          = 37;
  942. const int c_dataTypeUnitGroup           = 38;
  943. const int c_dataTypeUnitRef             = 39;
  944. const int c_dataTypeWave                = 40;
  945. const int c_dataTypeWaveInfo            = 41;
  946. const int c_dataTypeWaveTarget          = 42;
  947.  
  948. // General functionality
  949. native void     DataTableClear (bool global);
  950. native int      DataTableValueCount (bool global);
  951. native string   DataTableValueName (bool global, int index);
  952. native bool     DataTableValueExists (bool global, string name);
  953. native int      DataTableValueType (bool global, string name);
  954. native void     DataTableValueRemove (bool global, string name);
  955.  
  956. // Type-specific value set/get
  957. // - c_dataTypeAbilCmd
  958. native void         DataTableSetAbilCmd (bool global, string name, abilcmd val);
  959. native abilcmd      DataTableGetAbilCmd (bool global, string name);
  960.  
  961. // - c_dataTypeActor
  962. native void         DataTableSetActor (bool global, string name, actor val);
  963. native actor        DataTableGetActor (bool global, string name);
  964.  
  965. // - c_dataTypeActorScope
  966. native void         DataTableSetActorScope (bool global, string name, actorscope val);
  967. native actorscope   DataTableGetActorScope (bool global, string name);
  968.  
  969. // - c_dataTypeAIFilter
  970. native void         DataTableSetAIFilter (bool global, string name, aifilter val);
  971. native aifilter     DataTableGetAIFilter (bool global, string name);
  972.  
  973. // - c_dataTypeBank
  974. native void         DataTableSetBank (bool global, string name, bank val);
  975. native bank         DataTableGetBank (bool global, string name);
  976.  
  977. // - c_dataTypeBool
  978. native void         DataTableSetBool (bool global, string name, bool val);
  979. native bool         DataTableGetBool (bool global, string name);
  980.  
  981. // - c_dataTypeByte
  982. native void         DataTableSetByte (bool global, string name, byte val);
  983. native byte         DataTableGetByte (bool global, string name);
  984.  
  985. // - c_dataTypeCameraInfo
  986. native void         DataTableSetCameraInfo (bool global, string name, camerainfo val);
  987. native camerainfo   DataTableGetCameraInfo (bool global, string name);
  988.  
  989. // - c_dataTypeCinematic
  990. native void         DataTableSetCinematic (bool global, string name, int val);
  991. native int          DataTableGetCinematic (bool global, string name);
  992.  
  993. // - c_dataTypeColor
  994. native void         DataTableSetColor (bool global, string name, color val);
  995. native color        DataTableGetColor (bool global, string name);
  996.  
  997. // - c_dataTypeControl
  998. native void         DataTableSetControl (bool global, string name, int val);
  999. native int          DataTableGetControl (bool global, string name);
  1000.  
  1001. // - c_dataTypeConversation
  1002. native void         DataTableSetConversation (bool global, string name, int val);
  1003. native int          DataTableGetConversation (bool global, string name);
  1004.  
  1005. // - c_dataTypeDialog
  1006. native void         DataTableSetDialog (bool global, string name, int val);
  1007. native int          DataTableGetDialog (bool global, string name);
  1008.  
  1009. // - c_dataTypeDoodad
  1010. native void         DataTableSetDoodad (bool global, string name, doodad val);
  1011. native doodad       DataTableGetDoodad (bool global, string name);
  1012.  
  1013. // - c_dataTypeFixed
  1014. native void         DataTableSetFixed (bool global, string name, fixed val);
  1015. native fixed        DataTableGetFixed (bool global, string name);
  1016.  
  1017. // - c_dataTypeInt
  1018. native void         DataTableSetInt (bool global, string name, int val);
  1019. native int          DataTableGetInt (bool global, string name);
  1020.  
  1021. // - c_dataTypeMarker
  1022. native void         DataTableSetMarker (bool global, string name, marker val);
  1023. native marker       DataTableGetMarker (bool global, string name);
  1024.  
  1025. // - c_dataTypeObjective
  1026. native void         DataTableSetObjective (bool global, string name, int val);
  1027. native int          DataTableGetObjective (bool global, string name);
  1028.  
  1029. // - c_dataTypeOrder
  1030. native void         DataTableSetOrder (bool global, string name, order val);
  1031. native order        DataTableGetOrder (bool global, string name);
  1032.  
  1033. // - c_dataTypePing
  1034. native void         DataTableSetPing (bool global, string name, int val);
  1035. native int          DataTableGetPing (bool global, string name);
  1036.  
  1037. // - c_dataTypePlanet
  1038. native void         DataTableSetPlanet (bool global, string name, int val);
  1039. native int          DataTableGetPlanet (bool global, string name);
  1040.  
  1041. // - c_dataTypePlayerGroup
  1042. native void         DataTableSetPlayerGroup (bool global, string name, playergroup val);
  1043. native playergroup  DataTableGetPlayerGroup (bool global, string name);
  1044.  
  1045. // - c_dataTypePoint
  1046. native void         DataTableSetPoint (bool global, string name, point val);
  1047. native point        DataTableGetPoint (bool global, string name);
  1048.  
  1049. // - c_dataTypePortrait
  1050. native void         DataTableSetPortrait (bool global, string name, int val);
  1051. native int          DataTableGetPortrait (bool global, string name);
  1052.  
  1053. // - c_dataTypeRegion
  1054. native void         DataTableSetRegion (bool global, string name, region val);
  1055. native region       DataTableGetRegion (bool global, string name);
  1056.  
  1057. // - c_dataTypeReply
  1058. native void         DataTableSetReply (bool global, string name, int val);
  1059. native int          DataTableGetReply (bool global, string name);
  1060.  
  1061. // - c_dataTypeRevealer
  1062. native void         DataTableSetRevealer (bool global, string name, revealer val);
  1063. native revealer     DataTableGetRevealer (bool global, string name);
  1064.  
  1065. // - c_dataTypeRoom
  1066. native void         DataTableSetRoom (bool global, string name, int val);
  1067. native int          DataTableGetRoom (bool global, string name);
  1068.  
  1069. // - c_dataTypeSound
  1070. native void         DataTableSetSound (bool global, string name, sound val);
  1071. native sound        DataTableGetSound (bool global, string name);
  1072.  
  1073. // - c_dataTypeSoundLink
  1074. native void         DataTableSetSoundLink (bool global, string name, soundlink val);
  1075. native soundlink    DataTableGetSoundLink (bool global, string name);
  1076.  
  1077. // - c_dataTypeString
  1078. native void         DataTableSetString (bool global, string name, string val);
  1079. native string       DataTableGetString (bool global, string name);
  1080.  
  1081. // - c_dataTypeText
  1082. native void         DataTableSetText (bool global, string name, text val);
  1083. native text         DataTableGetText (bool global, string name);
  1084.  
  1085. // - c_dataTypeTimer
  1086. native void         DataTableSetTimer (bool global, string name, timer val);
  1087. native timer        DataTableGetTimer (bool global, string name);
  1088.  
  1089. // - c_dataTypeTransmission
  1090. native void         DataTableSetTransmission (bool global, string name, int val);
  1091. native int          DataTableGetTransmission (bool global, string name);
  1092.  
  1093. // - c_dataTypeTransmissionSource
  1094. native void                 DataTableSetTransmissionSource (bool global, string name, transmissionsource val);
  1095. native transmissionsource   DataTableGetTransmissionSource (bool global, string name);
  1096.  
  1097. // - c_dataTypeTrigger
  1098. native void         DataTableSetTrigger (bool global, string name, trigger val);
  1099. native trigger      DataTableGetTrigger (bool global, string name);
  1100.  
  1101. // - c_dataTypeUnit
  1102. native void         DataTableSetUnit (bool global, string name, unit val);
  1103. native unit         DataTableGetUnit (bool global, string name);
  1104.  
  1105. // - c_dataTypeUnitFilter
  1106. native void         DataTableSetUnitFilter (bool global, string name, unitfilter val);
  1107. native unitfilter   DataTableGetUnitFilter (bool global, string name);
  1108.  
  1109. // - c_dataTypeUnitGroup
  1110. native void         DataTableSetUnitGroup (bool global, string name, unitgroup val);
  1111. native unitgroup    DataTableGetUnitGroup (bool global, string name);
  1112.  
  1113. // - c_dataTypeUnitRef
  1114. native void         DataTableSetUnitRef (bool global, string name, unitref val);
  1115. native unitref      DataTableGetUnitRef (bool global, string name);
  1116.  
  1117. // - c_dataTypeWave
  1118. native void         DataTableSetWave (bool global, string name, wave val);
  1119. native wave         DataTableGetWave (bool global, string name);
  1120.  
  1121. // - c_dataTypeWaveInfo
  1122. native void         DataTableSetWaveInfo (bool global, string name, waveinfo val);
  1123. native waveinfo     DataTableGetWaveInfo (bool global, string name);
  1124.  
  1125. // - c_dataTypeWaveTarget
  1126. native void         DataTableSetWaveTarget (bool global, string name, wavetarget val);
  1127. native wavetarget   DataTableGetWaveTarget (bool global, string name);
  1128.  
  1129. //--------------------------------------------------------------------------------------------------
  1130. // Dialogs
  1131. //--------------------------------------------------------------------------------------------------
  1132. const int c_invalidDialogId     = 0;
  1133.  
  1134. native int      DialogCreate (
  1135.                     int width,
  1136.                     int height,
  1137.                     int anchor,
  1138.                     int offsetX,
  1139.                     int offsetY,
  1140.                     bool modal
  1141.                 );
  1142. native int      DialogLastCreated ();
  1143. native void     DialogDestroy (int dialog);
  1144. native void     DialogDestroyAll ();
  1145.  
  1146. native void     DialogSetSubtitlePositionOverride (int dialog);
  1147. native void     DialogClearSubtitlePositionOverride ();
  1148.  
  1149. native void     DialogSetTitle (int dialog, text title);
  1150. native void     DialogSetSize (int dialog, int width, int height);
  1151. native void     DialogSetPosition (int dialog, int anchor, int offsetX, int offsetY);
  1152. native void     DialogSetPositionRelative (int dialog, int anchor, int relative, int relativeAnchor, int offsetX, int offsetY);
  1153. native void     DialogSetVisible (int dialog, playergroup players, bool isVisible);
  1154. native void     DialogSetTransparency (int dialog, fixed inTransparency);
  1155. native void     DialogSetImage (int dialog, string image);
  1156. native void     DialogSetImageVisible (int dialog, bool isVisible);
  1157. native void     DialogSetOffscreen (int dialog, bool isOffscreen);
  1158. native void     DialogSetFullscreen (int dialog, bool isFullscreen);
  1159. native void     DialogSetChannel (int dialog, int channel);
  1160.  
  1161. native bool     DialogIsModal (int dialog);
  1162. native text     DialogGetTitle (int dialog);
  1163. native int      DialogGetWidth (int dialog);
  1164. native int      DialogGetHeight (int dialog);
  1165. native int      DialogGetAnchor (int dialog);
  1166. native int      DialogGetRelativeDialog (int dialog);
  1167. native int      DialogGetRelativeAnchor (int dialog);
  1168. native int      DialogGetOffsetX (int dialog);
  1169. native int      DialogGetOffsetY (int dialog);
  1170. native bool     DialogIsVisible (int dialog, int player);
  1171. native fixed    DialogGetTransparency (int dialog);
  1172. native string   DialogGetImage (int dialog);
  1173. native bool     DialogIsImageVisible (int dialog);
  1174. native bool     DialogIsOffscreen (int dialog);
  1175. native bool     DialogIsFullscreen (int dialog);
  1176. native int      DialogGetChannel (int dialog);
  1177.  
  1178. // Control types
  1179. const int c_triggerControlTypeInvalid                   = 0;
  1180. const int c_triggerControlTypeLabel                     = 1;
  1181. const int c_triggerControlTypeImage                     = 2;
  1182. const int c_triggerControlTypeButton                    = 3;
  1183. const int c_triggerControlTypeCheckBox                  = 4;
  1184. const int c_triggerControlTypeListBox                   = 5;
  1185. const int c_triggerControlTypePulldown                  = 6;
  1186. const int c_triggerControlTypeProgressBar               = 7;
  1187. const int c_triggerControlTypeSlider                    = 8;
  1188. const int c_triggerControlTypeEditBox                   = 9;
  1189. const int c_triggerControlTypeAchievement               = 11;
  1190.  
  1191. // Control properties
  1192. const int c_triggerControlPropertyInvalid               = 0;
  1193. const int c_triggerControlPropertyText                  = 1;        // text
  1194. const int c_triggerControlPropertyStyle                 = 3;        // string
  1195. const int c_triggerControlPropertyImage                 = 4;        // string
  1196. const int c_triggerControlPropertyImageType             = 5;        // int
  1197. const int c_triggerControlPropertyColor                 = 6;        // color
  1198. const int c_triggerControlPropertyChecked               = 7;        // bool
  1199. const int c_triggerControlPropertyMinValue              = 8;        // fixed
  1200. const int c_triggerControlPropertyMaxValue              = 9;        // fixed
  1201. const int c_triggerControlPropertyValue                 = 10;       // fixed
  1202. const int c_triggerControlPropertyTooltip               = 11;       // text
  1203. const int c_triggerControlPropertyVisible               = 12;       // bool
  1204. const int c_triggerControlPropertyEnabled               = 13;       // bool
  1205. const int c_triggerControlPropertyWidth                 = 14;       // int
  1206. const int c_triggerControlPropertyHeight                = 15;       // int
  1207. const int c_triggerControlPropertyAnchor                = 16;       // int
  1208. const int c_triggerControlPropertyRelative              = 17;       // int
  1209. const int c_triggerControlPropertyRelativeAnchor        = 18;       // int
  1210. const int c_triggerControlPropertyOffsetX               = 19;       // int
  1211. const int c_triggerControlPropertyOffsetY               = 20;       // int
  1212. const int c_triggerControlPropertyEditText              = 21;       // string
  1213. const int c_triggerControlPropertyItemCount             = 22;       // int
  1214. const int c_triggerControlPropertySelectionIndex        = 23;       // int
  1215. const int c_triggerControlPropertyFile                  = 24;       // string
  1216. const int c_triggerControlPropertyOffscreen             = 25;       // bool
  1217. const int c_triggerControlPropertyChannel               = 26;       // int
  1218. const int c_triggerControlPropertyFullDialog            = 27;       // bool
  1219. const int c_triggerControlPropertyTextWriteout          = 28;       // bool
  1220. const int c_triggerControlPropertyTextWriteoutDuration  = 29;       // fixed
  1221. const int c_triggerControlPropertyBlendMode             = 30;       // int
  1222. const int c_triggerControlPropertyHoverImage            = 31;       // string
  1223. const int c_triggerControlPropertyTiled                 = 32;       // bool
  1224. const int c_triggerControlPropertyRotation              = 33;       // int
  1225. const int c_triggerControlPropertyAchievement           = 34;       // string
  1226. const int c_triggerControlPropertyRenderPriority        = 35;       // int
  1227.  
  1228. // Image types
  1229. const int c_triggerImageTypeNone                        = 0;
  1230. const int c_triggerImageTypeNormal                      = 1;
  1231. const int c_triggerImageTypeBorder                      = 2;
  1232. const int c_triggerImageTypeHorizontalBorder            = 3;
  1233. const int c_triggerImageTypeEndCap                      = 4;
  1234.  
  1235. // Blend Modes
  1236. const int c_triggerBlendModeNormal            = 0;  
  1237. const int c_triggerBlendModeMultiply          = 1;    
  1238. const int c_triggerBlendModeLighten           = 2;
  1239. const int c_triggerBlendModeDarken            = 3;    
  1240. const int c_triggerBlendModeAdd               = 4;
  1241. const int c_triggerBlendModeSubtract          = 5;    
  1242. const int c_triggerBlendModeAlpha             = 6;  
  1243.    
  1244. // Item constants
  1245. const int c_invalidDialogControlId                      = 0;
  1246.  
  1247. const int c_dialogControlItemNone                       = -1;
  1248.  
  1249. // Controls
  1250. native int      DialogControlCreate (int dialog, int type);
  1251. native int      DialogControlCreateFromTemplate (int dialog, int type, string inTemplate);
  1252. native int      DialogControlLastCreated ();
  1253. native void     DialogControlDestroy (int control);
  1254. native void     DialogControlDestroyAll (int dialog);
  1255.  
  1256. native void     DialogControlSetSize (int control, playergroup players, int width, int height);
  1257. native void     DialogControlSetPosition (int control, playergroup players, int anchor, int offsetX, int offsetY);
  1258. native void     DialogControlSetPositionRelative (int control, playergroup players, int anchor, int relative, int relativeAnchor, int offsetX, int offsetY);
  1259. native void     DialogControlSetVisible (int control, playergroup players, bool isVisible);
  1260. native void     DialogControlSetEnabled (int control, playergroup players, bool isEnabled);
  1261. native void     DialogControlSetFullDialog (int control, playergroup players, bool isFullDialog);
  1262. native void     DialogControlFadeTransparency  (int control, playergroup players, fixed fadeTime, fixed inTargetTransparency);
  1263.  
  1264. native int      DialogControlGetType (int control);
  1265. native int      DialogControlGetWidth (int control, int player);
  1266. native int      DialogControlGetHeight (int control, int player);
  1267. native int      DialogControlGetAnchor (int control, int player);
  1268. native int      DialogControlGetRelativeControl (int control, int player);
  1269. native int      DialogControlGetRelativeAnchor (int control, int player);
  1270. native int      DialogControlGetOffsetX (int control, int player);
  1271. native int      DialogControlGetOffsetY (int control, int player);
  1272. native bool     DialogControlIsVisible (int control, int player);
  1273. native bool     DialogControlIsEnabled (int control, int player);
  1274. native bool     DialogControlIsFullDialog (int control, int player);
  1275.  
  1276. native void     DialogControlSetPropertyAsText (int control, int property, playergroup players, text value);
  1277. native void     DialogControlSetPropertyAsString (int control, int property, playergroup players, string value);
  1278. native void     DialogControlSetPropertyAsInt (int control, int property, playergroup players, int value);
  1279. native void     DialogControlSetPropertyAsFixed (int control, int property, playergroup players, fixed value);
  1280. native void     DialogControlSetPropertyAsBool (int control, int property, playergroup players, bool value);
  1281. native void     DialogControlSetPropertyAsColor (int control, int property, playergroup players, color value);
  1282. native void     DialogControlSetPropertyAsControl (int control, int property, playergroup players, int value);
  1283.  
  1284. native text     DialogControlGetPropertyAsText (int control, int property, int player);
  1285. native string   DialogControlGetPropertyAsString (int control, int property, int player);
  1286. native int      DialogControlGetPropertyAsInt (int control, int property, int player);
  1287. native fixed    DialogControlGetPropertyAsFixed (int control, int property, int player);
  1288. native bool     DialogControlGetPropertyAsBool (int control, int property, int player);
  1289. native color    DialogControlGetPropertyAsColor (int control, int property, int player);
  1290. native int      DialogControlGetPropertyAsControl (int control, int property, int player);
  1291.  
  1292. native void     DialogControlAddItem (int control, playergroup players, text value);
  1293. native void     DialogControlRemoveItem (int control, playergroup players, int index);
  1294. native void     DialogControlRemoveAllItems (int control, playergroup players);
  1295. native void     DialogControlSelectItem (int control, playergroup players, int index);
  1296. native int      DialogControlGetItemCount (int control, int player);
  1297. native int      DialogControlGetSelectedItem (int control, int player);
  1298.  
  1299. native void     DialogControlInvokeAsText (int control, playergroup players, string method, text param1, text param2, text param3, text param4); // Blizzard maps only
  1300. native void     DialogControlInvokeAsString (int control, playergroup players, string method, string param1, string param2, string param3, string param4); // Blizzard maps only
  1301.  
  1302. // Dialog events
  1303. const int c_dialogControlAny = -1;
  1304.  
  1305. const int c_triggerControlEventTypeAny                       = -1;
  1306. const int c_triggerControlEventTypeClick                     = 0;
  1307. const int c_triggerControlEventTypeChecked                   = 1;
  1308. const int c_triggerControlEventTypeValueChanged              = 2;
  1309. const int c_triggerControlEventTypeSelectionChanged          = 3;
  1310. const int c_triggerControlEventTypeSelectionDoubleClicked    = 4;
  1311. const int c_triggerControlEventTypeTextChanged               = 5;
  1312.  
  1313. native void     TriggerAddEventDialogControl (trigger t, int player, int control, int eventType);
  1314.  
  1315. native int      EventDialogControl ();
  1316. native int      EventDialogControlEventType ();
  1317.  
  1318. //--------------------------------------------------------------------------------------------------
  1319. // Environment
  1320. //--------------------------------------------------------------------------------------------------
  1321. // Time Of Day
  1322. native string   GameTimeOfDayGet ();
  1323. native void     GameTimeOfDaySet (string x);
  1324. native fixed    GameTimeOfDayGetLength ();  // Length of a day in game time seconds
  1325. native void     GameTimeOfDaySetLength (fixed inSecs);
  1326. native void     GameTimeOfDayPause (bool inPause);
  1327. native bool     GameTimeOfDayIsPaused ();
  1328.  
  1329. // Creep
  1330. native int      CreepAdjacent (point inPos);
  1331. native bool     CreepIsPresent (point inPos);
  1332. native void     CreepModify (point inPos, fixed inRadius, bool inAdd, bool inPermanent);
  1333.  
  1334. const int c_creepSpeedGrowth    = 0;
  1335. const int c_creepSpeedDecay     = 1;
  1336. const int c_creepSpeedBlend     = 2;
  1337.  
  1338. native void     CreepSetSpeed (int inType, fixed inPercent);
  1339.  
  1340. // Pathing
  1341. // - Modifications made using PathingModify will only take effect after:
  1342. //   a) PathingUpdate is called
  1343. //   - OR -
  1344. //   b) The end of the game loop
  1345. //
  1346. // - PathingReset resets *all* trigger-based modifications
  1347. //
  1348. const int c_pathingNoPathing    = 0;
  1349. const int c_pathingNoBuilding   = 1;
  1350. const int c_pathingGround       = 2;
  1351.  
  1352. native void     PathingModify (region inArea, int inType, bool inAdd);
  1353. native void     PathingUpdate ();
  1354. native void     PathingReset ();
  1355.  
  1356. // Power
  1357. native int      PowerLevel (int inPlayer, point inPos);
  1358. native bool     PowerIsProvidedBy (int inPlayer, point inPos, unit inSource, int inMinLevel);
  1359.  
  1360. // Height
  1361. native int      CliffLevel (point inPos);
  1362. native fixed    WorldHeight (int inType, point inPos);  // inType uses the c_heightMap<*> values
  1363.  
  1364. // Miscellaneous
  1365. const int c_backgroundFixed     = 0; // Attached to camera position (never appears to move)
  1366. const int c_backgroundTerrain   = 1; // Attached to terrain (moves as camera scrolls)
  1367.  
  1368. native void     GameSetLighting (string inId, fixed inBlendTime);
  1369. native void     GameSetToDLighting (string inId);
  1370. native void     SelectMainShadowLight (string inId);
  1371. native void     GameSetBackground (int inType, string inModel, fixed inAnimSpeed);
  1372. native void     GameDestroyEffects (point pos, fixed radius, int maxCount, string effectType);
  1373.  
  1374. native void     TerrainShowRegion (region inArea, bool inShow);
  1375.  
  1376. const int c_wtcLinear       = 0;
  1377. const int c_wtcSine         = 1;
  1378. const int c_wtcExponential  = 2;
  1379. const int c_wtcSquareRoot   = 3;
  1380.  
  1381. // First parameter is Water Template + Water State in one string, delimited by |
  1382. native void     WaterSetState (string inWater, fixed inDuration, int inMorphType);
  1383.  
  1384. // Fog
  1385. native void     FogSetEnabled (bool f);
  1386. native void     FogSetDensity (fixed d);
  1387. native void     FogSetColor (color c);
  1388. native void     FogSetFallOff (fixed f);
  1389. native void     FogSetStartHeight (fixed h);
  1390.  
  1391. // General environment visibility
  1392. const int c_environmentAll                  = 0;    // All of the below
  1393. const int c_environmentTerrain              = 1;
  1394. const int c_environmentWater                = 2;
  1395. const int c_environmentDoodads              = 3;
  1396. const int c_environmentBackgroundFixed      = 4;
  1397. const int c_environmentBackgroundTerrain    = 5;
  1398.  
  1399. native void     EnvironmentShow (int inType, bool inShow);
  1400.  
  1401. //--------------------------------------------------------------------------------------------------
  1402. // Game
  1403. //--------------------------------------------------------------------------------------------------
  1404. native bool     ConsoleCommand (string inText, bool allowDefault, bool allowMacros);
  1405. native bool     GameIsDebugOptionSet (string inOptionName, int player);
  1406.  
  1407. const int c_gameSpeedSlower     = 0;
  1408. const int c_gameSpeedSlow       = 1;
  1409. const int c_gameSpeedNormal     = 2;
  1410. const int c_gameSpeedFast       = 3;
  1411. const int c_gameSpeedFaster     = 4;
  1412.  
  1413. native text     GameMapName ();
  1414. native text     GameMapDescription ();
  1415.  
  1416. native fixed    GameGetSpeed ();
  1417. native void     GameSetSpeedValue (int speed);
  1418. native int      GameGetSpeedValue ();
  1419. native void     GameSetSpeedValueMinimum (int speed);
  1420. native int      GameGetSpeedValueMinimum ();
  1421. native void     GameSetSpeedLocked (bool isLocked);
  1422. native bool     GameIsSpeedLocked ();
  1423.  
  1424. native string   GameAttributeGameValue (string name);
  1425. native string   GameAttributePlayerValue (string name, int player);
  1426.  
  1427. native void     GameSetSeedLocked (bool locked);
  1428. native bool     GameIsSeedLocked ();
  1429.  
  1430. native void     GameSetAbsoluteTimeRemaining (fixed inTime);
  1431. native fixed    GameGetAbsoluteTimeRemaining ();
  1432. native void     GameSetAbsoluteTimeRemainingPaused (bool inPaused);
  1433. native bool     GameGetAbsoluteTimeRemainingPaused ();
  1434.  
  1435. native void     GamePauseAllCharges (bool inPaused);
  1436. native void     GamePauseAllCooldowns (bool inPaused);
  1437.  
  1438. native void     GameAddChargeRegen (string inCharge, fixed inVal);
  1439. native fixed    GameGetChargeRegen (string inCharge);
  1440. native void     GameAddChargeUsed (string inCharge, fixed inVal);
  1441. native fixed    GameGetChargeUsed (string inCharge);
  1442.  
  1443. native void     GameAddCooldown (string inCooldown, fixed inVal);
  1444. native fixed    GameGetCooldown (string inCooldown);
  1445.  
  1446. native bool     GameIsTestMap (bool inAuto);
  1447.  
  1448. native void     GameSetNextMap (string inMap);
  1449. native void     SetNextMissionDifficulty (playergroup inPlayerGroup, int inDifficultyLevel);
  1450. native bool     GameIsTransitionMap ();
  1451. native void     GameSetTransitionMap (string transitionMap);
  1452.  
  1453. native string   GameTerrainSet ();
  1454. native void     GameWaitForResourcesToComplete ();
  1455.  
  1456. const int c_gameOverVictory = 0;
  1457. const int c_gameOverDefeat  = 1;
  1458. const int c_gameOverTie     = 2;
  1459.  
  1460. native void     GameOver (int player, int type, bool showDialog, bool showScore);
  1461. native void     RestartGame (playergroup inPlayerGroup);
  1462.  
  1463. // Game Events
  1464. native void     TriggerAddEventMapInit (trigger t);
  1465. native void     TriggerAddEventSaveGame (trigger t);
  1466. native void     TriggerAddEventChatMessage (trigger t, int player, string inText, bool exact);
  1467.  
  1468. native string   EventChatMessage (bool matchedOnly);
  1469.  
  1470. //--------------------------------------------------------------------------------------------------
  1471. // Looping
  1472. //
  1473. // Convenience functions to allow for loops without creating any local variables.
  1474. // Notes:
  1475. // - The loop data is stored locally to the executing thread
  1476. // - Nested loops (of the same type) are not supported, and will produce a run-time error
  1477. //
  1478. //--------------------------------------------------------------------------------------------------
  1479. // Integer
  1480. // - Start and end are inclusive
  1481. //
  1482. native void IntLoopBegin (int start, int end);
  1483. native void IntLoopStep ();
  1484. native bool IntLoopDone ();
  1485. native int  IntLoopCurrent ();
  1486. native void IntLoopEnd ();
  1487.  
  1488. // Player group
  1489. native void PlayerGroupLoopBegin (playergroup g);
  1490. native void PlayerGroupLoopStep ();
  1491. native bool PlayerGroupLoopDone ();
  1492. native int  PlayerGroupLoopCurrent ();
  1493. native void PlayerGroupLoopEnd ();
  1494.  
  1495. // Unit group
  1496. native void UnitGroupLoopBegin (unitgroup g);
  1497. native void UnitGroupLoopStep ();
  1498. native bool UnitGroupLoopDone ();
  1499. native unit UnitGroupLoopCurrent ();
  1500. native void UnitGroupLoopEnd ();
  1501.  
  1502. //--------------------------------------------------------------------------------------------------
  1503. // Markers
  1504. //--------------------------------------------------------------------------------------------------
  1505. native marker   Marker (string link);
  1506. native marker   MarkerCastingPlayer (string link, int player);
  1507. native marker   MarkerCastingUnit (string link, unit u);
  1508.  
  1509. native void     MarkerSetCastingPlayer (marker m, int player);
  1510. native int      MarkerGetCastingPlayer (marker m);
  1511.  
  1512. native void     MarkerSetCastingUnit (marker m, unit u);
  1513. native unit     MarkerGetCastingUnit (marker m);
  1514.  
  1515. native void     MarkerSetMatchFlag (marker m, int flag, bool state);
  1516. native bool     MarkerGetMatchFlag (marker m, int flag);
  1517.  
  1518. native void     MarkerSetMismatchFlag (marker m, int flag, bool state);
  1519. native bool     MarkerGetMismatchFlag (marker m, int flag);
  1520.  
  1521. //--------------------------------------------------------------------------------------------------
  1522. // Math
  1523. //--------------------------------------------------------------------------------------------------
  1524. // General math
  1525. native fixed SquareRoot (fixed x);
  1526. native fixed Pow (fixed x, fixed power);
  1527. native fixed ModF (fixed x, fixed m);
  1528. native fixed MinF (fixed x1, fixed x2);
  1529. native fixed MaxF (fixed x1, fixed x2);
  1530. native fixed AbsF (fixed x);
  1531.  
  1532. native int   ModI (int x, int m);
  1533. native int   MinI (int x1, int x2);
  1534. native int   MaxI (int x1, int x2);
  1535. native int   AbsI (int x);
  1536.  
  1537. // Trigonometry
  1538. // Note: All angles are in degrees
  1539. native fixed Sin (fixed degrees);
  1540. native fixed Cos (fixed degrees);
  1541. native fixed Tan (fixed degrees);
  1542. native fixed ASin (fixed x);
  1543. native fixed ACos (fixed x);
  1544. native fixed ATan (fixed x);
  1545. native fixed ATan2 (fixed y, fixed x);
  1546.  
  1547. // Random
  1548. // Note: Bounds are inclusive
  1549. //
  1550. native int RandomInt (int min, int max);
  1551. native fixed RandomFixed (fixed min, fixed max);
  1552. bool OneIn (int value) { return RandomInt(1, value) == 1; }
  1553.  
  1554. //--------------------------------------------------------------------------------------------------
  1555. // Melee
  1556. //
  1557. // Game initialization and configuration associated with standard melee games
  1558. //--------------------------------------------------------------------------------------------------
  1559. native void     MeleeInitResourcesForPlayer (int player, string race);
  1560. native void     MeleeInitResources ();
  1561.  
  1562. native void     MeleeInitUnitsForPlayer (int player, string race, point position);
  1563. native void     MeleeInitUnits ();
  1564.  
  1565. native void     MeleeInitAI ();
  1566.  
  1567. const int c_meleeOptionReveal   = 0;
  1568. const int c_meleeOptionDefeat   = 1;
  1569. const int c_meleeOptionVictory  = 2;
  1570.  
  1571. native void     MeleeSetOption (int player, int option, bool value);
  1572. native bool     MeleeGetOption (int player, int option);
  1573. native void     MeleeInitOptions ();
  1574.  
  1575. //--------------------------------------------------------------------------------------------------
  1576. // Mercenary
  1577. //--------------------------------------------------------------------------------------------------
  1578. const int c_invalidMercenaryId              = 0;
  1579.  
  1580. const int c_mercenaryStateEnabled           = 0;
  1581. const int c_mercenaryStateDisabled          = 1;
  1582. const int c_mercenaryStatePurchased         = 2;
  1583. const int c_mercenaryStateHidden            = 3;
  1584. const int c_mercenaryStateNew               = 4;
  1585.  
  1586. native int      MercenaryCreate (playergroup inPlayerGroup, int inState);
  1587. native int      MercenaryLastCreated ();
  1588. native void     MercenaryDestroy (int inMercenaryId);
  1589.  
  1590. native void     MercenarySetPlayerGroup (int inMercenaryId, playergroup inPlayerGroup);
  1591. native void     MercenarySetState (int inMercenaryId, int inState);
  1592. native void     MercenarySetCost (int inMercenaryId, int inCost);
  1593. native void     MercenarySetTitleText (int inMercenaryId, text inText);
  1594. native void     MercenarySetDescriptionText (int inMercenaryId, text inText);
  1595. native void     MercenarySetCostText (int inMercenaryId, text inText);
  1596. native void     MercenarySetUnitText (int inMercenaryId, text inText);
  1597. native void     MercenarySetAvailabilityText (int inMercenaryId, text inText);
  1598. native void     MercenarySetSpecialText (int inMercenaryId, text inText);
  1599. native void     MercenarySetTooltipText (int inMercenaryId, text inText);
  1600. native void     MercenarySetModelLink (int inMercenaryId, string inModelLink);
  1601. native void     MercenarySetScenePath (int inMercenaryId, string inFilePath);
  1602. native void     MercenarySetImageFilePath (int inMercenaryId, string inFilePath);
  1603. native void     MercenarySetRecentlyPurchased (int inMercenaryId, bool inRecent);
  1604. native void     MercenaryPurchase (int inMercenaryId);
  1605.  
  1606. native bool     MercenaryIsRecentlyPurchased (int inMercenaryId);
  1607.  
  1608. native void     MercenarySetSelected (playergroup inPlayerGroup, int inMercenaryId);
  1609. native int      MercenaryGetSelected (int player);
  1610.  
  1611. // Mercenary events
  1612. native void     TriggerAddEventMercenaryPanelExit (trigger t, int player);
  1613. native void     TriggerAddEventMercenaryPanelPurchase (trigger t, int player);
  1614. native void     TriggerAddEventMercenaryPanelSelectionChanged (trigger t, int player, int inMercenaryId);
  1615.                
  1616. //--------------------------------------------------------------------------------------------------
  1617. // Minimap
  1618. //--------------------------------------------------------------------------------------------------
  1619. native void     MinimapPing (playergroup players, point position, fixed duration, color c);
  1620.  
  1621. //--------------------------------------------------------------------------------------------------
  1622. // Misc
  1623. //--------------------------------------------------------------------------------------------------
  1624. native void    PerfTestStart (text name);
  1625. native void    PerfTestStop ();
  1626. native void    PerfTestGetFPS ();
  1627. native void    UnitStatsStart (text name, text unitName, text unitFood);
  1628. native void    UnitStatsStop ();
  1629. native void    EngineReset ();
  1630.  
  1631. //--------------------------------------------------------------------------------------------------
  1632. // Movie
  1633. //--------------------------------------------------------------------------------------------------
  1634. native void     MoviePlayAfterGame (playergroup players, string assetLink);
  1635.  
  1636. native void     TriggerAddEventMovieStarted (trigger t, int player);
  1637. native void     TriggerAddEventMovieFinished (trigger t, int player);
  1638. native void     TriggerAddEventMovieFunction (trigger t, int player, string functionName);
  1639.  
  1640. //--------------------------------------------------------------------------------------------------
  1641. // Objectives
  1642. //--------------------------------------------------------------------------------------------------
  1643. const int c_invalidObjectiveId          = 0;
  1644.  
  1645. const int c_primaryObjectivesId         = 1;
  1646. const int c_secondaryObjectivesId       = 2;
  1647.  
  1648. const int c_objectiveStateUnknown       = -1;
  1649. const int c_objectiveStateHidden        = 0;
  1650. const int c_objectiveStateActive        = 1;
  1651. const int c_objectiveStateCompleted     = 2;
  1652. const int c_objectiveStateFailed        = 3;
  1653.  
  1654. native int  ObjectiveCreate3 (
  1655.                 text inName,
  1656.                 text inDescription,
  1657.                 int inState,
  1658.                 bool inVisible,
  1659.                 bool inPrimary
  1660.             );
  1661.  
  1662. native int          ObjectiveLastCreated ();
  1663. native void         ObjectiveDestroy (int inObjective);
  1664. native void         ObjectiveDestroyAll (playergroup inPlayers);
  1665.  
  1666. native void         ObjectiveShow (int inObjective, playergroup inPlayers, bool inShow);
  1667. native bool         ObjectiveVisible (int inObjective, int inPlayer);
  1668.  
  1669. native void         ObjectiveSetName (int inObjective, text inName);
  1670. native text         ObjectiveGetName (int inObjective);
  1671.  
  1672. native void         ObjectiveSetDescription (int inObjective, text inText);
  1673. native text         ObjectiveGetDescription (int inObjective);
  1674.  
  1675. native void         ObjectiveSetState (int inObjective, int inState);
  1676. native int          ObjectiveGetState (int inObjective);
  1677.  
  1678. native void         ObjectiveSetPlayerGroup (int inObjective, playergroup inPlayers);
  1679. native playergroup  ObjectiveGetPlayerGroup (int inObjective);
  1680.  
  1681. native void         ObjectiveSetPrimary (int inObjective, bool inPrimary);
  1682. native bool         ObjectiveGetPrimary (int inObjective);
  1683.  
  1684. //--------------------------------------------------------------------------------------------------
  1685. // Orders
  1686. // - Use a "null" abilcmd for "smart" orders (automatically determine ability based on target)
  1687. //--------------------------------------------------------------------------------------------------
  1688. native abilcmd  AbilityCommand (string inAbil, int inCmdIndex);
  1689. native string   AbilityCommandGetAbility (abilcmd inAbilCmd);
  1690. native int      AbilityCommandGetCommand (abilcmd inAbilCmd);
  1691.  
  1692. // - Command "action" type, which can be used to determine if the command needs a target or not
  1693. //
  1694. const int c_cmdActionNone       = 0;
  1695. const int c_cmdActionInstant    = 1;
  1696. const int c_cmdActionTarget     = 2;
  1697.  
  1698. native int      AbilityCommandGetAction (abilcmd inAbilCmd);
  1699.  
  1700. native order    Order (abilcmd inAbilCmd);
  1701. native order    OrderTargetingPoint (abilcmd inAbilCmd, point inPoint);
  1702. native order    OrderTargetingRelativePoint (abilcmd inAbilCmd, point inPoint);
  1703. native order    OrderTargetingUnit (abilcmd inAbilCmd, unit inUnit);
  1704. native order    OrderTargetingUnitGroup (abilcmd inAbilCmd, unitgroup inUnitGroup);
  1705. native order    OrderTargetingItem (abilcmd inAbilCmd, unit inItem);
  1706. native order    OrderSetAutoCast (abilcmd inAbilCmd, bool inAutoCastOn);
  1707.  
  1708. native void     OrderSetAbilityCommand (order inOrder, abilcmd inAbilCmd);
  1709. native abilcmd  OrderGetAbilityCommand (order inOrder);
  1710.  
  1711. native void     OrderSetPlayer (order inOrder, int inPlayer);
  1712. native int      OrderGetPlayer (order inOrder);
  1713.  
  1714. const int c_orderTargetNone         = 0;
  1715. const int c_orderTargetPoint        = 1;
  1716. const int c_orderTargetUnit         = 2;
  1717. const int c_orderTargetItem         = 3;
  1718.  
  1719. native int      OrderGetTargetType (order inOrder);
  1720.  
  1721. native bool     OrderSetTargetPlacement (order inOrder, point inPoint, unit inPlacer, string inType);
  1722. native void     OrderSetTargetPoint (order inOrder, point inPoint);
  1723. native point    OrderGetTargetPoint (order inOrder);
  1724. native point    OrderGetTargetPosition (order inOrder); // doesn't care what the target type is
  1725.  
  1726. native void     OrderSetTargetUnit (order inOrder, unit inUnit);
  1727. native unit     OrderGetTargetUnit (order inOrder);
  1728. native void     OrderSetTargetPassenger (order inOrder, unit inUnit);
  1729.  
  1730. native void     OrderSetTargetItem (order inOrder, unit inItem);
  1731. native unit     OrderGetTargetItem (order inOrder);
  1732.  
  1733. native void     OrderSetFlag (order inOrder, int inFlag, bool inValue);
  1734. native bool     OrderGetFlag (order inOrder, int inFlag);
  1735.  
  1736. //--------------------------------------------------------------------------------------------------
  1737. // Ping
  1738. //--------------------------------------------------------------------------------------------------
  1739. const int c_invalidPingId = 0;
  1740.  
  1741. native int         PingCreate (
  1742.                         playergroup players,
  1743.                         string modelLink,
  1744.                         point position,
  1745.                         color intColor,
  1746.                         fixed duration
  1747.                     );
  1748. native int          PingLastCreated ();
  1749. native void         PingDestroy (int p);
  1750. native void         PingDestroyAll ();
  1751.  
  1752. native void         PingSetPlayerGroup (int p, playergroup playerMask);
  1753. native playergroup  PingGetPlayerGroup (int p);
  1754.  
  1755. native void         PingSetModel (int p, string modelLink);
  1756.  
  1757. native void         PingSetPosition (int p, point position);
  1758. native point        PingGetPosition (int p);
  1759.  
  1760. native void         PingSetScale (int p, fixed scale);
  1761. native fixed        PingGetScale (int p);
  1762.  
  1763. native void         PingSetRotation (int p, fixed rotation);
  1764. native fixed        PingGetRotation (int p);
  1765.  
  1766. native void         PingSetColor (int p, color intColor);
  1767. native color        PingGetColor (int p);
  1768.  
  1769. native void         PingSetDuration (int p, fixed duration);
  1770. native fixed        PingGetDuration (int p);
  1771.  
  1772. native void         PingSetUnit (int p, unit u);
  1773. native unit         PingGetUnit (int p);
  1774.  
  1775. native void         PingSetTooltip (int p, text tooltip);
  1776. native text         PingGetTooltip (int p);
  1777.  
  1778. native void         PingSetVisible (int p, bool isVisible);
  1779. native bool         PingIsVisible (int p);
  1780.  
  1781. //--------------------------------------------------------------------------------------------------
  1782. // Planet
  1783. //--------------------------------------------------------------------------------------------------
  1784. const int c_invalidPlanetId     = 0;
  1785.  
  1786. const int c_planetStateHidden       = 0;
  1787. const int c_planetStateActive       = 1;
  1788. const int c_planetStateEmphasized   = 2;
  1789.    
  1790. const int c_planetPanelContactButtonStateDisabled = 0;
  1791. const int c_planetPanelContactButtonStateBlinking = 1;
  1792. const int c_planetPanelContactButtonStatePlay = 2;    
  1793. const int c_planetPanelContactButtonStatePause = 3;  
  1794.    
  1795. native int          PlanetCreate (playergroup inPlayerGroup, int inState);
  1796. native int          PlanetLastCreated ();
  1797.  
  1798. native void         PlanetDestroy (int inPlanetId);
  1799. native void         PlanetDestroyAll (playergroup inPlayerGroup);
  1800.  
  1801. native void         PlanetSetSelected (playergroup inPlayerGroup, int inPlanetId);
  1802. native int          PlanetGetSelected (int player);
  1803. native void         PlanetClearSelected (playergroup inPlayerGroup);
  1804.  
  1805. native void         PlanetSetPlayerGroup (int inPlanetId, playergroup inPlayerGroup);
  1806. native void         PlanetSetState (int inPlanetId, int inState);
  1807. native void         PlanetSetPlanetName (int inPlanetId, text inText);
  1808. native void         PlanetSetDescriptionText (int inPlanetId, text inText);
  1809. native void         PlanetSetTooltipText (int inPlanetId, text inText);
  1810. native void         PlanetSetContactTooltipText (int inPlanetId, text inText);
  1811. native void         PlanetSetTechnologyTooltipText (int inPlanetId, text inText);
  1812. native void         PlanetSetMissionTitle (int inPlanetId, text inText);
  1813. native void         PlanetSetMissionName (int inPlanetId, text inText);
  1814. native void         PlanetSetPrimaryObjectiveTitle (int inPlanetId, text inText);
  1815. native void         PlanetSetPrimaryObjectiveText (int inPlanetId, text inText);
  1816. native void         PlanetSetSecondaryObjectiveTitle (int inPlanetId, text inText);
  1817. native void         PlanetSetSecondaryObjectiveText (int inPlanetId, text inText);
  1818. native void         PlanetSetRewardTitle (int inPlanetId, text inText);
  1819. native void         PlanetSetRewardText (int inPlanetId, text inText);
  1820. native void         PlanetSetResearchTitle (int inPlanetId, text inText);
  1821. native void         PlanetSetResearchText (int inPlanetId, text inText);
  1822. native void         PlanetSetBonusTitle (int inPlanetId, text inText);
  1823. native void         PlanetSetBonusText (int inPlanetId, text inText);
  1824. native void         PlanetSetPlanetText (int inPlanetId, text inText);
  1825. native void         PlanetSetTechnologyTitle (int inPlanetId, text inText);
  1826. native void         PlanetSetTechnologyName (int inPlanetId, text inText);
  1827. native void         PlanetSetTechnologyText (int inPlanetId, text inText);
  1828. native void         PlanetSetContactTitle (int inPlanetId, text inText);
  1829. native void         PlanetSetContactName (int inPlanetId, text inText);
  1830. native void         PlanetSetContactModelLink (int inPlanetId, string inContactModelLink);
  1831. native void         PlanetSetBackgroundModelLink (int inPlanetId, string inBackgroundModelLink);
  1832. native void         PlanetSetPlanetModelLink (int inPlanetId, string inPlanetModelLink);
  1833. native void         PlanetSetTechnologyIconFilePath (int inPlanetId, string inTechnologyIconFilePath);
  1834. native void         PlanetSetTechnologyUnitLink (int inPlanetId, string inUnitLink);
  1835.  
  1836. native void         PlanetPanelSetContactButtonState (playergroup players, int inState);
  1837. native int          PlanetPanelGetContactButtonState (int player);
  1838. native void         PlanetPanelSetBackButtonEnabled (playergroup players, bool inEnabled);
  1839. native void         PlanetPanelSetBackgroundImage (playergroup players, string inFilePath);
  1840.  
  1841. // Planet events
  1842. native void         TriggerAddEventPlanetMissionLaunched (trigger t, int player);
  1843. native void         TriggerAddEventPlanetMissionSelected (trigger t, int player, int planetId);
  1844. native void         TriggerAddEventPlanetPanelCanceled (trigger t, int player);
  1845. native void         TriggerAddEventPlanetPanelReplayPressed (trigger t, int player);
  1846. native void         TriggerAddEventPlanetPanelBirthComplete (trigger t, int player);
  1847. native void         TriggerAddEventPlanetPanelDeathComplete (trigger t, int player);
  1848.  
  1849. native int          EventPlanetPanelMissionSelected ();
  1850. native int          EventPlanetPanelDifficultySelected ();
  1851.  
  1852. //--------------------------------------------------------------------------------------------------
  1853. // Victory Panel
  1854. //--------------------------------------------------------------------------------------------------
  1855. native void         VictoryPanelSetMissionTitle (text inText);
  1856. native void         VictoryPanelSetMissionText (text inText);
  1857. native void         VictoryPanelSetMissionTimeTitle (text inText);
  1858. native void         VictoryPanelSetMissionTimeText (text inText);
  1859. native void         VictoryPanelSetRewardTitle (text inText);
  1860. native void         VictoryPanelSetRewardText (text inText);
  1861. native void         VictoryPanelSetRewardCredits (int inCredits);
  1862. native void         VictoryPanelSetAchievementsTitle (text inText);
  1863. native void         VictoryPanelSetStatisticsTitle (text inText);
  1864. native void         VictoryPanelSetCustomStatisticText (text inText);
  1865. native void         VictoryPanelSetCustomStatisticValue (text inText);
  1866. native void         VictoryPanelSetPlanetModelLink (string inModelLink);
  1867. native void         VictoryPanelAddCustomStatisticLine (text inText, text inValueText);
  1868. native void         VictoryPanelClearCustomStatisticTable ();
  1869. native void         VictoryPanelAddTrackedStatistic (string inStatistic);
  1870. native void         VictoryPanelAddAchievement (string inAchievement);
  1871.  
  1872. native void         TriggerAddEventVictoryPanelExit (trigger t, int player);
  1873. native void         TriggerAddEventVictoryPanelPlayMissionAgain (trigger t, int player);
  1874.  
  1875. native int          EventVictoryPanelDifficultySelected ();
  1876.  
  1877. //--------------------------------------------------------------------------------------------------
  1878. // Help
  1879. //--------------------------------------------------------------------------------------------------
  1880. const int c_helpPanelPageTips = 0;
  1881. const int c_helpPanelPageTutorials = 1;
  1882.  
  1883. native void         HelpPanelAddTip (playergroup players, text titleText, text descriptionText, text alertText, string iconPath);
  1884. native void         HelpPanelAddHint (playergroup players, text titleText, text descriptionText, string iconPath);
  1885. native void         HelpPanelAddTutorial (playergroup players, text titleText, text descriptionText, string iconPath, string moviePath, bool flashing);
  1886. native void         HelpPanelDisplayPage (playergroup players, int inPage);
  1887. native void         HelpPanelEnableTechTreeButton (playergroup inPlayerGroup, bool inEnable);
  1888. native void         HelpPanelEnableTechGlossaryButton (playergroup inPlayerGroup, bool inEnable);
  1889. native void         HelpPanelShowTechTreeRace (playergroup inPlayerGroup, string inRace, bool inShow);
  1890.  
  1891. native void         TipAlertPanelClear (playergroup inPlayerGroup);
  1892.  
  1893. //--------------------------------------------------------------------------------------------------
  1894. // Room
  1895. //--------------------------------------------------------------------------------------------------
  1896. const int c_invalidRoomId = 0;
  1897.  
  1898. native void         RoomPanelSetPositionUnit (unit inUnit);
  1899.  
  1900. native void         RoomPanelAddButton (playergroup players, text buttonText, string iconPath);
  1901. native int          RoomPanelLastAdded ();
  1902.  
  1903. native void         RoomPanelRemoveButton (int roomId);
  1904. native void         RoomPanelRemoveAllButtons (playergroup players);
  1905. native void         RoomPanelShowRoomButton (int roomId, playergroup players, bool isVisible);
  1906. native void         RoomPanelSetButtonPressedIcon (int inRoomId, string inPressedIconPath);
  1907. native void         RoomPanelSetButtonEnabled (int inRoomId, bool inEnabled);
  1908.  
  1909. // Room events
  1910. native void         TriggerAddEventRoomPanelPressedButton (trigger t, int player, int roomId);
  1911. native void         TriggerAddEventRoomPanelCanceled (trigger t, int player);
  1912.  
  1913. native void         TriggerAddEventRoomPanelMouseRollOver (trigger t, int player);
  1914. native void         TriggerAddEventRoomPanelMouseRollOut (trigger t, int player);
  1915.  
  1916. native int          EventRoomPanelButtonPressed ();
  1917.  
  1918. //--------------------------------------------------------------------------------------------------
  1919. // Players
  1920. //--------------------------------------------------------------------------------------------------
  1921. const int c_playerAny = -1;
  1922. const int c_maxPlayers = 32;
  1923.  
  1924. // Player properties
  1925. const int c_playerPropMinerals              = 0;
  1926. const int c_playerPropVespene               = 1;
  1927. const int c_playerPropTerrazine             = 2;
  1928. const int c_playerPropCustom                = 3;
  1929. const int c_playerPropSuppliesUsed          = 4;
  1930. const int c_playerPropSuppliesMade          = 5;
  1931. const int c_playerPropSuppliesLimit         = 6;
  1932. const int c_playerPropCredits               = 7;
  1933. const int c_playerPropCreditsSpent          = 8;
  1934. const int c_playerPropResearchPoints        = 9;
  1935. const int c_playerPropResearchPointsSpent   = 10;
  1936. const int c_playerPropHandicap              = 11;
  1937. const int c_playerPropMineralsCollected     = 12;
  1938. const int c_playerPropVespeneCollected      = 13;
  1939. const int c_playerPropTerrazineCollected    = 14;
  1940. const int c_playerPropCustomCollected       = 15;
  1941.  
  1942. // Player property operations
  1943. const int c_playerPropOperSetTo         = 0;
  1944. const int c_playerPropOperAdd           = 1;
  1945. const int c_playerPropOperSubtract      = 2;
  1946.  
  1947. native void     PlayerModifyPropertyInt (int inPlayer, int inProp, int inOper, int inVal);
  1948. native void     PlayerModifyPropertyFixed (int inPlayer, int inProp, int inOper, fixed inVal);
  1949.  
  1950. native int      PlayerGetPropertyInt (int inPlayer, int inProp);
  1951. native fixed    PlayerGetPropertyFixed (int inPlayer, int inProp);
  1952.  
  1953. // Player status
  1954. const int c_playerStatusUnused          = 0;    // No player in this slot
  1955. const int c_playerStatusActive          = 1;    // Player is actively playing
  1956. const int c_playerStatusLeft            = 2;    // Player has left the game
  1957.  
  1958. native int      PlayerStatus (int inPlayer);
  1959. native int      PlayerType (int inPlayer); // Returns c_playerType<*> value
  1960. native text     PlayerName (int inPlayer);
  1961. native string   PlayerRace (int inPlayer);
  1962. native int      PlayerDifficulty (int inPlayer);
  1963. native void     PlayerSetDifficulty (int inPlayer, int inDifficulty);
  1964. native point    PlayerStartLocation (int inPlayer);
  1965.  
  1966. native void     PlayerSetColorIndex (int inPlayer, int inIndex, bool inChangeUnits);
  1967. native int      PlayerGetColorIndex (int inPlayer, bool inDefault);
  1968. native text     PlayerColorName (int inColor);
  1969.  
  1970. native void PlayerSetAlliance (int inSourcePlayer, int inAllianceId, int inTargetPlayer, bool ally);
  1971. native bool PlayerGetAlliance (int inSourcePlayer, int inAllianceId, int inTargetPlayer);
  1972.  
  1973. // Player states
  1974. const int c_playerStateShowScore            = 0;
  1975. const int c_playerStateXPGain               = 1;
  1976. const int c_playerStateAbortEnabled         = 2;
  1977. const int c_playerStateRestartEnabled       = 3;
  1978. const int c_playerStateContinueEnabled      = 4;
  1979. const int c_playerStateShowWorldTip         = 5;
  1980. const int c_playerStateFidgetingEnabled     = 6;
  1981. const int c_playerStateDisplayInLeaderPanel = 7;
  1982. const int c_playerStateDisplayInViewMenu    = 8;
  1983.  
  1984. native void PlayerSetState (int inPlayer, int inState, bool inVal);
  1985. native bool PlayerGetState (int inPlayer, int inState);
  1986.  
  1987. native void PlayerBeaconClearTarget (int inPlayer, int inBeacon);
  1988. native bool PlayerBeaconIsAutoCast (int inPlayer, int inBeacon);
  1989. native bool PlayerBeaconIsFromUser (int inPlayer, int inBeacon);
  1990. native bool PlayerBeaconIsSet (int inPlayer, int inBeacon);
  1991. native point PlayerBeaconGetTargetPoint (int inPlayer, int inBeacon);
  1992. native unit PlayerBeaconGetTargetUnit (int inPlayer, int inBeacon);
  1993. native void PlayerBeaconSetAutoCast (int inPlayer, int inBeacon, bool enable);
  1994. native void PlayerBeaconSetTargetPoint (int inPlayer, int inBeacon, point inPoint, bool alert);
  1995. native void PlayerBeaconSetTargetUnit (int inPlayer, int inBeacon, unit inUnit, bool alert);
  1996. native void PlayerBeaconAlert (int inPlayer, int inBeacon, string inAlert, text inMessage);
  1997.  
  1998. native void PlayerPauseAllCharges (int inPlayer, bool inPause);
  1999. native void PlayerPauseAllCooldowns (int inPlayer, bool inPause);
  2000.  
  2001. native void PlayerAddChargeRegen (int inPlayer, string inCharge, fixed inVal);
  2002. native fixed PlayerGetChargeRegen (int inPlayer, string inCharge);
  2003. native void PlayerAddChargeUsed (int inPlayer, string inCharge, fixed inVal);
  2004. native fixed PlayerGetChargeUsed (int inPlayer, string inCharge);
  2005.  
  2006. native void PlayerAddCooldown (int inPlayer, string inCooldown, fixed inVal);
  2007. native fixed PlayerGetCooldown (int inPlayer, string inCooldown);
  2008.  
  2009. native void PlayerCreateEffectPoint (int inPlayer, string inEffect, point inTarget);
  2010. native void PlayerCreateEffectUnit (int inPlayer, string inEffect, unit inTarget);
  2011. native int PlayerValidateEffectPoint (int inPlayer, string inEffect, point inTarget);
  2012. native int PlayerValidateEffectUnit (int inPlayer, string inEffect, unit inTarget);
  2013.  
  2014. // Player scores
  2015. native void PlayerScoreValueEnable (int player, string value, bool enable);
  2016. native fixed PlayerScoreValueGetAsFixed (int player, string value);
  2017. native int PlayerScoreValueGetAsInt (int player, string value);
  2018. native void PlayerScoreValueSetFromFixed (int player, string value, fixed amount);
  2019. native void PlayerScoreValueSetFromInt (int player, string value, int amount);
  2020.  
  2021. // Player events
  2022. const int c_gameResultUndecided     = 0;
  2023. const int c_gameResultVictory       = 1;
  2024. const int c_gameResultDefeat        = 2;
  2025. const int c_gameResultTie           = 3;
  2026.  
  2027. native void TriggerAddEventPlayerAllianceChange (trigger inTrigger, int player);
  2028. native void TriggerAddEventPlayerLeft (trigger inTrigger, int player, int inResult);
  2029. native void TriggerAddEventPlayerPropChange (trigger inTrigger, int player, int inProp);
  2030. native void TriggerAddEventPlayerAIWave (trigger inTrigger, int player);
  2031.  
  2032. native int  EventPlayer ();
  2033. native int  EventPlayerProperty ();
  2034.  
  2035. // Difficulty info
  2036. native text DifficultyName (int inDifficulty);
  2037. native text DifficultyNameCampaign (int inDifficulty);
  2038. native bool DifficultyEnabled (int inDifficulty);
  2039. native int  DifficultyAPM (int inDifficulty);   // AI Actions Per Minute
  2040.  
  2041. //--------------------------------------------------------------------------------------------------
  2042. // Player Groups
  2043. //--------------------------------------------------------------------------------------------------
  2044. native playergroup PlayerGroupEmpty ();
  2045. native playergroup PlayerGroupCopy (playergroup inGroup);
  2046. native playergroup PlayerGroupAll ();
  2047. native playergroup PlayerGroupActive ();
  2048. native playergroup PlayerGroupSingle (int inPlayer);
  2049.  
  2050. const int c_playerGroupAlly     = 0;    // Allied players of the given player
  2051. const int c_playerGroupEnemy    = 1;    // Enemy players of the given player
  2052. const int c_playerGroupAny      = 2;    // Any player.
  2053.  
  2054. native playergroup PlayerGroupAlliance (int inType, int inPlayer);
  2055.  
  2056. native void PlayerGroupClear (playergroup inGroup);
  2057. native void PlayerGroupAdd (playergroup inGroup, int inPlayer);
  2058. native void PlayerGroupRemove (playergroup inGroup, int inPlayer);
  2059.  
  2060. native int  PlayerGroupCount (playergroup inGroup);
  2061. native int  PlayerGroupPlayer (playergroup inGroup, int inIndex);
  2062. native bool PlayerGroupHasPlayer (playergroup inGroup, int inPlayer);
  2063.  
  2064. //--------------------------------------------------------------------------------------------------
  2065. // Points
  2066. //--------------------------------------------------------------------------------------------------
  2067. native point Point (fixed x, fixed y);
  2068. native point PointWithOffset (point p, fixed x, fixed y);
  2069. native point PointWithOffsetPolar (point p, fixed distance, fixed angle);
  2070. native point PointFromId (int id);
  2071.  
  2072. native fixed PointGetX (point p);
  2073. native fixed PointGetY (point p);
  2074. native void  PointSet (point p1, point p2);
  2075.  
  2076. native fixed PointGetFacing (point p);
  2077. native void  PointSetFacing (point p, fixed inFacing);
  2078.  
  2079. native fixed PointGetHeight (point p);
  2080. native void  PointSetHeight (point p, fixed inHeight);
  2081.  
  2082. native bool  PointsInRange (point p1, point p2, fixed range);
  2083.  
  2084. native fixed AngleBetweenPoints (point p1, point p2);
  2085. native fixed DistanceBetweenPoints (point p1, point p2);
  2086.  
  2087. native int   PointPathingCost (point p1, point p2);
  2088. native fixed PointPathingCliffLevel (point p);
  2089. native bool  PointPathingPassable (point p);
  2090. native bool  PointPathingIsConnected (point p1, point p2);
  2091. native point PointReflect (point source, point dest, fixed angle);
  2092.  
  2093. //--------------------------------------------------------------------------------------------------
  2094. // Portrait
  2095. //--------------------------------------------------------------------------------------------------
  2096. const int c_noPortraitChannel      = -1;
  2097. const int c_invalidPortraitId       = 0;
  2098.  
  2099. //These need to match the ERenderType enum in CFrame.h
  2100. const int c_portraitRenderTypeHDR = 0;
  2101. const int c_portraitRenderTypeLDR = 1;
  2102.    
  2103. native int          PortraitCreate (
  2104.                         int offsetX,
  2105.                         int offsetY,
  2106.                         int anchor,
  2107.                         int width,
  2108.                         int height,
  2109.                         string modelLink,
  2110.                         string cameraLink,
  2111.                         string animProps,
  2112.                         bool visible,
  2113.                         bool waitUntilLoaded
  2114.                     );
  2115. native int          PortraitLastCreated ();
  2116. native void         PortraitDestroy (int p);
  2117. native void         PortraitDestroyAll ();
  2118. native void         PortraitWaitForLoad (int p);
  2119.  
  2120. native int          PortraitGetGame ();
  2121. native int          PortraitGetPlanetPanel ();
  2122. native void         PortraitSetModel (int p, string modelLink, bool waitUntilLoaded);
  2123. native void         PortraitSetAnim (int p, string anim);
  2124. native void         PortraitSetCamera (int p, string cameraName);
  2125. native void         PortraitSetSize (int p, int width, int height);
  2126. native void         PortraitSetPosition (int p, int anchor, int offsetX, int offsetY);
  2127. native void         PortraitSetFullscreen (int p, bool isFullscreen);
  2128. native void         PortraitSetOffscreen (int p, bool isOffscreen);
  2129. native void         PortraitSetVisible (int p, playergroup players, bool isVisible, bool forceVisible);
  2130. native void         PortraitSetBorderVisible (int p, bool isBorderVisible);
  2131. native void         PortraitSetBorderTexture (int p, string inBorderFilePath);
  2132. native void         PortraitSetBackgroundVisible (int p, bool isBackgroundVisible);
  2133. native void         PortraitSetChannel (int p, int channel);
  2134. native void         PortraitSetChannelPortrait (int p, int dest, int channel);
  2135. native void         PortraitUseTransition (int p, bool useTransition);
  2136. native void         PortraitSetRenderType (int p, int renderType);
  2137. native void         PortraitSetMuted (int p, bool isMuted);
  2138. native void         PortraitForceTransition (int p, bool isVisible, bool isInstant);
  2139. native void         PortraitSetPaused (int p, bool isPaused);
  2140. native void         PortraitSetTintColor (int p, color inColor);
  2141. native void         PortraitSetLight (int p, string lightLink);
  2142. native void         PortraitSetTransitionModel (int p, string modelLink);
  2143.  
  2144. native bool         PortraitVisible (int p, int player);
  2145.  
  2146. //--------------------------------------------------------------------------------------------------
  2147. // Preload
  2148. //--------------------------------------------------------------------------------------------------
  2149. native void PreloadAsset (string key, bool queue);
  2150. native void PreloadImage (string path, bool queue);
  2151. native void PreloadModel (string path, bool queue);
  2152. native void PreloadMovie (string path, bool queue);
  2153. native void PreloadObject (int catalog, string id, bool queue);
  2154. native void PreloadScene (string path, bool queue);
  2155. native void PreloadScript (string path, bool queue);
  2156. native void PreloadSound (string path, bool queue);
  2157.  
  2158. //--------------------------------------------------------------------------------------------------
  2159. // Purchase
  2160. //--------------------------------------------------------------------------------------------------
  2161. const int c_invalidPurchaseItemId           = 0;
  2162. const int c_invalidPurchaseCategoryId       = 0;
  2163. const int c_invalidPurchaseGroupId          = 0;
  2164.  
  2165. const int c_purchaseCategoryStateEnabled    = 0;
  2166. const int c_purchaseCategoryStateDisabled   = 1;
  2167. const int c_purchaseCategoryStateHidden     = 2;
  2168. const int c_purchaseCategoryStateNew        = 3;
  2169.  
  2170. const int c_purchaseGroupStateEnabled       = 0;
  2171. const int c_purchaseGroupStateDisabled      = 1;
  2172. const int c_purchaseGroupStateHidden        = 2;
  2173. const int c_purchaseGroupStateNew           = 3;
  2174.  
  2175. const int c_purchaseItemStateEnabled        = 0;
  2176. const int c_purchaseItemStateDisabled       = 1;
  2177. const int c_purchaseItemStatePurchased      = 2;
  2178. const int c_purchaseItemStateHidden         = 3;
  2179. //--------------------------------------------------------------------------------------------------
  2180. native int              PurchaseCategoryCreate (playergroup inPlayerGroup, int inSlot);
  2181. native int              PurchaseCategoryLastCreated ();
  2182.  
  2183. native void             PurchaseCategoryDestroy (int inPurchaseCategoryId);
  2184. native void             PurchaseCategoryDestroyAll (playergroup inPlayerGroup);
  2185.  
  2186. native void             PurchaseCategorySetPlayerGroup (int inPurchaseCategoryId, playergroup inPlayerGroup);
  2187. native void             PurchaseCategorySetNameText (int inPurchaseCategoryId, text inText);
  2188. native void             PurchaseCategorySetState (int inPurchaseCategoryId, int inState);
  2189. native void             PurchaseCategorySetSlot (int inPurchaseCategoryId, int inSlot);
  2190.  
  2191. native void             PurchaseSetSelectedPurchaseCategory (playergroup inPlayerGroup, int inPurchaseCategoryId);
  2192. native int              PurchaseGetSelectedPurchaseCategory (int inPlayer);
  2193. //--------------------------------------------------------------------------------------------------
  2194. native int              PurchaseGroupCreate (playergroup inPlayerGroup, int inPurchaseCategoryId, int inSlot);                            
  2195. native int              PurchaseGroupLastCreated ();
  2196.  
  2197. native void             PurchaseGroupDestroy (int inPurchaseGroupId);
  2198. native void             PurchaseGroupDestroyAll (playergroup inPlayerGroup);
  2199.  
  2200. native void             PurchaseGroupSetPlayerGroup (int inPurchaseGroupId, playergroup inPlayerGroup);
  2201. native void             PurchaseGroupSetNameText (int inPurchaseGroupId, text inText);
  2202. native void             PurchaseGroupSetTooltipText (int inPurchaseGroupId, text inText);
  2203. native void             PurchaseGroupSetIconFilePath (int inPurchaseGroupId, string inFilePath);
  2204. native void             PurchaseGroupSetState (int inPurchaseGroupId, int inState);
  2205. native void             PurchaseGroupSetSlot (int inPurchaseGroupId, int inSlot);
  2206. native void             PurchaseGroupSetUnitLink (int inPurchaseGroupId, string inUnitLink);
  2207.  
  2208. //--------------------------------------------------------------------------------------------------
  2209. native int              PurchaseItemCreate (playergroup inPlayerGroup, int inPurchaseGroupId, int inSlot);
  2210. native int              PurchaseItemLastCreated ();
  2211.  
  2212. native void             PurchaseItemDestroy (int inPurchaseItemId);
  2213. native void             PurchaseItemDestroyAll (playergroup inPlayerGroup);
  2214.  
  2215. native void             PurchaseItemSetPlayerGroup (int inPurchaseItemId, playergroup inPlayerGroup);
  2216. native void             PurchaseItemSetNameText (int inPurchaseItemId, text inText);
  2217. native void             PurchaseItemSetTooltipText (int inPurchaseItemId, text inText);
  2218. native void             PurchaseItemSetDescriptionText (int inPurchaseItemId, text inText);
  2219. native void             PurchaseItemSetIconFilePath (int inPurchaseItemId, string inFilePath);
  2220. native void             PurchaseItemSetMovieFilePath (int inPurchaseItemId, string inFilePath);
  2221. native void             PurchaseItemSetCost (int inPurchaseItemId, int inCost);
  2222. native void             PurchaseItemSetState (int inPurchaseItemId, int inState);
  2223. native void             PurchaseItemSetRecentlyPurchased (int inPurchaseItemId, bool inRecent);
  2224. native void             PurchaseItemSetSlot (int inPurchaseItemId, int inSlot);
  2225. native void             PurchaseItemPurchase (int inPurchaseItemId);
  2226.  
  2227. native bool             PurchaseItemIsRecentlyPurchased (int inPurchaseItemId);
  2228.  
  2229. native void             PurchaseSetSelectedPurchaseItem (playergroup inPlayerGroup, int inPurchaseItemId);
  2230. native int              PurchaseGetSelectedPurchaseItem (int inPlayer);
  2231. //--------------------------------------------------------------------------------------------------
  2232. // Purchase events
  2233. native void             TriggerAddEventPurchaseMade (trigger t, int player, int inPurchaseItemId);
  2234. native void             TriggerAddEventPurchaseExit (trigger t, int player);
  2235. native void             TriggerAddEventSelectedPurchaseItemChanged (trigger t, int player, int inPurchaseItemId);
  2236. native void             TriggerAddEventSelectedPurchaseCategoryChanged (trigger t, int player, int inPurchaseCategoryId);
  2237.  
  2238. native int              EventPurchaseMade ();
  2239.  
  2240. //--------------------------------------------------------------------------------------------------
  2241. // Regions
  2242. //
  2243. // Regions are comprised of any number of basic shapes (rectangles, circles, etc).  Each shape
  2244. // can be specified as positive or negative.  A point is considered within the region if it is
  2245. // within a least one positive shape but not within any negative shapes.
  2246. //
  2247. // Example:
  2248. // An L-shaped region could be created with either
  2249. //
  2250. // (a) Two positive rectangles
  2251. //      _
  2252. //     | | <-- (+)
  2253. //     | |
  2254. //     |_|___
  2255. //     |_____| <-- (+)
  2256. //
  2257. // (b) One positive and one negative rectangle
  2258. //        _____
  2259. //      _|___  |
  2260. //     | |   | |
  2261. //     | |   | | <-- (-)
  2262. //     | |___|_|
  2263. //     |_____|   <-- (+)
  2264. //
  2265. // The "bounds" of the region are defined as the smallest rectangle which contains all positive
  2266. // shapes.  The "center" is the average of the center of all positive shapes, weighted by area.
  2267. //
  2268. // The "offset" of the region is relative to the shape coordinates.  The center and bounds take
  2269. // the offset into account.
  2270. //
  2271. //--------------------------------------------------------------------------------------------------
  2272. native region RegionEmpty ();
  2273. native region RegionEntireMap ();
  2274. native region RegionPlayableMap ();
  2275. native void RegionPlayableMapSet (region r);
  2276.  
  2277. native region RegionRect (fixed minx, fixed miny, fixed maxx, fixed maxy);
  2278. native region RegionCircle (point center, fixed radius);
  2279. native region RegionFromId (int id);
  2280.  
  2281. native void RegionAddRect (region r, bool positive, fixed minx, fixed miny, fixed maxx, fixed maxy);
  2282. native void RegionAddCircle (region r, bool positive, point center, fixed radius);
  2283. native void RegionAddRegion (region r, region regToAdd);
  2284.  
  2285. native void  RegionSetOffset (region r, point offset);
  2286. native point RegionGetOffset (region r);
  2287.  
  2288. native bool RegionContainsPoint (region r, point p);
  2289.  
  2290. // RegionRandomPoint attempts to find a random point somewhere within the region.  For regions
  2291. // containing only a single positive shape, this is guaranteed to work, but for more complex
  2292. // sets of shapes it may give up after a maximum number of tries and return (0, 0).
  2293. //
  2294. native point RegionRandomPoint (region r);
  2295.  
  2296. native point RegionGetBoundsMin (region r);
  2297. native point RegionGetBoundsMax (region r);
  2298. native point RegionGetCenter (region r);
  2299.  
  2300. // Setting the center will adjust the offset such that
  2301. // the region becomes centered on the given point.
  2302. //
  2303. native void RegionSetCenter (region r, point p);
  2304.  
  2305. // RegionAttachToUnit will attach the region to the given unit such that the region center
  2306. // is always at the unit's position plus the given offset.  Use a null unit to detach the region
  2307. // from whatever unit it may already be attached to.
  2308. //
  2309. native void RegionAttachToUnit (region r, unit u, point offset);
  2310. native unit RegionGetAttachUnit (region r);
  2311.  
  2312. //--------------------------------------------------------------------------------------------------
  2313. // Research
  2314. //--------------------------------------------------------------------------------------------------
  2315. const int c_invalidResearchCategoryId           = 0;
  2316. const int c_invalidResearchTierId               = 0;
  2317. const int c_invalidResearchItemId               = 0;
  2318.  
  2319. const int c_researchItemStateEnabled            = 0;
  2320. const int c_researchItemStateDisabled           = 1;
  2321. const int c_researchItemStatePurchased          = 2;
  2322. //--------------------------------------------------------------------------------------------------
  2323. native int          ResearchCategoryCreate (playergroup inPlayerGroup, int inSlot);
  2324. native int          ResearchCategoryLastCreated ();
  2325.  
  2326. native void         ResearchCategoryDestroy (int inResearchCategoryId);
  2327. native void         ResearchCategoryDestroyAll (playergroup inPlayerGroup);
  2328.  
  2329. native void         ResearchCategorySetPlayerGroup (int inResearchCategoryId, playergroup inPlayerGroup);
  2330. native void         ResearchCategorySetSlot (int inResearchCategoryId, int inSlot);
  2331. native void         ResearchCategorySetNameText (int inResearchCategoryId, text inText);
  2332. native void         ResearchCategorySetCurrentLevel (int inResearchCategoryId, int inLevel);
  2333. native void         ResearchCategorySetLastLevel (int inResearchCategoryId, int inLevel);
  2334. //--------------------------------------------------------------------------------------------------
  2335. native int          ResearchTierCreate (playergroup inPlayerGroup, int inResearchCategoryId, int inSlot);
  2336. native int          ResearchTierLastCreated ();
  2337.  
  2338. native void         ResearchTierDestroy (int inResearchTierId);
  2339. native void         ResearchTierDestroyAll (playergroup inPlayerGroup);
  2340.  
  2341. native void         ResearchTierSetPlayerGroup (int inResearchTierId, playergroup inPlayerGroup);
  2342. native void         ResearchTierSetSlot (int inResearchTierId, int inSlot);
  2343. native void         ResearchTierSetRequiredLevel (int inResearchTierId, int inLevel);
  2344. native void         ResearchTierSetMaxPurchasesAllowed (int inResearchTierId, int inMax);
  2345. //--------------------------------------------------------------------------------------------------
  2346. native int          ResearchItemCreate (playergroup inPlayerGroup, int inResearchTierId, int inState);
  2347. native int          ResearchItemLastCreated ();
  2348.  
  2349. native void         ResearchItemDestroy (int inResearchItemId);
  2350. native void         ResearchItemDestroyAll (playergroup inPlayerGroup);
  2351.  
  2352. native void         ResearchItemSetPlayerGroup (int inResearchItemId, playergroup inPlayerGroup);
  2353. native void         ResearchItemSetSlot (int inResearchItemId, int inSlot);
  2354. native void         ResearchItemSetState (int inResearchItemId, int inState);
  2355. native void         ResearchItemSetNameText (int inResearchItemId, text inText);
  2356. native void         ResearchItemSetDescriptionText (int inResearchItemId, text inText);
  2357. native void         ResearchItemSetTooltipText (int inResearchItemId, text inText);
  2358. native void         ResearchItemSetConfirmationText (int inResearchItemId, text inText);
  2359. native void         ResearchItemSetIconFilePath (int inResearchItemId, string inFilePath);
  2360. native void         ResearchItemSetMovieFilePath (int inResearchItemId, string inFilePath);
  2361. native void         ResearchItemSetRecentlyPurchased (int inResearchItemId, bool inRecent);
  2362.  
  2363. native bool         ResearchItemIsRecentlyPurchased (int inResearchItemId);
  2364. native void         ResearchItemPurchase (int inResearchItemId);
  2365.  
  2366. native void         ResearchItemSetSelected (playergroup inPlayerGroup, int inResearchItemId);
  2367. native int          ResearchItemGetSelected (int inPlayer);
  2368.  
  2369. // Research events
  2370. native void         TriggerAddEventResearchPanelExit (trigger t, int player);
  2371. native void         TriggerAddEventResearchPanelPurchase (trigger t, int player);
  2372. native void         TriggerAddEventResearchPanelSelectionChanged (trigger t, int player, int inResearchItemId);
  2373.  
  2374. //--------------------------------------------------------------------------------------------------
  2375. // Sound
  2376. //
  2377. // - A specific sound index within the sound list may be specified.
  2378. //   Using c_soundIndexAny will choose a sound either sequentially or randomly,
  2379. //   based on the sound data.
  2380. //
  2381. // - Use a "null" playergroup to play the sound for all players.
  2382. //
  2383. // - 3d sounds are only played for players who currently have vision of the sound position.
  2384. //
  2385. // - Volumes are expressed as a percent (0-100) of maximum volume.
  2386. //--------------------------------------------------------------------------------------------------
  2387. const int c_soundIndexAny = -1;
  2388.  
  2389. // Sound Info
  2390. native soundlink SoundLink (string soundId, int soundIndex);
  2391. native string SoundLinkId (soundlink soundId);
  2392. native int SoundLinkAsset (soundlink soundId);
  2393.  
  2394. // Sound
  2395. native void SoundPlay (
  2396.     soundlink link,
  2397.     playergroup players,
  2398.     fixed volume,
  2399.     fixed offset
  2400. );
  2401. native void SoundPlayAtPoint (
  2402.     soundlink link,
  2403.     playergroup players,
  2404.     point inPoint,
  2405.     fixed height,
  2406.     fixed volume,
  2407.     fixed offset
  2408. );
  2409. native void SoundPlayOnUnit (
  2410.     soundlink link,
  2411.     playergroup players,
  2412.     unit inUnit,
  2413.     fixed height,
  2414.     fixed volume,
  2415.     fixed offset
  2416. );
  2417.  
  2418. // - SoundPlayScene attempts to synchronize unit animations with the sound duration
  2419. native void SoundPlayScene (
  2420.     soundlink link,
  2421.     playergroup players,
  2422.     unitgroup units,
  2423.     string animProps
  2424. );
  2425. native void SoundPlaySceneFile (
  2426.     soundlink link,
  2427.     playergroup players,
  2428.     string sceneFile,
  2429.     string camera
  2430. );
  2431.  
  2432. native sound    SoundLastPlayed ();
  2433.  
  2434. native void     SoundStop (sound s, bool fade);
  2435. native void     SoundStopAllModelSounds ();
  2436. native void     SoundStopAllTriggerSounds (bool fade);
  2437.  
  2438. native void     SoundSetVolume (sound s, fixed volume);
  2439. native void     SoundSetPosition (sound s, point position, fixed height);
  2440.  
  2441. const int c_soundOffsetStart    = 0;
  2442. const int c_soundOffsetEnd      = 1;
  2443.  
  2444. native void     SoundSetOffset (sound s, fixed offset, int offsetType);
  2445. native void     SoundWait (sound s, fixed offset, int offsetType);
  2446. native void     SoundAttachUnit (sound s, unit u, fixed height);
  2447.  
  2448. // Sound Lengths
  2449. // - Note: Since sound files are localized and potentially different for each player,
  2450. //         a network query must be sent to all players, and all results must be
  2451. //         received before a synchronous result can be accessed.
  2452. //
  2453. //         SoundLengthQuery     - Initiate a network query for the given sound
  2454. //
  2455. //         SoundLengthQueryWait - Pause the current thread until all outstanding sound length
  2456. //                                query results have been synchronized
  2457. //
  2458. //         SoundLengthSync      - Retrieve the synchronized sound length result for the given
  2459. //                                sound
  2460. //
  2461. native void     SoundLengthQuery (soundlink info);
  2462. native void     SoundLengthQueryWait ();
  2463. native fixed    SoundLengthSync (soundlink info);
  2464.  
  2465. // Sound channels
  2466. native void     SoundChannelSetVolume (playergroup players, int channel, fixed volume, fixed duration);
  2467. native void     SoundChannelMute (playergroup players, int channel, bool mute);
  2468. native void     SoundChannelPause (playergroup players, int channel, bool pause);
  2469. native void     SoundChannelStop (playergroup players, int channel);
  2470.  
  2471. // Other properties
  2472. native void     SoundSetReverb (string inReverbLink, fixed inDuration, bool inAmbient, bool inGlobal);
  2473. native void     SoundSetFactors (fixed distance, fixed doppler, fixed rolloff);
  2474.  
  2475. native text     SoundSubtitleText (soundlink link);
  2476.  
  2477. //--------------------------------------------------------------------------------------------------
  2478. // Soundtracks
  2479. //--------------------------------------------------------------------------------------------------
  2480. const int c_soundtrackCueAny = -1;
  2481. const int c_soundtrackIndexAny = -1;
  2482.  
  2483. native void     SoundtrackDefault (playergroup players, int category, string soundtrack, int cue, int index);
  2484. native void     SoundtrackPlay (playergroup players, int category, string soundtrack, int cue, int index, bool makeDefault);
  2485. native void     SoundtrackPause (playergroup players, int category, bool pause, bool fade);
  2486. native void     SoundtrackSetContinuous (playergroup players, int category, bool continuous);
  2487. native void     SoundtrackSetDelay (playergroup players, int category, fixed delay);
  2488. native void     SoundtrackStop (playergroup players, int category, bool fade);
  2489. native void     SoundtrackWait (string soundtrack);
  2490.  
  2491. //--------------------------------------------------------------------------------------------------
  2492. // Story Mode
  2493. //--------------------------------------------------------------------------------------------------
  2494. native void     StoryMode (playergroup players, bool storyMode);     //  Blizzard maps only
  2495.  
  2496. //--------------------------------------------------------------------------------------------------
  2497. // Strings
  2498. //--------------------------------------------------------------------------------------------------
  2499. native int      StringLength (string s);
  2500. native string   StringCase (string s, bool upper);
  2501. native text     TextCase (text t, bool upper);
  2502. native string   StringSub (string s, int start, int end);
  2503.  
  2504. const bool c_stringCase = true;
  2505. const bool c_stringNoCase = false;
  2506.  
  2507. native bool     StringEqual (string s1, string s2, bool caseSens);
  2508.  
  2509. // StringFind returns the position of the first occurrence of s2 within s1,
  2510. // or c_stringNotFound if there isn't one.
  2511. //
  2512. const int c_stringNotFound  = -1;
  2513.  
  2514. native int      StringFind (string s1, string s2, bool caseSens);
  2515.  
  2516. // StringContains
  2517. const int c_stringBegin     = 0;    // True if s1 begins with s2
  2518. const int c_stringEnd       = 1;    // True if s1 ends with s2
  2519. const int c_stringAnywhere  = 2;    // True if s1 contains s2 anywhere
  2520.  
  2521. native bool     StringContains (string s1, string s2, int location, bool caseSens);
  2522.  
  2523. // StringWord splits the string into words separated by whitespace,
  2524. // and returns the word corresponding to the given index.
  2525. //
  2526. // Ex: StringWord("klaatu barada nikto", 2) will return "barada"
  2527. //
  2528. native string   StringWord (string s, int index);
  2529.  
  2530. // StringReplace replaces the indexed character range in the string with the replacement string
  2531. // and returns the result.
  2532. //
  2533. native string   StringReplace (string s, string replace, int start, int end);
  2534.  
  2535. // StringReplaceWord replaces occurrences of the given word in the string with the replacement
  2536. // string and returns the result.
  2537. //
  2538. const int c_stringReplaceAll    = -1;   // Use as maxCount for all occurrences
  2539.  
  2540. native string   StringReplaceWord (string s, string word, string replace, int maxCount, bool caseSens);
  2541. native text     TextReplaceWord (text t, text word, text replace, int maxCount, bool caseSens);
  2542.  
  2543. // StringExternal looks up the given string identifer in the externalized string table
  2544. native text     StringExternal (string s);
  2545.  
  2546. // StringToText converts the given string to text directly (not externalized)
  2547. native text     StringToText (string s);
  2548.  
  2549. // TextWithColor applies a formatting tag to the input text for the given color
  2550. native text     TextWithColor (text t, color c);
  2551.  
  2552. // TextTimeFormat converts a time value, in seconds, to text using a format string
  2553. // - The time format string should use the following tokens:
  2554. //
  2555. //      <hour/>         = hour count, rounded down
  2556. //      <hour2/>        = hour count, rounded down, always two digits
  2557. //      <hourtotal/>    = total hour count, rounded down
  2558. //      <hourtotaln/>   = total hour count, rounded to nearest
  2559. //      <hourtotalu/>   = total hour count, rounded up
  2560. //      <min/>          = minute count, rounded down
  2561. //      <min2/>         = minute count, rounded down, always two digits
  2562. //      <mintotal/>     = total minute count, rounded down
  2563. //      <mintotaln/>    = total minute count, rounded to nearest
  2564. //      <mintotalu/>    = total minute count, rounded up
  2565. //      <sec/>          = second count
  2566. //      <sec2/>         = second count, always two digits
  2567. //      <sectotal/>     = total second count
  2568. //      <short/>        = one of "<hour/>h", "<min/>m", or "<sec/>s"
  2569. //
  2570. //   Examples (these all represent the same value):
  2571. //      "<hour/>:<min2/>:<sec2/>"   ->  1:08:38     (this is the default format)
  2572. //      "<mintotaln/> minutes"      ->  69 minutes
  2573. //      "<mintotal/>:<sec2/>"       ->  68:38
  2574. //      "<short/>"                  ->  1h
  2575. //
  2576. native text     TextTimeFormat (text inFormat, int inSecs);
  2577.  
  2578. //--------------------------------------------------------------------------------------------------
  2579. // Tech Tree
  2580. //--------------------------------------------------------------------------------------------------
  2581. const int c_techCountQueuedOnly         = 0;
  2582. const int c_techCountQueuedOrBetter     = 1;    // Queued + In Progress + Complete
  2583. const int c_techCountInProgressOnly     = 2;
  2584. const int c_techCountInProgressOrBetter = 3;    // In Progress + Complete
  2585. const int c_techCountCompleteOnly       = 4;
  2586. const int c_techCountIncompleteOnly     = 5;    // Queued + In Progress
  2587.  
  2588. native void     TechTreeAbilityAllow (int player, abilcmd inAbilCmd, bool allow);
  2589. native int      TechTreeAbilityCount (int player, string abilType, int countType);
  2590. native bool     TechTreeAbilityIsAllowed (int player, abilcmd inAbilCmd);
  2591.  
  2592. native void     TechTreeBehaviorAllow (int player, string behaviorType, bool allow);
  2593. native int      TechTreeBehaviorCount (int player, string behaviorType, int countType);
  2594. native bool     TechTreeBehaviorIsAllowed (int player, string behaviorType);
  2595. native abilcmd  TechTreeBehaviorProducedAbilCmd (string behaviorType, int index);
  2596. native int      TechTreeBehaviorProducedAbilCmdCount (string behaviorType);
  2597.  
  2598. native void     TechTreeRequirementsEnable (int player, bool enable);
  2599. native bool     TechTreeRequirementsEnabled (int player);
  2600. native void     TechTreeRestrictionsEnable (int player, bool enable);
  2601. native bool     TechTreeRestrictionsEnabled (int player);
  2602.  
  2603. native void     TechTreeUnitAllow (int player, string unitType, bool allow);
  2604. native int      TechTreeUnitCount (int player, string unitType, int countType);
  2605. native int      TechTreeUnitAliasCount (int player, string unitType, int countType);
  2606. native int      TechTreeUnitCountEx (int player, string unitType, string equivType, int countType);
  2607. native bool     TechTreeUnitIsAllowed (int player, string unitType);
  2608. native void     TechTreeUnitHelp (int player, string unitType, bool display);
  2609. native void     TechTreeUnitHelpDefault (int player, bool display);
  2610. native abilcmd  TechTreeUnitProducedAbilCmd (string unitType, int index);
  2611. native int      TechTreeUnitProducedAbilCmdCount (string unitType);
  2612. native string   TechTreeUnitProducesUnit (string unitType, int index);
  2613. native int      TechTreeUnitProducesUnitCount (string unitType);
  2614. native string   TechTreeUnitProducesUpgrade (string unitType, int index);
  2615. native int      TechTreeUnitProducesUpgradeCount (string unitType);
  2616.  
  2617. native void     TechTreeUpgradeAddLevel (int player, string upgradeType, int levels);
  2618. native void     TechTreeUpgradeAllow (int player, string upgradeType, bool allow);
  2619. native int      TechTreeUpgradeCount (int player, string upgradeType, int countType);
  2620. native bool     TechTreeUpgradeIsAllowed (int player, string upgradeType);
  2621. native abilcmd  TechTreeUpgradeProducedAbilCmd (string upgradeType, int index);
  2622. native int      TechTreeUpgradeProducedAbilCmdCount (string upgradeType);
  2623.  
  2624. //--------------------------------------------------------------------------------------------------
  2625. // Text Tags
  2626. //--------------------------------------------------------------------------------------------------
  2627. const int c_textTagNone = 0;
  2628.  
  2629. // Edge
  2630. const int c_textTagEdgeTop      = 0;
  2631. const int c_textTagEdgeLeft     = 1;
  2632. const int c_textTagEdgeBottom   = 2;
  2633. const int c_textTagEdgeRight    = 3;
  2634.  
  2635. native int      TextTagCreate (
  2636.                     text inText,
  2637.                     int inFontSize,
  2638.                     point inPoint,
  2639.                     fixed inHeightOffset,
  2640.                     bool inShow,
  2641.                     bool useFogofWar,
  2642.                     playergroup inPlayers
  2643.                 );
  2644. native int      TextTagLastCreated ();
  2645. native void     TextTagDestroy (int inTag);
  2646.  
  2647. native void     TextTagSetText (int inTag, text inText);
  2648. native void     TextTagSetTextShadow (int inTag, bool inVal);
  2649. native void     TextTagSetFontSize (int inTag, int inFontSize);
  2650. native void     TextTagSetPosition (int inTag, point inPoint, fixed inHeightOffset);
  2651. native void     TextTagAttachToUnit (int inTag, unit inUnit, fixed inHeightOffset);
  2652. native void     TextTagAttachToUnitPoint (int inTag, unit inUnit, string attachmentPoint, int offsetX, int offsetY);
  2653. native void     TextTagSetVelocity (int inTag, fixed inSpeed, fixed inAngle);
  2654. native void     TextTagSetAlignment (int inTag, int inHoriz, int inVert);
  2655. native void     TextTagSetTextAlignment (int inTag, int inHoriz, int inVert);
  2656. native void     TextTagSetMaxSize (int inTag, fixed inWidth, fixed inHeight);
  2657.  
  2658. native void     TextTagShowBackground (int inTag, bool inShow);
  2659. native void     TextTagSetBackgroundImage (int inTag, string inPath, bool inTiled);
  2660. native void     TextTagSetBackgroundBorderSize (int inTag, fixed inX, fixed inY);
  2661. native void     TextTagSetBackgroundOffset (int inTag, fixed inX, fixed inY);
  2662. native void     TextTagSetEdgeImage (int inTag, int inEdge, string inPath, int inXOffset, int inYOffset);
  2663.  
  2664. native void     TextTagShow (int inTag, playergroup inPlayers, bool inShow);
  2665. native bool     TextTagVisible (int inTag, int inPlayer);
  2666. native void     TextTagPause (int inTag, bool inPause);
  2667. native void     TextTagFogofWar (int inTag, bool inPause);
  2668.  
  2669. const int c_textTagColorText            = -1;
  2670. const int c_textTagColorTextStart       =  0;
  2671. const int c_textTagColorTextEnd         =  1;
  2672. const int c_textTagColorBackground      = -2;
  2673. const int c_textTagColorBackgroundStart =  2;
  2674. const int c_textTagColorBackgroundEnd   =  3;
  2675. const int c_textTagColorEdge            = -3;
  2676. const int c_textTagColorEdgeStart       =  4;
  2677. const int c_textTagColorEdgeEnd         =  5;
  2678.  
  2679. native void     TextTagSetColor (int inTag, int inType, color inColor);
  2680.  
  2681. const int c_textTagFadeAll          = -1;
  2682. const int c_textTagFadeText         =  0;
  2683. const int c_textTagFadeBackground   =  1;
  2684. const int c_textTagFadeEdge         =  2;
  2685.  
  2686. native void     TextTagSetFadedTransparency (int inTag, int inType, fixed inTransparency);
  2687.  
  2688. const int c_textTagTimeDuration     = 0;
  2689. const int c_textTagTimeFadeOut      = 1;
  2690. const int c_textTagTimeFadeDuration = 2; // If zero, will fade over full duration
  2691. const int c_textTagTimeCurrent      = 3;
  2692.  
  2693. const fixed c_textTagTimePermanent  = 0; // Use with c_textTagTimeDuration for permanent text
  2694.  
  2695. native void     TextTagSetTime (int inTag, int inType, fixed inVal);
  2696.  
  2697. //--------------------------------------------------------------------------------------------------
  2698. // Timing
  2699. //
  2700. // -- Time types --
  2701. //
  2702. // Timing functions can work with three different types of time:
  2703. //
  2704. //   Game Time - Takes into account the current game speed, and will pass more slowly at slower
  2705. //               speeds, and vice versa.
  2706. //
  2707. //   Real Time - Passes at the same rate regardless of game speed, and approximates time passing
  2708. //               in the real world for the user.  However, "real" time is still synchronous, and
  2709. //               will therefore be affected by lag due to network or system issues.
  2710. //
  2711. //   AI Time   - Passes at the same rate as game time, but may be paused/unpaused independently
  2712. //               of game time via triggers.  This is most commonly done to pause the AI while
  2713. //               an in-game cinematic sequence is run.
  2714. //
  2715. //--------------------------------------------------------------------------------------------------
  2716. const int c_timeGame    = 0;
  2717. const int c_timeReal    = 1;
  2718. const int c_timeAI      = 2;
  2719.  
  2720. native void     Wait (fixed inSecs, int inTimeType);
  2721.  
  2722. // AI Time
  2723. native void     AITimePause (bool inPause);
  2724. native bool     AITimeIsPaused ();
  2725.  
  2726. // Timers
  2727. const fixed c_timerDurationInfinite = -1.0;
  2728.  
  2729. native timer    TimerCreate ();
  2730.  
  2731. native void     TimerStart (timer t, fixed duration, bool periodic, int timeType);
  2732. native void     TimerRestart (timer t);
  2733. native timer    TimerLastStarted ();
  2734.  
  2735. native void     TimerPause (timer t, bool pause);
  2736. native bool     TimerIsPaused (timer t);
  2737.  
  2738. native fixed    TimerGetElapsed (timer t);
  2739. native fixed    TimerGetRemaining (timer t);
  2740. native fixed    TimerGetDuration (timer t);
  2741.  
  2742. // Timer events
  2743. native void TriggerAddEventTimer (trigger inTrigger, timer inTimer);
  2744. native void TriggerAddEventTimeElapsed (trigger inTrigger, fixed inTime, int inTimeType);
  2745. native void TriggerAddEventTimePeriodic (trigger inTrigger, fixed inTime, int inTimeType);
  2746.  
  2747. native timer    EventTimer ();
  2748.  
  2749. // Timer windows
  2750. //   inShowElapsed shows elapsed vs. remaining time (defaults off)
  2751. //
  2752. const int c_timerWindowNone = 0;
  2753.  
  2754. native int      TimerWindowCreate (timer inTimer, text inTitle, bool inShow, bool inShowElapsed);
  2755. native int      TimerWindowLastCreated ();
  2756. native void     TimerWindowDestroy (int inWindow);
  2757.  
  2758. native void     TimerWindowShow (int inWindow, playergroup inPlayers, bool inShow);
  2759. native bool     TimerWindowVisible (int inWindow, int inPlayer);
  2760. native void     TimerWindowSetTimer (int inWindow, timer inTimer);
  2761. native void     TimerWindowSetTitle (int inWindow, text inTitle);
  2762.  
  2763. // - Style
  2764. const int c_timerWindowStyleHorizontalTitleTime = 0;
  2765. const int c_timerWindowStyleHorizontalTimeTitle = 1;
  2766. const int c_timerWindowStyleVerticalTitleTime   = 2;
  2767. const int c_timerWindowStyleVerticalTimeTitle   = 3;
  2768.  
  2769. native void     TimerWindowSetStyle (int inWindow, int inStyle, bool inShowElapsed);
  2770. native void     TimerWindowSetGapWidth (int inWindow, int inWidth);
  2771.  
  2772. // - Time Format - See the TextTimeFormat function for details on the format string
  2773. native void     TimerWindowSetFormat (int inWindow, text inFormat);
  2774.  
  2775. const int c_timerWindowColorTitle       = 0;
  2776. const int c_timerWindowColorTime        = 1;
  2777. const int c_timerWindowColorBackground  = 2;
  2778.  
  2779. native void     TimerWindowSetColor (int inWindow, int inType, color inColor, fixed transparency);
  2780.  
  2781. //--------------------------------------------------------------------------------------------------
  2782. // Transmission
  2783. //--------------------------------------------------------------------------------------------------
  2784. const int c_invalidTransmissionId = 0;
  2785.  
  2786. const fixed c_transmissionTransitionDuration = 0.5;
  2787.  
  2788. const int c_transmissionDurationDefault = 0;
  2789. const int c_transmissionDurationAdd     = 1;
  2790. const int c_transmissionDurationSub     = 2;
  2791. const int c_transmissionDurationSet     = 3;
  2792.  
  2793. native transmissionsource   TransmissionSource ();
  2794. native transmissionsource   TransmissionSourceFromUnit (unit u, bool flash, bool overridePortrait, string anim);
  2795. native transmissionsource   TransmissionSourceFromUnitType (string unitType, bool overridePortrait);
  2796. native transmissionsource   TransmissionSourceFromModel (string modelLink);
  2797. native transmissionsource   TransmissionSourceFromMovie (string assetLink, bool subtitles);
  2798.  
  2799. native int                  TransmissionSend (
  2800.                                 playergroup players,
  2801.                                 transmissionsource source,
  2802.                                 int targetPortrait,
  2803.                                 string targetAnim,
  2804.                                 soundlink soundLink,
  2805.                                 text speaker,
  2806.                                 text subtitle,
  2807.                                 fixed duration,
  2808.                                 int durationType,
  2809.                                 bool waitUntilDone
  2810.                             );
  2811. native int                  TransmissionLastSent ();
  2812. native void                 TransmissionClear (int t);
  2813. native void                 TransmissionClearAll ();
  2814. native void                 TransmissionWait (int t, fixed offset);
  2815.  
  2816. //--------------------------------------------------------------------------------------------------
  2817. // Triggers
  2818. //
  2819. // Each trigger has one script function, registered in TriggerCreate,
  2820. // which is expected to look like:
  2821. //
  2822. //  bool TriggerFunc (bool testConditions, bool runActions) {
  2823. //      if (testConditions) {
  2824. //          if (<conditions fail>) {
  2825. //              return false;
  2826. //          }
  2827. //      }
  2828. //
  2829. //      if (!runActions) {
  2830. //          return true;
  2831. //      }
  2832. //  
  2833. //      <do actions>
  2834. //      return true;
  2835. //  }
  2836. //
  2837. //--------------------------------------------------------------------------------------------------
  2838. native trigger  TriggerCreate (string inFunction);
  2839. native void     TriggerDestroy (trigger t);
  2840.  
  2841. native void     TriggerEnable (trigger t, bool enable);
  2842. native bool     TriggerIsEnabled (trigger t);
  2843.  
  2844. native void     TriggerResetCounts (trigger t);
  2845. native int      TriggerGetEvalCount (trigger t);
  2846. native int      TriggerGetExecCount (trigger t);
  2847.  
  2848. native bool     TriggerEvaluate (trigger t);
  2849. native void     TriggerExecute (trigger t, bool testConds, bool waitUntilDone);
  2850. native trigger  TriggerGetCurrent (); // Returns the trigger currently executing, if any
  2851. native void     TriggerStop (trigger t); // Kills all executing instances of the input trigger
  2852. native void     TriggerWaitForTrigger (trigger t, bool waitUntilDone); // Wait until the given trigger executes
  2853.  
  2854. native void     TriggerQueueEnter ();
  2855. native void     TriggerQueueExit ();
  2856. native bool     TriggerQueueIsEmpty ();
  2857. native void     TriggerQueuePause (bool pause);
  2858.  
  2859. // Options for handling the active thread when clearing the trigger queue
  2860. const int c_triggerQueueRetain  = 0; // Leave in the queue
  2861. const int c_triggerQueueRemove  = 1; // Remove from the queue, but leave it running
  2862. const int c_triggerQueueKill    = 2; // Remove from the queue and kill it immediately
  2863.  
  2864. native void     TriggerQueueClear (int activeOption);
  2865.  
  2866. native void     TriggerSkippableBegin (
  2867.                     playergroup allowedToSkip,
  2868.                     int requiredCount,
  2869.                     trigger onSkip,
  2870.                     bool testConds,
  2871.                     bool waitUntilDone
  2872.                 );
  2873. native void     TriggerSkippableEnd ();
  2874.  
  2875. // Trigger Debugging
  2876. native void     TriggerDebugWindowOpen (bool open);
  2877. native void     TriggerDebugOutput (int type, text inText, bool includeGameUI);
  2878. native void     TriggerDebugSetTypeName (int type, text inText);
  2879. native void     TriggerDebugSetTypeColor (int type, color c);
  2880. native void     TriggerDebugSetTypeFile (int type, string file);
  2881.  
  2882. //--------------------------------------------------------------------------------------------------
  2883. // Units
  2884. //--------------------------------------------------------------------------------------------------
  2885.  
  2886. // Spend locations for simulating spend calls
  2887. const int c_spendLocationAll        = -1;
  2888. const int c_spendLocationAbility    = 0;
  2889. const int c_spendLocationBehavior   = 1;
  2890. const int c_spendLocationUnit       = 2;
  2891. const int c_spendLocationPlayer     = 3;
  2892. const int c_spendLocationGlobal     = 4;
  2893.  
  2894. // Unit creation styles
  2895. const int c_unitCreateConstruct         = (1 << 0);
  2896. const int c_unitCreateIgnorePlacement   = (1 << 1);
  2897.  
  2898. native unitgroup UnitCreate (
  2899.     int inCount,
  2900.     string inUnitType,
  2901.     int inCreateStyle,
  2902.     int inPlayer,
  2903.     point inPos,
  2904.     fixed inFacing
  2905. );
  2906.  
  2907. native unit UnitLastCreated ();
  2908. native unitgroup UnitLastCreatedGroup ();
  2909. native unit UnitFromId (int id);
  2910. native void UnitLoadModel (unit inUnit);
  2911. native void UnitUnloadModel (unit inUnit);
  2912. native void UnitRemove (unit inUnit);
  2913. native void UnitKill (unit inUnit);
  2914. native void UnitRevive (unit inUnit);
  2915. native bool UnitIsAlive (unit inUnit);
  2916. native bool UnitIsValid (unit inUnit);
  2917. native void UnitWaitUntilIdle (unit inUnit, bool inIdle);
  2918.  
  2919. native string UnitGetType (unit inUnit);
  2920.  
  2921. native int   UnitGetOwner (unit inUnit);
  2922. native void  UnitSetOwner (unit inUnit, int inPlayer, bool inChangeColor);
  2923.  
  2924. native void  UnitSetTeamColorIndex (unit inUnit, int inIndex);
  2925. native void  UnitResetTeamColorIndex (unit inUnit);
  2926.  
  2927. native point UnitGetPosition (unit inUnit);
  2928. native void  UnitSetPosition (unit inUnit, point inPos, bool blend);
  2929. native fixed UnitGetHeight (unit inUnit); // Absolute height in world space
  2930. native void UnitSetHeight (unit inUnit, fixed inHeight, fixed inDuration);
  2931.  
  2932. native fixed UnitGetFacing (unit inUnit);
  2933. native void  UnitSetFacing (unit inUnit, fixed inFacing, fixed inDuration);
  2934.  
  2935. native point UnitGetAttachmentPoint (unit inUnit, string attachment);
  2936.  
  2937. native void  UnitResetSpeed (unit inUnit);
  2938.  
  2939. native void UnitSetScale (unit inUnit, fixed x, fixed y, fixed z);
  2940.  
  2941. native void UnitPauseAll (bool inPause);
  2942.  
  2943. native void UnitSetCursor (unit inUnit, string cursorLink);
  2944. native void UnitSetInfoText (unit inUnit, text info, text tip, text subTip);
  2945. native void UnitClearInfoText (unit inUnit);
  2946.  
  2947. native void UnitForceStatusBar (unit inUnit, bool inShow);
  2948.  
  2949. // Unit states
  2950. const int c_unitStateBuried             = 0;  // Read-only
  2951. const int c_unitStateCloaked            = 1;  // Read-only
  2952. const int c_unitStateDetector           = 2;  // Read-only
  2953. const int c_unitStateRadar              = 3;  // Read-only
  2954. const int c_unitStateVisionSuppressed   = 4;  // Read-only
  2955. const int c_unitStateAttackSuppressed   = 5;  // Read-only
  2956. const int c_unitStateInStasis           = 6;  // Read-only
  2957. const int c_unitStateHallucination      = 7;  // Read-only
  2958. const int c_unitStateInvulnerable       = 8;
  2959. const int c_unitStatePaused             = 9;
  2960. const int c_unitStateHidden             = 10;
  2961. const int c_unitStateHighlightable      = 11;
  2962. const int c_unitStateIgnoreTerrainZ     = 12;
  2963. const int c_unitStateUnderConstruction  = 13; // Read-only
  2964. const int c_unitStateInsideTransport    = 14; // Read-only
  2965. const int c_unitStateIdle               = 15; // Read-only
  2966. const int c_unitStateFidget             = 16;
  2967. const int c_unitStateSelectable         = 17;
  2968. const int c_unitStateTargetable         = 18;
  2969. const int c_unitStateStatusBar          = 19;
  2970. const int c_unitStateTooltipable        = 20;
  2971. const int c_unitStateCursorable         = 21;
  2972. const int c_unitStateIsDead             = 22; // Read-only
  2973. const int c_unitStateIsTransport        = 23; // Read-only
  2974. const int c_unitStateMoveSuppressed     = 24;
  2975. const int c_unitStateTurnSuppressed     = 25;
  2976. const int c_unitStateHighlighted        = 26;
  2977. const int c_unitStateUsingSupply        = 27;
  2978. const int c_unitStateRevivable          = 28; // Read-only
  2979.  
  2980. native void UnitSetState (unit inUnit, int inState, bool inVal);
  2981. native bool UnitTestState (unit inUnit, int inState);
  2982.  
  2983. // Unit properties
  2984. const int c_unitPropLife            =  0;
  2985. const int c_unitPropLifePercent     =  1;
  2986. const int c_unitPropLifeMax         =  2;
  2987. const int c_unitPropLifeRegen       =  3;
  2988. const int c_unitPropEnergy          =  4;
  2989. const int c_unitPropEnergyPercent   =  5;
  2990. const int c_unitPropEnergyMax       =  6;
  2991. const int c_unitPropEnergyRegen     =  7;
  2992. const int c_unitPropShields         =  8;
  2993. const int c_unitPropShieldsPercent  =  9;
  2994. const int c_unitPropShieldsMax      = 10;
  2995. const int c_unitPropShieldsRegen    = 11;
  2996. const int c_unitPropSuppliesUsed    = 12; // Read-only
  2997. const int c_unitPropSuppliesMade    = 13; // Read-only
  2998. const int c_unitPropKills           = 14;
  2999. const int c_unitPropVitality        = 15; // Read-only
  3000. const int c_unitPropVitalityPercent = 16; // Read-only
  3001. const int c_unitPropVitalityMax     = 17; // Read-only
  3002. const int c_unitPropAcceleration    = 18; // Read-only
  3003. const int c_unitPropHeight          = 19;
  3004. const int c_unitPropMovementSpeed   = 20;
  3005. const int c_unitPropTurnRate        = 21; // Read-only
  3006. const int c_unitPropResources       = 22;
  3007. const int c_unitPropRadius          = 23; // Read-only
  3008.  
  3009. const bool c_unitPropCurrent = true;
  3010. const bool c_unitPropNormal  = false;
  3011.  
  3012. native void     UnitSetPropertyInt (unit inUnit, int inProp, int inVal);
  3013. native void     UnitSetPropertyFixed (unit inUnit, int inProp, fixed inVal);
  3014.  
  3015. native int      UnitGetPropertyInt (unit inUnit, int inProp, bool inCurrent);
  3016. native fixed    UnitGetPropertyFixed (unit inUnit, int inProp, bool inCurrent);
  3017.  
  3018. native void     UnitSetCustomValue (unit inUnit, int inIndex, fixed inVal);
  3019. native fixed    UnitGetCustomValue (unit inUnit, int inIndex);
  3020.  
  3021. native void     UnitAddChargeRegen (unit inUnit, string inCharge, fixed inVal);
  3022. native fixed    UnitGetChargeRegen (unit inUnit, string inCharge);
  3023. native void     UnitAddChargeUsed (unit inUnit, string inCharge, fixed inVal);
  3024. native fixed    UnitGetChargeUsed (unit inUnit, string inCharge);
  3025.  
  3026. native void     UnitAddCooldown (unit inUnit, string inCooldown, fixed inVal);
  3027. native fixed    UnitGetCooldown (unit inUnit, string inCooldown);
  3028.  
  3029. native void     UnitCreateEffectPoint (unit inUnit, string inEffect, point inTarget);
  3030. native void     UnitCreateEffectUnit (unit inUnit, string inEffect, unit inTarget);
  3031. native int      UnitValidateEffectPoint (unit inUnit, string inEffect, point inTarget);
  3032. native int      UnitValidateEffectUnit (unit inUnit, string inEffect, unit inTarget);
  3033.  
  3034. // Unit AI options
  3035. const int c_unitAIOptionUsable      = 0;
  3036.  
  3037. native void     UnitSetAIOption (unit inUnit, int inOption, bool inVal);
  3038. native bool     UnitGetAIOption (unit inUnit, int inOption);
  3039.  
  3040. // Unit abilities
  3041.  
  3042. // Ability charge types
  3043. const int c_unitAbilChargeCountMax   = 0;
  3044. const int c_unitAbilChargeCountUse   = 1;
  3045. const int c_unitAbilChargeCountLeft  = 2;
  3046. const int c_unitAbilChargeRegenMax   = 3;
  3047. const int c_unitAbilChargeRegenLeft  = 4;
  3048.  
  3049. native void     UnitAbilitySpend (unit inUnit, abilcmd inAbilCmd, int inLocation);
  3050. native void     UnitAbilityReset (unit inUnit, abilcmd inAbilCmd, int inLocation);
  3051. native fixed    UnitAbilityChargeInfo (unit inUnit, abilcmd inAbilCmd, int inType);
  3052. native int      UnitAbilityCount (unit inUnit);
  3053. native bool     UnitAbilityExists (unit inUnit, string inAbil);
  3054. native void     UnitAbilityEnable (unit inUnit, string inAbil, bool inEnable);
  3055. native void     UnitAbilityShow (unit inUnit, string inAbil, bool inShow);
  3056. native string   UnitAbilityGet (unit inUnit, int inIndex);
  3057. native bool     UnitAbilityCheck (unit inUnit, string inAbil, bool inEnabled);
  3058.  
  3059. native void     UnitAbilityChangeLevel (unit inUnit, string inAbil, int inLevel);
  3060. native int      UnitAbilityGetLevel (unit inUnit, string inAbil);
  3061. native int      UnitAbilityMaxLevel (unit inUnit, string inAbil);
  3062.  
  3063. native void     UnitAbilityAddChargeRegen (unit inUnit, string inAbil, string inCharge, fixed inVal);
  3064. native fixed    UnitAbilityGetChargeRegen (unit inUnit, string inAbil, string inCharge);
  3065. native void     UnitAbilityAddChargeUsed (unit inUnit, string inAbil, string inCharge, fixed inVal);
  3066. native fixed    UnitAbilityGetChargeUsed (unit inUnit, string inAbil, string inCharge);
  3067.  
  3068. native void     UnitAbilityAddCooldown (unit inUnit, string inAbil, string inCooldown, fixed inVal);
  3069. native fixed    UnitAbilityGetCooldown (unit inUnit, string inAbil, string inCooldown);
  3070.  
  3071. // Ability command states
  3072. const int c_cmdStateHidden          = (1 << 0);
  3073. const int c_cmdStateExecuting       = (1 << 1);
  3074. const int c_cmdStateCanAutoCast     = (1 << 2);
  3075. const int c_cmdStateIsAutoCast      = (1 << 3);
  3076. const int c_cmdStateMaxCharges      = (1 << 4);
  3077. const int c_cmdStateHasCharges      = (1 << 5);
  3078. const int c_cmdStateDisabled        = (1 << 6);
  3079. const int c_cmdStateCooldown        = (1 << 7);
  3080. const int c_cmdStateNoLife          = (1 << 8);
  3081. const int c_cmdStateNoShields       = (1 << 9);
  3082. const int c_cmdStateNoEnergy        = (1 << 10);
  3083. const int c_cmdStateNoMinerals      = (1 << 11);
  3084. const int c_cmdStateNoVespene       = (1 << 12);
  3085. const int c_cmdStateNoTerrazine     = (1 << 13);
  3086. const int c_cmdStateNoCustom        = (1 << 14);
  3087. const int c_cmdStateNoFood          = (1 << 15);
  3088. const int c_cmdStateCantSpend       = (1 << 16);
  3089.  
  3090. native bool     UnitCheckAbilCmdState (unit inUnit, abilcmd inAbilCmd, int inState);
  3091.  
  3092. const int c_unitCargoUnitCount      = 0;    // Number of units contained as cargo
  3093. const int c_unitCargoSpaceTotal     = 1;    // Total cargo space
  3094. const int c_unitCargoSpaceUsed      = 2;    // Cargo space in use
  3095. const int c_unitCargoSpaceFree      = 3;    // Cargo space available (total - used)
  3096. const int c_unitCargoSizeAsCargo    = 4;    // Space used by this unit as cargo
  3097. const int c_unitCargoSizeMax        = 5;    // Maximum cargo size per unit this unit can contain
  3098. const int c_unitCargoPosition       = 6;    // Unit's index in the transport list
  3099.  
  3100. native void         UnitCargoCreate (unit inUnit, string inId, int inCount);
  3101. native unit         UnitCargoLastCreated ();
  3102. native unitgroup    UnitCargoLastCreatedGroup ();
  3103. native unit         UnitCargo (unit inUnit, int inIndex);
  3104. native unitgroup    UnitCargoGroup (unit inUnit);
  3105. native int          UnitCargoValue (unit inUnit, int inValue);
  3106. native unit         UnitTransport (unit inUnit);
  3107.  
  3108. native unit     UnitAgent (unit inUnit, int inPlayer);
  3109.  
  3110. native void     UnitMagazineArm (unit inUnit, abilcmd inAbilCmd, int inCount);
  3111. native int      UnitMagazineCount (unit inUnit, string inAbil);
  3112.  
  3113. const int c_unitQueueTimeElapsed    = 0;
  3114. const int c_unitQueueTimeRemaining  = 1;
  3115. const int c_unitQueueTimeTotal      = 2;
  3116.  
  3117. const int c_unitQueuePropertyAvailable  = 0;
  3118. const int c_unitQueuePropertyTotal      = 1;
  3119. const int c_unitQueuePropertyUsed       = 2;
  3120. const int c_unitQueuePropertyCount      = 3;
  3121.  
  3122. native int      UnitQueueItemCount (unit inUnit, int inSlot);
  3123. native string   UnitQueueItemGet (unit inUnit, int inItem, int inSlot);
  3124. native fixed    UnitQueueItemTime (unit inUnit, int inTimeType, int inItem);
  3125. native bool     UnitQueueItemTypeCheck (unit inUnit, int inItem, int inType);
  3126. native int      UnitQueueGetProperty (unit inUnit, int inProp);
  3127.  
  3128. native bool     UnitMoverExists (unit inUnit, string inMover);
  3129. native bool     UnitTestPlane (unit inUnit, int inPlane);
  3130.  
  3131. // Unit progress
  3132. const int c_unitProgressTypeConstruct       = 0;
  3133. const int c_unitProgressTypeTrain           = 1;
  3134. const int c_unitProgressTypeResearch        = 2;
  3135. const int c_unitProgressTypeArmMagazine     = 3;
  3136. const int c_unitProgressTypeSpecialize      = 4;
  3137. const int c_unitProgressTypeRevive          = 5;
  3138. const int c_unitProgressTypeLearn           = 6;
  3139.  
  3140. const int c_unitProgressStageStart          = 0;
  3141. const int c_unitProgressStageCancel         = 1;
  3142. const int c_unitProgressStageComplete       = 2;
  3143. const int c_unitProgressStagePause          = 3;
  3144. const int c_unitProgressStageResume         = 4;
  3145.  
  3146. const int c_unitProgressStateEmpty          = 0;
  3147. const int c_unitProgressStateActive         = 1;
  3148. const int c_unitProgressStatePaused         = 2;
  3149.  
  3150. native fixed    UnitGetProgressComplete (unit inUnit, int inSlot);
  3151. native void     UnitSetProgressComplete (unit inUnit, int inSlot, int inPercent);
  3152. native void     UnitSetProgressStage (unit inUnit, int inSlot, int inStage);
  3153. native bool     UnitCheckProgressState (unit inUnit, int inSlot, int inState);
  3154.  
  3155. // Unit behaviors
  3156.  
  3157. // Behavior categories
  3158. const int c_unitBehaviorFlagPermanent           = 0;
  3159. const int c_unitBehaviorFlagRestorable          = 1;
  3160. const int c_unitBehaviorFlagTemporary           = 2;
  3161. // Behavior buff flags
  3162. const int c_unitBehaviorFlagChanneled           = 3;
  3163. const int c_unitBehaviorFlagChanneling          = 4;
  3164. const int c_unitBehaviorFlagCountdown           = 5;
  3165. const int c_unitBehaviorFlagExtend              = 6;
  3166. const int c_unitBehaviorFlagDisableBuilding     = 7;
  3167. const int c_unitBehaviorFlagRemoveDamageResponseExhausted = 8;
  3168. // Behavior info flags
  3169. const int c_unitBehaviorFlagHidden              = 9;
  3170. // Behavior count
  3171. const int c_unitBehaviorCountAll                = -1;
  3172.  
  3173. native void     UnitBehaviorAdd (unit inUnit, string inBehavior, unit inCaster, int inCount);
  3174. native void     UnitBehaviorAddPlayer (unit inUnit, string inBehavior, int inPlayer, int inCount);
  3175. native int      UnitBehaviorCountAll (unit inUnit);
  3176. native int      UnitBehaviorCount (unit inUnit, string inBehavior);
  3177. native fixed    UnitBehaviorDuration (unit inUnit, string inBehavior);
  3178. native void     UnitBehaviorSetDuration (unit inUnit, string inBehavior, fixed inDuration);
  3179. native bool     UnitBehaviorEnabled (unit inUnit, string inBehavior);
  3180. native string   UnitBehaviorGet (unit inUnit, int inIndex);
  3181. native bool     UnitHasBehavior (unit inUnit, string inBehavior);
  3182. native void     UnitBehaviorRemove (unit inUnit, string inBehavior, int inCount);
  3183. native void     UnitBehaviorRemovePlayer (unit inUnit, string inBehavior, int inPlayer, int inCount);
  3184. native void     UnitBehaviorTransfer (unit inSource, unit inDest, string inBehavior, int inCount);
  3185. native bool     UnitBehaviorHasFlag (string inBehavior, int inCategory);
  3186. native void     UnitBehaviorRemoveCategory (unit inUnit, int inCategory);
  3187.  
  3188. native void     UnitBehaviorAddChargeRegen (unit inUnit, string inBehavior, string inCharge, fixed inVal);
  3189. native fixed    UnitBehaviorGetChargeRegen (unit inUnit, string inBehavior, string inCharge);
  3190. native void     UnitBehaviorAddChargeUsed (unit inUnit, string inBehavior, string inCharge, fixed inVal);
  3191. native fixed    UnitBehaviorGetChargeUsed (unit inUnit, string inBehavior, string inCharge);
  3192.  
  3193. native void     UnitBehaviorAddCooldown (unit inUnit, string inBehavior, string inCooldown, fixed inVal);
  3194. native fixed    UnitBehaviorGetCooldown (unit inUnit, string inBehavior, string inCooldown);
  3195.  
  3196. native void     UnitXPGainEnable (unit inUnit, string inBehavior, bool inEnable);
  3197.  
  3198. // Unit markers
  3199. native marker   UnitMarker (unit inUnit, int inIndex);
  3200. native void     UnitMarkerAdd (unit inUnit, marker inMarker);
  3201. native int      UnitMarkerCount (unit inUnit, marker inMarker);
  3202. native void     UnitMarkerRemove (unit inUnit, marker inMarker);
  3203.  
  3204. // Unit orders
  3205. const int c_orderQueueReplace       = 0;
  3206. const int c_orderQueueAddToEnd      = 1;
  3207. const int c_orderQueueAddToFront    = 2;
  3208.  
  3209. native order    UnitOrder (unit inUnit, int inIndex);
  3210. native int      UnitOrderCount (unit inUnit);
  3211. native bool     UnitOrderHasAbil (unit inUnit, string abilLink);
  3212. native bool     UnitOrderIsValid (unit inUnit, order inOrder);
  3213.  
  3214. native bool     UnitIsHarvesting (unit inUnit, int inResource);
  3215.  
  3216. native bool     UnitIssueOrder (unit inUnit, order inOrder, int inQueueType);
  3217.  
  3218. // Unit rallying
  3219. native int      UnitRallyPoint (unit inUnit, unit inUser);
  3220. native int      UnitRallyPointCount (unit inUnit);
  3221. native int      UnitRallyPointTargetCount (unit inUnit, int inPoint);
  3222. native point    UnitRallyPointTargetPoint (unit inUnit, int inPoint, int inTarget);
  3223. native unit     UnitRallyPointTargetUnit (unit inUnit, int inPoint, int inTarget);
  3224.  
  3225. // Unit tech
  3226. native int UnitTechTreeBehaviorCount (unit inUnit, string behaviorType, int countType);
  3227. native int UnitTechTreeUnitCount (unit inUnit, string unitType, int countType);
  3228. native int UnitTechTreeUpgradeCount (unit inUnit, string upgradeType, int countType);
  3229.  
  3230. // Unit inventory
  3231. const int c_unitInventoryCountCarried    = 0;
  3232. const int c_unitInventoryCountEmpty      = 1;
  3233. const int c_unitInventoryCountTotal      = 2;
  3234.  
  3235. native int       UnitInventoryCount (unit inUnit, int inCountType);
  3236. native unit      UnitInventoryItem (unit inUnit, int inIndex);
  3237. native unitgroup UnitInventoryGroup (unit inUnit);
  3238. native unit      UnitInventoryCreate (unit inUnit, string itemType);
  3239. native unit      UnitInventoryLastCreated ();
  3240.  
  3241. // Unit weapons
  3242. native void         UnitWeaponAdd (unit inUnit, string inWeapon, string inTurret);
  3243. native int          UnitWeaponCount (unit inUnit);
  3244. native bool         UnitWeaponCheck (unit inUnit, int inIndex, int inTarget);
  3245. native string       UnitWeaponGet (unit inUnit, int inIndex);
  3246. native bool         UnitWeaponIsEnabled (unit inUnit, int inIndex);
  3247. native fixed        UnitWeaponPeriod (unit inUnit, int inIndex);
  3248. native void         UnitWeaponRemove (unit inUnit, string inWeapon);
  3249. native bool         UnitWeaponsPlaneTest (unit inUnit, int inPlane);
  3250.  
  3251. // Unit experience
  3252. native fixed    UnitXPTotal (unit inUnit);
  3253. native int      UnitLevel (unit inUnit);
  3254.  
  3255. // Unit Costs
  3256. const int c_unitCostMinerals            = 0;
  3257. const int c_unitCostVespene             = 1;
  3258. const int c_unitCostTerrazine           = 2;
  3259. const int c_unitCostCustomResource      = 3;
  3260. const int c_unitCostSumMineralsVespene  = 4;
  3261.  
  3262. native string UnitTypeFromString (string inString);
  3263. native text UnitTypeGetName (string inUnitType);
  3264. native fixed UnitTypeGetProperty (string inUnitType, int inProp);
  3265. native int UnitTypeGetCost (string inUnitType, int inCostType);
  3266. native bool UnitTypeTestFlag (string inUnitType, int inFlag);
  3267. native bool UnitTypeTestAttribute (string inUnitType, int inAttribute);
  3268. native bool UnitTypeIsAffectedByUpgrade (string inUnitType, string inUpgrade);
  3269.  
  3270. native void UnitTypeAnimationLoad (string inUnitType, string animPath);
  3271. native void UnitTypeAnimationUnload (string inUnitType, string animPath);
  3272.  
  3273. // Unit events
  3274. // Note: Use a null unit for "any unit" events
  3275.  
  3276. // Damage fatal option
  3277. const int c_unitDamageEither    = 0;
  3278. const int c_unitDamageFatal     = 1;
  3279. const int c_unitDamageNonFatal  = 2;
  3280.  
  3281. // Damage type
  3282. const int c_unitDamageTypeAny       = -1;
  3283. const int c_unitDamageTypeSpell     = 0;
  3284. const int c_unitDamageTypeMelee     = 1;
  3285. const int c_unitDamageTypeRanged    = 2;
  3286. const int c_unitDamageTypeSplash    = 3;
  3287.  
  3288. native void     TriggerAddEventUnitCreated (trigger t, unitref u, string creatorAbil, string creatorBehavior);
  3289. native void     TriggerAddEventUnitRemoved (trigger t, unitref u);
  3290. native void     TriggerAddEventUnitDied (trigger t, unitref u);
  3291. native void     TriggerAddEventUnitGainExperience (trigger t, unitref u);
  3292. native void     TriggerAddEventUnitGainLevel (trigger t, unitref u);
  3293. native void     TriggerAddEventUnitAcquiredTarget (trigger t, unitref u);
  3294. native void     TriggerAddEventUnitStartedAttack (trigger t, unitref u);
  3295. native void     TriggerAddEventUnitAttacked (trigger t, unitref u);
  3296. native void     TriggerAddEventUnitAttributeChange (trigger t, unitref u);
  3297. native void     TriggerAddEventUnitDamaged (trigger inTrigger, unitref inUnit, int inDamageType, int inDamageFatal, string inEffect);
  3298. native void     TriggerAddEventUnitBecomesIdle (trigger t, unitref u, bool idle);
  3299.  
  3300. native unit     EventUnit ();
  3301. native unit     EventUnitTarget ();
  3302.  
  3303. // Responses
  3304. // - c_unitEventCreated
  3305. native unit     EventUnitCreatedUnit ();
  3306. native string   EventUnitCreatedAbil ();
  3307. native string   EventUnitCreatedBehavior ();
  3308.  
  3309. // - c_unitEventDamaged
  3310. // - c_unitEventDied
  3311. native fixed    EventUnitDamageAmount ();
  3312. native unit     EventUnitDamageSourceUnit ();
  3313. native int      EventUnitDamageSourcePlayer ();
  3314. native point    EventUnitDamageSourcePoint ();
  3315. native bool     EventUnitDamageDeathCheck (int inType);
  3316. native string   EventUnitDamageEffect ();
  3317.  
  3318. // - c_unitEventGainExperience
  3319. // - c_unitEventGainLevel
  3320. native string   EventUnitBehavior ();
  3321. native fixed    EventUnitXPDelta ();
  3322. native int      EventUnitAttributePoints ();
  3323.  
  3324. // Property change events
  3325. native void     TriggerAddEventUnitProperty (trigger t, unitref u, int prop);
  3326.  
  3327. // State events
  3328. //   region/range events    - true = entered,       false = exited
  3329. //   cargo events           - true = loaded,        false = unloaded
  3330. //   selection events       - true = selected,      false = deselected
  3331. //   highlight events       - true = highlighted,   false = unhighlighted
  3332. //
  3333. native void     TriggerAddEventUnitRegion (trigger t, unitref u, region r, bool state);
  3334. native void     TriggerAddEventUnitRange (trigger t, unitref u, unit fromUnit, fixed range, bool state);
  3335. native void     TriggerAddEventUnitRangePoint (trigger t, unitref u, point p, fixed distance, bool state);
  3336. native void     TriggerAddEventUnitCargo (trigger t, unitref u, bool state);
  3337.  
  3338. native region   EventUnitRegion ();
  3339. native unit     EventUnitCargo ();
  3340.  
  3341. // Player events
  3342. // Note: EventPlayer (defined in the Players section) is valid for these events
  3343. //
  3344. native void     TriggerAddEventUnitSelected (trigger t, unitref u, int player, bool state);
  3345. native void     TriggerAddEventUnitClick (trigger t, unitref u, int player);
  3346. native void     TriggerAddEventUnitHighlight (trigger t, unitref u, int player, bool state);
  3347.  
  3348. // Order events
  3349. native void     TriggerAddEventUnitOrder (trigger t, unitref u, abilcmd a);
  3350. native order    EventUnitOrder ();
  3351.  
  3352. // Ability events
  3353. const int c_unitAbilStageComplete           = -6;
  3354. const int c_unitAbilStagePreempt            = -5;
  3355. const int c_unitAbilStageCancel             = -4;
  3356. const int c_unitAbilStageExecute            = -3;
  3357. const int c_unitAbilStageQueue              = -2;
  3358. const int c_unitAbilStageAll                = -1;
  3359.  
  3360. native void     TriggerAddEventUnitAbility (trigger t, unitref u, abilcmd a, int stage, bool includeSharedAbils);
  3361.  
  3362. native abilcmd  EventUnitAbility ();
  3363. native int      EventUnitAbilityStage ();
  3364. native point    EventUnitTargetPoint ();
  3365. native unit     EventUnitTargetUnit ();
  3366.  
  3367. // Progress events
  3368. native void     TriggerAddEventUnitConstructProgress (trigger t, unitref u, int stage);
  3369. native void     TriggerAddEventUnitTrainProgress (trigger t, unitref u, int stage);
  3370. native void     TriggerAddEventUnitResearchProgress (trigger t, unitref u, int stage);
  3371. native void     TriggerAddEventUnitArmMagazineProgress (trigger t, unitref u, int stage);
  3372. native void     TriggerAddEventUnitSpecializeProgress (trigger t, unitref u, int stage);
  3373.  
  3374. native string   EventUnitProgressObjectType (); // The type of object being trained/researched/etc
  3375. native unit     EventUnitProgressUnit ();       // The unit being trained, if any
  3376.  
  3377. // Powerup
  3378. native void     TriggerAddEventUnitPowerup (trigger t, unitref u);
  3379. native unit     EventUnitPowerupUnit ();
  3380.  
  3381. // Revive
  3382. native void     TriggerAddEventUnitRevive (trigger t, unitref u);
  3383.  
  3384. //--------------------------------------------------------------------------------------------------
  3385. // Unit Filters
  3386. //--------------------------------------------------------------------------------------------------
  3387. // Construct a unitfilter based on bit flags corresponding to c_targetFilter<*> constants
  3388. // Note: If the target flag is >= than 32, it should go in the second integer.  For example:
  3389. //
  3390. //       UnitFilter (
  3391. //          (1 << c_targetFilterGround),                // Require ground
  3392. //          0,
  3393. //          0,
  3394. //          (1 << (c_targetFilterInvulnerable - 32))    // Exclude invulnerable
  3395. //       );
  3396. //
  3397. native unitfilter UnitFilter (int inRequired1, int inRequired2, int inExcluded1, int inExcluded2);
  3398. native unitfilter UnitFilterStr (string filters);
  3399.  
  3400. // Set/Get individual filter states by index
  3401. //
  3402. const int c_unitFilterAllowed   = 0;    // Neither required nor excluded
  3403. const int c_unitFilterRequired  = 1;
  3404. const int c_unitFilterExcluded  = 2;
  3405.  
  3406. native void UnitFilterSetState (unitfilter inFilter, int inType, int inState);
  3407. native int  UnitFilterGetState (unitfilter inFilter, int inType);
  3408. native bool UnitFilterMatch (unit inUnit, int inPlayer, unitfilter inFilter);
  3409.  
  3410. //--------------------------------------------------------------------------------------------------
  3411. // Unit Groups
  3412. //--------------------------------------------------------------------------------------------------
  3413. const int c_unitAllianceAny                = 0; // Any unit
  3414. const int c_unitAllianceAlly               = 1; // Units owned by allied players
  3415. const int c_unitAllianceEnemy              = 2; // Units owned by enemy players
  3416. const int c_unitAllianceAllyExcludeSelf    = 3; // Units owned by allied players not owned by player
  3417. const int c_unitAllianceAnyExcludeSelf     = 4; // Any unit not owned by player
  3418.  
  3419. const int c_noMaxCount = 0;
  3420.  
  3421. native unitgroup UnitGroupEmpty ();
  3422. native unitgroup UnitGroupCopy (unitgroup inGroup);
  3423. native unitgroup UnitGroupFromId (int id);
  3424. native unitgroup UnitGroup (string type, int player, region r, unitfilter filter, int maxCount);
  3425. native unitgroup UnitGroupAlliance (int player, int alliance, region r, unitfilter filter, int maxCount);
  3426. native unitgroup UnitGroupFilter (string type, int player, unitgroup g, unitfilter filter, int maxCount);
  3427. native unitgroup UnitGroupFilterAlliance (unitgroup g, int player, int alliance, int maxCount);
  3428. native unitgroup UnitGroupFilterPlane (unitgroup g, int plane, int maxCount);
  3429. native unitgroup UnitGroupFilterPlayer (unitgroup g, int player, int maxCount);
  3430. native unitgroup UnitGroupFilterRegion (unitgroup g, region r, int maxCount);
  3431. native unitgroup UnitGroupFilterThreat (unitgroup g, unit u, string alternateType, int maxCount);
  3432. native unitgroup UnitGroupIdle (int player, bool workerOnly);
  3433.  
  3434. native void UnitGroupClear (unitgroup inGroup);
  3435. native void UnitGroupAdd (unitgroup inGroup, unit inUnit);
  3436. native void UnitGroupRemove (unitgroup inGroup, unit inUnit);
  3437.  
  3438. native bool UnitGroupIssueOrder (unitgroup inGroup, order inOrder, int inQueueType);
  3439. native void UnitGroupWaitUntilIdle (unitgroup inGroup, int inCount, bool inIdle);
  3440.  
  3441. const int c_unitCountAll    = 0;
  3442. const int c_unitCountAlive  = 1;
  3443. const int c_unitCountDead   = 2;
  3444.  
  3445. native int  UnitGroupCount (unitgroup inGroup, int inType);
  3446. native unit UnitGroupUnit (unitgroup inGroup, int inIndex); // index is one-based
  3447. native unit UnitGroupRandomUnit (unitgroup inGroup, int inType);
  3448. native bool UnitGroupHasUnit (unitgroup inGroup, unit inUnit);
  3449. native bool UnitGroupTestPlane (unitgroup inGroup, int inPlane);
  3450. native unit UnitGroupNearestUnit (unitgroup inGroup, point inPoint);
  3451.  
  3452. //--------------------------------------------------------------------------------------------------
  3453. // Unit Reference
  3454. // - A unitref may refer to a unit explicitly or through a unit variable
  3455. //--------------------------------------------------------------------------------------------------
  3456. native unitref UnitRefFromUnit (unit u);
  3457. native unitref UnitRefFromVariable (string v);
  3458.  
  3459. native unit UnitRefToUnit (unitref r);
  3460.  
  3461. //--------------------------------------------------------------------------------------------------
  3462. // Unit Selection
  3463. //
  3464. // Notes:
  3465. // - UnitSelect and UnitGroupSelect set the local selection state,
  3466. //   which must be then transmitted across the network.
  3467. //
  3468. //   However, UnitIsSelected and UnitGroupSelected query the synchronous selection state,
  3469. //   which means that if you set the selection, then immediately query it, the results will
  3470. //   not match.
  3471. //
  3472. // - Unit selection state cannot be set during map initialization events.
  3473. //
  3474. //--------------------------------------------------------------------------------------------------
  3475. native void         UnitSelect (unit inUnit, int inPlayer, bool inSelect);
  3476. native void         UnitGroupSelect (unitgroup inGroup, int inPlayer, bool inSelect);
  3477. native void         UnitClearSelection (int inPlayer);
  3478.  
  3479. native bool         UnitIsSelected (unit inUnit, int inPlayer);
  3480. native unitgroup    UnitGroupSelected (int inPlayer);
  3481.  
  3482. native void         UnitFlashSelection (unit inUnit, fixed inPeriod);
  3483.  
  3484. // Control groups
  3485. native void         UnitControlGroupAddUnit (int inPlayer, int inGroup, unit inUnit);
  3486. native void         UnitControlGroupAddUnits (int inPlayer, int inGroup, unitgroup inUnits);
  3487. native void         UnitControlGroupRemoveUnit (int inPlayer, int inGroup, unit inUnit);
  3488. native void         UnitControlGroupRemoveUnits (int inPlayer, int inGroup, unitgroup inUnits);
  3489. native void         UnitControlGroupClear (int inPlayer, int inGroup);
  3490.  
  3491. //--------------------------------------------------------------------------------------------------
  3492. // User Interface
  3493. //--------------------------------------------------------------------------------------------------
  3494. const fixed c_transitionDurationImmediate   = 0.0;
  3495. const fixed c_transitionDurationDefault     = -1.0;
  3496.  
  3497. const int   c_messageAreaAll                = 0;
  3498. const int   c_messageAreaChat               = 1;
  3499. const int   c_messageAreaObjective          = 2;
  3500. const int   c_messageAreaDirective          = 3;
  3501. const int   c_messageAreaError              = 4;
  3502. const int   c_messageAreaSubtitle           = 5;
  3503. const int   c_messageAreaCinematic          = 6;
  3504. const int   c_messageAreaDebug              = 7;
  3505. const int   c_messageAreaWarning            = 8;
  3506.  
  3507. const int   c_uiModeFullscreen              = 0;
  3508. const int   c_uiModeLetterboxed             = 1;
  3509. const int   c_uiModeConsole                 = 2;
  3510.  
  3511. const int   c_mouseButtonNone               = 0;
  3512. const int   c_mouseButtonLeft               = 1;
  3513. const int   c_mouseButtonMiddle             = 2;
  3514. const int   c_mouseButtonRight              = 3;
  3515. const int   c_mouseButtonXButton1           = 4;
  3516. const int   c_mouseButtonXButton2           = 5;
  3517.  
  3518. const int   c_scaleNormal                   = 0;
  3519. const int   c_scaleAspect                   = 1;
  3520. const int   c_scaleStretch                  = 2;
  3521.  
  3522. const int c_keyNone                  = -1;
  3523. const int c_keyShift                 = 0;
  3524. const int c_keyControl               = 1;
  3525. const int c_keyAlt                   = 2;
  3526. const int c_key0                     = 3;
  3527. const int c_key1                     = 4;
  3528. const int c_key2                     = 5;
  3529. const int c_key3                     = 6;
  3530. const int c_key4                     = 7;
  3531. const int c_key5                     = 8;
  3532. const int c_key6                     = 9;
  3533. const int c_key7                     = 10;
  3534. const int c_key8                     = 11;
  3535. const int c_key9                     = 12;
  3536. const int c_keyA                     = 13;
  3537. const int c_keyB                     = 14;
  3538. const int c_keyC                     = 15;
  3539. const int c_keyD                     = 16;
  3540. const int c_keyE                     = 17;
  3541. const int c_keyF                     = 18;
  3542. const int c_keyG                     = 19;
  3543. const int c_keyH                     = 20;
  3544. const int c_keyI                     = 21;
  3545. const int c_keyJ                     = 22;
  3546. const int c_keyK                     = 23;
  3547. const int c_keyL                     = 24;
  3548. const int c_keyM                     = 25;
  3549. const int c_keyN                     = 26;
  3550. const int c_keyO                     = 27;
  3551. const int c_keyP                     = 28;
  3552. const int c_keyQ                     = 29;
  3553. const int c_keyR                     = 30;
  3554. const int c_keyS                     = 31;
  3555. const int c_keyT                     = 32;
  3556. const int c_keyU                     = 33;
  3557. const int c_keyV                     = 34;
  3558. const int c_keyW                     = 35;
  3559. const int c_keyX                     = 36;
  3560. const int c_keyY                     = 37;
  3561. const int c_keyZ                     = 38;
  3562. const int c_keySpace                 = 39;
  3563. const int c_keyGrave                 = 40;
  3564. const int c_keyNumPad0               = 41;
  3565. const int c_keyNumPad1               = 42;
  3566. const int c_keyNumPad2               = 43;
  3567. const int c_keyNumPad3               = 44;
  3568. const int c_keyNumPad4               = 45;
  3569. const int c_keyNumPad5               = 46;
  3570. const int c_keyNumPad6               = 47;
  3571. const int c_keyNumPad7               = 48;
  3572. const int c_keyNumPad8               = 49;
  3573. const int c_keyNumPad9               = 50;
  3574. const int c_keyNumPadPlus            = 51;
  3575. const int c_keyNumPadMinus           = 52;
  3576. const int c_keyNumPadMultiply        = 53;
  3577. const int c_keyNumPadDivide          = 54;
  3578. const int c_keyNumPadDecimal         = 55;
  3579. const int c_keyEquals                = 56;
  3580. const int c_keyMinus                 = 57;
  3581. const int c_keyBracketOpen           = 58;
  3582. const int c_keyBracketClose          = 59;
  3583. const int c_keyBackSlash             = 60;
  3584. const int c_keySemiColon             = 61;
  3585. const int c_keyApostrophe            = 62;
  3586. const int c_keyComma                 = 63;
  3587. const int c_keyPeriod                = 64;
  3588. const int c_keySlash                 = 65;
  3589. const int c_keyEscape                = 66;
  3590. const int c_keyEnter                 = 67;
  3591. const int c_keyBackSpace             = 68;
  3592. const int c_keyTab                   = 69;
  3593. const int c_keyLeft                  = 70;
  3594. const int c_keyUp                    = 71;
  3595. const int c_keyRight                 = 72;
  3596. const int c_keyDown                  = 73;
  3597. const int c_keyInsert                = 74;
  3598. const int c_keyDelete                = 75;
  3599. const int c_keyHome                  = 76;
  3600. const int c_keyEnd                   = 77;
  3601. const int c_keyPageUp                = 78;
  3602. const int c_keyPageDown              = 79;
  3603. const int c_keyCapsLock              = 80;
  3604. const int c_keyNumLock               = 81;
  3605. const int c_keyScrollLock            = 82;
  3606. const int c_keyPause                 = 83;
  3607. const int c_keyPrintScreen           = 84;
  3608. const int c_keyNextTrack             = 85;
  3609. const int c_keyPrevTrack             = 86;
  3610. const int c_keyF1                    = 87;
  3611. const int c_keyF2                    = 88;
  3612. const int c_keyF3                    = 89;
  3613. const int c_keyF4                    = 90;
  3614. const int c_keyF5                    = 91;
  3615. const int c_keyF6                    = 92;
  3616. const int c_keyF7                    = 93;
  3617. const int c_keyF8                    = 94;
  3618. const int c_keyF9                    = 95;
  3619. const int c_keyF10                   = 96;
  3620. const int c_keyF11                   = 97;
  3621. const int c_keyF12                   = 98;
  3622.  
  3623. const int c_keyModifierStateIgnore  = 0;
  3624. const int c_keyModifierStateRequire = 1;
  3625. const int c_keyModifierStateExclude = 2;
  3626.  
  3627. // Types of custom dialogs
  3628. const int c_customDialogTypeMessage = 0;
  3629. const int c_customDialogTypeQuery   = 1;
  3630.  
  3631. // Results of custom dialogs
  3632. const int c_customDialogResultAny = 0;
  3633. const int c_customDialogResultYes = 1;
  3634. const int c_customDialogResultNo  = 2;
  3635.    
  3636. // Frames that can be synchronously shown / hidden
  3637. const int c_syncFrameTypeMenuBar              = 0;
  3638. const int c_syncFrameTypeCashPanel            = 1;
  3639. const int c_syncFrameTypeTipAlertPanel        = 2;
  3640. const int c_syncFrameTypeObjectivePanel       = 3;    
  3641. const int c_syncFrameTypeCharacterSheetButton = 4;
  3642. const int c_syncFrameTypeSupply               = 5;
  3643. const int c_syncFrameTypeResourcePanel        = 6;
  3644. const int c_syncFrameTypeRoomPanel            = 7;
  3645. const int c_syncFrameTypePlanetPanel          = 8;
  3646. const int c_syncFrameTypeMercenaryPanel       = 9;
  3647. const int c_syncFrameTypeResearchPanel        = 10;
  3648. const int c_syncFrameTypePurchasePanel        = 11;
  3649. const int c_syncFrameTypeVictoryPanel         = 12;
  3650. const int c_syncFrameTypeBattleReportPanel    = 13;
  3651. const int c_syncFrameTypeAlertPanel           = 14;
  3652. const int c_syncFrameTypeHeroPanel            = 15;
  3653. const int c_syncFrameTypeErrorDisplayPanel    = 16;
  3654. const int c_syncFrameTypeCreditsPanel         = 17;
  3655. const int c_syncFrameTypeTechTreePanel        = 18;
  3656. const int c_syncFrameTypeTechGlossaryPanel    = 19;
  3657.  
  3658. // Game Menu Dialog Items
  3659. const int c_gameMenuDialogItemAny                     = -1;
  3660.    
  3661. // Buttons that can be renamed
  3662. const int c_gameMenuDialogAbortButton                 = 0;  
  3663. const int c_gameMenuDialogGenericButton1              = 1;
  3664. const int c_gameMenuDialogGenericButton2              = 2;
  3665. const int c_gameMenuDialogGenericButton3              = 3;
  3666. const int c_gameMenuDialogGenericButton4              = 4;
  3667. const int c_gameMenuDialogGenericButton5              = 5;
  3668. const int c_gameMenuDialogGenericButton6              = 6;
  3669. const int c_gameMenuDialogGenericButton7              = 7;
  3670. const int c_gameMenuDialogGenericButton8              = 8;
  3671. const int c_gameMenuDialogGenericButton9              = 9;
  3672. const int c_gameMenuDialogGenericButton10             = 10;  
  3673.  
  3674. // Buttons that cannot be renamed
  3675. const int c_gameMenuDialogOptionsButton               = 11;    
  3676. const int c_gameMenuDialogLoadButton                  = 12;
  3677. const int c_gameMenuDialogSaveButton                  = 13;
  3678. const int c_gameMenuDialogPauseButton                 = 14;
  3679. const int c_gameMenuDialogRestartButton               = 15;        
  3680. const int c_gameMenuDialogReturnToGameplayButton      = 16;    
  3681. const int c_gameMenuDialogRestartDifficultyPulldown   = 17;            
  3682. const int c_gameMenuDialogQuitButton                  = 18;  
  3683.  
  3684. // UI command allowables
  3685. const int c_uiCommandAllowButtons       = 0;
  3686. const int c_uiCommandAllowHotkeys       = 1;
  3687. const int c_uiCommandAllowSmartClick    = 2;
  3688. const int c_uiCommandAllowModifiers     = 3;
  3689. const int c_uiCommandAllowInfoPanel     = 4;
  3690. const int c_uiCommandAllowMinimap       = 5;
  3691. const int c_uiCommandAllowPings         = 6;
  3692.    
  3693. native void         UISetMode (playergroup players, int mode, fixed duration);
  3694. native void         UISetWorldVisible (playergroup players, bool isVisible);
  3695. native void         UISetCursorVisible (playergroup players, bool isCursorVisible);
  3696. native void         UISetCursorAutoHide (playergroup players, bool autoHide, fixed delay);
  3697.  
  3698. native void         UIDisplayMessage (playergroup players, int messageArea, text messageText);
  3699. native void         UIClearMessages (playergroup players, int messageArea);
  3700.  
  3701. native void         UIShowCinematicText (playergroup inPlayers, text inMessageText, fixed inTimeBetweenCharacters, fixed inMaxTime, soundlink inSoundLink);
  3702. native void         UIHideCinematicText (playergroup inPlayers);
  3703.  
  3704. native void         UIShowTextCrawl (playergroup inPlayers, text inTitle, text inText, fixed inMaxTime, soundlink inBirthSoundLink, soundlink inTypeSoundLink);
  3705. native void         UIHideTextCrawl (playergroup inPlayers);
  3706.  
  3707. native void         UIUnitColorStyleOverride (playergroup inPlayers, int style);
  3708. native void         UIUnitColorStyleClearOverride (playergroup inPlayers);
  3709.  
  3710. native void         UISetNextLoadingScreen (string imagePath, text title, text subtitle, text body, text  help, bool waitForInput);
  3711. native void         UISetNextLoadingScreenImageScale (int imageScale);
  3712. native void         UISetNextLoadingScreenTextPosition (int anchor, int offsetX, int offsetY, int width, int height);
  3713.  
  3714. native void         UISetRestartLoadingScreen (text  help);
  3715.  
  3716. // Alerts (message display and recall via spacebar to a given point or unit)
  3717. // - icon may be null for the default icon
  3718. //
  3719. native void         UIAlert (string alert, int player, text message, string icon);
  3720. native void         UIAlertPoint (string alert, int player, text message, string icon, point p);
  3721. native void         UIAlertUnit (string alert, int player, text message, string icon, unit u);
  3722. native void         UIAlertClear (int player);
  3723.  
  3724. native void         UISetFrameVisible (playergroup inPlayers, int inFrameType, bool inVisible);
  3725. native bool         UIFrameVisible (int inPlayer, int inFrameType);
  3726.  
  3727. native void         UISetGameMenuItemVisible (playergroup inPlayers, int inMenuItemType, bool inVisible);
  3728. native bool         UIGameMenuItemVisible (int inPlayer, int inMenuItemType);
  3729. native void         UISetGameMenuItemText (playergroup inPlayers, int inMenuItemType, text inText);
  3730.  
  3731. native void         UIClearCustomMenuItemList (playergroup inPlayers);
  3732. native void         UISetCustomMenuItemVisible (playergroup inPlayers, int inMenuItemType, bool inVisible);
  3733. native bool         UICustomMenuItemVisible (int inPlayer, int inMenuItemType);
  3734. native void         UISetCustomMenuItemText (playergroup inPlayers, int inMenuItemType, text inText);
  3735. native void         UIShowCustomMenu (playergroup inPlayers, text inTitleText);
  3736.  
  3737. native void         UIShowCustomDialog (playergroup inPlayers, int inType, text inTitle, text inText, bool pause);
  3738.  
  3739. native void         UISetResourceTradeCountdownTime (int time);
  3740.  
  3741. native void         UISetButtonHighlighted (playergroup inPlayers, abilcmd inAbilCmd, bool inHighlight);
  3742. native void         UISetMiniMapBackGroundColor (color inColor);
  3743.  
  3744. native void         UISetCommandAllowed (playergroup players, int option, bool allow);
  3745. native void         UISetCommandDisallowedMessage (playergroup players, text message);
  3746.  
  3747. // User Interface events
  3748. native void         TriggerAddEventAbortMission (trigger t, int player);
  3749. native void         TriggerAddEventCustomDialogDismissed (trigger t, int player, int result);
  3750. native void         TriggerAddEventGameMenuItemSelected (trigger t, int player, int gameMenuIndex);
  3751. native void         TriggerAddEventMouseClicked (trigger t, int player, int mouseButton, bool down);
  3752. native void         TriggerAddEventKeyPressed (trigger t, int player, int key, bool down, int s, int c, int a);
  3753. native void         TriggerAddEventButtonPressed (trigger t, int player, string button);
  3754. native void         TriggerAddEventGameCreditsFinished (trigger t, int player);
  3755.  
  3756. native int          EventCustomDialogResult ();
  3757. native int          EventGameMenuItemSelected ();
  3758. native int          EventMouseClickedButton ();
  3759. native int          EventMouseClickedPosXUI ();
  3760. native int          EventMouseClickedPosYUI ();
  3761. native fixed        EventMouseClickedPosXWorld ();
  3762. native fixed        EventMouseClickedPosYWorld ();
  3763. native fixed        EventMouseClickedPosZWorld ();
  3764.  
  3765. native int          EventKeyPressed ();
  3766. native bool         EventKeyShift ();
  3767. native bool         EventKeyControl ();
  3768. native bool         EventKeyAlt ();
  3769.  
  3770. native string       EventButtonPressed ();
  3771.  
  3772. //--------------------------------------------------------------------------------------------------
  3773. // Visibility
  3774. //--------------------------------------------------------------------------------------------------
  3775. const int c_visTypeMask     = 0;
  3776. const int c_visTypeFog      = 1;
  3777.  
  3778. native void     VisEnable (int visType, bool enable);
  3779. native bool     VisIsEnabled (int visType);
  3780.  
  3781. native void     VisExploreArea (int player, region area, bool explored, bool checkCliffLevel);
  3782. native void     VisRevealArea (int player, region area, fixed duration, bool checkCliffLevel); // Zero duration means permanent
  3783.  
  3784. native revealer VisRevealerCreate (int player, region area);
  3785. native revealer VisRevealerLastCreated ();
  3786. native void     VisRevealerDestroy (revealer r);
  3787. native void     VisRevealerEnable (revealer r, bool enable);
  3788. native void     VisRevealerUpdate (revealer r); // Update revealer after region has changed
  3789.  
  3790.  
  3791. include "TriggerLibs/AI"
  3792. include "TriggerLibs/CampaignAI"
  3793. include "TriggerLibs/MeleeAI"
  3794. include "TriggerLibs/TacticalAI"
  3795.  
  3796. // $AS - Trigger Editor(Bug 33070): In order for line numbers to be correct you need a newline at the end of this file
Add Comment
Please, Sign In to add comment