ZoriaRPG

zscript.txt for ZC 2.55

Nov 25th, 2016
142
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Docs for 2.50.2
  2. //Rev. 0.6.9
  3. //11th July, 2016
  4.  
  5. Search for !#! to find areas that require completion.
  6. ?REFFFC? What is this?
  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 ClearTile(int tileref); ZASM Instruction:
  392. CLEARTILER <d3>
  393. CLEARTILEV
  394. /**
  395. * Erases the tile specified by tileref.
  396. * This change is temporary within the quest file
  397. * and will not be retained when saving the game.
  398. * Tiles are not / are (!check!) shifted upward to adjust for the cleared tile.
  399. *
  400. */ Example Use:
  401.  
  402. ClearTile(21362);
  403. Clears tile 21362 by ( blanking it to colour 0 ) | ( removing it and shifting all tiles
  404. thereafter upward ).
  405.  
  406. /************************************************************************************************************/
  407.  
  408. //Overlay Tile
  409.  
  410. //! Is there a ZScript equivalent of this?!
  411. //! This instruction seems to be ***ZASM-specific***.
  412. //! Game->overlayTile() and Screen->OverlayTile() both return an error (no such pointer).
  413. //! Add this to the bytecode in a future build.
  414. //! As far as I can tell, this should work from ZASM, but it was never added to the ZScript side. (11/July/2016: ZRPG)
  415.  
  416. void OverlayTile() ?
  417.  
  418. OVERLAYTILEVV
  419. OVERLAYTILEVR
  420. OVERLAYTILERV
  421. OVERLAYTILERR
  422.  
  423. /************************************************************************************************************/
  424.  
  425. ///////////////
  426. /// Tracing ///
  427. ///////////////
  428.  
  429.  
  430. void Trace(float val); ZASM Instruction:
  431. TRACER d3
  432. TRACEV
  433. /**
  434. * Prints a line containing a string representation of val to allegro.log.
  435. * Useful for debugging scripts. You may trace int, and float types.
  436. * For b oolean values, see TraceB() below.
  437. * Values printed to allegro.log no not incorporate any spacing, or carriage
  438. * returns. You must manually add these into your commands.
  439. * Int values are not truncated when printed, and will always have four leading
  440. * zeros after the decimal point.
  441. * To add new lines (carriange returns), see TraceNL() below.
  442. *
  443. */ Example Use:
  444.  
  445. int val = 4;
  446. Trace(val);
  447. Prints 4.000 to allegro.log
  448.  
  449. /************************************************************************************************************/
  450.  
  451. void TraceB(bool state); ZASM Instruction:
  452. TRACE2R d3
  453. TRACE2V
  454. /**
  455. * Prints a boolean state to allegro.log. Works as trace() above, but prints 'true'
  456. * or 'false' to allegro.log
  457. *
  458. */ Example Use:
  459.  
  460. bool test = true;
  461. TraceB(test);
  462. Prints 'true' to allegro.log.
  463.  
  464. /************************************************************************************************************/
  465.  
  466. void TraceToBase( int val, int base, ZASM Instruction:
  467. int mindigits ); TRACE3
  468. /**
  469. * Prints a line in allegro.log representing 'val' in numerical base 'base',
  470. * where 2 <= base <= 36, with minimum digits 'mindigits'.
  471. * (Base must be at least base-2, and at most, base-36)
  472. * Can be useful for checking hex values or flags ORed together, or just to trace
  473. * an integer value, as Trace() always traces to four decimal places.
  474. * mindigits specifies the minimum number of integer digits to print.
  475. * Unlike Trace(), Decimal values are not printed. TraceToBase *does not* handle floats.
  476. * If you specify a floating point value as arg 'val', it will be Floored before conversion.
  477. *
  478. */ Example Use:
  479.  
  480. TraceToBase(20,8,1);
  481. Converts (decimal) d20 to base-8 (o24 in base-8) and prints value '024' to allegro.log
  482.  
  483. TraceToBase(50,16,1);
  484. Converts (decimal) d50 to base-16 (0x32 hexadecimal) and prints value '0x32' to allegro.log.
  485.  
  486. /************************************************************************************************************/
  487.  
  488. void ClearTrace(); ZASM Instruction:
  489. TRACE4
  490. /**
  491. * Clears allegro.log of all current traces and messages from Zelda Classic/ZQuest.
  492. * Works on a per-quest, per-session basis. Values recorded from previous sessions are not erased.
  493. *
  494. */ Example Use
  495.  
  496. ClearTrace();
  497.  
  498. /************************************************************************************************************/
  499.  
  500. void TraceNL(); ZASM Instruction:
  501. TRACE5
  502. /**
  503. * Traces a newline to allegro.log
  504. * This inserts a carriage return (as if pressing return/enter) into allegro.log
  505. * and is useful for providing formatting to debugging.
  506. *
  507. */ Example Use:
  508.  
  509. TraceNL();
  510. Prints a carriage return to allegro.log.
  511.  
  512. /************************************************************************************************************/
  513.  
  514. void TraceS(int s[]); ZASM Instruction:
  515. TRACE6 d3
  516. /**
  517. * Works as Trace() above, but prints a full string to allegro.log, using the array pointer
  518. * (name) as its argument.
  519. * Maximum 512 characters. Functions from string.zh can be used to split larger strings.
  520. *
  521. */ Example Use:
  522.  
  523. int testString[]="This is a string.";
  524. TraceS(testString);
  525. Prints 'This is a string.' to allegro.log.
  526.  
  527. /************************************************************************************************************/
  528.  
  529. ///////////////////////
  530. /// Array Functions ///
  531. ///////////////////////
  532.  
  533.  
  534. int SizeOfArray(int array[]); ZASM Instruction:
  535. ARRAYSIZE d2
  536. /**
  537. * Returns the index size of the array pointed by 'array'.
  538. * Works only on int, and float type arrays. Boolean arrays are not supported.
  539. * Useful in for loops.
  540. *
  541. */ Example Use:
  542.  
  543. int isAnArray[216];
  544. int x;
  545. x = SizeOfArray(isAnArray);
  546. The value of x becomes 216.
  547.  
  548. /************************************************************************************************************/
  549.  
  550. //////////////////////////////
  551. /// Mathematical Functions ///
  552. //////////////////////////////
  553.  
  554. int Rand(int n); ZASM Instruction:
  555. RNDR<><> d2,d3
  556. RNDV<><>
  557.  
  558. /**
  559. * Computes and returns a random integer from 0 to n-1,
  560. * or a negative value between n+1 and 0 if 'n' is negative.
  561. *
  562. * Note: The paramater 'n' is an integer, and any floating point (ZScript float)
  563. * value passed to it will be truncated (floored) to the nearest integer.
  564. * Rand(3.75) is identical to Rand(3).
  565. */ Example Use:
  566.  
  567. Rand(40);
  568. Produces a random number between 0 and 39.
  569. Rand(-20);
  570. produces a random number between -19 and 0.
  571.  
  572.  
  573. /************************************************************************************************************/
  574.  
  575. float Sin(float deg); ZASM Instruction:
  576. SINR<><> d2,d3
  577. SINV<><>
  578.  
  579. /**
  580. * Returns the trigonometric sine of the parameter, which is interpreted
  581. * as a degree value.
  582. *
  583. */ Example Use:
  584.  
  585. float x = Sin(32);
  586. x = 0.5299
  587.  
  588. /************************************************************************************************************/
  589.  
  590. float Cos(float deg); ZASM Instruction:
  591. COSR<><> d2,d3
  592. COSV<><>
  593.  
  594. /**
  595. * Returns the trigonometric cosine of the parameter, which is
  596. * interpreted as a degree value.
  597. *
  598. */ Example Usage:
  599.  
  600. float x = Cos(40);
  601. x = 0.7660
  602.  
  603. /************************************************************************************************************/
  604.  
  605. float Tan(float deg); ZASM Instruction:
  606. TANR<><> d2,d3
  607. TANV<><>
  608.  
  609. /**
  610. * Returns the trigonometric tangent of the parameter, which is
  611. * interpreted as a degree value. The return value is undefined if
  612. * deg is of the form 90 + 180n for an integral value of n.
  613. *
  614. */ Example Use:
  615.  
  616. float x = Tan(100);
  617. x = -5.6712
  618.  
  619. /************************************************************************************************************/
  620.  
  621. //!Sources: OMultImmediate, OArcSinRegister
  622. //Is there a direct ZASM instruction equivalent, or does this function run as a routine?
  623.  
  624. float RadianSin(float rad);
  625. /**
  626. * Returns the trigonometric sine of the parameter, which is interpreted
  627. * as a radian value.
  628. *
  629. */ Example Use:
  630.  
  631. /************************************************************************************************************/
  632.  
  633. //!Sources: OMultImmediate, OCosRegister
  634. //Is there a direct ZASM instruction equivalent, or does this function run as a routine?
  635.  
  636. float RadianCos(float rad);
  637. /**
  638. * Returns the trigonometric cosine of the parameter, which is
  639. * interpreted as a radian value.
  640. *
  641. */ Example Use:
  642.  
  643. /************************************************************************************************************/
  644.  
  645. //!Sources: OMultImmediate, OTanRegister
  646. //Is there a direct ZASM instruction equivalent, or does this function run as a routine?
  647.  
  648. float RadianTan(float rad);
  649. /**
  650. * Returns the trigonometric tangent of the parameter, which is
  651. * interpreted as a radian value. The return value is undefined for
  652. * values of rad near (pi/2) + n*pi, for n an integer.
  653. *
  654. */ Example Use:
  655.  
  656. /************************************************************************************************************/
  657.  
  658. float ArcTan(int x, int y); ZASM Instruction:
  659. ARCTANR<>
  660. (Does ARCTANV exist?)
  661. /**
  662. * Returns the trigonometric arctangent of the coordinates, which is
  663. * interpreted as a radian value.
  664. *
  665. */ Example Use:
  666.  
  667. /************************************************************************************************************/
  668.  
  669. float ArcSin(float x); ZASM Instruction:
  670. ARCSINR<><>
  671. ARCSINV<><> (Can't find this in the source code)
  672. ffasm.cpp line 217
  673. /**
  674. * Returns the trigonometric arcsine of x, which is
  675. * interpreted as a radian value.
  676. *
  677. */ Example Use:
  678.  
  679. /************************************************************************************************************/
  680.  
  681. float ArcCos(float x); ZASM Instruction:
  682. ARCCOSR<><>
  683. ARCCOSV<><>
  684.  
  685. /**
  686. * Returns the trigonometric arccosine of x, which is
  687. * interpreted as a radian value.
  688. *
  689. */ Example Use:
  690.  
  691. /************************************************************************************************************/
  692.  
  693. float Max(float a, float b); ZASM Instruction:
  694. MAXR<><>
  695. MAXV<><>
  696. /**
  697. * Returns the greater of a and b.
  698. *
  699. */ Example Use:
  700.  
  701. /************************************************************************************************************/
  702.  
  703. float Min(float a, float b); ZASM Instriction:
  704. MINR<><>
  705. MINV<><>
  706. /**
  707. * Returns the lesser of a and b.
  708. *
  709. */ Example Use:
  710.  
  711. /************************************************************************************************************/
  712.  
  713. int Pow(int base, int exp); ZASM Instruction:
  714. POWERR<><>
  715. POWERV<><>
  716. /**
  717. * Returns base^exp. The return value is undefined for base=exp=0. Note
  718. * also negative values of exp may not be useful, as the return value is
  719. * truncated to the nearest integer.
  720. *
  721. */ Example Use:
  722.  
  723. /************************************************************************************************************/
  724.  
  725. int InvPow(int base, int exp); ZASM Instruction:
  726. IPOWERR<><>
  727. IPOWERV<><>
  728. /**
  729. * Returns base^(1/exp). The return value is undefined for exp=0, or
  730. * if exp is even and base is negative. Note also that negative values
  731. * of exp may not be useful, as the return value is truncated to the
  732. * nearest integer.
  733. *
  734. */ Example Use:
  735.  
  736. /************************************************************************************************************/
  737.  
  738. float Log10(float val); ZASM Instruction:
  739. LOG10<>
  740. /**
  741. * Returns the log of val to the base 10. Any value <= 0 will return 0.
  742. *
  743. */ Example Use:
  744.  
  745. /************************************************************************************************************/
  746.  
  747. float Ln(float val); ZASM Instruction:
  748. LOGE<>
  749.  
  750. /**
  751. * Returns the natural logarithm of val (to the base e). Any value <= 0 will return 0.
  752. *
  753. */ Example Use:
  754.  
  755. /************************************************************************************************************/
  756.  
  757. int Factorial(int val); ZASM Instruction:
  758. FACTORIAL<>
  759. /**
  760. * Returns val!. val < 0 returns 0.
  761. *
  762. */ Example Use:
  763.  
  764. /************************************************************************************************************/
  765.  
  766. float Abs(float val); ZASM Instruction:
  767. ABS<>
  768. /**
  769. * Return the absolute value of the parameter, if possible. If the
  770. * absolute value would overflow the parameter, the return value is
  771. * undefined.
  772. *
  773. */ Example Use:
  774.  
  775. /************************************************************************************************************/
  776.  
  777. float Sqrt(float val); ZASM Instruction:
  778. SQROOTV<><>
  779. SQROOTR<><>
  780. /**
  781. * Computes the square root of the parameter. The return value is
  782. * undefined for val < 0.
  783. * NOTE: Passing negative values to Sqrt() will return an error. See SafeSqrt() in std.zh
  784. */ Example Use:
  785.  
  786. int x = Sqrt(16);
  787. x = 4
  788.  
  789. /************************************************************************************************************/
  790. /************************************************************************************************************/
  791.  
  792.  
  793.  
  794. //====================================
  795. //--- Game Functions and Variables ---
  796. //====================================
  797.  
  798. namespace Game
  799.  
  800.  
  801.  
  802. int GetCurScreen(); ZASM Instruction:
  803. CURSCR
  804. /**
  805. * Retrieves the number of the current screen within the current map.
  806. */ Example Use: !#!
  807.  
  808. /************************************************************************************************************/
  809.  
  810. int GetCurDMapScreen(); ZASM Instruction:
  811. CURDSCR
  812. /**
  813. * Retrieves the number of the current screen within the current DMap.
  814. */ Example Use: !#!
  815.  
  816. /************************************************************************************************************/
  817.  
  818. int GetCurLevel(); ZASM Instruction:
  819. CURLEVEL
  820. /**
  821. * Retrieves the number of the dungeon level of the current DMap. Multiple
  822. * DMaps can have the same dungeon level - this signifies that they share
  823. * a map, compass, level keys and such.
  824. */ Example Use: !#!
  825.  
  826. /************************************************************************************************************/
  827.  
  828. int GetCurMap(); ZASM Instruction:
  829. CURMAAP
  830. /**
  831. * Retrieves the number of the current map.
  832. */ Example Use: !#!
  833.  
  834. /************************************************************************************************************/
  835.  
  836. int GetCurDMap(); ZASM Instruction:
  837. CURDMAP
  838. /**
  839. * Returns the number of the current DMap.
  840. */ Example Use: !#!
  841.  
  842. /************************************************************************************************************/
  843.  
  844. int DMapFlags[]; ZASM Instruction:
  845. DMAPFLAGSD
  846. /**
  847. * An array of 512 integers, containing the DMap's flags ORed (|) together.
  848. * Use the 'DMF_' constants, or the 'DMapFlag()' functions from std.zh if you are not comfortable with binary.
  849. */ Example Use: !#!
  850.  
  851. /************************************************************************************************************/
  852.  
  853. int DMapLevel[]; ZASM Instruction:
  854. DMAPLEVELD
  855. /**
  856. * An array of 512 integers containing each DMap's level
  857. */ Example Use: !#!
  858.  
  859. /************************************************************************************************************/
  860.  
  861. int DMapCompass[]; ZASM Instruction:
  862. DMAPCOMPASSD
  863. /**
  864. * An array of 512 integers containing each DMap's compass screen
  865. */ Example Use: !#!
  866.  
  867. /************************************************************************************************************/
  868.  
  869. int DMapContinue[]; ZASM Instruction:
  870. DMAPCONTINUED
  871. /**
  872. * An array of 512 integers containing each DMap's continue screen
  873. */ Example Use: !#!
  874.  
  875. /************************************************************************************************************/
  876.  
  877. int DMapMIDI[]; ZASM Instruction:
  878. DMAPMIDID
  879. /**
  880. * An array of 512 integers containing each DMap's MIDI.
  881. * Positive numbers are for custom MIDIs, and negative values are used for
  882. * the built-in game MIDIs. Because of the way DMap MIDIs are handled
  883. * internally, however, built-in MIDIs besides the overworld, dungeon, and
  884. * level 9 songs won't match up with Game->PlayMIDI() and Game->GetMIDI().
  885. */ Example Use: !#!
  886.  
  887. /************************************************************************************************************/
  888.  
  889. void GetDMapName(int DMap, int buffer[]);
  890.  
  891. ZASM Instruction:
  892. GETDMAPNAME
  893. /**
  894. * Loads DMap with ID 'DMap's name into 'buffer'.
  895. * See std.zh for appropriate buffer size.
  896. */ Example Use: !#!
  897.  
  898. /************************************************************************************************************/
  899.  
  900. void GetDMapTitle(int DMap, int buffer[]);
  901.  
  902. ZASM Instruction:
  903. GETDMAPTITLE
  904. /**
  905. * Loads DMap with ID 'DMap's title into 'buffer'.
  906. * See std.zh for appropriate buffer size.
  907. */ Example Use: !#!
  908.  
  909. /************************************************************************************************************/
  910.  
  911. void GetDMapIntro(int DMap, int buffer[]);
  912.  
  913. ZASM Instruction:
  914. GETDMAPINTRO
  915. /**
  916. * Loads DMap with ID 'DMap's intro string into 'buffer'.
  917. * See std.zh for appropriate buffer size.
  918. */ Example Use: !#!
  919.  
  920. /************************************************************************************************************/
  921.  
  922. int DMapOffset[]; ZASM Instruction:
  923. DMAPOFFSET
  924. /**
  925. * An array of 512 integers containing the X offset of each DMap.
  926. * Game->DMapOffset is read-only; while setting it is not syntactically
  927. * incorrect, it does nothing.
  928. */ Example Use: !#!
  929.  
  930. /************************************************************************************************************/
  931.  
  932. int DMapMap[]; ZASM Instruction:
  933. DMAPMAP
  934.  
  935. /**
  936. * An array of 512 integers containing the map used by each DMap.
  937. * Game->DMapMap is read-only; while setting it is not syntactically
  938. * incorrect, it does nothing.
  939. */ Example Use: !#!
  940.  
  941. /************************************************************************************************************/
  942.  
  943. int NumDeaths; ZASM Instruction:
  944. GAMEDEATHS
  945. /**
  946. * Returns or sets the number of times Link has perished during this quest.
  947. */ Example Use: !#!
  948.  
  949. /************************************************************************************************************/
  950.  
  951. int Cheat; ZASM Instruction:
  952. GAMECHEAT
  953. /**
  954. * Returns, or sets the current cheat level of the quest player.
  955. * Valid values are 0, 1, 2, 3, and 4.
  956. */ Example Use: !#!
  957.  
  958. /************************************************************************************************************/
  959.  
  960. int Time ZASM Instruction:
  961. GAMETIME
  962. /**
  963. * Returns the time elapsed in this quest, in 60ths of a second. (i.e. in frames).
  964. * The return value is undefined if TimeValid is false (see below).
  965. */ Example Use: !#!
  966.  
  967. /************************************************************************************************************/
  968.  
  969. bool TimeValid; ZASM Instruction:
  970. GAMETIMEVALID
  971. /**
  972. * True if the elapsed quest time can be determined for the current quest.
  973. */ Example Use: !#!
  974.  
  975. /************************************************************************************************************/
  976.  
  977. bool HasPlayed; ZASM Instruction:
  978. GAMEHASPLAYED
  979. /**
  980. * This value is true if the current quest session was loaded from a saved
  981. * game, false if the quest was started fresh.
  982. */ Example Use: !#!
  983.  
  984. /************************************************************************************************************/
  985.  
  986. bool Standalone; ZASM Instruction:
  987. GAMESTANDALONE
  988. /**
  989. * This value is true if the game is running in standalone mode, false if not.
  990. * Game->Standalone is read-only; while setting it is not syntactically
  991. * incorrect, it does nothing.
  992. *
  993. * Standalone mode is set by command line params when launching ZC.
  994. */ Example Use: !#!
  995.  
  996. /************************************************************************************************************/
  997.  
  998. int GuyCount[]; ZASM Instruction:
  999. GAMEGUYCOUNT
  1000. /**
  1001. * The number of NPCs (enemies and guys) on screen i of this map, where
  1002. * i is the index used to access this array. This array is exclusively used
  1003. * to determine which enemies had previously been killed, and thus won't
  1004. * return, when you re-enter a screen.
  1005. */ Example Use: !#!
  1006.  
  1007. /************************************************************************************************************/
  1008.  
  1009. int ContinueDMap; ZASM Instruction:
  1010. GAMECONTDMAP
  1011. /**
  1012. * Returns or sets the DMap where Link will be respawned after quitting and reloading the game.
  1013. */ Example Use: !#!
  1014.  
  1015. /************************************************************************************************************/
  1016.  
  1017. int ContinueScreen; ZASM Instruction:
  1018. GAMECONTSCR
  1019. /**
  1020. * Returns or sets the map screen where Link will be respawned after quitting and reloading the game.
  1021. */ Example Use: !#!
  1022.  
  1023. /************************************************************************************************************/
  1024.  
  1025. int LastEntranceDMap; ZASM Instruction:
  1026. GAMEENTRDMAP
  1027. /**
  1028. * Returns or sets the DMap where Link will be respawned after dying and continuing.
  1029. */ Example Use: !#!
  1030.  
  1031. /************************************************************************************************************/
  1032.  
  1033. int LastEntranceScreen; ZASM Instruction:
  1034. GAMEENTRSCR
  1035. /**
  1036. * Returns or sets the map screen where Link will be respawned after dying and continuing.
  1037. */ Example Use: !#!
  1038.  
  1039. /************************************************************************************************************/
  1040.  
  1041. int Counter[]; ZASM Instruction:
  1042. GAMECOUNTERD
  1043. /**
  1044. * Returns of sets the current value of the game counters.
  1045. * Use the CR_ constants in std.zh to index into this array.
  1046. */ Example Use: !#!
  1047.  
  1048. /************************************************************************************************************/
  1049.  
  1050. int MCounter[]; ZASM Instruction:
  1051. GAMEMCOUNTERD
  1052. /**
  1053. * Returns or sets the current maximum value of the game counters.
  1054. * Use the CR_ constants in std.zh to index into this array.
  1055. */ Example Use: !#!
  1056.  
  1057. /************************************************************************************************************/
  1058.  
  1059. int DCounter[]; ZASM Instruction:
  1060. GAMEDCOUNTERD
  1061. /**
  1062. * Returns of sets the current value of the game drain counters.
  1063. * Use the CR_ constants in std.zh to index into this array.
  1064. * Note that if the player hasn't acquired the '1/2 Magic Upgrade' yet,
  1065. * then setting the CR_MAGIC drain counter to a negative value will
  1066. * drain the magic counter by 2 per frame rather than 1.
  1067. */ Example Use: !#!
  1068.  
  1069. /************************************************************************************************************/
  1070.  
  1071. int Generic[]; ZASM Instruction:
  1072. GAMEGENERICD
  1073. /**
  1074. * An array of miscellaneous game values, such as number of heart
  1075. * containers and magic drain rate.
  1076. * Use the GEN_ constants in std.zh to index into this array.
  1077. */ Example Use: !#!
  1078.  
  1079. /************************************************************************************************************/
  1080.  
  1081. int LItems ZASM Instruction:
  1082. GAMELITEMSD
  1083. /**
  1084. * The exploration items (map, compass, boss key etc.) of dungeon level i
  1085. * currently under the possession of the player, where i is
  1086. * the index used to access this array. Each element of this
  1087. * array consists of flags OR'd (|) together; use the LI_ constants in
  1088. * std.zh to set or compare these values.
  1089. */ Example Use: !#!
  1090.  
  1091. /************************************************************************************************************/
  1092.  
  1093. int LKeys[]; ZASM Instruction:
  1094. GAMELKEYSD
  1095. /**
  1096. * The number of level keys of level i currently under the possession of
  1097. * the player, where i is the index used to access this array.
  1098. */ Example Use: !#!
  1099.  
  1100. /************************************************************************************************************/
  1101.  
  1102. int GetScreenFlags(int map, int screen, int flagset);
  1103.  
  1104. ZASM Instruction:
  1105. GETSCREENFLAGS
  1106. /**
  1107. * Returns the screen flags from screen 'screen' on map 'map',
  1108. * interpreted in the same way as Screen->Flags
  1109. */ Example Use: !#!
  1110.  
  1111.  
  1112. Game->LKeys[3]+=4; //Gives the player four keys to Level 3.
  1113.  
  1114.  
  1115. /************************************************************************************************************/
  1116.  
  1117. int GetScreenEFlags(int map, int screen, int flagset);
  1118.  
  1119. ZASM Instruction:
  1120. GETSCREENEFLAGS
  1121.  
  1122. /**
  1123. * Returns the enemy flags from screen 'screen' on map 'map',
  1124. * interpreted in the same way as Screen->EFlags
  1125. */ Example Use: !#!
  1126.  
  1127. /************************************************************************************************************/
  1128.  
  1129. bool GetScreenState(int map, int screen, int flag);
  1130.  
  1131. ZASM Instruction:
  1132. SCREENSTATEDD
  1133. /**
  1134. * As with State, but retrieves the miscellaneous flags of any screen,
  1135. * not just the current one. This function is undefined if map is less
  1136. * than 1 or greater than the maximum map number of your quest, or if
  1137. * screen is greater than 127.
  1138. * Note: Screen numbers in ZQuest are usually displayed in hexadecimal.
  1139. * Use the ST_ constants in std.zh for the flag parameter.
  1140. */ Example Use: !#!
  1141.  
  1142. /************************************************************************************************************/
  1143.  
  1144. void SetScreenState(int map, int screen, int flag, bool value);
  1145.  
  1146. ZASM Instruction:
  1147. SCREENSTATEDD
  1148.  
  1149. /**
  1150. * As with State, but sets the miscellaneous flags of any screen, not
  1151. * just the current one. This function is undefined if map is less than
  1152. * 1 or greater than the maximum map number of your quest, or if
  1153. * screen is greater than 127.
  1154. * Note: Screen numbers in ZQuest are usually displayed in hexadecimal.
  1155. * Use the ST_ constants in std.zh for the flag parameter.
  1156. */ Example Use: !#!
  1157.  
  1158. /************************************************************************************************************/
  1159.  
  1160. float GetScreenD(int screen, int reg);
  1161.  
  1162. ZASM Instruction:
  1163. SDDD
  1164. /**
  1165. * Retrieves the value of D[reg] on the given screen of the current
  1166. * DMap.
  1167. */ Example Use: !#!
  1168.  
  1169. /************************************************************************************************************/
  1170.  
  1171. void SetScreenD(int screen, int reg, float value);
  1172.  
  1173. ZASM Instruction:
  1174. SDDD
  1175. /**
  1176. * Sets the value of D[reg] on the given screen of the current DMap.
  1177. */ Example Use: !#!
  1178.  
  1179. /************************************************************************************************************/
  1180.  
  1181. float GetDMapScreenD(int dmap, int screen, int reg);
  1182.  
  1183. ZASM Instruction:
  1184. SDDDD
  1185. /**
  1186. * Retrieves the value of D[reg] on the given screen of the given
  1187. * DMap.
  1188. */ Example Use: !#!
  1189.  
  1190. /************************************************************************************************************/
  1191.  
  1192. void SetDMapScreenD(int dmap, int screen, int reg, float value
  1193.  
  1194. ZASM Instruction:
  1195. SDDDD
  1196. /**
  1197. * Sets the value of D[reg] on the given screen of the given DMap.
  1198. */ Example Use: !#!
  1199.  
  1200. itemdata LoadItemData(int item);
  1201. LOADITEMDATAR
  1202. LOADITEMDATAV
  1203. /**
  1204. * Retrieves the itemdata pointer corresponding to the given item.
  1205. * Use the item pointer ID variable or I_ constants in std.zh as values.
  1206. */ Example Use: !#!
  1207. Game->LoadItemData[I_BRANG1]
  1208.  
  1209.  
  1210. /************************************************************************************************************/
  1211.  
  1212. void PlaySound(int soundid); ZASM Instruction:
  1213. PLAYSOUNDR
  1214. PLAYSOUNDV
  1215. /**
  1216. * Plays one of the quest's sound effects. Use the SFX_ constants in
  1217. * std.zh as values of soundid.
  1218. */ Example Use: !#!
  1219.  
  1220. /************************************************************************************************************/
  1221.  
  1222. void PlayMIDI(int MIDIid); ZASM Instruction:
  1223. PLAYMIDIR
  1224. PLAYMIDIV
  1225. /**
  1226. * Changes the current screen MIDI to MIDIid.
  1227. * Will revert to the DMap (or screen) MIDI upon leaving the screen.
  1228. */ Example Use: !#!
  1229.  
  1230. /************************************************************************************************************/
  1231.  
  1232. int GetMIDI(); ZASM Instruction:
  1233. GETMIDI
  1234. /**
  1235. * Returns the current screen MIDI that is playing.
  1236. * Positive numbers are for custom MIDIs, and negative values are used
  1237. * for the built-in game MIDIs.
  1238. */ Example Use: !#!
  1239.  
  1240. /************************************************************************************************************/
  1241.  
  1242. bool PlayEnhancedMusic(int filename[], int track);
  1243.  
  1244. ZASM Instruction:
  1245. PLAYENHMUSIC
  1246. /**
  1247. * Play the specified enhanced music if it's available. If the music
  1248. * cannot be played, the current music will continue. The music will
  1249. * revert to normal upon leaving the screen.
  1250. * Returns true if the music file was loaded successfully.
  1251. * The filename cannot be more than 255 characters. If the music format
  1252. * does not support multiple tracks, the track argument will be ignored.
  1253. */ Example Use:
  1254.  
  1255. int music[]="myfile.mp3"; // Make a string with the filename of the music to play.
  1256. if ( !Game->PlayEnhancedMusic(music, 1) ) Game->PlayMIDI(midi_id);
  1257.  
  1258. // Plays the enhanced music file 'myfle.mp3', track 1.
  1259. // If the file is mssing, the game will instead play
  1260. // the midi specified as midi_id.
  1261.  
  1262. /************************************************************************************************************/
  1263.  
  1264. void GetDMapMusicFilename(int dmap, int buf[]);
  1265.  
  1266. ZASM Instruction:
  1267. GETMUSICFILE
  1268. /**
  1269. * Load the filename of the given DMap's enhanced music into buf.
  1270. * buf should be at least 256 elements in size.
  1271. */ Example Use: !#!
  1272.  
  1273. /************************************************************************************************************/
  1274.  
  1275. int GetDMapMusicTrack(int dmap);
  1276.  
  1277. ZASM Instruction:
  1278. GETMUSICTRACK
  1279. /**
  1280. * Returns the given DMap's enhanced music track. This is valid but
  1281. * meaningless if the music format doesn't support multiple tracks.
  1282. */ Example Use: !#!
  1283.  
  1284. /************************************************************************************************************/
  1285.  
  1286. void SetDMapEnhancedMusic(int dmap, int filename[], int track);
  1287.  
  1288. ZASM Instruction:
  1289. SETDMAPENHMUSIC
  1290. /**
  1291. * Sets the specified DMap's enhanced music to the given filename and
  1292. * track number. If the music format does not support multiple tracks,
  1293. * the track argument will be ignored. The filename must not be more
  1294. * than 255 characters.
  1295. */ Example Use: !#!
  1296.  
  1297. /************************************************************************************************************/
  1298.  
  1299. int GetComboData(int map, int screen, int position);
  1300.  
  1301. ZASM Instruction:
  1302. COMBODDM
  1303. /**
  1304. * Grabs a particular combo reference from anywhere in the game
  1305. * world, based on map (NOT DMap), screen number, and position.
  1306. * Don't forget that the screen index should be in hexadecimal,
  1307. * and that maps are counted from 1 upwards.
  1308. * Position is considered an index, treated the same way as in
  1309. * Screen->ComboD[], with a legal range of 0 to 175.
  1310. */ Example Use: !#!
  1311.  
  1312. /************************************************************************************************************/
  1313.  
  1314. void SetComboData(int map, int screen, int position, int value);
  1315.  
  1316. ZASM Instruction:
  1317. COMBODDM
  1318. /**
  1319. * Sets a particular combo reference anywhere in the game world,
  1320. * based on map (NOT DMap), screen number, and position.
  1321. * Don't forget that the screen index should be in hexadecimal,
  1322. * and that maps are counted from 1 upwards.
  1323. * Position is considered an index, treated the same way as in
  1324. * Screen->ComboD[], with a legal range of 0 to 175.
  1325. */ Example Use: !#!
  1326.  
  1327. /************************************************************************************************************/
  1328.  
  1329. int GetComboCSet(int map, int screen, int position);
  1330.  
  1331. ZASM Instruction:
  1332. COMBOCDM
  1333. /**
  1334. * Grabs a particular combo's CSet from anywhere in the game
  1335. * world, based on map (NOT DMap), screen number, and position.
  1336. * Position is considered an index, treated the same way as in
  1337. * Screen->ComboC[], with a legal range of 0 to 175.
  1338. */ Example Use: !#!
  1339.  
  1340. /************************************************************************************************************/
  1341.  
  1342. void SetComboCSet(int map, int screen, int position, int value);
  1343.  
  1344. ZASM Instruction:
  1345. COMBOCDM
  1346. /**
  1347. * Sets a particular combo's CSet anywhere in the game world,
  1348. * based on map (NOT DMap), screen number, and position. Position
  1349. * is considered an index, treated the same way as in Screen->ComboC[]
  1350. * with a legal range of 0 to 175.
  1351. */ Example Use: !#!
  1352.  
  1353. /************************************************************************************************************/
  1354.  
  1355. int GetComboFlag(int map, int screen, int position);
  1356.  
  1357. ZASM Instruction:
  1358. COMBOFDM
  1359. /**
  1360. * Grabs a particular combo's placed flag from anywhere in the game
  1361. * world, based on map (NOT DMap), screen number, and position.
  1362. * Position is considered an index, treated the same way as in
  1363. * Screen->ComboF[], with a legal range of 0 to 175.
  1364. */ Example Use: !#!
  1365.  
  1366. /************************************************************************************************************/
  1367.  
  1368. void SetComboFlag(int map, int screen, int position, int value);
  1369.  
  1370. ZASM Instruction:
  1371. COMBOFDM
  1372. /**
  1373. * Sets a particular combo's placed flag anywhere in the game world,
  1374. * based on map (NOT DMap), screen number, and position. Position
  1375. * is considered an index, treated the same way as in Screen->ComboF[]
  1376. * with a legal range of 0 to 175.
  1377. */ Example Use: !#!
  1378.  
  1379. /************************************************************************************************************/
  1380.  
  1381. int GetComboType(int map, int screen, int position);
  1382.  
  1383. ZASM Instruction:
  1384. COMBOTDM
  1385. /**
  1386. * Grabs a particular combo's type from anywhere in the game
  1387. * world, based on map (NOT DMap), screen number, and position.
  1388. * Position is considered an index, treated the same way as in
  1389. * Screen->ComboT[]. Note that you are grabbing an actual combo
  1390. * attribute as referenced by the combo on screen you're
  1391. * referring to.
  1392. */ Example Use: !#!
  1393.  
  1394. /************************************************************************************************************/
  1395.  
  1396. void SetComboType(int map, int screen, int position, int value);
  1397.  
  1398. ZASM Instruction:
  1399. COMBOTDM
  1400. /**
  1401. * Sets a particular combo's type anywhere in the game world,
  1402. * based on map (NOT DMap), screen number, and position. Position
  1403. * is considered an index, treated the same way as in Screen->ComboT[].
  1404. * Note that you are grabbing an actual combo attribute as referenced
  1405. * by the combo on screen you're referring to, which means that
  1406. * setting this attribute will affect ALL references to this combo
  1407. * throughout the quest.
  1408. */ Example Use: !#!
  1409.  
  1410. /************************************************************************************************************/
  1411.  
  1412. int GetComboInherentFlag(int map, int screen, int position);
  1413.  
  1414. ZASM Instruction:
  1415. COMBOIDM
  1416. /**
  1417. * Grabs a particular combo's inherent flag from anywhere in the game
  1418. * world, based on map (NOT DMap), screen number, and position.
  1419. * Position is considered an index, treated the same way as in
  1420. * Screen->ComboI[]. Note that you are grabbing an actual combo
  1421. * attribute as referenced by the combo on screen you're
  1422. * referring to.
  1423. */ Example Use: !#!
  1424.  
  1425. /************************************************************************************************************/
  1426.  
  1427. void SetComboInherentFlag(int map, int screen, int position, int value);
  1428.  
  1429. ZASM Instruction:
  1430. COMBOIDM
  1431. /**
  1432. * Sets a particular combo's inherent flag anywhere in the game world,
  1433. * based on map (NOT DMap), screen number, and position. Position
  1434. * is considered an index, treated the same way as in Screen->ComboI[].
  1435. * Note that you are grabbing an actual combo attribute as referenced
  1436. * by the combo on screen you're referring to, which means that
  1437. * setting this attribute will affect ALL references to this combo
  1438. * throughout the quest.
  1439. */ Example Use: !#!
  1440.  
  1441. /************************************************************************************************************/
  1442.  
  1443. int GetComboSolid(int map, int screen, int position);
  1444.  
  1445. ZASM Instruction:
  1446. COMBOSDM
  1447. /**
  1448. * Grabs a particular combo's solidity flag from anywhere in the game
  1449. * world, based on map (NOT DMap), screen number, and position.
  1450. * Position is considered an index, treated the same way as in
  1451. * Screen->ComboS[]. Note that you are grabbing an actual combo
  1452. * attribute as referenced by the combo on screen you're
  1453. * referring to.
  1454. */ Example Use: !#!
  1455.  
  1456. /************************************************************************************************************/
  1457.  
  1458. void SetComboSolid(int map, int screen, int position, int value);
  1459.  
  1460. ZASM Instruction:
  1461. COMBOSDM
  1462. /**
  1463. * Sets a particular combo's solidity anywhere in the game world,
  1464. * based on map (NOT DMap), screen number, and position. Position
  1465. * is considered an index, treated the same way as in Screen->ComboS[].
  1466. * Note that you are grabbing an actual combo attribute as referenced
  1467. * by the combo on screen you're referring to, which means that
  1468. * setting this attribute will affect ALL references to this combo
  1469. * throughout the quest.
  1470. */ Example Use: !#!
  1471.  
  1472. /************************************************************************************************************/
  1473.  
  1474. int ComboTile(int combo); ZASM Instruction:
  1475. COMBOTILE
  1476. /**
  1477. * Returns the tile used by combo 'combo'
  1478. */ Example Use: !#!
  1479.  
  1480. /************************************************************************************************************/
  1481.  
  1482. void GetSaveName(int buffer[]);
  1483.  
  1484. ZASM Instruction:
  1485. GETSAVENAME
  1486. /**
  1487. * Loads the current save file's name into 'buffer'
  1488. * Buffer should be at least 9 elements long
  1489. */ Example Use: !#!
  1490.  
  1491. /************************************************************************************************************/
  1492.  
  1493. void SetSaveName(int name[]);
  1494.  
  1495. ZASM Instruction:
  1496. SETSAVENAME
  1497. /**
  1498. * Sets the current file's save name to 'name'
  1499. * Buffer should be no more than 9 elements
  1500. */ Example Use: !#!
  1501.  
  1502. /************************************************************************************************************/
  1503.  
  1504. void End(); ZASM Instruction:
  1505. GAMEEND
  1506. /**
  1507. * IMMEDIATELY ends the current game and returns to the file select screen
  1508. */ Example Use: !#!
  1509.  
  1510. /************************************************************************************************************/
  1511.  
  1512. void Save(); ZASM Instruction:
  1513. GAMESAVE
  1514. /**
  1515. * Saves the current game
  1516. */ Example Use: !#!
  1517.  
  1518. /************************************************************************************************************/
  1519.  
  1520. bool ShowSaveScreen(); ZASM Instruction:
  1521. SAVESCREEN
  1522. /**
  1523. * Displays the save screen. Returns true if the user chose to save, false otherwise.
  1524. */ Example Use: !#!
  1525.  
  1526. /************************************************************************************************************/
  1527.  
  1528. void ShowSaveQuitScreen(); ZASM Instruction:
  1529. SAVEQUITSCREEN
  1530. /**
  1531. * Displays the save and quit screen.
  1532. */ Example Use: !#!
  1533.  
  1534. /************************************************************************************************************/
  1535.  
  1536. void GetMessage(int string, int buffer[]);
  1537.  
  1538. ZASM Instruction:
  1539. GETMESSAGE
  1540. /**
  1541. * Loads 'string' into 'buffer'. Use the function from std.zh
  1542. * or use string.zh to remove trailing ' ' characters whilst loading.
  1543. */ Example Use: !#!
  1544.  
  1545. /************************************************************************************************************/
  1546.  
  1547. int GetFFCScript(int name[]); ZASM Instruction:
  1548. GETFFCSCRIPT
  1549. /**
  1550. * Returns the number of the script with the given name or -1 if there is
  1551. * no such script. The script name should be passed as a string.
  1552. * (!) This was added around 2.50.0 RC4. Earlier beta versions will not be able to perform this function.
  1553. */ Example Use: !#!
  1554.  
  1555. /************************************************************************************************************/
  1556.  
  1557. bool ClickToFreezeEnabled; ZASM Instruction:
  1558. GAMECLICKFREEZE
  1559. /**
  1560. * If this is false, the "Click to Freeze" setting will not function, ensuring
  1561. * that the script can use the mouse freely. This overrides the setting rather
  1562. * than changing it, so remembering and restoring the initial value is unnecessary.
  1563. */ Example Use: !#!
  1564.  
  1565. /************************************************************************************************************/
  1566. /************************************************************************************************************/
  1567.  
  1568. //======================================
  1569. //--- Screen Functions and Variables ---
  1570. //======================================
  1571.  
  1572. namespace Screen
  1573.  
  1574. float D[]; ZASM Instruction:
  1575. SD
  1576. SDD
  1577.  
  1578.  
  1579. /**
  1580. * Each screen has 8 general purpose registers for use by script
  1581. * programmers. These values are recorded in the save file when the
  1582. * player saves their game. Do with these as you will.
  1583. * Note that these registers are tied to screen/DMap combinations.
  1584. * Encountering the same screen in a different DMap will result in a
  1585. * different D[] array.
  1586. *
  1587. * Values in Screen->D are preserved through game saving.
  1588. *
  1589. */ Example Use: !#!
  1590.  
  1591. /************************************************************************************************************/
  1592.  
  1593. int Flags[]; ZASM Instruction:
  1594. SCREENFLAGSD
  1595. SCREENFLAGS
  1596.  
  1597. /**
  1598. * An array of ten integers containing the states of the flags in the
  1599. * 10 categories on the Screen Data tabs 1 and 2. Each flag is ORed into the
  1600. * Flags[x] value, starting with the top flag as the smallest bit.
  1601. * Use the SF_ constants as the array acces for this value, and the
  1602. * GetScreenFlags function if you are not comfortable with binary.
  1603. * This is read-only; while setting it is not syntactically incorrect, it does nothing.
  1604. *
  1605. */ Example Use: !#!
  1606.  
  1607. /************************************************************************************************************/
  1608.  
  1609. int EFlags[]; ZASM Instruction:
  1610. SCREENEFLAGSD
  1611. SCREENEFLAGS
  1612.  
  1613. /**
  1614. * An array of 3 integers containing the states of the flags in the
  1615. * E.Flags tab of the Screen Data dialog. Each flag is ORed into the
  1616. * EFlags[x] value, starting with the top flag as the smallest bit.
  1617. * Use the SEF_ constants as the array acces for this value, and the
  1618. * GetScreenEFlags function if you are not comfortable with binary.
  1619. * This is read-only; while setting it is not syntactically incorrect, it does nothing.
  1620. *
  1621. */ Example Use: !#!
  1622.  
  1623. /************************************************************************************************************/
  1624.  
  1625. int ComboD[]; ZASM Instruction:
  1626. CD### COMBOD
  1627. COMBODD COMBODDM
  1628. COMBODDM COMBOSD
  1629.  
  1630. /**
  1631. * The combo ID of the ith combo on the screen, where i is the index
  1632. * used to access this array. Combos are counted left to right, top to
  1633. * bottom.
  1634. * Screen dimensions are 16 combos wide, by 11 combos high.
  1635. *
  1636. */ Example Use: !#!
  1637.  
  1638. /************************************************************************************************************/
  1639.  
  1640. int ComboC[]; ZASM Instruction:
  1641. CC### COMBOC
  1642. COMBOCD COMBOCDM
  1643.  
  1644. /**
  1645. * The CSet of the tile used by the ith combo on the screen, where i is
  1646. * the index used to access this array. Combos are counted left to right,
  1647. * top to bottom.
  1648. * Screen dimensions are 16 combos wide, by 11 combos high.
  1649. *
  1650. */ Example Use: !#!
  1651.  
  1652. /************************************************************************************************************/
  1653.  
  1654. int ComboF[]; ZASM Instruction:
  1655. CF### COMBOF
  1656. COMBOFD COMBOFDM
  1657.  
  1658. /**
  1659. * The placed flag of the ith combo on the screen, where i is the index
  1660. * used to access this array. Combos are counted left to right, top to
  1661. * bottom. Use the CF_ constants in std.zh to set or compare these values.
  1662. * Screen dimensions are 16 combos wide, by 11 combos high.
  1663. *
  1664. */ Example Use: !#!
  1665.  
  1666. /************************************************************************************************************/
  1667.  
  1668. int ComboI[]; ZASM Instruction:
  1669. CI### COMBOID
  1670. COMBOIDM
  1671.  
  1672.  
  1673. /**
  1674. * The inherent flag of the ith combo on the screen, where i is the index
  1675. * used to access this array. Combos are counted left to right, top to
  1676. * bottom. Use the CF_ constants in std.zh to set or compare these values.
  1677. * Screen dimensions are 16 combos wide, by 11 combos high.
  1678. *
  1679. */ Example Use: !#!
  1680.  
  1681. /************************************************************************************************************/
  1682.  
  1683. int ComboT[]; ZASM Instruction:
  1684. CT### COMBOTD
  1685. COMBOTDM
  1686.  
  1687.  
  1688. /**
  1689. * The combo type of the ith combo on the screen, where i is the index
  1690. * used to access this array. Combos are counted left to right, top to
  1691. * bottom. Use the CT_ constants in std.zh to set or compare these values.
  1692. * Screen dimensions are 16 combos wide, by 11 combos high.
  1693. *
  1694. */ Example Use: !#!
  1695.  
  1696. /************************************************************************************************************/
  1697.  
  1698. int ComboS[]; ZASM Instruction:
  1699. CS### COMBOSD
  1700. COMBOSDM
  1701.  
  1702.  
  1703. /**
  1704. * The walkability mask of the ith combo on the screen, where i is the
  1705. * index used to access this array. Combos are counted left to right, top
  1706. * to bottom. The least signficant bit is true if the top-left of the combo
  1707. * is solid, the second-least signficant bit is true if the bottom-left
  1708. * of the combo is is solid, the third-least significant bit is true if the
  1709. * top-right of the combo is solid, and the fourth-least significant bit is
  1710. * true if the bottom-right of the combo is solid.
  1711. * Screen dimensions are 16 combos wide, by 11 combos high.
  1712. *
  1713. */ Example Use: !#!
  1714.  
  1715. /************************************************************************************************************/
  1716.  
  1717. int MovingBlockX; ZASM Instruction:
  1718. PUSHBLOCKX
  1719.  
  1720.  
  1721. /**
  1722. * The X position of the current moving block. If there is no moving block
  1723. * on the screen, it will be -1. This is read-only; while setting it is not
  1724. * syntactically incorrect, it does nothing.
  1725. *
  1726. */ Example Use: !#!
  1727.  
  1728. /************************************************************************************************************/
  1729.  
  1730. int MovingBlockY; ZASM Instruction:
  1731. PUSHBLOCKY
  1732.  
  1733. /**
  1734. * The Y position of the current moving block. If there is no moving block
  1735. * on the screen, it will be -1. This is read-only; while setting it is not
  1736. * syntactically incorrect, it does nothing.
  1737. *
  1738. */ Example Use: !#!
  1739.  
  1740. /************************************************************************************************************/
  1741.  
  1742. int MovingBlockCombo; ZASM Instruction:
  1743. PUSHBLOCKCOMBO
  1744.  
  1745. /**
  1746. * The combo used by moving block. If there is no block moving, the value
  1747. * is undefined.
  1748. *
  1749. */ Example Use: !#!
  1750.  
  1751. /************************************************************************************************************/
  1752.  
  1753. int MovingBlockCSet; ZASM Instruction:
  1754. PUSHBLOCKCSET
  1755.  
  1756. /**
  1757. * The CSet used by moving block. If there is no block moving, the value
  1758. * is undefined.
  1759. *
  1760. */ Example Use: !#!
  1761.  
  1762. /************************************************************************************************************/
  1763.  
  1764. int UnderCombo; ZASM Instruction:
  1765. UNDERCOMBO
  1766.  
  1767. /**
  1768. * The current screen's under combo.
  1769. * !#! Is setting this legal?
  1770. *
  1771. */ Example Use: !#!
  1772.  
  1773. /************************************************************************************************************/
  1774.  
  1775. int UnderCSet; ZASM Instruction:
  1776. UNDERCSET
  1777.  
  1778. /**
  1779. * The current screen's under CSet.
  1780. * !#! Is setting this legal?
  1781. *
  1782. */ Example Use: !#!
  1783.  
  1784. /************************************************************************************************************/
  1785.  
  1786. bool State[]; ZASM Instruction:
  1787. SCREENSTATED
  1788.  
  1789. /**
  1790. * An array of miscellaneous status data associated with the current
  1791. * screen.
  1792. * Screen states involve such things as permanent screen secrets, the
  1793. * status of lock blocks and treasure chest combos, and whether items have
  1794. * been collected.
  1795. * These values are recorded in the save file when the player saves their
  1796. * game. Use the ST_ constants in std.zh as indices into this array.
  1797. *
  1798. */ Example Use: !#!
  1799.  
  1800. /************************************************************************************************************/
  1801.  
  1802. int Door[]; ZASM Instruction:
  1803. SCRDOORD
  1804. SCRDOOR
  1805.  
  1806. /**
  1807. * The door type for each of the four doors on a screen. Doors are counted
  1808. * using the first four DIR_ constants in std.zh. Use the D_ constants in
  1809. * std.zh to compare these values.
  1810. *
  1811. */ Example Use: !#!
  1812.  
  1813. /************************************************************************************************************/
  1814.  
  1815. int RoomType; ZASM Instruction:
  1816. ROOMTYPE
  1817.  
  1818. /**
  1819. * The type of room this screen is (Special Item, Bomb Upgrade, etc)
  1820. * This is currently read-only.
  1821. * Use the RT_* constants in std.zh
  1822. *
  1823. */ Example Use: !#!
  1824.  
  1825. /************************************************************************************************************/
  1826.  
  1827. int RoomData; ZASM Instruction:
  1828. ROOMDATA
  1829.  
  1830. /**
  1831. * This is the data associated with the room type above. What it means depends
  1832. * on the room type. For Special Item, it will be the item ID, for a Shop, it
  1833. * will be the Shop Number, etc.
  1834. * Basically, this is what's in the "Catch-all" menu item underneath Room Type.
  1835. * If the room type has no data (eg, Ganon's room), this will be undefined.
  1836. *
  1837. */ Example Use: !#!
  1838.  
  1839. /************************************************************************************************************/
  1840.  
  1841. void TriggerSecrets(); ZASM Instruction:
  1842. SECRETS ? !#!
  1843.  
  1844. /**
  1845. * Triggers screen secrets temporarily. Set Screen->State[ST_SECRET]
  1846. * to true beforehand or afterward if you would like them to remain
  1847. * permanent.
  1848. *
  1849. */ Example Use: Screen->TriggerSecrets();
  1850.  
  1851.  
  1852. /************************************************************************************************************/
  1853.  
  1854. bool Lit; ZASM Instruction:
  1855. LIT
  1856.  
  1857. /**
  1858. * Whether or not the screen is lit. Setting this variable will change the
  1859. * lighting setting of the screen until you change screens.
  1860. *
  1861. */ Example Use: !#!
  1862.  
  1863.  
  1864. /************************************************************************************************************/
  1865.  
  1866. int Wavy; ZASM Instruction:
  1867. WAVY
  1868.  
  1869. /**
  1870. * The time, in frames, that the 'wave' screen effect will be in effect.
  1871. * This value is decremented once per frame. As the value of Wavy approaches 0,
  1872. * the intensity of the waves decreases.
  1873. *
  1874. */ Example Use: !#!
  1875.  
  1876. /************************************************************************************************************/
  1877.  
  1878. int Quake; ZASM Instruction:
  1879. QUAKE
  1880.  
  1881. /**
  1882. * The time, in frames, that the screen will shake. This value is decremented
  1883. * once per frame. As the value of Quake approaches 0, the intensity of the
  1884. * screen shaking decreases.
  1885. *
  1886. */ Example Use: !#!
  1887.  
  1888. /************************************************************************************************************/
  1889.  
  1890. void SetSideWarp(int warp, int screen, int dmap, int type); ZASM Instruction:
  1891. SETSIDEWARP
  1892.  
  1893. /**
  1894. * Sets the current screen's side warp 'warp' to the destination screen,
  1895. * DMap and type. If any of the parameters screen, dmap or type are equal
  1896. * to -1, they will remain unchanged. If warp is not between 0 and 3, the
  1897. * function does nothing.
  1898.  
  1899. * Directions match DIR_* in std_constants.zh
  1900. * Use constants SIDEWARP_* in std_constants.zh
  1901. *
  1902. */ Example Use: !#!
  1903.  
  1904. /************************************************************************************************************/
  1905.  
  1906. void SetTileWarp(int warp, int screen, int dmap, int type); ZASM Instruction:
  1907. SETTILEWARP
  1908.  
  1909. /**
  1910. * Sets the current screen's tile warp 'warp' to the destination screen,
  1911. * DMap and type. If any of the parameters screen, dmap or type are equal
  1912. * to -1, they will remain unchanged. If warp is not between 0 and 3, the
  1913. * function does nothing
  1914. *
  1915. * Warp-Tiles A, B, C, and D are 0, 1, 2, and 3 respectively.
  1916. * Use constants TILEWARP_* in std_constants.zh
  1917. *
  1918. */ Example Use: !#!
  1919.  
  1920. /************************************************************************************************************/
  1921.  
  1922. int GetSideWarpDMap(int warp); ZASM Instruction:
  1923. GETSIDEWARPDMAP
  1924.  
  1925. /**
  1926. * Returns the destination DMap of the given side warp on the current screen.
  1927. * Returns -1 if warp is not between 0 and 3.
  1928. *
  1929. * Side-Warp Directions match DIR_* in std_constants.zh
  1930. * Use constants SIDEWARP_* in std_constants.zh
  1931. *
  1932. */ Example Use: !#!
  1933.  
  1934. /************************************************************************************************************/
  1935.  
  1936. int GetSideWarpScreen(int warp); ZASM Instruction:
  1937. GETSIDEWARPSCR
  1938.  
  1939. /**
  1940. * Returns the destination screen of the given side warp on the current
  1941. * screen. Returns -1 if warp is not between 0 and 3.
  1942. *
  1943. * Directions match DIR_* in std_constants.zh
  1944. * Use constants SIDEWARP_* in std_constants.zh
  1945. *
  1946. */ Example Use: !#!
  1947.  
  1948. /************************************************************************************************************/
  1949.  
  1950. int GetSideWarpType(int warp); ZASM Instruction:
  1951. GETSIDEWARPTYPE
  1952.  
  1953. /**
  1954. * Returns the warp type of the given side warp on the current screen.
  1955. * Returns -1 if warp is not between 0 and 3.
  1956. *
  1957. * Directions match DIR_* in std_constants.zh
  1958. * Use constants SIDEWARP_* in std_constants.zh
  1959. *
  1960. */ Example Use: !#!
  1961.  
  1962. /************************************************************************************************************/
  1963.  
  1964. int GetTileWarpDMap(int warp); ZASM Instruction:
  1965. GETTILEWARPDMAP
  1966.  
  1967. /**
  1968. * Returns the destination DMap of the given tile warp on the current screen.
  1969. * Returns -1 if warp is not between 0 and 3.
  1970. *
  1971. * Warp-Tiles A, B, C, and D are 0, 1, 2, and 3 respectively.
  1972. * Use constants TILEWARP_* in std_constants.zh
  1973. *
  1974. */ Example Use: !#!
  1975.  
  1976. /************************************************************************************************************/
  1977.  
  1978. int GetTileWarpScreen(int warp); ZASM Instruction:
  1979. GETTILEWARPSCR
  1980.  
  1981. /**
  1982. * Returns the destination screen of the given tile warp on the current
  1983. * screen. Returns -1 if warp is not between 0 and 3.
  1984. *
  1985. * Warp-Tiles A, B, C, and D are 0, 1, 2, and 3 respectively.
  1986. * Use constants TILEWARP_* in std_constants.zh
  1987. *
  1988. */ Example Use: !#!
  1989.  
  1990. /************************************************************************************************************/
  1991.  
  1992. int GetTileWarpType(int warp); ZASM Instruction:
  1993. GETTILEWARPTYPE
  1994.  
  1995. /**
  1996. * Returns the warp type of the given tile warp on the current screen.
  1997. * Returns -1 if warp is not between 0 and 3.
  1998. *
  1999. * Warp-Tiles A, B, C, and D are 0, 1, 2, and 3 respectively.
  2000. * Use constants TILEWARP_* in std_constants.zh
  2001. *
  2002. */ Example Use: !#!
  2003.  
  2004. /************************************************************************************************************/
  2005.  
  2006. int LayerMap(int n); ZASM Instruction:
  2007. LAYERMAP
  2008.  
  2009. /**
  2010. * Returns the map of the screen currently being used as the nth layer.
  2011. * Values of n less than 1 or greater than 6, or layers that are not set up,
  2012. * returns -1.
  2013. *
  2014. */ Example Use: !#!
  2015.  
  2016. /************************************************************************************************************/
  2017.  
  2018. int LayerScreen(int n); ZASM Instruction:
  2019. LAYERSCREEN
  2020.  
  2021. /**
  2022. * Returns the number of the screen currently being used as the nth layer.
  2023. * Values of n less than 1 or greater than 6, or layers that are not set up,
  2024. * returns -1.
  2025. *
  2026. */ Example Use: !#!
  2027.  
  2028. /************************************************************************************************************/
  2029.  
  2030. int NumItems(); ZASM Instruction:
  2031. ITEMCOUNT
  2032.  
  2033. /**
  2034. * Returns the number of items currently present on the screen. Screen
  2035. * items, shop items, and items dropped by enemies are counted; Link's
  2036. * weapons, such as lit bombs, or enemy weapons are not counted.
  2037. * Note that this value is only correct up until the next call to
  2038. * Waitframe().
  2039. *
  2040. */ Example Use: !#!
  2041.  
  2042. /************************************************************************************************************/
  2043.  
  2044. item LoadItem(int num); ZASM Instruction:
  2045. LOADITEMR
  2046. LOADITEMV
  2047.  
  2048. /**
  2049. * Returns a pointer to the numth item on the current screen. The return
  2050. * value is undefined unless 1 <= num <= NumItems().
  2051. *
  2052. * Attempting to return an invalid item pointer will print an error to allegro.log.
  2053. *
  2054. */ Example Use: !#!
  2055.  
  2056. /************************************************************************************************************/
  2057.  
  2058. item CreateItem(int id); ZASM Instruction:
  2059. CREATEITEMV
  2060. CREATEITEMR
  2061.  
  2062. /**
  2063. * Returns a pointer to the numth FFC on the current screen. The return
  2064. * value is undefined unless 1 <= num <= ffcs, where ffcs is the number
  2065. * of FFCs active on the screen.
  2066. *
  2067. */ Example Use: !#!
  2068.  
  2069. /************************************************************************************************************/
  2070.  
  2071. ffc LoadFFC(int num); ZASM Instruction:
  2072. GETFFCSCRIPT
  2073.  
  2074. /**
  2075. * Returns a pointer to the numth FFC on the current screen. The return
  2076. * value is undefined unless 1 <= num <= ffcs, where ffcs is the number
  2077. * of FFCs active on the screen.
  2078. *
  2079. */ Example Use: !#!
  2080.  
  2081. /************************************************************************************************************/
  2082.  
  2083. int NumNPCs(); ZASM Instruction:
  2084. NPCCOUNT
  2085.  
  2086. /**
  2087. * Returns the number of NPCs (enemies and guys) on the screen.
  2088. * Note that this value is only correct up until the next call to
  2089. * Waitframe().
  2090. *
  2091. */ Example Use: !#!
  2092.  
  2093. /************************************************************************************************************/
  2094.  
  2095. npc LoadNPC(int num); ZASM Instruction:
  2096. LOADNPCR
  2097. LOADNPCV
  2098.  
  2099. /**
  2100. * Returns a pointer to the numth NPC on the current screen. The return
  2101. * value is undefined unless 1 <= num <= NumNPCs().
  2102. *
  2103. */ Example Use: !#!
  2104.  
  2105. /************************************************************************************************************/
  2106.  
  2107. npc CreateNPC(int id); ZASM Instruction:
  2108. CREATENPCR
  2109. CREATENPCV
  2110.  
  2111. /**
  2112. * Creates an npc of the given type at (0,0). Use the NPC_ constants in
  2113. * std.zh to pass into this method. The return value is a pointer to the
  2114. * new NPC.
  2115. * The maximum number of NPCs on any given screen is 255. ZC will report an
  2116. * error to allegro.log if you try to create NPCs after reaching that maximum.
  2117. *
  2118. */ Example Use: !#!
  2119.  
  2120. /************************************************************************************************************/
  2121.  
  2122. int NumLWeapons(); ZASM Instruction:
  2123. LWPNCOUNT
  2124.  
  2125. /**
  2126. * Returns the number of Link weapon projectiles currently present on the screen.
  2127. * This includes things like Link's arrows, bombs, magic, etc. Note that this
  2128. * value is only correct up until the next call of Waitframe().
  2129. *
  2130. */ Example Use: !#!
  2131.  
  2132. /************************************************************************************************************/
  2133.  
  2134. lweapon LoadLWeapon(int num); ZASM Instruction:
  2135. LOADLWEAPONR
  2136. LOADLWEAPONV
  2137.  
  2138. /**
  2139. * Returns a pointer to the num-th lweapon on the current screen. The return
  2140. * value is undefined unless 1 <= num <= NumLWeapons().
  2141. *
  2142. */ Example Use: !#!
  2143.  
  2144. /************************************************************************************************************/
  2145.  
  2146. lweapon CreateLWeapon(int type); ZASM Instruction:
  2147. CREATELWEAPONR
  2148. CREATELWEAPONV
  2149.  
  2150. /**
  2151. * Creates an lweapon of the given type at (0,0). Use the LW_ constants in
  2152. * std.zh to pass into this method. The return value is a pointer to the
  2153. * new lweapon.
  2154. * The maximum number of lweapons on any given screen is 255. ZC will NOT report an
  2155. * error to allegro.log if you try to create lweapons after reaching that maximum.
  2156. * The maximum instances for lweapons, and eweapons are independent.
  2157. * This cap is of *all* lweapons, of any type. Mixing types will not increase this cap.
  2158. *
  2159. */ Example Use: !#!
  2160.  
  2161. /************************************************************************************************************/
  2162.  
  2163. int NumEWeapons(); ZASM Instruction:
  2164. EWPNCOUNT
  2165.  
  2166. /**
  2167. * Returns the number of Enemy weapon projectiles currently present on the screen.
  2168. * This includes things like Enemy arrows, bombs, magic, etc. Note that this
  2169. * value is only correct up until the next call of Waitframe().
  2170. *
  2171. */ Example Use: !#!
  2172.  
  2173. /************************************************************************************************************/
  2174.  
  2175. eweapon LoadEWeapon(int num); ZASM Instruction:
  2176. LOADEWEAPONR
  2177. LOADEWEAPONV
  2178.  
  2179. /**
  2180. * Returns a pointer to the numth eweapon on the current screen. The return
  2181. * value is undefined unless 1 <= num <= NumEWeapons().
  2182. *
  2183. */ Example Use: !#!
  2184.  
  2185. /************************************************************************************************************/
  2186.  
  2187. eweapon CreateEWeapon(int type); ZASM Instruction:
  2188. CREATEEWEAPONR
  2189. CREATEEWEAPONV
  2190.  
  2191. /**
  2192. * Creates an eweapon of the given type at (0,0). Use the EW_ constants in
  2193. * std.zh to pass into this method. The return value is a pointer to the
  2194. * new lweapon.
  2195. * The maximum number of eweapons on any given screen is 255. ZC will NOT report an
  2196. * error to allegro.log if you try to create eweapons after reaching that maximum.
  2197. * The maximum instances for eweapons, and lweapons are independent.
  2198. * This cap is of *all* eweapons, of any type. Mixing types will not increase this cap.
  2199. *
  2200. */ Example Use: !#!
  2201.  
  2202. /************************************************************************************************************/
  2203.  
  2204. bool isSolid(int x, int y); ZASM Instruction:
  2205. ISSOLID
  2206.  
  2207. /**
  2208. * Returns true if the screen position (x, y) is solid - that is, if it
  2209. * is within the solid portion of a combo on layers 0, 1 or 2. If either
  2210. * x or y exceed the screen's bounds, then it will return false.
  2211. * It will also return false if the only applicable solid combo is a solid
  2212. * water combo that has recently been 'dried' by the whistle.
  2213. *
  2214. */ Example Use: !#!
  2215.  
  2216. /************************************************************************************************************/
  2217.  
  2218. void ClearSprites(int spritelist); ZASM Instruction:
  2219. CLEARSPRITESR
  2220. CLEARSPRITESV
  2221.  
  2222. /**
  2223. * Clears all of a certain kind of sprite from the screen. Use the SL_
  2224. * constants in std.zh to pass into this method.
  2225. *
  2226. */ Example Use: !#!
  2227.  
  2228. /************************************************************************************************************/
  2229.  
  2230. void Message(int string);
  2231.  
  2232. ZASM Instruction:
  2233. MSGSTRR
  2234. MSGSTRV
  2235. /**
  2236. * Prints the message string with given ID onto the screen.
  2237. * If string is 0, the currently displayed message is removed.
  2238. * This method's behavior is undefined if string is less than 0
  2239. * or greater than the total number of messages in the quest.
  2240. */ Example Use: !#!
  2241.  
  2242. /************************************************************************************************************/
  2243.  
  2244. //===============================//
  2245. // SCRIPT DRAWING COMMANDS //
  2246. //===============================//
  2247.  
  2248. /* These commands use the Allegro 4 drawing primitives to render drawn
  2249. effects directly to the screen. You may draw to the screen immediately
  2250. which is considered RT_SCREEN (see: Render Targets), or you may change
  2251. to another render target (1 through 5) and issue your drawing commands,
  2252. then render that back to the screen.
  2253.  
  2254. All render targets have eight valid layers, 0 through 7.
  2255. Drawing colour 0 to a layer of a bitmap render target erases a section of that,
  2256. creating a transparent area on that layer. Any transparent area that extends
  2257. through all layers will be drawn as transparent when rendered back to the screen
  2258. if 'bool mask' is set true.
  2259.  
  2260. Drawing colour 0 directly to a screen layer is undefined.
  2261.  
  2262. Please note: For all draw primitives, if the quest rule 'Subscreen Appears
  2263. Above Sprites' is set,passing the layer argument as 7 will allow drawing
  2264. on top of the subscreen.
  2265.  
  2266. Tha maximum number of script drawing instructions per frame is 1000.
  2267.  
  2268.  
  2269.  
  2270. void Rectangle( int layer, int x, int y, int x2, int y2,
  2271. int color, float scale,
  2272. int rx, int ry, int rangle,
  2273. bool fill, int opacity );
  2274.  
  2275. ZASM Instruction:
  2276. RECTR
  2277. RECT
  2278.  
  2279. /**
  2280. * Draws a rectangle on the specified layer of the current screen, using args to set its properties:
  2281. *
  2282. * METRICS
  2283. * (x,y) as the top-left corner and (x2,y2) as the bottom-right corner.
  2284. *
  2285. * COLOUR
  2286. *
  2287. * SCALE AND ROTATION
  2288. *
  2289. * FILL AND OPACITY
  2290. *
  2291. * Then scales the rectangle uniformly about its center by the given
  2292. * factor.
  2293. * Lastly, a rotation, centered about the point (rx, ry), is performed
  2294. * counterclockwise using an angle of rangle degrees.
  2295. * A filled rectangle is drawn if fill is true; otherwise, this method
  2296. * draws a wireframe.
  2297. * The rectangle is drawn using the specified index into the entire
  2298. * 256-element palette: for instance, passing in a color of 17 would
  2299. * use color 1 of cset 1.
  2300. * Opacity controls how transparent the rectangle will be.
  2301. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2302. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2303. * as translucent (OP_TRANS, or 64).
  2304. *
  2305. */ Example Use: !#!
  2306.  
  2307. /************************************************************************************************************/
  2308.  
  2309. void Circle( int layer, int x, int y, int radius,
  2310. int color, float scale,
  2311. int rx, int ry, int rangle,
  2312. bool fill, int opacity );
  2313.  
  2314.  
  2315. ZASM Instruction:
  2316. CIRCLE
  2317. CIRCLER
  2318.  
  2319. /**
  2320. * Draws a circle on the specified layer of the current screen with
  2321. * center (x,y) and radius scale*radius.
  2322. * Then performs a rotation counterclockwise, centered about the point
  2323. * (rx, ry), using an angle of rangle degrees.
  2324. * A filled circle is drawn if fill is true; otherwise, this method
  2325. * draws a wireframe.
  2326. * The circle is drawn using the specified index into the entire
  2327. * 256-element palette: for instance, passing in a color of 17 would
  2328. * use color 1 of cset 1.
  2329. * Opacity controls how transparent the circle will be.
  2330. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2331. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2332. * as translucent (OP_TRANS, or 64).
  2333. *
  2334. */ Example Use: !#!
  2335.  
  2336. /************************************************************************************************************/
  2337.  
  2338. void Arc( int layer, int x, int y, int radius, int startangle, int endangle,
  2339. int color, float scale,
  2340. int rx, int ry, int rangle,
  2341. bool closed, bool fill, int opacity );
  2342.  
  2343. ZASM Instruction:
  2344. ARC
  2345. ARCR
  2346.  
  2347. /**
  2348. * Draws an arc of a circle on the specified layer of the current
  2349. * screen. The circle in question has center (x,y) and radius
  2350. * scale*radius.
  2351. * The arc beings at startangle degrees counterclockwise from standard
  2352. * position, and ends at endangle degress counterclockwise from standard
  2353. * position. The behavior of this function is undefined unless
  2354. * 0 <= endangle-startangle < 360.
  2355. * The arc is then rotated about the point (rx, ry) using an angle of
  2356. * rangle radians.
  2357. * If closed is true, a line is drawn from the center of the circle to
  2358. * each endpoint of the arc, forming a sector of the circle. If fill
  2359. * is also true, a filled sector is drawn instead.
  2360. * The arc or sector is drawn using the specified index into the entire
  2361. * 256-element palette: for instance, passing in a color of 17 would
  2362. * use color 1 of cset 1.
  2363. * Opacity controls how transparent the arc will be.
  2364. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2365. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2366. * as translucent (OP_TRANS, or 64).
  2367. *
  2368. */ Example Use: !#!
  2369.  
  2370. /************************************************************************************************************/
  2371.  
  2372. void Ellipse( int layer, int x, int y, int xradius, int yradius,
  2373. int color, float scale,
  2374. int rx, int ry, int rangle,
  2375. bool fill, int opacity);
  2376.  
  2377.  
  2378.  
  2379. ZASM Instruction:
  2380. ELLIPSE2
  2381. ELLIPSER
  2382.  
  2383. /**
  2384. * Draws an ellipse on the specified layer of the current screen with
  2385. * center (x,y), x-axis radius xradius, and y-axis radius yradius.
  2386. * Then performs a rotation counterclockwise, centered about the point
  2387. * (rx, ry), using an angle of rangle degrees.
  2388. * A filled ellipse is drawn if fill is true; otherwise, this method
  2389. * draws a wireframe.
  2390. * The ellipse is drawn using the specified index into the entire
  2391. * 256-element palette: for instance, passing in a color of 17 would
  2392. * use color 1 of cset 1.
  2393. * Opacity controls how transparent the ellipse will be.
  2394. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2395. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2396. * as translucent (OP_TRANS, or 64).
  2397. *
  2398. */ Example Use: !#!
  2399.  
  2400. /************************************************************************************************************/
  2401.  
  2402. void Spline( int layer, int x1, int y1, int x2, int y2, int x3, int y3,int x4, int y4,
  2403. int color, int opacity);
  2404.  
  2405. ZASM Instruction:
  2406. SPLINER
  2407. SPLINE
  2408.  
  2409. /**
  2410. * Draws a cardinal spline on the specified layer of the current screen
  2411. * between (x1,y1) and (x4,y4)
  2412. * The spline is drawn using the specified index into the entire
  2413. * 256-element palette: for instance, passing in a color of 17 would
  2414. * use color 1 of cset 1.
  2415. * Opacity controls how transparent the ellipse will be.
  2416. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2417. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2418. * as translucent (OP_TRANS, or 64).
  2419. *
  2420. */ Example Use: !#!
  2421.  
  2422. /************************************************************************************************************/
  2423.  
  2424. void Line( int layer, int x, int y, int x2, int y2,
  2425. int color, float scale,
  2426. int rx, int ry, int rangle,
  2427. int opacity );
  2428.  
  2429. ZASM Instruction:
  2430. LINE
  2431. LINER
  2432. /**
  2433. * Draws a line on the specified layer of the current screen between
  2434. * (x,y) and (x2,y2).
  2435. * Then scales the line uniformly by a factor of scale about the line's
  2436. * midpoint.
  2437. * Finally, performs a rotation counterclockwise, centered about the
  2438. * point (rx, ry), using an angle of rangle degrees.
  2439. * The line is drawn using the specified index into the entire
  2440. * 256-element palette: for instance, passing in a color of 17 would
  2441. * use color 1 of cset 1.
  2442. * Opacity controls how transparent the line will be.
  2443. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2444. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2445. * as translucent (OP_TRANS, or 64).
  2446. *
  2447. */ Example Use: !#!
  2448.  
  2449. /************************************************************************************************************/
  2450.  
  2451. void PutPixel (int layer, int x, int y,
  2452. int color,
  2453. int rx, int ry, int rangle,
  2454. int opacity);
  2455.  
  2456. ZASM Instruction:
  2457. PUTPIXEL
  2458. PUTPIXELR
  2459. /**
  2460. * Draws a raw pixel on the specified layer of the current screen
  2461. * at (x,y).
  2462. * Then performs a rotation counterclockwise, centered about the point
  2463. * (rx, ry), using an angle of rangle degrees.
  2464. * The point is drawn using the specified index into the entire
  2465. * 256-element palette: for instance, passing in a color of 17 would
  2466. * use color 1 of cset 1.
  2467. * Opacity controls how transparent the point will be.
  2468. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2469. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2470. * as translucent (OP_TRANS, or 64).
  2471. *
  2472. */ Example Use: !#!
  2473.  
  2474. /************************************************************************************************************/
  2475.  
  2476. void DrawTile (int layer, int x, int y,
  2477. int tile, int blockw, int blockh,
  2478. int cset, int xscale, int yscale,
  2479. int rx, int ry, int rangle,
  2480. int flip,
  2481. bool transparency, int opacity);
  2482.  
  2483. ZASM Instruction:
  2484. DRAWTILE
  2485. DRAWTILER
  2486. /**
  2487. * Draws a block of tiles on the specified layer of the current screen,
  2488. * starting at (x,y), using the specified cset.
  2489. * Starting with the specified tile, this method copies a block of size
  2490. * blockh x blockw from the tile sheet to the screen. This method's
  2491. * behavior is undefined unless 1 <= blockh, blockw <= 20.
  2492. * Scale specifies the actual size in pixels! So scale 1 would mean it is
  2493. * only one pixel in size. To use the default sizes of block w,h you must
  2494. * set xscale and yscale to -1. These values are not independant of one another,
  2495. * so you cannot set xscale and leave yscale at -1.
  2496. * rx, ry : these work now, just like the other primitives.
  2497. * rangle performs a rotation clockwise using an angle of rangle degrees.
  2498. * Flip specifies how the tiles should be flipped when drawn:
  2499. * 0: No flip
  2500. * 1: Horizontal flip
  2501. * 2: Vertical flip
  2502. * 3: Both (180 degree rotation)
  2503. * If transparency is true, the tiles' transparent regions will be
  2504. * respected.
  2505. * Opacity controls how transparent the solid portions of the tiles will
  2506. * be.
  2507. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2508. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2509. * as translucent (OP_TRANS, or 64).
  2510. */ Example Use: !#!
  2511.  
  2512. /************************************************************************************************************/
  2513.  
  2514. void FastTile (int layer, int x, int y,
  2515. int tile, int cset,
  2516. int opacity );
  2517.  
  2518. ZASM Instruction:
  2519. FASTTILER
  2520. /**
  2521. * Optimized and simpler version of DrawTile()
  2522. * Draws a single tile on the current screen much in the same way as DrawTile().
  2523. * See DrawTile() for an explanation on what these arguments do.
  2524. */ Example Use: !#!
  2525.  
  2526. /************************************************************************************************************/
  2527.  
  2528. void DrawCombo (int layer, int x, int y,
  2529. int combo, int w, int h,
  2530. int cset, int xscale, int yscale,
  2531. int rx, int ry, int rangle,
  2532. int frame, int flip,
  2533. bool transparency, int opacity);
  2534.  
  2535. ZASM Instruction:
  2536. DRAWCOMBO
  2537. DRAWCOMBOR
  2538. /**
  2539. * Draws a combo on the specified layer of the current screen,
  2540. * starting at (x,y), using the specified cset.
  2541. * Starting with the specified tile referenced by the combo,
  2542. * this method copies a block of size
  2543. * blockh x blockw from the tile sheet to the screen. This method's
  2544. * behavior is undefined unless 1 <= blockh, blockw <= 20.
  2545. * Scale specifies the actual size in pixels! So scale 1 would mean it is
  2546. * only one pixel in size. To use the default sizes of block w,h you must
  2547. * set xscale and yscale to -1. These values are not independant of one another,
  2548. * so you cannot set xscale and leave yscale at -1.
  2549. * rx, ry : works now :
  2550. * rangle performs a rotation clockwise using an angle of rangle degrees.
  2551. * Flip specifies how the tiles should be flipped when drawn:
  2552. * 0: No flip
  2553. * 1: Horizontal flip
  2554. * 2: Vertical flip
  2555. * 3: Both (180 degree rotation)
  2556. * If transparency is true, the tiles' transparent regions will be
  2557. * respected.
  2558. * Opacity controls how transparent the solid portions of the tiles will
  2559. * be.
  2560. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2561. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2562. * as translucent (OP_TRANS, or 64).
  2563. */ Example Use: !#!
  2564.  
  2565. /************************************************************************************************************/
  2566.  
  2567. void FastCombo (int layer, int x, int y,
  2568. int combo, int cset,
  2569. int opacity );
  2570.  
  2571. ZASM Instruction:
  2572. FASTCOMBOR
  2573. /**
  2574. * Optimized and simpler version of DrawCombo()
  2575. * Draws a single combo on the current screen much in the same way as DrawCombo().
  2576. * See DrawCombo() for an explanation on what these arguments do.
  2577. */ Example Use: !#!
  2578.  
  2579. /************************************************************************************************************/
  2580.  
  2581. void DrawCharacter (int layer, int x, int y,
  2582. int font, int color, int background_color,
  2583. int width, int height, int glyph,
  2584. int opacity );
  2585.  
  2586. ZASM Instruction:
  2587. DRAWCHARR
  2588. /**
  2589. * Draws a single ASCII character 'glyph' on the specified layer of the current screen,
  2590. * using the specified font index (see std.zh for FONT_* list to pass to this method),
  2591. * starting at (x,y), using the specified color as the foreground color
  2592. * and background_color as the background color. * NOTE * Use -1 for a transparent background.
  2593. * The arguments width and height may be used to draw the glyph
  2594. * of any arbitrary size begining at 1 pixel up to 512 pixels large. (more than four times the size of the screen)
  2595. * Passing 0 or negative values to this will use the default fonts w and h.
  2596. * Opacity controls how transparent the is.
  2597. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2598. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2599. * as translucent (OP_TRANS, or 64).
  2600. */ Example Use: !#!
  2601.  
  2602. /************************************************************************************************************/
  2603.  
  2604. void DrawInteger (int layer, int x, int y,
  2605. int font, int color, int background_color,
  2606. int width, int height, int number, int number_decimal_places,
  2607. int opacity);
  2608.  
  2609.  
  2610. ZASM Instruction:
  2611. DRAWINTR
  2612. /**
  2613. * Draws a zscript 'int' or 'float' on the specified layer of the current screen,
  2614. * using the specified font index (see std.zh for FONT_* list to pass to this method),
  2615. * starting at (x,y), using the specified color as the foreground color
  2616. * and background_color as the background color. * NOTE * Use -1 for a transparent background.
  2617. * The arguments width and height may be used to draw the number
  2618. * of any arbitrary size begining at 1 pixel up to 512 pixels large.
  2619. * Passing 0 or negative values to this will use the default fonts w and h.
  2620. * The number can be rendered as type 'int' or 'float' by setting the argument
  2621. * "number_decimal_places", which is only valid if set to 0 or <= 4.
  2622. * Opacity controls how transparent the is.
  2623. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2624. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2625. * as translucent (OP_TRANS, or 64).
  2626. */ Example Use: !#!
  2627.  
  2628. /************************************************************************************************************/
  2629.  
  2630. void DrawString( int layer, int x, int y,
  2631. int font, int color, int background_color, int format,
  2632. int ptr[],
  2633. int opacity );
  2634.  
  2635. ZASM Instruction:
  2636. DRAWSTRINGR
  2637. /**
  2638. * Prints a NULL terminated string up to 256 characters from an int array
  2639. * containing ASCII data (*ptr) on the specified layer of the current screen,
  2640. * using the specified font index (see std.zh for FONT_* list to pass to this method),
  2641. * using the specified color as the foreground color
  2642. * and background_color as the background color. * NOTE * Use -1 for a transparent background.
  2643. * The array pointer should be passed as the argument for '*ptr', ie.
  2644. * int string[] = "Example String"; Screen->DrawString(l,x,y,f,c,b_c,fo,o,string);
  2645. * int format tells the engine how to format the string. (see std.zh for TF_* list to pass to this method)
  2646. * Opacity controls how transparent the message is.
  2647. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2648. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2649. * as translucent (OP_TRANS, or 64).
  2650. */ Example Use: !#!
  2651.  
  2652. /************************************************************************************************************/
  2653.  
  2654.  
  2655.  
  2656. /////////////////////////
  2657. // (Psuedo) 3D drawing //
  2658. /////////////////////////
  2659.  
  2660. //! When allocating a texture, the size (h,w) must be between 1 and 16, in powers of two.
  2661. //! Thus, legal sizes are 1, 2, 4, 8, and 16.
  2662. //! This applies to *all* the pseudo-3d and 3-D drawing functions.
  2663.  
  2664. void Quad ( int layer,
  2665. int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4,
  2666. int w, int h, int cset, int flip, int texture, int render_mode);
  2667.  
  2668. ZASM Instruction:
  2669. QUADR
  2670.  
  2671. /**
  2672. * Draws a quad on the specified layer with the corners x1,y1 through x4,y4.
  2673. * Corners are drawn in a counterclockwise order starting from x1,y1. ( So
  2674. * if you draw a "square" for example starting from the bottom-right corner
  2675. * instead of the usual top-left, the the image will be textured onto the
  2676. * quad so it appears upside-down. -yes, these are rotatable. )
  2677. *
  2678. * From there a single or block of tiles or combos is then texture mapped
  2679. * onto the quad using the arguments w, h, cset, flip, and render_mode.
  2680. * A positive vale in texture will draw the image from the tilesheet pages,
  2681. * whereas a negative value will be drawn from the combo page. 0 will draw combo number 0.
  2682. * Both w and h are undefined unless 1 <= blockh, blockw <= 16, and it is a power of
  2683. * two. ie: 1, 2 are acceptable, but 2, 15 are not.
  2684. *
  2685. *
  2686. * Flip specifies how the tiles/combos should be flipped when drawn:
  2687. * 0: No flip
  2688. * 1: Horizontal flip
  2689. * 2: Vertical flip
  2690. * 3: Both (180 degree rotation)
  2691. * (!) See std.zh for a list of all available render_mode arguments.
  2692. */ Example Use: !#!
  2693.  
  2694. /************************************************************************************************************/
  2695.  
  2696. void Triangle ( int layer,
  2697. int x1, int y1, int x2, int y2, int x3, int y3,
  2698. int w, int h, int cset, int flip, int texture, int render_mode);
  2699.  
  2700. ZASM Instruction:
  2701. TRIANGLER
  2702.  
  2703. /**
  2704. * Draws a triangle on the specified layer with the corners x1,y1 through x4,y4.
  2705. * Corners are drawn in a counterclockwise order starting from x1,y1.
  2706. * From there a single or block of tiles or combos is then texture mapped
  2707. * onto the triangle using the arguments w, h, cset, flip, and render_mode.
  2708. *
  2709. * A positive value in texture will draw the image from the tilesheet pages,
  2710. * whereas a negative value will be drawn from the combo page. 0 will draw combo number 0.
  2711. * Both w and h are undefined unless 1 <= blockh, blockw <= 16, and it is a power of
  2712. * two. ie: 1, 2 are acceptable, but 2, 15 are not.
  2713. *
  2714. * Flip specifies how the tiles/combos should be flipped when drawn:
  2715. * 0: No flip
  2716. * 1: Horizontal flip
  2717. * 2: Vertical flip
  2718. * 3: Both (180 degree rotation)
  2719. * (!) See std.zh for a list of all available render_mode arguments.
  2720. */ Example Use: !#!
  2721.  
  2722. /************************************************************************************************************/
  2723.  
  2724. void Triangle3D ( int layer,
  2725. int pos[9], int uv[6], int csets[3], int size[2],
  2726. int flip, int tile, int polytype );
  2727.  
  2728. ZASM Instruction:
  2729. TRIANGLE3DR
  2730. /**
  2731. * Draws a 3d triangle on the specified layer with the corners x1,y1 through x4,y4.
  2732. * Corners are drawn in a counterclockwise order starting from x1,y1.
  2733. * From there a single or block of tiles or combos is then texture mapped
  2734. * onto the triangle using the arguments w, h, cset, flip, and render_mode.
  2735. *
  2736. * A positive value in texture will draw the image from the tilesheet pages,
  2737. * whereas a negative value will be drawn from the combo page. 0 will draw combo number 0.
  2738. * Both w and h are undefined unless 1 <= blockh, blockw <= 16, and it is a power of
  2739. * two. ie: 1, 2 are acceptable, but 2, 15 are not.
  2740. *
  2741. * Arguments take the form of array pointers: Thus, you must declare arrays with the values that you wish to use
  2742. * and pass their pointers to each of the following:
  2743. *
  2744. * [9]pos - x, y, z positions of the 3 corners.
  2745. * [6]uv - x, y texture coordinates of the given texture.
  2746. * [3]csets - of the corners to interpolate between.
  2747. * [2]size - w, h, of the texture.
  2748. * w, and h must be in values of 1, 2, 4, 8, or 16.
  2749. *
  2750. *
  2751. * Flip specifies how the tiles/combos should be flipped when drawn:
  2752. * 0: No flip
  2753. * 1: Horizontal flip
  2754. * 2: Vertical flip
  2755. * 3: Both (180 degree rotation)
  2756. * (!) See std.zh for a list of all available render_mode arguments.
  2757. */ Example Use: !#!
  2758.  
  2759. /************************************************************************************************************/
  2760.  
  2761. void Quad3D ( int layer,
  2762. int pos[], int uv[], int cset[], int size[],
  2763. int flip, int texture, int render_mode );
  2764.  
  2765. ZASM Instruction:
  2766. QUAD3DR
  2767.  
  2768. /**
  2769. * Draws a Quad on the specified layer similar to Quad.
  2770. * Arguments take the form of array pointers: Thus, you must declare arrays with the values that you wish to use
  2771. * and pass their pointers to each of the following:
  2772. *
  2773. * [12]pos - x, y, z positions of the 4 corners.
  2774. * [8]uv - x, y texture coordinates of the given texture.
  2775. * [4]csets - of the corners to interpolate between.
  2776. * [2]size - w, h, of the texture.
  2777. * w, and h must be in values of 1, 2, 4, 8, or 16.
  2778. * (!) See std.zh for a list of all available render_mode arguments.
  2779. */ Example Use: !#!
  2780.  
  2781. /************************************************************************************************************/
  2782.  
  2783. void SetRenderTarget( int bitmap_id );
  2784.  
  2785. ZASM Instruction:
  2786. SETRENDERTARGET
  2787.  
  2788. /**
  2789. * Sets the target bitmap for all succesive drawing commands.
  2790. * These can be directly to the screen or any one of the available off-screen bitmaps,
  2791. * which are generally categorized as -1(screen) or 0-bitmapNumber(off-screen).
  2792. *
  2793. * (!) See std.zh for a complete list of valid render targets (RT_*).
  2794. */ Example Use: !#!
  2795.  
  2796. /************************************************************************************************************/
  2797.  
  2798. void DrawBitmap ( int layer,
  2799. int bitmap_id,
  2800. int source_x, int source_y, int source_w, int source_h,
  2801. int dest_x, int dest_y, int dest_w, int dest_h,
  2802. float rotation, bool mask);
  2803.  
  2804. ZASM Instruction:
  2805. BITMAPR
  2806.  
  2807. /**
  2808. * Draws a source rect from off-screen Bitmap with id of bitmap_id onto
  2809. * an area of the screen described by dest rect at the given layer.
  2810. *
  2811. * (!) Note* Script drawing functions are enqueued and executed in a frame-by-frame basis
  2812. * based on the order of which layer they need to be drawn to. Drawing to or from
  2813. * seperate render tagets or bitmaps is no exception! So keep in mind in order to
  2814. * eliminate unwanted drawing orders or bugs.
  2815. */ Example Use:
  2816. Screen->Bitmap( 6, myBitmapId, 0, 0, 16, 16, 79, 57, 32, 32, 0, true );
  2817. This would draw a 16x16 area starting at the upper-left corner of source bitmap to
  2818. layer 6 of the current screen at coordinates 79,57 with a width and height of
  2819.  
  2820.  
  2821.  
  2822. // Screen/Layer Drawing
  2823. */
  2824.  
  2825. /************************************************************************************************************/
  2826.  
  2827. void DrawLayer (int layer,
  2828. int source_map, int source_screen, int source_layer,
  2829. int x, int y, float rotation, int opacity);
  2830.  
  2831. ZASM Instruction:
  2832. DRAWLAYERR
  2833.  
  2834. /**
  2835. * Draws an entire Layer from source_screen on source_map on the specified layer of the current screen at (x,y).
  2836. * If rotation is not zero, it(the entire layer) will rotate about its center.
  2837. *
  2838. * Opacity controls how transparent the solid portions of the tiles will
  2839. * You may use OP_TRANS (64) for a translucent (50%) image, or OP_OPAQUE (128)
  2840. * for an opaque (100%) image. Other values are **ignored**, and will be treated
  2841. * as translucent (OP_TRANS, or 64).
  2842. *
  2843. * Also see ScreenToLayer() in std.zh
  2844. */ Example Use:
  2845.  
  2846. /************************************************************************************************************/
  2847.  
  2848. void DrawScreen (int layer,
  2849. int map, int source_screen,
  2850. int x, int y, float rotation);
  2851.  
  2852. ZASM Instruction:
  2853. DRAWSCREENR
  2854.  
  2855. /**
  2856. * Draws an entire screen from screen on map on the specified layer of the current screen at (x,y).
  2857. * If rotation is not zero, it(the entire screen) will rotate about its center.
  2858. *
  2859. */ Example Use:
  2860.  
  2861. /************************************************************************************************************/
  2862. /************************************************************************************************************/
  2863.  
  2864.  
  2865.  
  2866. //===================================
  2867. //--- FFC Functions and Variables ---
  2868. //===================================
  2869.  
  2870. class ffc
  2871.  
  2872. /*
  2873. * The following functions, and arrays are part of the ffc class.
  2874. *
  2875. * Ordinarily, these are set when writing an ffc script, using the pointer
  2876. * this->
  2877. * Example: this->Data = 10; Sets the Data variable for the present ffc
  2878. * to a value of '10'.
  2879. *
  2880. * The 'this->' pointer is used in ffcs, and item scripts only. It references ffc
  2881. * variables and arrays in an ffc script; and itemdata variables in an item script.
  2882. *
  2883. * Changing ffc variables without 'this->':
  2884. *
  2885. * You may change a variable, or array value of the ffc class by loading the ffc into a custom pointer
  2886. * using Screen->LoadFFC(int number) as follows:
  2887. *
  2888. * ffc f; //Declare a general ffc pointer.
  2889. * //You must use the ffc token to declare the pointer, but you may use any
  2890. * //name that you desire for it. 'f' here, is merely a short-name example.
  2891. *
  2892. * f = Screen->LoadFFC(10); //Loads the data of ffc ID 10 for the present screen into the 'f' pointer.
  2893. *
  2894. * f->Data = 15; //Sets the 'Data' variable of the ffc to a value of '15'.
  2895. *
  2896. * f->X = 120; //Sets the X-position of the ffc assigned to pointer 'f' to a value of '120'.
  2897. */
  2898.  
  2899.  
  2900. Set Working FFC ID: ZASM Instruction
  2901. REFFFC
  2902.  
  2903. /************************************************************************************************************/
  2904.  
  2905.  
  2906. int Data; ZASM Instruction:
  2907. DATA<d3>
  2908.  
  2909. /**
  2910. * The number of the combo associated with this FFC.
  2911. */ Example Use:
  2912.  
  2913. f->Data = 10;
  2914. Sets the ffc to Combo 10.
  2915.  
  2916. /************************************************************************************************************/
  2917.  
  2918. int Script; ZASM Instruction:
  2919. FFSCRIPT<d3>
  2920.  
  2921. /**
  2922. * The number of the script assigned to the FFC. This will be automatically
  2923. * set to 0 when the FFC's script halts. A script cannot change the script of
  2924. * the FFC running it; in other words, f->Script is read-only when f==this.
  2925. * When an FFC's script is changed, its arguments, Misc[], and registers will
  2926. * all be set to 0, and it will start running from the beginning. Set
  2927. * ffc->InitD[] after setting the script before the script starts running
  2928. * to pass arguments to it.
  2929. *
  2930. */ Example Use:
  2931.  
  2932. f->Script = 10;
  2933. Sets the ffc to Combo 10.
  2934.  
  2935. /************************************************************************************************************/
  2936.  
  2937. int CSet; ZASM Instruction:
  2938. FCSET<d3>
  2939.  
  2940. /**
  2941. * The cset of the FFC.
  2942. *
  2943. */ Example Use:
  2944.  
  2945. f->CSet = 2;
  2946. Sets the ffc to CSet 2.
  2947.  
  2948. /************************************************************************************************************/
  2949.  
  2950. int Delay; ZASM Instruction:
  2951. DELAY<d3>
  2952.  
  2953. /**
  2954. * The FFC's animation delay, in frames.
  2955. *
  2956. */ Example Use:
  2957.  
  2958. f->Delay = 120;
  2959. 120 frames will pass before the ffc animates.
  2960.  
  2961. /************************************************************************************************************/
  2962.  
  2963. float X; ZASM Instruction:
  2964. FX<d3>
  2965.  
  2966. /**
  2967. * The FFC's X position on the screen.
  2968. *
  2969. * Values outside the screen boundaries *are* legal.
  2970. *
  2971. */ Example Use:
  2972.  
  2973. f->X = 43;
  2974. Sets the ffc at X-position 43; 43 pixels to the right of the leftmost screen edge.
  2975.  
  2976. /************************************************************************************************************/
  2977.  
  2978. float Y; ZASM Instruction:
  2979. FY<d3>
  2980.  
  2981. /**
  2982. * The FFC's Y position on the screen.
  2983. *
  2984. * Values outside the screen boundaries *are* legal.
  2985. * The Y value 0 is automatically offset to account for the passive subscreen.
  2986. * To place an ffc in the area of the passive subscreen, a negative value must be passed to Y.
  2987. *
  2988. */ Example Use:
  2989.  
  2990. f->X = 90;
  2991. Sets the ffc at Y-position to 90; i.e. 90 pixels below the passive subscreen.
  2992.  
  2993. /************************************************************************************************************/
  2994.  
  2995. float Vx; ZASM Instruction:
  2996. XD<d3>
  2997.  
  2998. /**
  2999. * The FFC's velocity's X-component.
  3000. *
  3001. *
  3002. */ Example Use:
  3003.  
  3004. f->Vx = 20;
  3005. The ffc will move by 20 pixels per second on the X avis.
  3006.  
  3007. /************************************************************************************************************/
  3008.  
  3009. float Vy; ZASM Instruction:
  3010. YD<d3>
  3011.  
  3012. /**
  3013. * The FFC's velocity's Y-component.
  3014. *
  3015. *
  3016. */ Example Use:
  3017.  
  3018. f->Vy = 20;
  3019. The ffc will move by 20 pixels per second on the Y avis.
  3020.  
  3021. /************************************************************************************************************/
  3022.  
  3023. float Ax; ZASM Instruction:
  3024. XD2<d3>
  3025.  
  3026. /**
  3027. * The FFC's acceleration's X-component.
  3028. *
  3029. *
  3030. */ Example Use:
  3031.  
  3032. f->Vx = 1.03;
  3033. Every frame, the velocity X-component will increase by 1.03.
  3034.  
  3035. /************************************************************************************************************/
  3036.  
  3037. float Ay; ZASM Instruction:
  3038. YD2<d3>
  3039.  
  3040. /**
  3041. * The FFC's acceleration's Y-component.
  3042. *
  3043. *
  3044. */ Example Use:
  3045.  
  3046. f->Vx = 0.2903;
  3047. Every frame, the velocity Y-component will increase by 0.2903.
  3048.  
  3049. /************************************************************************************************************/
  3050.  
  3051. bool Flags[]; ZASM Instruction:
  3052. FLAG<d3>
  3053. FFFLAGSD
  3054.  
  3055.  
  3056. /**
  3057. * The FFC's set of flags. Use the FFCF_ constants in std.zh as the
  3058. * index to access a particular flag.
  3059. *
  3060. */ Example Use: !#!
  3061.  
  3062. /************************************************************************************************************/
  3063.  
  3064. int TileWidth; ZASM Instruction:
  3065. FFTWIDTH<d3>
  3066. WIDTH<>
  3067.  
  3068. /**
  3069. * The number of tile columns composing the FFC.
  3070. * The maximum value is '4'.
  3071. *
  3072. */ Example Use: !#!
  3073.  
  3074. /************************************************************************************************************/
  3075.  
  3076. int TileHeight; ZASM Instruction:
  3077. FFTHEIGHT<d3>
  3078. HEIGHT<>
  3079.  
  3080. /**
  3081. * The number of tile rows composing the FFC.
  3082. * The maximum value is '4'.
  3083. *
  3084. */ Example Use: !#!
  3085.  
  3086. /************************************************************************************************************/
  3087.  
  3088. int EffectWidth; ZASM Instruction:
  3089. FFCWIDTH<d3>
  3090.  
  3091. /**
  3092. * The width (in pixels) of the area of effect of the combo associated with the FFC.
  3093. * The maximum value is '64'.
  3094. *
  3095. */ Example Use: !#!
  3096.  
  3097. /************************************************************************************************************/
  3098.  
  3099. int EffectHeight; ZASM Instruction:
  3100. FFCHEIGHT<d3>
  3101.  
  3102. /**
  3103. * The width (in pixels) of the area of effect of the combo associated with the FFC.
  3104. * The maximum value is '64'.
  3105. *
  3106. */ Example Use: !#!
  3107.  
  3108. /************************************************************************************************************/
  3109.  
  3110. int Link; ZASM Instruction:
  3111. FFLINK<d3>
  3112. LINK<>
  3113.  
  3114. /**
  3115. * The number of the FFC linked to by this FFC.
  3116. *
  3117. */ Example Use: !#!
  3118.  
  3119. /************************************************************************************************************/
  3120.  
  3121. float InitD[8]; ZASM Instruction:
  3122. FFINITD<>
  3123. FFINITDD<>?
  3124. D<>
  3125.  
  3126. /**
  3127. * The original values of the FFC's 8 D input values as they are stored in
  3128. * the .qst file, regardless of whether they have been modified by ZScript.
  3129. *
  3130. */ Example Use: !#!
  3131.  
  3132. /************************************************************************************************************/
  3133.  
  3134. float Misc[16]; ZASM Instruction:
  3135. FFMISC
  3136. FFMISCD
  3137.  
  3138. /**
  3139. * An array of 16 miscellaneous variables for you to use as you please.
  3140. * These variables are not saved with the ffc.
  3141. *
  3142. */ Example Use: !#!
  3143.  
  3144. /************************************************************************************************************/
  3145.  
  3146. Address Argument ZASM Instruction
  3147. A<>
  3148.  
  3149. /************************************************************************************************************/
  3150. /************************************************************************************************************/
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156. //====================================
  3157. //--- Link Functions and Variables ---
  3158. //====================================
  3159.  
  3160. namespace Link
  3161.  
  3162. //Unimplemented?
  3163. Invincibility: LINKINVINC<>
  3164.  
  3165. int X; ZASM Instruction:
  3166. LINKX
  3167.  
  3168. /**
  3169. * Link's X position on the screen, in pixels. Float values passed to this will be truncated to ints.
  3170. *
  3171. */ Example Use: !#!
  3172.  
  3173. /************************************************************************************************************/
  3174.  
  3175. int Y; ZASM Instruction:
  3176. LINKY
  3177.  
  3178. /**
  3179. * Link's Y position on the screen, in pixels. Float values passed to this will be truncated to ints.
  3180. *
  3181. */ Example Use: !#!
  3182.  
  3183. /************************************************************************************************************/
  3184.  
  3185. int Z; ZASM Instruction:
  3186. LINKZ
  3187.  
  3188. /**
  3189. * Link's Z position on the screen, in pixels. Float values passed to this will be truncated to ints.
  3190. *
  3191. */ Example Use: !#!
  3192.  
  3193. /************************************************************************************************************/
  3194.  
  3195. bool Invisible; ZASM Instruction:
  3196. LINKINVIS
  3197.  
  3198. /**
  3199. * Whether Link is currently being draw to the screen. Set true to remove him from view.
  3200. *
  3201. */ Example Use: !#!
  3202.  
  3203. /************************************************************************************************************/
  3204.  
  3205. bool CollDetection; ZASM Instruction:
  3206. LINKINVINC
  3207.  
  3208. /**
  3209. * If true, Link's collision detection with npcs and eweapons is currently turned off.
  3210. * This variable works on a different system to clocks and the level 4 cheat, so it will not
  3211. * necessarily return true if they are set.
  3212. *
  3213. */ Example Use: !#!
  3214.  
  3215. /************************************************************************************************************/
  3216.  
  3217. int Jump; ZASM Instruction:
  3218. LINKJUMP
  3219.  
  3220. /**
  3221. * Link's upward velocity, in pixels. If negative, Link will fall.
  3222. * The downward acceleration of Gravity (in Init Data) modifies this value every frame.
  3223. *
  3224. * This value is intended to be in pixels, but appears to be in tiles. ?!
  3225. *
  3226. */ Example Use: !#!
  3227.  
  3228. /************************************************************************************************************/
  3229.  
  3230. int SwordJinx; ZASM Instruction:
  3231. LINKSWORDJINX
  3232.  
  3233. /**
  3234. * The time, in frames, until Link regains use of his sword. -1 signifies
  3235. * a permanent loss of the sword caused by a Red Bubble.
  3236. *
  3237. */ Example Use: !#!
  3238.  
  3239. /************************************************************************************************************/
  3240.  
  3241. int ItemJinx; ZASM Instruction:
  3242. LINKITEMJINX
  3243.  
  3244. /**
  3245. * The time, in frames, until Link regains use of his items. -1 signifies
  3246. * a permanent loss of his items. caused by a Red Bubble.
  3247. *
  3248. */ Example Use: !#!
  3249.  
  3250. /************************************************************************************************************/
  3251.  
  3252. int Drunk; ZASM Instruction:
  3253. LINKDRUNK
  3254.  
  3255. /**
  3256. * The time, in frames, that Link will be 'drunk'. If positive, the player's
  3257. * controls are randomly interfered with, causing Link to move erratically.
  3258. * This value is decremented once per frame. As the value of Drunk approaches 0,
  3259. * the intensity of the effect decreases.
  3260. *
  3261. */ Example Use: !#!
  3262.  
  3263. /************************************************************************************************************/
  3264.  
  3265. int Dir; ZASM Instruction:
  3266. LINKDIR
  3267.  
  3268. /**
  3269. * The direction Link is facing. Use the DIR_ constants in std.zh to set
  3270. * or compare this variable. Note: even though Link can move diagonally if the
  3271. * quest allows it, his sprite doesn't ever use any of the diagonal directions,
  3272. * which are intended for enemies only.
  3273. *
  3274. * Reading this value occurs after Waitdraw().
  3275. *
  3276. */ Example Use: !#!
  3277.  
  3278. /************************************************************************************************************/
  3279.  
  3280. int HitDir; ZASM Instruction:
  3281. LINKHITDIR
  3282.  
  3283. /**
  3284. * The direction Link should bounce in when he is hit. This is mostly useful for
  3285. * simulating getting hit by setting Link->Action to LA_GOTHURTLAND.
  3286. *
  3287. * This value does nothing is Link->Action does not equal LA_GOTHURTLAND or LA_GOTHURTWATER.
  3288. * Forcing this value to -1 prevent Link from being knocked back when injured, or when touching any enemy.
  3289. *
  3290. */ Example Use: !#!
  3291.  
  3292. /************************************************************************************************************/
  3293.  
  3294. int HP; ZASM Instruction:
  3295. LINKHP
  3296.  
  3297. /**
  3298. * Link's current hitpoints, in 16ths of a heart.
  3299. *
  3300. */ Example Use: !#!
  3301.  
  3302. /************************************************************************************************************/
  3303.  
  3304. int MP; ZASM Instruction:
  3305. LINKMP
  3306.  
  3307. /**
  3308. * Link's current amount of magic, in 32nds of a magic block.
  3309. *
  3310. */ Example Use: !#!
  3311.  
  3312. /************************************************************************************************************/
  3313.  
  3314. int MaxHP; ZASM Instruction:
  3315. LINKMAXHP
  3316.  
  3317. /**
  3318. * Link's maximum hitpoints, in 16ths of a heart.
  3319. *
  3320. */ Example Use: !#!
  3321.  
  3322. /************************************************************************************************************/
  3323.  
  3324. int MaxMP; ZASM Instruction:
  3325. LINKMAXMP
  3326.  
  3327. /**
  3328. * Link's maximum amount of magic, in 32nds of a magic block.
  3329. *
  3330. */ Example Use: !#!
  3331.  
  3332. /************************************************************************************************************/
  3333.  
  3334. int Action; ZASM Instruction:
  3335. LINKACTION<>
  3336.  
  3337. /**
  3338. * Link's current action. Use the LA_ constants in std.zh to set or
  3339. * compare this value.
  3340. * This value is read-write, but some actions are undefined in this
  3341. * version of ZC. The following are known to work:
  3342. *
  3343. *
  3344. *
  3345. *The effect of writing to this field is currently
  3346. * undefined.
  3347. *
  3348. */ Example Use: !#!
  3349.  
  3350. /************************************************************************************************************/
  3351.  
  3352. int HeldItem; ZASM Instruction:
  3353. LINKHELD<>
  3354.  
  3355. /**
  3356. * Link's current action. Use the LA_ constants in std.zh to set or
  3357. * The item that Link is currently holding up; reading or setting this
  3358. * field is undefined if Link's action is not current a hold action.
  3359. * Use the I_ constants in std.zh to specify the item, or -1 to show
  3360. * no item. Setting HeldItem to values other than -1 or a valid item
  3361. * ID is undefined.
  3362. *
  3363. */ Example Use: !#!
  3364.  
  3365. /************************************************************************************************************/
  3366.  
  3367. int LadderX; ZASM Instruction:
  3368. LINKLADDERX
  3369.  
  3370. /**
  3371. * The X position of Link's stepladder, or 0 if no ladder is onscreen.
  3372. * This is read-only; while setting it is not syntactically incorrect, it does nothing.
  3373. *
  3374. */ Example Use: !#!
  3375.  
  3376. /************************************************************************************************************/
  3377.  
  3378. int LadderY; ZASM Instruction:
  3379. LINKLADDERY
  3380.  
  3381. /**
  3382. * The Y position of Link's stepladder, or 0 if no ladder is onscreen.
  3383. * This is read-only; while setting it is not syntactically incorrect, it does nothing.
  3384. *
  3385. */ Example Use: !#!
  3386.  
  3387. /************************************************************************************************************/
  3388.  
  3389.  
  3390.  
  3391. *** Input Functions ***
  3392. * The following Input* boolean values return true if the player is pressing
  3393. * the corresponding button, analog stick, or key. Writing to this variable simulates
  3394. * the press or release of that referenced button, analog stick, or key.
  3395. */
  3396.  
  3397. bool InputStart; ZASM: INPUTSTART
  3398.  
  3399. bool InputMap; ZASM: INPUTMAP
  3400.  
  3401. bool InputUp; ZASM: INPUTUP
  3402.  
  3403. bool InputDown; ZASM: INPUTDOWN
  3404.  
  3405. bool InputLeft; ZASM: INPUTLEFT
  3406.  
  3407. bool InputRight; ZASM: INPUTRIGHT
  3408.  
  3409. bool InputA; ZASM: INPUTA
  3410.  
  3411. bool InputB; ZASM: INPUTB
  3412.  
  3413. bool InputL; ZASM: INPUTL
  3414.  
  3415. bool InputR; ZASM: INPUTR
  3416.  
  3417. bool InputEx1 ZASM: INPUTEX1
  3418.  
  3419. bool InputEx2 ZASM: INPUTEX2
  3420.  
  3421. bool InputEx3 ZASM: INPUTEX3
  3422.  
  3423. bool InputEx4 ZASM: INPUTEX4
  3424.  
  3425. bool InputAxisUp; ZASM: INPUTAXISUP
  3426.  
  3427. bool InputAxisDown; ZASM: INPUTAXISDOWN
  3428.  
  3429. bool InputAxisLeft; ZASM: INPUTAXISLEFT
  3430.  
  3431. bool InputAxisRight; ZASM: INPUTAXISRIGHT
  3432.  
  3433.  
  3434. *** Press Functions ***
  3435. /**
  3436. * The following Press* boolean values return true if the player activated
  3437. * the corresponding button, analog stick, or key this frame. Writing to this
  3438. * variable simulates the press or release of that referenced button, analog stick,
  3439. * or keys input press state.
  3440. */
  3441.  
  3442.  
  3443. bool PressStart; ZASM: INPUTPRESSSTART
  3444.  
  3445. bool PressMap; ZASM: INPUTPRESSMAP
  3446.  
  3447. bool PressUp; ZASM: INPUTPRESSUP
  3448.  
  3449. bool PressDown; ZASM: INPUTPRESSDOWN
  3450.  
  3451. bool PressLeft; ZASM: INPUTPRESSLEFT
  3452.  
  3453. bool PressRight; ZASM: INPUTPRESSRIGHT
  3454.  
  3455. bool PressA; ZASM: INPUTPRESSA
  3456.  
  3457. bool PressB; ZASM: INPUTPRESSB
  3458.  
  3459. bool PressL; ZASM: INPUTPRESSL
  3460.  
  3461. bool PressR; ZASM: INPUTPRESSR
  3462.  
  3463. bool PressEx1 ZASM: INPUTPRESSEX1
  3464.  
  3465. bool PressEx2 ZASM: INPUTPRESSEX2
  3466.  
  3467. bool PressEx3 ZASM: INPUTPRESSEX3
  3468.  
  3469. bool PressEx4 ZASM: INPUTPRESSEX4
  3470.  
  3471. bool PressAxisUp; ZASM: PRESSAXISUP
  3472.  
  3473. bool PressAxisDown; ZASM: PRESSAXISDOWN
  3474.  
  3475. bool PressAxisLeft; ZASM: PRESSAXISLEFT
  3476.  
  3477. bool PressAxisRight; ZASM: PRESSAXISRIGHT
  3478.  
  3479. /************************************************************************************************************/
  3480.  
  3481. int InputMouseX; ZASM Instruction:
  3482. INPUTMOUSEX
  3483.  
  3484. /**
  3485. * The mouse's in-game X position. This value is undefined if
  3486. * the mouse pointer is outside the Zelda Classic window.
  3487. *
  3488. */ Example Use: !#!
  3489.  
  3490. /************************************************************************************************************/
  3491.  
  3492. int InputMouseY; ZASM Instruction:
  3493. INPUTMOUSEY
  3494.  
  3495. /**
  3496. * The mouse's in-game Y position. This value is undefined if
  3497. * the mouse pointer is outside the Zelda Classic window.
  3498. *
  3499. */ Example Use: !#!
  3500.  
  3501. /************************************************************************************************************/
  3502.  
  3503. int InputMouseB; ZASM Instruction:
  3504. INPUTMOUSEB
  3505.  
  3506. /**
  3507. * Whether the left or right mouse buttons are pressed, as two flags OR'd (|) together;
  3508. * use the MB_ constants or the Input'X'Click functions in std.zh to check the button states.
  3509. * InputMouseB is read only; while setting it is not syntactically incorrect, it does nothing
  3510. * If you are not comfortable with binary, you can use the InputMouse'x' functions in std.zh
  3511. *
  3512. */ Example Use: !#!
  3513.  
  3514. /************************************************************************************************************/
  3515.  
  3516. int InputMouseZ; ZASM Instruction:
  3517. INPUTMOUSEB
  3518.  
  3519. /**
  3520. * The current state of the mouse's scroll wheel, negative for scrolling down and positive for scrolling up.
  3521. *
  3522. */ Example Use: !#!
  3523.  
  3524. /************************************************************************************************************/
  3525.  
  3526. bool Item[256]; ZASM Instruction:
  3527. LINKITEMD
  3528.  
  3529. /**
  3530. * True if Link's inventory contains the item whose ID is the index of
  3531. * the array access. Use the I_ constants in std.zh as an index into this array.
  3532. *
  3533. */ Example Use: !#!
  3534.  
  3535. /************************************************************************************************************/
  3536.  
  3537. int Equipment; ZASM Instruction:
  3538. LINKEQUIP
  3539.  
  3540. /**
  3541. * Contains the item IDs of what is currently equiped to Link's A and B buttons.
  3542. * The first 8 bits contain the A button item, and the second 8 bits contain the B button item.
  3543. * Currently it is only possible to retrieve this value and not to set it.
  3544. * If you are not comfortable with performing binary operations,
  3545. * you can use the functions GetEquipmentA() or GetEquipmentB() in std.zh.
  3546. *
  3547. */ Example Use: !#!
  3548.  
  3549. /************************************************************************************************************/
  3550.  
  3551. int Tile; ZASM Instruction:
  3552. LINKTILE
  3553.  
  3554. /**
  3555. * The current tile associated with Link. The effect of writing to this variable is undefined.
  3556. * Because Link's tile is not determined until he is drawn, this will actually represent
  3557. * Link's tile in the previous frame.
  3558. *
  3559. */ Example Use: !#!
  3560.  
  3561. /************************************************************************************************************/
  3562.  
  3563. int Flip; ZASM Instruction:
  3564. LINKFLIP
  3565.  
  3566. /**
  3567. * The current tile associated with Link. The effect of writing to this variable is undefined.
  3568. * Because Link's tile is not determined until he is drawn, this will actually represent
  3569. * Link's tile flip in the previous frame.
  3570. *
  3571. */ Example Use: !#!
  3572.  
  3573.  
  3574. /************************************************************************************************************/
  3575.  
  3576. Link->Extend ZASM Instruction:
  3577. n/a
  3578.  
  3579. /**
  3580. * This value is NOT set by script. There is no instruction for it; however in the sprites editor
  3581. * (Menu: Quest->Graphics->Sprites->Link ) it is possibly to modify the Extend value of link.
  3582. * To do this, click on his sprites for any given action, and preee the 'x' key.
  3583. * The options are 16x16, 16x32, and 32x32; which correspond to Extend values of ( ?, ?, and ? ) respectively.
  3584. */
  3585.  
  3586. /************************************************************************************************************/
  3587.  
  3588. int HitHeight; ZASM Instruction:
  3589. LINKHYSZ
  3590.  
  3591. /**
  3592. * link's Hitbox height in pixels.
  3593. * This is not usable, as Link->Extend cannot be set.
  3594. * While setting it is not syntactically incorrect, it does nothing.
  3595. * You can read a value that you assign to this (e.g. for custom collision functions).
  3596. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3597. *
  3598. */ Example Use: !#!
  3599.  
  3600. /************************************************************************************************************/
  3601.  
  3602. int HitWidth; ZASM Instruction:
  3603. LINKHXSZ
  3604.  
  3605. /**
  3606. * link's Hitbox width in pixels.
  3607. * This is not usable, as Link->Extend cannot be set.
  3608. * While setting it is not syntactically incorrect, it does nothing.
  3609. * You can read a value that you assign to this (e.g. for custom collision functions).
  3610. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3611. *
  3612. */ Example Use: !#!
  3613.  
  3614. /************************************************************************************************************/
  3615.  
  3616. int TileWidth; ZASM Instruction:
  3617. LINKTYSZ
  3618. /**
  3619. * Link's width, in tiles.
  3620. * This is not usable, as Link->Extend cannot be set.
  3621. * While setting it is not syntactically incorrect, it does nothing.
  3622. * You can read a value that you assign to this (e.g. for custom/proxy sprite drawing).
  3623. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3624. *
  3625. */ Example Use: !#!
  3626.  
  3627. /************************************************************************************************************/
  3628.  
  3629. int TileHeight; ZASM Instruction:
  3630. LINKTXSZ
  3631.  
  3632. /**
  3633. * Link's height, in tiles.
  3634. * This is not usable, as Link->Extend cannot be set.
  3635. * While setting it is not syntactically incorrect, it does nothing.
  3636. * You can read a value that you assign to this (e.g. for custom/proxy sprite drawing).
  3637. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3638. *
  3639. */ Example Use: !#!
  3640.  
  3641. /************************************************************************************************************/
  3642.  
  3643. int HitZHeight; ZASM Instruction:
  3644. LINKHZSZ
  3645.  
  3646. /**
  3647. * The Z-axis height of Link's hitbox, or collision rectangle.
  3648. * The lower it is, the lower a flying or jumping enemy must fly in order to hit Link.
  3649. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  3650. * Writing to this is ignored unless Extend is set to values >=3.
  3651. * This is not usable, as Link->Extend cannot be set.
  3652. * While setting it is not syntactically incorrect, it does nothing.
  3653. * You can read a value that you assign to this (e.g. for custom collision functions).
  3654. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3655. *
  3656. */ Example Use: !#!
  3657.  
  3658. /************************************************************************************************************/
  3659.  
  3660. int HitXOffset; ZASM Instruction:
  3661. LINKHXOFS
  3662.  
  3663. /**
  3664. * The X offset of Link's hitbox, or collision rectangle.
  3665. * Setting it to positive or negative values will move Link's hitbox left or right.
  3666. * Writing to this is ignored unless Extend is set to values >=3.
  3667. * This is not usable, as Link->Extend cannot be set.
  3668. * While setting it is not syntactically incorrect, it does nothing.
  3669. * You can read a value that you assign to this (e.g. for custom collision functions).
  3670. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3671. *
  3672. */ Example Use: !#!
  3673.  
  3674. /************************************************************************************************************/
  3675.  
  3676. int HitYOffset; ZASM Instruction:
  3677. LINKHYOFS
  3678.  
  3679. /**
  3680. * The Y offset of Link's hitbox, or collision rectangle.
  3681. * Setting it to positive or negative values will move Link's hitbox up or down.
  3682. * Writing to this is ignored unless Extend is set to values >=3.
  3683. * This is not usable, as Link->Extend cannot be set.
  3684. * While setting it is not syntactically incorrect, it does nothing.
  3685. * You can read a value that you assign to this (e.g. for custom collision functions).
  3686. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3687. *
  3688. */ Example Use: !#!
  3689.  
  3690. /************************************************************************************************************/
  3691.  
  3692. int DrawXOffset; ZASM Instruction:
  3693. LINKXOFS
  3694.  
  3695. /**
  3696. * The X offset of Link's sprite.
  3697. * Setting it to positive or negative values will move the sprite's tiles left or right relative to its position.
  3698. * Writing to this is ignored unless Extend is set to values >=3.
  3699. * This is not usable, as Link->Extend cannot be set.
  3700. * While setting it is not syntactically incorrect, it does nothing.
  3701. * You can read a value that you assign to this.
  3702. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3703. *
  3704. */ Example Use: !#!
  3705.  
  3706. /************************************************************************************************************/
  3707.  
  3708. int DrawYOffset; ZASM Instruction:
  3709. LINKYOFS
  3710.  
  3711. /**
  3712. * The Y offset of Link's sprite.
  3713. * Setting it to positive or negative values will move the sprite's tiles up or down relative to its position.
  3714. * Writing to this is ignored unless Extend is set to values >=3.
  3715. * This is not usable, as Link->Extend cannot be set.
  3716. * While setting it is not syntactically incorrect, it does nothing.
  3717. * You can read a value that you assign to this.
  3718. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3719. *
  3720. */ Example Use: !#!
  3721.  
  3722. /************************************************************************************************************/
  3723.  
  3724. int DrawZOffset; ZASM Instruction:
  3725. LINKZOFS
  3726.  
  3727. /**
  3728. * The Z offset of Link's sprite.
  3729. * Writing to this is ignored unless Extend is set to values >=3.
  3730. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  3731. * This is not usable, as Link->Extend cannot be set.
  3732. * While setting it is not syntactically incorrect, it does nothing.
  3733. * You can read a value that you assign to this.
  3734. * This value is not preserved through sessions: Loading a saved game will reset it to the default.
  3735. *
  3736. */ Example Use: !#!
  3737.  
  3738. /************************************************************************************************************/
  3739.  
  3740. float Misc[16]; ZASM Instruction:
  3741. LINKMISC
  3742. LINKMISCD
  3743.  
  3744. /**
  3745. * An array of 16 miscellaneous variables for you to use as you please.
  3746. * These variables are not saved with Link.
  3747. *
  3748. */ Example Use: !#!
  3749.  
  3750. /************************************************************************************************************/
  3751.  
  3752. void Warp(int DMap, int screen); ZASM Instruction:
  3753. WARP
  3754. WARPR
  3755.  
  3756. /**
  3757. * Warps link to the given screen in the given DMap, just like if he'd
  3758. * triggered an 'Insta-Warp'-type warp.
  3759. *
  3760. */ Example Use: !#!
  3761.  
  3762. /************************************************************************************************************/
  3763.  
  3764. void PitWarp(int DMap, int screen); ZASM Instruction:
  3765. PITWARP
  3766. PITWARPR
  3767.  
  3768. /**
  3769. * This is identical to Warp, but Link's X and Y positions are preserved
  3770. * when he enters the destination screen, rather than being set to the
  3771. * Warp Return square.
  3772. *
  3773. */ Example Use: !#!
  3774.  
  3775. /************************************************************************************************************/
  3776.  
  3777. SelectAWeapon(int dir); ZASM Instruction:
  3778. !#!
  3779.  
  3780. /**
  3781. * Sets the A button item to the next one in the given direction based on
  3782. * the indices set in the subscreen. This will skip over items if A and B
  3783. * would be set to the same item.
  3784. * If the quest rule "Can Select A-Button Weapon On Subscreen" is disabled,
  3785. * this function does nothing.
  3786. *
  3787. */ Example Use: !#!
  3788.  
  3789. /************************************************************************************************************/
  3790.  
  3791. SelectBWeapon(int dir); ZASM Instruction:
  3792. !#!
  3793.  
  3794. /**
  3795. * Sets the B button item to the next one in the given direction based on
  3796. * the indices set in the subscreen. This will skip over items if A and B
  3797. * would be set to the same item.
  3798. *
  3799. */ Example Use: !#!
  3800.  
  3801.  
  3802. /************************************************************************************************************/
  3803. /************************************************************************************************************/
  3804.  
  3805.  
  3806. //===================================
  3807. //--- NPC Functions and Variables ---
  3808. //===================================
  3809.  
  3810. class npc
  3811.  
  3812.  
  3813. bool isValid(); ZASM Instruction:
  3814. ISVALIDNPC
  3815. /**
  3816. * Returns whether or not this NPC pointer is still valid. A pointer
  3817. * becomes invalid if the enemy dies or Link leaves the screen.
  3818. * Trying to access any variable of an invalid NPC pointer prints
  3819. * an error to allegro.log and does nothing.
  3820. */
  3821.  
  3822. /************************************************************************************************************/
  3823.  
  3824. void GetName(int buffer[]); ZASM Instruction:
  3825. NPCNAME
  3826. /**
  3827. * Loads the npc's name into 'buffer'. To load an NPC from an ID rather than a pointer,
  3828. * use 'GetNPCName' from std.zh
  3829. */
  3830.  
  3831. /************************************************************************************************************/
  3832.  
  3833. int ID; ZASM Instruction:
  3834. NPCID
  3835. /**
  3836. * The NPC's enemy ID number.
  3837. * npc->ID is read-only; while setting it is not syntactically incorrect, it does nothing.
  3838. */
  3839.  
  3840. /************************************************************************************************************/
  3841.  
  3842. int Type; ZASM Instruction:
  3843. NPCTYPE
  3844. /**
  3845. * The NPC's Type. Use the NPCT_ constants in std.zh to compare this value.
  3846. * npc->Type is read-only; while setting it is not syntactically incorrect, it does nothing.
  3847. */
  3848.  
  3849. /************************************************************************************************************/
  3850.  
  3851. int X; ZASM Instruction:
  3852. NPCX
  3853. /**
  3854. * The NPC's current X coordinate, in pixels. Float values passed to this will be cast to int.
  3855. */
  3856.  
  3857. /************************************************************************************************************/
  3858.  
  3859. int Y; ZASM Instruction:
  3860. NPCY
  3861. /**
  3862. * The NPC's current Y coordinate, in pixels. Float values passed to this will be cast to int.
  3863. */
  3864.  
  3865. /************************************************************************************************************/
  3866.  
  3867. int Z; ZASM Instruction:
  3868. NPCZ
  3869. /**
  3870. * The NPC's current Z coordinate, in pixels. Float values passed to this will be cast to int.
  3871. */
  3872.  
  3873. /************************************************************************************************************/
  3874.  
  3875. int Jump; ZASM Instruction:
  3876. NPCJUMP
  3877. /**
  3878. * The NPC's upward velocity, in pixels. If negative, the NPC will fall.
  3879. * The downward acceleration of Gravity (in Init Data) modifies this value every frame.
  3880. */
  3881.  
  3882. /************************************************************************************************************/
  3883.  
  3884. int Dir; ZASM Instruction:
  3885. NPCDIR
  3886. /**
  3887. * The direction the NPC is facing. Use the DIR_ constants in std.zh to
  3888. * set and compare this value.
  3889. */
  3890.  
  3891. /************************************************************************************************************/
  3892.  
  3893. int Rate; ZASM Instruction:
  3894. NPCRATE
  3895. /**
  3896. * The rate at which the NPC changes direction. For a point of reference,
  3897. * the "Octorok (Magic)" enemy has a rate of 16. The effect of writing to
  3898. * this field is currently undefined.
  3899. */
  3900.  
  3901. /************************************************************************************************************/
  3902.  
  3903. int Haltrate; ZASM Instruction:
  3904. NPCHALTRATE
  3905. /**
  3906. * The extent to which the NPC stands still while moving around the
  3907. * screen. As a point of reference, the Zols and Gels have haltrate of
  3908. * 16. The effect of writing to this field is currently undefined.
  3909. */
  3910.  
  3911. /************************************************************************************************************/
  3912.  
  3913. int Homing; ZASM Instruction:
  3914. NPCHOMING
  3915. /**
  3916. * How likely the NPC is to move towards Link.
  3917. * The effect of writing to this field is currently undefined.
  3918. */
  3919.  
  3920. /************************************************************************************************************/
  3921.  
  3922. int Hunger; ZASM Instruction:
  3923. NPRCHUNGE
  3924. /**
  3925. * How likely the NPC is to move towards bait.
  3926. * The effect of writing to this field is currently undefined.
  3927. */
  3928.  
  3929. /************************************************************************************************************/
  3930.  
  3931. int Step; ZASM Instruction:
  3932. NPCSTEP
  3933. /**
  3934. * The NPC's movement speed. A Step of 100 usually means that
  3935. * the enemy moves at approximately one pixel per animation frame.
  3936. * As a point of reference, the "Octorok (Magic)" enemy has
  3937. * a step of 200. The effect of writing to this field is
  3938. * currently undefined.
  3939. */
  3940.  
  3941. /************************************************************************************************************/
  3942.  
  3943. bool CollDetection; ZASM Instruction:
  3944. NPCCOLLDET
  3945. /**
  3946. * Whether the NPC will use the system's code to work out collisions with Link
  3947. * Initialised as 'true'.
  3948. */
  3949.  
  3950. /************************************************************************************************************/
  3951.  
  3952. int ASpeed; ZASM Instruction:
  3953. NPCFRAMERATE
  3954. /**
  3955. * The the NPC's animation frame rate, in screen frames. The effect of
  3956. * writing to this field is currently undefined.
  3957. */
  3958.  
  3959. /************************************************************************************************************/
  3960.  
  3961. int DrawStyle; ZASM Instruction:
  3962. NPCDRAWTYPE
  3963. /**
  3964. * The way the NPC is animated. Use the DS_ constants in std.zh to set or
  3965. * compare this value. The effect of writing to this field is currently undefined.
  3966. */
  3967.  
  3968. /************************************************************************************************************/
  3969.  
  3970. int HP; ZASM Instruction:
  3971. NPCHP
  3972. /**
  3973. * The NPC's current hitpoints. A weapon with a Power of 1 removes 2
  3974. * hitpoints.
  3975. */
  3976.  
  3977. /************************************************************************************************************/
  3978.  
  3979. int Damage; ZASM Instruction:
  3980. NPCDP
  3981. /**
  3982. * The amount of damage dealt to an unprotected Link when he touches this NPC, in
  3983. * quarter-hearts.
  3984. */
  3985.  
  3986. /************************************************************************************************************/
  3987.  
  3988. int WeaponDamage; ZASM Instruction:
  3989. NPCWDP
  3990. /**
  3991. * The amount of damage dealt to an unprotected Link by this NPC's weapon, in
  3992. * quarter-hearts.
  3993. */
  3994.  
  3995. /************************************************************************************************************/
  3996.  
  3997. int Stun; ZASM Instruction:
  3998. NPCSTUN
  3999. /**
  4000. * The time, in frames, that the NPC will be stunned. Some types of enemies cannot be stunned.
  4001. */
  4002.  
  4003. /************************************************************************************************************/
  4004.  
  4005. int OriginalTile; ZASM Instruction:
  4006. NPCOTILE
  4007. /**
  4008. * The number of the starting tile used by this NPC.
  4009. */
  4010.  
  4011. /************************************************************************************************************/
  4012.  
  4013. int Tile; ZASM Instruction:
  4014. NPCTILE
  4015. /**
  4016. * The current tile associated with this NPC. The effect of writing to this variable is undefined.
  4017. */
  4018.  
  4019. /************************************************************************************************************/
  4020.  
  4021. int Weapon; ZASM Instruction:
  4022. NPCWEAPON
  4023. /**
  4024. * The weapon used by this enemy. Use the WPN_ constants (NOT the EW_ constants)
  4025. * in std.zh to set or compare this value.
  4026. */
  4027.  
  4028. /************************************************************************************************************/
  4029.  
  4030. int ItemSet; ZASM Instruction:
  4031. NPCITEMSET
  4032. /**
  4033. * The items that the NPC might drop when killed. Use the IS_ constants
  4034. * in std.zh to set or compare this value.
  4035. */
  4036.  
  4037. /************************************************************************************************************/
  4038.  
  4039. int CSet; ZASM Instruction:
  4040. NPCCSET
  4041. /**
  4042. * The CSet used by this NPC.
  4043. */
  4044.  
  4045. /************************************************************************************************************/
  4046.  
  4047. int BossPal; ZASM Instruction:
  4048. NPCBOSSPAL
  4049. /**
  4050. * The boss pallete used by this NPC; this pallete is only used if CSet
  4051. * is 14 (the reserved boss cset). Use the BPAL_ constants in std.zh to
  4052. * set or compare this value.
  4053. */
  4054.  
  4055. /************************************************************************************************************/
  4056.  
  4057. int SFX; ZASM Instruction:
  4058. NPCBGSFX
  4059. /**
  4060. * The sound effects emitted by the enemy. Use the SFX_ constants in
  4061. * std.zh to set or compare this value.
  4062. */
  4063.  
  4064. /************************************************************************************************************/
  4065.  
  4066. int Extend; ZASM Instruction:
  4067. NPCEXTEND
  4068. /**
  4069. * Whether to extend the sprite of the enemy.
  4070. */
  4071.  
  4072. /************************************************************************************************************/
  4073.  
  4074. int TileWidth; ZASM Instruction:
  4075. NPCTXSZ
  4076. /**
  4077. * The number of tile columns composing the sprite.
  4078. * Writing to this is ignored unless Extend is set to values >=3.
  4079. */
  4080.  
  4081. /************************************************************************************************************/
  4082.  
  4083. int TileHeight; ZASM Instruction:
  4084. NPCTYSZ
  4085. /**
  4086. * The number of tile rows composing the sprite.
  4087. * Writing to this is ignored unless Extend is set to values >=3.
  4088. */
  4089.  
  4090. /************************************************************************************************************/
  4091.  
  4092. int HitWidth; ZASM Instruction:
  4093. NPCHXSZ
  4094. /**
  4095. * The width of the sprite's hitbox, or collision rectangle.
  4096. */
  4097.  
  4098. /************************************************************************************************************/
  4099.  
  4100. int HitHeight; ZASM Instruction:
  4101. NPCHYSZ
  4102. /**
  4103. * The height of the sprite's hitbox, or collision rectangle.
  4104. */
  4105.  
  4106. /************************************************************************************************************/
  4107.  
  4108. int HitZHeight; ZASM Instruction:
  4109. NPCHZSZ
  4110. /**
  4111. * The Z-axis height of the sprite's hitbox, or collision rectangle.
  4112. * The greater it is, the higher Link must jump or fly over the sprite to avoid taking damage.
  4113. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  4114. */
  4115.  
  4116. /************************************************************************************************************/
  4117.  
  4118. int HitXOffset; ZASM Instruction:
  4119. NPCHXOFS
  4120. /**
  4121. * The X offset of the sprite's hitbox, or collision rectangle.
  4122. * Setting it to positive or negative values will move the sprite's hitbox left or right.
  4123. */
  4124.  
  4125. /************************************************************************************************************/
  4126.  
  4127. int HitYOffset; ZASM Instruction:
  4128. NPCHYOFS
  4129. /**
  4130. * The Y offset of the sprite's hitbox, or collision rectangle.
  4131. * Setting it to positive or negative values will move the sprite's hitbox up or down.
  4132. */
  4133.  
  4134. /************************************************************************************************************/
  4135.  
  4136. int DrawXOffset; ZASM Instruction:
  4137. NPCXOFS
  4138. /**
  4139. * The X offset of the sprite.
  4140. * Setting it to positive or negative values will move the sprite's tiles left or right relative to its position.
  4141. */
  4142.  
  4143. /************************************************************************************************************/
  4144.  
  4145. int DrawYOffset; ZASM Instruction:
  4146. NPCYOFS
  4147. /**
  4148. * The Y offset of the sprite. In non-sideview screens, this is usually -2.
  4149. * Setting it to positive or negative values will move the sprite's tiles up or down relative to its position.
  4150. */
  4151.  
  4152. /************************************************************************************************************/
  4153.  
  4154. int DrawZOffset; ZASM Instruction:
  4155. NPCZOFS
  4156. /**
  4157. * The Z offset of the sprite. This is ignored unless Extend is set to values >=3.
  4158. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  4159. */
  4160.  
  4161. /************************************************************************************************************/
  4162.  
  4163. int Defense[]; ZASM Instruction:
  4164. NPCDEFENSED
  4165. /**
  4166. * The npc's Defense values, as an array of 18 integers. Use the NPCD_ and NPCDT_ constants
  4167. * in std.zh to set or compare these values.
  4168. */
  4169.  
  4170. /************************************************************************************************************/
  4171.  
  4172. int Attributes[]; ZASM Instruction:
  4173. NPCDD
  4174. /**
  4175. * The npc's Miscellaneous Attributes, as an array of ten integers.
  4176. * They are read-only; while setting them is not syntactically incorrect, it does nothing.
  4177. */
  4178.  
  4179. /************************************************************************************************************/
  4180.  
  4181. int MiscFlags; ZASM Instruction:
  4182. NPCMFLAGS
  4183. /**
  4184. * The npc's Misc. Flags as 14 bits ORed together, starting with 'Damaged by Power 0 Weapons',
  4185. * and working down the flags in the order they are shown in the Enemy Editor.
  4186. * npc->MiscFlags is read-only; while setting it is not syntactically incorrect, it does nothing.
  4187. * If you are not comfortable with binary operations, you can use 'GetNPCMiscFlag' from std.zh
  4188. */
  4189.  
  4190. /************************************************************************************************************/
  4191.  
  4192. float Misc[]; ZASM Instruction:
  4193. NPCMISCD
  4194. /**
  4195. * An array of 16 miscellaneous variables for you to use as you please.
  4196. */
  4197.  
  4198. /************************************************************************************************************/
  4199.  
  4200. void BreakShield(); ZASM Instruction:
  4201. BREAKSHIELD
  4202. /**
  4203. * Breaks the enemy's shield if it has one. This works even if the flag
  4204. * "Hammer Can Break Shield" is not checked.
  4205. */
  4206.  
  4207.  
  4208. /************************************************************************************************************/
  4209. /************************************************************************************************************/
  4210.  
  4211.  
  4212.  
  4213.  
  4214. //======================================
  4215. //--- Weapon Functions and Variables ---
  4216. //======================================
  4217.  
  4218. class weapon
  4219.  
  4220.  
  4221. //! ZScript supports two different weapon classes:
  4222. //! The lweapon class is used for Link's weapons (that damage enemies, and trigger objects)
  4223. //! while the eweapon class is used for enemy weapons, that can damage Link.
  4224. //!
  4225. //! Both the lweapon, and the eweapon class have all of the following atributes:
  4226.  
  4227. bool isValid(); ZASM Instruction:
  4228. ISVALIDLWPN
  4229. ISVALIDEWPN
  4230.  
  4231. /**
  4232. * Returns whether this weapon pointer is still valid. A weapon pointer
  4233. * becomes invalid when the weapon fades away or disappears
  4234. * or Link leaves the screen. Accessing any variables using an
  4235. * invalid weapon pointer prints an error message to allegro.log and
  4236. * does nothing.
  4237. */ Example Use: !#!
  4238.  
  4239. /************************************************************************************************************/
  4240.  
  4241. void UseSprite(int id); ZASM Instruction:
  4242. LWPNUSESPRITER, LWPNUSESPRITEV
  4243. EWPNUSESPRITER, EWPNUSESPRITEV
  4244.  
  4245. /**
  4246. * Reads a 'Weapons/Misc' sprite entry in your quest file, and assigns
  4247. * the OriginalTile, Tile, OriginalCSet, CSet, FlashCSet, NumFrames,
  4248. * Frame, ASpeed, Flip and Flash variables of this weapon based on
  4249. * this entry's data. Passing negative values, and values greater than
  4250. * 255, will do nothing.
  4251. */ Example Use: !#!
  4252.  
  4253. /************************************************************************************************************/
  4254.  
  4255. bool Behind; ZASM Instruction:
  4256. LWPNBEHIND
  4257. EWPNBEHIND
  4258.  
  4259. /**
  4260. * Ensures that the weapon's graphic is drawn behind Link and enemies.
  4261. */ Example Use: !#!
  4262.  
  4263. /************************************************************************************************************/
  4264.  
  4265. int ID; ZASM Instruction:
  4266. LWPNID
  4267. EWPNID
  4268.  
  4269. /**
  4270. * The weapon's ID number. Use the LW_ or EW_ constants to compare
  4271. * this value. The effect of writing to this field is currently undefined.
  4272. */ Example Use: !#!
  4273.  
  4274. /************************************************************************************************************/
  4275.  
  4276. int X; ZASM Instruction:
  4277. LWPNX
  4278. EWPNX
  4279.  
  4280. /**
  4281. * The weapon's X position on the screen, in pixels. Float values passed
  4282. * to this will be cast to int.
  4283. */ Example Use: !#!
  4284.  
  4285. /************************************************************************************************************/
  4286.  
  4287. int Y; ZASM Instruction:
  4288. LWPNY
  4289. EWPNY
  4290.  
  4291. /**
  4292. * The weapon's Y position on the screen, in pixels. Float values passed
  4293. * to this will be cast to int.
  4294. */ Example Use: !#!
  4295.  
  4296. /************************************************************************************************************/
  4297.  
  4298. int Z; ZASM Instruction:
  4299. LWPNZ
  4300. EWPNZ
  4301.  
  4302. /**
  4303. * The weapon's Z position on the screen, in pixels. Float values passed
  4304. * to this will be cast to int.
  4305. */ Example Use: !#!
  4306.  
  4307. /************************************************************************************************************/
  4308.  
  4309. int Jump; ZASM Instruction:
  4310. LWPNJUMP
  4311. EWPNJUMP
  4312.  
  4313. /**
  4314. * The weapon's falling speed on the screen. Bombs, Bait and
  4315. * Fire obey gravity.
  4316. */ Example Use: !#!
  4317.  
  4318. /************************************************************************************************************/
  4319.  
  4320. int DrawStyle; ZASM Instruction:
  4321. LWPNDRAWTYPE
  4322. EWPNDRAWTYPE
  4323.  
  4324. /**
  4325. * An integer representing how the weapon is to be drawn. Use one of the
  4326. * DS_ constants in std.zh to set or compare this value.
  4327. */ Example Use: !#!
  4328.  
  4329. /************************************************************************************************************/
  4330.  
  4331. int Dir; ZASM Instruction:
  4332. LWPNDIR
  4333. eWPNDIR
  4334.  
  4335. /**
  4336. * The direction that the weapon is facing. Used by certain weapon types
  4337. * to determine movement, shield deflection and such.
  4338. */ Example Use: !#!
  4339.  
  4340. /************************************************************************************************************/
  4341.  
  4342. int OriginalTile; ZASM Instruction:
  4343. LWPNOTILE
  4344. EWPNOTILE
  4345.  
  4346. /**
  4347. * The starting tile of the weapon's animation.
  4348. */ Example Use: !#!
  4349.  
  4350. /************************************************************************************************************/
  4351.  
  4352. int Tile; ZASM Instruction:
  4353. LWPNTILE
  4354. EWPNTILE
  4355.  
  4356. /**
  4357. * The current tile associated with this weapon.
  4358. */ Example Use: !#!
  4359.  
  4360. /************************************************************************************************************/
  4361.  
  4362. int OriginalCSet; ZASM Instruction:
  4363. LWPNOCSET
  4364. EWPNOCSET
  4365.  
  4366. /**
  4367. * The starting CSet of the weapon's animation.
  4368. */ Example Use: !#!
  4369.  
  4370. /************************************************************************************************************/
  4371.  
  4372. int CSet; ZASM Instruction:
  4373. LWPNCSET
  4374. EWPNCSET
  4375.  
  4376. /**
  4377. * This weapon's current CSet.
  4378. */ Example Use: !#!
  4379.  
  4380. /************************************************************************************************************/
  4381.  
  4382. int FlashCSet; ZASM Instruction:
  4383. LWPNFLASHCSET
  4384. EWPNFLASHCSET
  4385.  
  4386. /**
  4387. * The CSet used during this weapon's flash frames, if this weapon flashes.
  4388. */ Example Use: !#!
  4389.  
  4390. /************************************************************************************************************/
  4391.  
  4392. int NumFrames; ZASM Instruction:
  4393. LWPNFRAMES
  4394. EWPNFRAMES
  4395.  
  4396. /**
  4397. * The number of frames in this weapon's animation.
  4398. */ Example Use: !#!
  4399.  
  4400. /************************************************************************************************************/
  4401.  
  4402. int Frame; ZASM Instruction:
  4403. LWPNFRAME
  4404. EWPNFRAME
  4405.  
  4406. /**
  4407. * The weapon's current animation frame.
  4408. */ Example Use: !#!
  4409.  
  4410. /************************************************************************************************************/
  4411.  
  4412. int ASpeed; ZASM Instruction:
  4413. LWPNASPEED
  4414. EWPNASPEED
  4415.  
  4416. /**
  4417. * The speed at which this weapon animates, in screen frames.
  4418. */ Example Use: !#!
  4419.  
  4420. /************************************************************************************************************/
  4421.  
  4422. int Damage; ZASM Instruction:
  4423. LWPNPOWER
  4424. EWPNPOWER
  4425.  
  4426. /**
  4427. * The amount of damage that this weapon causes to Link/an enemy upon contact.
  4428. */ Example Use: !#!
  4429.  
  4430. /************************************************************************************************************/
  4431.  
  4432. int Step; ZASM Instruction:
  4433. LWPNSTEP
  4434. EWPNSTEP
  4435.  
  4436. /**
  4437. * Usually associated with the weapon's velocity. A Step of 100
  4438. * typically means that the weapon moves at approximately one pixel
  4439. * per animation frame.
  4440. */ Example Use: !#!
  4441.  
  4442. /************************************************************************************************************/
  4443.  
  4444. int Angle; ZASM Instruction:
  4445. LWPNANGLE
  4446. EWPNANGLE
  4447.  
  4448. /**
  4449. * The weapon's current angle in clockwise radians; used by certain weapon
  4450. * types with angular movement. 0 = right, PI/2 = down, etc. Note: if you
  4451. * want Link's shield to interact with the weapon correctly, you must set
  4452. * its Dir to a direction that approximates this angle.
  4453. */ Example Use: !#!
  4454.  
  4455. /************************************************************************************************************/
  4456.  
  4457. bool Angular; ZASM Instruction:
  4458. LWPNANGULAR
  4459. EWPNANGULAR
  4460.  
  4461. /**
  4462. * Specifies whether a weapon has angular movement.
  4463. */ Example Use: !#!
  4464.  
  4465. /************************************************************************************************************/
  4466.  
  4467. bool CollDetection; ZASM Instruction:
  4468. LWPNCOLLDET
  4469. EWPNCOLLDET
  4470.  
  4471. /**
  4472. * Whether the weapon will use the system's code to work out collisions with
  4473. * Link and/or enemies (depending on weapon type). Initialised as 'true'.
  4474. */ Example Use: !#!
  4475.  
  4476. /************************************************************************************************************/
  4477.  
  4478. int DeadState; ZASM Instruction:
  4479. LWPNDEAD
  4480. EWPNDEAD
  4481.  
  4482. /**
  4483. * The current state of the weapon. Important to keep track of. A value of
  4484. * -1 indicates that it is active, and moves according to the weapon's
  4485. * Dir, Step, Angular, and Angle values. Use -1 if you want the engine to
  4486. * handle movement and collision. Use any value below -1 if you want a
  4487. * dummy weapon that you can control on your own.
  4488. *
  4489. * Given a deadstate value of -10, a weapon will turn of its collision
  4490. * detection and movement. If it has a positive value, it will
  4491. * decrement once per frame until it equals 0, whereupon the weapon is
  4492. * removed. If you want to remove the weapon, write one of the WDS_
  4493. * constants in std.zh (appropriate for the weapon) to this variable.
  4494. *
  4495. * Weapons with the type *_SPARKLE have a DeadState equal to the number
  4496. * of frames in their sprite animation, when created.
  4497. */ Example Use: !#!
  4498.  
  4499. /************************************************************************************************************/
  4500.  
  4501. bool Flash; ZASM Instruction:
  4502. LWPNFLASH
  4503. EWPNFLASH
  4504.  
  4505. /**
  4506. * Whether or not the weapon flashes. A flashing weapon alternates between
  4507. * its CSet and its FlashCSet.
  4508. */ Example Use: !#!
  4509.  
  4510. /************************************************************************************************************/
  4511.  
  4512. int Flip; ZASM Instruction:
  4513. LWPNFLIP
  4514. EWPNFLIP
  4515.  
  4516. /**
  4517. * Whether and how the weapon's tiles should be flipped.
  4518. * 0: No flip
  4519. * 1: Horizontal flip
  4520. * 2: Vertical flip
  4521. * 3: Both (180 degree rotation)
  4522. */ Example Use: !#!
  4523.  
  4524. /************************************************************************************************************/
  4525.  
  4526. int Extend; ZASM Instruction:
  4527. LWPNEXTEND
  4528. EWPNEXTEND
  4529.  
  4530. /**
  4531. * Whether to extend the sprite of the weapon.
  4532. */ Example Use: !#!
  4533.  
  4534. /************************************************************************************************************/
  4535.  
  4536. int TileWidth; ZASM Instruction:
  4537. LWPNTXSZ
  4538. EWPNTXSZ
  4539.  
  4540. /**
  4541. * The number of tile columns composing the sprite.
  4542. * Writing to this is ignored unless Extend is set to values >=3.
  4543. */ Example Use: !#!
  4544.  
  4545. /************************************************************************************************************/
  4546.  
  4547. int TileHeight; ZASM Instruction:
  4548. LWPNTYSZ
  4549. EWPNTYSZ
  4550.  
  4551. /**
  4552. * The number of tile rows composing the sprite.
  4553. * Writing to this is ignored unless Extend is set to values >=3.
  4554. */ Example Use: !#!
  4555.  
  4556. /************************************************************************************************************/
  4557.  
  4558. int HitWidth; ZASM Instruction:
  4559. LWPNHXSZ
  4560. EWPNHXSZ
  4561.  
  4562. /**
  4563. * The width of the sprite's hitbox, or collision rectangle.
  4564. */ Example Use: !#!
  4565.  
  4566. /************************************************************************************************************/
  4567.  
  4568. int HitHeight; ZASM Instruction:
  4569. LWPNHYSZ
  4570. WEPNHYSZ
  4571.  
  4572. /**
  4573. * The height of the sprite's hitbox, or collision rectangle.
  4574. */ Example Use: !#!
  4575.  
  4576. /************************************************************************************************************/
  4577.  
  4578. int HitZHeight; ZASM Instruction:
  4579. LWPNHZSZ
  4580. EWPNHZSZ
  4581.  
  4582. /**
  4583. * The Z-axis height of the sprite's hitbox, or collision rectangle.
  4584. * The greater it is, the higher Link must jump or fly over the sprite
  4585. * The values of DrawZOffset and HitZHight are linked. Setting one, also sets the other.
  4586. * to avoid taking damage.
  4587. */ Example Use: !#!
  4588.  
  4589. /************************************************************************************************************/
  4590.  
  4591. int HitXOffset; ZASM Instruction:
  4592. LWPNHXOFS
  4593. EWPNHXOFS
  4594.  
  4595. /**
  4596. * The X offset of the sprite's hitbox, or collision rectangle.
  4597. * Setting it to positive or negative values will move the sprite's
  4598. * hitbox left or right.
  4599. */ Example Use: !#!
  4600.  
  4601. /************************************************************************************************************/
  4602.  
  4603. int HitYOffset; ZASM Instruction:
  4604. LWPNHYOFS
  4605. EWPNHYOFS
  4606.  
  4607. /**
  4608. * The Y offset of the sprite's hitbox, or collision rectangle.
  4609. * Setting it to positive or negative values will move the sprite's
  4610. * hitbox up or down.
  4611. */ Example Use: !#!
  4612.  
  4613. /************************************************************************************************************/
  4614.  
  4615. int DrawXOffset; ZASM Instruction:
  4616. LWPNXOFS
  4617. EWPNXOFS
  4618.  
  4619. /**
  4620. * The X offset of the sprite.
  4621. * Setting it to positive or negative values will move the sprite's
  4622. * tiles left or right relative to its position.
  4623. */ Example Use: !#!
  4624.  
  4625. /************************************************************************************************************/
  4626.  
  4627. int DrawYOffset; ZASM Instruction:
  4628. LWPNYOFS
  4629. EWPNYOFS
  4630.  
  4631. /**
  4632. * The Y offset of the sprite.
  4633. * Setting it to positive or negative values will move the sprite's
  4634. * tiles up or down relative to its position.
  4635. */ Example Use: !#!
  4636.  
  4637. /************************************************************************************************************/
  4638.  
  4639. int DrawZOffset; ZASM Instruction:
  4640. LWPNZOFS
  4641. EWPNZOFS
  4642.  
  4643. /**
  4644. * The Z offset of the sprite.
  4645. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  4646. */ Example Use: !#!
  4647.  
  4648. /************************************************************************************************************/
  4649.  
  4650. float Misc[]; ZASM Instruction:
  4651. LWPNMISCD
  4652. EWPNMISCD
  4653.  
  4654. /**
  4655. * An array of 16 miscellaneous variables for you to use as you please.
  4656. */ Example Use: !#!
  4657.  
  4658.  
  4659. /************************************************************************************************************/
  4660. /************************************************************************************************************/
  4661.  
  4662. //====================================
  4663. //--- Item Functions and Variables ---
  4664. //====================================
  4665.  
  4666. class item
  4667.  
  4668.  
  4669. bool isValid(); ZASM Instruction:
  4670. ISVALIDITEM
  4671.  
  4672. /**
  4673. * Returns whether this item pointer is still valid. An item pointer
  4674. * becomes invalid when Link picks up the item, the item fades away,
  4675. * or Link leaves the screen. Accessing any variables using an
  4676. * invalid item pointer prints an error message to allegro.log and
  4677. * does nothing.
  4678. *
  4679. */ Example Use: !#!
  4680.  
  4681. /************************************************************************************************************/
  4682.  
  4683. int X; ZASM Instruction:
  4684. ITEMX
  4685.  
  4686. /**
  4687. * The item's X position on the screen, in pixels. Float values passed to this will be cast to int.
  4688. *
  4689. */ Example Use: !#!
  4690.  
  4691. /************************************************************************************************************/
  4692.  
  4693. int Y; ZASM Instruction:
  4694. ITEMY
  4695. /**
  4696. * The item's Y position on the screen, in pixels. Float values passed to this will be cast to int.
  4697. *
  4698. */ Example Use: !#!
  4699.  
  4700. /************************************************************************************************************/
  4701.  
  4702. int Jump ZASM Instruction:
  4703. ITEMJUMP
  4704.  
  4705. /**
  4706. * The item's upward velocity, in pixels. If negative, the item will fall.
  4707. * The downward acceleration of Gravity (in Init Data) modifies this value every frame.
  4708. *
  4709. */ Example Use: !#!
  4710.  
  4711. /************************************************************************************************************/
  4712.  
  4713. int DrawStyle; ZASM Instruction:
  4714. ITEMDRAWTYPE
  4715. /**
  4716. * An integer representing how the item is to be drawn. Use one of the
  4717. * DS_ constants in std.zh to set or compare this value.
  4718. *
  4719. */ Example Use: !#!
  4720.  
  4721. /************************************************************************************************************/
  4722.  
  4723. int ID; ZASM Instruction:
  4724. ITEMID
  4725. /**
  4726. * This item's ID number. Use the I_ constants to compare this value. The effect of writing to this field is currently undefined.
  4727. *
  4728. */ Example Use: !#!
  4729.  
  4730. /************************************************************************************************************/
  4731.  
  4732. int OriginalTile; ZASM Instruction:
  4733. ITEMOTILE
  4734. /**
  4735. * The starting tile of the item's animation.
  4736. *
  4737. */ Example Use: !#!
  4738.  
  4739. /************************************************************************************************************/
  4740.  
  4741. int Tile; ZASM Instruction:
  4742. ITEMTILE
  4743. /**
  4744. * The current tile associated with this item.
  4745. *
  4746. */ Example Use: !#!
  4747.  
  4748. /************************************************************************************************************/
  4749.  
  4750. int CSet; ZASM Instruction:
  4751. ITEMCSET
  4752. /**
  4753. * This item's CSet.
  4754. *
  4755. */ Example Use: !#!
  4756.  
  4757. /************************************************************************************************************/
  4758.  
  4759. int FlashCSet; ZASM Instruction:
  4760. ITEMFLASHCSET
  4761. /**
  4762. * The CSet used during this item's flash frames, if this item flashes.
  4763. *
  4764. */ Example Use: !#!
  4765.  
  4766. /************************************************************************************************************/
  4767.  
  4768. int NumFrames; ZASM Instruction:
  4769. ITEMFRAMES
  4770. /**
  4771. * The number of frames in this item's animation.
  4772. *
  4773. */ Example Use: !#!
  4774.  
  4775. /************************************************************************************************************/
  4776.  
  4777. int Frame; ZASM Instruction:
  4778. ITEMFRAME
  4779. /**
  4780. * The tile that is this item's current animation frame.
  4781. *
  4782. */ Example Use: !#!
  4783.  
  4784. /************************************************************************************************************/
  4785.  
  4786. int ASpeed; ZASM Instruction:
  4787. ITEMASPEED
  4788. /**
  4789. * The speed at which this item animates, in screen frames.
  4790. *
  4791. */ Example Use: !#!
  4792.  
  4793. /************************************************************************************************************/
  4794.  
  4795. int Delay; ZASM Instruction:
  4796. ITEMDELAY
  4797. /**
  4798. * The amount of time the animation is suspended after the last frame,
  4799. * before the animation restarts, in item frames. That is, the total
  4800. * number of screen frames of extra wait is Delay*ASpeed.
  4801. *
  4802. */ Example Use: !#!
  4803.  
  4804. /************************************************************************************************************/
  4805.  
  4806. bool Flash; ZASM Instruction:
  4807. ITEMFLASH
  4808. /**
  4809. * Whether or not the item flashes. A flashing item alternates between
  4810. * its CSet and its FlashCSet.
  4811. *
  4812. */ Example Use: !#!
  4813.  
  4814. /************************************************************************************************************/
  4815.  
  4816. int Flip; ZASM Instruction:
  4817. ITEMFLIP
  4818.  
  4819. /**
  4820. * Whether and how the item's tiles should be flipped.
  4821. * 0: No flip
  4822. * 1: Horizontal flip
  4823. * 2: Vertical flip
  4824. * 3: Both (180 degree rotation)
  4825. *
  4826. */ Example Use: !#!
  4827.  
  4828. /************************************************************************************************************/
  4829.  
  4830. int Pickup; ZASM Instruction:
  4831. ITEMPICKUP
  4832. /**
  4833. * The pickup flags of the item, which determine what happens when Link
  4834. * picks up the item. Its value consists of flags OR'd (|) together; use
  4835. * the IP_ constants in std.zh to set or compare these values.
  4836. * A special note about IP_ENEMYCARRIED: if the Quest Rule "Hide Enemy-
  4837. * Carried Items" is set, then an item carried by an enemy will have its
  4838. * X and Y values set to -128 while the enemy is carrying it. If this
  4839. * flag is removed from such an item, then it will be moved to the enemy's
  4840. * on-screen location.
  4841. * If you are not comfortable with performing binary operations, use the ItemPickup functions from std.zh.
  4842. *
  4843. */ Example Use: !#!
  4844.  
  4845. /************************************************************************************************************/
  4846.  
  4847. int Extend; ZASM Instruction:
  4848. ITEMEXTEND
  4849. /**
  4850. * Whether to extend the sprite of the item.
  4851. *
  4852. */ Example Use: !#!
  4853.  
  4854. /************************************************************************************************************/
  4855.  
  4856. int TileWidth; ZASM Instruction:
  4857. !
  4858. /**
  4859. * The number of tile columns composing the sprite.
  4860. * Writing to this is ignored unless Extend is set to values >=3.
  4861. *
  4862. */ Example Use: !#!
  4863.  
  4864. /************************************************************************************************************/
  4865.  
  4866. int TileHeight; ZASM Instruction:
  4867. !
  4868. /**
  4869. * The number of tile rows composing the sprite.
  4870. * Writing to this is ignored unless Extend is set to values >=3.
  4871. *
  4872. */ Example Use: !#!
  4873.  
  4874. /************************************************************************************************************/
  4875.  
  4876. int HitWidth; ZASM Instruction:
  4877. ITEMHSXZ
  4878. /**
  4879. * The width of the sprite's hitbox, or collision rectangle.
  4880. *
  4881. */ Example Use: !#!
  4882.  
  4883. /************************************************************************************************************/
  4884.  
  4885. int HitHeight; ZASM Instruction:
  4886. ITEMHYSZ
  4887. /**
  4888. * The height of the sprite's hitbox, or collision rectangle.
  4889. *
  4890. */ Example Use: !#!
  4891.  
  4892. /************************************************************************************************************/
  4893.  
  4894. int HitZHeight; ZASM Instruction:
  4895. ITEMHXSZ
  4896. /**
  4897. * The Z-axis height of the sprite's hitbox, or collision rectangle.
  4898. * The greater it is, the higher Link must jump or fly over the sprite to avoid picking up the item.
  4899. *
  4900. */ Example Use: !#!
  4901.  
  4902. /************************************************************************************************************/
  4903.  
  4904. int HitXOffset; ZASM Instruction:
  4905. ITEMHXOFS
  4906. /**
  4907. * The X offset of the sprite's hitbox, or collision rectangle.
  4908. * Setting it to positive or negative values will move the sprite's hitbox left or right.
  4909. *
  4910. */ Example Use: !#!
  4911.  
  4912. /************************************************************************************************************/
  4913.  
  4914. int HitYOffset; ZASM Instruction:
  4915. ITEMHYOFS
  4916. /**
  4917. * The Y offset of the sprite's hitbox, or collision rectangle.
  4918. * Setting it to positive or negative values will move the sprite's hitbox up or down.
  4919. *
  4920. */ Example Use: !#!
  4921.  
  4922. /************************************************************************************************************/
  4923.  
  4924. int DrawXOffset; ZASM Instruction:
  4925. ITEMXOFS
  4926. /**
  4927. * The X offset of the sprite.
  4928. * Setting it to positive or negative values will move the sprite's tiles left or right relative to its position.
  4929. *
  4930. */ Example Use: !#!
  4931.  
  4932. /************************************************************************************************************/
  4933.  
  4934. int DrawYOffset; ZASM Instruction:
  4935. ITEMYOFS
  4936. /**
  4937. * The Y offset of the sprite.
  4938. * Setting it to positive or negative values will move the sprite's tiles up or down relative to its position.
  4939. *
  4940. */ Example Use: !#!
  4941.  
  4942. /************************************************************************************************************/
  4943.  
  4944. int DrawZOffset; ZASM Instruction:
  4945. ITEMZOFS
  4946. /**
  4947. * The Z offset of the sprite.
  4948. * The values of DrawZOffset and HitZHeight are linked. Setting one, also sets the other.
  4949. *
  4950. */ Example Use: !#!
  4951.  
  4952. /************************************************************************************************************/
  4953.  
  4954. float Misc[]; ZASM Instruction:
  4955. ITEMMISCD
  4956. /**
  4957. * An array of 16 miscellaneous variables for you to use as you please.
  4958. * Note that lweapons and eweapons possess exactly the same attributes,
  4959. * although their designation affects how they are treated by the engine.
  4960. * The values here correspond to both the lweapon and eweapon type.
  4961. *
  4962. */ Example Use: !#!
  4963.  
  4964.  
  4965. /************************************************************************************************************/
  4966. /************************************************************************************************************/
  4967.  
  4968.  
  4969. //=========================================
  4970. //--- Itemdata Functions and Variables ---
  4971. //=========================================
  4972.  
  4973. //! You may reference itemdata variables via item scripts, using the 'this' pointer.
  4974.  
  4975. class itemdata
  4976.  
  4977.  
  4978. float InitD[]; ZASM Instruction:
  4979. IDATAINITDD
  4980. /**
  4981. * The original values of the item's 8 'D#' input values are they are stored in the
  4982. * .qst file, regardles of whether they have been modified by ZScript.
  4983. */ Example Use: !#!
  4984.  
  4985. /************************************************************************************************************/
  4986.  
  4987. void GetName(int buffer[]); ZASM Instruction:
  4988. !
  4989. /**
  4990. * Loads the item this itemdata is attributed to's name into 'buffer'
  4991. */ Example Use: !#!
  4992.  
  4993. /************************************************************************************************************/
  4994.  
  4995. int Family; ZASM Instruction:
  4996. IDATAFAMILY
  4997. /**
  4998. * The kind of item to which this class belongs (swords, boomerangs,
  4999. * potions, etc.) Use the IC_ constants in std.zh to set or compare this
  5000. * value.
  5001. */ Example Use: !#!
  5002.  
  5003. /************************************************************************************************************/
  5004.  
  5005. int Level; ZASM Instruction:
  5006. IDATALEVEL
  5007. /**
  5008. * The level of this item. Higher-level items replace lower-level items
  5009. * when they are picked up.
  5010. */ Example Use: !#!
  5011.  
  5012. /************************************************************************************************************/
  5013.  
  5014. int Power; ZASM Instruction:
  5015. IDATAPOWER
  5016. /**
  5017. * The item's power, for most items this is amount of damage dealt but is
  5018. * used for other values in some items (ie. Roc's Feather)
  5019. */ Example Use: !#!
  5020.  
  5021. /************************************************************************************************************/
  5022.  
  5023. int Amount; ZASM Instruction:
  5024. IDATAAMOUNT
  5025. /**
  5026. * Corresponds to the "Increase Amount" entry in the Item Editor.
  5027. * The value of this data member can have two meanings:
  5028. * If Amount & 0x8000 is 1, the drain counter for this item is set
  5029. * to Amount & 0x3FFF. The game then slowly fills the counter of this item
  5030. * (see Counter below) out of the drain counter. Gaining rupees uses the
  5031. * drain counter, for example.
  5032. * is set to Amount when the item is picked up.
  5033. * If Amount & 0x8000 is 0, the counter of this item is increased, if
  5034. * Amount & 0x4000 is 1, or decreased, if Amount & 0x4000 is 0, by
  5035. * Amount & 0x3FFF when the item is picked up.
  5036. */ Example Use: !#!
  5037.  
  5038. /************************************************************************************************************/
  5039.  
  5040. int Max; ZASM Instruction:
  5041. IDATAMAX
  5042. /**
  5043. * Corresponds to the "Full Max" entry in the Item Editor.
  5044. * In conjunction with MaxIncrement (see below) this value controls how
  5045. * the maximum value of the counter of this item (see Counter below) is
  5046. * modified when the item is picked up. If MaxIncrement is nonzero at that
  5047. * time, the counter's new maximum value is at that time set to the
  5048. * minimum of its current value plus MaxIncrement, Max.
  5049. * If Max is less than the current maximum of the counter, Max is ignored
  5050. * and that maximum is used instead.
  5051. * Notice that as a special case, if Max = MaxIncrement, the counter's
  5052. * maximum value will be forced equal to Max.
  5053. */ Example Use: !#!
  5054.  
  5055. /************************************************************************************************************/
  5056.  
  5057. int MaxIncrement; ZASM Instruction:
  5058. IDATASETMAX
  5059. /**
  5060. * Corresponds to the "+Max" entry in the Item Editor.
  5061. * In conjunction with Max (see above) this value controls how the
  5062. * maximum value of the counter of this item (see Counter below) is
  5063. * modified when the item is picked up. If MaxIncrement is nonzero at that
  5064. * time, the counter's new maximum value is at that time set to the
  5065. * minimum of its current value plus MaxIncrement, and Max.
  5066. * If Max is less than the current maximum of the counter, Max is ignored
  5067. * and that maximum is used instead.
  5068. */ Example Use: !#!
  5069.  
  5070. /************************************************************************************************************/
  5071.  
  5072. bool Keep; ZASM Instruction:
  5073. IDATAKEEP
  5074. /**
  5075. * Corresponds to the "Equipment Item" checkbox in the Item Editor.
  5076. * If true, Link will keep the item, and it will show up as an item or
  5077. * equipment in the subscreen. If false, it may modify the current value
  5078. * or maximum value of its counter (see Counter below), then disappear.
  5079. * The White Sword and Raft, for instance, have Keep true, and keys and
  5080. * rupees have Keep false.
  5081. */ Example Use: !#!
  5082.  
  5083. /************************************************************************************************************/
  5084.  
  5085. int Counter; ZASM Instruction:
  5086. IDATACOUNTER
  5087. /**
  5088. * Corresponds to the "Counter Reference" entry in the Item Editor.
  5089. * The game counter whose current and modified values might be modified
  5090. * when the item is picked up (see Amount, Max, and MaxIncrement above.)
  5091. * Use the CT_ constants in std.zh to set or compare this value.
  5092. */ Example Use: !#!
  5093.  
  5094. /************************************************************************************************************/
  5095.  
  5096. int UseSound; ZASM Instruction:
  5097. IDATAUSESOUND
  5098.  
  5099. /**
  5100. * Corresponds to the "Sound" entry on the action tab in the Item Editor.
  5101. */ Example Use: !#!
  5102.  
  5103.  
  5104. /************************************************************************************************************/
  5105. /************************************************************************************************************/
  5106.  
  5107.  
  5108. //////////////////////
  5109. /// Array Building ///
  5110. //////////////////////
  5111.  
  5112.  
  5113. //////////////////////////////////////
  5114. /// Poke, or Peek at Memory Values ///
  5115. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  5116. /// The following functions are used by ZScript to build arrays, and move data between the registers ///
  5117. /// that hold them, and generally interpret the values in registers for using arrays. ///
  5118. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  5119. /// When an array is declared in ZScript, the following commands are used to create it, ///
  5120. /// and store its values: ///
  5121. /// ///
  5122. /// Creating arrays (global): ///
  5123. /// ///
  5124. /// int arr[16]; ///
  5125. /// int x; ///
  5126. /// ///
  5127. /// ZASM Output: ///
  5128. /// ALLOCATEGMEMV d2,16 : allocates 16 indices to d2 ///
  5129. /// SETR gd1,d2 : assigns the register d2 to global register gd1 ///
  5130. /// SETV gd2,0 ///
  5131. /// ///
  5132. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  5133. /// When an array is accessed, and the value of an index read, these instructions: ///
  5134. /// ///
  5135. /// int x; ///
  5136. /// int arr[16]; ///
  5137. /// x = arr[2]; ///
  5138. /// ///
  5139. /// ZASM Output: ///
  5140. /// ///
  5141. /// SETV d2,0 : Clear expression axcumulator #1 ///
  5142. /// PUSHR d3 : Push expression accumulator #2 ///
  5143. /// SETR d4,SP : Stack frame pointer to stack pointer. ///
  5144. /// SETR d2,gd1 : Set the value of arr[] to the expression accumulator #1. ///
  5145. /// PUSHR d2 : Push the expression accumulaor #1 ///
  5146. /// SETV d2,2 : Store the index we're reading in the expression accumulator #1 ///
  5147. /// POP d0 : Pop the array index accumulator ///
  5148. /// SETR d1,d2 : Store the expression accumulator #1 into the secondary array index accumulator. ///
  5149. /// SETR d2,GLOBALRAM : Read the array values into the expression accumulator #1 ///
  5150. /// SETR gd2,d2 : Store the value of the inex into x. ///
  5151. /// SETV d3,0 : Clear the secondary expression accumulator. ///
  5152. /// ///
  5153. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  5154. /// When the values in an array are modified, these instructions: ///
  5155. /// ///
  5156. /// arr[2] = 6; ///
  5157. /// ///
  5158. /// ZASM Output: ///
  5159. /// ///
  5160. /// SETV d2,0 : Clear expression accumulator #1 ///
  5161. /// PUSHR d3 : Push expression accumulator #2 ///
  5162. /// SETR d4,SP : Stack frame pointer to stack pointer. ///
  5163. /// SETV d2,6 : Set expression accumulator #1 to a value of 6 ///
  5164. /// SETR d0,gd1 : Prep the array index accumulator with the array stored in gd1 ///
  5165. /// SETR d5,d2 : Sink the value in d2 ///
  5166. /// PUSHR d0 : Push the array index accumulator. ///
  5167. /// SETV d2,2 : Store the index to modify in The expression accumulator #1 ///
  5168. /// POP d0 : Pop off the array index accumulator ///
  5169. /// SETR d1,d2 : Assign the value of the expression accumulator #1 to the ///
  5170. /// : secondary array index accumulator. ///
  5171. /// SETR GLOBALRAM,d5 : Store the value. ///
  5172. /// SETV d3,0 : Clear the expression accumulaTor #2 ///
  5173. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  5174. /// Using these, it would be possible to generate your own array handling routines. ///
  5175. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  5176. /// Global arrays are allocated in the REVERSE order of DECLARATION! ///
  5177. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  5178.  
  5179. // Peek at RAM value in a global address.
  5180.  
  5181. void GetGlobalRAM(int register) ZASM Instruction:
  5182. GLOBALRAMD
  5183. Example Use:
  5184. Game->GetGlobalRAM(10)
  5185. Returns the value in gd10
  5186.  
  5187. /************************************************************************************************************/
  5188.  
  5189. // POKE value into Global address
  5190.  
  5191. void SetGlobalRAM(int register, int value) ZASM Instruction:
  5192. GLOBALRAMD<><>
  5193. Example Use:
  5194. Game->SetGlobalRAM(10,6)
  5195. Sets gd10 to a value of '6'.
  5196.  
  5197. /************************************************************************************************************/
  5198.  
  5199. //Peek at register value of specific script address.
  5200. void GetScriptRAM(int register) ZASM Instruction:
  5201. SCRIPTRAMD<>
  5202. Example Use:
  5203. Game->GetScriptRAM(4)
  5204. Returns the value of Script RAM register 4.
  5205.  
  5206. /************************************************************************************************************/
  5207.  
  5208. //POKE Vakue into Script RAM address
  5209. void SetScriptRAM(int register, int value) ZASM Instruction:
  5210. SCRIPTRAMD<><>
  5211. Example Use:
  5212. Game->SetScriptRAM(4,12)
  5213. Sets script RAM register 4 to a value of '12'
  5214.  
  5215. /************************************************************************************************************/
  5216.  
  5217.  
  5218. ///////////////////////////////////////
  5219. /// Misc ZASM-Specific Instructions ///
  5220. ///////////////////////////////////////
  5221.  
  5222. GOTO<><>
  5223. GOTOTRUE<><>
  5224. GOTOFALSE<><>
  5225. GOTOLESS<><>
  5226. GOTOMORE<><>
  5227. POP<>
  5228. PUSHR<>
  5229. PUSHV<>
  5230. ENQUEUER<><>
  5231. ENQUEUEV<><>
  5232. DEQUEUE<>
  5233. GOTOR<>
  5234. LOADI<><>
  5235. STOREI<><>
  5236. LOOP<><>
  5237. MODR<><>
  5238. MODV<><>
  5239. CHECKTRIG
  5240. COMPOUNDR<>
  5241. COMPOUNDV<>
  5242. FLIPROTTILEVV<><>
  5243. FLIPROTTILERR<><>
  5244. FLIPROTTILERV<><>
  5245. FLIPROTTILEVR<><>
  5246.  
  5247. /* These may not be implemented.
  5248. GETTILEPIXELV<>
  5249. GETTILEPIXELR<>
  5250. SETTILEPIXELV<>
  5251. SETTILEPIXELC<>
  5252.  
  5253. SHIFTTILEVV<><>
  5254. SHIFTTILEVR<><>
  5255. SHIFTTILERR<><>
  5256. SHIFTTILERV<><>
  5257. */
  5258.  
  5259.  
  5260. /* Handles array data allocation.
  5261. ALLOCATEMEMR<><>
  5262. ALLOCATEMEMV<><>
  5263. ALLOCATEMGEMR<><>
  5264. ALLOCATEMGEMV<><>
  5265. */
  5266.  
  5267. /************************************************************************************************************/
  5268.  
  5269. ZASM Register Reservations
  5270.  
  5271. Name Register Use
  5272. SP
  5273. stack pointer
  5274. D4
  5275. stack frame pointer
  5276. D6
  5277. stack frame offset accumulator
  5278. D2
  5279. expression accumulator #1
  5280. D3
  5281. expression accumulator #2
  5282. D0
  5283. array index accumulator
  5284. D1
  5285. secondary array index accumulator
  5286. D5
  5287. pure SETR sink
  5288.  
  5289.  
  5290. //Unimplemented ZASM Instructions
  5291. GETTILEPIXEL
  5292. SETTILEPIXEL
  5293. FLIPROTATETILE
  5294. SHIFTTILE
  5295.  
  5296. //partially Implemented ZASM
  5297.  
  5298. OVERLAYTILE : Supports 8-bit mode tiles only. May support 4-bit only in CSet 0
  5299.  
  5300. ************************************
  5301. Misc ZASM
  5302.  
  5303. LOADI LoadIndirect
  5304. STOREI StoreIndirect
  5305.  
  5306.  
  5307. ////////////////////
  5308. /// Undocumented ///
  5309. ////////////////////
  5310.  
  5311. The following are unsupported, and unfinished ZScript functions.
  5312. * While calling them is not while setting it is not syntactically incorrect, it does nothing.
  5313.  
  5314. void SetColorBuffer( int amount, int offset, ZASM Instruction:
  5315. int stride, int *ptr ) SETCOLORB
  5316.  
  5317. Opcode: OSetColorBufferRegister()
  5318. Example Use:
  5319.  
  5320. /************************************************************************************************************/
  5321.  
  5322. void GetColorBuffer( int amount, int offset, ZASM Instruction:
  5323. int stride, int *ptr ) GETCOLORB
  5324.  
  5325. Opcode: OGetColorBufferRegister();
  5326. Exaple Use:
  5327.  
  5328. /************************************************************************************************************/
  5329.  
  5330. void SetDepthBuffer( int amount, int offset, ZASM Instruction:
  5331. int stride, int *ptr ) SETDEPTHB
  5332.  
  5333. Opcode: OSetDepthBufferRegister();
  5334. Example Use:
  5335.  
  5336. /************************************************************************************************************/
  5337.  
  5338. void GetDepthBuffer( int amount, int offset, ZASM Instruction:
  5339. int stride, int *ptr ) GETDEPTHB
  5340.  
  5341. Opcode: OGetDepthBufferRegister();
  5342. Example use:
  5343.  
  5344. /************************************************************************************************************/
  5345.  
  5346. Undocumented / ZASM Exclusive
  5347.  
  5348. FLOODFILL
  5349.  
  5350. //////////////////////////////////////////////
  5351. /// System Limitations, Minimums, Maximums ///
  5352. //////////////////////////////////////////////
  5353.  
  5354. Maximum numeric literal: 214747.9999
  5355.  
  5356. Ints, Floats, Arrays
  5357.  
  5358. Maximum float: -214747.9999 to 214747.9999
  5359. Maximum int -214747 to 214747
  5360. Maximum array size (number of indices): 214747
  5361.  
  5362. * This further includes arrays with a type of npc, leweapon, eweapon, item, and itemdata.
  5363. Maximum value in an array index: Same as float, or int; based on type declaration.
  5364. Maximum size of string index: 214747
  5365. Maximum string length: 214747
  5366. Maximum simultaneous arrays in operation: 4095
  5367.  
  5368. Counters, Tiles, Combos, Strings
  5369.  
  5370. Maximum Tiles: 65519
  5371. Maximum Combos: 65279
  5372. Maximum Counter Value: 0 to 32767
  5373. Maximum strings in string editor: ( 65519 )
  5374.  
  5375. Largest tile ID (ZQ Editors): 32767 ?
  5376.  
  5377. The largest value that can be referenced in the ZQ item, enemy, and other editors.
  5378.  
  5379. --> I seem to remember a problem calling high values.
  5380.  
  5381. Pointers and Objects
  5382.  
  5383. Maximum number of item pointers (on-screen items) at any one time: 255
  5384. Maximum number of lweapon pointers (on-screen lweapons) at any one time: 255
  5385. Maximum number of eweapon pointers (on-screen eweapons) at any one time: 255
  5386. Maximum number of npc pointers (on-screen NPCs) at any one time: 255
  5387. Maximum number of ffc (on-screen FFCs) pointers at any one time: 32
  5388. Array Pointers (maximum number of arrays in operation): 4095
  5389.  
  5390. Maximum total (cumulative) number of 'object' pointers at any one time: 1020
  5391. * 255 each, npc, lweapon, eweapon, item + 32 (ffcs)
  5392.  
  5393. --> ZC separates pointers by class. All pointers are stored in vectors, with pointer IDs ranging from 1 to 255.
  5394.  
  5395. 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.
  5396.  
  5397. Compiler
  5398.  
  5399. Maximum constants (any scope): Unlimited. (Constants are converted to their true value at compilation, and are not preserved by name.)
  5400. Maximum global variables: 255*
  5401. Maximum global functions: 4,294,967,295 (2^32-1).
  5402. Note that this is limited by the filesystem, as each function requires its ASCII size in bytes,
  5403. and is stored in the quest file. Many filesystems have a file size limit, that restricts it.
  5404. At the smallest function size, max functions would use ~40GB of space.
  5405. It is further restricted by the maximum buffer size at between 18MB and 22MB.
  5406.  
  5407. Script Drawing
  5408.  
  5409. Maximum number of drawing commands per frame: 1000
  5410. Maximum distance (x,y) for drawing, including off-screen areas (and bitmaps): -214747.9999 to 214747.9999 (X and Y)
  5411. Maximum Z Height for 3D Drawing: 214747.9999
  5412.  
  5413. --> Negative Z Height is effectively '0'.
  5414.  
  5415. Stack Operation
  5416.  
  5417. Maximum number of concurrent stacks: ?
  5418. --> Essentially, the maximum number of concurrent scripts; except that item scripts share one stack.
  5419.  
  5420. Maximum variables in operation at any given time: 255* (gd1-gd255)
  5421. Maximum variables per script: 255*
  5422. Maximum function calls per script ( 127* )
  5423. *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
  5424. *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
  5425. --> How are these tabulated at compilation, and is there a strict ratio ( function call:variable ) ?
  5426. --> Script-scope variables use gd registers. Thus, you need to retain free registers for scripts to run.
  5427.  
  5428. Maximum script buffer size: ~18MB, including code imported with the 'import' directive.
  5429. --> Maximum line count is also limited, but it is restricted by being a signed int.
  5430. --> Thus, max line-count is somewhere around 2,147,483,647 lines, however,
  5431. this is still restricted by the 18MB buffer size.
  5432.  
  5433. Maximum number of instructions: 2^32-1 * Max Scripts
  5434. Maximum instructions per script: 4,294,967,295 (2^31 - 1)
  5435. Maximum instructions per frame: Effectively unlimited, save by instructions per script.
  5436.  
  5437. Maximum number of scripts ?
  5438. Max ffc scripts at compilation ?
  5439. Max Item scripts at compilation ?
  5440. Max global scripts at compilation ?
  5441. --> I know this is unlikely to ever be reached.
  5442.  
  5443. Maximum function calls per script: Limited by maximum instructions, and available gd registers.
  5444. Maximum local functions per script: ? Effectively unlimited, and tied to maximum functions (see above).
  5445.  
  5446. Maximum Values (Binary, Hex) for Use as Flags
  5447.  
  5448. The largest literal that you can use as a flag, binary, is: 110100011010111101
  5449. ( dec. 214717, hex 0x346BD )
  5450.  
  5451. The largest true binary value (all ones) is 11111111111111111
  5452. ( dec. 131071, hex 0x1FFFF )
  5453.  
  5454. While these are certainly possible, the largest absolutely useful value, that maximises all places in
  5455. both binary, and hex, and thus is the true flag maximum is: 65535 (decimal).
  5456. This becomes 1111111111111111b, or 0XFFFF, which means that you may use each place to its full potential,
  5457. at all times.
  5458.  
  5459. Thus, the maximum useful flags are a width of 16-bit, and are represented below.
  5460.  
  5461. Max Flag
  5462.  
  5463. Binary Hexadecimal Decimal
  5464. 1111111111111111b 0XFFFF 65535
  5465.  
  5466.  
  5467. //! A list of all known system limitations.
  5468.  
  5469. ################################
  5470. ## COMPILER ERROR DEFINITIONS ##
  5471. ################################
  5472. These errors are generated by the parser, during compilation.
  5473.  
  5474. Error codes are broken down by type:
  5475. P** Preprocessing errors.
  5476. S** Symbol table errors.
  5477. T** Type-checking errors.
  5478. G** Code Generation Errors
  5479. ** Array Errors ---We need to change these to A**
  5480.  
  5481. Errors of each class are given unique numerical identifiers, ranging from 00 to 41, such as P01, or G33.
  5482. The letter code will give you an indication of the type of error, and the full code will give you specific details.
  5483.  
  5484. In ZQuest v2.50.2 and later, the compiler will report name of the script that generated (where possible).
  5485. This applies only to errors caused by scripts, and not errors at a 'global' level, such as global functions.
  5486. Thus, if you are using 2.50.2, or later, an error without a script name is likely to be caused at global scope.
  5487.  
  5488. #####################
  5489. ## Specific Errors ##
  5490. ## Preprocessing ##
  5491. #####################
  5492.  
  5493. P00: Can't open or parse input file!
  5494.  
  5495. Your script file contains illegal characters, or is not plain ASCII Text.
  5496.  
  5497. Otherwise, it is possible that the compiler is unable to write to the disk, that the disk is out of space.
  5498.  
  5499. Last, your file may be bad, such as a file in the qrong encoding format (not ASCII text).
  5500.  
  5501. P01: Failure to parse imported file foo.
  5502.  
  5503. Generally means that you are trying to call a file via the import directive that does not exist; or that
  5504. you have a typo in the filename, or path.
  5505.  
  5506.  
  5507. P02: Recursion limit of x hit while preprocessing.
  5508.  
  5509. Caused by attempting to import a file recursively. For example:
  5510.  
  5511. If you declare: import "script.z" ... and ... the file 'script.z' has the line: ' import "script.z" ' inside it.
  5512.  
  5513. This error should no longer exist! Recursive imports should resolve as duplicate finction/variable/script declarations.
  5514.  
  5515. Error P03: You may only place import statements at file scope.
  5516.  
  5517. Import directives ( import "file.z" ) may only be declared at a global scope, not within
  5518. a function, statement, or script.
  5519.  
  5520. P35: There is already a constant with name 'foo' defined.
  5521. You attempted to define the same constant more than once.
  5522. The identifier (declared name) of all constants MUST be UNIQUE.
  5523.  
  5524.  
  5525. #####################
  5526. ## Specific Errors ##
  5527. ## Symbol Table ##
  5528. #####################
  5529.  
  5530. S04: Function 'foo' was already declared with that type signature.
  5531.  
  5532. You attempted to declare a function with the same parameters twice, int he same scope.
  5533. This can occur when using different types, if the compiler cannot resolve a difference between the signatures.
  5534.  
  5535. To fix this, remove one function,or change its signature (the arguments inside the parens) so that each is unique or;
  5536. If you declare a functiona t a global scope, and the same at a local scope, remove one of the two.
  5537.  
  5538. Note that return type is NOT enough to distinguish otherwise identical function declarations and that 'int' and 'float'
  5539. types are the same type internally, so int/float is identical insofar as the signature is concerned.
  5540.  
  5541. If two function type signatures are identical except that one has a parameter of type float where the other has the
  5542. same parameter of type int, you will have a conflict.
  5543.  
  5544. There are two additional subtle situations where you might get a conflict:
  5545.  
  5546. 1. A function declared at file scope might conflict with a function that's implicitly added to file scope
  5547. by the preprocessor because of an import statement.
  5548. 2. A function might conflict with one already reserved by the ZScript standard library (std.zh).
  5549.  
  5550. S05: Function parameter 'foo' cannot have void type.
  5551.  
  5552. You cannot set a parameter (argument of a function) as a void type. e.g.:
  5553. int foo(void var){ return var+1; }
  5554.  
  5555. This is illegal, and the param 'var' muct be changed to a legal type.
  5556.  
  5557. S06: Duplicate script with name 'foo' already exists.
  5558.  
  5559. Script names must be wholly unique. For example, if there's already an ffc script named 'my_script' you cannot
  5560. declare an item script with the name 'my_script'.
  5561.  
  5562. S07: Variable 'foo' can't have type void.
  5563.  
  5564. Variables at any scope may not have a void type. Only functions may have this type.
  5565.  
  5566. S08: There is already a variable with name 'foo' defined in this scope.
  5567.  
  5568. Variable identifiers must be unique at any given scope. Thus, this is illegal:
  5569.  
  5570. ffc script my_ffc(){
  5571. void run(int x){
  5572. int v = 1;
  5573. int w = 10;
  5574. int x = 0.5;
  5575. int y = 13;
  5576. int z = v+w+x+y;
  5577. Trace(z);
  5578. }
  5579. }
  5580.  
  5581. As the variable 'x' is declared in the params of the run() function, it cannot be declared inside the function with
  5582. the same identifier (name).
  5583.  
  5584.  
  5585. S09: Variable 'foo' is undeclared.
  5586.  
  5587. You attempted to reference a variable identifier (namme) that has not been declared.
  5588. Usually this is due to a typo:
  5589.  
  5590. int var;
  5591. if ( val > 0 ) Link->X += var;
  5592.  
  5593. Here, 'val' will return this error, as it was not declared.
  5594.  
  5595. A variable with the give name could not be found in the current or any enclosing scope. Keep in mind the following subtleties:
  5596. 1. To access a different script's global variables, or to access a global variable from within a function delcared at file scope,
  5597. you must use the dot operator: scriptname.varname.
  5598. 2. To access the data members of the ffc or item associated with a script, you must use the this pointer: this->varname.
  5599. 3. ZScript uses C++-style for loop scoping rules, so variables declared in the header part of the for loop cannot be
  5600. accessed outside the loop:
  5601.  
  5602. Code:
  5603.  
  5604. for(int i=0; i<5;i++);
  5605. i = 2; //NOT legal
  5606.  
  5607. S10: Function 'foo' is undeclared.
  5608.  
  5609. You attempted to call a function that was not declared. This is usually due to either a typo in your code, or failing
  5610. to import a mandatory header. Check that you are importing 'std.zh' as well, as failing to do this will result in a slew
  5611. of this error type.
  5612.  
  5613. S11: Script 'foo' must implement void run().
  5614.  
  5615. Every script must implement run() function call. The signature may be empty, or contain arguments.
  5616. Zelda Classic uses all the code inside the run() function when executing the script, so a script without
  5617. this function would do nothing, and will return an error.
  5618.  
  5619. S12: Script 'foo's' run() must have return type void.
  5620.  
  5621. Is this error even implemented? The run() function is automatic, and never declared by type, unless the user tries to declare
  5622. a separate run(params) function with a different type.
  5623.  
  5624. S26: Pointer types (ffc, etc) cannot be declared as global variables.
  5625.  
  5626. /* It is illegal to declare a global variable (that is, a variable in script scope) or any type other than int, float, and bool.
  5627. Why? Recall that global variables are permanent; they persist from frame to frame, screen to screen.
  5628. Pointer types, on the other hand, reference ffcs or items that are transitory; they become stale after a single WAITFRAME,
  5629. so it makes no sense to try to store them for the long term.
  5630. */
  5631.  
  5632. This explanation may no longer be true, as pointers may no longer be dereferenced by Waitframe(),
  5633. and global pointers may also be implemented in a future version.
  5634.  
  5635.  
  5636. S30: Script foo may have only one run method.
  5637.  
  5638. You may not call a run() function more than once per script.
  5639. Your run method may have any type signature, but because of this flexibility, the compiler cannot
  5640. determine which run script it the "real" entry point of the script if multiple run methods are declared.
  5641.  
  5642. S32: Script foo is of illegal type.
  5643.  
  5644. The only legal script tokens are: global, ffc, and item. You cannot declare other types (such as itemdata script).
  5645.  
  5646. S38: Script-scope global variable declaration syntax is deprecated; put declarations at file scope instead.
  5647. You cannot declare a global variable in a global script, outside the run function.
  5648.  
  5649. Example:
  5650.  
  5651. global script active{
  5652. int x;
  5653. void run(){
  5654. x = 16;
  5655. }
  5656. }
  5657.  
  5658. This is ILLEGAL. The declaration of variable 'x' must either be at a global scope, or at the scope of the
  5659. run function. Do this, instead:
  5660.  
  5661. int x;
  5662. global script active{
  5663. void run(){
  5664. x = 16;
  5665. }
  5666. }
  5667.  
  5668. This creates a global variable at the file scope.
  5669.  
  5670. S39: Array 'foo' can't have type void.
  5671. Arrays may be types of int, float, bool, ffc, item, itemdata, npc, lweapon, or eweapon; but arrays
  5672. with a void type are illegal.
  5673.  
  5674. S40: Pointer types (ffc, etc) cannot be declared as global arrays.
  5675. As of 2.50.2, global array declarations may only have the following types:
  5676. int, float, bool
  5677. Any other type is illegal.
  5678.  
  5679. S41: There is already an array with name 'foo' defined in this scope.
  5680. As with variables, and functions, arrays must have unique identifiers within the same scope.
  5681.  
  5682. ###################
  5683. ## LEXING ERRORS ##
  5684. ###################
  5685. L24: Too many global variables.
  5686.  
  5687. 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.
  5688.  
  5689. #####################
  5690. ## Specific Errors ##
  5691. ## Type Checking ##
  5692. #####################
  5693.  
  5694. T13: Script 'foo' has id that's not an integer.
  5695.  
  5696. /* I do not know what can cause this error, or if it ever occurs. */
  5697.  
  5698. T14: Script 'foo's' id must be between 0 and 255.
  5699.  
  5700. Occurs if you try to load more than 256 scripts of any given type at any given time.
  5701. /* The maximum number of concurrent scripts (of any given type?) is 256. */
  5702.  
  5703. T15: Script 'foo's' id is already in use.
  5704. You attempted to laod two scripts into the same slot.
  5705. /* I do not know if this is EVER possible. */
  5706.  
  5707. T16: Cast from foo to bar.
  5708.  
  5709. The only "safe" implicit casts are from int to float and vice-versa (since they are the same type),
  5710. and from int (or float) to bool (0 becomes false, anything else true).
  5711. The results of any other kind of cast are unspecified.
  5712.  
  5713. /*
  5714. Is this error still in effect? Casting from npc to itemdata, or others, usually results in a different error code.
  5715. Further, Cannot cast from wtf to int, is a thing.
  5716. */
  5717.  
  5718. Explicit casts are unimplemented and unnecessary.
  5719.  
  5720. T17: Cannot cast from foo to bar.
  5721.  
  5722. You attempted to typecast illegally, such as tyring to typecast from bool to float.
  5723.  
  5724. T18: Operand is void.
  5725. Occurs if you try to use a void type value in an operation.
  5726. /* I do not know if this is EVER possible. */
  5727.  
  5728. T19: Constant division by zero.
  5729.  
  5730. While constant-folding, the compiler has detected a division by zero
  5731.  
  5732. Example:
  5733. const int MY_CONSTANT = 0;
  5734. ffc script foo{
  5735. void run(){
  5736. int x = 6;
  5737. Link->Jump = x / MY_CONSTANT;
  5738. }
  5739. }
  5740.  
  5741. Correct the value of your constant. Perhaps you meant to use a variable?
  5742.  
  5743. Note that only division by a CONSTANT zero can be detected at compile time.
  5744. The following code, for instance, compiles with no errors but will generate script errors during execution.
  5745.  
  5746. Example:
  5747.  
  5748. int x = 0;
  5749. int y;
  5750. y = 1/x;
  5751.  
  5752.  
  5753.  
  5754.  
  5755. T20: Truncation of constant x.
  5756.  
  5757. Constants can only be specified to four places of decimal precision, withing the legal range of values.
  5758. Any extra digits are simply ignored by the compiler, which then issues this warning.
  5759.  
  5760. Any values greater than MAX_CONSTANT, or less then MIN_CONSTANT will result in this error.
  5761.  
  5762. ## Applies to variables, but does not throw an error:
  5763. Both floats and ints can only be specified to four places of decimal precision.
  5764. Any extra digits are simply ignored by the compiler, which then issues this warning.
  5765.  
  5766. Any values greater than MAX_VARIABLE, or less then MIN_VARIABLE will result in this error.
  5767.  
  5768. ########
  5769.  
  5770. T21: Could not match type signature 'foo'.
  5771.  
  5772. When calling a function, you used the wrong number, or types, of parameters.
  5773. The compiler can determine no way of casting the parameters of a function call so that they
  5774. match the type signature of a declared function.
  5775.  
  5776. For instance, in the following snippet
  5777. Code:
  5778.  
  5779. int x = Sin(true);
  5780.  
  5781. since true cannot be cast to a float, this function call cannot be matched to the library function Sin, triggering this error.
  5782.  
  5783.  
  5784. T22: Two or more functions match type signature 'foo'.
  5785.  
  5786. If there is ambiguity as to which function declaration a function call should matched to,
  5787. the compiler will attempt to determine the "best fit."
  5788. These measures are however occasionally still not enough. Consider for instance the following snippet:
  5789. Code:
  5790.  
  5791. void foo(int x, bool y) {}
  5792. void foo(bool x, int y) {}
  5793. foo(1,1);
  5794.  
  5795. matching either of the two foo declarations requires one cast, so no match can be made.
  5796. In contrast, the following code has no error:
  5797. Code:
  5798.  
  5799. void foo(int x, bool y) {}
  5800. void foo(bool x, bool y) {}
  5801. foo(1,1);
  5802.  
  5803. (The first foo function is matched.)
  5804.  
  5805. It is best to design functions so that noambiguity is possible, by addign extra params, to change the signature or by using
  5806. different identifiers (function names) when using more params is not desirable.
  5807.  
  5808. T23: This function must return a value.
  5809.  
  5810. All return statements must be followed by an expression if the enclosing function returns a value.
  5811. Note that the compiler does NOT attempt to verify that all executions paths of a function with non-void
  5812. return type actually returns a value; if you fail to return a value, the return value is undefined.
  5813. For instace, the following is a legal (though incorrect) ZScript program:
  5814.  
  5815. int foo() {}
  5816.  
  5817. /* I don't believe anythign ever returns this error.
  5818. I've seen functions with int/float/bool types, and no returns compile, without errors.
  5819. Perhaps we should fix this, and issue a warning during compilation? */
  5820.  
  5821. T25: Constant bitshift by noninteger amount; truncating to nearest integer.
  5822.  
  5823. The bitshift operators (<< and >>) require that their second parameters be whole integers.
  5824.  
  5825. T27: Left of the arrow (->) operator must be a pointer type (ffc, etc).
  5826.  
  5827. It makes no sense to write "x->foo" if x is of type int.
  5828. You may only use the dereference (->) operator on pointer types.
  5829.  
  5830. T28: That pointer type does not have a function 'foo'.
  5831.  
  5832. You tried to use the dereference operator (->) to call a function that does not exist for the pointer type being dereferenced.
  5833. Check the list of member variables and functions and verify you have not mistyped the function you are trying to call.
  5834.  
  5835. This generally occurs when calling internal functions, using the incorrect class, or namespace, such as:
  5836.  
  5837. Game->Rectangle() instead of Screen->Rectangle()
  5838.  
  5839. The extra std.zh component 'shortcuts.zh' assists in preventing this error type.
  5840.  
  5841.  
  5842. T29: That pointer type does not have a variable 'foo'.
  5843.  
  5844. You tried to use the dereference operator (->) to call a member variable that does not exist for the pointer type being dereferenced.
  5845. Check the list of member variables and verify you have not mistyped the variable you are trying to call.
  5846.  
  5847. This generally occurs when calling internal variables, using the incorrect class, or namespace, such as:
  5848.  
  5849. Link->D[] instead of Screen->D[]
  5850.  
  5851. /* The extra std.zh component 'shortcuts.zh' assists in preventing this error type.
  5852. Probaby not, as this requires silly amounts of functions to handle variables with identical identifiers.
  5853. C'est la vie. perhaps we'll do it, but I really am not fond of the idea. */
  5854.  
  5855. As above, but the member variable you tried to access does not exist.
  5856.  
  5857. Error T31: The index of 'foo' must be an integer.
  5858.  
  5859. /* This has been deprecated, so who cares? */
  5860.  
  5861.  
  5862. T36: Cannot change the value of constant variable 'foo'.
  5863.  
  5864. You cannot assign a CONSTANT to another value.
  5865.  
  5866. T37: Global variables can only be initialized to constants or globals declared in the same script.
  5867. You cannot (directly) simultaneously declare, and initialise a global value using the value of a variable at
  5868. the scope of another script, or function.
  5869.  
  5870. Example:
  5871. int x = script.a;
  5872. ffc script foo{
  5873. int a = 6;
  5874. void run(){
  5875. for ( int q = 9; q < Rand(15); q++ ) a++;
  5876. }
  5877. }
  5878.  
  5879. This is ILLEGAL. You cannot initialise the value of the global variable 'x' using the local value
  5880. of 'a' in the ffc script 'foo'.
  5881.  
  5882. /* I believe this is deprecated, as I do not believe that script level declarations remain legal */
  5883.  
  5884. T45 (old version, T38): Arrays can only be initialized to numerical values
  5885. You attempted to declare an array using a floating point value (e.g. 10.5), constant or equation,
  5886. rather than a numeric literal.
  5887.  
  5888.  
  5889. Consider that you want to declare an array with an explicit size of '40':
  5890. These are ILLEGAL:
  5891. int my_arr[26+14];
  5892. const int CONSTANT = 30;
  5893. int my_arr[CONSTANT];
  5894. int my_arr[CONSTANT/2+20]
  5895.  
  5896. YOu must declare an arrray with a numeric literal:
  5897. int my_array[40];
  5898. This is the only legal way to declare the size of an array as of 2.50.2.
  5899.  
  5900.  
  5901. #####################
  5902. ## Specific Errors ##
  5903. ## @Generation ##
  5904. #####################
  5905.  
  5906.  
  5907. G33: Break must lie inside of an enclosing for or while loop.
  5908.  
  5909. The 'break' keyword aborts the loop (in a for, while, or do statement) in which it is called.
  5910. You must be in a loop to break out of one, so calling 'break' outside of a loop is illegal.
  5911.  
  5912.  
  5913. G34: Continue must lie inside of an enclosing for or while loop.
  5914.  
  5915. 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.
  5916. You must be in a loop to continue one, so calling 'continue' outside of a loop is illegal.
  5917.  
  5918. As the above error, but with the continue keyword. Continue aborts the current iteration of the loop and skips to the next iteration.
  5919.  
  5920.  
  5921. ##################
  5922. ## Array Errors ##
  5923. ##################
  5924.  
  5925. Error A42 (old, Error O1): Array is too small. ( Converting to A42 in 2.50.3 )
  5926. You attempted to declare an array, with a set of values, where the number of values in the set
  5927. exceeds an explicit array size declaration:
  5928.  
  5929. int foo[4]={1,2,3,4,5};
  5930. The declared size is '4', but you tried to initialise it with five elements.
  5931.  
  5932. /* THis doesn't seem right, as this seems to be covered by Err 02. Check the source to see what causes this. */
  5933.  
  5934. Error O2: Array initializer larger than specified dimensions. ( Converting to A43 in 2.50.3)
  5935. You attempted to initialise an array, with a set of values, where the number of values in the set
  5936. exceeds an explicit array size declaration:
  5937.  
  5938. int foo[4]={1,2,3,4,5};
  5939. The declared size is '4', but you tried to initialise it with five elements.
  5940.  
  5941. Error O3: String array initializer larger than specified dimensions, space must be allocated for NULL terminator.
  5942. ( Convering to A44 in 2.50.3 )
  5943. YOu attempted to seclare a QUOTEDSTRING of an explicit size, but you didn;t add space
  5944. for the NULL terminator; or you used more chars than you allocated:
  5945.  
  5946. int my_string[17]="This is a string.";
  5947. THis allocates only enough indices for the chars, but not for the NULL terminator.
  5948. The array size here needs to be 18.
  5949. int my_string[12]="THis is a string.";
  5950. You tried to initialise a QUOTEDSTRING that is longer than the array size.
  5951. The minimum array size for this is '18'.
  5952.  
  5953. It is generally best either to declare strings with an implicit size (set by the initialiser):
  5954. int my_string[]="This is a string";
  5955. This reads the nuber of chars, adds one to the count (for NULL), and sizes the array to 18.
  5956. ...or...
  5957. Declare the string with an arbitrarily large size:
  5958. int my_string[256]="This is a string";
  5959. This reserves 256 chars. Only 18 are used, and the rest of the indices
  5960. are initialised as '0' (NULL). YOu may later populate the unused space, if desired.
  5961.  
  5962.  
  5963. #################
  5964. ## Misc Errors ##
  5965. #################
  5966.  
  5967. FATAL FATAL ERROR I0: bad internal error code
  5968. A fallback error if no other type matches the problem.
  5969.  
  5970. /* I have no idea what causes this. Be afraid, very afraid. */
  5971.  
  5972. /* OTHER ERRORS
  5973. Document any further error codes here.
  5974. We need to convert the array errors from raw numeric, to A** codes.
  5975. */
  5976.  
  5977. ########################
  5978. ## OPERATIONAL ERRORS ##
  5979. ###################################################################################################
  5980. ## These errors occur only during the operation of script execution (i.e. when running a script, ##
  5981. ## in Zelda Classic while playing a quest). ##
  5982. ## --------------------------------------------------------------------------------------------- ##
  5983. ## In ZC versions 2.50.2, and later, operational script errors will return the ID of the script ##
  5984. ## from which they were generated. ##
  5985. ###################################################################################################
  5986.  
  5987. //! These errors will be reported to allegro.log (or the ZConsole) when scripts run.
  5988.  
  5989.  
  5990.  
  5991. ////////////////////
  5992. /// Stack Errors ///
  5993. ////////////////////
  5994.  
  5995. "Stack over or underflow, stack pointer = %ld\n"
  5996.  
  5997. * !? How should I describe this, and give examples?
  5998.  
  5999. "Invalid ZASM command %ld reached\n"
  6000.  
  6001. Stack instruction countber reached, or exceeded. The stack counter is an unsigned int, so it's maximum value is 65536.
  6002. You have isused more instructiosn this frame than the instructon counter can ahndle. Look through your code for
  6003. something that may be doing this.
  6004.  
  6005. ////////////////////
  6006. /// Array Errors ///
  6007. ////////////////////
  6008.  
  6009. "Invalid value (%i) passed to '%s'\n"
  6010. "Invalid index (%ld) to local array of size %ld\n"
  6011.  
  6012. You attempted to reference an array index that is either too small, or too large.
  6013. Check the size of your array, and try again.
  6014. Perhaps you have a for loop, or other loop that is parsing the array, and trying to read beyond its index ranges.
  6015.  
  6016.  
  6017. "Invalid pointer (%i) passed to array (don't change the values of your array pointers)\n"
  6018.  
  6019. Array pointers values in operation are 1 through 4095, ( and 4096 to 8164? as declared global pointers ?).
  6020. An array may not have a pointer of '0', nor may you reference an array for which a pointer does not exist.
  6021. Often, this error is caused by attempting to reference an array that you created, without updating the saved game slot
  6022. as the old save does not have the array allocated, but the script is attempting to reference its global ID.
  6023.  
  6024. "Script tried to deallocate memory at invalid address %ld\n"
  6025. "Script tried to deallocate memory that was not allocated at address %ld\n"
  6026.  
  6027. /* Script attempted to change the value of an array index // that does not exist // due to the inability to declare an array
  6028. because too many registers are in use?
  6029.  
  6030.  
  6031. "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"
  6032. You attempted to read, or write to a Screen->D[register] that was less than 1, or greater than 10.
  6033. Check for loops, and vriables that read/write to Screen->D for any that can fall outside the legal range.
  6034.  
  6035. "Array initialized to invalid size of %d\n"
  6036. You attempted to init array to a size less than 1, or a size greater than 214747, or;
  6037. You attempted to init array with a constant, a variable, a formula, or with a floating point value.
  6038. Arrays may ONLY be initialised with numeric literals (integers only) between 1 and 214747.
  6039.  
  6040. "%d local arrays already in use, no more can be allocated\n", MAX_ZCARRAY_SIZE-1);
  6041. The maximum number of arrays in operation at one time is 4095.
  6042.  
  6043. "Invalid pointer value of %ld passed to global allocate\n"
  6044. !
  6045.  
  6046. /////////////////////////////
  6047. /// Object Pointer Errors ///
  6048. /////////////////////////////
  6049.  
  6050. "Invalid NPC with UID %ld passed to %s\nNPCs on screen have UIDs "
  6051. "Invalid item with UID %ld passed to %s\nItems on screen have UIDs "
  6052. "Invalid lweapon with UID %ld passed to %s\nLWeapons on screen have UIDs "
  6053. "Invalid eweapon with UID %ld passed to %s\nEWeapons on screen have UIDs "
  6054.  
  6055. "Script attempted to reference a nonexistent NPC!\n"
  6056. "You were trying to reference the %s of an NPC with UID = %ld; NPC on screen are UIDs "
  6057.  
  6058. "Script attempted to reference a nonexistent item!\n"
  6059. "You were trying to reference an item with UID = %ld; Items on screen are UIDs: "
  6060.  
  6061. "Script attempted to reference a nonexistent LWeapon!\n"
  6062. "You were trying to reference the %s of an LWeapon with UID = %ld; LWeapons on screen are UIDs "
  6063.  
  6064. "Script attempted to reference a nonexistent EWeapon!\n"
  6065. "You were trying to reference the %s of an EWeapon with UID = %ld; EWeapons on screen are UIDs "
  6066.  
  6067. You attempted to reference a game object that has a maximum legal range of 1 to 255.
  6068. It is possible that you tried to read outside that range, or that the pointer that you were loading is not valid.
  6069. Check NumItems(), NumLWeapons(), NumEWeapons(0, and NumNPCs() before referencing them; and verify that the object ->IsValid()
  6070. Check for loops that may attempt ro reference items outside of the range that actually exist.
  6071. Look for any for loops that access these objects, that start, or end at zero.
  6072.  
  6073. The best way to ensure this does not occur, is to make a for loop as follows:
  6074.  
  6075. for ( int q = 1; q < Screen->NumLWeapons; q++ )
  6076.  
  6077. //or//
  6078.  
  6079. for ( int q = Screen->NumLWeapons(); q > 0; q-- )
  6080.  
  6081. ...replacing NumLWeapons() withthe appropriate type that you are attempting to load.
  6082.  
  6083. You may be attempting to refrence a pointer that has fallen out of scope.
  6084. You may be attempting to reference a pointer that is no longer valid, or has been removed.
  6085. Check ( pinter->IsValid() ) by itself, to ensure this does not occur:
  6086.  
  6087. if ( pointer->IsValid ) {
  6088. if ( pointer->ID == LW_FIRE ) //Do things.
  6089. }
  6090.  
  6091. This helps to prevent loading invalid pointers.
  6092.  
  6093. ////////////////////////////////
  6094. /// Maths and Logical Errors ///
  6095. ////////////////////////////////
  6096.  
  6097. "Script attempted to divide %ld by zero!\n"
  6098. "Script attempted to modulo %ld by zero!\n"
  6099.  
  6100. "Script attempted to pass %ld into ArcSin!\n"
  6101. "Script attempted to pass %ld into ArcCos!\n"
  6102. "Script tried to calculate log of 0\n"
  6103. "Script tried to calculate log of %f\n"
  6104. "Script tried to calculate ln of 0\n"
  6105. "Script tried to calculate ln of %f\n"
  6106. "Script attempted to calculate 0 to the power 0!\n"
  6107. "Script attempted to calculate square root of %ld!\n"
  6108.  
  6109. Look for scripts that pass a variable into these functions, or use a variable in a mathematical operation, that
  6110. 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
  6111. mathematical operation you wish to perform.
  6112.  
  6113. Chweck for any hardcoded values, or constants that are in use with these functions that may be illegal, or irrational.
  6114.  
  6115. ////////////////////////////////
  6116. /// System Limitation Errors ///
  6117. ////////////////////////////////
  6118.  
  6119. "Couldn't create lweapon %ld, screen lweapon limit reached\n"
  6120. "Couldn't create eweapon %ld, screen eweapon limit reached\n"
  6121. "Couldn't create item \"%s\", screen item limit reached\n"
  6122. "Couldn't create NPC \"%s\", screen NPC limit reached\n"
  6123.  
  6124. You may create a maximum of 255 of any one object type on the screen at any one time.
  6125. Look for anything that is generating extra pointers, and add a statement such as:
  6126. if ( Screen->NumNPCs() < 255 )
  6127.  
  6128. "Max draw primitive limit reached\n"
  6129. The maximum number of drawing function calls, per frame, is 1,000.
  6130.  
  6131. /////////////////////
  6132. /// String Errors ///
  6133. /////////////////////
  6134.  
  6135. "Array supplied to 'Game->GetDMapMusicFilename' not large enough\n"
  6136. "Array supplied to 'Game->GetSaveName' not large enough\n"
  6137. "String supplied to 'Game->GetSaveName' too large\n"
  6138. "Array supplied to 'Game->GetMessage' not large enough\n"
  6139. "Array supplied to 'Game->GetDMapName' not large enough\n"
  6140. "Array supplied to 'Game->GetDMapTitle' not large enough\n"
  6141. "Array supplied to 'Game->GetDMapIntro' not large enough\n"
  6142. "Array supplied to 'itemdata->GetName' not large enough\n"
  6143. "Array supplied to 'npc->GetName' not large enough\n"
  6144.  
  6145. The buffer for these actions must be equal to the size of the text to load into it, plus one, for NULL.
  6146.  
  6147. If you wish to load a game name, with Game->LoadSaveName(), and the name on the file select is FOO, you must
  6148. supply a buffer with a size of [4] to hold it. (Three chars in the name, plus one for NULL.)
  6149.  
  6150. ////////////////////
  6151. /// Misc. Errors ///
  6152. ////////////////////
  6153.  
  6154. "Waitdraw can only be used in the active global script\n"
  6155. You attempted to call Waitdrw() in an ffc script, or an item script; or in your global OnContinue,
  6156. global OnExit, or ~Init scripts.
  6157. You may only use the Waitdraw() function from a global active script.
  6158.  
  6159. "No other scripts are currently supported\n"
  6160. ? You should never see this. May indicate that you have attempted to load more scripts than ZC can handle.
  6161.  
  6162.  
  6163. "Invalid value (%i) passed to '%s'\n"
  6164. !? WHat should we put here?
  6165.  
  6166. "Global scripts currently have no A registers\n"
  6167. This error can only occur if you are coding ZASM, and attempt to utilise an Address register with a global script.
  6168.  
  6169. ////////////////////////
  6170. /// Script Reporting ///
  6171. ////////////////////////
  6172.  
  6173. //Events that will be recorded if Quest Rule 'Log Game Events to Allegro.log' is enabled:
  6174.  
  6175. "Script created lweapon %ld with UID = %ld\n"
  6176. "Script created eweapon %ld with UID = %ld\n"
  6177. "Script created item \"%s\" with UID = %ld\n"
  6178. "Script created NPC \"%s\" with UID = %ld\n"
  6179.  
  6180. When any new game object is generated by script, and reporting is enabled, the lweapon, and the name of the
  6181. script that generated it, will be reported to allegro.log.
  6182.  
  6183.  
  6184. ///////////////////////////
  6185. /// Documentation Staff ///
  6186. ///////////////////////////
  6187.  
  6188. ZScript documentation generated, and maintained by:
  6189. DarkDragon (retired)
  6190. Gleeok
  6191. Saffith
  6192. ZoriaRPG
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×