Advertisement
ZoriaRPG

2.54 ZScript Full Docs (ZScript.txt, 31-MAY-2017)

May 30th, 2017
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 267.83 KB | None | 0 0
  1. //Docs for 2.54 Beta
  2. //Rev. 0.9.7
  3. //for 2.54 b52.4
  4. //31st May, 2017
  5.  
  6. Search for !#! to find areas that require completion.
  7.  
  8. //===================================================================================
  9. // --- ZScript built-in functions and variables ---
  10. //===================================================================================
  11. /*
  12. * These functions are all INTERNAL to ZQuest. They require no header
  13. * or other import directives to work, and are all direct representations
  14. * of ZASM instructions.
  15. *
  16. * These functions and commands are the BASIC BUILDING BLOCKS of ZScript:
  17. * While they require no other functions to work, ALL other functions
  18. * in headers (such as std.zh) RELY, and OPERATE using these functions.
  19. *
  20. * Thus, it is essential to know what each of these does, how they work,
  21. * and how to use them.
  22. *
  23. * For other included functions, that are not internal (i.e. external functions)
  24. * please read the documentation specific to each header. These are individual
  25. * files (e.g. std.txt), however if you wish to view all the pre-packaged ZScript
  26. * functions, and commands, you may view the EXTENDED DOCUMENTATION, as
  27. * those documentation files contain all of the 'Essential ZScript' that
  28. * you will want to use.
  29. *
  30. * Where possible, the ZASM instruction used by the functions, and the
  31. * commands detailed herein are listed inline with the entry for the related
  32. * function / command. Full (public) ZASM documentation is, sadly incomplete.
  33. *
  34. * Note: Functions and variables other than global functions are properties
  35. * of **objects**. Objects are divided into NAMESPACEs and CLASSes, and the
  36. * the syntax for using them is:
  37. *
  38. * [object name]->[property]
  39. *
  40. * where "[object name]" is the object's name (e.g. Link, Game, Screen)/
  41. * and "[property]" is the function.
  42. *
  43. * Example:
  44. * void GetCurDMap() is a Game property, and is called as:
  45. *
  46. * Game->GetCurDMap();
  47. *
  48. * "Link", "Screen" and "Game" are always available and don't need to be
  49. * instantiated, while you must initialise other classes, such as ffc, item,
  50. * and npc.
  51. *
  52. * ZScript functions are of the types: int, float, bool, and void. Of these,
  53. * only void does not return a value. (The void type is normally used to run
  54. * a series of instructions, or to set values). The other types retrun values
  55. * appropriate to their type.
  56. *
  57. * Note: In the following, "int" indicates that a parameter is truncated by a
  58. * function to an integer, or that the return value will always be an integer
  59. * however, ZScript itself makes no distinction between int and float types.
  60. */
  61.  
  62. /************************************************************************************************************/
  63.  
  64. //////////////////
  65. /// ZASM Flags ///
  66. //////////////////
  67.  
  68. ZASM uses a series of special flags, to determine how it should follow logical instructions,
  69. including the following:
  70.  
  71. SCRIPT FLAGS
  72. TRUEFLAG : A condition in the script, is true
  73. MOREFLAG : Must be set manually with ZASM.
  74. FALSEFLAG : Must be set namually with ZASM.
  75. LESSFLAG : Must be set manually with ZASM.
  76.  
  77. Instructions
  78. SETTRUE : Set the Script Flag TRUEFLAG.
  79. SETTRUE Sets a true condition for the Assembler, if a COMPARERV and COMPARER validate.
  80. This is used when making statements in ZScript.
  81. SETFALSE: Set the Script Flag FALSEFLAG: ZScript does not do this.
  82. SETMORE : Set the Script FLag MOREFLAG: ZScript does not do this.
  83. SETLESS : Set the Script Flag LESSFLAG: ZScript does not do this.
  84.  
  85. These flags are used in evaluation instructions, to determine if an instruction should run.
  86.  
  87. Examples of these are as follows:
  88.  
  89. GOTOTRUE: Executes the GOTO instruction only if the Script Flag TRUEFLAG is enabled.
  90. GOTOFALSE: Executes the GOTO instruction only if the Script Flag FALSEFLAG is enabled.
  91. GOTOMORE: Executes the GOTO instruction only if the Script Flag MOREFLAG is enabled.
  92. GOTOLESS: Executes the GOTO instruction only if the Script Flag LESSFLAG is enabled.
  93.  
  94. In contrast, GOTO/GOTOR ignore all flags, and conditions.
  95.  
  96. ZScript always compiles down to GOTO, GOTOR, and GOTOTRUE instructions.
  97. The other FLAG-typed GOTO instruction types are valid only in ZASM, and serve no useful purpose.
  98. GOTOLESS, GOTOMORE, and GOTOFALSE are effectively deprecated.
  99.  
  100. //=======================================================
  101. //--- Instruction Processing Order and General Timing ---
  102. =========================================================
  103.  
  104. 1. Instructions in Global script Init (if starting a new game)
  105. 2. Instructions in Global Script OnContinue (is resuming a game)
  106. 3. Instructions immediately inside the run() function of a global active script.
  107. 4. Instructions in the global active script's infinite loop prior to Waitdraw,
  108. if (5) does not exist, or on the first frame of the game.
  109. 5. Instructions from an ffc script positioned after (an illegal)
  110. Waitdraw() instruction in that script from the previous frame.
  111. Note: Requires being on at least the second frame of a game session.
  112. 6. Instructions in the global active script prior to Waitdraw().
  113. 7. Instructions in an ffc script, other than (5), excluding draw commands.
  114. 8. Screen Scrolling (2.50.2, or later)
  115. 9. Instructions from item scripts.
  116. 10. Waitdraw() in a global active script.
  117. 11. Engine writing to Link->Dir and Link->Tile.
  118. 12. Instructions in the global active script, called after Waitdraw()
  119. 12(b). Screen Scrolling ( 2.50.0, and 2.50.1 )
  120. 13. Drawing from FFCs
  121. 14. Instructions in an OnExit script, if the game is exiting.
  122. 15. Return to (5).
  123.  
  124.  
  125. //=================
  126. //--- Pointers ---
  127. //=================
  128.  
  129. Global array pointers start at 4096 (when traced). These are added in escalating value, but in the reverse-order
  130. of declaration. e.g. The last declared array will be ID 4096.
  131.  
  132. /************************************************************************************************************/
  133.  
  134.  
  135. ////////////////////////
  136. /// Operator Symbols ///
  137. ////////////////////////
  138.  
  139. ZScript supports value input as decimal, hexidecimal, and binary.
  140.  
  141. To input hexidecimal values, preface them with '0x'. Thus, '0x0F' for '16'.
  142. To input binary balues, end them with a lowercase 'b'. Thus, '11b' for '3'.
  143.  
  144. Name Sign ZASM (R) ZASM (V) Definition
  145. PLUS + ADDR<><> ADDV<><> Adds a value a + b, a + 3
  146. MINUS - SUBR<><> SUBV<><> Subtracts a value a - b, a - 2
  147. INCREMENT ++ Increments a value by '1'
  148. DECREMENT -- Decreases a value by '1'
  149. MULTIPLY * MULTR<><> MULTV<><> Multiplies values a * b
  150. DIVIDE / DIVR<><> DIVV<><> Divides values a / b
  151. MODULUS % Returns the remainder of integer division of 4 % 2
  152. NOT ! NOT<> Inverse logic boolean operator.
  153. if ( !var1 == 0 ) returns true if var1 is zero,
  154. and false if var1 is non-zero
  155. EQUALS = SETR<><> SETV<><> Sets a value to another value a = 4
  156. EXACTLY EQUALS == Compares value a == b and returns if they match.
  157. NOT EQUALS != Compares values a != b and returns if they do not match,
  158. LESSTHAN < Comapres a < b and returns if a is less then b.
  159. MORETHAN > Compares a > b and returns if a is more than b.
  160. LOGICAL OR || Boolean logic, Or.
  161. LOGICAL AND && Boolean Logic And.
  162.  
  163. SET ADDRESS ARG SETA1<><>
  164. SETA2<><>
  165. GET ADDRESS ARG GETA1<><>
  166. GETA2<><>
  167.  
  168. Note: LOGICAL XOR (^^) is not valid in ZScript, but you may simulate it with custom functions.
  169.  
  170.  
  171. /////////////////////////
  172. /// Bitwise Operators ///
  173. /////////////////////////
  174.  
  175. Reminder: You may reference a binary value using a numeric sequence, ending in 'b':
  176. 0100010b
  177. ('34' decimal)
  178.  
  179. Or ZScript Symbol ZASM Instructions:
  180. | ORV<><>
  181. ORR<><>
  182.  
  183. And ZScript Symbol ZASM Instructions:
  184. & ANDR<><>
  185. ANDV<><>
  186.  
  187. Not ZScript Symbol ZASM Instructions:
  188. ~ BITNOT<>
  189.  
  190. Left Shift:
  191. ZScript Symbol ZASM Instructions
  192. << LSHIFTV<><>
  193. LSHIFTR<><>
  194.  
  195. Right Shift:
  196. ZScript Symbol ZASM Instructions
  197. >> RSHIFTV<><>
  198. RSHIFTR<><>
  199.  
  200. Xor ZScript Symbol ZASM Instructions:
  201. ^ XORV<><>
  202. XORR<><>
  203.  
  204. Nor ZScript Symbol ZASM Instructions:
  205. ~| NORV<><>
  206. NORR<><>
  207.  
  208. XNor ZScript Symbol ZASM Instructions:
  209. ~^ XNORV<><>
  210. XNORV<><>
  211.  
  212. Nand ZScript Symbol ZASM Instructions:
  213. ~& NANDV<><>
  214. NANDR<><>
  215.  
  216. /************************************************************************************************************/
  217.  
  218.  
  219. //========================
  220. //--- Global Functions ---
  221. //========================
  222.  
  223. /////////////////////////
  224. /// General Functions ///
  225. /////////////////////////
  226.  
  227.  
  228. void Waitdraw(); ZASM Instruction:
  229. WAITDRAW
  230. /**
  231. * Halts execution of the script until ZC's internal code has been run (movement,
  232. * collision detection, etc.), but before the screen is drawn. This can only
  233. * be used in the active global script.
  234. * Waitdraw() may only be called from the global active script; not from FFC scripts.
  235. * The sequence of ZC actions is as follows:
  236.  
  237. * FFCs (in numerical sequence, from FFC 01, to FFC 32)
  238. * Enemies
  239. * EWeapons
  240. * Link
  241. * LWeapons
  242. * Hookshot
  243. * Collision Checking
  244. * Store Link->Input / Link->Press
  245. * Waitdraw()
  246. * Drawing
  247. * Rendering of the Screen
  248. * Screen Scrolling
  249. * Drawing from FFCs
  250. *
  251. * Note: Drawing from FFCs technically occurs with other Drawing, but as it is issued after Waitdraw(),
  252. * it is offset (a frame late) and renders after screen scrolling, and after any other drawing in the same
  253. * frame as draw instructions from ffcs are called. To ensure that drawing done by ffcs is in sync with
  254. * other drawing, it is imperative to call it from your global script, using the ffc to trigger global
  255. * conditions that cause global drawing instructions that are called before Waitdraw() in your global
  256. * active script to evaluate true.
  257. *
  258. * Anything placed after Waitdraw() will not present graphical effects until the next frame.
  259. * It is possible { ! CHECK } to read/store Link->Tile, Link->Dir and other variables *after* Waitdraw()
  260. * in one frame, and then use these values to modify other pointer members so that they are drawn correctly
  261. * at the next execution of Waitdraw().
  262. *
  263. *
  264. */ Example Use:
  265.  
  266. Waitdraw();
  267.  
  268. //! Submit bug report that Link->Dir and Link->Tile are incorrect before Waitdraw.
  269.  
  270. *//////////////////////////////
  271. * Waitdraw() in ffc scripts ///
  272. * --------------------------///
  273. * Althouth technically illegal, it is possible to call Waitdraw() in an *ffc script*. Doing this has the
  274. * following effects, and/or consequences:
  275. *
  276. * 1. The Compiler will report an error, and print the error to Allegro log:
  277. * 'Warning: Waitdraw() may only be used in global scripts.'
  278. * 2. Any instruction sint he ffc script that are called before the Waitdraw() instruction in the ffc script
  279. * will run this frame, after Waitdraw() in your global active script.
  280. * 3. Any instructions called *after* Waitdraw() in the ffc script, will run BEFORE BOTH Waitdraw() in your
  281. * global active script, and BEFORE any other instructions in your global active script's infinite loop.
  282. *
  283. * This behaviour may change in future versions of ZC, and using Waitdraw() in ffc scripts is not advised.
  284.  
  285. *///////////////////////////////
  286. * Waitdraw() in item scripts ///
  287. * ---------------------------///
  288. * Althouth technically illegal, it is possible to call Waitdraw() in an item sctipt. Doing this has the
  289. * following effects, and/or consequences:
  290. *
  291. * 1. The Compiler will report an error, and print the error to Allegro log:
  292. * 'Warning: Waitdraw() may only be used in global scripts.'
  293. * 2.
  294. *
  295. * This behaviour may change in future versions of ZC, and using Waitdraw() in item scripts is not advised.
  296.  
  297. /************************************************************************************************************/
  298.  
  299. void Waitframe(); ZASM Instruction:
  300. WAITFRAME
  301. /**
  302. * Temporarily halts execution of the current script. This function returns at
  303. * the beginning of the next frame of gameplay.
  304. * Slots 1, 3 and 4 Global scripts and item scripts only execute for one frame,
  305. * so in those scripts Waitframe() is essentially Quit().
  306. * It is safe to call Waitframe in the active global script.
  307. * A Waitframe is required in all infinite loops (e.g. while(true) ) so that ZC may
  308. * pause to break in order to advance to the next frame, then resume the loop from the start.
  309. *
  310. */ Example Use:
  311.  
  312. Waitframe();
  313.  
  314. *///////////////////////////////
  315. * Waitdraw() in item scripts ///
  316. * ---------------------------///
  317. * Althouth technically legal, it is invalid to call Waitframe() in an item sctipt. Doing this has the
  318. * following effects, and/or consequences:
  319. *
  320. * 1. The script will prematurely exit.
  321. *
  322. * Calling Waitframe() in an item script is effectively identical to calling Quit(), however this behaviour
  323. * may change in future versions of ZC, and using Waitframe() in item scripts is not advised.
  324.  
  325. /************************************************************************************************************/
  326.  
  327. void Quit(); ZASM Instruction:
  328. QUIT
  329. /**
  330. * Terminates execution of the current script. Does not return.
  331. * Caution: If called from a global script, the script itself exits.
  332. *
  333. */ Example Use:
  334.  
  335. Quit();
  336.  
  337. /************************************************************************************************************/
  338.  
  339. ////////////////////
  340. /// Modify Tiles ///
  341. ////////////////////
  342.  
  343.  
  344. void CopyTile(int srctile, int desttile); ZASM Instruction:
  345. COPYTILERR d2,d3
  346. COPYTILEVV
  347. COPYTILERV
  348. COPYTILEVR
  349. /**
  350. * Copies the tile specified by scrtile onto the tile space
  351. * specified by desttile. The valid tile value range is 0 to 65519.
  352. * This change is temporary within the quest file
  353. * and not be retained when saving the game.
  354. *
  355. */ Example Use:
  356.  
  357. CopyTile(312,11614);
  358. Copies tile 312, to tile 11614. Tiles 312, and 11614 will be identical.
  359.  
  360. /** TIP **
  361. * CopyTile may be used to change Link's tile, by copying a tile onto whatever tile ZC is
  362. * using as a source for Link->Tile
  363. * Thus, although you cannot write directly to Link->Tile, you can write to the actual tile
  364. * that is being used for this Link attribute, and you can do this for any other game graphic
  365. * that you need to change.
  366. *
  367. * When doing this, it is important to read Link->Dir or Link->Flip, *after* Waitdraw() and
  368. * perform the CopyTile() operation immediately thereafter.
  369. */
  370.  
  371. /************************************************************************************************************/
  372.  
  373. void SwapTile(int firsttile, int secondtile); ZASM Instruction:
  374. SWAPTILERR d2,d3
  375. SWAPTILEVV
  376. SWAPTILEVR
  377. SWAPTILERV
  378. /**
  379. * Swaps the two tiles specified by firsttile and secondtile.
  380. * The valid tile value range is 0 to 65519.
  381. * This change is *TEMPORARY* within the quest file
  382. * and will not be retained when saving the game.
  383. *
  384. */ Example Use:
  385.  
  386. SwapTile(312,11614);
  387. Changes tile 11614 into tile 312; and tile 312 into tile 11614, transposing their positions.
  388.  
  389. /************************************************************************************************************/
  390.  
  391. void OverlayTile(int firsttile, int secondtile); ZASM Instruction:
  392. OVERLAYTILEVV
  393. OVERLAYTILEVR
  394. OVERLAYTILERV
  395. OVERLAYTILERR
  396. /**
  397. * Overlays secondtile onto firsttile, ignoring all pixels of colour 0.
  398. * The valid tile value range is 0 to 65519.
  399. * This change is *TEMPORARY* within the quest file
  400. * and will not be retained when saving the game.
  401. *
  402. */ Example Use:
  403.  
  404.  
  405. /************************************************************************************************************/
  406.  
  407. void ClearTile(int tileref); ZASM Instruction:
  408. CLEARTILER <d3>
  409. CLEARTILEV
  410. /**
  411. * Erases the tile specified by tileref.
  412. * This change is temporary within the quest file
  413. * and will not be retained when saving the game.
  414. * Tiles are not / are (!check!) shifted upward to adjust for the cleared tile.
  415. *
  416. */ Example Use:
  417.  
  418. ClearTile(21362);
  419. Clears tile 21362 by ( blanking it to colour 0 ) | ( removing it and shifting all tiles
  420. thereafter upward ).
  421.  
  422. /************************************************************************************************************/
  423.  
  424. //Overlay Tile
  425.  
  426. //! Is there a ZScript equivalent of this?!
  427. //! This instruction seems to be ***ZASM-specific***.
  428. //! Game->overlayTile() and Screen->OverlayTile() both return an error (no such pointer).
  429. //! Add this to the bytecode in a future build.
  430. //! As far as I can tell, this should work from ZASM, but it was never added to the ZScript side. (11/July/2016: ZRPG)
  431.  
  432. void OverlayTile() ?
  433.  
  434. OVERLAYTILEVV
  435. OVERLAYTILEVR
  436. OVERLAYTILERV
  437. OVERLAYTILERR
  438.  
  439. /************************************************************************************************************/
  440.  
  441. ///////////////
  442. /// Tracing ///
  443. ///////////////
  444.  
  445.  
  446. void Trace(float val); ZASM Instruction:
  447. TRACER d3
  448. TRACEV
  449. /**
  450. * Prints a line containing a string representation of val to allegro.log.
  451. * Useful for debugging scripts. You may trace int, and float types.
  452. * For b oolean values, see TraceB() below.
  453. * Values printed to allegro.log no not incorporate any spacing, or carriage
  454. * returns. You must manually add these into your commands.
  455. * Int values are not truncated when printed, and will always have four leading
  456. * zeros after the decimal point.
  457. * To add new lines (carriange returns), see TraceNL() below.
  458. *
  459. */ Example Use:
  460.  
  461. int val = 4;
  462. Trace(val);
  463. Prints 4.000 to allegro.log
  464.  
  465. /************************************************************************************************************/
  466.  
  467. void TraceB(bool state); ZASM Instruction:
  468. TRACE2R d3
  469. TRACE2V
  470. /**
  471. * Prints a boolean state to allegro.log. Works as trace() above, but prints 'true'
  472. * or 'false' to allegro.log
  473. *
  474. */ Example Use:
  475.  
  476. bool test = true;
  477. TraceB(test);
  478. Prints 'true' to allegro.log.
  479.  
  480. /************************************************************************************************************/
  481.  
  482. void TraceToBase( int val, int base, ZASM Instruction:
  483. int mindigits ); TRACE3
  484. /**
  485. * Prints a line in allegro.log representing 'val' in numerical base 'base',
  486. * where 2 <= base <= 36, with minimum digits 'mindigits'.
  487. * (Base must be at least base-2, and at most, base-36)
  488. * Can be useful for checking hex values or flags ORed together, or just to trace
  489. * an integer value, as Trace() always traces to four decimal places.
  490. * mindigits specifies the minimum number of integer digits to print.
  491. * Unlike Trace(), Decimal values are not printed. TraceToBase *does not* handle floats.
  492. * If you specify a floating point value as arg 'val', it will be Floored before conversion.
  493. *
  494. */ Example Use:
  495.  
  496. TraceToBase(20,8,1);
  497. Converts (decimal) d20 to base-8 (o24 in base-8) and prints value '024' to allegro.log
  498.  
  499. TraceToBase(50,16,1);
  500. Converts (decimal) d50 to base-16 (0x32 hexadecimal) and prints value '0x32' to allegro.log.
  501.  
  502. /************************************************************************************************************/
  503.  
  504. void ClearTrace(); ZASM Instruction:
  505. TRACE4
  506. /**
  507. * Clears allegro.log of all current traces and messages from Zelda Classic/ZQuest.
  508. * Works on a per-quest, per-session basis. Values recorded from previous sessions are not erased.
  509. *
  510. */ Example Use
  511.  
  512. ClearTrace();
  513.  
  514. /************************************************************************************************************/
  515.  
  516. void TraceNL(); ZASM Instruction:
  517. TRACE5
  518. /**
  519. * Traces a newline to allegro.log
  520. * This inserts a carriage return (as if pressing return/enter) into allegro.log
  521. * and is useful for providing formatting to debugging.
  522. *
  523. */ Example Use:
  524.  
  525. TraceNL();
  526. Prints a carriage return to allegro.log.
  527.  
  528. /************************************************************************************************************/
  529.  
  530. void TraceS(int s[]); ZASM Instruction:
  531. TRACE6 d3
  532. /**
  533. * Works as Trace() above, but prints a full string to allegro.log, using the array pointer
  534. * (name) as its argument.
  535. * Maximum 512 characters. Functions from string.zh can be used to split larger strings.
  536. *
  537. */ Example Use:
  538.  
  539. int testString[]="This is a string.";
  540. TraceS(testString);
  541. Prints 'This is a string.' to allegro.log.
  542.  
  543. /************************************************************************************************************/
  544.  
  545. ///////////////////////
  546. /// Array Functions ///
  547. ///////////////////////
  548.  
  549.  
  550. int SizeOfArray(int array[]); ZASM Instruction:
  551. ARRAYSIZE d2
  552. /**
  553. * Returns the index size of the array pointed by 'array'.
  554. * Works only on int, and float type arrays. Boolean arrays are not supported.
  555. * Useful in for loops.
  556. *
  557. */ Example Use:
  558.  
  559. int isAnArray[216];
  560. int x;
  561. x = SizeOfArray(isAnArray);
  562. The value of x becomes 216.
  563.  
  564. /************************************************************************************************************/
  565.  
  566. int SizeOfArrayBool(bool array[]); ZASM Instruction:
  567. ARRAYSIZEB d2
  568. /**
  569. * Returns the index size of the array pointed by 'array'.
  570. * As SizeOfArray(int *ptr), save that it works specifically with bool typed arrays.
  571. * Useful in for loops.
  572. *
  573. */ Example Use:
  574.  
  575.  
  576. /************************************************************************************************************/
  577.  
  578. int SizeOfArrayFFC(ffc array[]); ZASM Instruction:
  579. ARRAYSIZEF d2
  580. /**
  581. * Returns the index size of the array pointed by 'array'.
  582. * As SizeOfArray(int *ptr), save that it works specifically with ffc typed arrays.
  583. * Useful in for loops.
  584. *
  585. */ Example Use:
  586.  
  587.  
  588. /************************************************************************************************************/
  589.  
  590. int SizeOfArrayNPC(npc array[]); ZASM Instruction:
  591. ARRAYSIZEN d2
  592. /**
  593. * Returns the index size of the array pointed by 'array'.
  594. * As SizeOfArray(int *ptr), save that it works specifically with npc typed arrays.
  595. * Useful in for loops.
  596. *
  597. */ Example Use:
  598.  
  599. /************************************************************************************************************/
  600.  
  601. int SizeOfArrayItem(item array[]); ZASM Instruction:
  602. ARRAYSIZEI d2
  603. /**
  604. * Returns the index size of the array pointed by 'array'.
  605. * As SizeOfArray(int *ptr), save that it works specifically with item typed arrays.
  606. * Useful in for loops.
  607. *
  608. */ Example Use:
  609.  
  610. /************************************************************************************************************/
  611.  
  612. int SizeOfArrayItemdata(itemdata array[]);
  613. ZASM Instruction:
  614. ARRAYSIZEID d2
  615. /**
  616. * Returns the index size of the array pointed by 'array'.
  617. * As SizeOfArray(int *ptr), save that it works specifically with itemdata typed arrays.
  618. * Useful in for loops.
  619. *
  620. */ Example Use:
  621.  
  622. /************************************************************************************************************/
  623.  
  624. int SizeOfArrayLWeapon(lweapon array[]);
  625. ZASM Instruction:
  626. ARRAYSIZEL d2
  627. /**
  628. * Returns the index size of the array pointed by 'array'.
  629. * As SizeOfArray(int *ptr), save that it works specifically with lweapon typed arrays.
  630. * Useful in for loops.
  631. *
  632. */ Example Use:
  633.  
  634. /************************************************************************************************************/
  635.  
  636. int SizeOfArrayEWeapon(eweapon array[]);
  637. ZASM Instruction:
  638. ARRAYSIZEE d2
  639. /**
  640. * Returns the index size of the array pointed by 'array'.
  641. * As SizeOfArray(int *ptr), save that it works specifically with eweapon typed arrays.
  642. * Useful in for loops.
  643. *
  644. */ Example Use:
  645.  
  646. /************************************************************************************************************/
  647.  
  648.  
  649.  
  650.  
  651. //////////////////////////////
  652. /// Mathematical Functions ///
  653. //////////////////////////////
  654.  
  655. int Rand(int n); ZASM Instruction:
  656. RNDR<><> d2,d3
  657. RNDV<><>
  658.  
  659. /**
  660. * Computes and returns a random integer from 0 to n-1,
  661. * or a negative value between n+1 and 0 if 'n' is negative.
  662. *
  663. * Note: The paramater 'n' is an integer, and any floating point (ZScript float)
  664. * value passed to it will be truncated (floored) to the nearest integer.
  665. * Rand(3.75) is identical to Rand(3).
  666. */ Example Use:
  667.  
  668. Rand(40);
  669. Produces a random number between 0 and 39.
  670. Rand(-20);
  671. produces a random number between -19 and 0.
  672.  
  673.  
  674. /************************************************************************************************************/
  675.  
  676. float Sin(float deg); ZASM Instruction:
  677. SINR<><> d2,d3
  678. SINV<><>
  679.  
  680. /**
  681. * Returns the trigonometric sine of the parameter, which is interpreted
  682. * as a degree value.
  683. *
  684. */ Example Use:
  685.  
  686. float x = Sin(32);
  687. x = 0.5299
  688.  
  689. /************************************************************************************************************/
  690.  
  691. float Cos(float deg); ZASM Instruction:
  692. COSR<><> d2,d3
  693. COSV<><>
  694.  
  695. /**
  696. * Returns the trigonometric cosine of the parameter, which is
  697. * interpreted as a degree value.
  698. *
  699. */ Example Usage:
  700.  
  701. float x = Cos(40);
  702. x = 0.7660
  703.  
  704. /************************************************************************************************************/
  705.  
  706. float Tan(float deg); ZASM Instruction:
  707. TANR<><> d2,d3
  708. TANV<><>
  709.  
  710. /**
  711. * Returns the trigonometric tangent of the parameter, which is
  712. * interpreted as a degree value. The return value is undefined if
  713. * deg is of the form 90 + 180n for an integral value of n.
  714. *
  715. */ Example Use:
  716.  
  717. float x = Tan(100);
  718. x = -5.6712
  719.  
  720. /************************************************************************************************************/
  721.  
  722. //!Sources: OMultImmediate, OArcSinRegister
  723. //Is there a direct ZASM instruction equivalent, or does this function run as a routine?
  724.  
  725. float RadianSin(float rad);
  726. /**
  727. * Returns the trigonometric sine of the parameter, which is interpreted
  728. * as a radian value.
  729. *
  730. */ Example Use:
  731.  
  732. /************************************************************************************************************/
  733.  
  734. //!Sources: OMultImmediate, OCosRegister
  735. //Is there a direct ZASM instruction equivalent, or does this function run as a routine?
  736.  
  737. float RadianCos(float rad);
  738. /**
  739. * Returns the trigonometric cosine of the parameter, which is
  740. * interpreted as a radian value.
  741. *
  742. */ Example Use:
  743.  
  744. /************************************************************************************************************/
  745.  
  746. //!Sources: OMultImmediate, OTanRegister
  747. //Is there a direct ZASM instruction equivalent, or does this function run as a routine?
  748.  
  749. float RadianTan(float rad);
  750. /**
  751. * Returns the trigonometric tangent of the parameter, which is
  752. * interpreted as a radian value. The return value is undefined for
  753. * values of rad near (pi/2) + n*pi, for n an integer.
  754. *
  755. */ Example Use:
  756.  
  757. /************************************************************************************************************/
  758.  
  759. float ArcTan(int x, int y); ZASM Instruction:
  760. ARCTANR<>
  761. (Does ARCTANV exist?)
  762. /**
  763. * Returns the trigonometric arctangent of the coordinates, which is
  764. * interpreted as a radian value.
  765. *
  766. */ Example Use:
  767.  
  768. /************************************************************************************************************/
  769.  
  770. float ArcSin(float x); ZASM Instruction:
  771. ARCSINR<><>
  772. ARCSINV<><> (Can't find this in the source code)
  773. ffasm.cpp line 217
  774. /**
  775. * Returns the trigonometric arcsine of x, which is
  776. * interpreted as a radian value.
  777. *
  778. */ Example Use:
  779.  
  780. /************************************************************************************************************/
  781.  
  782. float ArcCos(float x); ZASM Instruction:
  783. ARCCOSR<><>
  784. ARCCOSV<><>
  785.  
  786. /**
  787. * Returns the trigonometric arccosine of x, which is
  788. * interpreted as a radian value.
  789. *
  790. */ Example Use:
  791.  
  792. /************************************************************************************************************/
  793.  
  794. float Max(float a, float b); ZASM Instruction:
  795. MAXR<><>
  796. MAXV<><>
  797. /**
  798. * Returns the greater of a and b.
  799. *
  800. */ Example Use:
  801.  
  802. /************************************************************************************************************/
  803.  
  804. float Min(float a, float b); ZASM Instriction:
  805. MINR<><>
  806. MINV<><>
  807. /**
  808. * Returns the lesser of a and b.
  809. *
  810. */ Example Use:
  811.  
  812. /************************************************************************************************************/
  813.  
  814. int Pow(int base, int exp); ZASM Instruction:
  815. POWERR<><>
  816. POWERV<><>
  817. /**
  818. * Returns base^exp. The return value is undefined for base=exp=0. Note
  819. * also negative values of exp may not be useful, as the return value is
  820. * truncated to the nearest integer.
  821. *
  822. */ Example Use:
  823.  
  824. /************************************************************************************************************/
  825.  
  826. int InvPow(int base, int exp); ZASM Instruction:
  827. IPOWERR<><>
  828. IPOWERV<><>
  829. /**
  830. * Returns base^(1/exp). The return value is undefined for exp=0, or
  831. * if exp is even and base is negative. Note also that negative values
  832. * of exp may not be useful, as the return value is truncated to the
  833. * nearest integer.
  834. *
  835. */ Example Use:
  836.  
  837. /************************************************************************************************************/
  838.  
  839. float Log10(float val); ZASM Instruction:
  840. LOG10<>
  841. /**
  842. * Returns the log of val to the base 10. Any value <= 0 will return 0.
  843. *
  844. */ Example Use:
  845.  
  846. /************************************************************************************************************/
  847.  
  848. float Ln(float val); ZASM Instruction:
  849. LOGE<>
  850.  
  851. /**
  852. * Returns the natural logarithm of val (to the base e). Any value <= 0 will return 0.
  853. *
  854. */ Example Use:
  855.  
  856. /************************************************************************************************************/
  857.  
  858. int Factorial(int val); ZASM Instruction:
  859. FACTORIAL<>
  860. /**
  861. * Returns val!. val < 0 returns 0.
  862. *
  863. */ Example Use:
  864.  
  865. /************************************************************************************************************/
  866.  
  867. float Abs(float val); ZASM Instruction:
  868. ABS<>
  869. /**
  870. * Return the absolute value of the parameter, if possible. If the
  871. * absolute value would overflow the parameter, the return value is
  872. * undefined.
  873. *
  874. */ Example Use:
  875.  
  876. /************************************************************************************************************/
  877.  
  878. float Sqrt(float val); ZASM Instruction:
  879. SQROOTV<><>
  880. SQROOTR<><>
  881. /**
  882. * Computes the square root of the parameter. The return value is
  883. * undefined for val < 0.
  884. * NOTE: Passing negative values to Sqrt() will return an error. See SafeSqrt() in std.zh
  885. */ Example Use:
  886.  
  887. int x = Sqrt(16);
  888. x = 4
  889.  
  890. /************************************************************************************************************/
  891. /************************************************************************************************************/
  892.  
  893.  
  894.  
  895. //====================================
  896. //--- Game Functions and Variables ---
  897. //====================================
  898.  
  899. namespace Game
  900.  
  901. void SetScreenFlag(int map, int screen, int flag, bool state); ZASM Instruction:
  902. SCREENFLAG
  903.  
  904. /**
  905. *
  906. *
  907. */ Example Use:
  908.  
  909.  
  910. /************************************************************************************************************/
  911.  
  912. bool ButtonPress[18]; ZASM Instruction:
  913. BUTTONPRESS
  914. /**
  915. * An array of 18 button states that correspond to Link->Press*
  916. *
  917. */ Example Use:
  918.  
  919. /************************************************************************************************************/
  920.  
  921. bool ButtonInput[18]; ZASM Instruction:
  922. BUTTONINPUT
  923. /**
  924. * An array of 18 button states that correspond to Link->Input*
  925. *
  926. */ Example Use:
  927.  
  928. /************************************************************************************************************/
  929.  
  930. bool ButtonHeld[18]; ZASM Instruction:
  931. BUTTONHELD
  932. /**
  933. * An array of 18 button states that returns if a button is being held down.
  934. * MAY only represent a joypad.
  935. *
  936. */ Example Use:
  937.  
  938. /************************************************************************************************************/
  939.  
  940. bool KeyPress[127]; ZASM Instruction:
  941. KEYPRESS
  942. /**
  943. * An array of 127 indices, each representing a keypress on the keyboard.
  944. * See std_keyboard.zh for constants ands functions that relate to reading from, or writing to the keyboard.
  945. *
  946. */ Example Use:
  947.  
  948. /************************************************************************************************************/
  949.  
  950. bool ReadKey[127]; ZASM Instruction:
  951. READKEY
  952. /**
  953. * A read-only array of 127 indices, each representing a keypress on the keyboard.
  954. * Returns true if a key is pressed or held.
  955. * See std_keyboard.zh for constants ands functions that relate to reading from, or writing to the keyboard.
  956. *
  957. */ Example Use:
  958.  
  959. /************************************************************************************************************/
  960.  
  961. bool JoypadPress[18]; ZASM Instruction:
  962. JOYPADPRESS
  963. /**
  964. * An array of 18 button states that corresponds to whether the player is pressing a button on a Joypad \
  965. * controller, but not the keyboard. REQUIRES TESTING.
  966. *
  967. */ Example Use:
  968.  
  969. /************************************************************************************************************/
  970.  
  971. int GetMaxMaps()
  972. int MapCount() ZASM Instruction
  973. GETMAXMAPS
  974.  
  975. /**
  976. *
  977. * Returns the number of maps used by a quest.
  978. *
  979. *
  980. * /
  981.  
  982. /************************************************************************************************************/
  983.  
  984. int GetScreenEnemy(int map, int screen, int enemy_index)
  985. ZASM Instruction
  986. GETSCREENENEMY
  987.  
  988. /**
  989. * Reads values from enemy lists anywhere in the game.
  990. * Returns the Nth enemy of a given map, and screen where 'enemy_index' is the Nth index
  991. * 'map' is the desired map, and 'screen' is the desired screen.
  992. * Returns 0 if there is no enemy in the desired index.
  993. *
  994. * Use DMaptoMap() from std_functions to simplify in-game use with DMaps.
  995. * /
  996.  
  997. /************************************************************************************************************/
  998.  
  999. int SetScreenEnemy(int map, int screen, int enemy_index, int enemy_id)
  1000. ZASM Instruction
  1001. SETSCREENENEMY
  1002.  
  1003. /**
  1004. * Sets values to enemy lists anywhere in the game.
  1005. * Sets the Nth enemy of a given map, and screen to a specified NPC, where 'enemy_index' is
  1006. * the Nth index 'map' is the desired map, and 'screen' is the desired screen, and 'enemy_id'.
  1007. * is the ID of the enemy that you wish to use.
  1008. *
  1009. * If changing the enemies on the current screen and map, enemies will change upon reloading the screen.
  1010. *
  1011. * Use DMaptoMap() from std_functions to simplify in-game use with DMaps.
  1012. * /
  1013.  
  1014. /************************************************************************************************************/
  1015.  
  1016. int GetScreenDoor(int map, int screen, int index)
  1017. ZASM Instruction
  1018. GETSCREENDOOR
  1019.  
  1020. /**
  1021. * Reads value of a door on any screen in the game environment.
  1022. * Returns Screen->Door[index] of a given map, and screen where 'index' is the Door[] index,
  1023. * 'map' is the desired map, and 'screen' is the desired screen.
  1024. * Returns 0 if there is no door present (open).
  1025. *
  1026. * Use DMaptoMap() from std_functions to simplify in-game use with DMaps.
  1027. * /
  1028.  
  1029. /************************************************************************************************************/
  1030.  
  1031. int SetScreenDoor(int map, int screen, int index, int type)
  1032. ZASM Instruction
  1033. SETSCREENDOOR
  1034.  
  1035. /**
  1036. * Sets the value of a door on any screen in the game environment.
  1037. * Sets Screen->Door[index] of a given map, and screen where 'index' is the Door[] index,
  1038. * 'map' is the desired map, and 'screen' is the desired screen, and 'type'.
  1039. * is the door type.
  1040. *
  1041. * If changing the doors on the current screen and map, doors will change upon reloading the screen.
  1042. *
  1043. * Use DMaptoMap() from std_functions to simplify in-game use with DMaps.
  1044. * /
  1045.  
  1046. /************************************************************************************************************/
  1047.  
  1048. int GetPointer(bool *ptr[]); ZASM Instruction:
  1049. BOOLARRPTR
  1050. /**
  1051. * Returns the pointer of a bool array as a float.
  1052. */ Example Use:
  1053. bool arr[16];
  1054. int size = SizeOfArray( GetPointer(arr) );
  1055. //Size == 16
  1056.  
  1057. /************************************************************************************************************/
  1058.  
  1059.  
  1060. int GetCurScreen(); ZASM Instruction:
  1061. CURSCR
  1062. /**
  1063. * Retrieves the number of the current screen within the current map.
  1064. */ Example Use: !#!
  1065.  
  1066. /************************************************************************************************************/
  1067.  
  1068. int GetCurDMapScreen(); ZASM Instruction:
  1069. CURDSCR
  1070. /**
  1071. * Retrieves the number of the current screen within the current DMap.
  1072. */ Example Use: !#!
  1073.  
  1074. /************************************************************************************************************/
  1075.  
  1076. int GetCurLevel(); ZASM Instruction:
  1077. CURLEVEL
  1078. /**
  1079. * Retrieves the number of the dungeon level of the current DMap. Multiple
  1080. * DMaps can have the same dungeon level - this signifies that they share
  1081. * a map, compass, level keys and such.
  1082. */ Example Use: !#!
  1083.  
  1084. /************************************************************************************************************/
  1085.  
  1086. int GetCurMap(); ZASM Instruction:
  1087. CURMAAP
  1088. /**
  1089. * Retrieves the number of the current map.
  1090. */ Example Use: !#!
  1091.  
  1092. /************************************************************************************************************/
  1093.  
  1094. int GetCurDMap(); ZASM Instruction:
  1095. CURDMAP
  1096. /**
  1097. * Returns the number of the current DMap.
  1098. */ Example Use: !#!
  1099.  
  1100. /************************************************************************************************************/
  1101.  
  1102. int DMapFlags[]; ZASM Instruction:
  1103. DMAPFLAGSD
  1104. /**
  1105. * An array of 512 integers, containing the DMap's flags ORed (|) together.
  1106. * Use the 'DMF_' constants, or the 'DMapFlag()' functions from std.zh if you are not comfortable with binary.
  1107. */ Example Use: !#!
  1108.  
  1109. /************************************************************************************************************/
  1110.  
  1111. int DMapLevel[]; ZASM Instruction:
  1112. DMAPLEVELD
  1113. /**
  1114. * An array of 512 integers containing each DMap's level
  1115. */ Example Use: !#!
  1116.  
  1117. /************************************************************************************************************/
  1118.  
  1119. int DMapCompass[]; ZASM Instruction:
  1120. DMAPCOMPASSD
  1121. /**
  1122. * An array of 512 integers containing each DMap's compass screen
  1123. */ Example Use: !#!
  1124.  
  1125. /************************************************************************************************************/
  1126.  
  1127. int DMapContinue[]; ZASM Instruction:
  1128. DMAPCONTINUED
  1129. /**
  1130. * An array of 512 integers containing each DMap's continue screen
  1131. */ Example Use: !#!
  1132.  
  1133. /************************************************************************************************************/
  1134.  
  1135. int DMapMIDI[]; ZASM Instruction:
  1136. DMAPMIDID
  1137. /**
  1138. * An array of 512 integers containing each DMap's MIDI.
  1139. * Positive numbers are for custom MIDIs, and negative values are used for
  1140. * the built-in game MIDIs. Because of the way DMap MIDIs are handled
  1141. * internally, however, built-in MIDIs besides the overworld, dungeon, and
  1142. * level 9 songs won't match up with Game->PlayMIDI() and Game->GetMIDI().
  1143. */ Example Use: !#!
  1144.  
  1145. /************************************************************************************************************/
  1146.  
  1147. void GetDMapName(int DMap, int buffer[]);
  1148.  
  1149. ZASM Instruction:
  1150. GETDMAPNAME
  1151. /**
  1152. * Loads DMap with ID 'DMap's name into 'buffer'.
  1153. * See std_constsnts.zh for appropriate buffer size.
  1154. */ Example Use: !#!
  1155.  
  1156. /************************************************************************************************************/
  1157.  
  1158. void SetDMapName(int dmap_id, int buffer[]);
  1159.  
  1160. ZASM Instruction:
  1161. SETDMAPNAME
  1162. /**
  1163. * Loads string 'buffer[]' to the DMap Name field for DMap with ID 'dmap_id'.
  1164. * See std_constsnts.zh for appropriate buffer size.
  1165. */ Example Use: !#!
  1166.  
  1167. /************************************************************************************************************/
  1168.  
  1169. void GetDMapTitle(int DMap, int buffer[]);
  1170.  
  1171. ZASM Instruction:
  1172. GETDMAPTITLE
  1173. /**
  1174. * Loads DMap with ID 'DMap's title into 'buffer'.
  1175. * See std_constants.zh for appropriate buffer size.
  1176. */ Example Use: !#!
  1177.  
  1178. /************************************************************************************************************/
  1179.  
  1180. void SetDMapTitle(int DMap, int buffer[]);
  1181.  
  1182. ZASM Instruction:
  1183. SETDMAPTITLE
  1184. /**
  1185. * Loads string 'buffer[]' to the DMap Title field for DMap with ID 'dmap_id'.
  1186. * See std_constsnts.zh for appropriate buffer size.
  1187. */ Example Use: !#!
  1188.  
  1189. /************************************************************************************************************/
  1190.  
  1191. void GetDMapIntro(int DMap, int buffer[]);
  1192.  
  1193. ZASM Instruction:
  1194. GETDMAPINTRO
  1195. /**
  1196. * Loads DMap with ID 'DMap's intro string into 'buffer'.
  1197. * See std_constants.zh for appropriate buffer size.
  1198. */ Example Use: !#!
  1199.  
  1200. /************************************************************************************************************/
  1201.  
  1202. void SetDMapIntro(int DMap, int buffer[]);
  1203.  
  1204. ZASM Instruction:
  1205. SETDMAPINTRO
  1206. /**
  1207. * Loads string 'buffer[]' to the DMap Intro field for DMap with ID 'dmap_id'.
  1208. * See std_constsnts.zh for appropriate buffer size.
  1209. */ Example Use: !#!
  1210.  
  1211. /************************************************************************************************************/
  1212.  
  1213. int DMapOffset[]; ZASM Instruction:
  1214. DMAPOFFSET
  1215. /**
  1216. * An array of 512 integers containing the X offset of each DMap.
  1217. * Game->DMapOffset is read-only; while setting it is not syntactically
  1218. * incorrect, it does nothing.
  1219. */ Example Use: !#!
  1220.  
  1221. /************************************************************************************************************/
  1222.  
  1223. int DMapPalette[]; ZASM Instruction:
  1224. DMAPLEVELPAL
  1225. /**
  1226. * An array of 512 integers containing each DMap's Level Palette
  1227. */ Example Use: !#!
  1228.  
  1229. /************************************************************************************************************/
  1230.  
  1231. int DMapMap[]; ZASM Instruction:
  1232. DMAPMAP
  1233.  
  1234. /**
  1235. * An array of 512 integers containing the map used by each DMap.
  1236. * Game->DMapMap is read-only; while setting it is not syntactically
  1237. * incorrect, it does nothing.
  1238. */ Example Use: !#!
  1239.  
  1240. /************************************************************************************************************/
  1241.  
  1242.  
  1243. void GreyscaleOn() ZASM Instruction
  1244. GREYSCALEON
  1245.  
  1246. /**
  1247. * Renders the entire display in greyscale.
  1248. */ Example Use: !#!
  1249.  
  1250. /************************************************************************************************************/
  1251.  
  1252. void GreyscaleOff() ZASM Instruction
  1253. GREYSCALEOFF
  1254.  
  1255. /**
  1256. * Returns the display rendering to colour.
  1257. */ Example Use: !#!
  1258.  
  1259. /************************************************************************************************************/
  1260.  
  1261. int NumDeaths; ZASM Instruction:
  1262. GAMEDEATHS
  1263. /**
  1264. * Returns or sets the number of times Link has perished during this quest.
  1265. */ Example Use: !#!
  1266.  
  1267. /************************************************************************************************************/
  1268.  
  1269. int Cheat; ZASM Instruction:
  1270. GAMECHEAT
  1271. /**
  1272. * Returns, or sets the current cheat level of the quest player.
  1273. * Valid values are 0, 1, 2, 3, and 4.
  1274. */ Example Use: !#!
  1275.  
  1276. /************************************************************************************************************/
  1277.  
  1278. bool CappedFPS; ZASM Instruction:
  1279. GAMETHROTTLE
  1280. /**
  1281. * Returns if the user enabled an uncapped mode either with F1 or TILDE.
  1282. * Returns 'true' is the game is capped to 60fps, or false otherwise.
  1283. * At present, you may get (read), but NOT set (write to) this value.
  1284. */ Example Use: !#!
  1285.  
  1286. /************************************************************************************************************/
  1287.  
  1288. int Time ZASM Instruction:
  1289. GAMETIME
  1290. /**
  1291. * Returns the time elapsed in this quest, in 60ths of a second. (i.e. in frames).
  1292. * The return value is undefined if TimeValid is false (see below).
  1293. */ Example Use: !#!
  1294.  
  1295. /************************************************************************************************************/
  1296.  
  1297. bool TimeValid; ZASM Instruction:
  1298. GAMETIMEVALID
  1299. /**
  1300. * True if the elapsed quest time can be determined for the current quest.
  1301. */ Example Use: !#!
  1302.  
  1303. /************************************************************************************************************/
  1304.  
  1305. bool HasPlayed; ZASM Instruction:
  1306. GAMEHASPLAYED
  1307. /**
  1308. * This value is true if the current quest session was loaded from a saved
  1309. * game, false if the quest was started fresh.
  1310. */ Example Use: !#!
  1311.  
  1312. /************************************************************************************************************/
  1313.  
  1314. bool Standalone; ZASM Instruction:
  1315. GAMESTANDALONE
  1316. /**
  1317. * This value is true if the game is running in standalone mode, false if not.
  1318. * Game->Standalone is read-only; while setting it is not syntactically
  1319. * incorrect, it does nothing.
  1320. *
  1321. * Standalone mode is set by command line params when launching ZC.
  1322. */ Example Use: !#!
  1323.  
  1324. /************************************************************************************************************/
  1325.  
  1326. int GuyCount[]; ZASM Instruction:
  1327. GAMEGUYCOUNT
  1328. /**
  1329. * The number of NPCs (enemies and guys) on screen i of this map, where
  1330. * i is the index used to access this array. This array is exclusively used
  1331. * to determine which enemies had previously been killed, and thus won't
  1332. * return, when you re-enter a screen.
  1333. * Note: This is only a count of the enemies that remain on a screen; not their IDs.
  1334. */ Example Use: !#!
  1335.  
  1336. /************************************************************************************************************/
  1337.  
  1338. int ContinueDMap; ZASM Instruction:
  1339. GAMECONTDMAP
  1340. /**
  1341. * Returns or sets the DMap where Link will be respawned after quitting and reloading the game.
  1342. */ Example Use: !#!
  1343.  
  1344. /************************************************************************************************************/
  1345.  
  1346. int ContinueScreen; ZASM Instruction:
  1347. GAMECONTSCR
  1348. /**
  1349. * Returns or sets the map screen where Link will be respawned after quitting and reloading the game.
  1350. */ Example Use: !#!
  1351.  
  1352. /************************************************************************************************************/
  1353.  
  1354. int LastEntranceDMap; ZASM Instruction:
  1355. GAMEENTRDMAP
  1356. /**
  1357. * Returns or sets the DMap where Link will be respawned after dying and continuing.
  1358. */ Example Use: !#!
  1359.  
  1360. /************************************************************************************************************/
  1361.  
  1362. int LastEntranceScreen; ZASM Instruction:
  1363. GAMEENTRSCR
  1364. /**
  1365. * Returns or sets the map screen where Link will be respawned after dying and continuing.
  1366. */ Example Use: !#!
  1367.  
  1368. /************************************************************************************************************/
  1369.  
  1370. int Counter[]; ZASM Instruction:
  1371. GAMECOUNTERD
  1372. /**
  1373. * Returns of sets the current value of the game counters.
  1374. * Use the CR_ constants in std.zh to index into this array.
  1375. */ Example Use: !#!
  1376.  
  1377. /************************************************************************************************************/
  1378.  
  1379. int MCounter[]; ZASM Instruction:
  1380. GAMEMCOUNTERD
  1381. /**
  1382. * Returns or sets the current maximum value of the game counters.
  1383. * Use the CR_ constants in std.zh to index into this array.
  1384. */ Example Use: !#!
  1385.  
  1386. /************************************************************************************************************/
  1387.  
  1388. int DCounter[]; ZASM Instruction:
  1389. GAMEDCOUNTERD
  1390. /**
  1391. * Returns of sets the current value of the game drain counters.
  1392. * Use the CR_ constants in std.zh to index into this array.
  1393. * Note that if the player hasn't acquired the '1/2 Magic Upgrade' yet,
  1394. * then setting the CR_MAGIC drain counter to a negative value will
  1395. * drain the magic counter by 2 per frame rather than 1.
  1396. */ Example Use: !#!
  1397.  
  1398. /************************************************************************************************************/
  1399.  
  1400. int Generic[]; ZASM Instruction:
  1401. GAMEGENERICD
  1402. /**
  1403. * An array of miscellaneous game values, such as number of heart
  1404. * containers and magic drain rate.
  1405. * Use the GEN_ constants in std.zh to index into this array.
  1406. */ Example Use: !#!
  1407.  
  1408. /************************************************************************************************************/
  1409.  
  1410. int LItems ZASM Instruction:
  1411. GAMELITEMSD
  1412. /**
  1413. * The exploration items (map, compass, boss key etc.) of dungeon level i
  1414. * currently under the possession of the player, where i is
  1415. * the index used to access this array. Each element of this
  1416. * array consists of flags OR'd (|) together; use the LI_ constants in
  1417. * std.zh to set or compare these values.
  1418. */ Example Use: !#!
  1419.  
  1420. /************************************************************************************************************/
  1421.  
  1422. int LKeys[]; ZASM Instruction:
  1423. GAMELKEYSD
  1424. /**
  1425. * The number of level keys of level i currently under the possession of
  1426. * the player, where i is the index used to access this array.
  1427. */ Example Use: !#!
  1428.  
  1429. /************************************************************************************************************/
  1430.  
  1431. int GetScreenFlags(int map, int screen, int flagset);
  1432.  
  1433. ZASM Instruction:
  1434. GETSCREENFLAGS
  1435. /**
  1436. * Returns the screen flags from screen 'screen' on map 'map',
  1437. * interpreted in the same way as Screen->Flags
  1438. */ Example Use: !#!
  1439.  
  1440.  
  1441. Game->LKeys[3]+=4; //Gives the player four keys to Level 3.
  1442.  
  1443.  
  1444. /************************************************************************************************************/
  1445.  
  1446. int GetScreenEFlags(int map, int screen, int flagset);
  1447.  
  1448. ZASM Instruction:
  1449. GETSCREENEFLAGS
  1450.  
  1451. /**
  1452. * Returns the enemy flags from screen 'screen' on map 'map',
  1453. * interpreted in the same way as Screen->EFlags
  1454. */ Example Use: !#!
  1455.  
  1456. /************************************************************************************************************/
  1457.  
  1458. bool GetScreenState(int map, int screen, int flag);
  1459.  
  1460. ZASM Instruction:
  1461. SCREENSTATEDD
  1462. /**
  1463. * As with State, but retrieves the miscellaneous flags of any screen,
  1464. * not just the current one. This function is undefined if map is less
  1465. * than 1 or greater than the maximum map number of your quest, or if
  1466. * screen is greater than 127.
  1467. * Note: Screen numbers in ZQuest are usually displayed in hexadecimal.
  1468. * Use the ST_ constants in std.zh for the flag parameter.
  1469. */ Example Use: !#!
  1470.  
  1471. /************************************************************************************************************/
  1472.  
  1473. void SetScreenState(int map, int screen, int flag, bool value);
  1474.  
  1475. ZASM Instruction:
  1476. SCREENSTATEDD
  1477.  
  1478. /**
  1479. * As with State, but sets the miscellaneous flags of any screen, not
  1480. * just the current one. This function is undefined if map is less than
  1481. * 1 or greater than the maximum map number of your quest, or if
  1482. * screen is greater than 127.
  1483. * Note: Screen numbers in ZQuest are usually displayed in hexadecimal.
  1484. * Use the ST_ constants in std.zh for the flag parameter.
  1485. */ Example Use: !#!
  1486.  
  1487. /************************************************************************************************************/
  1488.  
  1489. float GetScreenD(int screen, int reg);
  1490.  
  1491. ZASM Instruction:
  1492. SDDD
  1493. /**
  1494. * Retrieves the value of D[reg] on the given screen of the current
  1495. * DMap.
  1496. */ Example Use: !#!
  1497.  
  1498. /************************************************************************************************************/
  1499.  
  1500. void SetScreenD(int screen, int reg, float value);
  1501.  
  1502. ZASM Instruction:
  1503. SDDD
  1504. /**
  1505. * Sets the value of D[reg] on the given screen of the current DMap.
  1506. */ Example Use: !#!
  1507.  
  1508. /************************************************************************************************************/
  1509.  
  1510. float GetDMapScreenD(int dmap, int screen, int reg);
  1511.  
  1512. ZASM Instruction:
  1513. SDDDD
  1514. /**
  1515. * Retrieves the value of D[reg] on the given screen of the given
  1516. * DMap.
  1517. */ Example Use: !#!
  1518.  
  1519. /************************************************************************************************************/
  1520.  
  1521. void SetDMapScreenD(int dmap, int screen, int reg, float value
  1522.  
  1523. ZASM Instruction:
  1524. SDDDD
  1525. /**
  1526. * Sets the value of D[reg] on the given screen of the given DMap.
  1527. */ Example Use: !#!
  1528.  
  1529. itemdata LoadItemData(int item);
  1530. LOADITEMDATAR
  1531. LOADITEMDATAV
  1532. /**
  1533. * Retrieves the itemdata pointer corresponding to the given item.
  1534. * Use the item pointer ID variable or I_ constants in std.zh as values.
  1535. */ Example Use: !#!
  1536. Game->LoadItemData[I_BRANG1]
  1537.  
  1538.  
  1539. /************************************************************************************************************/
  1540. //! This compiles, but it is incomplete and returns 0.
  1541. float GetDMapScreenDoor(int dmap, int screen, int door);
  1542.  
  1543. ZASM Instruction:
  1544. n/a
  1545. /**
  1546. * Retrieves the value of Screen->Door[door] on the given screen of the given
  1547. * DMap.
  1548. */ Example Use: !#!
  1549.  
  1550. /************************************************************************************************************/
  1551. //! This compiles, but it is incomplete and returns 0.
  1552. void SetDMapScreenDoor(int dmap, int screen, int door, float value
  1553.  
  1554. ZASM Instruction:
  1555. SDDDD
  1556. /**
  1557. * Sets the value of Screen->Door[door] on the given screen of the given DMap.
  1558. */ Example Use: !#!
  1559.  
  1560.  
  1561. /************************************************************************************************************/
  1562. //! This compiles, but it is incomplete and returns 0.
  1563. bool GetDMapScreenState(int dmap, int screen, int index);
  1564.  
  1565. ZASM Instruction:
  1566. n/a
  1567. /**
  1568. * Retrieves the value of Screen->State[index] on the given screen of the given
  1569. * DMap.
  1570. */ Example Use: !#!
  1571.  
  1572. /************************************************************************************************************/
  1573. //! This compiles, but it is incomplete and returns 0.
  1574. void SetDMapScreenState(int dmap, int screen, int index, bool value
  1575.  
  1576. ZASM Instruction:
  1577. SDDDD
  1578. /**
  1579. * Sets the value of Screen->State[index] on the given screen of the given DMap.
  1580. */ Example Use: !#!
  1581.  
  1582.  
  1583. /************************************************************************************************************/
  1584.  
  1585. void PlaySound(int soundid); ZASM Instruction:
  1586. PLAYSOUNDR
  1587. PLAYSOUNDV
  1588. /**
  1589. * Plays one of the quest's sound effects. Use the SFX_ constants in
  1590. * std.zh as values of soundid.
  1591. */ Example Use: !#!
  1592.  
  1593. /************************************************************************************************************/
  1594.  
  1595. void ContinueSound(int sfx); ZASM Instruction:
  1596. CONTINUESFX
  1597. /**
  1598. *
  1599. *
  1600. */ Example Use:
  1601.  
  1602. /************************************************************************************************************/
  1603.  
  1604. void AdjustSound(int sfx, int pan, bool loop); ZASM Instruction:
  1605. ADJUSTSFX
  1606. /**
  1607. * Adjusts properties of a sound effect.
  1608. *
  1609. */ Example Use:
  1610.  
  1611. /************************************************************************************************************/
  1612.  
  1613. void PauseSound(int soundid); ZASM Instruction:
  1614. PAUSESOUNDR
  1615. PAUSESOUNDV
  1616. /**
  1617. * Pauses one of the quest's playing sound effects. Use the SFX_ constants in
  1618. * std.zh as values of soundid.
  1619. */ Example Use: !#!
  1620.  
  1621. /************************************************************************************************************/
  1622.  
  1623. void ResumeSound(int soundid); ZASM Instruction:
  1624. RESUMESOUNDR
  1625. RESUMESOUNDV
  1626. /**
  1627. * Resumes one of the quest's paused sound effects. Use the SFX_ constants in
  1628. * std.zh as values of soundid.
  1629. */ Example Use: !#!
  1630.  
  1631. /************************************************************************************************************/
  1632.  
  1633. void EndSound(int soundid); ZASM Instruction:
  1634. ENDSOUNDR
  1635. ENDSOUNDV
  1636. /**
  1637. * Kills one of the quest's playing sound effects. Use the SFX_ constants in
  1638. * std.zh as values of soundid.
  1639. */ Example Use: !#!
  1640.  
  1641. /************************************************************************************************************/
  1642.  
  1643. void PauseMusic(); ZASM Instruction:
  1644. PAUSEMUSIC
  1645. PAUSEMUSIC
  1646. /**
  1647. * Pauses the present, playing MIDI or Enhanced Music file.
  1648. */ Example Use: !#!
  1649.  
  1650. /************************************************************************************************************/
  1651.  
  1652. void ResumeMusic(); ZASM Instruction:
  1653. RESUMEMUSIC
  1654. RESUMEMUSIC
  1655. /**
  1656. * Resumes the present, playing MIDI or Enhanced Music file.
  1657. */ Example Use: !#!
  1658.  
  1659. /************************************************************************************************************/
  1660.  
  1661. void PlayMIDI(int MIDIid); ZASM Instruction:
  1662. PLAYMIDIR
  1663. PLAYMIDIV
  1664. /**
  1665. * Changes the current screen MIDI to MIDIid.
  1666. * Will revert to the DMap (or screen) MIDI upon leaving the screen.
  1667. */ Example Use: !#!
  1668.  
  1669. /************************************************************************************************************/
  1670.  
  1671. int GetMIDI(); ZASM Instruction:
  1672. GETMIDI
  1673. /**
  1674. * Returns the current screen MIDI that is playing.
  1675. * Positive numbers are for custom MIDIs, and negative values are used
  1676. * for the built-in game MIDIs.
  1677. */ Example Use: !#!
  1678.  
  1679. /************************************************************************************************************/
  1680.  
  1681. bool PlayEnhancedMusic(int filename[], int track);
  1682.  
  1683. ZASM Instruction:
  1684. PLAYENHMUSIC
  1685. /**
  1686. * Play the specified enhanced music if it's available. If the music
  1687. * cannot be played, the current music will continue. The music will
  1688. * revert to normal upon leaving the screen.
  1689. * Returns true if the music file was loaded successfully.
  1690. * The filename cannot be more than 255 characters. If the music format
  1691. * does not support multiple tracks, the track argument will be ignored.
  1692. */ Example Use:
  1693.  
  1694. int music[]="myfile.mp3"; // Make a string with the filename of the music to play.
  1695. if ( !Game->PlayEnhancedMusic(music, 1) ) Game->PlayMIDI(midi_id);
  1696.  
  1697. // Plays the enhanced music file 'myfle.mp3', track 1.
  1698. // If the file is mssing, the game will instead play
  1699. // the midi specified as midi_id.
  1700.  
  1701. /************************************************************************************************************/
  1702.  
  1703. void GetDMapMusicFilename(int dmap, int buf[]);
  1704.  
  1705. ZASM Instruction:
  1706. GETMUSICFILE
  1707. /**
  1708. * Load the filename of the given DMap's enhanced music into buf.
  1709. * buf should be at least 256 elements in size.
  1710. */ Example Use: !#!
  1711.  
  1712. /************************************************************************************************************/
  1713.  
  1714. int GetDMapMusicTrack(int dmap);
  1715.  
  1716. ZASM Instruction:
  1717. GETMUSICTRACK
  1718. /**
  1719. * Returns the given DMap's enhanced music track. This is valid but
  1720. * meaningless if the music format doesn't support multiple tracks.
  1721. */ Example Use: !#!
  1722.  
  1723. /************************************************************************************************************/
  1724.  
  1725. void SetDMapEnhancedMusic(int dmap, int filename[], int track);
  1726.  
  1727. ZASM Instruction:
  1728. SETDMAPENHMUSIC
  1729. /**
  1730. * Sets the specified DMap's enhanced music to the given filename and
  1731. * track number. If the music format does not support multiple tracks,
  1732. * the track argument will be ignored. The filename must not be more
  1733. * than 255 characters.
  1734. */ Example Use: !#!
  1735.  
  1736. /************************************************************************************************************/
  1737.  
  1738. int GetComboData(int map, int screen, int position);
  1739.  
  1740. ZASM Instruction:
  1741. COMBODDM
  1742. /**
  1743. * Grabs a particular combo reference from anywhere in the game
  1744. * world, based on map (NOT DMap), screen number, and position.
  1745. * Don't forget that the screen index should be in hexadecimal,
  1746. * and that maps are counted from 1 upwards.
  1747. * Position is considered an index, treated the same way as in
  1748. * Screen->ComboD[], with a legal range of 0 to 175.
  1749. */ Example Use: !#!
  1750.  
  1751. /************************************************************************************************************/
  1752.  
  1753. void SetComboData(int map, int screen, int position, int value);
  1754.  
  1755. ZASM Instruction:
  1756. COMBODDM
  1757. /**
  1758. * Sets a particular combo reference anywhere in the game world,
  1759. * based on map (NOT DMap), screen number, and position.
  1760. * Don't forget that the screen index should be in hexadecimal,
  1761. * and that maps are counted from 1 upwards.
  1762. * Position is considered an index, treated the same way as in
  1763. * Screen->ComboD[], with a legal range of 0 to 175.
  1764. */ Example Use: !#!
  1765.  
  1766. /************************************************************************************************************/
  1767.  
  1768. int GetComboCSet(int map, int screen, int position);
  1769.  
  1770. ZASM Instruction:
  1771. COMBOCDM
  1772. /**
  1773. * Grabs a particular combo's CSet from anywhere in the game
  1774. * world, based on map (NOT DMap), screen number, and position.
  1775. * Position is considered an index, treated the same way as in
  1776. * Screen->ComboC[], with a legal range of 0 to 175.
  1777. */ Example Use: !#!
  1778.  
  1779. /************************************************************************************************************/
  1780.  
  1781. void SetComboCSet(int map, int screen, int position, int value);
  1782.  
  1783. ZASM Instruction:
  1784. COMBOCDM
  1785. /**
  1786. * Sets a particular combo's CSet anywhere in the game world,
  1787. * based on map (NOT DMap), screen number, and position. Position
  1788. * is considered an index, treated the same way as in Screen->ComboC[]
  1789. * with a legal range of 0 to 175.
  1790. */ Example Use: !#!
  1791.  
  1792. /************************************************************************************************************/
  1793.  
  1794. int GetComboFlag(int map, int screen, int position);
  1795.  
  1796. ZASM Instruction:
  1797. COMBOFDM
  1798. /**
  1799. * Grabs a particular combo's placed flag from anywhere in the game
  1800. * world, based on map (NOT DMap), screen number, and position.
  1801. * Position is considered an index, treated the same way as in
  1802. * Screen->ComboF[], with a legal range of 0 to 175.
  1803. */ Example Use: !#!
  1804.  
  1805. /************************************************************************************************************/
  1806.  
  1807. void SetComboFlag(int map, int screen, int position, int value);
  1808.  
  1809. ZASM Instruction:
  1810. COMBOFDM
  1811. /**
  1812. * Sets a particular combo's placed flag anywhere in the game world,
  1813. * based on map (NOT DMap), screen number, and position. Position
  1814. * is considered an index, treated the same way as in Screen->ComboF[]
  1815. * with a legal range of 0 to 175.
  1816. */ Example Use: !#!
  1817.  
  1818. /************************************************************************************************************/
  1819.  
  1820. int GetComboType(int map, int screen, int position);
  1821.  
  1822. ZASM Instruction:
  1823. COMBOTDM
  1824. /**
  1825. * Grabs a particular combo's type from anywhere in the game
  1826. * world, based on map (NOT DMap), screen number, and position.
  1827. * Position is considered an index, treated the same way as in
  1828. * Screen->ComboT[]. Note that you are grabbing an actual combo
  1829. * attribute as referenced by the combo on screen you're
  1830. * referring to.
  1831. */ Example Use: !#!
  1832.  
  1833. /************************************************************************************************************/
  1834.  
  1835. void SetComboType(int map, int screen, int position, int value);
  1836.  
  1837. ZASM Instruction:
  1838. COMBOTDM
  1839. /**
  1840. * Sets a particular combo's type anywhere in the game world,
  1841. * based on map (NOT DMap), screen number, and position. Position
  1842. * is considered an index, treated the same way as in Screen->ComboT[].
  1843. * Note that you are grabbing an actual combo attribute as referenced
  1844. * by the combo on screen you're referring to, which means that
  1845. * setting this attribute will affect ALL references to this combo
  1846. * throughout the quest.
  1847. */ Example Use: !#!
  1848.  
  1849. /************************************************************************************************************/
  1850.  
  1851. int GetComboInherentFlag(int map, int screen, int position);
  1852.  
  1853. ZASM Instruction:
  1854. COMBOIDM
  1855. /**
  1856. * Grabs a particular combo's inherent flag from anywhere in the game
  1857. * world, based on map (NOT DMap), screen number, and position.
  1858. * Position is considered an index, treated the same way as in
  1859. * Screen->ComboI[]. Note that you are grabbing an actual combo
  1860. * attribute as referenced by the combo on screen you're
  1861. * referring to.
  1862. */ Example Use: !#!
  1863.  
  1864. /************************************************************************************************************/
  1865.  
  1866. void SetComboInherentFlag(int map, int screen, int position, int value);
  1867.  
  1868. ZASM Instruction:
  1869. COMBOIDM
  1870. /**
  1871. * Sets a particular combo's inherent flag anywhere in the game world,
  1872. * based on map (NOT DMap), screen number, and position. Position
  1873. * is considered an index, treated the same way as in Screen->ComboI[].
  1874. * Note that you are grabbing an actual combo attribute as referenced
  1875. * by the combo on screen you're referring to, which means that
  1876. * setting this attribute will affect ALL references to this combo
  1877. * throughout the quest.
  1878. */ Example Use: !#!
  1879.  
  1880. /************************************************************************************************************/
  1881.  
  1882. int GetComboSolid(int map, int screen, int position);
  1883.  
  1884. ZASM Instruction:
  1885. COMBOSDM
  1886. /**
  1887. * Grabs a particular combo's solidity flag from anywhere in the game
  1888. * world, based on map (NOT DMap), screen number, and position.
  1889. * Position is considered an index, treated the same way as in
  1890. * Screen->ComboS[]. Note that you are grabbing an actual combo
  1891. * attribute as referenced by the combo on screen you're
  1892. * referring to.
  1893. */ Example Use: !#!
  1894.  
  1895. /************************************************************************************************************/
  1896.  
  1897. void SetComboSolid(int map, int screen, int position, int value);
  1898.  
  1899. ZASM Instruction:
  1900. COMBOSDM
  1901. /**
  1902. * Sets a particular combo's solidity anywhere in the game world,
  1903. * based on map (NOT DMap), screen number, and position. Position
  1904. * is considered an index, treated the same way as in Screen->ComboS[].
  1905. * Note that you are grabbing an actual combo attribute as referenced
  1906. * by the combo on screen you're referring to, which means that
  1907. * setting this attribute will affect ALL references to this combo
  1908. * throughout the quest.
  1909. */ Example Use: !#!
  1910.  
  1911. /************************************************************************************************************/
  1912.  
  1913. int ComboTile(int combo); ZASM Instruction:
  1914. COMBOTILE
  1915. /**
  1916. * Returns the tile used by combo 'combo'
  1917. */ Example Use: !#!
  1918.  
  1919. /************************************************************************************************************/
  1920.  
  1921. void GetSaveName(int buffer[]);
  1922.  
  1923. ZASM Instruction:
  1924. GETSAVENAME
  1925. /**
  1926. * Loads the current save file's name into 'buffer'
  1927. * Buffer should be at least 9 elements long
  1928. */ Example Use: !#!
  1929.  
  1930. /************************************************************************************************************/
  1931.  
  1932. void SetSaveName(int name[]);
  1933.  
  1934. ZASM Instruction:
  1935. SETSAVENAME
  1936. /**
  1937. * Sets the current file's save name to 'name'
  1938. * Buffer should be no more than 9 elements
  1939. */ Example Use: !#!
  1940.  
  1941. /************************************************************************************************************/
  1942.  
  1943. void End(); ZASM Instruction:
  1944. GAMEEND
  1945. /**
  1946. * IMMEDIATELY ends the current game and returns to the file select screen
  1947. */ Example Use: !#!
  1948.  
  1949. /************************************************************************************************************/
  1950.  
  1951. void Save(); ZASM Instruction:
  1952. GAMESAVE
  1953. /**
  1954. * Saves the current game
  1955. */ Example Use: !#!
  1956.  
  1957. /************************************************************************************************************/
  1958.  
  1959. bool ShowSaveScreen(); ZASM Instruction:
  1960. SAVESCREEN
  1961. /**
  1962. * Displays the save screen. Returns true if the user chose to save, false otherwise.
  1963. */ Example Use: !#!
  1964.  
  1965. /************************************************************************************************************/
  1966.  
  1967. void ShowSaveQuitScreen(); ZASM Instruction:
  1968. SAVEQUITSCREEN
  1969. /**
  1970. * Displays the save and quit screen.
  1971. */ Example Use: !#!
  1972.  
  1973. /************************************************************************************************************/
  1974.  
  1975. void GetMessage(int string, int buffer[]);
  1976.  
  1977. ZASM Instruction:
  1978. GETMESSAGE
  1979. /**
  1980. * Loads 'string' into 'buffer'. Use the function from std.zh
  1981. * or use string.zh to remove trailing ' ' characters whilst loading.
  1982. */ Example Use: !#!
  1983.  
  1984. /************************************************************************************************************/
  1985.  
  1986. void SetMessage(int message, int buffer[]);
  1987.  
  1988. ZASM Instruction:
  1989. SETMESSAGE
  1990. /**
  1991. * Loads string 'buffer[]' into ZQ Message 'message'.
  1992. */ Example Use: !#!
  1993.  
  1994. /************************************************************************************************************/
  1995.  
  1996. int GetFFCScript(int name[]); ZASM Instruction:
  1997. GETFFCSCRIPT
  1998. /**
  1999. * Returns the number of the script with the given name or -1 if there is
  2000. * no such script. The script name should be passed as a string.
  2001. * (!) This was added around 2.50.0 RC4. Earlier beta versions will not be able to perform this function.
  2002. */ Example Use: !#!
  2003.  
  2004. /************************************************************************************************************/
  2005.  
  2006. bool ClickToFreezeEnabled; ZASM Instruction:
  2007. GAMECLICKFREEZE
  2008. /**
  2009. * If this is false, the "Click to Freeze" setting will not function, ensuring
  2010. * that the script can use the mouse freely. This overrides the setting rather
  2011. * than changing it, so remembering and restoring the initial value is unnecessary.
  2012. */ Example Use: !#!
  2013.  
  2014. /************************************************************************************************************/
  2015. DEBUGGING: These might find their way into namespace Debug->
  2016. /************************************************************************************************************/
  2017.  
  2018. int RefFFC; ZASM Instruction:
  2019. REFFFC
  2020. /**
  2021. * Returns the present ffc refrence from the stack. FOR DEBUGGING ONLY!
  2022. * THIS WILL BE DISABLED IN RELEASE BUILDS !
  2023. */ Example Use:
  2024.  
  2025. /************************************************************************************************************/
  2026.  
  2027. int RefItem; ZASM Instruction:
  2028. REFITEM
  2029. /**
  2030. * Returns the present item refrence from the stack. FOR DEBUGGING ONLY!
  2031. * THIS WILL BE DISABLED IN RELEASE BUILDS !
  2032. */ Example Use:
  2033.  
  2034. /************************************************************************************************************/
  2035.  
  2036. int RefItemdata; ZASM Instruction:
  2037. REFIDATA
  2038. /**
  2039. * Returns the present itemdata refrence from the stack. FOR DEBUGGING ONLY!
  2040. * THIS WILL BE DISABLED IN RELEASE BUILDS !
  2041. */ Example Use:
  2042.  
  2043. /************************************************************************************************************/
  2044.  
  2045. int RefLWeapon; ZASM Instruction:
  2046. REFLWPN
  2047. /**
  2048. * Returns the present lweapon refrence from the stack. FOR DEBUGGING ONLY!
  2049. * THIS WILL BE DISABLED IN RELEASE BUILDS !
  2050. */ Example Use:
  2051.  
  2052. /************************************************************************************************************/
  2053.  
  2054. int RefEWeapon; ZASM Instruction:
  2055. REFEWPN
  2056. /**
  2057. * Returns the present eweapon refrence from the stack. FOR DEBUGGING ONLY!
  2058. * THIS WILL BE DISABLED IN RELEASE BUILDS !
  2059. */ Example Use:
  2060.  
  2061. /************************************************************************************************************/
  2062.  
  2063. int RefNPC; ZASM Instruction:
  2064. REFNPC
  2065. /**
  2066. * Returns the present npc refrence from the stack. FOR DEBUGGING ONLY!
  2067. * THIS WILL BE DISABLED IN RELEASE BUILDS !
  2068. */ Example Use:
  2069.  
  2070. /************************************************************************************************************/
  2071.  
  2072. int SP; ZASM Instruction:
  2073. SP
  2074. /**
  2075. * Returns the value of the stack pointer. FOR DEBUGGING ONLY!
  2076. * THIS WILL BE DISABLED IN RELEASE BUILDS !
  2077. */ Example Use:
  2078. /************************************************************************************************************/
  2079.  
  2080. //======================================
  2081. //--- Screen Functions and Variables ---
  2082. //======================================
  2083.  
  2084. namespace Screen
  2085.  
  2086. float D[]; ZASM Instruction:
  2087. SD
  2088. SDD
  2089.  
  2090.  
  2091. /**
  2092. * Each screen has 8 general purpose registers for use by script
  2093. * programmers. These values are recorded in the save file when the
  2094. * player saves their game. Do with these as you will.
  2095. * Note that these registers are tied to screen/DMap combinations.
  2096. * Encountering the same screen in a different DMap will result in a
  2097. * different D[] array.
  2098. *
  2099. * Values in Screen->D are preserved through game saving.
  2100. *
  2101. */ Example Use: !#!
  2102.  
  2103. /************************************************************************************************************/
  2104.  
  2105. int Flags[]; ZASM Instruction:
  2106. SCREENFLAGSD
  2107. SCREENFLAGS
  2108.  
  2109. /**
  2110. * An array of ten integers containing the states of the flags in the
  2111. * 10 categories on the Screen Data tabs 1 and 2. Each flag is ORed into the
  2112. * Flags[x] value, starting with the top flag as the smallest bit.
  2113. * Use the SF_ constants as the array acces for this value, and the
  2114. * GetScreenFlags function if you are not comfortable with binary.
  2115. * This is read-only; while setting it is not syntactically incorrect, it does nothing.
  2116. *
  2117. */ Example Use: !#!
  2118.  
  2119. /************************************************************************************************************/
  2120.  
  2121. int EFlags[]; ZASM Instruction:
  2122. SCREENEFLAGSD
  2123. SCREENEFLAGS
  2124.  
  2125. /**
  2126. * An array of 3 integers containing the states of the flags in the
  2127. * E.Flags tab of the Screen Data dialog. Each flag is ORed into the
  2128. * EFlags[x] value, starting with the top flag as the smallest bit.
  2129. * Use the SEF_ constants as the array acces for this value, and the
  2130. * GetScreenEFlags function if you are not comfortable with binary.
  2131. * This is read-only; while setting it is not syntactically incorrect, it does nothing.
  2132. *
  2133. */ Example Use: !#!
  2134.  
  2135. /************************************************************************************************************/
  2136.  
  2137. int ComboD[]; ZASM Instruction:
  2138. CD### COMBOD
  2139. COMBODD COMBODDM
  2140. COMBODDM COMBOSD
  2141.  
  2142. /**
  2143. * The combo ID of the ith combo on the screen, where i is the index
  2144. * used to access this array. Combos are counted left to right, top to
  2145. * bottom.
  2146. * Screen dimensions are 16 combos wide, by 11 combos high.
  2147. *
  2148. */ Example Use: !#!
  2149.  
  2150. /************************************************************************************************************/
  2151.  
  2152. int ComboC[]; ZASM Instruction:
  2153. CC### COMBOC
  2154. COMBOCD COMBOCDM
  2155.  
  2156. /**
  2157. * The CSet of the tile used by the ith combo on the screen, where i is
  2158. * the index used to access this array. Combos are counted left to right,
  2159. * top to bottom.
  2160. * Screen dimensions are 16 combos wide, by 11 combos high.
  2161. *
  2162. */ Example Use: !#!
  2163.  
  2164. /************************************************************************************************************/
  2165.  
  2166. int ComboF[]; ZASM Instruction:
  2167. CF### COMBOF
  2168. COMBOFD COMBOFDM
  2169.  
  2170. /**
  2171. * The placed flag of the ith combo on the screen, where i is the index
  2172. * used to access this array. Combos are counted left to right, top to
  2173. * bottom. Use the CF_ constants in std.zh to set or compare these values.
  2174. * Screen dimensions are 16 combos wide, by 11 combos high.
  2175. *
  2176. */ Example Use: !#!
  2177.  
  2178. /************************************************************************************************************/
  2179.  
  2180. int ComboI[]; ZASM Instruction:
  2181. CI### COMBOID
  2182. COMBOIDM
  2183.  
  2184.  
  2185. /**
  2186. * The inherent flag of the ith combo on the screen, where i is the index
  2187. * used to access this array. Combos are counted left to right, top to
  2188. * bottom. Use the CF_ constants in std.zh to set or compare these values.
  2189. * Screen dimensions are 16 combos wide, by 11 combos high.
  2190. *
  2191. */ Example Use: !#!
  2192.  
  2193. /************************************************************************************************************/
  2194.  
  2195. int ComboT[]; ZASM Instruction:
  2196. CT### COMBOTD
  2197. COMBOTDM
  2198.  
  2199.  
  2200. /**
  2201. * The combo type of the ith combo on the screen, where i is the index
  2202. * used to access this array. Combos are counted left to right, top to
  2203. * bottom. Use the CT_ constants in std.zh to set or compare these values.
  2204. * Screen dimensions are 16 combos wide, by 11 combos high.
  2205. *
  2206. */ Example Use: !#!
  2207.  
  2208. /************************************************************************************************************/
  2209.  
  2210. int ComboS[]; ZASM Instruction:
  2211. CS### COMBOSD
  2212. COMBOSDM
  2213.  
  2214.  
  2215. /**
  2216. * The walkability mask of the ith combo on the screen, where i is the
  2217. * index used to access this array. Combos are counted left to right, top
  2218. * to bottom. The least signficant bit is true if the top-left of the combo
  2219. * is solid, the second-least signficant bit is true if the bottom-left
  2220. * of the combo is is solid, the third-least significant bit is true if the
  2221. * top-right of the combo is solid, and the fourth-least significant bit is
  2222. * true if the bottom-right of the combo is solid.
  2223. * Screen dimensions are 16 combos wide, by 11 combos high.
  2224. *
  2225. */ Example Use: !#!
  2226.  
  2227. /************************************************************************************************************/
  2228.  
  2229. int MovingBlockX; ZASM Instruction:
  2230. PUSHBLOCKX
  2231.  
  2232.  
  2233. /**
  2234. * The X position of the current moving block. If there is no moving block
  2235. * on the screen, it will be -1. This is read-only; while setting it is not
  2236. * syntactically incorrect, it does nothing.
  2237. *
  2238. */ Example Use: !#!
  2239.  
  2240. /************************************************************************************************************/
  2241.  
  2242. int MovingBlockY; ZASM Instruction:
  2243. PUSHBLOCKY
  2244.  
  2245. /**
  2246. * The Y position of the current moving block. If there is no moving block
  2247. * on the screen, it will be -1. This is read-only; while setting it is not
  2248. * syntactically incorrect, it does nothing.
  2249. *
  2250. */ Example Use: !#!
  2251.  
  2252. /************************************************************************************************************/
  2253.  
  2254. int MovingBlockCombo; ZASM Instruction:
  2255. PUSHBLOCKCOMBO
  2256.  
  2257. /**
  2258. * The combo used by moving block. If there is no block moving, the value
  2259. * is undefined.
  2260. *
  2261. */ Example Use: !#!
  2262.  
  2263. /************************************************************************************************************/
  2264.  
  2265. int MovingBlockCSet; ZASM Instruction:
  2266. PUSHBLOCKCSET
  2267.  
  2268. /**
  2269. * The CSet used by moving block. If there is no block moving, the value
  2270. * is undefined.
  2271. *
  2272. */ Example Use: !#!
  2273.  
  2274. /************************************************************************************************************/
  2275.  
  2276. int UnderCombo; ZASM Instruction:
  2277. UNDERCOMBO
  2278.  
  2279. /**
  2280. * The current screen's under combo.
  2281. * !#! Is setting this legal?
  2282. *
  2283. */ Example Use: !#!
  2284.  
  2285. /************************************************************************************************************/
  2286.  
  2287. int UnderCSet; ZASM Instruction:
  2288. UNDERCSET
  2289.  
  2290. /**
  2291. * The current screen's under CSet.
  2292. * !#! Is setting this legal?
  2293. *
  2294. */ Example Use: !#!
  2295.  
  2296. /************************************************************************************************************/
  2297.  
  2298. bool State[]; ZASM Instruction:
  2299. SCREENSTATED
  2300.  
  2301. /**
  2302. * An array of miscellaneous status data associated with the current
  2303. * screen.
  2304. * Screen states involve such things as permanent screen secrets, the
  2305. * status of lock blocks and treasure chest combos, and whether items have
  2306. * been collected.
  2307. * These values are recorded in the save file when the player saves their
  2308. * game. Use the ST_ constants in std.zh as indices into this array.
  2309. *
  2310. */ Example Use: !#!
  2311.  
  2312. /************************************************************************************************************/
  2313.  
  2314. int Door[]; ZASM Instruction:
  2315. SCRDOORD
  2316. SCRDOOR
  2317.  
  2318. /**
  2319. * The door type for each of the four doors on a screen. Doors are counted
  2320. * using the first four DIR_ constants in std.zh. Use the D_ constants in
  2321. * std.zh to compare these values.
  2322. *
  2323. */ Example Use: !#!
  2324.  
  2325. /************************************************************************************************************/
  2326.  
  2327. int RoomType; ZASM Instruction:
  2328. ROOMTYPE
  2329.  
  2330. /**
  2331. * The type of room this screen is (Special Item, Bomb Upgrade, etc)
  2332. * This is currently read-only.
  2333. * Use the RT_* constants in std.zh
  2334. *
  2335. */ Example Use: !#!
  2336.  
  2337. /************************************************************************************************************/
  2338.  
  2339. int RoomData; ZASM Instruction:
  2340. ROOMDATA
  2341.  
  2342. /**
  2343. * This is the data associated with the room type above. What it means depends
  2344. * on the room type. For Special Item, it will be the item ID, for a Shop, it
  2345. * will be the Shop Number, etc.
  2346. * Basically, this is what's in the "Catch-all" menu item underneath Room Type.
  2347. * If the room type has no data (eg, Ganon's room), this will be undefined.
  2348. *
  2349. */ Example Use: !#!
  2350.  
  2351. /************************************************************************************************************/
  2352.  
  2353. void TriggerSecrets(); ZASM Instruction:
  2354. SECRETS ? !#!
  2355.  
  2356. /**
  2357. * Triggers screen secrets temporarily. Set Screen->State[ST_SECRET]
  2358. * to true beforehand or afterward if you would like them to remain
  2359. * permanent.
  2360. *
  2361. */ Example Use: Screen->TriggerSecrets();
  2362.  
  2363.  
  2364. /************************************************************************************************************/
  2365.  
  2366. void WavyIn(); ZASM Instruction:
  2367. WAVYIN
  2368.  
  2369. /**
  2370. * Replicates the warping screen wave effect (inbound) from a tile warp.
  2371. *
  2372. */ Example Use: !#!
  2373.  
  2374. /************************************************************************************************************/
  2375.  
  2376. void WavyOut(); ZASM Instruction:
  2377. WAVYOUT
  2378.  
  2379. /**
  2380. * Replicates the warping screen wave effect (outbound) from a tile warp.
  2381. *
  2382. */ Example Use: !#!
  2383.  
  2384. /************************************************************************************************************/
  2385.  
  2386. void ZapIn(); ZASM Instruction:
  2387. ZAPIN
  2388.  
  2389. /**
  2390. * Replicates the warping screen zap effect (inbound) from a tile warp.
  2391. *
  2392. */ Example Use: !#!
  2393.  
  2394. /************************************************************************************************************/
  2395.  
  2396. void ZapOut(); ZASM Instruction:
  2397. ZAPOUT
  2398.  
  2399. /**
  2400. * Replicates the warping screen zap effect (outbound) from a tile warp.
  2401. *
  2402. */ Example Use: !#!
  2403.  
  2404. /************************************************************************************************************/
  2405.  
  2406. void OpeningWipe(); ZASM Instruction:
  2407. OPENWIPE
  2408.  
  2409. /**
  2410. * Replicates the opening wipe screen effect (using the quest rule for its type) from a tile warp.
  2411. *
  2412. */ Example Use: !#!
  2413.  
  2414. /************************************************************************************************************/
  2415.  
  2416. bool Lit; ZASM Instruction:
  2417. LIT
  2418.  
  2419. /**
  2420. * Whether or not the screen is lit. Setting this variable will change the
  2421. * lighting setting of the screen until you change screens.
  2422. *
  2423. */ Example Use: !#!
  2424.  
  2425.  
  2426. /************************************************************************************************************/
  2427.  
  2428. int Wavy; ZASM Instruction:
  2429. WAVY
  2430.  
  2431. /**
  2432. * The time, in frames, that the 'wave' screen effect will be in effect.
  2433. * This value is decremented once per frame. As the value of Wavy approaches 0,
  2434. * the intensity of the waves decreases.
  2435. *
  2436. */ Example Use: !#!
  2437.  
  2438. /************************************************************************************************************/
  2439.  
  2440. int Quake; ZASM Instruction:
  2441. QUAKE
  2442.  
  2443. /**
  2444. * The time, in frames, that the screen will shake. This value is decremented
  2445. * once per frame. As the value of Quake approaches 0, the intensity of the
  2446. * screen shaking decreases.
  2447. *
  2448. */ Example Use: !#!
  2449.  
  2450. /************************************************************************************************************/
  2451.  
  2452. void SetSideWarp(int warp, int screen, int dmap, int type); ZASM Instruction:
  2453. SETSIDEWARP
  2454.  
  2455. /**
  2456. * Sets the current screen's side warp 'warp' to the destination screen,
  2457. * DMap and type. If any of the parameters screen, dmap or type are equal
  2458. * to -1, they will remain unchanged. If warp is not between 0 and 3, the
  2459. * function does nothing.
  2460.  
  2461. * Directions match DIR_* in std_constants.zh
  2462. * Use constants SIDEWARP_* in std_constants.zh
  2463. *
  2464. */ Example Use: !#!
  2465.  
  2466. /************************************************************************************************************/
  2467.  
  2468. void SetTileWarp(int warp, int screen, int dmap, int type); ZASM Instruction:
  2469. SETTILEWARP
  2470.  
  2471. /**
  2472. * Sets the current screen's tile warp 'warp' to the destination screen,
  2473. * DMap and type. If any of the parameters screen, dmap or type are equal
  2474. * to -1, they will remain unchanged. If warp is not between 0 and 3, the
  2475. * function does nothing
  2476. *
  2477. * Warp-Tiles A, B, C, and D are 0, 1, 2, and 3 respectively.
  2478. * Use constants TILEWARP_* in std_constants.zh
  2479. *
  2480. */ Example Use: !#!
  2481.  
  2482. /************************************************************************************************************/
  2483.  
  2484. int GetSideWarpDMap(int warp); ZASM Instruction:
  2485. GETSIDEWARPDMAP
  2486.  
  2487. /**
  2488. * Returns the destination DMap of the given side warp on the current screen.
  2489. * Returns -1 if warp is not between 0 and 3.
  2490. *
  2491. * Side-Warp Directions match DIR_* in std_constants.zh
  2492. * Use constants SIDEWARP_* in std_constants.zh
  2493. *
  2494. */ Example Use: !#!
  2495.  
  2496. /************************************************************************************************************/
  2497.  
  2498. int GetSideWarpScreen(int warp); ZASM Instruction:
  2499. GETSIDEWARPSCR
  2500.  
  2501. /**
  2502. * Returns the destination screen of the given side warp on the current
  2503. * screen. Returns -1 if warp is not between 0 and 3.
  2504. *
  2505. * Directions match DIR_* in std_constants.zh
  2506. * Use constants SIDEWARP_* in std_constants.zh
  2507. *
  2508. */ Example Use: !#!
  2509.  
  2510. /************************************************************************************************************/
  2511.  
  2512. int GetSideWarpType(int warp); ZASM Instruction:
  2513. GETSIDEWARPTYPE
  2514.  
  2515. /**
  2516. * Returns the warp type of the given side warp on the current screen.
  2517. * Returns -1 if warp is not between 0 and 3.
  2518. *
  2519. * Directions match DIR_* in std_constants.zh
  2520. * Use constants SIDEWARP_* in std_constants.zh
  2521. *
  2522. */ Example Use: !#!
  2523.  
  2524. /************************************************************************************************************/
  2525.  
  2526. int GetTileWarpDMap(int warp); ZASM Instruction:
  2527. GETTILEWARPDMAP
  2528.  
  2529. /**
  2530. * Returns the destination DMap of the given tile warp on the current screen.
  2531. * Returns -1 if warp is not between 0 and 3.
  2532. *
  2533. * Warp-Tiles A, B, C, and D are 0, 1, 2, and 3 respectively.
  2534. * Use constants TILEWARP_* in std_constants.zh
  2535. *
  2536. */ Example Use: !#!
  2537.  
  2538. /************************************************************************************************************/
  2539.  
  2540. int GetTileWarpScreen(int warp); ZASM Instruction:
  2541. GETTILEWARPSCR
  2542.  
  2543. /**
  2544. * Returns the destination screen of the given tile warp on the current
  2545. * screen. Returns -1 if warp is not between 0 and 3.
  2546. *
  2547. * Warp-Tiles A, B, C, and D are 0, 1, 2, and 3 respectively.
  2548. * Use constants TILEWARP_* in std_constants.zh
  2549. *
  2550. */ Example Use: !#!
  2551.  
  2552. /************************************************************************************************************/
  2553.  
  2554. int GetTileWarpType(int warp); ZASM Instruction:
  2555. GETTILEWARPTYPE
  2556.  
  2557. /**
  2558. * Returns the warp type of the given tile warp on the current screen.
  2559. * Returns -1 if warp is not between 0 and 3.
  2560. *
  2561. * Warp-Tiles A, B, C, and D are 0, 1, 2, and 3 respectively.
  2562. * Use constants TILEWARP_* in std_constants.zh
  2563. *
  2564. */ Example Use: !#!
  2565.  
  2566. /************************************************************************************************************/
  2567.  
  2568. int LayerMap(int n); ZASM Instruction:
  2569. LAYERMAP
  2570.  
  2571. /**
  2572. * Returns the map of the screen currently being used as the nth layer.
  2573. * Values of n less than 1 or greater than 6, or layers that are not set up,
  2574. * returns -1.
  2575. *
  2576. */ Example Use: !#!
  2577.  
  2578. /************************************************************************************************************/
  2579.  
  2580. int LayerScreen(int n); ZASM Instruction:
  2581. LAYERSCREEN
  2582.  
  2583. /**
  2584. * Returns the number of the screen currently being used as the nth layer.
  2585. * Values of n less than 1 or greater than 6, or layers that are not set up,
  2586. * returns -1.
  2587. *
  2588. */ Example Use: !#!
  2589.  
  2590. /************************************************************************************************************/
  2591.  
  2592. int NumItems(); ZASM Instruction:
  2593. ITEMCOUNT
  2594.  
  2595. /**
  2596. * Returns the number of items currently present on the screen. Screen
  2597. * items, shop items, and items dropped by enemies are counted; Link's
  2598. * weapons, such as lit bombs, or enemy weapons are not counted.
  2599. * Note that this value is only correct up until the next call to
  2600. * Waitframe().
  2601. *
  2602. */ Example Use: !#!
  2603.  
  2604. /************************************************************************************************************/
  2605.  
  2606. item LoadItem(int num); ZASM Instruction:
  2607. LOADITEMR
  2608. LOADITEMV
  2609.  
  2610. /**
  2611. * Returns a pointer to the numth item on the current screen. The return
  2612. * value is undefined unless 1 <= num <= NumItems().
  2613. *
  2614. * Attempting to return an invalid item pointer will print an error to allegro.log.
  2615. *
  2616. */ Example Use: !#!
  2617.  
  2618. /************************************************************************************************************/
  2619.  
  2620. item CreateItem(int id); ZASM Instruction:
  2621. CREATEITEMV
  2622. CREATEITEMR
  2623.  
  2624. /**
  2625. * Returns a pointer to the numth FFC on the current screen. The return
  2626. * value is undefined unless 1 <= num <= ffcs, where ffcs is the number
  2627. * of FFCs active on the screen.
  2628. *
  2629. */ Example Use: !#!
  2630.  
  2631. /************************************************************************************************************/
  2632.  
  2633. ffc LoadFFC(int num); ZASM Instruction:
  2634. GETFFCSCRIPT
  2635.  
  2636. /**
  2637. * Returns a pointer to the numth FFC on the current screen. The return
  2638. * value is undefined unless 1 <= num <= ffcs, where ffcs is the number
  2639. * of FFCs active on the screen.
  2640. *
  2641. */ Example Use: !#!
  2642.  
  2643. /************************************************************************************************************/
  2644.  
  2645. int NumNPCs(); ZASM Instruction:
  2646. NPCCOUNT
  2647.  
  2648. /**
  2649. * Returns the number of NPCs (enemies and guys) on the screen.
  2650. * Note that this value is only correct up until the next call to
  2651. * Waitframe().
  2652. *
  2653. */ Example Use: !#!
  2654.  
  2655. /************************************************************************************************************/
  2656.  
  2657. npc LoadNPC(int num); ZASM Instruction:
  2658. LOADNPCR
  2659. LOADNPCV
  2660.  
  2661. /**
  2662. * Returns a pointer to the numth NPC on the current screen. The return
  2663. * value is undefined unless 1 <= num <= NumNPCs().
  2664. *
  2665. */ Example Use: !#!
  2666.  
  2667. /************************************************************************************************************/
  2668.  
  2669. npc CreateNPC(int id); ZASM Instruction:
  2670. CREATENPCR
  2671. CREATENPCV
  2672.  
  2673. /**
  2674. * Creates an npc of the given type at (0,0). Use the NPC_ constants in
  2675. * std.zh to pass into this method. The return value is a pointer to the
  2676. * new NPC.
  2677. * The maximum number of NPCs on any given screen is 255. ZC will report an
  2678. * error to allegro.log if you try to create NPCs after reaching that maximum.
  2679. *
  2680. */ Example Use: !#!
  2681.  
  2682. /************************************************************************************************************/
  2683.  
  2684. int NumLWeapons(); ZASM Instruction:
  2685. LWPNCOUNT
  2686.  
  2687. /**
  2688. * Returns the number of Link weapon projectiles currently present on the screen.
  2689. * This includes things like Link's arrows, bombs, magic, etc. Note that this
  2690. * value is only correct up until the next call of Waitframe().
  2691. *
  2692. */ Example Use: !#!
  2693.  
  2694. /************************************************************************************************************/
  2695.  
  2696. lweapon LoadLWeapon(int num); ZASM Instruction:
  2697. LOADLWEAPONR
  2698. LOADLWEAPONV
  2699.  
  2700. /**
  2701. * Returns a pointer to the num-th lweapon on the current screen. The return
  2702. * value is undefined unless 1 <= num <= NumLWeapons().
  2703. *
  2704. */ Example Use: !#!
  2705.  
  2706. /************************************************************************************************************/
  2707.  
  2708. lweapon CreateLWeapon(int type); ZASM Instruction:
  2709. CREATELWEAPONR
  2710. CREATELWEAPONV
  2711.  
  2712. /**
  2713. * Creates an lweapon of the given type at (0,0). Use the LW_ constants in
  2714. * std.zh to pass into this method. The return value is a pointer to the
  2715. * new lweapon.
  2716. * The maximum number of lweapons on any given screen is 255. ZC will NOT report an
  2717. * error to allegro.log if you try to create lweapons after reaching that maximum.
  2718. * The maximum instances for lweapons, and eweapons are independent.
  2719. * This cap is of *all* lweapons, of any type. Mixing types will not increase this cap.
  2720. *
  2721. */ Example Use: !#!
  2722.  
  2723. /************************************************************************************************************/
  2724.  
  2725. lweapon CreateLWeaponDx(int type, int baseitem)
  2726. ZASM Instruction
  2727. CREATELWEAPONDX
  2728.  
  2729. /**
  2730. *
  2731. * Creates an lweapon with the type 'type', using data as if the weapon was created
  2732. * by using the item 'item_id', thus forwarding sprites, sounds, and other values.
  2733. *
  2734. *
  2735. * /
  2736.  
  2737. /************************************************************************************************************/
  2738.  
  2739. int NumEWeapons(); ZASM Instruction:
  2740. EWPNCOUNT
  2741.  
  2742. /**
  2743. * Returns the number of Enemy weapon projectiles currently present on the screen.
  2744. * This includes things like Enemy arrows, bombs, magic, etc. Note that this
  2745. * value is only correct up until the next call of Waitframe().
  2746. *
  2747. */ Example Use: !#!
  2748.  
  2749. /************************************************************************************************************/
  2750.  
  2751. eweapon LoadEWeapon(int num); ZASM Instruction:
  2752. LOADEWEAPONR
  2753. LOADEWEAPONV
  2754.  
  2755. /**
  2756. * Returns a pointer to the numth eweapon on the current screen. The return
  2757. * value is undefined unless 1 <= num <= NumEWeapons().
  2758. *
  2759. */ Example Use: !#!
  2760.  
  2761. /************************************************************************************************************/
  2762.  
  2763. eweapon CreateEWeapon(int type); ZASM Instruction:
  2764. CREATEEWEAPONR
  2765. CREATEEWEAPONV
  2766.  
  2767. /**
  2768. * Creates an eweapon of the given type at (0,0). Use the EW_ constants in
  2769. * std.zh to pass into this method. The return value is a pointer to the
  2770. * new lweapon.
  2771. * The maximum number of eweapons on any given screen is 255. ZC will NOT report an
  2772. * error to allegro.log if you try to create eweapons after reaching that maximum.
  2773. * The maximum instances for eweapons, and lweapons are independent.
  2774. * This cap is of *all* eweapons, of any type. Mixing types will not increase this cap.
  2775. *
  2776. */ Example Use: !#!
  2777.  
  2778. /************************************************************************************************************/
  2779.  
  2780. bool isSolid(int x, int y); ZASM Instruction:
  2781. ISSOLID
  2782.  
  2783. /**
  2784. * Returns true if the screen position (x, y) is solid - that is, if it
  2785. * is within the solid portion of a combo on layers 0, 1 or 2. If either
  2786. * x or y exceed the screen's bounds, then it will return false.
  2787. * It will also return false if the only applicable solid combo is a solid
  2788. * water combo that has recently been 'dried' by the whistle.
  2789. *
  2790. */ Example Use: !#!
  2791.  
  2792. /************************************************************************************************************/
  2793.  
  2794. void ClearSprites(int spritelist); ZASM Instruction:
  2795. CLEARSPRITESR
  2796. CLEARSPRITESV
  2797.  
  2798. /**
  2799. * Clears all of a certain kind of sprite from the screen. Use the SL_
  2800. * constants in std.zh to pass into this method.
  2801. *
  2802. */ Example Use: !#!
  2803.  
  2804. /************************************************************************************************************/
  2805.  
  2806. void Message(int string);
  2807.  
  2808. ZASM Instruction:
  2809. MSGSTRR
  2810. MSGSTRV
  2811. /**
  2812. * Prints the message string with given ID onto the screen.
  2813. * If string is 0, the currently displayed message is removed.
  2814. * This method's behavior is undefined if string is less than 0
  2815. * or greater than the total number of messages in the quest.
  2816. */ Example Use: !#!
  2817.  
  2818. /************************************************************************************************************/
  2819.  
  2820. //===============================//
  2821. // SCRIPT DRAWING COMMANDS //
  2822. //===============================//
  2823.  
  2824. /* These commands use the Allegro 4 drawing primitives to render drawn
  2825. effects directly to the screen. You may draw to the screen immediately
  2826. which is considered RT_SCREEN (see: Render Targets), or you may change
  2827. to another render target (1 through 5) and issue your drawing commands,
  2828. then render that back to the screen.
  2829.  
  2830. All render targets have eight valid layers, 0 through 7.
  2831. Drawing colour 0 to a layer of a bitmap render target erases a section of that,
  2832. creating a transparent area on that layer. Any transparent area that extends
  2833. through all layers will be drawn as transparent when rendered back to the screen
  2834. if 'bool mask' is set true.
  2835.  
  2836. Drawing colour 0 directly to a screen layer is undefined.
  2837.  
  2838. Please note: For all draw primitives, if the quest rule 'Subscreen Appears
  2839. Above Sprites' is set,passing the layer argument as 7 will allow drawing
  2840. on top of the subscreen.
  2841.  
  2842. Tha maximum number of script drawing instructions per frame is 1000.
  2843.  
  2844.  
  2845.  
  2846. void Rectangle( int layer, int x, int y, int x2, int y2,
  2847. int color, float scale,
  2848. int rx, int ry, int rangle,
  2849. bool fill, int opacity );
  2850.  
  2851. ZASM Instruction:
  2852. RECTR
  2853. RECT
  2854.  
  2855. /**
  2856. * Draws a rectangle on the specified layer of the current screen, using args to set its properties:
  2857. *
  2858. * METRICS
  2859. * (x,y) as the top-left corner and (x2,y2) as the bottom-right corner.
  2860. *
  2861. * COLOUR
  2862. *
  2863. * SCALE AND ROTATION
  2864. *
  2865. * FILL AND OPACITY
  2866. *
  2867. * Then scales the rectangle uniformly about its center by the given
  2868. * factor.
  2869. * Lastly, a rotation, centered about the point (rx, ry), is performed
  2870. * counterclockwise using an angle of rangle degrees.
  2871. * A filled rectangle is drawn if fill is true; otherwise, this method
  2872. * draws a wireframe.
  2873. * The rectangle is drawn using the specified index into the entire
  2874. * 256-element palette: for instance, passing in a color of 17 would
  2875. * use color 1 of cset 1.
  2876. * Opacity controls how transparent the rectangle will be.
  2877. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2878. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2879. * as translucent (OP_TRANS, or 64).
  2880. *
  2881. */ Example Use: !#!
  2882.  
  2883. /************************************************************************************************************/
  2884.  
  2885. void Circle( int layer, int x, int y, int radius,
  2886. int color, float scale,
  2887. int rx, int ry, int rangle,
  2888. bool fill, int opacity );
  2889.  
  2890.  
  2891. ZASM Instruction:
  2892. CIRCLE
  2893. CIRCLER
  2894.  
  2895. /**
  2896. * Draws a circle on the specified layer of the current screen with
  2897. * center (x,y) and radius scale*radius.
  2898. * Then performs a rotation counterclockwise, centered about the point
  2899. * (rx, ry), using an angle of rangle degrees.
  2900. * A filled circle is drawn if fill is true; otherwise, this method
  2901. * draws a wireframe.
  2902. * The circle is drawn using the specified index into the entire
  2903. * 256-element palette: for instance, passing in a color of 17 would
  2904. * use color 1 of cset 1.
  2905. * Opacity controls how transparent the circle will be.
  2906. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2907. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2908. * as translucent (OP_TRANS, or 64).
  2909. *
  2910. */ Example Use: !#!
  2911.  
  2912. /************************************************************************************************************/
  2913.  
  2914. void Arc( int layer, int x, int y, int radius, int startangle, int endangle,
  2915. int color, float scale,
  2916. int rx, int ry, int rangle,
  2917. bool closed, bool fill, int opacity );
  2918.  
  2919. ZASM Instruction:
  2920. ARC
  2921. ARCR
  2922.  
  2923. /**
  2924. * Draws an arc of a circle on the specified layer of the current
  2925. * screen. The circle in question has center (x,y) and radius
  2926. * scale*radius.
  2927. * The arc beings at startangle degrees counterclockwise from standard
  2928. * position, and ends at endangle degress counterclockwise from standard
  2929. * position. The behavior of this function is undefined unless
  2930. * 0 <= endangle-startangle < 360.
  2931. * The arc is then rotated about the point (rx, ry) using an angle of
  2932. * rangle radians.
  2933. * If closed is true, a line is drawn from the center of the circle to
  2934. * each endpoint of the arc, forming a sector of the circle. If fill
  2935. * is also true, a filled sector is drawn instead.
  2936. * The arc or sector is drawn using the specified index into the entire
  2937. * 256-element palette: for instance, passing in a color of 17 would
  2938. * use color 1 of cset 1.
  2939. * Opacity controls how transparent the arc will be.
  2940. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2941. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2942. * as translucent (OP_TRANS, or 64).
  2943. *
  2944. */ Example Use: !#!
  2945.  
  2946. /************************************************************************************************************/
  2947.  
  2948. void Ellipse( int layer, int x, int y, int xradius, int yradius,
  2949. int color, float scale,
  2950. int rx, int ry, int rangle,
  2951. bool fill, int opacity);
  2952.  
  2953.  
  2954.  
  2955. ZASM Instruction:
  2956. ELLIPSE2
  2957. ELLIPSER
  2958.  
  2959. /**
  2960. * Draws an ellipse on the specified layer of the current screen with
  2961. * center (x,y), x-axis radius xradius, and y-axis radius yradius.
  2962. * Then performs a rotation counterclockwise, centered about the point
  2963. * (rx, ry), using an angle of rangle degrees.
  2964. * A filled ellipse is drawn if fill is true; otherwise, this method
  2965. * draws a wireframe.
  2966. * The ellipse is drawn using the specified index into the entire
  2967. * 256-element palette: for instance, passing in a color of 17 would
  2968. * use color 1 of cset 1.
  2969. * Opacity controls how transparent the ellipse will be.
  2970. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2971. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2972. * as translucent (OP_TRANS, or 64).
  2973. *
  2974. */ Example Use: !#!
  2975.  
  2976. /************************************************************************************************************/
  2977.  
  2978. void Spline( int layer, int x1, int y1, int x2, int y2, int x3, int y3,int x4, int y4,
  2979. int color, int opacity);
  2980.  
  2981. ZASM Instruction:
  2982. SPLINER
  2983. SPLINE
  2984.  
  2985. /**
  2986. * Draws a cardinal spline on the specified layer of the current screen
  2987. * between (x1,y1) and (x4,y4)
  2988. * The spline is drawn using the specified index into the entire
  2989. * 256-element palette: for instance, passing in a color of 17 would
  2990. * use color 1 of cset 1.
  2991. * Opacity controls how transparent the ellipse will be.
  2992. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2993. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2994. * as translucent (OP_TRANS, or 64).
  2995. *
  2996. */ Example Use: !#!
  2997.  
  2998. /************************************************************************************************************/
  2999.  
  3000. void Line( int layer, int x, int y, int x2, int y2,
  3001. int color, float scale,
  3002. int rx, int ry, int rangle,
  3003. int opacity );
  3004.  
  3005. ZASM Instruction:
  3006. LINE
  3007. LINER
  3008. /**
  3009. * Draws a line on the specified layer of the current screen between
  3010. * (x,y) and (x2,y2).
  3011. * Then scales the line uniformly by a factor of scale about the line's
  3012. * midpoint.
  3013. * Finally, performs a rotation counterclockwise, centered about the
  3014. * point (rx, ry), using an angle of rangle degrees.
  3015. * The line is drawn using the specified index into the entire
  3016. * 256-element palette: for instance, passing in a color of 17 would
  3017. * use color 1 of cset 1.
  3018. * Opacity controls how transparent the line will be.
  3019. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  3020. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  3021. * as translucent (OP_TRANS, or 64).
  3022. *
  3023. */ Example Use: !#!
  3024.  
  3025. /************************************************************************************************************/
  3026.  
  3027. void PutPixel (int layer, int x, int y,
  3028. int color,
  3029. int rx, int ry, int rangle,
  3030. int opacity);
  3031.  
  3032. ZASM Instruction:
  3033. PUTPIXEL
  3034. PUTPIXELR
  3035. /**
  3036. * Draws a raw pixel on the specified layer of the current screen
  3037. * at (x,y).
  3038. * Then performs a rotation counterclockwise, centered about the point
  3039. * (rx, ry), using an angle of rangle degrees.
  3040. * The point is drawn using the specified index into the entire
  3041. * 256-element palette: for instance, passing in a color of 17 would
  3042. * use color 1 of cset 1.
  3043. * Opacity controls how transparent the point will be.
  3044. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  3045. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  3046. * as translucent (OP_TRANS, or 64).
  3047. *
  3048. */ Example Use: !#!
  3049.  
  3050. /************************************************************************************************************/
  3051.  
  3052. void DrawTile (int layer, int x, int y,
  3053. int tile, int blockw, int blockh,
  3054. int cset, int xscale, int yscale,
  3055. int rx, int ry, int rangle,
  3056. int flip,
  3057. bool transparency, int opacity);
  3058.  
  3059. ZASM Instruction:
  3060. DRAWTILE
  3061. DRAWTILER
  3062. /**
  3063. * Draws a block of tiles on the specified layer of the current screen,
  3064. * starting at (x,y), using the specified cset.
  3065. * Starting with the specified tile, this method copies a block of size
  3066. * blockh x blockw from the tile sheet to the screen. This method's
  3067. * behavior is undefined unless 1 <= blockh, blockw <= 20.
  3068. * Scale specifies the actual size in pixels! So scale 1 would mean it is
  3069. * only one pixel in size. To use the default sizes of block w,h you must
  3070. * set xscale and yscale to -1. These values are not independant of one another,
  3071. * so you cannot set xscale and leave yscale at -1.
  3072. * rx, ry : these work now, just like the other primitives.
  3073. * rangle performs a rotation clockwise using an angle of rangle degrees.
  3074. * Flip specifies how the tiles should be flipped when drawn:
  3075. * 0: No flip
  3076. * 1: Horizontal flip
  3077. * 2: Vertical flip
  3078. * 3: Both (180 degree rotation)
  3079. * If transparency is true, the tiles' transparent regions will be
  3080. * respected.
  3081. * Opacity controls how transparent the solid portions of the tiles will
  3082. * be.
  3083. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  3084. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  3085. * as translucent (OP_TRANS, or 64).
  3086. */ Example Use: !#!
  3087.  
  3088. /************************************************************************************************************/
  3089.  
  3090. void FastTile (int layer, int x, int y,
  3091. int tile, int cset,
  3092. int opacity );
  3093.  
  3094. ZASM Instruction:
  3095. FASTTILER
  3096. /**
  3097. * Optimized and simpler version of DrawTile()
  3098. * Draws a single tile on the current screen much in the same way as DrawTile().
  3099. * See DrawTile() for an explanation on what these arguments do.
  3100. */ Example Use: !#!
  3101.  
  3102. /************************************************************************************************************/
  3103.  
  3104. void DrawCombo (int layer, int x, int y,
  3105. int combo, int w, int h,
  3106. int cset, int xscale, int yscale,
  3107. int rx, int ry, int rangle,
  3108. int frame, int flip,
  3109. bool transparency, int opacity);
  3110.  
  3111. ZASM Instruction:
  3112. DRAWCOMBO
  3113. DRAWCOMBOR
  3114. /**
  3115. * Draws a combo on the specified layer of the current screen,
  3116. * starting at (x,y), using the specified cset.
  3117. * Starting with the specified tile referenced by the combo,
  3118. * this method copies a block of size
  3119. * blockh x blockw from the tile sheet to the screen. This method's
  3120. * behavior is undefined unless 1 <= blockh, blockw <= 20.
  3121. * Scale specifies the actual size in pixels! So scale 1 would mean it is
  3122. * only one pixel in size. To use the default sizes of block w,h you must
  3123. * set xscale and yscale to -1. These values are not independant of one another,
  3124. * so you cannot set xscale and leave yscale at -1.
  3125. * rx, ry : works now :
  3126. * rangle performs a rotation clockwise using an angle of rangle degrees.
  3127. * Flip specifies how the tiles should be flipped when drawn:
  3128. * 0: No flip
  3129. * 1: Horizontal flip
  3130. * 2: Vertical flip
  3131. * 3: Both (180 degree rotation)
  3132. * If transparency is true, the tiles' transparent regions will be
  3133. * respected.
  3134. * Opacity controls how transparent the solid portions of the tiles will
  3135. * be.
  3136. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  3137. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  3138. * as translucent (OP_TRANS, or 64).
  3139. */ Example Use: !#!
  3140.  
  3141. /************************************************************************************************************/
  3142.  
  3143. void FastCombo (int layer, int x, int y,
  3144. int combo, int cset,
  3145. int opacity );
  3146.  
  3147. ZASM Instruction:
  3148. FASTCOMBOR
  3149. /**
  3150. * Optimized and simpler version of DrawCombo()
  3151. * Draws a single combo on the current screen much in the same way as DrawCombo().
  3152. * See DrawCombo() for an explanation on what these arguments do.
  3153. */ Example Use: !#!
  3154.  
  3155. /************************************************************************************************************/
  3156.  
  3157. void DrawCharacter (int layer, int x, int y,
  3158. int font, int color, int background_color,
  3159. int width, int height, int glyph,
  3160. int opacity );
  3161.  
  3162. ZASM Instruction:
  3163. DRAWCHARR
  3164. /**
  3165. * Draws a single ASCII character 'glyph' on the specified layer of the current screen,
  3166. * using the specified font index (see std.zh for FONT_* list to pass to this method),
  3167. * starting at (x,y), using the specified color as the foreground color
  3168. * and background_color as the background color. * NOTE * Use -1 for a transparent background.
  3169. * The arguments width and height may be used to draw the glyph
  3170. * of any arbitrary size begining at 1 pixel up to 512 pixels large. (more than four times the size of the screen)
  3171. * Passing 0 or negative values to this will use the default fonts w and h.
  3172. * Opacity controls how transparent the is.
  3173. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  3174. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  3175. * as translucent (OP_TRANS, or 64).
  3176. */ Example Use: !#!
  3177.  
  3178. /************************************************************************************************************/
  3179.  
  3180. void DrawInteger (int layer, int x, int y,
  3181. int font, int color, int background_color,
  3182. int width, int height, int number, int number_decimal_places,
  3183. int opacity);
  3184.  
  3185.  
  3186. ZASM Instruction:
  3187. DRAWINTR
  3188. /**
  3189. * Draws a zscript 'int' or 'float' on the specified layer of the current screen,
  3190. * using the specified font index (see std.zh for FONT_* list to pass to this method),
  3191. * starting at (x,y), using the specified color as the foreground color
  3192. * and background_color as the background color. * NOTE * Use -1 for a transparent background.
  3193. * The arguments width and height may be used to draw the number
  3194. * of any arbitrary size begining at 1 pixel up to 512 pixels large.
  3195. * Passing 0 or negative values to this will use the default fonts w and h.
  3196. * The number can be rendered as type 'int' or 'float' by setting the argument
  3197. * "number_decimal_places", which is only valid if set to 0 or <= 4.
  3198. * Opacity controls how transparent the is.
  3199. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  3200. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  3201. * as translucent (OP_TRANS, or 64).
  3202. */ Example Use: !#!
  3203.  
  3204. /************************************************************************************************************/
  3205.  
  3206. void DrawString( int layer, int x, int y,
  3207. int font, int color, int background_color, int format,
  3208. int ptr[],
  3209. int opacity );
  3210.  
  3211. ZASM Instruction:
  3212. DRAWSTRINGR
  3213. /**
  3214. * Prints a NULL terminated string up to 256 characters from an int array
  3215. * containing ASCII data (*ptr) on the specified layer of the current screen,
  3216. * using the specified font index (see std.zh for FONT_* list to pass to this method),
  3217. * using the specified color as the foreground color
  3218. * and background_color as the background color. * NOTE * Use -1 for a transparent background.
  3219. * The array pointer should be passed as the argument for '*ptr', ie.
  3220. * int string[] = "Example String"; Screen->DrawString(l,x,y,f,c,b_c,fo,o,string);
  3221. * int format tells the engine how to format the string. (see std.zh for TF_* list to pass to this method)
  3222. * Opacity controls how transparent the message is.
  3223. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  3224. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  3225. * as translucent (OP_TRANS, or 64).
  3226. */ Example Use: !#!
  3227.  
  3228. /************************************************************************************************************/
  3229.  
  3230.  
  3231.  
  3232. /////////////////////////
  3233. // (Psuedo) 3D drawing //
  3234. /////////////////////////
  3235.  
  3236. //! When allocating a texture, the size (h,w) must be between 1 and 16, in powers of two.
  3237. //! Thus, legal sizes are 1, 2, 4, 8, and 16.
  3238. //! This applies to *all* the pseudo-3d and 3-D drawing functions.
  3239.  
  3240. void Quad ( int layer,
  3241. int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4,
  3242. int w, int h, int cset, int flip, int texture, int render_mode);
  3243.  
  3244. ZASM Instruction:
  3245. QUADR
  3246.  
  3247. /**
  3248. * Draws a quad on the specified layer with the corners x1,y1 through x4,y4.
  3249. * Corners are drawn in a counterclockwise order starting from x1,y1. ( So
  3250. * if you draw a "square" for example starting from the bottom-right corner
  3251. * instead of the usual top-left, the the image will be textured onto the
  3252. * quad so it appears upside-down. -yes, these are rotatable. )
  3253. *
  3254. * From there a single or block of tiles, combos **or a bitmap** is then texture mapped
  3255. * onto the quad using the arguments w, h, cset, flip, and render_mode.
  3256. * A positive vale in texture will draw the image from the tilesheet pages,
  3257. * whereas a negative value will be drawn from the combo page. 0 will draw combo number 0.
  3258. * Both w and h are undefined unless 1 <= blockh, blockw <= 16, and it is a power of
  3259. * two. ie: 1, 2 are acceptable, but 2, 15 are not.
  3260. *
  3261. * To specify a bitmap as a texture, sum 65520 with the bitmap ID, or use the constant TEX_BITMAP + Bitmap
  3262. * Example: Screen->Quad(6, 0, 0, 40, 25, 18, 50, 60, 110, 0, 0, 0, 0, TEX_BITMAP+RT_BITMAP0, PT_TEXTURE);
  3263. *
  3264. *
  3265. * Flip specifies how the tiles/combos should be flipped when drawn:
  3266. * 0: No flip
  3267. * 1: Horizontal flip
  3268. * 2: Vertical flip
  3269. * 3: Both (180 degree rotation)
  3270. * (!) See std.zh for a list of all available render_mode arguments.
  3271. */ Example Use: !#!
  3272.  
  3273. /************************************************************************************************************/
  3274.  
  3275. void Triangle ( int layer,
  3276. int x1, int y1, int x2, int y2, int x3, int y3,
  3277. int w, int h, int cset, int flip, int texture, int render_mode);
  3278.  
  3279. ZASM Instruction:
  3280. TRIANGLER
  3281.  
  3282. /**
  3283. * Draws a triangle on the specified layer with the corners x1,y1 through x4,y4.
  3284. * Corners are drawn in a counterclockwise order starting from x1,y1.
  3285. * From there a single or block of tiles or combos is then texture mapped
  3286. * onto the triangle using the arguments w, h, cset, flip, and render_mode.
  3287. *
  3288. * A positive value in texture will draw the image from the tilesheet pages,
  3289. * whereas a negative value will be drawn from the combo page. 0 will draw combo number 0.
  3290. * Both w and h are undefined unless 1 <= blockh, blockw <= 16, and it is a power of
  3291. * two. ie: 1, 2 are acceptable, but 2, 15 are not.
  3292. *
  3293. * Flip specifies how the tiles/combos should be flipped when drawn:
  3294. * 0: No flip
  3295. * 1: Horizontal flip
  3296. * 2: Vertical flip
  3297. * 3: Both (180 degree rotation)
  3298. * (!) See std.zh for a list of all available render_mode arguments.
  3299. */ Example Use: !#!
  3300.  
  3301. /************************************************************************************************************/
  3302.  
  3303. void Triangle3D ( int layer,
  3304. int pos[9], int uv[6], int csets[3], int size[2],
  3305. int flip, int tile, int polytype );
  3306.  
  3307. ZASM Instruction:
  3308. TRIANGLE3DR
  3309. /**
  3310. * Draws a 3d triangle on the specified layer with the corners x1,y1 through x4,y4.
  3311. * Corners are drawn in a counterclockwise order starting from x1,y1.
  3312. * From there a single or block of tiles or combos is then texture mapped
  3313. * onto the triangle using the arguments w, h, cset, flip, and render_mode.
  3314. *
  3315. * A positive value in texture will draw the image from the tilesheet pages,
  3316. * whereas a negative value will be drawn from the combo page. 0 will draw combo number 0.
  3317. * Both w and h are undefined unless 1 <= blockh, blockw <= 16, and it is a power of
  3318. * two. ie: 1, 2 are acceptable, but 2, 15 are not.
  3319. *
  3320. * Arguments take the form of array pointers: Thus, you must declare arrays with the values that you wish to use
  3321. * and pass their pointers to each of the following:
  3322. *
  3323. * [9]pos - x, y, z positions of the 3 corners.
  3324. * [6]uv - x, y texture coordinates of the given texture.
  3325. * [3]csets - of the corners to interpolate between.
  3326. * [2]size - w, h, of the texture.
  3327. * w, and h must be in values of 1, 2, 4, 8, or 16.
  3328. *
  3329. *
  3330. * Flip specifies how the tiles/combos should be flipped when drawn:
  3331. * 0: No flip
  3332. * 1: Horizontal flip
  3333. * 2: Vertical flip
  3334. * 3: Both (180 degree rotation)
  3335. * (!) See std.zh for a list of all available render_mode arguments.
  3336. */ Example Use: !#!
  3337.  
  3338. /************************************************************************************************************/
  3339.  
  3340. void Quad3D ( int layer,
  3341. int pos[], int uv[], int cset[], int size[],
  3342. int flip, int texture, int render_mode );
  3343.  
  3344. ZASM Instruction:
  3345. QUAD3DR
  3346.  
  3347. /**
  3348. * Draws a Quad on the specified layer similar to Quad.
  3349. * Arguments take the form of array pointers: Thus, you must declare arrays with the values that you wish to use
  3350. * and pass their pointers to each of the following:
  3351. *
  3352. * [12]pos - x, y, z positions of the 4 corners.
  3353. * [8]uv - x, y texture coordinates of the given texture.
  3354. * [4]csets - of the corners to interpolate between.
  3355. * [2]size - w, h, of the texture.
  3356. * w, and h must be in values of 1, 2, 4, 8, or 16.
  3357. * (!) See std.zh for a list of all available render_mode arguments.
  3358. */ Example Use: !#!
  3359.  
  3360. /************************************************************************************************************/
  3361.  
  3362. void SetRenderTarget( int bitmap_id );
  3363.  
  3364. ZASM Instruction:
  3365. SETRENDERTARGET
  3366.  
  3367. /**
  3368. * Sets the target bitmap for all succesive drawing commands.
  3369. * These can be directly to the screen or any one of the available off-screen bitmaps,
  3370. * which are generally categorized as -1(screen) or 0-bitmapNumber(off-screen).
  3371. *
  3372. * (!) See std.zh for a complete list of valid render targets (RT_*).
  3373. */ Example Use: !#!
  3374.  
  3375. /************************************************************************************************************/
  3376.  
  3377. void DrawBitmap ( int layer,
  3378. int bitmap_id,
  3379. int source_x, int source_y, int source_w, int source_h,
  3380. int dest_x, int dest_y, int dest_w, int dest_h,
  3381. float rotation, bool mask);
  3382.  
  3383. ZASM Instruction:
  3384. BITMAPR
  3385.  
  3386. /**
  3387. * Draws a source rect from off-screen Bitmap with id of bitmap_id onto
  3388. * an area of the screen described by dest rect at the given layer.
  3389. *
  3390. * (!) Note* Script drawing functions are enqueued and executed in a frame-by-frame basis
  3391. * based on the order of which layer they need to be drawn to. Drawing to or from
  3392. * seperate render tagets or bitmaps is no exception! So keep in mind in order to
  3393. * eliminate unwanted drawing orders or bugs.
  3394. */ Example Use:
  3395. Screen->DrawBitmap( 6, myBitmapId, 0, 0, 16, 16, 79, 57, 32, 32, 0, true );
  3396. This would draw a 16x16 area starting at the upper-left corner of source bitmap to
  3397. layer 6 of the current screen at coordinates 79,57 with a width and height of
  3398.  
  3399.  
  3400.  
  3401. // Screen/Layer Drawing
  3402. */
  3403.  
  3404. /************************************************************************************************************/
  3405.  
  3406. void DrawBitmapEx ( int layer,
  3407. int bitmap_id,
  3408. int source_x, int source_y, int source_w, int source_h,
  3409. int dest_x, int dest_y, int dest_w, int dest_h,
  3410. float rotation, int cx, int cy, int mode, int lit, bool mask);
  3411.  
  3412. ZASM: BITMAPEXR
  3413.  
  3414. /**
  3415. *
  3416. * As DrawBitmap(), except that it can do more things.
  3417. *
  3418. * The 'mode' parameter sets up drawing modes. AT PRESENT this supports normal opaque drawing as DrawBitmap()
  3419. * AND it supports TRANSLUCENT MODE, which will allow drawing translucent bitmaps.
  3420. * The translucent mode does not yet support rotation, and some other modes are temporarily suspended, pending
  3421. * full implementation.
  3422. *
  3423. * See std_constants.zh, under BITDX_* (or possibly we'll change this to BMPDX_* later?) for a list of modes,
  3424. * and more information
  3425. *
  3426. * Draws a source rect from off-screen Bitmap with id of bitmap_id onto
  3427. * an area of the screen described by dest rect at the given layer.
  3428. *
  3429. * (!) Note* Script drawing functions are enqueued and executed in a frame-by-frame basis
  3430. * based on the order of which layer they need to be drawn to. Drawing to or from
  3431. * seperate render tagets or bitmaps is no exception! So keep in mind in order to
  3432. * eliminate unwanted drawing orders or bugs.
  3433. *
  3434. * Set 'mode' to a value of '1' to draw a translucent bitmap.
  3435. *
  3436. * Note: Rotation does not work with translucent bitmaps at this time.
  3437. *
  3438. * cx, cy: Used for pivot
  3439. * lit: used for lit colour in light table (may not work).
  3440. *
  3441. */ Example Use:
  3442. Screen->DrawBitmapEx( 6, myBitmapId, 0, 0, 16, 16, 79, 57, 32, 32, 0, 1, true );
  3443. This would draw a translucent 16x16 area starting at the upper-left corner of source
  3444. bitmap to layer 6 of the current screen at coordinates 79,57 with a width and height of
  3445.  
  3446.  
  3447.  
  3448.  
  3449. // Screen/Layer Drawing
  3450. */
  3451.  
  3452. /************************************************************************************************************/
  3453.  
  3454. void DrawLayer (int layer,
  3455. int source_map, int source_screen, int source_layer,
  3456. int x, int y, float rotation, int opacity);
  3457.  
  3458. ZASM Instruction:
  3459. DRAWLAYERR
  3460.  
  3461. /**
  3462. * Draws an entire Layer from source_screen on source_map on the specified layer of the current screen at (x,y).
  3463. * If rotation is not zero, it(the entire layer) will rotate about its center.
  3464. *
  3465. * Opacity controls how transparent the solid portions of the tiles will
  3466. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  3467. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  3468. * as translucent (OP_TRANS, or 64).
  3469. *
  3470. * Also see ScreenToLayer() in std.zh
  3471. */ Example Use:
  3472.  
  3473. /************************************************************************************************************/
  3474.  
  3475. void DrawScreen (int layer,
  3476. int map, int source_screen,
  3477. int x, int y, float rotation);
  3478.  
  3479. ZASM Instruction:
  3480. DRAWSCREENR
  3481.  
  3482. /**
  3483. * Draws an entire screen from screen on map on the specified layer of the current screen at (x,y).
  3484. * If rotation is not zero, it(the entire screen) will rotate about its center.
  3485. *
  3486. */ Example Use:
  3487.  
  3488. /************************************************************************************************************/
  3489. /************************************************************************************************************/
  3490.  
  3491.  
  3492.  
  3493. //===================================
  3494. //--- FFC Functions and Variables ---
  3495. //===================================
  3496.  
  3497. class ffc
  3498.  
  3499. /*
  3500. * The following functions, and arrays are part of the ffc class.
  3501. *
  3502. * Ordinarily, these are set when writing an ffc script, using the pointer
  3503. * this->
  3504. * Example: this->Data = 10; Sets the Data variable for the present ffc
  3505. * to a value of '10'.
  3506. *
  3507. * The 'this->' pointer is used in ffcs, and item scripts only. It references ffc
  3508. * variables and arrays in an ffc script; and itemdata variables in an item script.
  3509. *
  3510. * Changing ffc variables without 'this->':
  3511. *
  3512. * You may change a variable, or array value of the ffc class by loading the ffc into a custom pointer
  3513. * using Screen->LoadFFC(int number) as follows:
  3514. *
  3515. * ffc f; //Declare a general ffc pointer.
  3516. * //You must use the ffc token to declare the pointer, but you may use any
  3517. * //name that you desire for it. 'f' here, is merely a short-name example.
  3518. *
  3519. * f = Screen->LoadFFC(10); //Loads the data of ffc ID 10 for the present screen into the 'f' pointer.
  3520. *
  3521. * f->Data = 15; //Sets the 'Data' variable of the ffc to a value of '15'.
  3522. *
  3523. * f->X = 120; //Sets the X-position of the ffc assigned to pointer 'f' to a value of '120'.
  3524. */
  3525.  
  3526.  
  3527.  
  3528. int ID; ZASM Instruction
  3529. FFCID, REFFFC
  3530.  
  3531. /**
  3532. * Returns the screen index of the FFC, or set working FFC ID.
  3533. * Can be set, to change the index of a pointer, but this requires testing and may be unstable.
  3534. *
  3535. */
  3536.  
  3537.  
  3538. /************************************************************************************************************/
  3539.  
  3540. int GetPointer(ffc *ptr[]); ZASM Instruction:
  3541. FFCARRPTR
  3542. /**
  3543. * Returns the pointer of a ffc array as a float.
  3544. */ Example Use:
  3545. ffc arr[16];
  3546. int size = SizeOfArray( GetPointer(arr) );
  3547. //Size == 16
  3548.  
  3549. /************************************************************************************************************/
  3550.  
  3551. ffc SetPointer(int value); ZASM Instruction:
  3552. FFCARRPTR2
  3553. /**
  3554. * Converts an int pointer to the ffc type, for assigning.
  3555. */ Example Use:
  3556. ffc arr[16]; ffc arrB[2]; int arrC[2];
  3557. arrC[0] = GetPointer(arr);
  3558. arrB[0] = SetPointer(arrC[0]);
  3559.  
  3560. /************************************************************************************************************/
  3561.  
  3562. int Data; ZASM Instruction:
  3563. DATA<d3>
  3564.  
  3565. /**
  3566. * The number of the combo associated with this FFC.
  3567. */ Example Use:
  3568.  
  3569. f->Data = 10;
  3570. Sets the ffc to Combo 10.
  3571.  
  3572. /************************************************************************************************************/
  3573.  
  3574. int Script; ZASM Instruction:
  3575. FFSCRIPT<d3>
  3576.  
  3577. /**
  3578. * The number of the script assigned to the FFC. This will be automatically
  3579. * set to 0 when the FFC's script halts. A script cannot change the script of
  3580. * the FFC running it; in other words, f->Script is read-only when f==this.
  3581. * When an FFC's script is changed, its arguments, Misc[], and registers will
  3582. * all be set to 0, and it will start running from the beginning. Set
  3583. * ffc->InitD[] after setting the script before the script starts running
  3584. * to pass arguments to it.
  3585. *
  3586. */ Example Use:
  3587.  
  3588. f->Script = 10;
  3589. Sets the ffc to Combo 10.
  3590.  
  3591. /************************************************************************************************************/
  3592.  
  3593. int CSet; ZASM Instruction:
  3594. FCSET<d3>
  3595.  
  3596. /**
  3597. * The cset of the FFC.
  3598. *
  3599. */ Example Use:
  3600.  
  3601. f->CSet = 2;
  3602. Sets the ffc to CSet 2.
  3603.  
  3604. /************************************************************************************************************/
  3605.  
  3606. int Delay; ZASM Instruction:
  3607. DELAY<d3>
  3608.  
  3609. /**
  3610. * The FFC's animation delay, in frames.
  3611. *
  3612. */ Example Use:
  3613.  
  3614. f->Delay = 120;
  3615. 120 frames will pass before the ffc animates.
  3616.  
  3617. /************************************************************************************************************/
  3618.  
  3619. float X; ZASM Instruction:
  3620. FX<d3>
  3621.  
  3622. /**
  3623. * The FFC's X position on the screen.
  3624. *
  3625. * Values outside the screen boundaries *are* legal.
  3626. *
  3627. */ Example Use:
  3628.  
  3629. f->X = 43;
  3630. Sets the ffc at X-position 43; 43 pixels to the right of the leftmost screen edge.
  3631.  
  3632. /************************************************************************************************************/
  3633.  
  3634. float Y; ZASM Instruction:
  3635. FY<d3>
  3636.  
  3637. /**
  3638. * The FFC's Y position on the screen.
  3639. *
  3640. * Values outside the screen boundaries *are* legal.
  3641. * The Y value 0 is automatically offset to account for the passive subscreen.
  3642. * To place an ffc in the area of the passive subscreen, a negative value must be passed to Y.
  3643. *
  3644. */ Example Use:
  3645.  
  3646. f->X = 90;
  3647. Sets the ffc at Y-position to 90; i.e. 90 pixels below the passive subscreen.
  3648.  
  3649. /************************************************************************************************************/
  3650.  
  3651. float Vx; ZASM Instruction:
  3652. XD<d3>
  3653.  
  3654. /**
  3655. * The FFC's velocity's X-component.
  3656. *
  3657. *
  3658. */ Example Use:
  3659.  
  3660. f->Vx = 20;
  3661. The ffc will move by 20 pixels per second on the X avis.
  3662.  
  3663. /************************************************************************************************************/
  3664.  
  3665. float Vy; ZASM Instruction:
  3666. YD<d3>
  3667.  
  3668. /**
  3669. * The FFC's velocity's Y-component.
  3670. *
  3671. *
  3672. */ Example Use:
  3673.  
  3674. f->Vy = 20;
  3675. The ffc will move by 20 pixels per second on the Y avis.
  3676.  
  3677. /************************************************************************************************************/
  3678.  
  3679. float Ax; ZASM Instruction:
  3680. XD2<d3>
  3681.  
  3682. /**
  3683. * The FFC's acceleration's X-component.
  3684. *
  3685. *
  3686. */ Example Use:
  3687.  
  3688. f->Vx = 1.03;
  3689. Every frame, the velocity X-component will increase by 1.03.
  3690.  
  3691. /************************************************************************************************************/
  3692.  
  3693. float Ay; ZASM Instruction:
  3694. YD2<d3>
  3695.  
  3696. /**
  3697. * The FFC's acceleration's Y-component.
  3698. *
  3699. *
  3700. */ Example Use:
  3701.  
  3702. f->Vx = 0.2903;
  3703. Every frame, the velocity Y-component will increase by 0.2903.
  3704.  
  3705. /************************************************************************************************************/
  3706.  
  3707. bool Flags[]; ZASM Instruction:
  3708. FLAG<d3>
  3709. FFFLAGSD
  3710.  
  3711.  
  3712. /**
  3713. * The FFC's set of flags. Use the FFCF_ constants in std.zh as the
  3714. * index to access a particular flag.
  3715. *
  3716. */ Example Use: !#!
  3717.  
  3718. /************************************************************************************************************/
  3719.  
  3720. int TileWidth; ZASM Instruction:
  3721. FFTWIDTH<d3>
  3722. WIDTH<>
  3723.  
  3724. /**
  3725. * The number of tile columns composing the FFC.
  3726. * The maximum value is '4'.
  3727. *
  3728. */ Example Use: !#!
  3729.  
  3730. /************************************************************************************************************/
  3731.  
  3732. int TileHeight; ZASM Instruction:
  3733. FFTHEIGHT<d3>
  3734. HEIGHT<>
  3735.  
  3736. /**
  3737. * The number of tile rows composing the FFC.
  3738. * The maximum value is '4'.
  3739. *
  3740. */ Example Use: !#!
  3741.  
  3742. /************************************************************************************************************/
  3743.  
  3744. int EffectWidth; ZASM Instruction:
  3745. FFCWIDTH<d3>
  3746.  
  3747. /**
  3748. * The width (in pixels) of the area of effect of the combo associated with the FFC.
  3749. * The maximum value is '64'.
  3750. *
  3751. */ Example Use: !#!
  3752.  
  3753. /************************************************************************************************************/
  3754.  
  3755. int EffectHeight; ZASM Instruction:
  3756. FFCHEIGHT<d3>
  3757.  
  3758. /**
  3759. * The width (in pixels) of the area of effect of the combo associated with the FFC.
  3760. * The maximum value is '64'.
  3761. *
  3762. */ Example Use: !#!
  3763.  
  3764. /************************************************************************************************************/
  3765.  
  3766. int Link; ZASM Instruction:
  3767. FFLINK<d3>
  3768. LINK<>
  3769.  
  3770. /**
  3771. * The number of the FFC linked to by this FFC.
  3772. *
  3773. */ Example Use: !#!
  3774.  
  3775. /************************************************************************************************************/
  3776.  
  3777. float InitD[8]; ZASM Instruction:
  3778. FFINITD<>
  3779. FFINITDD<>?
  3780. D<>
  3781.  
  3782. /**
  3783. * The original values of the FFC's 8 D input values as they are stored in
  3784. * the .qst file, regardless of whether they have been modified by ZScript.
  3785. *
  3786. */ Example Use: !#!
  3787.  
  3788. /************************************************************************************************************/
  3789.  
  3790. float Misc[16]; ZASM Instruction:
  3791. FFMISC
  3792. FFMISCD
  3793.  
  3794. /**
  3795. * An array of 16 miscellaneous variables for you to use as you please.
  3796. * These variables are not saved with the ffc.
  3797. *
  3798. */ Example Use: !#!
  3799.  
  3800. /************************************************************************************************************/
  3801.  
  3802. Address Argument ZASM Instruction
  3803. A<>
  3804.  
  3805. /************************************************************************************************************/
  3806. /************************************************************************************************************/
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812. //====================================
  3813. //--- Link Functions and Variables ---
  3814. //====================================
  3815.  
  3816. namespace Link
  3817.  
  3818.  
  3819. int X; ZASM Instruction:
  3820. LINKX
  3821.  
  3822. /**
  3823. * Link's X position on the screen, in pixels. Float values passed to this will be truncated to ints.
  3824. *
  3825. */ Example Use: !#!
  3826.  
  3827. /************************************************************************************************************/
  3828.  
  3829. int Y; ZASM Instruction:
  3830. LINKY
  3831.  
  3832. /**
  3833. * Link's Y position on the screen, in pixels. Float values passed to this will be truncated to ints.
  3834. *
  3835. */ Example Use: !#!
  3836.  
  3837. /************************************************************************************************************/
  3838.  
  3839. int Z; ZASM Instruction:
  3840. LINKZ
  3841.  
  3842. /**
  3843. * Link's Z position on the screen, in pixels. Float values passed to this will be truncated to ints.
  3844. *
  3845. */ Example Use: !#!
  3846.  
  3847. /************************************************************************************************************/
  3848.  
  3849. bool Invisible; ZASM Instruction:
  3850. LINKINVIS
  3851.  
  3852. /**
  3853. * Whether Link is currently being draw to the screen. Set true to remove him from view.
  3854. *
  3855. */ Example Use: !#!
  3856.  
  3857. /************************************************************************************************************/
  3858.  
  3859. bool CollDetection; ZASM Instruction:
  3860. LINKINVINC
  3861.  
  3862. /**
  3863. * If true, Link's collision detection with npcs and eweapons is currently turned off.
  3864. * This variable works on a different system to clocks and the level 4 cheat, so it will not
  3865. * necessarily return true if they are set.
  3866. *
  3867. */ Example Use: !#!
  3868.  
  3869. /************************************************************************************************************/
  3870.  
  3871. int Jump; ZASM Instruction:
  3872. LINKJUMP
  3873.  
  3874. /**
  3875. * Link's upward velocity, in pixels. If negative, Link will fall.
  3876. * The downward acceleration of Gravity (in Init Data) modifies this value every frame.
  3877. *
  3878. * This value is intended to be in pixels, but appears to be in tiles. ?!
  3879. *
  3880. */ Example Use: !#!
  3881.  
  3882. /************************************************************************************************************/
  3883.  
  3884. int SwordJinx; ZASM Instruction:
  3885. LINKSWORDJINX
  3886.  
  3887. /**
  3888. * The time, in frames, until Link regains use of his sword. -1 signifies
  3889. * a permanent loss of the sword caused by a Red Bubble.
  3890. *
  3891. */ Example Use: !#!
  3892.  
  3893. /************************************************************************************************************/
  3894.  
  3895. int ItemJinx; ZASM Instruction:
  3896. LINKITEMJINX
  3897.  
  3898. /**
  3899. * The time, in frames, until Link regains use of his items. -1 signifies
  3900. * a permanent loss of his items. caused by a Red Bubble.
  3901. *
  3902. */ Example Use: !#!
  3903.  
  3904. /************************************************************************************************************/
  3905.  
  3906. int Drunk; ZASM Instruction:
  3907. LINKDRUNK
  3908.  
  3909. /**
  3910. * The time, in frames, that Link will be 'drunk'. If positive, the player's
  3911. * controls are randomly interfered with, causing Link to move erratically.
  3912. * This value is decremented once per frame. As the value of Drunk approaches 0,
  3913. * the intensity of the effect decreases.
  3914. *
  3915. */ Example Use: !#!
  3916.  
  3917. /************************************************************************************************************/
  3918.  
  3919. int Dir; ZASM Instruction:
  3920. LINKDIR
  3921.  
  3922. /**
  3923. * The direction Link is facing. Use the DIR_ constants in std.zh to set
  3924. * or compare this variable. Note: even though Link can move diagonally if the
  3925. * quest allows it, his sprite doesn't ever use any of the diagonal directions,
  3926. * which are intended for enemies only.
  3927. *
  3928. * Reading this value occurs after Waitdraw().
  3929. *
  3930. */ Example Use: !#!
  3931.  
  3932. /************************************************************************************************************/
  3933.  
  3934. int HitDir; ZASM Instruction:
  3935. LINKHITDIR
  3936.  
  3937. /**
  3938. * The direction Link should bounce in when he is hit. This is mostly useful for
  3939. * simulating getting hit by setting Link->Action to LA_GOTHURTLAND.
  3940. *
  3941. * This value does nothing if Link->Action does not equal LA_GOTHURTLAND or LA_GOTHURTWATER.
  3942. * Forcing this value to -1 prevent Link from being knocked back when injured, or when touching any enemy.
  3943. *
  3944. */ Example Use: !#!
  3945.  
  3946. /************************************************************************************************************/
  3947.  
  3948. int WarpEffect; ZASM Instruction:
  3949. WARPEFFECT
  3950.  
  3951. /**
  3952. * Sets a warp effect type prior to doing Screen->Warp
  3953. * These replicate the in-build effects for tile warps.
  3954. * see 'std_constants.zh' under WARPFX_* for a list of effects.
  3955. *
  3956. */ Example Use: !#!
  3957.  
  3958. /************************************************************************************************************/
  3959.  
  3960. int WarpSound; ZASM Instruction:
  3961. LINKWARPSOUND
  3962.  
  3963. /**
  3964. * Setting this to a value other than '0' will play that sound when Link warps.
  3965. *
  3966. */ Example Use: !#!
  3967.  
  3968. /************************************************************************************************************/
  3969.  
  3970. bool SideWarpSounds; ZASM Instruction:
  3971. PLAYWARPSOUND
  3972.  
  3973. /**
  3974. * By default, even if you set a warp sound, it will not play in sidewarps.
  3975. * If you enable this setting, the sound will play in side warps.
  3976. * At present, this does not disable playing the sound otherwise. Set Link->WarpSound = 0 to do that.
  3977. *
  3978. */ Example Use: !#!
  3979.  
  3980. /************************************************************************************************************/
  3981.  
  3982. bool PitWarpSounds; ZASM Instruction:
  3983. PLAYPITWARPSFX
  3984.  
  3985. /**
  3986. * By default, even if you set a warp sound, it will not play in pit warps.
  3987. * If you enable this setting, the sound will play in a pit warp, one time.
  3988. * This value resets after the pit warp, so it is mandatory to re-set it each time tat you desire a pit warp
  3989. * to play a sound. Do this before Waitdraw().
  3990. *
  3991. */ Example Use: !#!
  3992.  
  3993. /************************************************************************************************************/
  3994.  
  3995. int UseWarpReturn; ZASM Instruction:
  3996. LINKRETSQUARE
  3997.  
  3998. /**
  3999. * Setting this to a value between 0 and 3 will change the target return square for Link->Warp
  4000. * Valid values are: 0 (A), 1 (B), 2 (C), and 3 (D). Other values will be clamed within this range.
  4001. *
  4002. */ Example Use: !#!
  4003.  
  4004. /************************************************************************************************************/
  4005.  
  4006. int UsingItem; ZASM Instruction:
  4007. LINKUSINITEM
  4008.  
  4009. /**
  4010. * Returns the ID of an item used when Link uses an item.
  4011. * Returns -1 if Link is not using an item this frame.
  4012. * Does not work at present.
  4013. *
  4014. */ Example Use: !#!
  4015.  
  4016. /************************************************************************************************************/
  4017.  
  4018. int UsingItemA; ZASM Instruction:
  4019. LINKUSINITEMA
  4020.  
  4021. /**
  4022. * Returns the ID of an item used when Link uses an item on button A.
  4023. * Returns -1 if Link is not using an item this frame.
  4024. * Does not work at present.
  4025. *
  4026. */ Example Use: !#!
  4027.  
  4028. /************************************************************************************************************/
  4029.  
  4030. int UsingItemB; ZASM Instruction:
  4031. LINKUSINITEMB
  4032.  
  4033. /**
  4034. * Returns the ID of an item used when Link uses an item on button B.
  4035. * Returns -1 if Link is not using an item this frame.
  4036. * Does not work at present.
  4037. *
  4038. */ Example Use: !#!
  4039.  
  4040. /************************************************************************************************************/
  4041.  
  4042. bool Diagonal; ZASM Instruction:
  4043. LINKDIAG
  4044.  
  4045. /**
  4046. * This corresponds to whether 'Diagonal Movement' is enabled, or not.
  4047. * This will initially return true, or false, based on the setting in Quest->Graphics->Sprites->Link.
  4048. * You may enable, or disable diagonal movement by writing to this value.
  4049. *
  4050. */ Example Use: !#!
  4051.  
  4052. /************************************************************************************************************/
  4053.  
  4054. bool BigHitbox; ZASM Instruction:
  4055. LINKBIGHITBOX
  4056.  
  4057. /**
  4058. * This corresponds to whether 'Big Hitbox' is enabled, or not.
  4059. * This will initially return true, or false, based on the setting in Quest->Graphics->Sprites->Link.
  4060. * You may enable, or disable big hitbox, by writing to this value.
  4061. *
  4062. */ Example Use: !#!
  4063.  
  4064. /************************************************************************************************************/
  4065.  
  4066. int HP; ZASM Instruction:
  4067. LINKHP
  4068.  
  4069. /**
  4070. * Link's current hitpoints, in 16ths of a heart.
  4071. *
  4072. */ Example Use: !#!
  4073.  
  4074. /************************************************************************************************************/
  4075.  
  4076. int MP; ZASM Instruction:
  4077. LINKMP
  4078.  
  4079. /**
  4080. * Link's current amount of magic, in 32nds of a magic block.
  4081. *
  4082. */ Example Use: !#!
  4083.  
  4084. /************************************************************************************************************/
  4085.  
  4086. int MaxHP; ZASM Instruction:
  4087. LINKMAXHP
  4088.  
  4089. /**
  4090. * Link's maximum hitpoints, in 16ths of a heart.
  4091. *
  4092. */ Example Use: !#!
  4093.  
  4094. /************************************************************************************************************/
  4095.  
  4096. int MaxMP; ZASM Instruction:
  4097. LINKMAXMP
  4098.  
  4099. /**
  4100. * Link's maximum amount of magic, in 32nds of a magic block.
  4101. *
  4102. */ Example Use: !#!
  4103.  
  4104. /************************************************************************************************************/
  4105.  
  4106. int Action; ZASM Instruction:
  4107. LINKACTION<>
  4108.  
  4109. /**
  4110. * Link's current action. Use the LA_ constants in std.zh to set or
  4111. * compare this value.
  4112. * This value is read-write, but writing some actions are undefined in this
  4113. * version of ZC. The following are known to work if you write to them:
  4114. *
  4115. * LA_NONE
  4116. * LA_WALKING
  4117. * LA_ATTACKING
  4118. * LA_FROZEN //Verify
  4119. * LA_HOLD1LAND
  4120. * LA_HOLD2LAND
  4121. * LA_GOTHURTLAND
  4122. * LA_SWIMMING
  4123. * LA_GOTHURTWATER
  4124. * LA_HOLD1WATER
  4125. * LA_HOLD2WATER
  4126. * LA_CASTING
  4127. * LA_DROWNING
  4128. * LA_CHARGING //Resets chargeclock?
  4129. * LA_SPINNING //Resets spinclock?
  4130. * LA_DIVING //Verify
  4131. *
  4132. */ Example Use: !#!
  4133.  
  4134. /************************************************************************************************************/
  4135.  
  4136. int HeldItem; ZASM Instruction:
  4137. LINKHELD<>
  4138.  
  4139. /**
  4140. * Link's current action. Use the LA_ constants in std.zh to set or
  4141. * The item that Link is currently holding up; reading or setting this
  4142. * field is undefined if Link's action is not current a hold action.
  4143. * Use the I_ constants in std.zh to specify the item, or -1 to show
  4144. * no item. Setting HeldItem to values other than -1 or a valid item
  4145. * ID is undefined.
  4146. *
  4147. */ Example Use: !#!
  4148.  
  4149. /************************************************************************************************************/
  4150.  
  4151. int LadderX; ZASM Instruction:
  4152. LINKLADDERX
  4153.  
  4154. /**
  4155. * The X position of Link's stepladder, or 0 if no ladder is onscreen.
  4156. * This is read-only; while setting it is not syntactically incorrect, it does nothing.
  4157. *
  4158. */ Example Use: !#!
  4159.  
  4160. /************************************************************************************************************/
  4161.  
  4162. int LadderY; ZASM Instruction:
  4163. LINKLADDERY
  4164.  
  4165. /**
  4166. * The Y position of Link's stepladder, or 0 if no ladder is onscreen.
  4167. * This is read-only; while setting it is not syntactically incorrect, it does nothing.
  4168. *
  4169. */ Example Use: !#!
  4170.  
  4171. /************************************************************************************************************/
  4172.  
  4173.  
  4174.  
  4175. *** Input Functions ***
  4176. * The following Input* boolean values return true if the player is pressing
  4177. * the corresponding button, analog stick, or key. Writing to this variable simulates
  4178. * the press or release of that referenced button, analog stick, or key.
  4179. *
  4180. * These have been SUPERCEDED by:
  4181. * Game->ButtonPress[], Game->ButtonInput[], Game->ButtonHeld[], and Game->JoypadPress[]
  4182. * Those arrays should be used if possible.
  4183. */
  4184.  
  4185. bool InputStart; ZASM: INPUTSTART
  4186.  
  4187. bool InputMap; ZASM: INPUTMAP
  4188.  
  4189. bool InputUp; ZASM: INPUTUP
  4190.  
  4191. bool InputDown; ZASM: INPUTDOWN
  4192.  
  4193. bool InputLeft; ZASM: INPUTLEFT
  4194.  
  4195. bool InputRight; ZASM: INPUTRIGHT
  4196.  
  4197. bool InputA; ZASM: INPUTA
  4198.  
  4199. bool InputB; ZASM: INPUTB
  4200.  
  4201. bool InputL; ZASM: INPUTL
  4202.  
  4203. bool InputR; ZASM: INPUTR
  4204.  
  4205. bool InputEx1 ZASM: INPUTEX1
  4206.  
  4207. bool InputEx2 ZASM: INPUTEX2
  4208.  
  4209. bool InputEx3 ZASM: INPUTEX3
  4210.  
  4211. bool InputEx4 ZASM: INPUTEX4
  4212.  
  4213. bool InputAxisUp; ZASM: INPUTAXISUP
  4214.  
  4215. bool InputAxisDown; ZASM: INPUTAXISDOWN
  4216.  
  4217. bool InputAxisLeft; ZASM: INPUTAXISLEFT
  4218.  
  4219. bool InputAxisRight; ZASM: INPUTAXISRIGHT
  4220.  
  4221.  
  4222. *** Press Functions ***
  4223. /**
  4224. * The following Press* boolean values return true if the player activated
  4225. * the corresponding button, analog stick, or key this frame. Writing to this
  4226. * variable simulates the press or release of that referenced button, analog stick,
  4227. * or keys input press state.
  4228. */
  4229.  
  4230.  
  4231. bool PressStart; ZASM: INPUTPRESSSTART
  4232.  
  4233. bool PressMap; ZASM: INPUTPRESSMAP
  4234.  
  4235. bool PressUp; ZASM: INPUTPRESSUP
  4236.  
  4237. bool PressDown; ZASM: INPUTPRESSDOWN
  4238.  
  4239. bool PressLeft; ZASM: INPUTPRESSLEFT
  4240.  
  4241. bool PressRight; ZASM: INPUTPRESSRIGHT
  4242.  
  4243. bool PressA; ZASM: INPUTPRESSA
  4244.  
  4245. bool PressB; ZASM: INPUTPRESSB
  4246.  
  4247. bool PressL; ZASM: INPUTPRESSL
  4248.  
  4249. bool PressR; ZASM: INPUTPRESSR
  4250.  
  4251. bool PressEx1 ZASM: INPUTPRESSEX1
  4252.  
  4253. bool PressEx2 ZASM: INPUTPRESSEX2
  4254.  
  4255. bool PressEx3 ZASM: INPUTPRESSEX3
  4256.  
  4257. bool PressEx4 ZASM: INPUTPRESSEX4
  4258.  
  4259. bool PressAxisUp; ZASM: PRESSAXISUP
  4260.  
  4261. bool PressAxisDown; ZASM: PRESSAXISDOWN
  4262.  
  4263. bool PressAxisLeft; ZASM: PRESSAXISLEFT
  4264.  
  4265. bool PressAxisRight; ZASM: PRESSAXISRIGHT
  4266.  
  4267. /************************************************************************************************************/
  4268.  
  4269. int InputMouseX; ZASM Instruction:
  4270. INPUTMOUSEX
  4271.  
  4272. /**
  4273. * The mouse's in-game X position. This value is undefined if
  4274. * the mouse pointer is outside the Zelda Classic window.
  4275. *
  4276. */ Example Use: !#!
  4277.  
  4278. /************************************************************************************************************/
  4279.  
  4280. int InputMouseY; ZASM Instruction:
  4281. INPUTMOUSEY
  4282.  
  4283. /**
  4284. * The mouse's in-game Y position. This value is undefined if
  4285. * the mouse pointer is outside the Zelda Classic window.
  4286. *
  4287. */ Example Use: !#!
  4288.  
  4289. /************************************************************************************************************/
  4290.  
  4291. int InputMouseB; ZASM Instruction:
  4292. INPUTMOUSEB
  4293.  
  4294. /**
  4295. * Whether the left or right mouse buttons are pressed, as two flags OR'd (|) together;
  4296. * use the MB_ constants or the Input'X'Click functions in std.zh to check the button states.
  4297. * InputMouseB is read only; while setting it is not syntactically incorrect, it does nothing
  4298. * If you are not comfortable with binary, you can use the InputMouse'x' functions in std.zh
  4299. *
  4300. */ Example Use: !#!
  4301.  
  4302. /************************************************************************************************************/
  4303.  
  4304. int InputMouseZ; ZASM Instruction:
  4305. INPUTMOUSEB
  4306.  
  4307. /**
  4308. * The current state of the mouse's scroll wheel, negative for scrolling down and positive for scrolling up.
  4309. *
  4310. */ Example Use: !#!
  4311.  
  4312. /************************************************************************************************************/
  4313.  
  4314. bool Item[256]; ZASM Instruction:
  4315. LINKITEMD
  4316.  
  4317. /**
  4318. * True if Link's inventory contains the item whose ID is the index of
  4319. * the array access. Use the I_ constants in std.zh as an index into this array.
  4320. *
  4321. */ Example Use: !#!
  4322.  
  4323. /************************************************************************************************************/
  4324.  
  4325. bool DisableItem[256]; ZASM Instruction:
  4326. DISABLEDITEM
  4327. /*
  4328. * An array of 256 values that represents whether items are disabeld on the current DMap.
  4329. * A disabled item returns 'true'.
  4330. * Writing to this array should disable or enable an item on the current DMap, but the behaviour
  4331. * if Link does not have that item MAY not be fully defined.
  4332. *
  4333. */ Example Use:
  4334.  
  4335. /************************************************************************************************************/
  4336.  
  4337. int Equipment; ZASM Instruction:
  4338. LINKEQUIP
  4339.  
  4340. /**
  4341. * Contains the item IDs of what is currently equiped to Link's A and B buttons.
  4342. * The first 8 bits contain the A button item, and the second 8 bits contain the B button item.
  4343. * If you are not comfortable with performing binary operations,
  4344. * you can use the functions GetEquipmentA() or GetEquipmentB() in std.zh.
  4345. *
  4346. */ Example Use: !#!
  4347.  
  4348. /************************************************************************************************************/
  4349.  
  4350. int ItemA; ZASM Instruction:
  4351. LINKITEMA
  4352.  
  4353. /**
  4354. * Contains the item IDs of what is currently equiped to Link's A button.
  4355. * Writing to this variable will set an item to the A-button.
  4356. * This will occur even if the item is not in inventory, and not on the subscreen.
  4357. * This will ignore if you have B+A or B-only subscreens, and force-set the item.
  4358. * The intent of this is to allow scriters to easily create scripted subscreens.
  4359. *
  4360. */ Example Use: !#!
  4361.  
  4362. /************************************************************************************************************/
  4363.  
  4364. int ItemB; ZASM Instruction:
  4365. LINKITEMB
  4366.  
  4367. /**
  4368. * Contains the item IDs of what is currently equiped to Link's B button.
  4369. * Writing to this variable will set an item to the A-button.
  4370. * This will occur even if the item is not in inventory, and not on the subscreen.
  4371. * The intent of this is to allow scriters to easily create scripted subscreens.
  4372. *
  4373. */ Example Use: !#!
  4374.  
  4375. /************************************************************************************************************/
  4376.  
  4377. int SetItemSlot(int itm_id, int slot, int force);
  4378. ZASM Instruction:
  4379. SETITEMSLOT
  4380.  
  4381. /**
  4382. * This allows you to set Link's button items without binary operations, and to decide whether to
  4383. * obey quest rules, or inventory.
  4384. *
  4385. * When using this, 'itm_id' is the ID number of the item.
  4386. * Set 'slot' to one of the following: 0 == Slot B, 1 == Slot A
  4387. * Other buttons may be added int he future, and other values for ;slot' are thus, reserved.
  4388. * Set the flags on 'force' as follows:
  4389. * const int ITM_REQUIRE_NONE = 0
  4390. * const int ITM_REQUIRE_INVENTORY = 1
  4391. * const int ITM_REQUIRE_A_SLOT_RULE = 2
  4392. * Thus, require both inventory, and following quest slot rules, force == 3.
  4393. *
  4394. */ Example Use: !#!
  4395.  
  4396. /************************************************************************************************************/
  4397.  
  4398. int Tile; ZASM Instruction:
  4399. LINKTILE
  4400.  
  4401. /**
  4402. * The current tile associated with Link. The effect of writing to this variable is undefined.
  4403. * Because Link's tile is not determined until he is drawn, this will actually represent
  4404. * Link's tile in the previous frame.
  4405. *
  4406. */ Example Use: !#!
  4407.  
  4408. /************************************************************************************************************/
  4409.  
  4410. int Flip; ZASM Instruction:
  4411. LINKFLIP
  4412.  
  4413. /**
  4414. * The flip value of current tile associated with Link.
  4415. * The effect of writing to this variable is undefined (will do nothing).
  4416. * Because Link's tile is not determined until he is drawn, this will actually represent
  4417. * Link's tile flip in the previous frame.
  4418. *
  4419. */ Example Use: !#!
  4420.  
  4421.  
  4422. /************************************************************************************************************/
  4423.  
  4424. int Eaten; ZASM Instruction:
  4425. LINKEATEN
  4426.  
  4427. /**
  4428. * This stores a counter for how long Link has been inside a LikeLike, or similar enemy.
  4429. * It returns 0 if Link is not eaten, otherwise it returns the duration of him being eaten.
  4430. *
  4431. */ Example Use: !#!
  4432.  
  4433. /************************************************************************************************************/
  4434.  
  4435. int Extend; ZASM Instruction:
  4436. LINKEXTEND
  4437.  
  4438. /**
  4439. * Sets the extend value for all of Link's various actions for his current sprite, and direction.
  4440. * This is equivalent to the Extend value set in Quest->Graphics->Sprites->Link when selecting
  4441. * a tile, click on his sprites for any given action, and press the 'x' key.
  4442. * The options are 16x16, 16x32, and 32x32; which correspond to Extend values of ( 0, 1, and 2 )
  4443. * respectively.
  4444. *
  4445. * This also returns the present extend value of Link's sprite for his current direction and sprite.
  4446. *
  4447. * You may force-set all sprites, and directions to an extend value by assigning a negative number to
  4448. * this variable, where -1 == 0 -2 == 1, -3 == 2, -4 == 3, and -5 == 4.
  4449. *
  4450. * See the 'LINKEXTEND_* values in std_constants for more details.
  4451. */
  4452.  
  4453. /************************************************************************************************************/
  4454.  
  4455. int GetLinkExtend(int sprite, int dir); ZASM Instruction:
  4456. SETLINKEXTEND
  4457.  
  4458. /**
  4459. * Gets the extend value for one of Link's various actions based on a direction.
  4460. * This is equivalent to the Extend value set in Quest->Graphics->Sprites->Link when selecting a tile.
  4461. * See 'std_constants' entries under LSPR_* for a list of the various attributes for 'sprite'.
  4462. */
  4463.  
  4464. /************************************************************************************************************/
  4465.  
  4466. void SetLinkExtend(int sprite, int dir, int extend);
  4467. ZASM Instruction:
  4468. SETLINKEXTEND
  4469.  
  4470. /**
  4471. * Sets the extend value for one of Link's various actions.
  4472. * This is equivalent to the Extend value set in Quest->Graphics->Sprites->Link when selecting a tile.
  4473. * 'sprite' is the 'action', 'dir' is the sprite direction, and 'extend' is a value between 1 and 3.
  4474. * An extend value of '4' is reserved for future implementations of Link->Hit/DrawOffsets ad HitWidth/height.
  4475. * See 'std_constants' entries under LSPR_* for a list of the various attributes for 'sprite'.
  4476. *
  4477. * See the 'LINKEXTEND_* values in std_constants for more details on possible extend values.
  4478. */
  4479.  
  4480.  
  4481. /************************************************************************************************************/
  4482.  
  4483. void SetLinkTile(int sprite, int dir, int tile)
  4484. ZASM Instruction:
  4485. SETLINKTILE
  4486.  
  4487. /**
  4488. * Sets the tile for Link's various actions. This is intended to work as OTile for Link.
  4489. * 'sprite' is the action for the tile. See Quest->Graphics->Sprites->Link for a visual reference.
  4490. * 'tile is the base tile for the sequence. It uses the animation style set in the sprites editor.
  4491. * 'dir' is the direction for the tile.
  4492. * See 'std_constants' entries under LSPR_* for a list of the various attributes for 'sprite'.
  4493. *
  4494. * See the 'LINKEXTEND_* values in std_constants for more details on possible extend values.
  4495. */
  4496.  
  4497. /************************************************************************************************************/
  4498.  
  4499. int GetLinkTile(int sprite, int dir)
  4500. ZASM Instruction:
  4501. LINKGETTILE
  4502.  
  4503. /**
  4504. * Returns the OTile for one of Link's various actions.
  4505. * 'sprite' is the action for the tile. See Quest->Graphics->Sprites->Link for a visual reference.
  4506. * 'dir' is the direction for the tile.
  4507. * See 'std_constants' entries under LSPR_* for a list of the various attributes for 'sprite'.
  4508. */
  4509.  
  4510. /************************************************************************************************************/
  4511.  
  4512. int WalkTile, SwimTile, DiveTile, SlashTile, JumpTile, ChargeTile, StabTile, CastingTile, PoundTile, FloatTile
  4513. Hold1LandTile, Hold2LandTile, Hold1WaterTile, Hold2WaterTile;
  4514.  
  4515. ZASM Instructions:
  4516. LINKWALKTILE, LINKSWIMTILE, LINKDIVETILE, LINKSLASHTILE, LINKJUMPTILE
  4517. LINKCHARGETILE, LINKSTABTILE, LINKCASTTILE, LINKPOUNDTILE, LINKFLOATTILE,
  4518. LINKHOLD1LTILE, LINKHOLD2LTILE, LINKHOLD1WTILE, LINKHOLD2WTILE
  4519.  
  4520. /**
  4521. * A series of fourteen individual setter/getter ints to set or return the tile for all of Link's various actions.
  4522. *
  4523. * In future, setting this values of 0 through 4 will set Link->Extend based on Link's present drection and
  4524. * sprite and values of -1 through -5 will force Extend = 0 through Extend = 4 for all sprites and directions.
  4525. *
  4526. * Checking this will return the tile value for the desired sprite using Link's current direction.
  4527. * Setting this will set the tile for the sprite in Link's current direction.
  4528. *
  4529. * These exist to manually test getting, and setting values to these sprites, and are scheduled to be removed
  4530. * in a future build, supplanted by Link->SetLinkTile(int sprite, int dir, int tile)
  4531. */
  4532.  
  4533. /************************************************************************************************************/
  4534.  
  4535. int HitHeight; ZASM Instruction:
  4536. LINKHYSZ
  4537.  
  4538. /**
  4539. * link's Hitbox height in pixels.
  4540. * This is not usable, as Link->Extend cannot be set.
  4541. * While setting it is not syntactically incorrect, it does nothing.
  4542. * You can read a value that you assign to this (e.g. for custom collision functions).
  4543. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4544. *
  4545. */ Example Use: !#!
  4546.  
  4547. /************************************************************************************************************/
  4548.  
  4549. int HitWidth; ZASM Instruction:
  4550. LINKHXSZ
  4551.  
  4552. /**
  4553. * link's Hitbox width in pixels.
  4554. * This is not usable, as Link->Extend cannot be set.
  4555. * While setting it is not syntactically incorrect, it does nothing.
  4556. * You can read a value that you assign to this (e.g. for custom collision functions).
  4557. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4558. *
  4559. */ Example Use: !#!
  4560.  
  4561. /************************************************************************************************************/
  4562.  
  4563. int TileWidth; ZASM Instruction:
  4564. LINKTYSZ
  4565. /**
  4566. * Link's width, in tiles.
  4567. * This is not usable, as Link->Extend cannot be set.
  4568. * While setting it is not syntactically incorrect, it does nothing.
  4569. * You can read a value that you assign to this (e.g. for custom/proxy sprite drawing).
  4570. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4571. *
  4572. */ Example Use: !#!
  4573.  
  4574. /************************************************************************************************************/
  4575.  
  4576. int TileHeight; ZASM Instruction:
  4577. LINKTXSZ
  4578.  
  4579. /**
  4580. * Link's height, in tiles.
  4581. * This is not usable, as Link->Extend cannot be set.
  4582. * While setting it is not syntactically incorrect, it does nothing.
  4583. * You can read a value that you assign to this (e.g. for custom/proxy sprite drawing).
  4584. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4585. *
  4586. */ Example Use: !#!
  4587.  
  4588. /************************************************************************************************************/
  4589.  
  4590. int HitZHeight; ZASM Instruction:
  4591. LINKHZSZ
  4592.  
  4593. /**
  4594. * The Z-axis height of Link's hitbox, or collision rectangle.
  4595. * The lower it is, the lower a flying or jumping enemy must fly in order to hit Link.
  4596. * To jump over a sprite, you must be higher than its Z + HitZHeight.
  4597. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  4598. * Writing to this is ignored unless Extend is set to values >=3.
  4599. * This is not usable, as Link->Extend cannot be set.
  4600. * While setting it is not syntactically incorrect, it does nothing.
  4601. * You can read a value that you assign to this (e.g. for custom collision functions).
  4602. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4603. *
  4604. */ Example Use: !#!
  4605.  
  4606. /************************************************************************************************************/
  4607.  
  4608. int HitXOffset; ZASM Instruction:
  4609. LINKHXOFS
  4610.  
  4611. /**
  4612. * The X offset of Link's hitbox, or collision rectangle.
  4613. * Setting it to positive or negative values will move Link's hitbox left or right.
  4614. * Writing to this is ignored unless Extend is set to values >=3.
  4615. * This is not usable, as Link->Extend cannot be set.
  4616. * While setting it is not syntactically incorrect, it does nothing.
  4617. * You can read a value that you assign to this (e.g. for custom collision functions).
  4618. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4619. *
  4620. */ Example Use: !#!
  4621.  
  4622. /************************************************************************************************************/
  4623.  
  4624. int HitYOffset; ZASM Instruction:
  4625. LINKHYOFS
  4626.  
  4627. /**
  4628. * The Y offset of Link's hitbox, or collision rectangle.
  4629. * Setting it to positive or negative values will move Link's hitbox up or down.
  4630. * Writing to this is ignored unless Extend is set to values >=3.
  4631. * This is not usable, as Link->Extend cannot be set.
  4632. * While setting it is not syntactically incorrect, it does nothing.
  4633. * You can read a value that you assign to this (e.g. for custom collision functions).
  4634. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4635. *
  4636. */ Example Use: !#!
  4637.  
  4638. /************************************************************************************************************/
  4639.  
  4640. int DrawXOffset; ZASM Instruction:
  4641. LINKXOFS
  4642.  
  4643. /**
  4644. * The X offset of Link's sprite.
  4645. * Setting it to positive or negative values will move the sprite's tiles left or right relative to its position.
  4646. * Writing to this is ignored unless Extend is set to values >=3.
  4647. * This is not usable, as Link->Extend cannot be set.
  4648. * While setting it is not syntactically incorrect, it does nothing.
  4649. * You can read a value that you assign to this.
  4650. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4651. *
  4652. */ Example Use: !#!
  4653.  
  4654. /************************************************************************************************************/
  4655.  
  4656. int DrawYOffset; ZASM Instruction:
  4657. LINKYOFS
  4658.  
  4659. /**
  4660. * The Y offset of Link's sprite.
  4661. * Setting it to positive or negative values will move the sprite's tiles up or down relative to its position.
  4662. * Writing to this is ignored unless Extend is set to values >=3.
  4663. * This is not usable, as Link->Extend cannot be set.
  4664. * While setting it is not syntactically incorrect, it does nothing.
  4665. * You can read a value that you assign to this.
  4666. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4667. *
  4668. */ Example Use: !#!
  4669.  
  4670. /************************************************************************************************************/
  4671.  
  4672. int DrawZOffset; ZASM Instruction:
  4673. LINKZOFS
  4674.  
  4675. /**
  4676. * The Z offset of Link's sprite.
  4677. * Writing to this is ignored unless Extend is set to values >=3.
  4678. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  4679. * This is not usable, as Link->Extend cannot be set.
  4680. * While setting it is not syntactically incorrect, it does nothing.
  4681. * You can read a value that you assign to this.
  4682. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  4683. *
  4684. */ Example Use: !#!
  4685.  
  4686. /************************************************************************************************************/
  4687.  
  4688. float Misc[32]; ZASM Instruction:
  4689. LINKMISC
  4690. LINKMISCD
  4691.  
  4692. /**
  4693. * An array of 32 miscellaneous variables for you to use as you please.
  4694. * These variables are not saved with Link.
  4695. *
  4696. */ Example Use: !#!
  4697.  
  4698. /************************************************************************************************************/
  4699.  
  4700. void Warp(int DMap, int screen); ZASM Instruction:
  4701. WARP
  4702. WARPR
  4703.  
  4704. /**
  4705. * Warps link to the given screen in the given DMap, just like if he'd
  4706. * triggered an 'Insta-Warp'-type warp.
  4707. *
  4708. */ Example Use: !#!
  4709.  
  4710. /************************************************************************************************************/
  4711.  
  4712. void PitWarp(int DMap, int screen); ZASM Instruction:
  4713. PITWARP
  4714. PITWARPR
  4715.  
  4716. /**
  4717. * This is identical to Warp, but Link's X and Y positions are preserved
  4718. * when he enters the destination screen, rather than being set to the
  4719. * Warp Return square.
  4720. *
  4721. */ Example Use: !#!
  4722.  
  4723. /************************************************************************************************************/
  4724.  
  4725. SelectAWeapon(int dir); ZASM Instruction:
  4726. !#!
  4727.  
  4728. /**
  4729. * Sets the A button item to the next one in the given direction based on
  4730. * the indices set in the subscreen. This will skip over items if A and B
  4731. * would be set to the same item.
  4732. * If the quest rule "Can Select A-Button Weapon On Subscreen" is disabled,
  4733. * this function does nothing.
  4734. *
  4735. */ Example Use: !#!
  4736.  
  4737. /************************************************************************************************************/
  4738.  
  4739. SelectBWeapon(int dir); ZASM Instruction:
  4740. !#!
  4741.  
  4742. /**
  4743. * Sets the B button item to the next one in the given direction based on
  4744. * the indices set in the subscreen. This will skip over items if A and B
  4745. * would be set to the same item.
  4746. *
  4747. */ Example Use: !#!
  4748.  
  4749.  
  4750. /************************************************************************************************************/
  4751. /************************************************************************************************************/
  4752.  
  4753.  
  4754. //===================================
  4755. //--- NPC Functions and Variables ---
  4756. //===================================
  4757.  
  4758. class npc
  4759.  
  4760.  
  4761. float UID; ZASM Instruction:
  4762. NPCUID
  4763. /**
  4764. * Returns the UID of an npc.
  4765. */ Example Use:
  4766.  
  4767. /************************************************************************************************************/
  4768.  
  4769. int GetPointer(npc *ptr[]); ZASM Instruction:
  4770. NPCARRPTR
  4771. /**
  4772. * Returns the pointer of a item array as a float.
  4773. */ Example Use:
  4774. item arr[16];
  4775. int size = SizeOfArray( GetPointer(arr) );
  4776. //Size == 16
  4777.  
  4778. /************************************************************************************************************/
  4779.  
  4780. npc SetPointer(int value); ZASM Instruction:
  4781. NPCARRPTR2
  4782. /**
  4783. * Converts an int pointer to the npc type, for assigning.
  4784. */ Example Use:
  4785. npc arr[16]; npc arrB[2]; int arrC[2];
  4786. arrC[0] = GetPointer(arr);
  4787. arrB[0] = SetPointer(arrC[0]);
  4788.  
  4789. /************************************************************************************************************/
  4790.  
  4791. bool isValid(); ZASM Instruction:
  4792. ISVALIDNPC
  4793. /**
  4794. * Returns whether or not this NPC pointer is still valid. A pointer
  4795. * becomes invalid if the enemy dies or Link leaves the screen.
  4796. * Trying to access any variable of an invalid NPC pointer prints
  4797. * an error to allegro.log and does nothing.
  4798. */
  4799.  
  4800. /************************************************************************************************************/
  4801.  
  4802. void GetName(int buffer[]); ZASM Instruction:
  4803. NPCNAME
  4804. /**
  4805. * Loads the npc's name into 'buffer'. To load an NPC from an ID rather than a pointer,
  4806. * use 'GetNPCName' from std.zh
  4807. */
  4808.  
  4809. /************************************************************************************************************/
  4810.  
  4811. int ID; ZASM Instruction:
  4812. NPCID
  4813. /**
  4814. * The NPC's enemy ID number.
  4815. * npc->ID is read-only; while setting it is not syntactically incorrect, it does nothing.
  4816. */
  4817.  
  4818. /************************************************************************************************************/
  4819.  
  4820. int Type; ZASM Instruction:
  4821. NPCTYPE
  4822. /**
  4823. * The NPC's Type. Use the NPCT_ constants in std.zh to compare this value.
  4824. * npc->Type is read-only; while setting it is not syntactically incorrect, it does nothing.
  4825. */
  4826.  
  4827. /************************************************************************************************************/
  4828.  
  4829. int X; ZASM Instruction:
  4830. NPCX
  4831. /**
  4832. * The NPC's current X coordinate, in pixels. Float values passed to this will be cast to int.
  4833. */
  4834.  
  4835. /************************************************************************************************************/
  4836.  
  4837. int Y; ZASM Instruction:
  4838. NPCY
  4839. /**
  4840. * The NPC's current Y coordinate, in pixels. Float values passed to this will be cast to int.
  4841. */
  4842.  
  4843. /************************************************************************************************************/
  4844.  
  4845. int Z; ZASM Instruction:
  4846. NPCZ
  4847. /**
  4848. * The NPC's current Z coordinate, in pixels. Float values passed to this will be cast to int.
  4849. */
  4850.  
  4851. /************************************************************************************************************/
  4852.  
  4853. int Jump; ZASM Instruction:
  4854. NPCJUMP
  4855. /**
  4856. * The NPC's upward velocity, in pixels. If negative, the NPC will fall.
  4857. * The downward acceleration of Gravity (in Init Data) modifies this value every frame.
  4858. */
  4859.  
  4860. /************************************************************************************************************/
  4861.  
  4862. int Dir; ZASM Instruction:
  4863. NPCDIR
  4864. /**
  4865. * The direction the NPC is facing. Use the DIR_ constants in std.zh to
  4866. * set and compare this value.
  4867. */
  4868.  
  4869. /************************************************************************************************************/
  4870.  
  4871. int Rate; ZASM Instruction:
  4872. NPCRATE
  4873. /**
  4874. * The rate at which the NPC changes direction. For a point of reference,
  4875. * the "Octorok (Magic)" enemy has a rate of 16. The effect of writing to
  4876. * this field is currently undefined.
  4877. */
  4878.  
  4879. /************************************************************************************************************/
  4880.  
  4881. int Haltrate; ZASM Instruction:
  4882. NPCHALTRATE
  4883. /**
  4884. * The extent to which the NPC stands still while moving around the
  4885. * screen. As a point of reference, the Zols and Gels have haltrate of
  4886. * 16. The effect of writing to this field is currently undefined.
  4887. */
  4888.  
  4889. /************************************************************************************************************/
  4890.  
  4891. int Homing; ZASM Instruction:
  4892. NPCHOMING
  4893. /**
  4894. * How likely the NPC is to move towards Link.
  4895. * The effect of writing to this field is currently undefined.
  4896. */
  4897.  
  4898. /************************************************************************************************************/
  4899.  
  4900. int Hunger; ZASM Instruction:
  4901. NPRCHUNGE
  4902. /**
  4903. * How likely the NPC is to move towards bait.
  4904. * The effect of writing to this field is currently undefined.
  4905. */
  4906.  
  4907. /************************************************************************************************************/
  4908.  
  4909. int Step; ZASM Instruction:
  4910. NPCSTEP
  4911. /**
  4912. * The NPC's movement speed. A Step of 100 usually means that
  4913. * the enemy moves at approximately one pixel per animation frame.
  4914. * As a point of reference, the "Octorok (Magic)" enemy has
  4915. * a step of 200. The effect of writing to this field is
  4916. * currently undefined.
  4917. */
  4918.  
  4919. /************************************************************************************************************/
  4920.  
  4921. bool CollDetection; ZASM Instruction:
  4922. NPCCOLLDET
  4923. /**
  4924. * Whether the NPC will use the system's code to work out collisions with Link
  4925. * Initialised as 'true'.
  4926. */
  4927.  
  4928. /************************************************************************************************************/
  4929.  
  4930. int ASpeed; ZASM Instruction:
  4931. NPCFRAMERATE
  4932. /**
  4933. * The the NPC's animation frame rate, in screen frames. The effect of
  4934. * writing to this field is currently undefined.
  4935. */
  4936.  
  4937. /************************************************************************************************************/
  4938.  
  4939. int DrawStyle; ZASM Instruction:
  4940. NPCDRAWTYPE
  4941. /**
  4942. * The way the NPC is animated. Use the DS_ constants in std.zh to set or
  4943. * compare this value. The effect of writing to this field is currently undefined.
  4944. */
  4945.  
  4946. /************************************************************************************************************/
  4947.  
  4948. int HP; ZASM Instruction:
  4949. NPCHP
  4950. /**
  4951. * The NPC's current hitpoints. A weapon with a Power of 1 removes 2
  4952. * hitpoints.
  4953. */
  4954.  
  4955. /************************************************************************************************************/
  4956.  
  4957. int Damage; ZASM Instruction:
  4958. NPCDP
  4959. /**
  4960. * The amount of damage dealt to an unprotected Link when he touches this NPC, in
  4961. * quarter-hearts.
  4962. */
  4963.  
  4964. /************************************************************************************************************/
  4965.  
  4966. int WeaponDamage; ZASM Instruction:
  4967. NPCWDP
  4968. /**
  4969. * The amount of damage dealt to an unprotected Link by this NPC's weapon, in
  4970. * quarter-hearts.
  4971. */
  4972.  
  4973. /************************************************************************************************************/
  4974.  
  4975. int Stun; ZASM Instruction:
  4976. NPCSTUN
  4977. /**
  4978. * The time, in frames, that the NPC will be stunned. Some types of enemies cannot be stunned.
  4979. */
  4980.  
  4981. /************************************************************************************************************/
  4982.  
  4983. int OriginalTile; ZASM Instruction:
  4984. NPCOTILE
  4985. /**
  4986. * The number of the starting tile used by this NPC.
  4987. */
  4988.  
  4989. /************************************************************************************************************/
  4990.  
  4991. int Tile; ZASM Instruction:
  4992. NPCTILE
  4993. /**
  4994. * The current tile associated with this NPC. The effect of writing to this variable is undefined.
  4995. */
  4996.  
  4997. /************************************************************************************************************/
  4998.  
  4999. int Weapon; ZASM Instruction:
  5000. NPCWEAPON
  5001. /**
  5002. * The weapon used by this enemy. Use the WPN_ constants (NOT the EW_ constants)
  5003. * in std.zh to set or compare this value.
  5004. */
  5005.  
  5006. /************************************************************************************************************/
  5007.  
  5008. int ItemSet; ZASM Instruction:
  5009. NPCITEMSET
  5010. /**
  5011. * The items that the NPC might drop when killed. Use the IS_ constants
  5012. * in std.zh to set or compare this value.
  5013. */
  5014.  
  5015. /************************************************************************************************************/
  5016.  
  5017. int CSet; ZASM Instruction:
  5018. NPCCSET
  5019. /**
  5020. * The CSet used by this NPC.
  5021. */
  5022.  
  5023. /************************************************************************************************************/
  5024.  
  5025. int BossPal; ZASM Instruction:
  5026. NPCBOSSPAL
  5027. /**
  5028. * The boss pallete used by this NPC; this pallete is only used if CSet
  5029. * is 14 (the reserved boss cset). Use the BPAL_ constants in std.zh to
  5030. * set or compare this value.
  5031. */
  5032.  
  5033. /************************************************************************************************************/
  5034.  
  5035. int SFX; ZASM Instruction:
  5036. NPCBGSFX
  5037. /**
  5038. * The sound effects emitted by the enemy. Use the SFX_ constants in
  5039. * std.zh to set or compare this value.
  5040. */
  5041.  
  5042. /************************************************************************************************************/
  5043.  
  5044. int Extend; ZASM Instruction:
  5045. NPCEXTEND
  5046. /**
  5047. * Whether to extend the sprite of the enemy.
  5048. */
  5049.  
  5050. /************************************************************************************************************/
  5051.  
  5052. int TileWidth; ZASM Instruction:
  5053. NPCTXSZ
  5054. /**
  5055. * The number of tile columns composing the sprite.
  5056. * Writing to this is ignored unless Extend is set to values >=3.
  5057. */
  5058.  
  5059. /************************************************************************************************************/
  5060.  
  5061. int TileHeight; ZASM Instruction:
  5062. NPCTYSZ
  5063. /**
  5064. * The number of tile rows composing the sprite.
  5065. * Writing to this is ignored unless Extend is set to values >=3.
  5066. */
  5067.  
  5068. /************************************************************************************************************/
  5069.  
  5070. int HitWidth; ZASM Instruction:
  5071. NPCHXSZ
  5072. /**
  5073. * The width of the sprite's hitbox, or collision rectangle.
  5074. */
  5075.  
  5076. /************************************************************************************************************/
  5077.  
  5078. int HitHeight; ZASM Instruction:
  5079. NPCHYSZ
  5080. /**
  5081. * The height of the sprite's hitbox, or collision rectangle.
  5082. */
  5083.  
  5084. /************************************************************************************************************/
  5085.  
  5086. int HitZHeight; ZASM Instruction:
  5087. NPCHZSZ
  5088. /**
  5089. * The Z-axis height of the sprite's hitbox, or collision rectangle.
  5090. * The greater it is, the higher Link must jump or fly over the sprite to avoid taking damage.
  5091. * To jump over a sprite, you must be higher than its Z + HitZHeight.
  5092. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  5093. */
  5094.  
  5095. /************************************************************************************************************/
  5096.  
  5097. int HitXOffset; ZASM Instruction:
  5098. NPCHXOFS
  5099. /**
  5100. * The X offset of the sprite's hitbox, or collision rectangle.
  5101. * Setting it to positive or negative values will move the sprite's hitbox left or right.
  5102. */
  5103.  
  5104. /************************************************************************************************************/
  5105.  
  5106. int HitYOffset; ZASM Instruction:
  5107. NPCHYOFS
  5108. /**
  5109. * The Y offset of the sprite's hitbox, or collision rectangle.
  5110. * Setting it to positive or negative values will move the sprite's hitbox up or down.
  5111. */
  5112.  
  5113. /************************************************************************************************************/
  5114.  
  5115. int DrawXOffset; ZASM Instruction:
  5116. NPCXOFS
  5117. /**
  5118. * The X offset of the sprite.
  5119. * Setting it to positive or negative values will move the sprite's tiles left or right relative to its position.
  5120. */
  5121.  
  5122. /************************************************************************************************************/
  5123.  
  5124. int DrawYOffset; ZASM Instruction:
  5125. NPCYOFS
  5126. /**
  5127. * The Y offset of the sprite. In non-sideview screens, this is usually -2.
  5128. * Setting it to positive or negative values will move the sprite's tiles up or down relative to its position.
  5129. */
  5130.  
  5131. /************************************************************************************************************/
  5132.  
  5133. int DrawZOffset; ZASM Instruction:
  5134. NPCZOFS
  5135. /**
  5136. * The Z offset of the sprite. This is ignored unless Extend is set to values >=3.
  5137. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  5138. */
  5139.  
  5140. /************************************************************************************************************/
  5141.  
  5142. int InvFrames; ZASM Instruction:
  5143. NPCINVINC
  5144. /**
  5145. * Returns if the enemy is temporarily invincible, from being hit, or otherwise.
  5146. * Returns the number of remaining invincibility frames if the enemy is invincible, otherwise 0.
  5147. *
  5148. */ Example Use: !#!
  5149.  
  5150. /************************************************************************************************************/
  5151.  
  5152. int Invincible; ZASM Instruction:
  5153. NPCSUPERMAN
  5154. /**
  5155. * Returns if the enemy is invincible, because of ( superman variable ).
  5156. *
  5157. */ Example Use: !#!
  5158.  
  5159. /************************************************************************************************************/
  5160.  
  5161. bool HasItem; ZASM Instruction:
  5162. NPCHASITEM
  5163. /**
  5164. * Returns if the enemy is holding the screen item.
  5165. *
  5166. */ Example Use: !#!
  5167.  
  5168. /************************************************************************************************************/
  5169.  
  5170. bool Ringleader; ZASM Instruction:
  5171. NPCRINGLEAD
  5172. /**
  5173. * Returns if the enemy is a 'ringleader'.
  5174. *
  5175. */ Example Use: !#!
  5176.  
  5177. /************************************************************************************************************/
  5178.  
  5179. int Defense[]; ZASM Instruction:
  5180. NPCDEFENSED
  5181. /**
  5182. * The npc's Defense values, as an array of 18 integers. Use the NPCD_ and NPCDT_ constants
  5183. * in std.zh to set or compare these values.
  5184. */
  5185.  
  5186. /************************************************************************************************************/
  5187.  
  5188. int ScriptDefense[]; ZASM Instruction:
  5189. NPCSCRDEFENSED
  5190. /**
  5191. * The npc's Script Weapon Defense values, as an array of 10 integers. Use the NPCSD_ and NPCDT_ constants
  5192. * in std.zh to set or compare these values.
  5193. *
  5194. * This corresponds to the 'Defenses 3' tab in the Enemy Editor.
  5195. */
  5196.  
  5197. /************************************************************************************************************/
  5198.  
  5199. int Attributes[]; ZASM Instruction:
  5200. NPCDD
  5201. /**
  5202. * The npc's Miscellaneous Attributes, as an array of ten integers.
  5203. * They are read-only; while setting them is not syntactically incorrect, it does nothing.
  5204. */
  5205.  
  5206. /************************************************************************************************************/
  5207.  
  5208. int MiscFlags; ZASM Instruction:
  5209. NPCMFLAGS
  5210. /**
  5211. * The npc's Misc. Flags as 14 bits ORed together, starting with 'Damaged by Power 0 Weapons',
  5212. * and working down the flags in the order they are shown in the Enemy Editor.
  5213. * npc->MiscFlags is read-only; while setting it is not syntactically incorrect, it does nothing.
  5214. * If you are not comfortable with binary operations, you can use 'GetNPCMiscFlag' from std.zh
  5215. */
  5216.  
  5217. /************************************************************************************************************/
  5218.  
  5219. float Misc[32]; ZASM Instruction:
  5220. NPCMISCD
  5221. /**
  5222. * An array of 32 miscellaneous variables for you to use as you please.
  5223. */
  5224.  
  5225. /************************************************************************************************************/
  5226.  
  5227. void BreakShield(); ZASM Instruction:
  5228. BREAKSHIELD
  5229. /**
  5230. * Breaks the enemy's shield if it has one. This works even if the flag
  5231. * "Hammer Can Break Shield" is not checked.
  5232. */
  5233.  
  5234.  
  5235. /************************************************************************************************************/
  5236. /************************************************************************************************************/
  5237.  
  5238.  
  5239.  
  5240.  
  5241. //======================================
  5242. //--- Weapon Functions and Variables ---
  5243. //======================================
  5244.  
  5245. class weapon
  5246.  
  5247.  
  5248. //! ZScript supports two different weapon classes:
  5249. //! The lweapon class is used for Link's weapons (that damage enemies, and trigger objects)
  5250. //! while the eweapon class is used for enemy weapons, that can damage Link.
  5251. //!
  5252. //! Both the lweapon, and the eweapon class have all of the following atributes:
  5253.  
  5254. bool isValid(); ZASM Instruction:
  5255. ISVALIDLWPN
  5256. ISVALIDEWPN
  5257.  
  5258. /**
  5259. * Returns whether this weapon pointer is still valid. A weapon pointer
  5260. * becomes invalid when the weapon fades away or disappears
  5261. * or Link leaves the screen. Accessing any variables using an
  5262. * invalid weapon pointer prints an error message to allegro.log and
  5263. * does nothing.
  5264. */ Example Use: !#!
  5265.  
  5266. /************************************************************************************************************/
  5267.  
  5268. float UID; ZASM Instruction:
  5269. LWPNUID
  5270. EWPNUID
  5271. /**
  5272. * Returns the UID of an *weapon.
  5273. */ Example Use:
  5274.  
  5275. /************************************************************************************************************/
  5276.  
  5277. int GetPointer(eweapon *ptr[]);
  5278. int GetPointer(lweapon *ptr[]);
  5279. ZASM Instruction:
  5280. LWPNARRPTR
  5281. EWPNARRPTR
  5282. /**
  5283. * Returns the pointer of a *weapon array as a float.
  5284. */ Example Use:
  5285. eweapon arr[16];
  5286. int size = SizeOfArray( GetPointer(arr) );
  5287. //Size == 16
  5288.  
  5289. /************************************************************************************************************/
  5290.  
  5291. lweapon SetPointer(int value);
  5292. eweapon SetPointer(int value); ZASM Instruction:
  5293. LWPNARRPTR2
  5294. EWPNARRPTR2
  5295. /**
  5296. * Converts an int pointer to the *weapon type, for assigning.
  5297. */ Example Use:
  5298. eweapon arr[16]; eweapon arrB[2]; int arrC[2];
  5299. arrC[0] = GetPointer(arr);
  5300. arrB[0] = SetPointer(arrC[0]);
  5301.  
  5302. /************************************************************************************************************/
  5303.  
  5304. void UseSprite(int id); ZASM Instruction:
  5305. LWPNUSESPRITER, LWPNUSESPRITEV
  5306. EWPNUSESPRITER, EWPNUSESPRITEV
  5307.  
  5308. /**
  5309. * Reads a 'Weapons/Misc' sprite entry in your quest file, and assigns
  5310. * the OriginalTile, Tile, OriginalCSet, CSet, FlashCSet, NumFrames,
  5311. * Frame, ASpeed, Flip and Flash variables of this weapon based on
  5312. * this entry's data. Passing negative values, and values greater than
  5313. * 255, will do nothing.
  5314. */ Example Use: !#!
  5315.  
  5316. /************************************************************************************************************/
  5317.  
  5318. bool Behind; ZASM Instruction:
  5319. LWPNBEHIND
  5320. EWPNBEHIND
  5321.  
  5322. /**
  5323. * Ensures that the weapon's graphic is drawn behind Link and enemies.
  5324. */ Example Use: !#!
  5325.  
  5326. /************************************************************************************************************/
  5327.  
  5328. int ID; ZASM Instruction:
  5329. LWPNID
  5330. EWPNID
  5331.  
  5332. /**
  5333. * The weapon's ID number. Use the LW_ or EW_ constants to compare
  5334. * this value. The effect of writing to this field is currently undefined.
  5335. */ Example Use: !#!
  5336.  
  5337. /************************************************************************************************************/
  5338.  
  5339. int X; ZASM Instruction:
  5340. LWPNX
  5341. EWPNX
  5342.  
  5343. /**
  5344. * The weapon's X position on the screen, in pixels. Float values passed
  5345. * to this will be cast to int.
  5346. */ Example Use: !#!
  5347.  
  5348. /************************************************************************************************************/
  5349.  
  5350. int Y; ZASM Instruction:
  5351. LWPNY
  5352. EWPNY
  5353.  
  5354. /**
  5355. * The weapon's Y position on the screen, in pixels. Float values passed
  5356. * to this will be cast to int.
  5357. */ Example Use: !#!
  5358.  
  5359. /************************************************************************************************************/
  5360.  
  5361. int Z; ZASM Instruction:
  5362. LWPNZ
  5363. EWPNZ
  5364.  
  5365. /**
  5366. * The weapon's Z position on the screen, in pixels. Float values passed
  5367. * to this will be cast to int.
  5368. */ Example Use: !#!
  5369.  
  5370. /************************************************************************************************************/
  5371.  
  5372. int Jump; ZASM Instruction:
  5373. LWPNJUMP
  5374. EWPNJUMP
  5375.  
  5376. /**
  5377. * The weapon's falling speed on the screen. Bombs, Bait and
  5378. * Fire obey gravity.
  5379. */ Example Use: !#!
  5380.  
  5381. /************************************************************************************************************/
  5382.  
  5383. int DrawStyle; ZASM Instruction:
  5384. LWPNDRAWTYPE
  5385. EWPNDRAWTYPE
  5386.  
  5387. /**
  5388. * An integer representing how the weapon is to be drawn. Use one of the
  5389. * DS_ constants in std.zh to set or compare this value.
  5390. */ Example Use: !#!
  5391.  
  5392. /************************************************************************************************************/
  5393.  
  5394. int Dir; ZASM Instruction:
  5395. LWPNDIR
  5396. eWPNDIR
  5397.  
  5398. /**
  5399. * The direction that the weapon is facing. Used by certain weapon types
  5400. * to determine movement, shield deflection and such.
  5401. */ Example Use: !#!
  5402.  
  5403. /************************************************************************************************************/
  5404.  
  5405. int Range; ZASM Instruction:
  5406. LWPNRANGE
  5407.  
  5408. /**
  5409. * The range of the weapon in pixels.
  5410. * The range in pixels for boomerang and hookshot lweapons; and the duration in frames for arrow lweapons.
  5411. *
  5412. */ Example Use: !#!
  5413.  
  5414. /************************************************************************************************************/
  5415.  
  5416. int OriginalTile; ZASM Instruction:
  5417. LWPNOTILE
  5418. EWPNOTILE
  5419.  
  5420. /**
  5421. * The starting tile of the weapon's animation.
  5422. */ Example Use: !#!
  5423.  
  5424. /************************************************************************************************************/
  5425.  
  5426. int Tile; ZASM Instruction:
  5427. LWPNTILE
  5428. EWPNTILE
  5429.  
  5430. /**
  5431. * The current tile associated with this weapon.
  5432. */ Example Use: !#!
  5433.  
  5434. /************************************************************************************************************/
  5435.  
  5436. int OriginalCSet; ZASM Instruction:
  5437. LWPNOCSET
  5438. EWPNOCSET
  5439.  
  5440. /**
  5441. * The starting CSet of the weapon's animation.
  5442. */ Example Use: !#!
  5443.  
  5444. /************************************************************************************************************/
  5445.  
  5446. int CSet; ZASM Instruction:
  5447. LWPNCSET
  5448. EWPNCSET
  5449.  
  5450. /**
  5451. * This weapon's current CSet.
  5452. */ Example Use: !#!
  5453.  
  5454. /************************************************************************************************************/
  5455.  
  5456. int FlashCSet; ZASM Instruction:
  5457. LWPNFLASHCSET
  5458. EWPNFLASHCSET
  5459.  
  5460. /**
  5461. * The CSet used during this weapon's flash frames, if this weapon flashes.
  5462. */ Example Use: !#!
  5463.  
  5464. /************************************************************************************************************/
  5465.  
  5466. int NumFrames; ZASM Instruction:
  5467. LWPNFRAMES
  5468. EWPNFRAMES
  5469.  
  5470. /**
  5471. * The number of frames in this weapon's animation.
  5472. */ Example Use: !#!
  5473.  
  5474. /************************************************************************************************************/
  5475.  
  5476. int Frame; ZASM Instruction:
  5477. LWPNFRAME
  5478. EWPNFRAME
  5479.  
  5480. /**
  5481. * The weapon's current animation frame.
  5482. */ Example Use: !#!
  5483.  
  5484. /************************************************************************************************************/
  5485.  
  5486. int ASpeed; ZASM Instruction:
  5487. LWPNASPEED
  5488. EWPNASPEED
  5489.  
  5490. /**
  5491. * The speed at which this weapon animates, in screen frames.
  5492. */ Example Use: !#!
  5493.  
  5494. /************************************************************************************************************/
  5495.  
  5496. int Damage; ZASM Instruction:
  5497. LWPNPOWER
  5498. EWPNPOWER
  5499.  
  5500. /**
  5501. * The amount of damage that this weapon causes to Link/an enemy upon contact.
  5502. */ Example Use: !#!
  5503.  
  5504. /************************************************************************************************************/
  5505.  
  5506. int Step; ZASM Instruction:
  5507. LWPNSTEP
  5508. EWPNSTEP
  5509.  
  5510. /**
  5511. * Usually associated with the weapon's velocity. A Step of 100
  5512. * typically means that the weapon moves at approximately one pixel
  5513. * per animation frame.
  5514. */ Example Use: !#!
  5515.  
  5516. /************************************************************************************************************/
  5517.  
  5518. int Angle; ZASM Instruction:
  5519. LWPNANGLE
  5520. EWPNANGLE
  5521.  
  5522. /**
  5523. * The weapon's current angle in clockwise radians; used by certain weapon
  5524. * types with angular movement. 0 = right, PI/2 = down, etc. Note: if you
  5525. * want Link's shield to interact with the weapon correctly, you must set
  5526. * its Dir to a direction that approximates this angle.
  5527. */ Example Use: !#!
  5528.  
  5529. /************************************************************************************************************/
  5530.  
  5531. bool Angular; ZASM Instruction:
  5532. LWPNANGULAR
  5533. EWPNANGULAR
  5534.  
  5535. /**
  5536. * Specifies whether a weapon has angular movement.
  5537. */ Example Use: !#!
  5538.  
  5539. /************************************************************************************************************/
  5540.  
  5541. bool CollDetection; ZASM Instruction:
  5542. LWPNCOLLDET
  5543. EWPNCOLLDET
  5544.  
  5545. /**
  5546. * Whether the weapon will use the system's code to work out collisions with
  5547. * Link and/or enemies (depending on weapon type). Initialised as 'true'.
  5548. */ Example Use: !#!
  5549.  
  5550. /************************************************************************************************************/
  5551.  
  5552. int DeadState; ZASM Instruction:
  5553. LWPNDEAD
  5554. EWPNDEAD
  5555.  
  5556. /**
  5557. * The current state of the weapon. Important to keep track of. A value of
  5558. * -1 indicates that it is active, and moves according to the weapon's
  5559. * Dir, Step, Angular, and Angle values. Use -1 if you want the engine to
  5560. * handle movement and collision. Use any value below -1 if you want a
  5561. * dummy weapon that you can control on your own.
  5562. *
  5563. * Given a deadstate value of -10, a weapon will turn of its collision
  5564. * detection and movement. If it has a positive value, it will
  5565. * decrement once per frame until it equals 0, whereupon the weapon is
  5566. * removed. If you want to remove the weapon, write one of the WDS_
  5567. * constants in std.zh (appropriate for the weapon) to this variable.
  5568. *
  5569. * Weapons with the type *_SPARKLE have a DeadState equal to the number
  5570. * of frames in their sprite animation, when created.
  5571. */ Example Use: !#!
  5572.  
  5573. /************************************************************************************************************/
  5574.  
  5575. bool Flash; ZASM Instruction:
  5576. LWPNFLASH
  5577. EWPNFLASH
  5578.  
  5579. /**
  5580. * Whether or not the weapon flashes. A flashing weapon alternates between
  5581. * its CSet and its FlashCSet.
  5582. */ Example Use: !#!
  5583.  
  5584. /************************************************************************************************************/
  5585.  
  5586. int Flip; ZASM Instruction:
  5587. LWPNFLIP
  5588. EWPNFLIP
  5589.  
  5590. /**
  5591. * Whether and how the weapon's tiles should be flipped.
  5592. * 0: No flip
  5593. * 1: Horizontal flip
  5594. * 2: Vertical flip
  5595. * 3: Both (180 degree rotation)
  5596. */ Example Use: !#!
  5597.  
  5598. /************************************************************************************************************/
  5599.  
  5600. int Extend; ZASM Instruction:
  5601. LWPNEXTEND
  5602. EWPNEXTEND
  5603.  
  5604. /**
  5605. * Whether to extend the sprite of the weapon.
  5606. */ Example Use: !#!
  5607.  
  5608. /************************************************************************************************************/
  5609.  
  5610. int TileWidth; ZASM Instruction:
  5611. LWPNTXSZ
  5612. EWPNTXSZ
  5613.  
  5614. /**
  5615. * The number of tile columns composing the sprite.
  5616. * Writing to this is ignored unless Extend is set to values >=3.
  5617. */ Example Use: !#!
  5618.  
  5619. /************************************************************************************************************/
  5620.  
  5621. int TileHeight; ZASM Instruction:
  5622. LWPNTYSZ
  5623. EWPNTYSZ
  5624.  
  5625. /**
  5626. * The number of tile rows composing the sprite.
  5627. * Writing to this is ignored unless Extend is set to values >=3.
  5628. */ Example Use: !#!
  5629.  
  5630. /************************************************************************************************************/
  5631.  
  5632. int HitWidth; ZASM Instruction:
  5633. LWPNHXSZ
  5634. EWPNHXSZ
  5635.  
  5636. /**
  5637. * The width of the sprite's hitbox, or collision rectangle.
  5638. */ Example Use: !#!
  5639.  
  5640. /************************************************************************************************************/
  5641.  
  5642. int HitHeight; ZASM Instruction:
  5643. LWPNHYSZ
  5644. WEPNHYSZ
  5645.  
  5646. /**
  5647. * The height of the sprite's hitbox, or collision rectangle.
  5648. */ Example Use: !#!
  5649.  
  5650. /************************************************************************************************************/
  5651.  
  5652. int HitZHeight; ZASM Instruction:
  5653. LWPNHZSZ
  5654. EWPNHZSZ
  5655.  
  5656. /**
  5657. * The Z-axis height of the sprite's hitbox, or collision rectangle.
  5658. * The greater it is, the higher Link must jump or fly over the sprite
  5659. * To jump over a sprite, you must be higher than its Z + HitZHeight.
  5660. * The values of DrawZOffset and HitZHight are linked. Setting one, also sets the other.
  5661. * to avoid taking damage.
  5662. */ Example Use: !#!
  5663.  
  5664. /************************************************************************************************************/
  5665.  
  5666. int HitXOffset; ZASM Instruction:
  5667. LWPNHXOFS
  5668. EWPNHXOFS
  5669.  
  5670. /**
  5671. * The X offset of the sprite's hitbox, or collision rectangle.
  5672. * Setting it to positive or negative values will move the sprite's
  5673. * hitbox left or right.
  5674. */ Example Use: !#!
  5675.  
  5676. /************************************************************************************************************/
  5677.  
  5678. int HitYOffset; ZASM Instruction:
  5679. LWPNHYOFS
  5680. EWPNHYOFS
  5681.  
  5682. /**
  5683. * The Y offset of the sprite's hitbox, or collision rectangle.
  5684. * Setting it to positive or negative values will move the sprite's
  5685. * hitbox up or down.
  5686. */ Example Use: !#!
  5687.  
  5688. /************************************************************************************************************/
  5689.  
  5690. int DrawXOffset; ZASM Instruction:
  5691. LWPNXOFS
  5692. EWPNXOFS
  5693.  
  5694. /**
  5695. * The X offset of the sprite.
  5696. * Setting it to positive or negative values will move the sprite's
  5697. * tiles left or right relative to its position.
  5698. */ Example Use: !#!
  5699.  
  5700. /************************************************************************************************************/
  5701.  
  5702. int DrawYOffset; ZASM Instruction:
  5703. LWPNYOFS
  5704. EWPNYOFS
  5705.  
  5706. /**
  5707. * The Y offset of the sprite.
  5708. * Setting it to positive or negative values will move the sprite's
  5709. * tiles up or down relative to its position.
  5710. */ Example Use: !#!
  5711.  
  5712. /************************************************************************************************************/
  5713.  
  5714. int DrawZOffset; ZASM Instruction:
  5715. LWPNZOFS
  5716. EWPNZOFS
  5717.  
  5718. /**
  5719. * The Z offset of the sprite.
  5720. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  5721. */ Example Use: !#!
  5722.  
  5723. /************************************************************************************************************/
  5724.  
  5725. float Misc[32]; ZASM Instruction:
  5726. LWPNMISCD
  5727. EWPNMISCD
  5728.  
  5729. /**
  5730. * An array of 32 miscellaneous variables for you to use as you please.
  5731. */ Example Use: !#!
  5732.  
  5733.  
  5734. /************************************************************************************************************/
  5735. /************************************************************************************************************/
  5736.  
  5737. //====================================
  5738. //--- Item Functions and Variables ---
  5739. //====================================
  5740.  
  5741. class item
  5742.  
  5743.  
  5744. bool isValid(); ZASM Instruction:
  5745. ISVALIDITEM
  5746.  
  5747. /**
  5748. * Returns whether this item pointer is still valid. An item pointer
  5749. * becomes invalid when Link picks up the item, the item fades away,
  5750. * or Link leaves the screen. Accessing any variables using an
  5751. * invalid item pointer prints an error message to allegro.log and
  5752. * does nothing.
  5753. *
  5754. */ Example Use: !#!
  5755.  
  5756. /************************************************************************************************************/
  5757.  
  5758. int X; ZASM Instruction:
  5759. ITEMX
  5760.  
  5761. /**
  5762. * The item's X position on the screen, in pixels. Float values passed to this will be cast to int.
  5763. *
  5764. */ Example Use: !#!
  5765.  
  5766. /************************************************************************************************************/
  5767.  
  5768. int Y; ZASM Instruction:
  5769. ITEMY
  5770. /**
  5771. * The item's Y position on the screen, in pixels. Float values passed to this will be cast to int.
  5772. *
  5773. */ Example Use: !#!
  5774.  
  5775. /************************************************************************************************************/
  5776.  
  5777. int Jump ZASM Instruction:
  5778. ITEMJUMP
  5779.  
  5780. /**
  5781. * The item's upward velocity, in pixels. If negative, the item will fall.
  5782. * The downward acceleration of Gravity (in Init Data) modifies this value every frame.
  5783. *
  5784. */ Example Use: !#!
  5785.  
  5786. /************************************************************************************************************/
  5787.  
  5788. int DrawStyle; ZASM Instruction:
  5789. ITEMDRAWTYPE
  5790. /**
  5791. * An integer representing how the item is to be drawn. Use one of the
  5792. * DS_ constants in std.zh to set or compare this value.
  5793. *
  5794. */ Example Use: !#!
  5795.  
  5796. /************************************************************************************************************/
  5797.  
  5798. int ID; ZASM Instruction:
  5799. ITEMID
  5800. /**
  5801. * This item's ID number. Use the I_ constants to compare this value. The effect of writing to this field is currently undefined.
  5802. *
  5803. */ Example Use: !#!
  5804.  
  5805. /************************************************************************************************************/
  5806.  
  5807. int OriginalTile; ZASM Instruction:
  5808. ITEMOTILE
  5809. /**
  5810. * The starting tile of the item's animation.
  5811. *
  5812. */ Example Use: !#!
  5813.  
  5814. /************************************************************************************************************/
  5815.  
  5816. int Tile; ZASM Instruction:
  5817. ITEMTILE
  5818. /**
  5819. * The current tile associated with this item.
  5820. *
  5821. */ Example Use: !#!
  5822.  
  5823. /************************************************************************************************************/
  5824.  
  5825. int CSet; ZASM Instruction:
  5826. ITEMCSET
  5827. /**
  5828. * This item's CSet.
  5829. *
  5830. */ Example Use: !#!
  5831.  
  5832. /************************************************************************************************************/
  5833.  
  5834. int FlashCSet; ZASM Instruction:
  5835. ITEMFLASHCSET
  5836. /**
  5837. * The CSet used during this item's flash frames, if this item flashes.
  5838. *
  5839. */ Example Use: !#!
  5840.  
  5841. /************************************************************************************************************/
  5842.  
  5843. int NumFrames; ZASM Instruction:
  5844. ITEMFRAMES
  5845. /**
  5846. * The number of frames in this item's animation.
  5847. *
  5848. */ Example Use: !#!
  5849.  
  5850. /************************************************************************************************************/
  5851.  
  5852. int Frame; ZASM Instruction:
  5853. ITEMFRAME
  5854. /**
  5855. * The tile that is this item's current animation frame.
  5856. *
  5857. */ Example Use: !#!
  5858.  
  5859. /************************************************************************************************************/
  5860.  
  5861. int ASpeed; ZASM Instruction:
  5862. ITEMASPEED
  5863. /**
  5864. * The speed at which this item animates, in screen frames.
  5865. *
  5866. */ Example Use: !#!
  5867.  
  5868. /************************************************************************************************************/
  5869.  
  5870. int ACLock; ZASM Instruction:
  5871. ITEMACLK
  5872.  
  5873. /**
  5874. * Returns the present tick of the animation clock.
  5875. *
  5876. */
  5877.  
  5878. /************************************************************************************************************/
  5879.  
  5880. int Delay; ZASM Instruction:
  5881. ITEMDELAY
  5882. /**
  5883. * The amount of time the animation is suspended after the last frame,
  5884. * before the animation restarts, in item frames. That is, the total
  5885. * number of screen frames of extra wait is Delay*ASpeed.
  5886. *
  5887. */ Example Use: !#!
  5888.  
  5889. /************************************************************************************************************/
  5890.  
  5891. bool Flash; ZASM Instruction:
  5892. ITEMFLASH
  5893. /**
  5894. * Whether or not the item flashes. A flashing item alternates between
  5895. * its CSet and its FlashCSet.
  5896. *
  5897. */ Example Use: !#!
  5898.  
  5899. /************************************************************************************************************/
  5900.  
  5901. int Flip; ZASM Instruction:
  5902. ITEMFLIP
  5903.  
  5904. /**
  5905. * Whether and how the item's tiles should be flipped.
  5906. * 0: No flip
  5907. * 1: Horizontal flip
  5908. * 2: Vertical flip
  5909. * 3: Both (180 degree rotation)
  5910. *
  5911. */ Example Use: !#!
  5912.  
  5913. /************************************************************************************************************/
  5914.  
  5915. int Pickup; ZASM Instruction:
  5916. ITEMPICKUP
  5917. /**
  5918. * The pickup flags of the item, which determine what happens when Link
  5919. * picks up the item. Its value consists of flags OR'd (|) together; use
  5920. * the IP_ constants in std.zh to set or compare these values.
  5921. * A special note about IP_ENEMYCARRIED: if the Quest Rule "Hide Enemy-
  5922. * Carried Items" is set, then an item carried by an enemy will have its
  5923. * X and Y values set to -128 while the enemy is carrying it. If this
  5924. * flag is removed from such an item, then it will be moved to the enemy's
  5925. * on-screen location.
  5926. * If you are not comfortable with performing binary operations, use the ItemPickup functions from std.zh.
  5927. *
  5928. */ Example Use: !#!
  5929.  
  5930. /************************************************************************************************************/
  5931.  
  5932. int Extend; ZASM Instruction:
  5933. ITEMEXTEND
  5934. /**
  5935. * Whether to extend the sprite of the item.
  5936. *
  5937. */ Example Use: !#!
  5938.  
  5939. /************************************************************************************************************/
  5940.  
  5941. int TileWidth; ZASM Instruction:
  5942. !
  5943. /**
  5944. * The number of tile columns composing the sprite.
  5945. * Writing to this is ignored unless Extend is set to values >=3.
  5946. *
  5947. */ Example Use: !#!
  5948.  
  5949. /************************************************************************************************************/
  5950.  
  5951. int TileHeight; ZASM Instruction:
  5952. !
  5953. /**
  5954. * The number of tile rows composing the sprite.
  5955. * Writing to this is ignored unless Extend is set to values >=3.
  5956. *
  5957. */ Example Use: !#!
  5958.  
  5959. /************************************************************************************************************/
  5960.  
  5961. int HitWidth; ZASM Instruction:
  5962. ITEMHSXZ
  5963. /**
  5964. * The width of the sprite's hitbox, or collision rectangle.
  5965. *
  5966. */ Example Use: !#!
  5967.  
  5968. /************************************************************************************************************/
  5969.  
  5970. int HitHeight; ZASM Instruction:
  5971. ITEMHYSZ
  5972. /**
  5973. * The height of the sprite's hitbox, or collision rectangle.
  5974. *
  5975. */ Example Use: !#!
  5976.  
  5977. /************************************************************************************************************/
  5978.  
  5979. int HitZHeight; ZASM Instruction:
  5980. ITEMHXSZ
  5981. /**
  5982. * The Z-axis height of the sprite's hitbox, or collision rectangle.
  5983. * The greater it is, the higher Link must jump or fly over the sprite to avoid picking up the item.
  5984. * To jump over a sprite, you must be higher than its Z + HitZHeight.
  5985. *
  5986. */ Example Use: !#!
  5987.  
  5988. /************************************************************************************************************/
  5989.  
  5990. int HitXOffset; ZASM Instruction:
  5991. ITEMHXOFS
  5992. /**
  5993. * The X offset of the sprite's hitbox, or collision rectangle.
  5994. * Setting it to positive or negative values will move the sprite's hitbox left or right.
  5995. *
  5996. */ Example Use: !#!
  5997.  
  5998. /************************************************************************************************************/
  5999.  
  6000. int HitYOffset; ZASM Instruction:
  6001. ITEMHYOFS
  6002. /**
  6003. * The Y offset of the sprite's hitbox, or collision rectangle.
  6004. * Setting it to positive or negative values will move the sprite's hitbox up or down.
  6005. *
  6006. */ Example Use: !#!
  6007.  
  6008. /************************************************************************************************************/
  6009.  
  6010. int DrawXOffset; ZASM Instruction:
  6011. ITEMXOFS
  6012. /**
  6013. * The X offset of the sprite.
  6014. * Setting it to positive or negative values will move the sprite's tiles left or right relative to its position.
  6015. *
  6016. */ Example Use: !#!
  6017.  
  6018. /************************************************************************************************************/
  6019.  
  6020. int DrawYOffset; ZASM Instruction:
  6021. ITEMYOFS
  6022. /**
  6023. * The Y offset of the sprite.
  6024. * Setting it to positive or negative values will move the sprite's tiles up or down relative to its position.
  6025. *
  6026. */ Example Use: !#!
  6027.  
  6028. /************************************************************************************************************/
  6029.  
  6030. int DrawZOffset; ZASM Instruction:
  6031. ITEMZOFS
  6032. /**
  6033. * The Z offset of the sprite.
  6034. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  6035. *
  6036. */ Example Use: !#!
  6037.  
  6038. /************************************************************************************************************/
  6039.  
  6040. float Misc[32]; ZASM Instruction:
  6041. ITEMMISCD
  6042. /**
  6043. * An array of 32 miscellaneous variables for you to use as you please.
  6044. * Note that lweapons and eweapons possess exactly the same attributes,
  6045. * although their designation affects how they are treated by the engine.
  6046. * The values here correspond to both the lweapon and eweapon type.
  6047. *
  6048. */ Example Use: !#!
  6049.  
  6050.  
  6051. /************************************************************************************************************/
  6052. /************************************************************************************************************/
  6053.  
  6054.  
  6055. //=========================================
  6056. //--- Itemdata Functions and Variables ---
  6057. //=========================================
  6058.  
  6059.  
  6060. int GetPointer(itemdata *ptr[]);
  6061. ZASM Instruction:
  6062. IDATAARRPTR
  6063. /**
  6064. * Returns the pointer of a itemdata array as a float.
  6065. */ Example Use:
  6066. itemdata arr[16];
  6067. int size = SizeOfArray( GetPointer(arr) );
  6068. //Size == 16
  6069.  
  6070. /************************************************************************************************************/
  6071.  
  6072. itemdata SetPointer(int value); ZASM Instruction:
  6073. IDATAARRPTR2
  6074. /**
  6075. * Converts an int pointer to the itemdata type, for assigning.
  6076. */ Example Use:
  6077. itemdata arr[16]; itemdata arrB[2]; int arrC[2];
  6078. arrC[0] = GetPointer(arr);
  6079. arrB[0] = SetPointer(arrC[0]);
  6080.  
  6081. /************************************************************************************************************/
  6082.  
  6083. //! You may reference itemdata variables via item scripts, using the 'this' pointer.
  6084.  
  6085. class itemdata
  6086. int ID; ZASM Instruction:
  6087. IDATAID
  6088. /**
  6089. * Returns the item number of the item in question.
  6090. * Can be called with this->ID in item scripts.
  6091. */ Example Use: !#!
  6092.  
  6093. /************************************************************************************************************/
  6094.  
  6095. int Modifier; ZASM Instruction:
  6096. IDATALTM
  6097. /**
  6098. * The Link Tile Modifier
  6099. *
  6100. */ Example Use: !#!
  6101.  
  6102. /************************************************************************************************************/
  6103.  
  6104. int Tile; ZASM Instruction:
  6105. IDATATILE
  6106. /**
  6107. * The tile used by the item.
  6108. *
  6109. */ Example Use: !#!
  6110.  
  6111. /************************************************************************************************************/
  6112.  
  6113. int CSet; ZASM Instruction:
  6114. IDATAID
  6115. /**
  6116. * The CSet of the tile used by the item.
  6117. *
  6118. */ Example Use: !#!
  6119.  
  6120. /************************************************************************************************************/
  6121.  
  6122. int Flash; ZASM Instruction:
  6123. IDATAFLASH
  6124. /**
  6125. * The Flash value for the CSet
  6126. *
  6127. */ Example Use: !#!
  6128.  
  6129. /************************************************************************************************************/
  6130.  
  6131. int AFrames; ZASM Instruction:
  6132. IDATAFRAMES
  6133. /**
  6134. * The number of animation frames in the item's tile animation.
  6135. *
  6136. */ Example Use: !#!
  6137.  
  6138. /************************************************************************************************************/
  6139.  
  6140. int ASpeed; ZASM Instruction:
  6141. IDATAASPEED
  6142. /**
  6143. * The speed of the item's animation.
  6144. *
  6145. */ Example Use: !#!
  6146.  
  6147. /************************************************************************************************************/
  6148.  
  6149. int Delay; ZASM Instruction:
  6150. IDATADELAY
  6151. /**
  6152. * The Delay value, before the animation begins.
  6153. *
  6154. */ Example Use: !#!
  6155.  
  6156. /************************************************************************************************************/
  6157.  
  6158. int Script; ZASM Instruction:
  6159. IDATAID
  6160. /**
  6161. * The Action Script for the item.
  6162. *
  6163. */ Example Use: !#!
  6164.  
  6165. /************************************************************************************************************/
  6166.  
  6167. int PScript; ZASM Instruction:
  6168. IDATAID
  6169. /**
  6170. * The Pickup Script for the item.
  6171. *
  6172. */ Example Use: !#!
  6173.  
  6174. /************************************************************************************************************/
  6175.  
  6176. int MagicCost; ZASM Instruction:
  6177. IDATAID
  6178. /**
  6179. * The item's maic (or rupees, if this is set) cost.
  6180. *
  6181. */ Example Use: !#!
  6182.  
  6183. /************************************************************************************************************/
  6184.  
  6185. int MinHearts; ZASM Instruction:
  6186. IDATAID
  6187. /**
  6188. * The minimum number of hearts required to pick up the item.
  6189. *
  6190. */ Example Use: !#!
  6191.  
  6192. /************************************************************************************************************/
  6193.  
  6194. bool Combine; ZASM Instruction:
  6195. IDATACOMBINE
  6196. /**
  6197. * Corresponds to 'Upgrade when collected twice'.
  6198. *
  6199. */ Example Use: !#!
  6200.  
  6201. /************************************************************************************************************/
  6202.  
  6203. bool Downgrade; ZASM Instruction:
  6204. IDATADOWNGRADE
  6205. /**
  6206. * Corresponds to the 'Remove When Used' option on the Action tab of the item editor.
  6207. *
  6208. */ Example Use: !#!
  6209.  
  6210. /************************************************************************************************************/
  6211.  
  6212. bool KeepOld; ZASM Instruction:
  6213. IDATAKEEPOLD
  6214. /**
  6215. * Corresponds to 'Keep lower level items on the Pickup tab of the item editor.
  6216. * NOTE: Not to be confused with 'Keep', which corresponds to the 'Equipment Item' box.
  6217. *
  6218. */ Example Use: !#!
  6219.  
  6220. /************************************************************************************************************/
  6221.  
  6222. bool RupeeCost; ZASM Instruction:
  6223. IDATARUPEECOST
  6224. /**
  6225. * Corresponds to the 'Use Rupees Instead of Magic' option on the item editor 'Action' tab.
  6226. *
  6227. */ Example Use: !#!
  6228.  
  6229. /************************************************************************************************************/
  6230.  
  6231. bool Edible; ZASM Instruction:
  6232. IDATAEDIBLE
  6233. /**
  6234. * Corresponds to the 'Can be Eaten by Enemies' box on the Pickup tab of the item editor.
  6235. *
  6236. */ Example Use: !#!
  6237.  
  6238. /************************************************************************************************************/
  6239.  
  6240. bool GainLower; ZASM Instruction:
  6241. IDATAGAINLOWER
  6242. /**
  6243. * Corresponds to the 'Gain All Lower Level Items' box on the Pickup tab of the item editor.
  6244. *
  6245. */ Example Use: !#!
  6246.  
  6247. /************************************************************************************************************/
  6248.  
  6249. bool Flag1; ZASM Instruction:
  6250. IDATAFLAG1
  6251. /**
  6252. * Multipurpose Flag 1
  6253. *
  6254. * The properties of this flag change based on the item class (family).
  6255. * This corresponds to the box directly below 'Equiment Item'.
  6256. * For swords, this is 'B.H. is Percent'.
  6257. * Scripted item classes may make use of this as a general-purpose 'Script 1' flag.
  6258. * See 'zscript_itemdata.txt' for more information on what this flag does, based on the item class.
  6259. *
  6260. */ Example Use: !#!
  6261.  
  6262. /************************************************************************************************************/
  6263.  
  6264. bool Flag2; ZASM Instruction:
  6265. IDATAFLAG2
  6266. /**
  6267. * Multipurpose Flag 2
  6268. *
  6269. * The properties of this flag change based on the item class (family).
  6270. * This corresponds to the box directly below 'Flag 1, or two boxes down from 'Equiment Item'.
  6271. * For swords, this is 'B.D. is Percent'.
  6272. * Scripted item classes may make use of this as a general-purpose 'Script 2' flag.
  6273. * See 'zscript_itemdata.txt' for more information on what this flag does, based on the item class.
  6274. *
  6275. */ Example Use: !#!
  6276.  
  6277. /************************************************************************************************************/
  6278.  
  6279. bool Flag3; ZASM Instruction:
  6280. IDATAFLAG3
  6281. /**
  6282. * Multipurpose Flag 3
  6283. *
  6284. * The properties of this flag change based on the item class (family).
  6285. * This corresponds to the box directly right of 'Equiment Item'.
  6286. * For swords, this is 'B. Penetrates Enemies'.
  6287. * Scripted item classes may make use of this as a general-purpose 'Script 3' flag.
  6288. * See 'zscript_itemdata.txt' for more information on what this flag does, based on the item class.
  6289. *
  6290. */ Example Use: !#!
  6291.  
  6292. /************************************************************************************************************/
  6293.  
  6294. bool Flag4; ZASM Instruction:
  6295. IDATAFLAG4
  6296. /**
  6297. * Multipurpose Flag 4
  6298. *
  6299. * The properties of this flag change based on the item class (family).
  6300. * This corresponds to the box directly right of 'Flag 2'.
  6301. * For swords, this is 'Can Slash'.
  6302. * Scripted item classes may make use of this as a general-purpose 'Script 4' flag.
  6303. * See 'zscript_itemdata.txt' for more information on what this flag does, based on the item class.
  6304. *
  6305. */ Example Use: !#!
  6306.  
  6307. /************************************************************************************************************/
  6308.  
  6309. bool Flag5; ZASM Instruction:
  6310. IDATAFLAG5
  6311. /**
  6312. * Multipurpose Flag 5
  6313. *
  6314. * The properties of this flag change based on the item class (family).
  6315. * This corresponds to the box directly below 'Flag 4'.
  6316. * For swords, this is '<Unused>', and greyed out.
  6317. * Scripted item classes may make use of this as a general-purpose 'Script 5' flag.
  6318. * See 'zscript_itemdata.txt' for more information on what this flag does, based on the item class.
  6319. *
  6320. */ Example Use: !#!
  6321.  
  6322. /************************************************************************************************************/
  6323.  
  6324. bool Unused; ZASM Instruction:
  6325. IDATAFLAGUNUSED
  6326. /**
  6327. * ? - An extra script-only flag. It's a mystery to everyone.
  6328. * Likely best left unused in the event that we need to reserve it.
  6329. *
  6330. */ Example Use: !#!
  6331.  
  6332. /************************************************************************************************************/
  6333.  
  6334. float InitD[]; ZASM Instruction:
  6335. IDATAINITDD
  6336. /**
  6337. * The original values of the item's 8 'D#' input values are they are stored in the
  6338. * .qst file, regardles of whether they have been modified by ZScript.
  6339. */ Example Use: !#!
  6340.  
  6341. /************************************************************************************************************/
  6342.  
  6343. void GetName(int buffer[]); ZASM Instruction:
  6344. !
  6345. /**
  6346. * Loads the item this itemdata is attributed to's name into 'buffer'
  6347. */ Example Use: !#!
  6348.  
  6349. /************************************************************************************************************/
  6350.  
  6351. int Family; ZASM Instruction:
  6352. IDATAFAMILY
  6353. /**
  6354. * The kind of item to which this class belongs (swords, boomerangs,
  6355. * potions, etc.) Use the IC_ constants in std.zh to set or compare this
  6356. * value.
  6357. */ Example Use: !#!
  6358.  
  6359. /************************************************************************************************************/
  6360.  
  6361. int Level; ZASM Instruction:
  6362. IDATALEVEL
  6363. /**
  6364. * The level of this item. Higher-level items replace lower-level items
  6365. * when they are picked up.
  6366. */ Example Use: !#!
  6367.  
  6368. /************************************************************************************************************/
  6369.  
  6370. int Power; ZASM Instruction:
  6371. IDATAPOWER
  6372. /**
  6373. * The item's power, for most items this is amount of damage dealt but is
  6374. * used for other values in some items (ie. Roc's Feather)
  6375. */ Example Use: !#!
  6376.  
  6377. /************************************************************************************************************/
  6378.  
  6379. int Amount; ZASM Instruction:
  6380. IDATAAMOUNT
  6381. /**
  6382. * Corresponds to the "Increase Amount" entry in the Item Editor.
  6383. * The value of this data member can have two meanings:
  6384. * If Amount & 0x8000 is 1, the drain counter for this item is set
  6385. * to Amount & 0x3FFF. The game then slowly fills the counter of this item
  6386. * (see Counter below) out of the drain counter. Gaining rupees uses the
  6387. * drain counter, for example.
  6388. * is set to Amount when the item is picked up.
  6389. * If Amount & 0x8000 is 0, the counter of this item is increased, if
  6390. * Amount & 0x4000 is 1, or decreased, if Amount & 0x4000 is 0, by
  6391. * Amount & 0x3FFF when the item is picked up.
  6392. */ Example Use: !#!
  6393.  
  6394. /************************************************************************************************************/
  6395.  
  6396. int Max; ZASM Instruction:
  6397. IDATAMAX
  6398. /**
  6399. * Corresponds to the "Full Max" entry in the Item Editor.
  6400. * In conjunction with MaxIncrement (see below) this value controls how
  6401. * the maximum value of the counter of this item (see Counter below) is
  6402. * modified when the item is picked up. If MaxIncrement is nonzero at that
  6403. * time, the counter's new maximum value is at that time set to the
  6404. * minimum of its current value plus MaxIncrement, Max.
  6405. * If Max is less than the current maximum of the counter, Max is ignored
  6406. * and that maximum is used instead.
  6407. * Notice that as a special case, if Max = MaxIncrement, the counter's
  6408. * maximum value will be forced equal to Max.
  6409. */ Example Use: !#!
  6410.  
  6411. /************************************************************************************************************/
  6412.  
  6413. int MaxIncrement; ZASM Instruction:
  6414. IDATASETMAX
  6415. /**
  6416. * Corresponds to the "+Max" entry in the Item Editor.
  6417. * In conjunction with Max (see above) this value controls how the
  6418. * maximum value of the counter of this item (see Counter below) is
  6419. * modified when the item is picked up. If MaxIncrement is nonzero at that
  6420. * time, the counter's new maximum value is at that time set to the
  6421. * minimum of its current value plus MaxIncrement, and Max.
  6422. * If Max is less than the current maximum of the counter, Max is ignored
  6423. * and that maximum is used instead.
  6424. */ Example Use: !#!
  6425.  
  6426. /************************************************************************************************************/
  6427.  
  6428. bool Keep; ZASM Instruction:
  6429. IDATAKEEP
  6430. /**
  6431. * Corresponds to the "Equipment Item" checkbox in the Item Editor.
  6432. * If true, Link will keep the item, and it will show up as an item or
  6433. * equipment in the subscreen. If false, it may modify the current value
  6434. * or maximum value of its counter (see Counter below), then disappear.
  6435. * The White Sword and Raft, for instance, have Keep true, and keys and
  6436. * rupees have Keep false.
  6437. */ Example Use: !#!
  6438.  
  6439. /************************************************************************************************************/
  6440.  
  6441. int Counter; ZASM Instruction:
  6442. IDATACOUNTER
  6443. /**
  6444. * Corresponds to the "Counter Reference" entry in the Item Editor.
  6445. * The game counter whose current and modified values might be modified
  6446. * when the item is picked up (see Amount, Max, and MaxIncrement above.)
  6447. * Use the CT_ constants in std.zh to set or compare this value.
  6448. */ Example Use: !#!
  6449.  
  6450. /************************************************************************************************************/
  6451.  
  6452. int UseSound; ZASM Instruction:
  6453. IDATAUSESOUND
  6454.  
  6455. /**
  6456. * Corresponds to the "Sound" entry on the action tab in the Item Editor.
  6457. */ Example Use: !#!
  6458.  
  6459. /************************************************************************************************************/
  6460.  
  6461. int Attributes[10]; ZASM Instruction:
  6462. IDATAATTRIB
  6463.  
  6464. /**
  6465. * An array of ten integers containing the Attributes values.
  6466. * These correspond to the text entry fields, in the item editor 'Data' tab.
  6467. *
  6468. */
  6469.  
  6470. /************************************************************************************************************/
  6471.  
  6472. int Sprites[10]; ZASM Instruction:
  6473. IDATASPRITES
  6474.  
  6475. /**
  6476. * An array of ten integers containing the Sprites values.
  6477. * These correspond to the pull-down options in the item editor 'Action' tab. .
  6478. *
  6479. */
  6480.  
  6481. /************************************************************************************************************/
  6482.  
  6483. bool Flags[5]; ZASM Instruction:
  6484. IDATAFLAGS
  6485.  
  6486. /**
  6487. * An array of five multipurpose boolean flags. The properties of this flag change based on the item class (family).
  6488. * Flag[0] corresponds to the box directly below 'Equiment Item'. For swords, this is 'B.H. is Percent'.
  6489. * Flag[1] corresponds to the box directly below 'Flag 1'. For swords, this is 'B.D. is Percent'.
  6490. * Flag[2] corresponds to the box directly right of 'Equiment Item'. For swords, this is 'B. Penetrates Enemies'.
  6491. * Flag[3] corresponds to the box directly right of 'Flag 2'. For swords, this is 'Can Slash'.
  6492. * Flag[4] corresponds to the box directly below 'Flag 4'.For swords, this is '<Unused>', and greyed out.
  6493. *
  6494. * Scripted item classes may make use of these as a general-purpose script flags.
  6495. * See 'zscript_itemdata.txt' for more information on what this flag does, based on the item class.
  6496. */
  6497.  
  6498. /************************************************************************************************************/
  6499.  
  6500. int Misc1, Misc2, Misc3, Misc4, Misc5, Misc6, Misc7, Misc8, Misc9, Misc10;
  6501. ZASM Instructions:
  6502. IDATAMISC1, IDATAMISC2, IDATAMISC3, IDATAMISC4, IDATAMISC5
  6503. IDATAMISC6, IDATAMISC7, IDATAMISC8, IDATAMISC9, IDATAMISC10
  6504. /**
  6505. * These correspond to the pull-down options in the item editor 'Data' tab.
  6506. *
  6507. * Example: For a Sword Misc1 is 'Beam hearts', and Misc2 is 'Beam .
  6508. *
  6509. */ Example Use: !#!
  6510.  
  6511. /************************************************************************************************************/
  6512.  
  6513. int Attribute1, Attribute2, Attribute3, Attribute4, Attribute5, Attribute6,
  6514. Attribute7, Attribute8, Attribute9, Attribute10;
  6515. ZASM Instructions:
  6516. IDATAWPN, IDATAWPN2, IDATAWPN3, IDATAWPN4, IDATAWPN5
  6517. IDATAWPN6, IDATAWPN7, IDATAWPN8, IDATAWPN9, IDATAWPN10
  6518. /**
  6519. * These correspond to the pull-down options in the item editor 'Action' tab.
  6520. *
  6521. * Example: For a Sword Attribute1 is 'Sprite', Attribute 2 is 'Slash sprite'
  6522. * and Attribute 3 is 'Beam sprite'.
  6523. *
  6524. */ Example Use: !#!
  6525.  
  6526. /************************************************************************************************************/
  6527. /************************************************************************************************************/
  6528.  
  6529.  
  6530. //////////////////////
  6531. /// Array Building ///
  6532. //////////////////////
  6533.  
  6534.  
  6535. //////////////////////////////////////
  6536. /// Poke, or Peek at Memory Values ///
  6537. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  6538. /// The following functions are used by ZScript to build arrays, and move data between the registers ///
  6539. /// that hold them, and generally interpret the values in registers for using arrays. ///
  6540. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  6541. /// When an array is declared in ZScript, the following commands are used to create it, ///
  6542. /// and store its values: ///
  6543. /// ///
  6544. /// Creating arrays (global): ///
  6545. /// ///
  6546. /// int arr[16]; ///
  6547. /// int x; ///
  6548. /// ///
  6549. /// ZASM Output: ///
  6550. /// ALLOCATEGMEMV d2,16 : allocates 16 indices to d2 ///
  6551. /// SETR gd1,d2 : assigns the register d2 to global register gd1 ///
  6552. /// SETV gd2,0 ///
  6553. /// ///
  6554. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  6555. /// When an array is accessed, and the value of an index read, these instructions: ///
  6556. /// ///
  6557. /// int x; ///
  6558. /// int arr[16]; ///
  6559. /// x = arr[2]; ///
  6560. /// ///
  6561. /// ZASM Output: ///
  6562. /// ///
  6563. /// SETV d2,0 : Clear expression axcumulator #1 ///
  6564. /// PUSHR d3 : Push expression accumulator #2 ///
  6565. /// SETR d4,SP : Stack frame pointer to stack pointer. ///
  6566. /// SETR d2,gd1 : Set the value of arr[] to the expression accumulator #1. ///
  6567. /// PUSHR d2 : Push the expression accumulaor #1 ///
  6568. /// SETV d2,2 : Store the index we're reading in the expression accumulator #1 ///
  6569. /// POP d0 : Pop the array index accumulator ///
  6570. /// SETR d1,d2 : Store the expression accumulator #1 into the secondary array index accumulator. ///
  6571. /// SETR d2,GLOBALRAM : Read the array values into the expression accumulator #1 ///
  6572. /// SETR gd2,d2 : Store the value of the inex into x. ///
  6573. /// SETV d3,0 : Clear the secondary expression accumulator. ///
  6574. /// ///
  6575. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  6576. /// When the values in an array are modified, these instructions: ///
  6577. /// ///
  6578. /// arr[2] = 6; ///
  6579. /// ///
  6580. /// ZASM Output: ///
  6581. /// ///
  6582. /// SETV d2,0 : Clear expression accumulator #1 ///
  6583. /// PUSHR d3 : Push expression accumulator #2 ///
  6584. /// SETR d4,SP : Stack frame pointer to stack pointer. ///
  6585. /// SETV d2,6 : Set expression accumulator #1 to a value of 6 ///
  6586. /// SETR d0,gd1 : Prep the array index accumulator with the array stored in gd1 ///
  6587. /// SETR d5,d2 : Sink the value in d2 ///
  6588. /// PUSHR d0 : Push the array index accumulator. ///
  6589. /// SETV d2,2 : Store the index to modify in The expression accumulator #1 ///
  6590. /// POP d0 : Pop off the array index accumulator ///
  6591. /// SETR d1,d2 : Assign the value of the expression accumulator #1 to the ///
  6592. /// : secondary array index accumulator. ///
  6593. /// SETR GLOBALRAM,d5 : Store the value. ///
  6594. /// SETV d3,0 : Clear the expression accumulaTor #2 ///
  6595. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  6596. /// Using these, it would be possible to generate your own array handling routines. ///
  6597. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  6598. /// Global arrays are allocated in the REVERSE order of DECLARATION! ///
  6599. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  6600.  
  6601. // Peek at RAM value in a global address.
  6602.  
  6603. void GetGlobalRAM(int register) ZASM Instruction:
  6604. GLOBALRAMD
  6605. Example Use:
  6606. Game->GetGlobalRAM(10)
  6607. Returns the value in gd10
  6608.  
  6609. /************************************************************************************************************/
  6610.  
  6611. // POKE value into Global address
  6612.  
  6613. void SetGlobalRAM(int register, int value) ZASM Instruction:
  6614. GLOBALRAMD<><>
  6615. Example Use:
  6616. Game->SetGlobalRAM(10,6)
  6617. Sets gd10 to a value of '6'.
  6618.  
  6619. /************************************************************************************************************/
  6620.  
  6621. //Peek at register value of specific script address.
  6622. void GetScriptRAM(int register) ZASM Instruction:
  6623. SCRIPTRAMD<>
  6624. Example Use:
  6625. Game->GetScriptRAM(4)
  6626. Returns the value of Script RAM register 4.
  6627.  
  6628. /************************************************************************************************************/
  6629.  
  6630. //POKE Vakue into Script RAM address
  6631. void SetScriptRAM(int register, int value) ZASM Instruction:
  6632. SCRIPTRAMD<><>
  6633. Example Use:
  6634. Game->SetScriptRAM(4,12)
  6635. Sets script RAM register 4 to a value of '12'
  6636.  
  6637. /************************************************************************************************************/
  6638.  
  6639.  
  6640. ///////////////////////////////////////
  6641. /// Misc ZASM-Specific Instructions ///
  6642. ///////////////////////////////////////
  6643.  
  6644. GOTO<><>
  6645. GOTOTRUE<><>
  6646. GOTOFALSE<><>
  6647. GOTOLESS<><>
  6648. GOTOMORE<><>
  6649. POP<>
  6650. PUSHR<>
  6651. PUSHV<>
  6652. ENQUEUER<><>
  6653. ENQUEUEV<><>
  6654. DEQUEUE<>
  6655. GOTOR<>
  6656. LOADI<><>
  6657. STOREI<><>
  6658. LOOP<><>
  6659. MODR<><>
  6660. MODV<><>
  6661. CHECKTRIG
  6662. COMPOUNDR<>
  6663. COMPOUNDV<>
  6664. FLIPROTTILEVV<><>
  6665. FLIPROTTILERR<><>
  6666. FLIPROTTILERV<><>
  6667. FLIPROTTILEVR<><>
  6668.  
  6669. /* These may not be implemented.
  6670. GETTILEPIXELV<>
  6671. GETTILEPIXELR<>
  6672. SETTILEPIXELV<>
  6673. SETTILEPIXELC<>
  6674.  
  6675. SHIFTTILEVV<><>
  6676. SHIFTTILEVR<><>
  6677. SHIFTTILERR<><>
  6678. SHIFTTILERV<><>
  6679. */
  6680.  
  6681.  
  6682. /* Handles array data allocation.
  6683. ALLOCATEMEMR<><>
  6684. ALLOCATEMEMV<><>
  6685. ALLOCATEMGEMR<><>
  6686. ALLOCATEMGEMV<><>
  6687. */
  6688.  
  6689. /************************************************************************************************************/
  6690.  
  6691. ZASM Register Reservations
  6692.  
  6693. Name Register Use
  6694. SP
  6695. stack pointer
  6696. D4
  6697. stack frame pointer
  6698. D6
  6699. stack frame offset accumulator
  6700. D2
  6701. expression accumulator #1
  6702. D3
  6703. expression accumulator #2
  6704. D0
  6705. array index accumulator
  6706. D1
  6707. secondary array index accumulator
  6708. D5
  6709. pure SETR sink
  6710.  
  6711.  
  6712. //Unimplemented ZASM Instructions
  6713. GETTILEPIXEL
  6714. SETTILEPIXEL
  6715. FLIPROTATETILE
  6716. SHIFTTILE
  6717.  
  6718. //partially Implemented ZASM
  6719.  
  6720. OVERLAYTILE : Supports 8-bit mode tiles only. May support 4-bit only in CSet 0
  6721.  
  6722. ************************************
  6723. Misc ZASM
  6724.  
  6725. LOADI LoadIndirect
  6726. STOREI StoreIndirect
  6727.  
  6728.  
  6729. ////////////////////
  6730. /// Undocumented ///
  6731. ////////////////////
  6732.  
  6733. The following are unsupported, and unfinished ZScript functions.
  6734. * While calling them is not while setting it is not syntactically incorrect, it does nothing.
  6735.  
  6736. void SetColorBuffer( int amount, int offset, ZASM Instruction:
  6737. int stride, int *ptr ) SETCOLORB
  6738.  
  6739. Opcode: OSetColorBufferRegister()
  6740. Example Use:
  6741.  
  6742. /************************************************************************************************************/
  6743.  
  6744. void GetColorBuffer( int amount, int offset, ZASM Instruction:
  6745. int stride, int *ptr ) GETCOLORB
  6746.  
  6747. Opcode: OGetColorBufferRegister();
  6748. Exaple Use:
  6749.  
  6750. /************************************************************************************************************/
  6751.  
  6752. void SetDepthBuffer( int amount, int offset, ZASM Instruction:
  6753. int stride, int *ptr ) SETDEPTHB
  6754.  
  6755. Opcode: OSetDepthBufferRegister();
  6756. Example Use:
  6757.  
  6758. /************************************************************************************************************/
  6759.  
  6760. void GetDepthBuffer( int amount, int offset, ZASM Instruction:
  6761. int stride, int *ptr ) GETDEPTHB
  6762.  
  6763. Opcode: OGetDepthBufferRegister();
  6764. Example use:
  6765.  
  6766. /************************************************************************************************************/
  6767.  
  6768. Undocumented / ZASM Exclusive
  6769.  
  6770. FLOODFILL
  6771.  
  6772. //////////////////////////////////////////////
  6773. /// System Limitations, Minimums, Maximums ///
  6774. //////////////////////////////////////////////
  6775.  
  6776. Maximum numeric literal: 214747.9999
  6777.  
  6778. Ints, Floats, Arrays
  6779.  
  6780. Maximum float: -214747.9999 to 214747.9999
  6781. Maximum int -214747 to 214747
  6782. Maximum array size (number of indices): 214747
  6783.  
  6784. * This further includes arrays with a type of npc, leweapon, eweapon, item, and itemdata.
  6785. Maximum value in an array index: Same as float, or int; based on type declaration.
  6786. Maximum size of string index: 214747
  6787. Maximum string length: 214747
  6788. Maximum simultaneous arrays in operation: 4095
  6789.  
  6790. Counters, Tiles, Combos, Strings
  6791.  
  6792. Maximum Tiles: 65519
  6793. Maximum Combos: 65279
  6794. Maximum Counter Value: 0 to 32767
  6795. Maximum strings in string editor: ( 65519 )
  6796.  
  6797. Largest tile ID (ZQ Editors): 32767 ?
  6798.  
  6799. The largest value that can be referenced in the ZQ item, enemy, and other editors.
  6800.  
  6801. --> I seem to remember a problem calling high values.
  6802.  
  6803. Pointers and Objects
  6804.  
  6805. Maximum number of item pointers (on-screen items) at any one time: 255
  6806. Maximum number of lweapon pointers (on-screen lweapons) at any one time: 255
  6807. Maximum number of eweapon pointers (on-screen eweapons) at any one time: 255
  6808. Maximum number of npc pointers (on-screen NPCs) at any one time: 255
  6809. Maximum number of ffc (on-screen FFCs) pointers at any one time: 32
  6810. Array Pointers (maximum number of arrays in operation): 4095
  6811.  
  6812. Maximum total (cumulative) number of 'object' pointers at any one time: 1020
  6813. * 255 each, npc, lweapon, eweapon, item + 32 (ffcs)
  6814.  
  6815. --> ZC separates pointers by class. All pointers are stored in vectors, with pointer IDs ranging from 1 to 255.
  6816.  
  6817. Maximum Z Height of a Screen Object (npc, weapon, item) or Link: 32767. Values above this wrap to -32767, which is reset to 0 every frame.
  6818.  
  6819. Compiler
  6820.  
  6821. Maximum constants (any scope): Unlimited. (Constants are converted to their true value at compilation, and are not preserved by name.)
  6822. Maximum global variables: 255*
  6823. Maximum global functions: 4,294,967,295 (2^32-1).
  6824. Note that this is limited by the filesystem, as each function requires its ASCII size in bytes,
  6825. and is stored in the quest file. Many filesystems have a file size limit, that restricts it.
  6826. At the smallest function size, max functions would use ~40GB of space.
  6827. It is further restricted by the maximum buffer size at between 18MB and 22MB.
  6828.  
  6829. Script Drawing
  6830.  
  6831. Maximum number of drawing commands per frame: 1000
  6832. Maximum distance (x,y) for drawing, including off-screen areas (and bitmaps): -214747.9999 to 214747.9999 (X and Y)
  6833. Maximum Z Height for 3D Drawing: 214747.9999
  6834.  
  6835. --> Negative Z Height is effectively '0'.
  6836.  
  6837. Stack Operation
  6838.  
  6839. Maximum number of concurrent stacks: ?
  6840. --> Essentially, the maximum number of concurrent scripts; except that item scripts share one stack.
  6841.  
  6842. Maximum variables in operation at any given time: 255* (gd1-gd255)
  6843. Maximum variables per script: 255*
  6844. Maximum function calls per script ( 127* )
  6845. *Note: 255 variables will compile, but fail to run. A safe maximum is closer to 245, to allow instructions and function calls on the stack
  6846. *Note: Both variables, and function calls share registers (global variables are gd registers), and thus cumulatively count against their combined caps (within a register type). See: ZASM_Registers
  6847. --> How are these tabulated at compilation, and is there a strict ratio ( function call:variable ) ?
  6848. --> Script-scope variables use gd registers. Thus, you need to retain free registers for scripts to run.
  6849.  
  6850. Maximum script buffer size: ~18MB, including code imported with the 'import' directive.
  6851. --> Maximum line count is also limited, but it is restricted by being a signed int.
  6852. --> Thus, max line-count is somewhere around 2,147,483,647 lines, however,
  6853. this is still restricted by the 18MB buffer size.
  6854.  
  6855. Maximum number of instructions: 2^32-1 * Max Scripts
  6856. Maximum instructions per script: 4,294,967,295 (2^31 - 1)
  6857. Maximum instructions per frame: Effectively unlimited, save by instructions per script.
  6858.  
  6859. Maximum number of scripts ?
  6860. Max ffc scripts at compilation ?
  6861. Max Item scripts at compilation ?
  6862. Max global scripts at compilation ?
  6863. --> I know this is unlikely to ever be reached.
  6864.  
  6865. Maximum function calls per script: Limited by maximum instructions, and available gd registers.
  6866. Maximum local functions per script: ? Effectively unlimited, and tied to maximum functions (see above).
  6867.  
  6868. Maximum Values (Binary, Hex) for Use as Flags
  6869.  
  6870. The largest literal that you can use as a flag, binary, is: 110100011010111101
  6871. ( dec. 214717, hex 0x346BD )
  6872.  
  6873. The largest true binary value (all ones) is 11111111111111111
  6874. ( dec. 131071, hex 0x1FFFF )
  6875.  
  6876. While these are certainly possible, the largest absolutely useful value, that maximises all places in
  6877. both binary, and hex, and thus is the true flag maximum is: 65535 (decimal).
  6878. This becomes 1111111111111111b, or 0XFFFF, which means that you may use each place to its full potential,
  6879. at all times.
  6880.  
  6881. Thus, the maximum useful flags are a width of 16-bit, and are represented below.
  6882.  
  6883. Max Flag
  6884.  
  6885. Binary Hexadecimal Decimal
  6886. 1111111111111111b 0XFFFF 65535
  6887.  
  6888.  
  6889. //! A list of all known system limitations.
  6890.  
  6891. ################################
  6892. ## COMPILER ERROR DEFINITIONS ##
  6893. ################################
  6894. These errors are generated by the parser, during compilation.
  6895.  
  6896. Error codes are broken down by type:
  6897. P** Preprocessing errors.
  6898. S** Symbol table errors.
  6899. T** Type-checking errors.
  6900. G** Code Generation Errors
  6901. ** Array Errors ---We need to change these to A**
  6902.  
  6903. Errors of each class are given unique numerical identifiers, ranging from 00 to 41, such as P01, or G33.
  6904. The letter code will give you an indication of the type of error, and the full code will give you specific details.
  6905.  
  6906. In ZQuest v2.50.2 and later, the compiler will report name of the script that generated (where possible).
  6907. This applies only to errors caused by scripts, and not errors at a 'global' level, such as global functions.
  6908. Thus, if you are using 2.50.2, or later, an error without a script name is likely to be caused at global scope.
  6909.  
  6910. #####################
  6911. ## Specific Errors ##
  6912. ## Preprocessing ##
  6913. #####################
  6914.  
  6915. P00: Can't open or parse input file!
  6916.  
  6917. Your script file contains illegal characters, or is not plain ASCII Text.
  6918.  
  6919. Otherwise, it is possible that the compiler is unable to write to the disk, that the disk is out of space.
  6920.  
  6921. Last, your file may be bad, such as a file in the qrong encoding format (not ASCII text).
  6922.  
  6923. P01: Failure to parse imported file foo.
  6924.  
  6925. Generally means that you are trying to call a file via the import directive that does not exist; or that
  6926. you have a typo in the filename, or path.
  6927.  
  6928.  
  6929. P02: Recursion limit of x hit while preprocessing.
  6930.  
  6931. Caused by attempting to import a file recursively. For example:
  6932.  
  6933. If you declare: import "script.z" ... and ... the file 'script.z' has the line: ' import "script.z" ' inside it.
  6934.  
  6935. This error should no longer exist! Recursive imports should resolve as duplicate finction/variable/script declarations.
  6936.  
  6937. Error P03: You may only place import statements at file scope.
  6938.  
  6939. Import directives ( import "file.z" ) may only be declared at a global scope, not within
  6940. a function, statement, or script.
  6941.  
  6942. P35: There is already a constant with name 'foo' defined.
  6943. You attempted to define the same constant more than once.
  6944. The identifier (declared name) of all constants MUST be UNIQUE.
  6945.  
  6946.  
  6947. #####################
  6948. ## Specific Errors ##
  6949. ## Symbol Table ##
  6950. #####################
  6951.  
  6952. S04: Function 'foo' was already declared with that type signature.
  6953.  
  6954. You attempted to declare a function with the same parameters twice, int he same scope.
  6955. This can occur when using different types, if the compiler cannot resolve a difference between the signatures.
  6956.  
  6957. To fix this, remove one function,or change its signature (the arguments inside the parens) so that each is unique or;
  6958. If you declare a functiona t a global scope, and the same at a local scope, remove one of the two.
  6959.  
  6960. Note that return type is NOT enough to distinguish otherwise identical function declarations and that 'int' and 'float'
  6961. types are the same type internally, so int/float is identical insofar as the signature is concerned.
  6962.  
  6963. If two function type signatures are identical except that one has a parameter of type float where the other has the
  6964. same parameter of type int, you will have a conflict.
  6965.  
  6966. There are two additional subtle situations where you might get a conflict:
  6967.  
  6968. 1. A function declared at file scope might conflict with a function that's implicitly added to file scope
  6969. by the preprocessor because of an import statement.
  6970. 2. A function might conflict with one already reserved by the ZScript standard library (std.zh).
  6971.  
  6972. S05: Function parameter 'foo' cannot have void type.
  6973.  
  6974. You cannot set a parameter (argument of a function) as a void type. e.g.:
  6975. int foo(void var){ return var+1; }
  6976.  
  6977. This is illegal, and the param 'var' muct be changed to a legal type.
  6978.  
  6979. S06: Duplicate script with name 'foo' already exists.
  6980.  
  6981. Script names must be wholly unique. For example, if there's already an ffc script named 'my_script' you cannot
  6982. declare an item script with the name 'my_script'.
  6983.  
  6984. S07: Variable 'foo' can't have type void.
  6985.  
  6986. Variables at any scope may not have a void type. Only functions may have this type.
  6987.  
  6988. S08: There is already a variable with name 'foo' defined in this scope.
  6989.  
  6990. Variable identifiers must be unique at any given scope. Thus, this is illegal:
  6991.  
  6992. ffc script my_ffc(){
  6993. void run(int x){
  6994. int v = 1;
  6995. int w = 10;
  6996. int x = 0.5;
  6997. int y = 13;
  6998. int z = v+w+x+y;
  6999. Trace(z);
  7000. }
  7001. }
  7002.  
  7003. As the variable 'x' is declared in the params of the run() function, it cannot be declared inside the function with
  7004. the same identifier (name).
  7005.  
  7006.  
  7007. S09: Variable 'foo' is undeclared.
  7008.  
  7009. You attempted to reference a variable identifier (namme) that has not been declared.
  7010. Usually this is due to a typo:
  7011.  
  7012. int var;
  7013. if ( val > 0 ) Link->X += var;
  7014.  
  7015. Here, 'val' will return this error, as it was not declared.
  7016.  
  7017. A variable with the give name could not be found in the current or any enclosing scope. Keep in mind the following subtleties:
  7018. 1. To access a different script's global variables, or to access a global variable from within a function delcared at file scope,
  7019. you must use the dot operator: scriptname.varname.
  7020. 2. To access the data members of the ffc or item associated with a script, you must use the this pointer: this->varname.
  7021. 3. ZScript uses C++-style for loop scoping rules, so variables declared in the header part of the for loop cannot be
  7022. accessed outside the loop:
  7023.  
  7024. Code:
  7025.  
  7026. for(int i=0; i<5;i++);
  7027. i = 2; //NOT legal
  7028.  
  7029. S10: Function 'foo' is undeclared.
  7030.  
  7031. You attempted to call a function that was not declared. This is usually due to either a typo in your code, or failing
  7032. to import a mandatory header. Check that you are importing 'std.zh' as well, as failing to do this will result in a slew
  7033. of this error type.
  7034.  
  7035. S11: Script 'foo' must implement void run().
  7036.  
  7037. Every script must implement run() function call. The signature may be empty, or contain arguments.
  7038. Zelda Classic uses all the code inside the run() function when executing the script, so a script without
  7039. this function would do nothing, and will return an error.
  7040.  
  7041. S12: Script 'foo's' run() must have return type void.
  7042.  
  7043. Is this error even implemented? The run() function is automatic, and never declared by type, unless the user tries to declare
  7044. a separate run(params) function with a different type.
  7045.  
  7046. S26: Pointer types (ffc, etc) cannot be declared as global variables.
  7047.  
  7048. /* It is illegal to declare a global variable (that is, a variable in script scope) or any type other than int, float, and bool.
  7049. Why? Recall that global variables are permanent; they persist from frame to frame, screen to screen.
  7050. Pointer types, on the other hand, reference ffcs or items that are transitory; they become stale after a single WAITFRAME,
  7051. so it makes no sense to try to store them for the long term.
  7052. */
  7053.  
  7054. This explanation may no longer be true, as pointers may no longer be dereferenced by Waitframe(),
  7055. and global pointers may also be implemented in a future version.
  7056.  
  7057.  
  7058. S30: Script foo may have only one run method.
  7059.  
  7060. You may not call a run() function more than once per script.
  7061. Your run method may have any type signature, but because of this flexibility, the compiler cannot
  7062. determine which run script it the "real" entry point of the script if multiple run methods are declared.
  7063.  
  7064. S32: Script foo is of illegal type.
  7065.  
  7066. The only legal script tokens are: global, ffc, and item. You cannot declare other types (such as itemdata script).
  7067.  
  7068. S38: Script-scope global variable declaration syntax is deprecated; put declarations at file scope instead.
  7069. You cannot declare a global variable in a global script, outside the run function.
  7070.  
  7071. Example:
  7072.  
  7073. global script active{
  7074. int x;
  7075. void run(){
  7076. x = 16;
  7077. }
  7078. }
  7079.  
  7080. This is ILLEGAL. The declaration of variable 'x' must either be at a global scope, or at the scope of the
  7081. run function. Do this, instead:
  7082.  
  7083. int x;
  7084. global script active{
  7085. void run(){
  7086. x = 16;
  7087. }
  7088. }
  7089.  
  7090. This creates a global variable at the file scope.
  7091.  
  7092. S39: Array 'foo' can't have type void.
  7093. Arrays may be types of int, float, bool, ffc, item, itemdata, npc, lweapon, or eweapon; but arrays
  7094. with a void type are illegal.
  7095.  
  7096. S40: Pointer types (ffc, etc) cannot be declared as global arrays.
  7097. As of 2.50.2, global array declarations may only have the following types:
  7098. int, float, bool
  7099. Any other type is illegal.
  7100.  
  7101. S41: There is already an array with name 'foo' defined in this scope.
  7102. As with variables, and functions, arrays must have unique identifiers within the same scope.
  7103.  
  7104. ###################
  7105. ## LEXING ERRORS ##
  7106. ###################
  7107. L24: Too many global variables.
  7108.  
  7109. The assembly language to which ZScript is compiled has a built-in maximum of 256 global variables. ZScript can't do anything if you exceed this limit.
  7110.  
  7111. #####################
  7112. ## Specific Errors ##
  7113. ## Type Checking ##
  7114. #####################
  7115.  
  7116. T13: Script 'foo' has id that's not an integer.
  7117.  
  7118. /* I do not know what can cause this error, or if it ever occurs. */
  7119.  
  7120. T14: Script 'foo's' id must be between 0 and 255.
  7121.  
  7122. Occurs if you try to load more than 256 scripts of any given type at any given time.
  7123. /* The maximum number of concurrent scripts (of any given type?) is 256. */
  7124.  
  7125. T15: Script 'foo's' id is already in use.
  7126. You attempted to laod two scripts into the same slot.
  7127. /* I do not know if this is EVER possible. */
  7128.  
  7129. T16: Cast from foo to bar.
  7130.  
  7131. The only "safe" implicit casts are from int to float and vice-versa (since they are the same type),
  7132. and from int (or float) to bool (0 becomes false, anything else true).
  7133. The results of any other kind of cast are unspecified.
  7134.  
  7135. /*
  7136. Is this error still in effect? Casting from npc to itemdata, or others, usually results in a different error code.
  7137. Further, Cannot cast from wtf to int, is a thing.
  7138. */
  7139.  
  7140. Explicit casts are unimplemented and unnecessary.
  7141.  
  7142. T17: Cannot cast from foo to bar.
  7143.  
  7144. You attempted to typecast illegally, such as tyring to typecast from bool to float.
  7145.  
  7146. T18: Operand is void.
  7147. Occurs if you try to use a void type value in an operation.
  7148. /* I do not know if this is EVER possible. */
  7149.  
  7150. T19: Constant division by zero.
  7151.  
  7152. While constant-folding, the compiler has detected a division by zero
  7153.  
  7154. Example:
  7155. const int MY_CONSTANT = 0;
  7156. ffc script foo{
  7157. void run(){
  7158. int x = 6;
  7159. Link->Jump = x / MY_CONSTANT;
  7160. }
  7161. }
  7162.  
  7163. Correct the value of your constant. Perhaps you meant to use a variable?
  7164.  
  7165. Note that only division by a CONSTANT zero can be detected at compile time.
  7166. The following code, for instance, compiles with no errors but will generate script errors during execution.
  7167.  
  7168. Example:
  7169.  
  7170. int x = 0;
  7171. int y;
  7172. y = 1/x;
  7173.  
  7174.  
  7175.  
  7176.  
  7177. T20: Truncation of constant x.
  7178.  
  7179. Constants can only be specified to four places of decimal precision, withing the legal range of values.
  7180. Any extra digits are simply ignored by the compiler, which then issues this warning.
  7181.  
  7182. Any values greater than MAX_CONSTANT, or less then MIN_CONSTANT will result in this error.
  7183.  
  7184. ## Applies to variables, but does not throw an error:
  7185. Both floats and ints can only be specified to four places of decimal precision.
  7186. Any extra digits are simply ignored by the compiler, which then issues this warning.
  7187.  
  7188. Any values greater than MAX_VARIABLE, or less then MIN_VARIABLE will result in this error.
  7189.  
  7190. ########
  7191.  
  7192. T21: Could not match type signature 'foo'.
  7193.  
  7194. When calling a function, you used the wrong number, or types, of parameters.
  7195. The compiler can determine no way of casting the parameters of a function call so that they
  7196. match the type signature of a declared function.
  7197.  
  7198. For instance, in the following snippet
  7199. Code:
  7200.  
  7201. int x = Sin(true);
  7202.  
  7203. since true cannot be cast to a float, this function call cannot be matched to the library function Sin, triggering this error.
  7204.  
  7205.  
  7206. T22: Two or more functions match type signature 'foo'.
  7207.  
  7208. If there is ambiguity as to which function declaration a function call should matched to,
  7209. the compiler will attempt to determine the "best fit."
  7210. These measures are however occasionally still not enough. Consider for instance the following snippet:
  7211. Code:
  7212.  
  7213. void foo(int x, bool y) {}
  7214. void foo(bool x, int y) {}
  7215. foo(1,1);
  7216.  
  7217. matching either of the two foo declarations requires one cast, so no match can be made.
  7218. In contrast, the following code has no error:
  7219. Code:
  7220.  
  7221. void foo(int x, bool y) {}
  7222. void foo(bool x, bool y) {}
  7223. foo(1,1);
  7224.  
  7225. (The first foo function is matched.)
  7226.  
  7227. It is best to design functions so that noambiguity is possible, by addign extra params, to change the signature or by using
  7228. different identifiers (function names) when using more params is not desirable.
  7229.  
  7230. T23: This function must return a value.
  7231.  
  7232. All return statements must be followed by an expression if the enclosing function returns a value.
  7233. Note that the compiler does NOT attempt to verify that all executions paths of a function with non-void
  7234. return type actually returns a value; if you fail to return a value, the return value is undefined.
  7235. For instace, the following is a legal (though incorrect) ZScript program:
  7236.  
  7237. int foo() {}
  7238.  
  7239. /* I don't believe anythign ever returns this error.
  7240. I've seen functions with int/float/bool types, and no returns compile, without errors.
  7241. Perhaps we should fix this, and issue a warning during compilation? */
  7242.  
  7243. T25: Constant bitshift by noninteger amount; truncating to nearest integer.
  7244.  
  7245. The bitshift operators (<< and >>) require that their second parameters be whole integers.
  7246.  
  7247. T27: Left of the arrow (->) operator must be a pointer type (ffc, etc).
  7248.  
  7249. It makes no sense to write "x->foo" if x is of type int.
  7250. You may only use the dereference (->) operator on pointer types.
  7251.  
  7252. T28: That pointer type does not have a function 'foo'.
  7253.  
  7254. You tried to use the dereference operator (->) to call a function that does not exist for the pointer type being dereferenced.
  7255. Check the list of member variables and functions and verify you have not mistyped the function you are trying to call.
  7256.  
  7257. This generally occurs when calling internal functions, using the incorrect class, or namespace, such as:
  7258.  
  7259. Game->Rectangle() instead of Screen->Rectangle()
  7260.  
  7261. The extra std.zh component 'shortcuts.zh' assists in preventing this error type.
  7262.  
  7263.  
  7264. T29: That pointer type does not have a variable 'foo'.
  7265.  
  7266. You tried to use the dereference operator (->) to call a member variable that does not exist for the pointer type being dereferenced.
  7267. Check the list of member variables and verify you have not mistyped the variable you are trying to call.
  7268.  
  7269. This generally occurs when calling internal variables, using the incorrect class, or namespace, such as:
  7270.  
  7271. Link->D[] instead of Screen->D[]
  7272.  
  7273. /* The extra std.zh component 'shortcuts.zh' assists in preventing this error type.
  7274. Probaby not, as this requires silly amounts of functions to handle variables with identical identifiers.
  7275. C'est la vie. perhaps we'll do it, but I really am not fond of the idea. */
  7276.  
  7277. As above, but the member variable you tried to access does not exist.
  7278.  
  7279. Error T31: The index of 'foo' must be an integer.
  7280.  
  7281. /* This has been deprecated, so who cares? */
  7282.  
  7283.  
  7284. T36: Cannot change the value of constant variable 'foo'.
  7285.  
  7286. You cannot assign a CONSTANT to another value.
  7287.  
  7288. T37: Global variables can only be initialized to constants or globals declared in the same script.
  7289. You cannot (directly) simultaneously declare, and initialise a global value using the value of a variable at
  7290. the scope of another script, or function.
  7291.  
  7292. Example:
  7293. int x = script.a;
  7294. ffc script foo{
  7295. int a = 6;
  7296. void run(){
  7297. for ( int q = 9; q < Rand(15); q++ ) a++;
  7298. }
  7299. }
  7300.  
  7301. This is ILLEGAL. You cannot initialise the value of the global variable 'x' using the local value
  7302. of 'a' in the ffc script 'foo'.
  7303.  
  7304. /* I believe this is deprecated, as I do not believe that script level declarations remain legal */
  7305.  
  7306. T45 (old version, T38): Arrays can only be initialized to numerical values
  7307. You attempted to declare an array using a floating point value (e.g. 10.5), constant or equation,
  7308. rather than a numeric literal.
  7309.  
  7310.  
  7311. Consider that you want to declare an array with an explicit size of '40':
  7312. These are ILLEGAL:
  7313. int my_arr[26+14];
  7314. const int CONSTANT = 30;
  7315. int my_arr[CONSTANT];
  7316. int my_arr[CONSTANT/2+20]
  7317.  
  7318. YOu must declare an arrray with a numeric literal:
  7319. int my_array[40];
  7320. This is the only legal way to declare the size of an array as of 2.50.2.
  7321.  
  7322.  
  7323. #####################
  7324. ## Specific Errors ##
  7325. ## @Generation ##
  7326. #####################
  7327.  
  7328.  
  7329. G33: Break must lie inside of an enclosing for or while loop.
  7330.  
  7331. The 'break' keyword aborts the loop (in a for, while, or do statement) in which it is called.
  7332. You must be in a loop to break out of one, so calling 'break' outside of a loop is illegal.
  7333.  
  7334.  
  7335. G34: Continue must lie inside of an enclosing for or while loop.
  7336.  
  7337. The 'continue' keyword halts a loop, and repeats the loop from its head (in a for, while, or do statement) in which it is called.
  7338. You must be in a loop to continue one, so calling 'continue' outside of a loop is illegal.
  7339.  
  7340. As the above error, but with the continue keyword. Continue aborts the current iteration of the loop and skips to the next iteration.
  7341.  
  7342.  
  7343. ##################
  7344. ## Array Errors ##
  7345. ##################
  7346.  
  7347. Error A42 (old, Error O1): Array is too small. ( Converting to A42 in 2.50.3 )
  7348. You attempted to declare an array, with a set of values, where the number of values in the set
  7349. exceeds an explicit array size declaration:
  7350.  
  7351. int foo[4]={1,2,3,4,5};
  7352. The declared size is '4', but you tried to initialise it with five elements.
  7353.  
  7354. /* THis doesn't seem right, as this seems to be covered by Err 02. Check the source to see what causes this. */
  7355.  
  7356. Error O2: Array initializer larger than specified dimensions. ( Converting to A43 in 2.50.3)
  7357. You attempted to initialise an array, with a set of values, where the number of values in the set
  7358. exceeds an explicit array size declaration:
  7359.  
  7360. int foo[4]={1,2,3,4,5};
  7361. The declared size is '4', but you tried to initialise it with five elements.
  7362.  
  7363. Error O3: String array initializer larger than specified dimensions, space must be allocated for NULL terminator.
  7364. ( Convering to A44 in 2.50.3 )
  7365. YOu attempted to seclare a QUOTEDSTRING of an explicit size, but you didn;t add space
  7366. for the NULL terminator; or you used more chars than you allocated:
  7367.  
  7368. int my_string[17]="This is a string.";
  7369. THis allocates only enough indices for the chars, but not for the NULL terminator.
  7370. The array size here needs to be 18.
  7371. int my_string[12]="THis is a string.";
  7372. You tried to initialise a QUOTEDSTRING that is longer than the array size.
  7373. The minimum array size for this is '18'.
  7374.  
  7375. It is generally best either to declare strings with an implicit size (set by the initialiser):
  7376. int my_string[]="This is a string";
  7377. This reads the nuber of chars, adds one to the count (for NULL), and sizes the array to 18.
  7378. ...or...
  7379. Declare the string with an arbitrarily large size:
  7380. int my_string[256]="This is a string";
  7381. This reserves 256 chars. Only 18 are used, and the rest of the indices
  7382. are initialised as '0' (NULL). YOu may later populate the unused space, if desired.
  7383.  
  7384.  
  7385. #################
  7386. ## Misc Errors ##
  7387. #################
  7388.  
  7389. FATAL FATAL ERROR I0: bad internal error code
  7390. A fallback error if no other type matches the problem.
  7391.  
  7392. /* I have no idea what causes this. Be afraid, very afraid. */
  7393.  
  7394. /* OTHER ERRORS
  7395. Document any further error codes here.
  7396. We need to convert the array errors from raw numeric, to A** codes.
  7397. */
  7398.  
  7399. ########################
  7400. ## OPERATIONAL ERRORS ##
  7401. ###################################################################################################
  7402. ## These errors occur only during the operation of script execution (i.e. when running a script, ##
  7403. ## in Zelda Classic while playing a quest). ##
  7404. ## --------------------------------------------------------------------------------------------- ##
  7405. ## In ZC versions 2.50.2, and later, operational script errors will return the ID of the script ##
  7406. ## from which they were generated. ##
  7407. ###################################################################################################
  7408.  
  7409. //! These errors will be reported to allegro.log (or the ZConsole) when scripts run.
  7410.  
  7411.  
  7412.  
  7413. ////////////////////
  7414. /// Stack Errors ///
  7415. ////////////////////
  7416.  
  7417. "Stack over or underflow, stack pointer = %ld\n"
  7418.  
  7419. * !? How should I describe this, and give examples?
  7420.  
  7421. "Invalid ZASM command %ld reached\n"
  7422.  
  7423. Stack instruction countber reached, or exceeded. The stack counter is an unsigned int, so it's maximum value is 65536.
  7424. You have isused more instructiosn this frame than the instructon counter can ahndle. Look through your code for
  7425. something that may be doing this.
  7426.  
  7427. ////////////////////
  7428. /// Array Errors ///
  7429. ////////////////////
  7430.  
  7431. "Invalid value (%i) passed to '%s'\n"
  7432. "Invalid index (%ld) to local array of size %ld\n"
  7433.  
  7434. You attempted to reference an array index that is either too small, or too large.
  7435. Check the size of your array, and try again.
  7436. Perhaps you have a for loop, or other loop that is parsing the array, and trying to read beyond its index ranges.
  7437.  
  7438.  
  7439. "Invalid pointer (%i) passed to array (don't change the values of your array pointers)\n"
  7440.  
  7441. Array pointers values in operation are 1 through 4095, ( and 4096 to 8164? as declared global pointers ?).
  7442. An array may not have a pointer of '0', nor may you reference an array for which a pointer does not exist.
  7443. Often, this error is caused by attempting to reference an array that you created, without updating the saved game slot
  7444. as the old save does not have the array allocated, but the script is attempting to reference its global ID.
  7445.  
  7446. "Script tried to deallocate memory at invalid address %ld\n"
  7447. "Script tried to deallocate memory that was not allocated at address %ld\n"
  7448.  
  7449. /* Script attempted to change the value of an array index // that does not exist // due to the inability to declare an array
  7450. because too many registers are in use?
  7451.  
  7452.  
  7453. "You were trying to reference an out-of-bounds array index for a screen's D[] array (%ld); valid indices are from 0 to 7.\n"
  7454. You attempted to read, or write to a Screen->D[register] that was less than 1, or greater than 10.
  7455. Check for loops, and vriables that read/write to Screen->D for any that can fall outside the legal range.
  7456.  
  7457. "Array initialized to invalid size of %d\n"
  7458. You attempted to init array to a size less than 1, or a size greater than 214747, or;
  7459. You attempted to init array with a constant, a variable, a formula, or with a floating point value.
  7460. Arrays may ONLY be initialised with numeric literals (integers only) between 1 and 214747.
  7461.  
  7462. "%d local arrays already in use, no more can be allocated\n", MAX_ZCARRAY_SIZE-1);
  7463. The maximum number of arrays in operation at one time is 4095.
  7464.  
  7465. "Invalid pointer value of %ld passed to global allocate\n"
  7466. !
  7467.  
  7468. /////////////////////////////
  7469. /// Object Pointer Errors ///
  7470. /////////////////////////////
  7471.  
  7472. "Invalid NPC with UID %ld passed to %s\nNPCs on screen have UIDs "
  7473. "Invalid item with UID %ld passed to %s\nItems on screen have UIDs "
  7474. "Invalid lweapon with UID %ld passed to %s\nLWeapons on screen have UIDs "
  7475. "Invalid eweapon with UID %ld passed to %s\nEWeapons on screen have UIDs "
  7476.  
  7477. "Script attempted to reference a nonexistent NPC!\n"
  7478. "You were trying to reference the %s of an NPC with UID = %ld; NPC on screen are UIDs "
  7479.  
  7480. "Script attempted to reference a nonexistent item!\n"
  7481. "You were trying to reference an item with UID = %ld; Items on screen are UIDs: "
  7482.  
  7483. "Script attempted to reference a nonexistent LWeapon!\n"
  7484. "You were trying to reference the %s of an LWeapon with UID = %ld; LWeapons on screen are UIDs "
  7485.  
  7486. "Script attempted to reference a nonexistent EWeapon!\n"
  7487. "You were trying to reference the %s of an EWeapon with UID = %ld; EWeapons on screen are UIDs "
  7488.  
  7489. You attempted to reference a game object that has a maximum legal range of 1 to 255.
  7490. It is possible that you tried to read outside that range, or that the pointer that you were loading is not valid.
  7491. Check NumItems(), NumLWeapons(), NumEWeapons(0, and NumNPCs() before referencing them; and verify that the object ->IsValid()
  7492. Check for loops that may attempt ro reference items outside of the range that actually exist.
  7493. Look for any for loops that access these objects, that start, or end at zero.
  7494.  
  7495. The best way to ensure this does not occur, is to make a for loop as follows:
  7496.  
  7497. for ( int q = 1; q < Screen->NumLWeapons; q++ )
  7498.  
  7499. //or//
  7500.  
  7501. for ( int q = Screen->NumLWeapons(); q > 0; q-- )
  7502.  
  7503. ...replacing NumLWeapons() withthe appropriate type that you are attempting to load.
  7504.  
  7505. You may be attempting to refrence a pointer that has fallen out of scope.
  7506. You may be attempting to reference a pointer that is no longer valid, or has been removed.
  7507. Check ( pinter->IsValid() ) by itself, to ensure this does not occur:
  7508.  
  7509. if ( pointer->IsValid ) {
  7510. if ( pointer->ID == LW_FIRE ) //Do things.
  7511. }
  7512.  
  7513. This helps to prevent loading invalid pointers.
  7514.  
  7515. ////////////////////////////////
  7516. /// Maths and Logical Errors ///
  7517. ////////////////////////////////
  7518.  
  7519. "Script attempted to divide %ld by zero!\n"
  7520. "Script attempted to modulo %ld by zero!\n"
  7521.  
  7522. "Script attempted to pass %ld into ArcSin!\n"
  7523. "Script attempted to pass %ld into ArcCos!\n"
  7524. "Script tried to calculate log of 0\n"
  7525. "Script tried to calculate log of %f\n"
  7526. "Script tried to calculate ln of 0\n"
  7527. "Script tried to calculate ln of %f\n"
  7528. "Script attempted to calculate 0 to the power 0!\n"
  7529. "Script attempted to calculate square root of %ld!\n"
  7530.  
  7531. Look for scripts that pass a variable into these functions, or use a variable in a mathematical operation, that
  7532. may be zero at any point, and correct it to ensure that it is never zero, or that it is never illegal for the type of
  7533. mathematical operation you wish to perform.
  7534.  
  7535. Chweck for any hardcoded values, or constants that are in use with these functions that may be illegal, or irrational.
  7536.  
  7537. ////////////////////////////////
  7538. /// System Limitation Errors ///
  7539. ////////////////////////////////
  7540.  
  7541. "Couldn't create lweapon %ld, screen lweapon limit reached\n"
  7542. "Couldn't create eweapon %ld, screen eweapon limit reached\n"
  7543. "Couldn't create item \"%s\", screen item limit reached\n"
  7544. "Couldn't create NPC \"%s\", screen NPC limit reached\n"
  7545.  
  7546. You may create a maximum of 255 of any one object type on the screen at any one time.
  7547. Look for anything that is generating extra pointers, and add a statement such as:
  7548. if ( Screen->NumNPCs() < 255 )
  7549.  
  7550. "Max draw primitive limit reached\n"
  7551. The maximum number of drawing function calls, per frame, is 1,000.
  7552.  
  7553. /////////////////////
  7554. /// String Errors ///
  7555. /////////////////////
  7556.  
  7557. "Array supplied to 'Game->GetDMapMusicFilename' not large enough\n"
  7558. "Array supplied to 'Game->GetSaveName' not large enough\n"
  7559. "String supplied to 'Game->GetSaveName' too large\n"
  7560. "Array supplied to 'Game->GetMessage' not large enough\n"
  7561. "Array supplied to 'Game->GetDMapName' not large enough\n"
  7562. "Array supplied to 'Game->GetDMapTitle' not large enough\n"
  7563. "Array supplied to 'Game->GetDMapIntro' not large enough\n"
  7564. "Array supplied to 'itemdata->GetName' not large enough\n"
  7565. "Array supplied to 'npc->GetName' not large enough\n"
  7566.  
  7567. The buffer for these actions must be equal to the size of the text to load into it, plus one, for NULL.
  7568.  
  7569. If you wish to load a game name, with Game->LoadSaveName(), and the name on the file select is FOO, you must
  7570. supply a buffer with a size of [4] to hold it. (Three chars in the name, plus one for NULL.)
  7571.  
  7572. ////////////////////
  7573. /// Misc. Errors ///
  7574. ////////////////////
  7575.  
  7576. "Waitdraw can only be used in the active global script\n"
  7577. You attempted to call Waitdrw() in an ffc script, or an item script; or in your global OnContinue,
  7578. global OnExit, or ~Init scripts.
  7579. You may only use the Waitdraw() function from a global active script.
  7580.  
  7581. "No other scripts are currently supported\n"
  7582. ? You should never see this. May indicate that you have attempted to load more scripts than ZC can handle.
  7583.  
  7584.  
  7585. "Invalid value (%i) passed to '%s'\n"
  7586. !? WHat should we put here?
  7587.  
  7588. "Global scripts currently have no A registers\n"
  7589. This error can only occur if you are coding ZASM, and attempt to utilise an Address register with a global script.
  7590.  
  7591. ////////////////////////
  7592. /// Script Reporting ///
  7593. ////////////////////////
  7594.  
  7595. //Events that will be recorded if Quest Rule 'Log Game Events to Allegro.log' is enabled:
  7596.  
  7597. "Script created lweapon %ld with UID = %ld\n"
  7598. "Script created eweapon %ld with UID = %ld\n"
  7599. "Script created item \"%s\" with UID = %ld\n"
  7600. "Script created NPC \"%s\" with UID = %ld\n"
  7601.  
  7602. When any new game object is generated by script, and reporting is enabled, the lweapon, and the name of the
  7603. script that generated it, will be reported to allegro.log.
  7604.  
  7605.  
  7606. ///////////////////////////
  7607. /// Documentation Staff ///
  7608. ///////////////////////////
  7609.  
  7610. ZScript documentation generated, and maintained by:
  7611. DarkDragon (retired)
  7612. Gleeok
  7613. Saffith
  7614. ZoriaRPG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement