JademusSreg

Starcraft 2 natives.galaxy [patch 1.4]

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