Advertisement
JademusSreg

1.5.0 - 2.0.4 Galaxy native & constant additions

Feb 20th, 2013
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 23.95 KB | None | 0 0
  1. //==================================================================================================
  2. //
  3. //  natives.galaxy
  4. //
  5. //==================================================================================================
  6. //--------------------------------------------------------------------------------------------------
  7. // Achievements
  8. //--------------------------------------------------------------------------------------------------
  9. native bool AchievementsDisabled (int player);
  10.  
  11. //--------------------------------------------------------------------------------------------------
  12. // Bank
  13. //--------------------------------------------------------------------------------------------------
  14. native void     BankReload (bank b);
  15. native void     BankWait (bank b);
  16. native void     BankSectionCreate (bank b, string section);
  17.  
  18. //--------------------------------------------------------------------------------------------------
  19. // Battle Report
  20. //--------------------------------------------------------------------------------------------------
  21. native int      BattleReportGetDialogControl ();
  22. native int      BattleReportGetState (int inBattleReportId);
  23. native int      BattleReportGetPriority (int inBattleReportId);
  24. native text     BattleReportGetButtonText (int inBattleReportId);
  25. native string   BattleReportGetButtonImage (int inBattleReportId);
  26. native text     BattleReportGetMissionText (int inBattleReportId);
  27. native text     BattleReportGetResearchTitle (int inBattleReportId);
  28. native text     BattleReportGetResearchText (int inBattleReportId);
  29. native text     BattleReportGetBonusTitle (int inBattleReportId);
  30. native text     BattleReportGetBonusText (int inBattleReportId);
  31. native text     BattleReportGetBestTimeText (int inBattleReportId);
  32. native string   BattleReportGetMissionImage (int inBattleReportId);
  33. native bool     BattleReportGetDifficultyLevelCompleted (int inBattleReportId, int inDifficultyLevel);
  34. native text     BattleReportGetDifficultyLevelBestTimeText (int inBattleReportId, int inDifficultyLevel);
  35. native text     BattleReportGetSceneText (int inBattleReportId);
  36. native string   BattleReportGetSceneImage (int inBattleReportId);
  37. native bool     BattleReportGetShownInMissionTotal (int inBattleReportId);
  38.  
  39. //--------------------------------------------------------------------------------------------------
  40. // Boards
  41. //--------------------------------------------------------------------------------------------------
  42. native void         BoardSetAnchor (int inBoard, int inAnchor, int inOffsetX, int inOffsetY);
  43.  
  44. //--------------------------------------------------------------------------------------------------
  45. // Campaign
  46. //--------------------------------------------------------------------------------------------------
  47. native void     CampaignProgressDeleteCampaignSave (playergroup players); // Blizzard maps only
  48. native void     CampaignProgressEnableCampaignCompletedSaves (playergroup players, bool inDisable); // Blizzard maps only
  49.  
  50. //--------------------------------------------------------------------------------------------------
  51. // Cutscenes
  52. //--------------------------------------------------------------------------------------------------
  53. native int          CutsceneGetTriggerControl (int inControlId);
  54.  
  55. //--------------------------------------------------------------------------------------------------
  56. // Dialogs
  57. //--------------------------------------------------------------------------------------------------
  58. const int c_triggerControlTypeCutscene                  = 22;
  59.  
  60. const int c_triggerControlPropertyHotkey                = 65;       // int
  61. const int c_triggerControlPropertyAllowedButtons        = 66;       // int
  62. const int c_triggerControlPropertyAlphaMask             = 67;       // string
  63.  
  64. const int c_triggerControlEventTypeHotkeyPressed             = 8;
  65. const int c_triggerControlEventTypeDoubleClick               = 9;
  66.  
  67. native int      DialogControlHookupUnitStatus (int type, string inTemplate, unit inUnit);
  68. native void     DialogControlClearSelectedItem (int control, playergroup players);
  69. native int      EventDialogControlMouseButton ();
  70.  
  71. //--------------------------------------------------------------------------------------------------
  72. // Environment
  73. //--------------------------------------------------------------------------------------------------
  74. const int c_pathingUnpathable   = 0;
  75. const int c_pathingBuilding     = 2;
  76. const int c_pathingCliff        = 3;
  77.  
  78. native int      PathingType (point inPos);
  79.  
  80. //--------------------------------------------------------------------------------------------------
  81. // Game
  82. //--------------------------------------------------------------------------------------------------
  83. native bool     GameIsOnline ();
  84. native bool     GameDataIsFullyDownloaded (int player);
  85. native void     TriggerAddEventLoadGameDone (trigger t);
  86.  
  87. //--------------------------------------------------------------------------------------------------
  88. // Melee
  89. //--------------------------------------------------------------------------------------------------
  90. const int c_meleeOptionPoints           = 6;
  91.  
  92. //--------------------------------------------------------------------------------------------------
  93. // Objectives
  94. //--------------------------------------------------------------------------------------------------
  95. native int          ObjectiveGetPriority (int inObjective);
  96. native void         ObjectiveSetFirst (int inObjective);
  97. native void         ObjectiveSetLast (int inObjective);
  98. native void         ObjectiveSetAfter (int inObjective, int inAfterObjective);
  99. native void         ObjectiveSetBefore (int inObjective, int inBeforeObjective);
  100.  
  101. //--------------------------------------------------------------------------------------------------
  102. // Path
  103. //--------------------------------------------------------------------------------------------------
  104. const int c_abilClassFilterExcluded = -1;
  105. const int c_abilClassFilterAllowed = 0;
  106. const int c_abilClassFilterRequired = 1;
  107.  
  108. native void         PathSetAbilClassFilter (int inPathId, int inAbilClass, int inFilter);
  109.  
  110. //--------------------------------------------------------------------------------------------------
  111. // Ping
  112. //--------------------------------------------------------------------------------------------------
  113. native void         PingSetUseUnitTeamColor (int p, bool useUnitTeamColor);
  114. native void         PingSetUseUnitVisibility (int p, bool useUnitVisibility);
  115.  
  116. //--------------------------------------------------------------------------------------------------
  117. // Help
  118. //--------------------------------------------------------------------------------------------------
  119. native void         HelpPanelSetHelpItemDarkenedWhenViewed (int inHelpItemId, bool inDarkened);
  120.  
  121. //--------------------------------------------------------------------------------------------------
  122. // Players
  123. //--------------------------------------------------------------------------------------------------
  124. const int c_playerPropDamageDealtTime       = 18;
  125. const int c_playerPropDamageTakenTime       = 19;
  126.  
  127. const int c_playerStateStartingRallyEnabled = 17; // Read-only
  128.  
  129. const int c_buildMenuOpening = 1; // uses c_customBuildOpeningOne to c_customBuildOpeningFive for inSlotNum
  130. const int c_buildMenuLateGame = 2; // uses c_customBuildLateGameOne to c_customBuildLateGameFive for inSlotNum
  131. const int c_buildMenuBeacons = 3; // only used for SlotInfo setup, uses c_beaconCustom1 to c_beaconCustom4 for inSlotNum
  132.  
  133. native int      PlayerAIBuildNumber (int player);
  134. native bool     PlayerHasAccessTo (int inPlayer, string inEntityName);
  135. native void PlayerBeaconBuildMenuSetSlotInfo (int inPlayer, int inType, int inSlotNum, text inIcon, text inName, text inTooltip);
  136. native void PlayerBeaconBuildMenuDisableSlotInfo (int inPlayer, int inType, int inSlotNum, bool disable); // disables the button
  137. native void PlayerBeaconBuildMenuClearSlotInfo (int inPlayer, int inType, int inSlotNum); // removes the button
  138. native void PlayerBeaconBuildMenuCurrentSet (int inPlayer, int inType, int inSlotNum); //only applies to build types
  139. native int PlayerBeaconBuildMenuCurrentGet (int inPlayer, int inType); //only applies to build types
  140. native bool PlayerBeaconBuildMenuWasFromPlayer (int inPlayer, int inType); //only applies to build types
  141.  
  142. //--------------------------------------------------------------------------------------------------
  143. // Points
  144. //--------------------------------------------------------------------------------------------------
  145. native point PointFromName (string name);
  146.  
  147. //--------------------------------------------------------------------------------------------------
  148. // Regions
  149. //--------------------------------------------------------------------------------------------------
  150. native region RegionFromName (string name);
  151.  
  152. //--------------------------------------------------------------------------------------------------
  153. // Sound
  154. //--------------------------------------------------------------------------------------------------
  155. native void     SoundChannelDSPInsert (playergroup players, int channel, string dsp);
  156. native void     SoundChannelDSPRemove (playergroup players, int channel, string dsp);
  157. native void     SoundtrackStopCurrent (playergroup players, int category, bool fade);
  158.  
  159. //--------------------------------------------------------------------------------------------------
  160. // Story Mode
  161. //--------------------------------------------------------------------------------------------------
  162. native void     StoryCreatePlanetPanel ();     //  Blizzard maps only
  163.  
  164. //--------------------------------------------------------------------------------------------------
  165. // Tech Tree
  166. //--------------------------------------------------------------------------------------------------
  167. native void     TechTreeSpecificRequirementEnable (int player, string requirementName, bool enable);
  168. native bool     TechTreeSpecificRequirementEnabled (int player, string requirementName);
  169.  
  170. //--------------------------------------------------------------------------------------------------
  171. // Timing
  172. //--------------------------------------------------------------------------------------------------
  173. const int c_timerWindowImageBorder          = 0;
  174. const int c_timerWindowImageBackground      = 1;
  175. const int c_timerWindowImageProgressFrame   = 2;
  176. const int c_timerWindowImageProgressFill    = 3;
  177.  
  178. native void     TimerWindowSetAnchor (int inWindow, int inAnchor, int inOffsetX, int inOffsetY);
  179. native void     TimerWindowSetFixedHeight (int inWindow, int inHeight);
  180. native void     TimerWindowShowBorder (int inWindow, bool inShow);
  181. native void     TimerWindowShowProgressBar (int inWindow, bool inShow);
  182. native void     TimerWindowSetProgressColor (int inWindow, color inColor, int inStep);
  183. native void     TimerWindowSetImageType (int inWindow, int inImage, int inType);
  184.  
  185. //--------------------------------------------------------------------------------------------------
  186. // Transmission
  187. //--------------------------------------------------------------------------------------------------
  188. native void TransmissionSourceSetStreamingAllowed (transmissionsource source, bool allowed);
  189.  
  190. //--------------------------------------------------------------------------------------------------
  191. // Triggers
  192. //--------------------------------------------------------------------------------------------------
  193. // Generic trigger event that can be sent via script
  194. // NOTE: This was my idea; I'm pretty awesome.
  195. native void     TriggerSendEvent (string name);
  196. native void     TriggerAddEventGeneric (trigger t, string name);
  197. native string   EventGenericName ();
  198. native void     TriggerDebugEnableType (int type, bool enable);
  199.  
  200. //--------------------------------------------------------------------------------------------------
  201. // Units
  202. //--------------------------------------------------------------------------------------------------
  203. const int c_killDisplayDefault = 0;
  204. const int c_killDisplayAlways = 1;
  205. const int c_killDisplayNever = 2;
  206.  
  207. const int c_unitBehaviorFlagUpdateDurationWhileDisabled = 10;
  208.  
  209. const int c_placementTestCreepMask = 1 << c_placementTestCreep;
  210. const int c_placementTestPowerMask = 1 << c_placementTestPower;
  211. const int c_placementTestFogMask = 1 << c_placementTestFog;
  212. const int c_placementTestIgnoreBlockersMask = 1 << c_placementTestIgnoreBlockers;
  213. const int c_placementTestIgnoreInvisibleMask = 1 << c_placementTestIgnoreInvisible;
  214. const int c_placementTestZoneMask = 1 << c_placementTestZone;
  215. const int c_placementTestCliffMask = 1 << c_placementTestCliff;
  216. const int c_placementTestDensityMask = 1 << c_placementTestDensity;
  217.  
  218. const int c_unitAbilAutoCastChangeAll       = -1;
  219. const int c_unitAbilAutoCastChangeOff       = 0;
  220. const int c_unitAbilAutoCastChangeOn        = 1;
  221.  
  222. native void UnitShowKillDisplay (unit inUnit, int inKillDisplay);
  223. native void UnitSetInfoText2 (unit inUnit, text info);
  224. native void UnitSetInfoTip (unit inUnit, text tip);
  225. native void UnitSetInfoSubTip (unit inUnit, text subTip);
  226. native unit         UnitMagazineLastCreated ();
  227. native unitgroup    UnitMagazineLastCreatedGroup ();
  228. native void      UnitInventoryContainerOpen (playergroup inPlayers, unit inUnit, int inContainer, bool inOpen);
  229. native point UnitTypePlacementTestsFromPoint (string inType, int inPlayer, point inSource, fixed inRange, int inTests);
  230. native point UnitTypePlacementTestsFromUnit (string inType, int inPlayer, unit inSource, fixed inRange, int inTests);
  231. native void UnitEventSetNullVariableInvalid (bool inVal);
  232. native void     TriggerAddEventUnitStartedAttack2 (trigger t, unitref u, string inWeapon);
  233. native void     TriggerAddEventUnitAttacked2 (trigger t, unitref u, string inWeapon);
  234. native string   EventUnitGetWeapon ();
  235. native fixed    EventUnitDamageAbsorbed ();
  236. native unit     EventUnitGetItem ();
  237. native string   EventUnitGetItemType ();
  238. native void     TriggerAddEventUnitAbilityAutoCastChange (trigger t, unitref u, abilcmd a, int inChangeType, bool includeSharedAbils);
  239.  
  240. //--------------------------------------------------------------------------------------------------
  241. // Unit Groups
  242. //--------------------------------------------------------------------------------------------------
  243. native int       UnitCount (string type, int player, region r, unitfilter filter, int maxCount);
  244. native int       UnitCountAlliance (int player, int alliance, region r, unitfilter filter, int maxCount);
  245.  
  246. //--------------------------------------------------------------------------------------------------
  247. // User Interface
  248. //--------------------------------------------------------------------------------------------------
  249. const int   c_mouseButtonFlagLeft           = (1 << 0);
  250. const int   c_mouseButtonFlagMiddle         = (1 << 1);
  251. const int   c_mouseButtonFlagRight          = (1 << 2);
  252. const int   c_mouseButtonFlagXButton1       = (1 << 3);
  253. const int   c_mouseButtonFlagXButton2       = (1 << 4);
  254.  
  255. const int   c_achievementToastStyleTerran   = 0;
  256. const int   c_achievementToastStyleZerg     = 1;
  257.  
  258. const int c_syncFrameTypeStatusUI               = 35;
  259. const int c_syncFrameTypeArmyButton             = 36;
  260.  
  261. const int c_gameMenuDialogLoadReplayButton            = 20; // unused
  262. const int c_gameMenuDialogLoadLastButton              = 21;
  263. const int c_gameMenuDialogMoreOptionsButton           = 22;
  264. const int c_gameMenuDialogEndGameButton               = 23;
  265. const int c_gameMenuDialogAchievementsButton          = 24;
  266. const int c_gameMenuDialogMessageLogButton            = 25;
  267.  
  268. const int c_localSelectionTypeArmyButton      = 9;
  269.  
  270. const int c_targetModeStateAny = -1;
  271. const int c_targetModeStateOff = 0;
  272. const int c_targetModeStateOn = 1;
  273.  
  274. native void         UISetMinimumLetterboxHeight (int inHeight);
  275. native void         UISetAchievementToastStyle (playergroup inPlayers, int style);
  276. native void         TriggerAddEventTargetModeUpdate (trigger t, int player, abilcmd inAbilCmd, int state);
  277. native abilcmd      EventTargetModeAbilCmd ();
  278. native int          EventTargetModeState ();
  279.  
  280. //--------------------------------------------------------------------------------------------------
  281. // Visibility
  282. //--------------------------------------------------------------------------------------------------
  283. native bool     VisIsVisibleForPlayer (int player, point inPos);
  284.  
  285. //==================================================================================================
  286. //
  287. //  AI.galaxy
  288. //
  289. //==================================================================================================
  290. //--------------------------------------------------------------------------------------------------
  291. //  Build and Train Priorities
  292. //--------------------------------------------------------------------------------------------------
  293. const int c_makePriorityDetection  = 8;
  294. const int c_makePriorityFood       = 9;
  295.  
  296. //--------------------------------------------------------------------------------------------------
  297. //  Town States
  298. //--------------------------------------------------------------------------------------------------
  299. const int c_townStateBuilding     = 2;
  300.  
  301. //--------------------------------------------------------------------------------------------------
  302. //  Wave States
  303. //--------------------------------------------------------------------------------------------------
  304. const int c_waveStateBeacon       = 12;
  305.  
  306. //--------------------------------------------------------------------------------------------------
  307. //  Best Target Flags
  308. //--------------------------------------------------------------------------------------------------
  309. const int c_btSortMeleeAllyAttackOnly   = 256;      // chooses the best target only considering already attacking computer allies
  310. const int c_btSortMeleeAllyDefendOnly   = 512;      // chooses the best target only considering computer allies that want help defending
  311. const int c_btMeleePreferSplitAttacking = 1024;     // melee AI will each try to hit different opponents rather than attacking the same target (weaker AI, but more fun to play against) (ignored for more than 2 teams)
  312.  
  313. const int c_btDefaultAllyAttackOnly     = 1 + 16 + 32 + 128 + 256;
  314. const int c_btDefaultAllyDefendOnly     = 1 + 16 + 32 + 128 + 512;
  315.  
  316. //--------------------------------------------------------------------------------------------------
  317. //  Difficulty
  318. //--------------------------------------------------------------------------------------------------
  319. const int c_diffLimitAPMCombat          = 7;  // If we're not limiting all APM, do we still limit combat APM  (has no effect if c_diffLimitAPM is Enabled since combat is limited by that).
  320. const int c_diffAdvancedRetreatLogic    = 20; // Controls whether the AI uses advanced logic when retreating (does a calculation to see if the enemy has faster unit that will continue to attack us while we retreat).
  321. const int c_diffAutoTransport           = 31; // Should transports automatically look for units unable to move to their goal and pick them up? (worker trying to expand to an island, etc).
  322.  
  323. const int c_skirAuto        =  0; // melee difficulty settings
  324. const int c_skirMed_Hard    =  4;
  325. const int c_skirHard_VH     =  6;
  326. const int c_skirChVision    =  8;
  327. const int c_skirChMoney     =  9;
  328. const int c_skirChInsane    = 10;
  329.  
  330. //--------------------------------------------------------------------------------------------------
  331. // Utility
  332. //--------------------------------------------------------------------------------------------------
  333. native void AISetCompNameToDiff (int player, int difficulty);
  334. native void AISetStockArmyDefaultScale (int player, fixed scale); // Sets the gloabl scale (doesn't change current army)
  335. native void AISetStockArmyOverride (int player, string data, int replaceCount, string replaceUnit);
  336. native void AIAddToStockArmy (int player, string data, int change); // AIAddStringInt with Scale & Override logic
  337. native void AIScaleCurrentStockArmy (int player, fixed scale, int start, int end); // Scales the current army
  338. // these calls can be expensive, they also ignore units/buildings when pathing. returns -1 if no path/known building
  339. native int AIPathDistToNearestKnownEnemyStructure (int player, point loc, bool onlyDropoffs);
  340. native int AIPathDistToNearestFriendlyStructure (int player, point loc, bool onlyDropoffs);
  341. native bool AICanPathToAnyKnownEnemyStructure (int player, point loc, bool onlyDropoffs);
  342. // all of these are known buildings only (enemies may have unknown buildings)
  343. native int AINumEnemyBuildings (int player);
  344. native void AIAddAirDanger (int player, string unitType);
  345. native bool AIDefaultSuspectAirDanger (int player);
  346. native int AIGetNumTeams (); // may not be accurate outside of regular melee games
  347. native int AIGetSelfRaceVal (int player);
  348. native int AIGetNumWorkers (int player);
  349. native int AIGetNumDropoffs (int player);
  350. native int AIGetNumEstablishedTowns (int player);
  351. native bool AIHasNearbyAlliedAttackers (int player, point loc, fixed range); // self or ally
  352. native bool AIHasNearbyAlliedDetector (int player, point loc, fixed staticRange, fixed mobileRange); // self or ally
  353.  
  354. //--------------------------------------------------------------------------------------------------
  355. // Coop Helper Functions
  356. //--------------------------------------------------------------------------------------------------
  357. const int c_coopTraining         = 0;
  358. const int c_coopWaveDefender     = 1;
  359. const int c_coopWaveAttacker     = 2;
  360. const int c_coopTurtle           = 3;
  361. const int c_coopCasterOnly       = 4;
  362. const int c_coopAirOnly          = 5;
  363. const int c_coopMultiRacial      = 6;
  364.  
  365. native void AISetCoopFlag (int player, int index, bool state);
  366. native bool AIGetCoopFlag (int player, int index);
  367. native point AIGetBuildingPlacement (int player, point center, string aliasUnitType, int buildFlags);
  368.  
  369. //--------------------------------------------------------------------------------------------------
  370. //  Construction
  371. //--------------------------------------------------------------------------------------------------
  372. native int AIGetInternalTrainQueueCount (int player);
  373. native int AIGetInternalBuildQueueCount (int player);
  374. native int AIGetInternalResearchQueueCount (int player);
  375. native void AISetDefaultArmyUnit (int player, string unitType);
  376. native void AIForceTrainingDelay (int player, int workerDelay, int armyDelay, int defenseDelay); // forced gaps in unit production for low difficulty
  377.  
  378. //--------------------------------------------------------------------------------------------------
  379. //  Stock
  380. //--------------------------------------------------------------------------------------------------
  381. const int c_stockNormal = 0;
  382. const int c_stockOptional = 1;
  383. const int c_stockExpansion = 2;
  384. const int c_stockDefense = 4;
  385. const int c_stockForced = 8;
  386.  
  387. //--------------------------------------------------------------------------------------------------
  388. //  Tactical
  389. //--------------------------------------------------------------------------------------------------
  390. native point AISelfReinforceDropPoint (int player);
  391. native void AIForceTacticalDelay (int player, int delay); // forced delay between all tactical spells for low difficulty
  392.  
  393. //--------------------------------------------------------------------------------------------------
  394. //  Combat
  395. //--------------------------------------------------------------------------------------------------
  396. native void AISetSpawnerTargettingDelay (int player, string behaviorName, int count);
  397.  
  398. //--------------------------------------------------------------------------------------------------
  399. //  Transports
  400. //--------------------------------------------------------------------------------------------------
  401. native void AITransportDisableAutoPickup (int player);
  402.  
  403. //--------------------------------------------------------------------------------------------------
  404. //  Waves
  405. //--------------------------------------------------------------------------------------------------
  406. native unit AIWaveCurrentLeader (wave w);
  407. native wavetarget AIWaveTargetMeleeBeacon (int player);
  408. native int AIEvalAllSelf (int player);
  409. native int AIEvalAllAllied (int player);
  410. native int AIEvalLargestEnemy (int player);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement