Advertisement
ZoriaRPG

std.txt for ZC 2.55

Nov 25th, 2016
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.41 KB | None | 0 0
  1. std.txt for ZC Versions 2.50.2 and higher.
  2. 17th July, 2016
  3.  
  4. =================
  5. --- Constants ---
  6. =================
  7.  
  8. const float PI, PI2, E
  9. * The mathematical constants pi, 2*pi and e.
  10.  
  11. const int NULL
  12. * Refers to an invalid array pointer, returned by ALLOCATEMEM when memory cannot be allocated
  13.  
  14. const int MAX_CONSTANT, float MAX_VARIABLE, int MAX_INT, float MAX_FLOAT
  15. const int MAX_COUNTER, int MIN_COUNTER
  16. const int MAX_LWEAPONS, int MAX_EWEAPONS, int MAX_NPCS, MAX_ITEMS, int MAX_OBJECT_POINTERS, int MAX_SPRITES
  17. const int MAX_DRAWING
  18. const int MAX_GLOBAL_VARIABLES, int MAX_VARIABLES, int MAX_BITSPERVARIABLE
  19. const int MAX_ARRAY_POINTERS, int MAX_TILES, int MAX_COMBOS, int MAX_STRINGS
  20. const int MAX_SCRIPTDRAWINGCOMMANDS
  21. const int MAX_MESSAGES, int MAX_MESSAGELENGTH
  22. const int MAX_MAPS, MAX_DMAPS
  23. const int MAX_DMAPNAMELENGTH, MAX_DMAPTITLELENGTH, MAX_DMAPINTROLENGTH
  24. const int MAX_FFC_*
  25. * Information about some system constraints
  26.  
  27. const int SCREEN_WIDTH, int SCREEN_HEIGHT, int SUBSCREEN_BOTTOM, int SUBSCREEN_TOP
  28. * Screen dimensions.
  29.  
  30. const float GRAVITY
  31. const float TERMINAL_VELOCITY
  32. const float JUMPING_LAYER_THRESHOLD
  33. * Some defaults from Init. Data
  34.  
  35. const int HP_PER_HEART, MP_PER_BLOCK
  36. * Constants about how HP and MP work
  37.  
  38. const int SFX_*
  39. * Sound effects, can be used with Game->PlaySound.
  40.  
  41. const int IC_*
  42. * Itemclass IDs, can be compared against itemdata->Family
  43.  
  44. const int I_*
  45. * Item IDs, can be used with Link->Item, Link->Equipment, item->ID, Link->HeldItem, GetEquipmentA,
  46. * GetEquipmentB, Screen->CreateItem, CreateItemAt, NumItemsOf
  47.  
  48. const int LA_*
  49. * Link's actions, can be used to set or compare against Link->Action
  50.  
  51. const int NPCT_*
  52. * NPC Types, can be used to compare against npc->Type
  53.  
  54. const int NPC_*
  55. * NPC IDs, can be used with npc->ID, Screen->CreateNPC, NumNPCsOf
  56.  
  57. const int HP_SILENT
  58. * NPC HP value, can be used to set npc->HP
  59.  
  60. const int LW_*
  61. * LWeapon IDs, can be used with lweapon->ID, Screen->CreateLWeapon, CreateLWeaponAt, NumLWeaponsOf
  62.  
  63. const int EW_*
  64. * EWeapon IDs, can be used with eweapon->ID, Screen->CreateEWeapon, CreateEWeaponAt, NumEWeaponsOf
  65.  
  66. const int WDS_*
  67. * Weapon DeadState Values, can be used to set or compare against *weapon->DeadState
  68.  
  69. const int FFCF_*
  70. * FFC Flags, can be used to set or compare against ffc->Flags[]
  71.  
  72. const int DIR_*
  73. * Directions, can be used with Link->Dir, npc->Dir, *weapon->Dir
  74.  
  75. const int CF_*
  76. * Combo Flags, can be used with Screen->ComboF[], Screen->ComboI[], Game->GetComboFlag, Game->SetComboFlag,
  77. * Game->GetComboInherentFlag, Game->SetComboInherentFlag
  78.  
  79. const int CT_*
  80. * Combo Types, can be used with Screen->ComboT[], Game->GetComboType, Game->SetComboFlag
  81.  
  82. const int IP_*
  83. * Item Pickup Flags, can be used with item->Pickup, GetItemPickup, SetItemPickup
  84.  
  85. const int SF_*
  86. * Screen Flag Categories, can be used with Screen->Flags, GetScreenFlags
  87.  
  88. const int SEF_*
  89. * Screen Enemy Flag Categories, can be used with Screen->EFlags, GetScreenEFlags
  90.  
  91. const int DMF_*
  92. * DMap Flags, can be used with Game->DMapFlags[], GetDMapFlag, SetDMapFlag
  93.  
  94. const int NPCA*_*
  95. * NPC Attributes, can be used to compare against npc->Attributes[]
  96.  
  97. const int NPCD_*
  98. * NPC Defenses, can be used to compare against npc->Defense[]
  99.  
  100. const int NPCDT_*
  101. * NPC Defense types, can be used to compare against npc->Defense[]
  102.  
  103. const int DS_*
  104. * Draw Styles, can be used with item->DrawStyle
  105.  
  106. const int WT_*
  107. * Warp Types, can be used with Screen->SetSideWarp, Screen->SetTileWarp
  108.  
  109. const int FONT_*
  110. * Font Types, can be used with Screen->DrawCharacter, Screen->DrawString, Screen->DrawInteger
  111.  
  112. const int TF_*
  113. * Text Formats, can be used with Screen->DrawString
  114.  
  115. const int PT_*
  116. * Texture Mapping Rendering Modes, can be used with Screen->*3D
  117.  
  118. const int OP_*
  119. * Opacity options, can be used with all shape and tile drawing commands.
  120.  
  121. const int RT_*
  122. * Render targets, can be used with Screen->SetRenderTarget and Screen->DrawBitmap.
  123.  
  124. const int EXT_*
  125. * Sprite Extend Types, can be used with Link->Extend, npc->Extend, *weapon->Extend, item->Extend
  126.  
  127. const int CR_*
  128. * Counter types, can be used with itemclass->Counter, Game->Counter[], Game->MCounter[], Game->DCounter[]
  129.  
  130. const int GEN_*
  131. * Generic Data Types, can be used to set or compare against Game->Generic[]
  132.  
  133. const int LI_*
  134. * Level Item Flags, can be used with Game->LItems[], GetLevelItems, SetLevelItems
  135.  
  136. cosnt int ST_*
  137. * Screen States, can be used with Screen->State[], Game->GetScreenState, Game->SetScreenState
  138.  
  139. const int D_*
  140. * Door types, can be used with Screen->Door[]
  141.  
  142. const int WPN_*
  143. * Enemy Weapon Types, can be used with npc->Weapon
  144.  
  145. const int AT_*
  146. * Weapon aim types, to be used with AimEWeapon
  147.  
  148. const int IS_*
  149. * Item Drop Sets, can be used to set or compare against npc->ItemSet
  150.  
  151. const int BPAL_*
  152. * Boss Palletes, can be used to set or compare against npc->BossPal
  153.  
  154. const int SL_*
  155. * Sprite Lists, can be used with Screen->ClearSprites
  156.  
  157. const int MB_*
  158. * Mouse Buttons, can be used with Link->InputMouseB
  159.  
  160. const int CB_*
  161. * Controller input buttons
  162.  
  163. const int NPCSF_*
  164. * NPC Spawn Flags
  165.  
  166. const int NPCM_*
  167. * NPC Misc. Flags
  168.  
  169. const int SFM__*
  170. * Misc. Screen Flags
  171.  
  172. const int CSET_*
  173. * Values for the first colour in each CSet
  174.  
  175. const int SPRITE_*
  176. * Values for all default sprites
  177.  
  178. const int AT_*
  179. * Aim types for use with AimEWeapon()
  180.  
  181. const int TEX_BITMAP
  182. * Drawing texture Mode (2.50.3 experimental, and later)
  183.  
  184. //Constants for AdjacentCombo()
  185.  
  186. const int CMB_UPLEFT = 0;
  187. const int CMB_UP = 1;
  188. const int CMB_UPRIGHT = 2;
  189. const int CMB_RIGHT = 3;
  190. const int CMB_DOWNRIGHT = 4;
  191. const int CMB_DOWN = 5;
  192. const int CMB_DOWNLEFT = 6;
  193. const int CMB_LEFT = 7;
  194. const int CMB_LEFTUP = 0;
  195.  
  196.  
  197. =================
  198. --- Functions ---
  199. =================
  200.  
  201. -- Mathematical Functions --
  202. ============================
  203.  
  204. float LogToBase(float x, float base)
  205. * Returns the logarithm of x to the given base
  206.  
  207. int Floor(float x)
  208. * Truncates x to an integer
  209.  
  210. int Ceiling(float x)
  211. * Raises x to the nearest integer
  212.  
  213. int Round(float x)
  214. * Rounds x to the nearest integer
  215.  
  216. int VBound(int x, int high, int low)
  217. * Bounds x between two values
  218.  
  219. int Div(float x, float y)
  220. * Modulo's complement; returns the quotient only of x divided by y
  221.  
  222. int Rand(int min, int max)
  223. * Overload to rand, returning a random integer in the bounds of min and max
  224.  
  225. float Randf(float n)
  226. * Returns a random floating point number up to n
  227.  
  228. float Randf(float n1, float n2)
  229. * Overloaded to take two boundaries as arguments
  230.  
  231. float DegtoRad(float d)
  232. * Converts 'd' in degrees to radians
  233.  
  234. float RadtoDeg(float r)
  235. * Converts 'r' in radians to degrees
  236.  
  237. int Sign(int n)
  238. * Returns the sign of n
  239.  
  240. float Distance(int x1, int y1, int x2, int y2)
  241. * Returns the distance between two sets of coordinates using Pythagoras' Theorem
  242.  
  243. float Angle(int x1, int y1, int x2, int y2)
  244. * Returns the direction of the vector from point 1 to point 2, in degrees from -180 to 180. (0 = right)
  245.  
  246. float RadianAngle(int x1, int y1, int x2, int y2)
  247. * The above, but in radians.
  248.  
  249. float VectorX(int len, float angle)
  250. * Returns the X component of a vector with a degree angle.
  251. * A length of 3 and angle of 0 returns 3.
  252. * A length of 3 and angle of 45 returns approx. 1.57.
  253. * A length of 3 and angle of 90 returns 0.
  254.  
  255. float VectorY(int len, float angle)
  256. * Returns the Y component of a vector with a degree angle.
  257. * A length of 3 and angle of 0 returns 0.
  258. * A length of 3 and angle of 45 returns approx. 1.57.
  259. * A length of 3 and angle of 90 returns 3.
  260.  
  261. float Lerp(float p1, float p2, float t)
  262. * Interpolates between p1 and p2 given 't' clamped within range 0,1.
  263.  
  264. float DotProduct( float x1, float y1, float x2, float y2 )
  265. * Returns the dot product of two vectors.
  266.  
  267. float CrossProduct( float x1, float y1, float x2, float y2 )
  268. * Returns the cross product of two vectors.
  269.  
  270. float DistanceSquared( float x, float y )
  271. * Returns the squared distance of a vector.
  272.  
  273. float Midpoint(float p1, float p2)
  274. * Finds the center of p1 and p2.
  275.  
  276. float SmoothStep(float p1, float p2, float t)
  277. * Performs a "Smooth" Interpolation given 't' clamped within range 0,1.
  278.  
  279. float WrapAngle( float radians )
  280. * Wraps radian value towards the range of -PI,PI.
  281.  
  282. float WrapDegrees( float degrees )
  283. * Wraps degree value towards the range of -180,180.
  284.  
  285. float TurnTowards( int X, int Y, int targetX, int targetY, float radian_angle, float t )
  286. * Returns an angle pointing (t)percentage more accurate to the target than the specified radian_angle.
  287.  
  288. -- Direction Functions --
  289. =========================
  290. * Make sure your angles are in the range -PI to PI (with WrapAngle) before using these functions
  291.  
  292.  
  293. int AngleDir8(float angle)
  294. * Converts a counterclockwise degree angle (from -180 to 180) into one of the eight
  295. * standard directions (DIR_UP etc.) used by ZC.
  296.  
  297. int RadianAngleDir8(float angle)
  298. * The above, but for radian angles.
  299.  
  300. int AngleDir4(float angle)
  301. * Converts a counterclockwise degree angle (from -180 to 180) into one of the four
  302. * standard directions (DIR_UP, DIR_DOWN, DIR_LEFT, DIR_RIGHT) used by ZC.
  303.  
  304. int RadianAngleDir4(float angle)
  305. * The above, but for radian angles.
  306.  
  307. int OppositeDir(int dir)
  308. * Returns the opposite direction to 'dir'
  309.  
  310. int SpinDir(int dir)
  311. * Converts directions to go round in a circle rather than U, D, L, R
  312.  
  313. -- Drawing Functions --
  314. =======================
  315.  
  316. void DrawString(int layer, int x, int y, int font, int color, int background_color, int format, int opacity,
  317. int string, int start)
  318. * Overload to Screen->DrawString which includes a position to start drawing from in the string
  319. * Does not check for overflow
  320.  
  321. void DrawString(int layer, int x, int y, int font, int color, int background_color, int format, int opacity,
  322. int string, int start, int end)
  323. * Overload to Screen->DrawString which includes a start and end position to draw the string
  324. * Does not check for overflow
  325.  
  326. void DrawTileSimple(int x, int y, int tile, int color)
  327. * A very simple layer 0 tile drawing routine.
  328.  
  329. void DrawToLayer(T ptr, int layer, int opacity)
  330. * Draws a pointer to given layer. Overloaded to take all pointers as arguments
  331.  
  332.  
  333. -- Conditional Functions --
  334. ===========================
  335.  
  336. T Cond(bool cond, T a, T b)
  337. * Returns a if cond is true, else b. Overloaded to take all types as arguments
  338.  
  339. float Choose(float a, float b)
  340. float Choose(float a, float b, float c)
  341. float Choose(float a, float b, float c, float d)
  342. float Choose(float a, float b, float c, float d, float e)
  343. float Choose(float a, float b, float c, float d, float e, float f)
  344. * Chooses one of the options randomly and fairly.
  345.  
  346.  
  347. -- Collision Detection Functions --
  348. ===================================
  349.  
  350. bool RectCollision(int box1_x1, int box1_y1, int box1_x2, int box1_y2, int box2_x1, int box2_y1, int box2_x2, int box2_y2)
  351. * Generalized and optimized rectangle collision checking function.
  352. * Returns true if the bounding box of box1 and box2 overlap.
  353.  
  354. bool SquareCollision(int c1x, int c1y, int side1, int c2x, int c2y, int side2)
  355. * Check for collisions of two squares given upper-left coordinates and a side length for each.
  356.  
  357. bool SquareCollision2(int c1x, int c1y, int radius1, int c2x, int c2y, int radius2)
  358. * Check for collisions of two squares given center coordinates and a halved side length for each.
  359.  
  360. bool CircleCollision(int c1x, int c1y, int radius1, int c2x, int c2y, int radius2)
  361. * Returns true if the two circles c1 and c2 overlap.
  362.  
  363. bool Collision(T a, S b)
  364. * Returns true if there is a collision between the hitboxes of any two pointers
  365.  
  366. bool LinkCollision(T ptr)
  367. * Returns true if there is a collision between Link's hitbox and any pointer's
  368.  
  369. int HitboxLeft(T ptr)
  370. * Returns the X coordinate of the left edge of the hitbox for any pointer
  371.  
  372. int HitboxTop(T ptr)
  373. * Returns the Y coordinate of the top edge of the hitbox for any pointer
  374.  
  375. int HitboxRight(T ptr)
  376. * Returns the X coordinate of the right edge of the hitbox for any pointer
  377.  
  378. int HitboxBottom(T ptr)
  379. * Returns the Y coordinate of the bottom edge of the hitbox.
  380.  
  381. bool CanWalk(int x, int y, int dir, int step, bool full_tile)
  382. * This should allow any scripted object to easily mimic Link styled LOZ solidity collision
  383. * checking, be it Link, FFCs, or enemies.
  384. * Note - You should use full_tile=true if you don't want the upper eight pixels to overlap
  385. * solid combos as per LOZ1 behavior.
  386.  
  387. bool OnSidePlatform(int x, int y)
  388. bool OnSidePlatform(int x, int y, int xOff, int yOff, int h)
  389. * Returns true if the sprite at (x,y) is standing on a sideview platform on a sideview screen, as worked out
  390. * by ZC's internal code.
  391.  
  392.  
  393.  
  394. -- Functions for accessing data stored in binary format --
  395. ==========================================================
  396.  
  397. void SetScreenDBit(int dmap, int screen, int d, int bit, bool state)
  398. void SetScreenDBit(int screen, int d, int bit, bool state)
  399. void SetScreenDBit(int d, int bit, bool state)
  400. * Sets bit 'bit' of Screen->D[] register 'd' to 'state', overloaded to set on other screens
  401.  
  402. bool GetScreenDBit(int dmap, int screen, int d, int bit)
  403. bool GetScreenDBit(int screen, int d, int bit)
  404. bool GetScreenDBit(int d, int bit)
  405. * Returns the state of bit 'bit' of Screen->D[] register 'd'
  406. * Overloaded to get from other screens
  407.  
  408. bool InputLeftClick()
  409. * Returns true if the left mouse button is pressed
  410.  
  411. bool InputRightClick()
  412. * Returns true if the right mouse button is pressed
  413.  
  414. int GetEquipmentA()
  415. * Returns the item ID of the item equipped to Link's A button
  416.  
  417. int GetEquipmentB()
  418. * Returns the item ID of the item equipped to Link's B button
  419.  
  420. bool UsingItem(int id)
  421. * Returns true if Link is using item 'id'
  422.  
  423. int ScreenFlag(int category, int flag)
  424. * Returns 1 if Screen Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
  425. * Flags are numbered starting from 0
  426.  
  427. int ScreenEFlag(int category, int flag)
  428. * Returns 1 if Screen Enemy Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
  429. * Flags are numbered starting from 0
  430.  
  431. bool GetDMapFlag(int dmap, int flag)
  432. * Returns true if DMap Flag 'flag' is set on dmap 'dmap'
  433.  
  434. void SetDMapFlag(int dmap, int flag, bool state)
  435. * Sets a certain DMap flag to 'state'
  436.  
  437. bool GetItemPickup(item i, int pickup)
  438. * Returns true if an item's Pickup state is set
  439. * Use the IP_ constants for the 'pickup' argument of this function
  440.  
  441. void SetItemPickup(item i, int pickup, bool state)
  442. * Sets an item's Pickup state to 'state'
  443.  
  444. bool GetNPCMiscFlag(npc e, int flag)
  445. * Returns true if an npc's Misc. flag is set.
  446.  
  447. bool GetLevelItem(int level, int itm)
  448. bool GetLevelItem(int itm)
  449. * Returns true if Link has the level item 'itm' from level 'level'
  450. * Overloaded to use the current level if no 'level' arg is entered
  451. * Use the LI_ constants for the 'itm' argument
  452.  
  453. void SetLevelItem(int level, int itm, bool state)
  454. void SetLevelItem(int itm, bool state)
  455. * Gives or removes a level item from Link's inventory
  456.  
  457.  
  458. -- Functions to help handling in-built pointers --
  459. ==================================================
  460.  
  461. lweapon NextToLink(int id, int distx, int disty)
  462. lweapon NextToLink(int id, int dist)
  463. * Creates an lweapon at 'distx, disty' away from where Link is facing
  464.  
  465. eweapon NextToNPC(npc n, int id, int distx, int disty)
  466. eweapon NextToNPC(npc n, int id, int dist)
  467. * Creates an eweapon at 'distx, disty' away from where npc 'n' is facing
  468.  
  469. void AimEWeapon(eweapon e, int aimtype)
  470. * Aims eweapon e according to the AT_* constant passed to aimtype
  471.  
  472. void AimLWeapon(lweapon l, npc n, int aimtype)
  473. void AimLWeapon(lweapon l, int aimtype)
  474. * Aims lweapon l according to the AT_* constant passed to aimtype, overloaded to shoot
  475. * at an npc or at random
  476.  
  477. int WeaponTypeToID(int weapontype)
  478. * Turns a WPN_* constant to an EW_* constant
  479.  
  480. *weapon Duplicate(*weapon a)
  481. * Creates and returns an exact copy of the passed weapon. Assumes that the passed pointer is valid.
  482.  
  483. npc CreateNPCAt(int id, int x, int y)
  484. * Create an NPC and set its X and Y position in one command
  485.  
  486. item CreateItemAt(int id, int x, int y)
  487. * Create an Item and set its X and Y position in one command
  488.  
  489. lweapon CreateLWeaponAt(int id, int x, int y)
  490. * Create an LWeapon and set its X and Y position in one command
  491.  
  492. eweapon CreateEWeaponAt(int id, int x, int y)
  493. * Create an EWeapon and set its X and Y position in one command
  494.  
  495. void Remove(T n)
  496. * Removes sprite 'n' from the screen. Overloaded.
  497.  
  498. int NumLWeaponsOf(int type)
  499. * Returns the number of lweapons of type 'type' currently on the screen
  500.  
  501. int NumEWeaponsOf(int type)
  502. * Returns the number of weapons of type 'type' currently on the screen
  503.  
  504. int NumNPCsOf(int type)
  505. * Returns the number of npcs of type 'type' currently on the screen
  506.  
  507. int NumItemsOf(int type)
  508. * Returns the number of items of type 'type' currently on the screen
  509.  
  510. lweapon LoadLWeaponOf(int type)
  511. * Returns the first LWeapon of the given type. Use the LW_ constants.
  512. * If none exist, it returns an uninitialised pointer.
  513.  
  514. eweapon LoadEWeaponOf(int type)
  515. * Returns the first EWeapon of the given type. Use the EW_ constants.
  516. * If none exist, it returns an uninitialised pointer.
  517.  
  518. npc LoadNPCOfType(int type)
  519. * Returns the first NPC of the given type. Use the NPCT_ constants.
  520. * If none exist, it returns an uninitialised pointer.
  521.  
  522. npc LoadNPCOf(int type)
  523. * Returns the first NPC of the given ID. Use the NPC_ constants.
  524. * If none exist, it returns an uninitialised pointer.
  525.  
  526. item CreateTimeoutItem(int id, int x, int y)
  527. * Creates a timeout item (such as a rupee or heart) with ID 'id' at '(x, y)'
  528.  
  529. -- Position Functions --
  530. ========================
  531.  
  532. int GridX(int x)
  533. * Snaps 'x' to the combo grid
  534. * Equivalent to calling ComboX(ComboAt(x, foo));
  535.  
  536. int GridY(int y)
  537. * Snaps 'y' to the combo grid
  538. * Equivalent to calling ComboY(ComboAt(foo, y));
  539.  
  540. int AtFrontX(int dir)
  541. int AtFrontY(int dir)
  542. * Returns the correct offset to be at the front of a sprite facing in
  543. * the direction 'dir'
  544.  
  545. int InFrontX(int dir, int dist)
  546. int InFrontY(int dir, int dist)
  547. * Returns the correct offset to be 'dist' pixels away from the front of
  548. * a sprite facing in the direction 'dir'
  549.  
  550. int CenterX(ffc anFFC)
  551. int CenterY(ffc anFFC)
  552. int CenterX(npc anNPC)
  553. int CenterY(npc anNPC)
  554. int CenterX(eweapon anEWeapon)
  555. int CenterY(eweapon anEWeapon)
  556. int CenterX(lweapon anLWeapon)
  557. int CenterY(lweapon anLWeapon)
  558. int CenterLinkX()
  559. int CenterLinkY()
  560. * Returns the X or Y coordinate at the center of the given sprite.
  561.  
  562.  
  563. -- Combo Functions --
  564. =====================
  565.  
  566. int ComboAt(int x, int y)
  567. * Finds the location of a combo, given its (x,y) coordinates on the screen
  568.  
  569. int ComboX(int loc)
  570. int ComboY(int y)
  571. * Return the coordinates of a combo on the screen
  572.  
  573. bool ComboFI(int x, int y, int flag)
  574. bool ComboFI(int loc, int flag)
  575. * Returns true if the combo at '(x, y)' or 'loc' has either an
  576. * inherent or placed flag of type 'flag'
  577.  
  578. int GetLayerComboD(int layer, int pos)
  579. * A shorthand way to get a combo on the specified layer.
  580. * Layer 0 is the screen itself.
  581.  
  582. void SetLayerComboD(int layer, int pos, int combo)
  583. * A shorthand way to set a combo on the specified layer.
  584. * Layer 0 is the screen itself.
  585.  
  586. int GetLayerComboF(int layer, int pos)
  587. * A shorthand way to get a combo flag on the specified layer.
  588. * Layer 0 is the screen itself.
  589.  
  590. void SetLayerComboF(int layer, int pos, int flag)
  591. * A shorthand way to set a combo flag on the specified layer.
  592. * Layer 0 is the screen itself.
  593.  
  594. int GetLayerComboT(int layer, int pos)
  595. * A shorthand way to get a combo type on the specified layer.
  596. * Layer 0 is the screen itself.
  597.  
  598. void SetLayerComboT(int layer, int pos, int type)
  599. * A shorthand way to set a combo type on the specified layer.
  600. * Layer 0 is the screen itself.
  601.  
  602. int GetLayerComboS(int layer, int pos)
  603. * A shorthand way to get a combo's solidity on the specified layer.
  604. * Layer 0 is the screen itself.
  605.  
  606. void SetLayerComboS(int layer, int pos, int solidity)
  607. * A shorthand way to set a combo's solidity on the specified layer.
  608. * Layer 0 is the screen itself.
  609.  
  610. int GetLayerComboI(int layer, int pos)
  611. * A shorthand way to get a combo inherent flag on the specified layer.
  612. * Layer 0 is the screen itself.
  613.  
  614. void SetLayerComboI(int layer, int pos, int flag)
  615. * A shorthand way to set a combo inherent flag on the specified layer.
  616. * Layer 0 is the screen itself.
  617.  
  618. int GetLayerComboC(int layer, int pos)
  619. * A shorthand way to get a combo's CSet on the specified layer.
  620. * Layer 0 is the screen itself.
  621.  
  622. void SetLayerComboC(int layer, int pos, int cset)
  623. * A shorthand way to set a combo's CSet on the specified layer.
  624. * Layer 0 is the screen itself.
  625.  
  626. int FirstComboOf(int t, int layer)
  627. * Returns the position of the first instance of the given combo, or -1.
  628.  
  629. int LastComboOf(int t, int layer)
  630. * Returns the position of the last instance of the given combo, or -1.
  631.  
  632. int FirstComboTypeOf(int t, int layer)
  633. * Returns the position of the first instance of the given combo, or -1.
  634.  
  635. int LastComboTypeOf(int t, int layer)
  636. * Returns the position of the last instance of the given combo, or -1.
  637.  
  638. int FirstComboFlagOf(int t, int layer)
  639. * Returns the position of the first instance of the given combo flag, or -1.
  640. * Checks inherent flags too!
  641.  
  642. int LastComboFlagOf(int t, int layer)
  643. * Returns the position of the last instance of the given combo flag, or -1.
  644. * Checks inherent flags too!
  645.  
  646. bool IsWater(int position)
  647. * Returns true if the combo at the given position is water or a swim or dive warp. Shallow water doesn't count.
  648.  
  649. bool IsPit(int position)
  650. * Returns true if the combo at the given position is a pit.
  651.  
  652.  
  653. -- Tile Functions --
  654. ====================
  655.  
  656. void SwapTileRow(int first, int second, int length)
  657. * Swaps a row of tiles of length 'length' between positions 'first' and 'second'
  658.  
  659. void CopyTileRow(int source, int dest, int length)
  660. * Copies a row of tiles of length 'length' from 'source' onto 'dest'
  661.  
  662. void ClearTileRow(int ref, int length)
  663. * Clears a row of tiles of length 'length' starting from tile 'ref'
  664.  
  665. void SwapTileBlock(int first, int last, int second)
  666. * Swaps a block of tiles defined by diagonal corners 'first' and 'last'
  667. * with the block starting with top left tile 'second'
  668.  
  669. void CopyTileBlock(int sourcefirst, int sourcelast, int destfirst)
  670. * Copies a block of tiles defined by diagonal corners 'sourcefirst' and 'sourcelast'
  671. * onto the block starting with top left tile 'destfirst'
  672.  
  673. void ClearTileBlock(int reffirst, int reflast)
  674. * Clears a block of tiles defined by diagonal corners 'reffirst' and 'reflast'
  675.  
  676.  
  677. -- Miscellaneous Functions --
  678. =============================
  679.  
  680. void Waitframes(int n)
  681. * Wait for 'n' frames
  682.  
  683. void NoAction()
  684. * Kills all of Link's inputs, including those from the analogue stick.
  685.  
  686. void NoAction(bool analogue_stick)
  687. * As NoAction() but the analoge stick is not killed by default.
  688.  
  689. void WaitNoAction()
  690. void WaitNoAction(int frames)
  691. * NoAction, then Waitframe or (equivalent of) Waitframes
  692.  
  693. void ScreenCopy(int destmap, int destscr, int srcmap, int srcscr)
  694. * Copies the combos and csets from one screen to another.
  695. * Only copies layer 0!
  696.  
  697. int FFCNum(ffc f)
  698. * Returns the number of an FFC, and -1 for a non-valid FFC (which should never happen)
  699.  
  700. int NumTriforcePieces()
  701. * Returns the number of Triforce Pieces Link currently has
  702.  
  703. void GetNPCName(int ID, int string[])
  704. * Puts the name of an npc into a string
  705.  
  706. void GetMessage(int ID, int string[])
  707. * Puts string 'ID' into 'string', removing the trailing spaces.
  708.  
  709. itemdata GetItemData(item i)
  710. * Returns an itemdata pointer from an item pointer
  711.  
  712. int GetHighestLevelItem(int itemclass)
  713. int GetHighestLevelItem(item i)
  714. * Returns the highest level item of a given itemclass, or of the class 'i' belongs to
  715.  
  716. bool IsSideview()
  717. * Returns true if Link is on a sideview screen
  718.  
  719. int DMapToMap(int screen, int dmap)
  720. int MapToDMap(int screen, int dmap)
  721. * Convert between map and DMap screen coordinates
  722.  
  723. -- New Functions ( 2.50.2 ) --
  724. ==============================
  725.  
  726. int GetLayerComboI(int layer, int pos)
  727. * A shorthand way to get a combo inherent flag on the specified layer.
  728. * Layer 0 is the screen itself.
  729.  
  730. void SetLayerComboI(int layer, int pos, int flag)
  731. * A shorthand way to set a combo inherent flag on the specified layer.
  732. * Layer 0 is the screen itself.
  733.  
  734. int GetLayerComboC(int layer, int pos)
  735. * A shorthand way to get a combo's CSet on the specified layer.
  736. * Layer 0 is the screen itself.
  737.  
  738. void SetLayerComboC(int layer, int pos, int cset)
  739. * A shorthand way to set a combo's CSet on the specified layer.
  740. * Layer 0 is the screen itself.
  741.  
  742. bool ChooseB(bool a, bool b)
  743. bool ChooseB(bool a, bool b, bool c)
  744. bool ChooseB(bool a, bool b, bool c, bool d)
  745. bool ChooseB(bool a, bool b, bool c, bool d, bool e)
  746. bool ChooseB(bool a, bool b, bool c, bool d, bool e, bool f)
  747. * Fairly chooses between two or more boolean values. Overloaded for up to six options.
  748.  
  749. bool ChooseB()
  750. * Randomly returns true, or false with a 50/50% chance..
  751.  
  752. bool RandB()
  753. * Randomly returns true, or false with a 50/50% chance.
  754.  
  755. bool RandB(int percentTrue)
  756. * Randomly returns true, or false. uses the input of percentTrue to determine chance.
  757. * Example: RandB(40) sets a 40% chance of the return being true, and a 60% chance of it being false.
  758.  
  759. float SafeSqrt(int n, int spec)
  760. * Returns the square root of n, and returns a specified value 'spec' if n is a negative number.
  761. * Returns 0 on a failure.
  762.  
  763. float SafeSqrt(int n)
  764. * Returns the square root of n, and returns -32768 is the value of n is a negative number.
  765. * Returns 0 on a failure.
  766.  
  767. void SetLinkItem(int itm)
  768. * Safely sets an item 'itm' true, if it is false, or false if it is true.
  769. * Will *not* slow down ZC.
  770.  
  771. void SetLinkItem(int itm, bool state)
  772. * Safely sets an item 'itm' to the value of 'state'.
  773. * Will *not* slow down ZC.
  774.  
  775. void TraceA(int arr)
  776. * Traces the contents of an array 'arr' to allegro.log.
  777. * Warning: This may slow ZC down, particulalry if called in a loop!
  778.  
  779. void TraceArray(int arr)
  780. * Traces the contents of an array 'arr' to allegro.log.
  781. * Warning: This may slow ZC down, particulalry if called in a loop!
  782.  
  783. void EndFFC(int ffc_ID)
  784. * Terminates an ffc specified by 'ffc_id' and sets all of its values to 0.
  785.  
  786. bool InputMiddleClick()
  787. * Returns true if the middle mouse button is pressed.
  788. * Note that not all mice have a middle button.
  789.  
  790. float BoolToFloat(bool input)
  791. * Converts variable 'input' to a floating point value of '1.000' for 'true', and '0.0000' for 'false'.
  792.  
  793. int BoolToInt(bool input)
  794. * Converts variable 'input' to a integer (0 or 1; for false, or true, respectively).
  795.  
  796. void ScreenToLayer(int sourceMap, int sourceScreen, int layerMin, int layerMax, int drawOpacity, int destLayer){
  797. * Draws a screen specified by 'sourceMap and sourceScreen;, from layers specified by 'layerMin and layerMax',
  798. * at a desired opacity, to the layer specified by 'destLayer' of the current screen.
  799.  
  800. void ScreenToLayer(int sourceMap, int sourceScreen, int drawOpacity, int destLayer)
  801. * Draws all layers of a screen specified by 'sourceMap and sourceScreen at a desired opacity
  802. * to the layer specified by 'destLayer' of the current screen.
  803.  
  804. int GetLowFloat(int n)
  805. * Accepts a float as input, and returns the decimal portion as int.
  806.  
  807. int GetHighFloat(int n)
  808. * Accepts a float as input, and returns the integer portion as int.
  809.  
  810. int GetDigitValue(int n, int place)
  811. * Extracts a single digit from n at the place specified.
  812. * -4 is the ten-thousandTHs place, 0 is the ones spot, and 4 is the ten-thousanDs spot.
  813.  
  814. int GetPartialValue(int n, int place, int num)
  815. * Extracts an integer using specific places of any value 'n', from position 'place' plus a number of places 'num'.
  816.  
  817. int DecimalToInt(int v)
  818. * Converts floating point value 'v', after the decimal, to an integer.
  819.  
  820. bool Xor(bool valA, bool valB)
  821. * Xor comparison of two boolean values.
  822. * Returns true if values *do not match*, otherwise false.
  823.  
  824. bool Collision(npc n)
  825. bool Collision(ffc f)
  826. bool Collision(item i)
  827. bool Collision(lweapon l)
  828. bool Collision(eweapon e)
  829. * Shorthand way of doing LinkCollision() and prophylactic against erroneous usage.
  830.  
  831. float Distance(int x1, int y1, int x2, int y2, int specify_negative_value)
  832. * Returns the distance between two sets of coordinates using Pythagoras' Theorem
  833. * Use specify_negative_value to specify a number to return, if an attempt is made to resolve the square root
  834. of a negative number.
  835.  
  836. void NoInput(bool analogue_stick)
  837. * Kill inputs, but not from analogue stock, unless value 'analogue_stick' is set 'true'.
  838.  
  839. int DirX(int dir)
  840. * Returns factor for X-direction (1, 0, or -1), to use with lweapon/eweapon placement and/or step.
  841.  
  842. int DirY(int dir)
  843. * Returns factor for Y-direction (1, 0, or -1), to use with lweapon/eweapon placement and/or step.
  844.  
  845. bool MatchLWeaponType(int list, lweapon l)
  846. * Compare given lweapon 'l' to array 'list' and returns if its ID matches any index value.
  847.  
  848. bool MatchEWeaponType(int list, eweapon e)
  849. * Compare given eweapon 'e' to array 'list' and returns if its ID matches any index value.
  850.  
  851. bool MatchNPC(int list, npc n)
  852. * Compare given npc 'n' to array 'list' and returns if its ID matches any index value.
  853.  
  854. bool MatchNPCT(int list, npc n)
  855. * Compare given npc 'n' to array 'list' and returns if its Type matches any index value.
  856.  
  857. bool MatchItem(int list, item i)
  858. * Compare given item 'i' to array 'list' and returns if its ID matches any index value.
  859.  
  860. bool MatchAction(int list)
  861. * Compares the present Link->Action to values in indices of array 'list'
  862. * and returns if there is a match.
  863.  
  864. bool MatchComboD(int list, int cmb)
  865. * Compares the Combo Data at location 'cmb' to values in indices of array 'list'
  866. * and returns if there is a match.
  867.  
  868. bool MatchComboT(int list, int cmb)
  869. * Compares the Combo Type at location 'cmb' to values in indices of array 'list'
  870. * and returns if there is a match.
  871.  
  872. bool MatchComboC(int list, int cmb)
  873. * Compares the Combo CSet at location 'cmb' to values in indices of array 'list'
  874. * and returns if there is a match.
  875.  
  876. bool MatchComboF(int list, int cmb)
  877. * Compares the Combo Flag at location 'cmb' to values in indices of array 'list'
  878. * and returns if there is a match.
  879.  
  880. bool MatchComboI(int list, int cmb)
  881. * Compares the Combo Inherent Flag at location 'cmb' to values in indices of
  882. * array 'list' and returns if there is a match.
  883.  
  884. bool MatchComboS(int list, int cmb)
  885. * Compares the Combo Solidity at location 'cmb' to values in indices of
  886. * array 'list' and returns if there is a match.
  887.  
  888. bool MatchLayerComboD(int list, int layer, int cmb)
  889. * Compares the Combo Data at location 'cmb' on layer 'layer' to values in indices of
  890. * array 'list' and returns if there is a match.
  891.  
  892. bool MatchLayerComboT(int list, int layer, int cmb)
  893. * Compares the Combo Type at location 'cmb' on layer 'layer' to values in indices of
  894. * array 'list' and returns if there is a match.
  895.  
  896. bool MatchLayerComboC(int list, int layer, int cmb)
  897. * Compares the Combo CSet at location 'cmb' on layer 'layer' to values in indices of
  898. * array 'list' and returns if there is a match.
  899.  
  900. bool MatchLayerComboF(int list, int layer, int cmb)
  901. * Compares the Combo Flag at location 'cmb' on layer 'layer' to values in indices of
  902. * array 'list' and returns if there is a match.
  903.  
  904. bool MatchLayerComboI(int list, int layer, int cmb)
  905. * Compares the Combo Inherent flag. at location 'cmb' on layer 'layer' to values in indices of
  906. * array 'list' and returns if there is a match.
  907.  
  908. bool MatchLayerComboS(int list, int layer, int cmb)
  909. * Compares the Combo Solidity. at location 'cmb' on layer 'layer' to values in indices of
  910. * array 'list' and returns if there is a match.
  911.  
  912. int HasTriforce(int level)
  913. * Returns true if Link has the Triforce piece for the level 'level'.
  914.  
  915. int HasCompass(int level)
  916. * Returns true if Link has the compass for the level 'level'.
  917.  
  918. int HasMap(int level)
  919. * Returns true if Link has the dungeon map for the level 'level'.
  920.  
  921. int HasBossKey(int level)
  922. * Returns true if Link has the boss key for the level 'level'.
  923.  
  924. int DefeatedLevelBoss(int level)
  925. * Returns true if Link has defeated te boss of level 'level'.
  926.  
  927. int NumTriforcePieces(int maxlevel)
  928. * Returns the total number of Triforce pieces collected.
  929. * Specify the highest level in your quest that has a Triforce piece, as arg 'maxlevel'.
  930.  
  931. void SetCombo(int pos, int data, int type, int flag, int inh_flag, int cset, int solid)
  932. * Sets the values for combo at position 'pos' to those specified.
  933. * Pass -1 to leave a value unchanged.
  934.  
  935. void SetLayerComboValues(int layer, int data, int type, int flag, int inh_flag, int cset, int solid)
  936. * Sets the values for a combo on layer 'layer', at position 'pos' to the values specified.
  937. * Pass -1 to any value to leave it unchanged.
  938.  
  939. void CloneCombo(int pos_a, int pos_b)
  940. * Clones combo from position 'pos_a' to position 'pos_b'
  941.  
  942. void CloneLayerCombo(int layer, int pos_a, int pos_b)
  943. * Clones combo on layer 'layer' posigtion 'pos_a' to the same layer at position 'pos_b'
  944.  
  945. void CloneLayerCombo(int layer_a, int layer_b, int pos_a, int pos_b)
  946. * Clones a combo on layer 'layer_a' at position 'pos_a', to layer 'layer_b" at position 'pos_b'.
  947.  
  948. void Remove(ffc f)
  949. * Removes an FFC by zeroing out its attributes, and freeing it for other use.
  950.  
  951. int DirRev(int dir)
  952. * Returns the reverse of direction 'dir'
  953.  
  954. int DirAngle(int dir)
  955. * Converts a direction to an angle in degrees.
  956.  
  957. int DirRad(int dir)
  958. * Converts a direction into radians.
  959.  
  960. int SpeedRev(int speed, int reduceinertia)
  961. * Inverts the speed of a moving object, and alters it by value of reverseinertia
  962.  
  963. int ImpactVelocity(int mass1, int velocity1, int mass2, int velociy2 )
  964. * Returns the momentum change (acceleration) of two objects.
  965.  
  966. int ImpactVelocityA(int massA, int velocityA, int massB, int velociyB )
  967. * Accepts values for object A' and object 'B' then returns the acceleration change for object 'A'.
  968.  
  969. int ImpactVelocityB(int massA, int velocityA, int massB, int velociyB )
  970. * Accepts values for object A' and object 'B' then returns the acceleration change for object 'B'.
  971.  
  972. void ImpactVelocity(lweapon a, eweapon b, int massA, int velocityA, int massB, int velociyB )
  973. * Accepts the mass, and velocity if two weapons. Determins the acceleration on impact.
  974. * Changes the Step of both to reflect their mass on collision.
  975.  
  976. void ImpactVelocityF()
  977. * FFC version that will change the direction, and speed of moving ffcs on collision.
  978.  
  979. int CenterX(*ptr, bool usehitbox)
  980. int CenterX(lweapon anLWeapon, bool usehitbox)
  981. int CenterX(eweapon anEWeapon, bool usehitbox)
  982. int CenterX(npc n, bool usehitbox)
  983. int CenterX(item i, bool usehitbox)
  984.  
  985. int CenterX(*ptr, bool usehitbox, bool trueoffset, bool drawoffset)
  986. int CenterX(lweapon anLWeapon, bool usehitbox, bool trueoffset, bool drawoffset)
  987. int CenterX(eweapon anEWeapon, bool usehitbox, bool trueoffset, bool drawoffset)
  988. int CenterX(npc n, bool usehitbox, bool trueoffset, bool drawoffset)
  989. int CenterX(item i, bool usehitbox, bool trueoffset, bool drawoffset)
  990. * Returns the centre X position of an object.
  991. * Set usehitbox to true, to calculate the centre from Hitbox proportions
  992. * " or false to use its sprites/tiles.
  993. * Set trueoffset to return the value after caqlculating its HitXOffset
  994. * Set drawoffset to return the value after calculating its DrawXOffset
  995.  
  996. int CenterY(*ptr, bool usehitbox)
  997. int CenterY(lweapon anLWeapon, bool usehitbox)
  998. int CenterY(eweapon anEWeapon, bool usehitbox)
  999. int CenterY(npc n, bool usehitbox)
  1000. int CenterY(item i, bool usehitbox)
  1001.  
  1002. int CenterY(*ptr, bool usehitbox, bool trueoffset, bool drawoffset)
  1003. int CenterY(lweapon anLWeapon, bool usehitbox, bool trueoffset, bool drawoffset)
  1004. int CenterY(eweapon anEWeapon, bool usehitbox, bool trueoffset, bool drawoffset)
  1005. int CenterY(npc n, bool usehitbox, bool trueoffset, bool drawoffset)
  1006. int CenterY(item i, bool usehitbox, bool trueoffset, bool drawoffset)
  1007. * Returns the centre Y position of an object.
  1008. * Set usehitbox to true, to calculate the centre from Hitbox proportions
  1009. * " or false to use its sprites/tiles.
  1010. * Set trueoffset to return the value after calculating its HitYOffset
  1011. * Set drawoffset to return the value after calculating its DrawYOffset
  1012.  
  1013.  
  1014. int CenterLinkX(bool hitoffset)
  1015. int CenterLinkX(bool hitoffset, bool drawoffset)
  1016. * Returns the centre X position of Link.
  1017. * Set trueoffset to return the value after caqlculating his HitXOffset
  1018. * Set drawoffset to return the value after calculating his DrawXOffset
  1019. * Note: HitXOffset and DrawXOffset for Link must be set by script, and do not directly affect
  1020. * his hitbox or sprite. See 'Class Link' in zscript.txt for more information.
  1021.  
  1022. int CenterLinkY(bool hitoffset)
  1023. int CenterLinkY(bool hitoffset, bool drawoffset)
  1024. * Returns the centre Y position of Link.
  1025. * Set trueoffset to return the value after caqlculating his HitXOffset
  1026. * Set drawoffset to return the value after calculating his DrawXOffset
  1027. * Note: HitXOffset and DrawXOffset for Link must be set by script, and do not directly affect
  1028. * his hitbox or sprite. See 'Class Link' in zscript.txt for more information.
  1029.  
  1030. int CenterComboX(int loc)
  1031. * Returns the centre X position of combo at location 'loc' similar to CenterX()
  1032.  
  1033. int CenterComboY(int loc)
  1034. * Returns the centre Y position of combo at location 'loc' similar to CenterX()
  1035.  
  1036. float Angle(int x, int y) {
  1037. * Simplified form of Angle(int x1, int x2, int y1, int y2)
  1038. * Returns the direction of the vector from (0, 0) to point, in degrees from -180 to 180. (0 = right)
  1039.  
  1040. bool Collision(int cmb, ffc f)
  1041. bool Collision(ffc f, int cmb)
  1042. bool Collision(int cmb, lweapon l)
  1043. bool Collision(lweapon l, int cmb)
  1044. bool Collision(lweapon l, int cmb, bool checkcoldetection)
  1045. bool Collision(int cmb, lweapon l, bool checkcoldetection)
  1046. bool Collision(int cmb, eweapon e)
  1047. bool Collision(eweapon e, int cmb)
  1048. bool Collision(eweapon e, int cmb, bool checkcoldetection)
  1049. bool Collision(int cmb, eweapon e, bool checkcoldetection)
  1050. bool Collision(int cmb, npc n)
  1051. bool Collision(npc n, int cmb)
  1052. bool Collision(npc n, int cmb, bool checkcoldetection)
  1053. bool Collision(int cmb, npc n, bool checkcoldetection)
  1054. bool Collision(int cmb, item i)
  1055. bool Collision(item i, int cmb)
  1056. * Check for collision between an object (ffc, *weapon, npc, item) and a combo at location 'cmb'
  1057. * Set 'checkcoldetection' to true if you wish to ignore objects with CollDetection disabled (excludes item types).
  1058.  
  1059. bool Collision(int cmb)
  1060. bool Collision(int cmb, bool checkcoldetection)
  1061. * Check for collision between Link and a combo at location 'loc'
  1062. * Set checkcoldetection' to true if you wish to ignore collision when Link->CollDetection is false.
  1063.  
  1064. void SetLayerComboD(int layer, int pos, int combo, bool layer0)
  1065. void SetLayerComboF(int layer, int pos, int flag, bool layer0)
  1066. void SetLayerComboI(int layer, int pos, int flag, , bool layer0)
  1067. void SetLayerComboC(int layer, int pos, int cset, bool layer0)
  1068. void SetLayerComboT(int layer, int pos, int type, bool layer0)
  1069. void SetLayerComboS(int layer, int pos, int solidity, bool layer0)
  1070. * As ordinary SetLayerCombo* functions, except allows user to make layer 0 changes static.
  1071. * Set layer0 = true to make changes on layer 0 static.
  1072.  
  1073. int HitboxTop()
  1074. int HitboxLeft()
  1075. int HitboxRight()
  1076. int HitboxBottom()
  1077. * Returns the bounds of Link's Hitbox
  1078.  
  1079. item CreateTimeoutItem(int id, int x, int y, int width, int height)
  1080. * Creates a timeout item, with the option to set its hitbox size.
  1081.  
  1082. lweapon EWeaponToLWeaponID(int type)
  1083. lweapon EtoLWeaponType(int type)
  1084. * Converts and returns the type (ID) of an EWeapon to the closest LWeapon type
  1085.  
  1086. eweapon LWeaponToEWeaponID(int type)
  1087. eweapon LtoEWeaponType(int type)
  1088. * Converts and returns the type (ID) of an LWeapon to the closest EWeapon type
  1089.  
  1090. eweapon LWeaponToEWeapon(lweapon a, eweapon b)
  1091. eweapon LWeaponToEWeapon(eweapon b, lweapon a)
  1092. eweapon LToEWeapon(lweapon a, eweapon b)
  1093. eweapon LToEWeapon(eweapon b, lweapon a)
  1094. * Copies the attributes of lweapon 'a' to eweapon 'b'.
  1095. * Designed for reflected attacks.
  1096. * This works only for types legal with LWeaponToEWeaponType()
  1097. * Returns the pointer of the new weapon, or -1 on error.
  1098. * Overloaded for reversed arguments.
  1099.  
  1100. eweapon LWeaponToEWeapon(lweapon a)
  1101. eweapon LToEWeapon(lweapon a)
  1102. * Creates a new eweapon with the attributes of an lweapon 'a'.
  1103. * Works similarly to Duplicate(), except it changes the weapon class.
  1104. * This works only for types legal with LWeaponToEWeaponType()
  1105. * Returns the pointer of the new weapon, or -1 on error.
  1106.  
  1107. lweapon EWeaponToLWeapon(eweapon a, lweapon b)
  1108. lweapon EWeaponToLWeapon(lweapon b, eweapon a)
  1109. lweapon EToLWeapon(eweapon a, lweapon b)
  1110. lweapon EToLWeapon(lweapon b, eweapon a)
  1111. * Copies the attributes of eweapon 'a' to lweapon 'b'.
  1112. * Designed for reflected attacks.
  1113. * This works only for types legal with EWeaponToLWeaponType()
  1114. * Returns the pointer of the new weapon, or -1 on error.
  1115. * Overloaded for reversed arguments.
  1116.  
  1117. lweapon EWeaponToLWeapon(eweapon a)
  1118. lweapon EToLWeapon(eweapon a)
  1119. * Creates a new lweapon with the attributes of an eweapon 'a'.
  1120. * Works similarly to Duplicate(), except it changes the weapon class.
  1121. * This works only for types legal with EWeaponToLWeaponType()
  1122. * Returns the pointer of the new weapon, or -1 on error.
  1123.  
  1124. int ProximityX(*ptr a, *ptr b)
  1125. int ProximityX(int combo, *ptr)
  1126. int ProximityX(*ptr int combo)
  1127. int ProximityX(int comboA, int comboB)
  1128. int ProximityX(*ptr a, *ptr b, bool fromcentre)
  1129. int ProximityX(int combo, *ptr, bool fromcentre)
  1130. int ProximityX(*ptr int combo, bool fromcentre)
  1131. int ProximityX(int comboA, int comboB, bool fromcentre)
  1132.  
  1133. * Returns the X-axis proximity of two pointers, or one pointer and one combo, in pixels.
  1134. * Overloaded to support all pointer types (npc, item, *weapon, ffc), and combo positions.
  1135. * The value it returns is an absolute; not a relative value.
  1136. * You mnay optionally set fromcentre to 'true' to return the proximity of the centre of both objects.
  1137.  
  1138. int ProximityX(*ptr)
  1139. int ProximityX(int combo)
  1140.  
  1141. * Returns the X-axis proximity of any pointer, and Link.
  1142. * Overloaded to accept all pointer types (npc, item, *weapon, ffc), and combo positions.
  1143. * The value it returns is an absolute; not a relative value.
  1144.  
  1145. int ProximityY(*ptr a, *ptr b)
  1146. int ProximityY(int combo, *ptr)
  1147. int ProximityY(*ptr int combo)
  1148. int ProximityY(int comboA, int comboB)
  1149. int ProximityY(*ptr a, *ptr b, bool fromcentre)
  1150. int ProximityY(int combo, *ptr, bool fromcentre)
  1151. int ProximityY(*ptr int combo, bool fromcentre)
  1152. int ProximityY(int comboA, int comboB, bool fromcentre)
  1153.  
  1154. * Returns the Y-axis proximity of two pointers, or one pointer and one combo, in pixels.
  1155. * Overloaded to support all pointer types (npc, item, *weapon, ffc), and combo positions.
  1156. * The value it returns is an absolute; not a relative value.
  1157. * You mnay optionally set fromcentre to 'true' to return the proximity of the centre of both objects.
  1158.  
  1159. int ProximityY(*ptr)
  1160. int ProximityY(int combo)
  1161. * Returns the Y-axis proximity of any pointer, and Link.
  1162. * Overloaded to accept all pointer types (npc, item, *weapon, ffc), and combo positions.
  1163. * The value it returns is an absolute; not a relative value.
  1164.  
  1165. //Deprecated by Formatting:
  1166. int ProximityCenterX(ffc a, ffc b)
  1167. * Determines the centre of two pointers, and returls the proximity of their two central points.
  1168. * The value it returns is an absolute; not a relative value.
  1169.  
  1170. float Distance(int x1, int y1, int x2, int y2, int scale)
  1171. * A variant of Distance() designed to handle very large distances.
  1172. * Returns the distance between two sets of coordinates using Pythagoras' Theorem
  1173. * Allows scaling for large distance determinations.
  1174. * Argument 'scale' represents a ratio of 1:scale.
  1175. * Argument 'scale' is most precise when using powers of 10 (i.e. 1, 10, 100, 1000, 10000).
  1176. * If arg 'scale' is set to 0, it defaults to '1'.
  1177. * Returns -1 on error.
  1178.  
  1179. int MatchScript(int script_id)
  1180. * Compares the value 'script_id' to all running ffc scripts, and returns the screen
  1181. * index (1 to 32) of the ffc running that script.
  1182. * Returns 0 if it finds no mach.
  1183.  
  1184. int MatchScript(int script_id, int list)
  1185. * Compares the scripts of all running ffcs, to all indices of an array 'list'
  1186. * searching for a match to ffc script 'script_id'.
  1187. * If there is a match, it MatchScript() will return the first match (FFC number) found.
  1188. * Returns 0 if it finds no match.
  1189.  
  1190. int ScreenItem()
  1191. * Returns the ID of the curent Screen Item, if there is one.
  1192. * Returns -1 if none.
  1193.  
  1194. int Chance()
  1195. * Randomly returns true or false, with 50/50% odds.
  1196.  
  1197. bool Chance(int percentChance){
  1198. * Randomly returns true, or false, using input 'percentChance' to
  1199. * determine the percentage change of a 'true return'
  1200.  
  1201.  
  1202. int ProximityX(ptr a, ptr b)
  1203. int ProximityX(int a, ptr b)
  1204. int ProximityX(ptr a, int b)
  1205. int ProximityX(int a, int b)
  1206. * Returns the absolute distance on the X-axis between any two given
  1207. * pointers of any type (*weapon, ffc, item, npc, combo_loc) in pixels.
  1208.  
  1209. int ProximityY(ptr a, ptr b)
  1210. int ProximityY(int a, ptr b)
  1211. int ProximityY(ptr a, int b)
  1212. int ProximityY(int a, int b)
  1213. * Returns the absolute distance on the Y-axis between any two given
  1214. * pointers of any type (*weapon, ffc, item, npc, combo_loc) in pixels.
  1215.  
  1216. int ProximityX(ptr a)
  1217. int ProximityX(int a)
  1218. * Returns the abolute distance on the X-axis between Link and the specified
  1219. * pointer of any type (*weapon, ffc, item, npc, combo_loc) in pixels.
  1220.  
  1221. int Proximityy(ptr a)
  1222. int Proximityy(int a)
  1223. * Returns the abolute distance on the y-axis between Link and the specified
  1224. * pointer of any type (*weapon, ffc, item, npc, combo_loc) in pixels.
  1225.  
  1226. int ProximityX(ptr a, ptr b, bool fromcentre)
  1227. int ProximityX(int a, ptr b, bool fromcentre)
  1228. int ProximityX(ptr a, int b, bool fromcentre)
  1229. int ProximityX(int a, int b, bool fromcentre)
  1230. * Returns the absolute distance on the X-axis between any two given
  1231. * pointers of any type (*weapon, ffc, item, npc, combo_loc) in pixels.
  1232. * If 'bool fromcentre' is set true, it returns the distance to the centre of both objects
  1233.  
  1234. int ProximityY(ptr a, ptr b, bool fromcentre)
  1235. int ProximityY(int a, ptr b, bool fromcentre)
  1236. int ProximityY(ptr a, int b, bool fromcentre)
  1237. int ProximityY(int a, int b, bool fromcentre)
  1238. * Returns the absolute distance on the Y-axis between any two given
  1239. * pointers of any type (*weapon, ffc, item, npc, combo_loc) in pixels.
  1240. * If 'bool fromcentre' is set true, it returns the distance to the centre of both objects
  1241.  
  1242.  
  1243. int ProximityX(ptr a, bool fromcentre)
  1244. int ProximityX(int a, bool fromcentre)
  1245. * Returns the abolute distance on the X-axis between Link and the specified
  1246. * pointer of any type (*weapon, ffc, item, npc, combo_loc) in pixels.
  1247. * If 'bool fromcentre' is set true, it returns the distance to the centre of both objects
  1248.  
  1249.  
  1250. int Proximityy(ptr a, bool fromcentre)
  1251. int Proximityy(int a, bool fromcentre)
  1252. * Returns the abolute distance on the y-axis between Link and the specified
  1253. * pointer of any type (*weapon, ffc, item, npc, combo_loc) in pixels.
  1254. * If 'bool fromcentre' is set true, it returns the distance to the centre of both objects
  1255.  
  1256. bool Collision(int a, ptr b, int a1, int b1, int c1, int d1, int a2, int b2, int c2, int d2)
  1257. bool Collision(int a, int b, int a1, int b1, int c1, int d1, int a2, int b2, int c2, int d2)
  1258. bool Collision(ptr a, ptr b, int a1, int b1, int c1, int d1, int a2, int b2, int c2, int d2)
  1259. * Checks Collision between two objects, as per Collision()
  1260. * Allows setting HITBOX constraints or offsets.
  1261.  
  1262. bool CollisionDir(int a, ptr b, int dir, bool checkcoldetection)
  1263. * Checks Collision between a COMBO and one object, as per Collision()
  1264. * Allows setting a required direction for the second argument.
  1265. * Set checkcoldetection true if you wish weapons without collision to automatically return false.
  1266.  
  1267. bool CollisionDir(int cmb, lweapon l, int dir, bool facingspecificdir, bool checkcoldetection)
  1268. * Silimar to CollisionDir()
  1269. * Set 'facingspecificdir' to true, to check only if a weapon is facing a specific direction.
  1270. * Set it false, if you want to check if a weapon is NOT facing a specific direction.
  1271. * Set checkcoldetection true if you wish weapons without collision to automatically return false.
  1272.  
  1273. bool Pos(int val)
  1274. * Returns true if a value passed is greater than 0.
  1275.  
  1276. bool Neg(int val)
  1277. * Returns true if a value passed is less than 0.
  1278.  
  1279. int Lesser (int a, int b)
  1280. int Lesser (int a, int b, int c)
  1281. int Lesser (int a, int b, int c, int d)
  1282. int Lesser (int a, int b, int c, int d, int e)
  1283. int Lesser (int a, int b, int c, int d, int e, int f)
  1284. int Lesser (int a, int b, int c, int d, int e, int f, int g)
  1285. int Lesser (int a, int b, int c, int d, int e, int f, int g, int h)
  1286. * Returns the lesser of all values passed.
  1287. * Overloaded to accept up to eight arguments.
  1288.  
  1289. int Greater (int a, int b)
  1290. int Greater (int a, int b, int c)
  1291. int Greater (int a, int b, int c, int d)
  1292. int Greater (int a, int b, int c, int d, int e)
  1293. int Greater (int a, int b, int c, int d, int e, int f)
  1294. int Greater (int a, int b, int c, int d, int e, int f, int g)
  1295. int Greater (int a, int b, int c, int d, int e, int f, int g, int h)
  1296. * Returns the greatest of all values passed.
  1297. * Overloaded to accept up to eight arguments.
  1298.  
  1299. bool IsLess(int a, int b)
  1300. bool IsLess(int a, int b, int c)
  1301. bool IsLess(int a, int b, int c, int d)
  1302. bool IsLess(int a, int b, int c, int d, int e)
  1303. bool IsLess(int a, int b, int c, int d, int e, int f)
  1304. bool IsLess(int a, int b, int c, int d, int e, int f, int g)
  1305. bool IsLess(int a, int b, int c, int d, int e, int f, int g, int h)
  1306. * Returns if 'a' is less than all other values passed.
  1307.  
  1308. bool IsMore(int a, int b)
  1309. bool IsMore(int a, int b, int c)
  1310. bool IsMore(int a, int b, int c, int d)
  1311. bool IsMore(int a, int b, int c, int d, int e)
  1312. bool IsMore(int a, int b, int c, int d, int e, int f)
  1313. bool IsMore(int a, int b, int c, int d, int e, int f, int g)
  1314. bool IsMore(int a, int b, int c, int d, int e, int f, int g, int h)
  1315. * Returns if 'a' is greater than all other values passed.
  1316.  
  1317. int Least(int arr)
  1318. * Returns the index of the lowest value in an array.
  1319.  
  1320. int Greatest(int arr)
  1321. * Returns the highest value in a given array.
  1322.  
  1323. int LeastIndex(int arr)
  1324. * Returns the index number of the array index holding the lowest value in a given array.
  1325. * If the lowest value is present in two or more indices, this will return the
  1326. * lowest-numbered index of the set.
  1327.  
  1328. int GreatestIndex(int arr)
  1329. * Returns the index number of the array index holding the highest value in a given array.
  1330. * If the ighest value is present in two or more indices, this will return the
  1331. * lowest-numbered index of the set.
  1332.  
  1333. void GiveLinkItem(int itm_id)
  1334. * Gives Link an item specified by 'itm_id' at his position, running its pick-up
  1335. * script (if any). LINK DOES NOT HOLD UP THE ITEM.
  1336.  
  1337. void GiveLinkItem(int itm_id, int holdtype)
  1338. * Creates an item specified by 'itm_id' on the screen at link's position, giving it to him,
  1339. * and running its pick-up script.
  1340. * If holdtype is set to a Link->Action for holding up an item, then Link will hold the item up as desired.
  1341.  
  1342. int AdjacentCombo(int cmb, int dir)
  1343. * Returns the Nuth combo index of a combo based on a central point, and a direction.
  1344. * For example, combo 22 + COMBO_UPRIGHT returns '7',
  1345. * as combo 7 is to the upper-right of combo 22.
  1346. * Use the constants defined for use with this function in std_constans.zh to pass values into this function.
  1347.  
  1348. bool DistX(int a, int dist)
  1349. bool DistX(ptr a, int dist)
  1350. * Returns true if Link is with a distance of 'dist' pixels on the X-axis, from the object specified.
  1351.  
  1352. bool DistY(int a, int dist)
  1353. bool DistY(ptr a, int dist)
  1354. * Returns true if Link is with a distance of 'dist' pixels on the Y-axis, from the object specified.
  1355.  
  1356. bool DistX(int a, int b, int distance)
  1357. bool DistX(int a, ptr b, int distance
  1358. bool DistX(ptr a, int b, int distance)
  1359. bool DistX(ptr a, ptr b, int distance)
  1360. * Returns true if two objects of any type (*weapon, ffc, item, combo_loc, npc) are
  1361. * within a relative distance of 'dist' pixels on the X-axis.
  1362.  
  1363. bool DistY(int a, int b, int distance)
  1364. bool DistY(int a, ptr b, int distance
  1365. bool DistY(ptr a, int b, int distance)
  1366. bool DistY(ptr a, ptr b, int distance)
  1367. * Returns true if two objects of any type (*weapon, ffc, item, combo_loc, npc) are
  1368. * within a relative distance of 'dist' pixels on the Y-axis.
  1369.  
  1370. bool LinkFacing(ptr a)
  1371. bool LinkFacing(int a)
  1372. * Returns true if Link is facing the given object (*weapon, npc, ffc, item, combo_pos)
  1373.  
  1374. bool Facing(*ptr a, *ptr b)
  1375. bool Facing(*ptr a, int b)
  1376. * Returns if 'a' is facing 'b'.
  1377. * Object 'a; may be an lweapon, eweapon, or npc.
  1378. * Target 'b' may be an lweapon, eweapon, npc, ffc, an item, or a combo location.
  1379.  
  1380. bool Facing(*ptr a)
  1381. * Returns if 'a' is facing Link.
  1382. * Object 'a' may be an lweapon, eweapon, or npc.
  1383.  
  1384. bool Facing(ffc a, *ptr b, int dir)
  1385. bool Facing(ffc a, int b, int dir)
  1386. * Returns if ffc 'a' is facing 'b'.
  1387. * You must specify the direction of 'a' with 'dir'.
  1388. * Target 'b' may be an lweapon, eweapon, npc, ffc, an item, or a combo location.
  1389.  
  1390. bool Facing(ffc a, int dir)
  1391. * Returns if ffc 'a' is facing Link.
  1392. * You must specify a direction for the ffc.
  1393.  
  1394. bool Facing(item a, *ptr b, int dir)
  1395. bool Facing(item a, int b, int dir)
  1396. * Returns if item 'a' is facing 'b'.
  1397. * You must specify the direction of 'a' with 'dir'.
  1398. * Target 'b' may be an lweapon, eweapon, npc, ffc, an item, or a combo location.
  1399.  
  1400. bool Facing(item a, int dir)
  1401. * Returns if item 'a' is facing Link.
  1402. * You must specify a direction for the item.
  1403.  
  1404. ==================================
  1405. -- Function Changes ( 2.50.2 ) --
  1406. ==================================
  1407.  
  1408. Distance() now returns special values to handle floating point rollover.
  1409. * If the value passed to Distance() is negative, Distance will calculate a special factor
  1410. * starting at 464 for it.
  1411. * This type of event occurs when the values passed to its args would exceed
  1412. * the maximum float value of 214748.3648.
  1413. * Thus, a value of -2.3648 is actually an attempt to pass 214750.3648 to the function.
  1414. * To solve this, negative values are inverted, and a square root is derived
  1415. * then added to 464, and returned.
  1416. //now uses SafeSqrt() to avoid errors when parsing negative values, or values too large for ZC
  1417. //to use to perform a square root operation.
  1418.  
  1419. SetLayerComboS() now refuses to set solidity for combos on layers 2 and above. Note that this is to
  1420. prevent ZC crashes on 2.50.0, 2.50.1, and 2.50.2. This bug is fixed as of 2.50.3, and the changes to this
  1421. function will automatically account for this in 2.50.3 during compilation; but this will not prevent earlier
  1422. versions of ZC running code compile din 2.50.3 from potentially crashing.
  1423.  
  1424. SquareCollision now properly uses 'side2' arg for its calculation. (Bugfix)
  1425.  
  1426. Choose() is now overloaded for up to 16 args.
  1427.  
  1428. Collision() functions now use an array for their vars. Is this slower at all? The goal here, is to
  1429. optimise variable use on functions likely to be in a nest.
  1430.  
  1431. =============================
  1432. -- New Includes ( 2.50.3 ) --
  1433. =============================
  1434. std.zh now includes some new files, that you will want to review. THe outline, scope, and purpose of
  1435. the new expansions is outlined below.
  1436.  
  1437. /******************
  1438. * std.zh Settings *
  1439. *******************/
  1440.  
  1441. std.zh now includes a SETTINGS FILE ( std.cfg ) that has a few options
  1442. that you may enable, if you wish to change the behaviour of std.zh at compilation
  1443. for your quests. These settings are disbaled by default, and affect only a handful of
  1444. minimal mechanical differences as follows:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement