Note: In the following, int indicates that a parameter is truncated
by a function to an integer, or that the return value will always
be an integer. ZScript itself makes no distinction between int and
float.


========================
--- Global Functions ---
========================

int Rand(int maxvalue)
 * Computes and returns a random integer i such that 0 <= i < maxvalue.
 * The return value is undefined if maxvalue is 0 or negative.

void Quit()
 * Terminates execution of the current script. Does not return.

void Waitframe()
 * Temporarily halts execution of the current script. This function
 * returns at the beginning of the next frame of gameplay. Global
 * scripts and item pickup scripts only execute for one frame, so in
 * those scripts Waitframe() is essentially Quit().

void Trace(float val)
 * Prints a line containing a string representation of val to
 * allegro.log. Useful for debugging scripts.

float Sin(int deg)
 * Returns the trigonometric sine of the parameter, which is interpreted
 * as a degree value.

float Cos(int deg)
 * Returns the trigonometric cosine of the parameter, which is
 * interpreted as a degree value.

float Tan(int deg)
 * Returns the trigonometric tangent of the parameter, which is
 * interpreted as a degree value. The return value is undefined if
 * deg is of the form 90 + 180n for an integral value of n.

float RadianSin(float rad)
 * Returns the trigonometric sine of the parameter, which is interpreted
 * as a radian value.

float RadianCos(float rad)
 * Returns the trigonometric cosine of the parameter, which is
 * interpreted as a radian value.

float RadianTan(float rad)
 * Returns the trigonometric tangent of the parameter, which is
 * interpreted as a radian value. The return value is undefined for
 * values of rad near (pi/2) + n*pi, for n an integer.

float ArcTan(int x, int y)
 * Returns the trigonometric arctangent of the coordinates, which is
 * interpreted as a radian value.

float Max(float a, float b)
 * Returns the greater of a and b.

float Min(float a, float b)
 * Returns the lesser of a and b.

int Pow(int base, int exp)
 * Returns base^exp. The return value is undefined for base=exp=0. Note
 * also negative values of exp may not be useful, as the return value is
 * truncated to the nearest integer.

int InvPow(int base, int exp)
 * Returns base^(1/exp). The return value is undefined for exp=0, or
 * if exp is even and base is negative. Note also that negative values
 * of exp may not be useful, as the return value is truncated to the
 * nearest integer.

float Log10(float val)
 * Returns the log of val to the base 10. Any value <= 0 will return 0.

float Ln(float val)
 * Returns the natural logarithm of val (to the base e). Any value <= 0 will return 0.

int Factorial(int val)
 * Returns val!. The return value is undefined for val <= 0 (despite the
 * convention 0! = 1.)

float Abs(float val)
 * Return the absolute value of the parameter, if possible. If the
 * absolute value would overflow the parameter, the return value is
 * undefined.

float Sqrt(float val)
 * Computes the square root of the parameter. The return value is
 * undefined for val < 0.

void CopyTile(int srctile, int desttile)
 * Copies the tile specified by scrtile onto the tile space
 * specified by desttile.

void SwapTile(int firsttile, int secondtile)
 * Swaps the two tiles specified by firsttile and secondtile.

void ClearTile(int tileref)
 * Erases the tile specified by tileref.


===================================
--- FFC Functions and Variables ---
===================================

int Data
 * The number of the combo associated with this FFC.

int CSet
 * The cset of the FFC.

int Delay
 * The FFC's animation delay, in frames.

float X
 * The FFC's X position on the screen.

float Y
 * The FFC's Y position on the screen.

float Vx
 * The FFC's velocity's X-component.

float Vy
 * The FFC's velocity's Y-component.

float Ax
 * The FFC's acceleration's X-component.

float Ay
 * The FFC's acceleration's Y-component.

bool WasTriggered()
 * Returns true if and only if the FFC was triggered by a secret.

bool Flags[]
 * The FFC's set of flags. Use the FFCF_ constants in std.zh as the
 * index to access a particular flag.

int TileWidth
 * The number of tile columns composing the FFC.

int TileHeight
 * The number of tile rows composing the FFC.

int EffectWidth
 * The width of the area of effect of the combo associated with the FFC,
 * in pixels.

int EffectHeight
 * The height of the area of effect of the combo associated with the FFC,
 * in pixels.

int Link
 * The number of the FFC linked to by this FFC.

float Misc[]
 * An array of 8 miscellaneous variables for you to use as your please.
 * These variables are not saved with the ffc.


====================================
--- Link Functions and Variables ---
====================================

int X
 * Link's X position on the screen, in pixels.

int Y
 * Link's Y position on the screen, in pixels.

int Z
 * Link's Z position on the screen, in pixels.

int Jump
 * Link's upward velocity, in pixels. If negative, Link will fall.
 * The downward acceleration of Gravity (in Init Data) modifies this value every frame.

int SwordJinx
 * The time, in frames, until Link regains use of his sword. -1 signifies
 * a permanent loss of the sword.

int ItemJinx
 * The time, in frames, until Link regains use of his items. -1 signifies
 * a permanent loss of his items.

int Drunk
 * The time, in frames, that Link will be 'drunk'. If positive, the player's
 * controls are randomly interfered with, causing Link to move erratically.
 * This value is decremented once per frame. As the value of Drunk approaches 0,
 * the intensity of the effect decreases.

int Dir
 * The direction Link is facing. Use the DIR_ constants in std.zh to set
 * or compare this variable. Note: even though Link can move diagonally if the
 * quest allows it, his sprite doesn't ever use any of the diagonal directions,
 * which are intended for enemies only.
 * The effects of writing to this variable are undefined.

int HP
 * Link's current hitpoints, in 16ths of a heart.

int MP
 * Link's current amount of magic, in 32nds of a magic block.

int MaxHP
 * Link's maximum hitpoints, in 16ths of a heart.

int MaxMP
 * Link's maximum amount of magic, in 32nds of a magic block.

int Action
 * Link's current action. Use the LA_ constants in std.zh to set or
 * compare this value. The effect of writing to this field is currently
 * undefined.

int HeldItem
 * The item that Link is currently holding up; reading or setting this
 * field is undefined if Link's action is not current a hold action.
 * Use the IT_ constants in std.zh to specify the item, or -1 to show
 * no item. Setting HeldItem to values other than -1 or a valid item
 * ID is undefined.

void Warp(int DMap, int screen)
 * Warps link to the given screen in the given DMap, just like if he'd
 * triggered an 'Insta-Warp'-type warp.

void PitWarp(int DMap, int screen)
 * This is identical to Warp, but Link's X and Y positions are preserved
 * when he enters the destination screen, rather than being set to the
 * Warp Return square.

bool InputStart
 * True if the player is pressing the start button. Writing to this
 * variable simulates the press or release of the start button.

bool InputMap
 * True if the player is pressing the map button. Writing to this
 * variable simulates the press or release of the map button.

bool InputUp
 * True if the player is pressing the up arrow. Writing to this variable
 * simulates the press or release of the up arrow.

bool InputDown
 * True if the player is pressing the down arrow. Writing to this
 * variable simulates the press or release of the down arrow.

bool InputLeft
 * True if the player is pressing the left arrow. Writing to this
 * variable simulates the press or release of the left arrow.

bool InputRight
 * True if the player is pressing the right arrow. Writing to this
 * variable simulates the press or release of the right arrow.

bool InputA
 * True if the player is pressing the A key. Writing to this variable
 * simulates the press or release of the A key.

bool InputB
 * True if the player is pressing the B key. Writing to this variable
 * simulates the press or release of the B key.

bool InputL
 * True if the player is pressing the L key. Writing to this variable
 * simulates the press or release of the L key.

bool InputR
 * True if the player is pressing the R key. Writing to this variable
 * simulates the press or release of the R key.

int InputMouseX
 * The mouse's in-game X position. This value is read-only, and undefined if
 * the mouse pointer is outside the Zelda Classic window.

int InputMouseY
 * The mouse's in-game Y position. This value is read-only, and undefined if
 * the mouse pointer is outside the Zelda Classic window.

bool Item[]
 * True if Link's inventory contains the item whose ID is the index of
 * the array access. Use the IT_ constants in std.zh as an index into
 * this array.

int TileWidth
 * The number of tile columns composing the sprite. Writing to this is ignored unless Extend is set to values >=3.

int TileHeight
 * The number of tile rows composing the sprite. Writing to this is ignored unless Extend is set to values >=3.

int HitWidth
 * The width of Link's hitbox, or collision rectangle. Writing to this is ignored unless Extend is set to values >=3.

int HitHeight
 * The height of Link's hitbox, or collision rectangle. Writing to this is ignored unless Extend is set to values >=3.

int HitZHeight
 * The Z-axis height of Link's hitbox, or collision rectangle. The lower it is, the lower a flying or jumping enemy must fly in order to hit Link. Writing to this is ignored unless Extend is set to values >=3.

int HitXOffset
 * The X offset of Link's hitbox, or collision rectangle. Setting it to positive or negative values will move Link's hitbox left or right. Writing to this is ignored unless Extend is set to values >=3.

int HitYOffset
 * The Y offset of Link's hitbox, or collision rectangle. Setting it to positive or negative values will move Link's hitbox up or down. Writing to this is ignored unless Extend is set to values >=3.

int DrawXOffset
 * The X offset of Link's sprite. Setting it to positive or negative values will move the sprite's tiles left or right relative to its position. Writing to this is ignored unless Extend is set to values >=3.

int DrawYOffset
 * The Y offset of Link's sprite. Setting it to positive or negative values will move the sprite's tiles up or down relative to its position. Writing to this is ignored unless Extend is set to values >=3.

int DrawZOffset
 * The Z offset of Link's sprite. Writing to this is ignored unless Extend is set to values >=3.

======================================
--- Screen Functions and Variables ---
======================================

float D[]
 * Each screen has 8 general purpose registers for use by script
 * programmers. These values are recorded in the save file when the
 * player saves their game. Do with these as you will.
 * Note that these registers are tied to screen/DMap combinations.
 * Encountering the same screen in a different DMap will result in a
 * different D[] array.

int ComboD[]
 * The combo ID of the ith combo on the screen, where i is the index
 * used to access this array. Combos are counted left to right, top to
 * bottom.

int ComboC[]
 * The CSet of the tile used by the ith combo on the screen, where i is
 * the index used to access this array. Combos are counted left to right,
 * top to bottom.

int ComboF[]
 * The secret flag of the ith combo on the screen, where i is the index
 * used to access this array. Combos are counted left to right, top to
 * bottom. Use the CF_ constants in std.zh to set or compare these values.

int ComboI[]
 * The inherent flag of the ith combo on the screen, where i is the index
 * used to access this array. Combos are counted left to right, top to
 * bottom. Use the CF_ constants in std.zh to set or compare these values.

int ComboT[]
 * The combo type of the ith combo on the screen, where i is the index
 * used to access this array. Combos are counted left to right, top to
 * bottom. Use the CT_ constants in std.zh to set or compare these values.

int ComboS[]
 * The walkability mask of the ith combo on the screen, where i is the
 * index used to access this array. Combos are counted left to right, top
 * to bottom. The least signficant bit is true if the top-left of the combo
 * is solid, the second-least signficant bit is true if the bottom-left
 * of the combo is is solid, the third-least significant bit is true if the
 * top-right of the combo is solid, and the fourth-least significant bit is
 * true if the bottom-right of the combo is solid.

bool State[]
 * An array of miscellaneous status data associated with the current screen.
 * Screen states involve such things as permanent screen secrets, the status of
 * lock blocks and treasure chest combos, and whether items have been collected.
 * These values are recorded in the save file when the player saves their game.
 * Use the ST_ constants in std.zh as indices into this array.

int LayerMap(int num)
 * Returns the map used by layer 'num'.
 * Values of 'num' less than 1 or greater than 6, or layers that are not set up return -1.

int LayerScreen(int num)
 * Returns the screen used by layer 'num'.
 * Values of 'num' less than 1 or greater than 6, or layers that are not set up return -1.

int Door[]
 * The door type for each of the four doors on a screen. Doors are counted
 * using the first four DIR_ constants in std.zh. Use the D_ constants in
 * std.zh to compare these values.

bool Lit
 * Whether or not the screen is lit. Setting this variable will change the
 * lighting setting of the screen until you change screens.

int Wavy
 * The time, in frames, that the 'wave' screen effect will be in effect.
 * This value is decremented once per frame. As the value of Wavy approaches 0,
 * the intensity of the waves decreases.

int Quake
 * The time, in frames, that the screen will shake. This value is decremented
 * once per frame. As the value of Quake approaches 0, the intensity of the
 * screen shaking decreases.

int NumItems()
 * Returns the number of items currently present on the screen. Screen
 * items, shop items, and items dropped by enemies are counted; Link's
 * weapons, such as lit bombs, or enemy weapons are not counted.
 * Note that this value is only correct up until the next call to
 * Waitframe().

item LoadItem(int num)
 * Returns a pointer to the numth item on the current screen. The return
 * value is undefined unless 1 <= num <= NumItems().

item CreateItem(int id)
 * Creates an item of the given type at (0,0). Use the IT_ constants in
 * std.zh to pass into this method. The return value is a pointer to the
 * new item.

ffc LoadFFC(int num)
 * Returns a pointer to the numth FFC on the current screen. The return
 * value is undefined unless 1 <= num <= ffcs, where ffcs is the number
 * of FFCs active on the screen.

int NumNPCs()
 * Returns the number of NPCs (enemies and guys) on the screen.
 * Note that this value is only correct up until the next call to
 * Waitframe().

npc LoadNPC(int num)
 * Returns a pointer to the numth NPC on the current screen. The return
 * value is undefined unless 1 <= num <= NumNPCs().

npc CreateNPC(int id)
 * Creates an npc of the given type at (0,0). Use the NPC_ constants in
 * std.zh to pass into this method. The return value is a pointer to the
 * new NPC.

int NumLWeapons()
 * Returns the number of Link weapon projectiles currently present on the screen.
 * This includes things like Link's arrows, bombs, magic, etc. Note that this
 * value is only correct up until the next call of Waitframe()

lweapon LoadLWeapon(int num)
 * Returns a pointer to the numth lweapon on the current screen. The return
 * value is undefined unless 1 <= num <= NumLWeapons().

lweapon CreateLWeapon(int type)
 * Creates an lweapon of the given type at (0,0). Use the LW_ constants in
 * std.zh to pass into this method. The return value is a pointer to the
 * new lweapon.

int NumEWeapons()
 * Returns the number of Enemy weapon projectiles currently present on the screen.
 * This includes things like Enemy arrows, bombs, magic, etc. Note that this
 * value is only correct up until the next call of Waitframe()

eweapon LoadEWeapon(int num)
 * Returns a pointer to the numth eweapon on the current screen. The return
 * value is undefined unless 1 <= num <= NumEWeapons().

eweapon CreateEWeapon(int type)
 * Creates an eweapon of the given type at (0,0). Use the EW_ constants in
 * std.zh to pass into this method. The return value is a pointer to the
 * new lweapon.

bool isSolid(int x, int y)
 * Returns true if the screen position (x, y) is solid - that is, if it
 * is within the solid portion of a combo on layers 0, 1 or 2. If either
 * x or y exceed the screen's bounds, then it will return false.
 * It will also return false if the only applicable solid combo is a solid
 * water combo that has recently been 'dried' by the whistle.

void ClearSprites(int spritelist)
 * Clears all of a certain kind of sprite from the screen. Use the SL_
 * constants in std.zh to pass into this method.

void Rectangle(int layer, int x, int y, int x2, int y2, int color,
               float scale, int rx, int ry, int rangle, bool fill,
		   int opacity)
 * Draws a rectangle on the specified layer of the current screen, using
 * (x,y) as the top-left corner and (x2,y2) as the bottom-right corner.
 * Then scales the rectangle uniformly about its center by the given
 * factor.
 * Lastly, a rotation, centered about the point (rx, ry), is performed
 * counterclockwise using an angle of rangle degrees.
 * A filled rectangle is drawn if fill is true; otherwise, this method
 * draws a wireframe.
 * The rectangle is drawn using the specified index into the entire
 * 256-element palette: for instance, passing in a color of 17 would
 * use color 1 of cset 1.
 * Opacity controls how transparent the rectangle will be. Values other
 * than 128 (solid) and 64 (translucent) are currently undefined.

void Circle(int layer, int x, int y, int radius, int color,
               float scale, int rx, int ry, int rangle, bool fill,
		   int opacity)
 * Draws a circle on the specified layer of the current screen with
 * center (x,y) and radius scale*radius.
 * Then performs a rotation counterclockwise, centered about the point
 * (rx, ry), using an angle of rangle degrees.
 * A filled circle is drawn if fill is true; otherwise, this method
 * draws a wireframe.
 * The circle is drawn using the specified index into the entire
 * 256-element palette: for instance, passing in a color of 17 would
 * use color 1 of cset 1.
 * Opacity controls how transparent the circle will be. Values other
 * than 128 (solid) and 64 (translucent) are currently undefined.

void Arc(int layer, int x, int y, int radius, int startangle,
		   int endangle, int color, float scale, int rx, int ry,
		   int rangle, bool closed, bool fill, int opacity)
 * Draws an arc of a circle on the specified layer of the current
 * screen. The circle in question has center (x,y) and radius
 * scale*radius.
 * The arc beings at startangle degrees counterclockwise from standard
 * position, and ends at endangle degress counterclockwise from standard
 * position. The behavior of this function is undefined unless
 * 0 <= endangle-startangle < 360.
 * The arc is then rotated about the point (rx, ry) using an angle of
 * rangle radians.
 * If closed is true, a line is drawn from the center of the circle to
 * each endpoint of the arc, forming a sector of the circle. If fill
 * is also true, a filled sector is drawn instead.
 * The arc or sector is drawn using the specified index into the entire
 * 256-element palette: for instance, passing in a color of 17 would
 * use color 1 of cset 1.
 * Opacity controls how transparent the arc will be. Values other
 * than 128 (solid) and 64 (translucent) are currently undefined.

void Ellipse(int layer, int x, int y, int xradius, int yradius,
		   int color, float scale, int rx, int ry, int rangle,
		   bool fill, int opacity)
 * Draws an ellipse on the specified layer of the current screen with
 * center (x,y), x-axis radius xradius, and y-axis radius yradius.
 * Then performs a rotation counterclockwise, centered about the point
 * (rx, ry), using an angle of rangle degrees.
 * A filled ellipse is drawn if fill is true; otherwise, this method
 * draws a wireframe.
 * The ellipse is drawn using the specified index into the entire
 * 256-element palette: for instance, passing in a color of 17 would
 * use color 1 of cset 1.
 * Opacity controls how transparent the ellipse will be. Values other
 * than 128 (solid) and 64 (translucent) are currently undefined.

void Line(int layer, int x, int y, int x2, int y2, int color, float scale,
			   int rx, int ry, int rangle, int opacity)
 * Draws a line on the specified layer of the current screen between
 * (x,y) and (x2,y2).
 * Then scales the line uniformly by a factor of scale about the line's
 * midpoint.
 * Finally, performs a rotation counterclockwise, centered about the
 * point (rx, ry), using an angle of rangle degrees.
 * The line is drawn using the specified index into the entire
 * 256-element palette: for instance, passing in a color of 17 would
 * use color 1 of cset 1.
 * Opacity controls how transparent the line will be. Values other
 * than 128 (solid) and 64 (translucent) are currently undefined.

void PutPixel(int layer, int x, int y, int color, int rx, int ry,
			   int rangle, int opacity)
 * Draws a raw pixel on the specified layer of the current screen
 * at (x,y).
 * Then performs a rotation counterclockwise, centered about the point
 * (rx, ry), using an angle of rangle degrees.
 * The point is drawn using the specified index into the entire
 * 256-element palette: for instance, passing in a color of 17 would
 * use color 1 of cset 1.
 * Opacity controls how transparent the point will be. Values other
 * than 128 (solid) and 64 (translucent) are currently undefined.

void DrawTile(int layer, int x, int y, int tile, int blockw, int blockh,
			   int cset, float scale, int rx, int ry, int rangle,
			   int flip, bool transparency, int opacity)
 * Draws a block of tiles on the specified layer of the current screen,
 * starting at (x,y), using the specified cset.
 * Starting with the specified tile, this method copies a block of size
 * blockh x blockw from the tile sheet to the screen. This method's
 * behavior is undefined unless 1 <= blockh, blockw <= 20.
 * The scaling and rotation parameters are reserved for the future, and
 * not currently implemented. This method's behavior is undefined unless
 * rx=ry=rangle=0 and scale=1.
 * Flip specifies how the tiles should be flipped when drawn:
 * 0: No flip
 * 1: Horizontal flip
 * 2: Vertical flip
 * 3: Both (180 degree rotation)
 * If transparency is true, the tiles' transparent regions will be
 * respected.
 * Opacity controls how transparent the solid portions of the tiles will
 * be. Values other than 128 (solid) and 64 (translucent) are currently
 * undefined.

void DrawCombo(int layer, int x, int y, int combo, int w, int h,
			   int cset, float scale, int rx, int ry, int rangle,
			   int frame, int flip, bool transparency, int opacity)
 * Draws a combo on the specified layer of the current screen,
 * starting at (x,y), using the specified cset.
 * Starting with the specified tile referenced by the combo,
 * this method copies a block of size
 * blockh x blockw from the tile sheet to the screen. This method's
 * behavior is undefined unless 1 <= blockh, blockw <= 20.
 * The scaling and rotation parameters are reserved for the future, and
 * not currently implemented. This method's behavior is undefined unless
 * rx=ry=rangle=0 and scale=1.
 * Flip specifies how the tiles should be flipped when drawn:
 * 0: No flip
 * 1: Horizontal flip
 * 2: Vertical flip
 * 3: Both (180 degree rotation)
 * If transparency is true, the tiles' transparent regions will be
 * respected.
 * Opacity controls how transparent the solid portions of the tiles will
 * be. Values other than 128 (solid) and 64 (translucent) are currently
 * undefined.

void Message(int string)
 * Prints the message string with given ID onto the screen.
 * If string is 0, the currently displayed message is removed.
 * This method's behavior is undefined if string is less than 0
 * or greater than the total number of messages in the quest.

====================================
--- Item Functions and Variables ---
====================================

bool isValid()
 * Returns whether this item pointer is still valid. An item pointer
 * becomes invalid when Link picks up the item, the item fades away,
 * or Link leaves the screen. Accessing any variables using an
 * invalid item pointer prints an error message to allegro.log and
 * does nothing.

int X
 * The item's X position on the screen, in pixels.

int Y
 * The item's Y position on the screen, in pixels.

int DrawStyle
 * An integer representing how the item is to be drawn. Use one of the
 * DS_ constants in std.zh to set or compare this value.

int ID
 * This item's ID number. Use the I_ constants to compare this value. The effect of writing to this field is currently undefined.

int OriginalTile
 * The starting tile of the item's animation.

int Tile
 * The current tile associated with this item.

int CSet
 * This item's CSet.

int FlashCSet
 * The CSet used during this item's flash frames, if this item flashes.

int NumFrames
 * The number of frames in this item's animation.

int Frame
 * The tile that is this item's current animation frame.

int ASpeed
 * The speed at which this item animates, in screen frames.

int Delay
 * The amount of time the animation is suspended after the last frame,
 * before the animation restarts, in item frames. That is, the total
 * number of screen frames of extra wait is Delay*ASpeed.

bool Flash
 * Whether or not the item flashes. A flashing item alternates between
 * its CSet and its FlashCSet.

int Flip
 * Whether and how the item's tiles should be flipped.
 * 0: No flip
 * 1: Vertical flip
 * 2: Horizontal flip
 * 3: Both (180 degree rotation)

int Pickup
 * The pickup flags of the item, which determine what happens when Link
 * picks up the item. Its value consists of flags OR'd (|) together; use
 * the IP_ constants in std.zh to set or compare these values.
 * A special note about IP_ENEMYCARRIED: if the Quest Rule "Hide Enemy-
 * Carried Items" is set, then an item carried by an enemy will have its
 * X and Y values set to -128 while the enemy is carrying it. If this
 * flag is removed from such an item, then it will be moved to the enemy's
 * on-screen location.

int Extend
 * Whether to extend the sprite of the item.

int TileWidth
 * The number of tile columns composing the sprite. Writing to this is ignored unless Extend is set to values >=3.

int TileHeight
 * The number of tile rows composing the sprite. Writing to this is ignored unless Extend is set to values >=3.

int HitWidth
 * The width of the sprite's hitbox, or collision rectangle. Writing to this is ignored unless Extend is set to values >=3.

int HitHeight
 * The height of the sprite's hitbox, or collision rectangle. Writing to this is ignored unless Extend is set to values >=3.

int HitZHeight
 * The Z-axis height of the sprite's hitbox, or collision rectangle. The greater it is, the higher Link must jump or fly over the sprite to avoid taking damage. Writing to this is ignored unless Extend is set to values >=3.

int HitXOffset
 * The X offset of the sprite's hitbox, or collision rectangle. Setting it to positive or negative values will move the sprite's hitbox left or right. Writing to this is ignored unless Extend is set to values >=3.

int HitYOffset
 * The Y offset of the sprite's hitbox, or collision rectangle. Setting it to positive or negative values will move the sprite's hitbox up or down. Writing to this is ignored unless Extend is set to values >=3.

int DrawXOffset
 * The X offset of the sprite. Setting it to positive or negative values will move the sprite's tiles left or right relative to its position. Writing to this is ignored unless Extend is set to values >=3.

int DrawYOffset
 * The Y offset of the sprite. Setting it to positive or negative values will move the sprite's tiles up or down relative to its position. Writing to this is ignored unless Extend is set to values >=3.

int DrawZOffset
 * The Z offset of the sprite. Writing to this is ignored unless Extend is set to values >=3.

float Misc[]
 * An array of 8 miscellaneous variables for you to use as your please.

======================================
--- Weapon Functions and Variables ---
======================================

 * Note that lweapons and eweapons possess exactly the same attributes,
 * although their designation affects how they are treated by the engine.
 * The values here correspond to both the lweapon and eweapon type.

bool isValid()
 * Returns whether this weapon pointer is still valid. A weapon pointer
 * becomes invalid when the weapon fades away or disappears
 * or Link leaves the screen. Accessing any variables using an
 * invalid weapon pointer prints an error message to allegro.log and
 * does nothing.

void UseSprite(int id)
 * Reads a 'Weapons/Misc' sprite entry in your quest file, and assigns
 * the OriginalTile, Tile, OriginalCSet, CSet, FlashCSet, NumFrames,
 * Frame, ASpeed, Flip and Flash variables of this weapon based on
 * this entry's data. Passing negative values, and values greater than
 * 255, will do nothing.

bool Behind
 * Ensures the weapon's graphic is drawn behind Link and enemies.

int ID
 * The weapon's ID number. Use the LW_ or EW_ constants to compare
 * this value. The effect of writing to this field is currently undefined.

int X
 * The weapon's X position on the screen, in pixels.

int Y
 * The weapon's Y position on the screen, in pixels.

int Z
 * The weapon's Z position on the screen, in pixels.

int Jump
 * The weapon's falling speed on the screen. Bombs, Bait
 * and Fire weapons obey gravity, although this may only be
 * noticable in sideview.

int DrawStyle
 * An integer representing how the weapon is to be drawn. Use one of the
 * DS_ constants in std.zh to set or compare this value.

int Dir
 * The direction that the weapon is facing. Used by certain weapon types
 * to determine movement, shield deflection and such.

int OriginalTile
 * The starting tile of the weapon's animation.

int Tile
 * The current tile associated with this weapon.

int OriginalCSet
 * The starting CSet of the weapon's animation.

int CSet
 * This weapon's current CSet.

int FlashCSet
 * The CSet used during this weapon's flash frames, if this weapon flashes.

int NumFrames
 * The number of frames in this weapon's animation.

int Frame
 * The weapon's current animation frame.

int ASpeed
 * The speed at which this weapon animates, in screen frames.

int Damage
 * The amount of damage that this weapon causes to Link/an enemy upon contact.

int Step
 * Usually associated with the weapon's velocity. A Step of 100
 * typically means that the weapon moves at approximately one pixel
 * per animation frame.

int Angle
 * The weapon's current angle; used by certain weapon types with
 * angular movement.

bool Angular
 * Specifies whether a weapon has angular movement.

int DeadState
 * The current state of the weapon. Important to keep track of. A value of
 * -1 indicates that it is active, and moves according to the weapon's
 * Dir, Step, Angular, and Angle values. Use -1 if you want the engine to
 * handle movement. Use any value below -1 if you want a dummy weapon that
 * you can control on your own.
 * If it has a positive value, it will decrement once per frame until it equals 0,
 * whereupon the weapon is removed.
 * If you want to remove the weapon, write one of the WDS_ constants in std.zh
 * (appropriate for the weapon) to this variable.

bool Flash
 * Whether or not the weapon flashes. A flashing weapon alternates between
 * its CSet and its FlashCSet.

int Flip
 * Whether and how the weapon's tiles should be flipped.
 * 0: No flip
 * 1: Vertical flip
 * 2: Horizontal flip
 * 3: Both (180 degree rotation)

int Extend
 * Whether to extend the sprite of the weapon. The following values are ignored unless this is set to >=3.

int TileWidth
 * The number of tile columns composing the sprite. Writing to this is ignored unless Extend is set to values >=3.

int TileHeight
 * The number of tile rows composing the sprite. Writing to this is ignored unless Extend is set to values >=3.

int HitWidth
 * The width of the sprite's hitbox, or collision rectangle. Writing to this is ignored unless Extend is set to values >=3.

int HitHeight
 * The height of the sprite's hitbox, or collision rectangle. Writing to this is ignored unless Extend is set to values >=3.

int HitZHeight
 * The Z-axis height of the sprite's hitbox, or collision rectangle. The greater it is, the higher Link must jump or fly over the sprite to avoid taking damage. Writing to this is ignored unless Extend is set to values >=3.

int HitXOffset
 * The X offset of the sprite's hitbox, or collision rectangle. Setting it to positive or negative values will move the sprite's hitbox left or right. Writing to this is ignored unless Extend is set to values >=3.

int HitYOffset
 * The Y offset of the sprite's hitbox, or collision rectangle. Setting it to positive or negative values will move the sprite's hitbox up or down. Writing to this is ignored unless Extend is set to values >=3.

int DrawXOffset
 * The X offset of the sprite. Setting it to positive or negative values will move the sprite's tiles left or right relative to its position. Writing to this is ignored unless Extend is set to values >=3.

int DrawYOffset
 * The Y offset of the sprite. Setting it to positive or negative values will move the sprite's tiles up or down relative to its position. Writing to this is ignored unless Extend is set to values >=3.

int DrawZOffset
 * The Z offset of the sprite. Writing to this is ignored unless Extend is set to values >=3.

float Misc[]
 * An array of 8 miscellaneous variables for you to use as your please.


=========================================
--- Itemdata Functions and Variables ---
=========================================

int Family
 * The kind of item to which this class belongs (swords, boomerangs,
 * potions, etc.) Use the IC_ constants in std.zh to set or compare this
 * value.

int Level
 * The level of this item. Higher-level items replace lower-level items
 * when they are picked up.

int Amount
 * Corresponds to the "Increase Amount" entry in the Item Editor.
 * The value of this data member can have two meanings:
 * If Amount & 0x8000 is 1, the drain counter for this item is set
 * to Amount & 0x3FFF. The game then slowly fills the counter of this item
 * (see Counter below) out of the drain counter. Gaining rupees uses the
 * drain counter, for example.
 * is set to Amount when the item is picked up.
 * If Amount & 0x8000 is 0, the counter of this item is increased, if
 * Amount & 0x4000 is 1, or decreased, if Amount & 0x4000 is 0, by
 * Amount & 0x3FFF when the item is picked up.

int Max
 * Corresponds to the "Full Max" entry in the Item Editor.
 * In conjunction with MaxIncrement (see below) this value controls how
 * the maximum value of the counter of this item (see Counter below) is
 * modified when the item is picked up. If MaxIncrement is nonzero at that
 * time, the counter's new maximum value is at that time set to the
 * minimum of its current value plus MaxIncrement, Max.
 * If Max is less than the current maximum of the counter, Max is ignored
 * and that maximum is used instead.
 * Notice that as a special case, if Max = MaxIncrement, the counter's
 * maximum value will be forced equal to Max.

int MaxIncrement
 * Corresponds to the "+Max" entry in the Item Editor.
 * In conjunction with Max (see above) this value controls how the
 * maximum value of the counter of this item (see Counter below) is
 * modified when the item is picked up. If MaxIncrement is nonzero at that
 * time, the counter's new maximum value is at that time set to the
 * minimum of its current value plus MaxIncrement, and Max.
 * If Max is less than the current maximum of the counter, Max is ignored
 * and that maximum is used instead.

bool Keep
 * Corresponds to the "Equipment Item" checkbox in the Item Editor.
 * If true, Link will keep the item, and it will show up as an item or
 * equipment in the subscreen. If false, it may modify the current value
 * or maximum value of its counter (see Counter below), then disappear.
 * The White Sword and Raft, for instance, have Keep true, and keys and
 * rupees have Keep false.

int Counter
 * Corresponds to the "Counter Reference" entry in the Item Editor.
 * The game counter whose current and modified values might be modified
 * when the item is picked up (see Amount, Max, and MaxIncrement above.)
 * Use the CT_  constants in std.zh to set or compare this value.

int UseSound
 * Corresponds to the "Sound" entry on the action tab in the Item Editor.

====================================
--- Game Functions and Variables ---
====================================

int GetCurScreen()
 * Retrieves the number of the current screen within the current map.

int GetCurDMapScreen()
 * Retrieves the number of the current screen within the current DMap.

int GetCurLevel()
 * Retrieves the number of the dungeon level of the current DMap. Multiple
 * DMaps can have the same dungeon level - this signifies that they share
 * a map, compass, level keys and such.

int GetCurMap()
 * Retrieves the number of the current map.

int GetCurDMap()
 * Returns the number of the current DMap.

int NumDeaths
 * The number of times Link has perished during this quest.

int Cheat
 * The current cheat level of the quest player.

int Time
 * Returns the time elapsed in this quest, in 60ths of a second. The
 * return value is undefined if TimeValid is false (see below).

bool HasPlayed
 * This value is true if the current quest session was loaded from a saved
 * game, false if the quest was started fresh.

bool TimeValid
 * True if the elapsed quest time can be determined for the current quest.

int GuyCount[]
 * The number of NPCs (enemies and guys) on screen i of this map, where
 * i is the index used to access this array. This array is exclusively used
 * to determine which enemies had previously been killed, and thus won't
 * return, when you re-enter a screen.

int ContinueScreen
 * The screen in the continue DMap (see ContinueDMap below) that will be
 * used when Link dies and continues.

int ContinueDMap
 * The DMap containing the screen that will be used when Link dies and
 * continues.

int Counter[]
 * The current value of the game counters. Use the CR_ constants in
 * std.zh to index into this array.

int MCounter[]
 * The current maximum value of the game counters. Use the CR_ constants
 * in std.zh to index into this array.

int DCounter[]
 * The current value of the game drain counters. Use the CR_ constants
 * in std.zh to index into this array.
 * Note that if the player hasn't acquired the '1/2 Magic Upgrade' yet,
 * then setting the CR_MAGIC drain counter to a negative value will
 * drain the magic counter by 2 per frame rather than 1.

int Generic[]
 * An array of miscellaneous game values, such as number of heart
 * containers and magic drain rate. Use the GEN_ constants in std.zh
 * to index into this array.

int LItems[]
 * The exploration items (map, compass, boss key etc.) of dungeon level i
 * currently under the possession of the player, where i is
 * the index used to access this array. Each element of this
 * array consists of flags OR'd (|) together; use the LI_ constants in
 * std.zh to set or compare these values.

int LKeys[]
 * The number of level keys of level i currently under the possession of
 * the player, where i is the index used to access this array.

bool GetScreenState(int map, int screen, int flag)
 * As with State, but retrieves the miscellaneous flags of any screen,
 * not just the current one. This function is undefined if map is less
 * than 1 or greater than the maximum map number of your quest, or if
 * screen is greater than 135.
 * Note: Screen numbers in ZQuest are usually displayed in hexadecimal.
 * Use the ST_ constants in std.zh for the flag parameter.

void SetScreenState(int map, int screen, int flag, bool value)
 * As with State, but sets the miscellaneous flags of any screen, not
 * just the current one. This function is undefined if map is less than
 * 1 or greater than the maximum map number of your quest, or if
 * screen is greater than 135.
 * Note: Screen numbers in ZQuest are usually displayed in hexadecimal.
 * Use the ST_ constants in std.zh for the flag parameter.

float GetScreenD(int screen, int reg)
 * Retrieves the value of D[reg] on the given screen of the current
 * DMap.

void SetScreenD(int screen, int reg, float value)
 * Sets the value of D[reg] on the given screen of the current DMap.

float GetDMapScreenD(int dmap, int screen, int reg)
 * Retrieves the value of D[reg] on the given screen of the given
 * DMap.

void SetDMapScreenD(int dmap, int screen, int reg, float value)
 * Sets the value of D[reg] on the given screen of the given DMap.

itemdata LoadItemData(int item)
 * Retrieves the itemdata pointer corresponding to the given item.
 * Use the item pointer ID variable or I_ constants in std.zh as values.

void PlaySound(int soundid)
 * Plays one of the quest's sound effects. Use the SFX_ constants in
 * std.zh as values of soundid.

void PlayMIDI(int MIDIid)
 * Changes the current screen MIDI to MIDIid.
 * Will revert to the DMap (or screen) MIDI upon leaving the screen.

int GetComboData(int map, int screen, int position)
 * Grabs a particular combo reference from anywhere in the game
 * world, based on map (NOT DMap), screen number, and position.
 * Position is considered an index, treated the same way as in
 * Screen->ComboD[].

void SetComboData(int map, int screen, int position, int value)
 * Sets a particular combo reference anywhere in the game world,
 * based on map (NOT DMap), screen number, and position. Position
 * is considered an index, treated the same way as in Screen->ComboD[].

int GetComboCSet(int map, int screen, int position)
 * Grabs a particular combo's CSet from anywhere in the game
 * world, based on map (NOT DMap), screen number, and position.
 * Position is considered an index, treated the same way as in
 * Screen->ComboC[].

void SetComboCSet(int map, int screen, int position, int value)
 * Sets a particular combo's CSet anywhere in the game world,
 * based on map (NOT DMap), screen number, and position. Position
 * is considered an index, treated the same way as in Screen->ComboC[].

int GetComboFlag(int map, int screen, int position)
 * Grabs a particular combo's secret flag from anywhere in the game
 * world, based on map (NOT DMap), screen number, and position.
 * Position is considered an index, treated the same way as in
 * Screen->ComboF[].

void SetComboFlag(int map, int screen, int position, int value)
 * Sets a particular combo's secret flag anywhere in the game world,
 * based on map (NOT DMap), screen number, and position. Position
 * is considered an index, treated the same way as in Screen->ComboF[].

int GetComboType(int map, int screen, int position)
 * Grabs a particular combo's type from anywhere in the game
 * world, based on map (NOT DMap), screen number, and position.
 * Position is considered an index, treated the same way as in
 * Screen->ComboT[]. Note that you are grabbing an actual combo
 * attribute as referenced by the combo on screen you're
 * referring to.

void SetComboType(int map, int screen, int position, int value)
 * Sets a particular combo's type anywhere in the game world,
 * based on map (NOT DMap), screen number, and position. Position
 * is considered an index, treated the same way as in Screen->ComboT[].
 * Note that you are grabbing an actual combo attribute as referenced
 * by the combo on screen you're referring to, which means that
 * setting this attribute will affect ALL references to this combo
 * throughout the quest.

int GetComboInherentFlag(int map, int screen, int position)
 * Grabs a particular combo's inherent flag from anywhere in the game
 * world, based on map (NOT DMap), screen number, and position.
 * Position is considered an index, treated the same way as in
 * Screen->ComboI[]. Note that you are grabbing an actual combo
 * attribute as referenced by the combo on screen you're
 * referring to.

void SetComboInherentFlag(int map, int screen, int position, int value)
 * Sets a particular combo's inherent flag anywhere in the game world,
 * based on map (NOT DMap), screen number, and position. Position
 * is considered an index, treated the same way as in Screen->ComboI[].
 * Note that you are grabbing an actual combo attribute as referenced
 * by the combo on screen you're referring to, which means that
 * setting this attribute will affect ALL references to this combo
 * throughout the quest.

int GetComboSolid(int map, int screen, int position)
 * Grabs a particular combo's solidity flag from anywhere in the game
 * world, based on map (NOT DMap), screen number, and position.
 * Position is considered an index, treated the same way as in
 * Screen->ComboS[]. Note that you are grabbing an actual combo
 * attribute as referenced by the combo on screen you're
 * referring to.

void SetComboSolid(int map, int screen, int position, int value)
 * Sets a particular combo's solidity anywhere in the game world,
 * based on map (NOT DMap), screen number, and position. Position
 * is considered an index, treated the same way as in Screen->ComboS[].
 * Note that you are grabbing an actual combo attribute as referenced
 * by the combo on screen you're referring to, which means that
 * setting this attribute will affect ALL references to this combo
 * throughout the quest.


===================================
--- NPC Functions and Variables ---
===================================

bool isValid()
 * Returns whether or not this NPC pointer is still valid. A pointer
 * becomes invalid if the enemy dies or Link leaves the screen.
 * Trying to access any variable of an invalid NPC pointer prints
 * an error to allegro.log and does nothing.

int X
 * The NPC's current X coordinate, in pixels.

int Y
 * The NPC's current Y coordinate, in pixels.

int Z
 * The NPC's current Z coordinate, in pixels.

int Jump
 * The NPC's upward velocity, in pixels. If negative, the NPC will fall.
 * The downward acceleration of Gravity (in Init Data) modifies this value every frame.

int Dir
 * The direction the NPC is facing. Use the DIR_ constants in std.zh to
 * set and compare this value. The effect of writing to this field is
 * currently undefined.

int Rate
 * The rate at which the NPC changes direction. For a point of reference,
 * the "Octorok (Magic)" enemy has a rate of 16. The effect of writing to
 * this field is currently undefined.

int Step
 * The NPC's movement speed. A Step of 100 usually means that
 * the enemy moves at approximately one pixel per animation frame.
 * As a point of reference, the "Octorok (Magic)" enemy has
 * a step of 200. The effect of writing to this field is
 * currently undefined.

int ASpeed
 * The the NPC's animation frame rate, in screen frames. The effect of
 * writing to this field is currently undefined.

int Haltrate
 * The extent to which the NPC stands still while moving around the
 * screen. As a point of reference, the Zols and Gels have haltrate of
 * 16. The effect of writing to this field is currently undefined.

int DrawStyle
 * The way the NPC is animated. Use the DS_ constants in std.zh to set or
 * compare this value. The effect of writing to this field is currently undefined.

int ID
 * The NPC's enemy ID number. The effect of writing to this field is currently undefined.

int HP
 * The NPC's current hitpoints. A weapon with a Power of 1 removes 2
 * hitpoints.

int Damage
 * The amount of damage dealt to an unprotected Link when he touches this NPC, in
 * quarter-hearts.

int WeaponDamage
 * The amount of damage dealt to an unprotected Link by this NPC's weapon, in
 * quarter-hearts.

int OriginalTile
 * The number of the starting tile used by this NPC.

int Tile
 * The current tile associated with this NPC. The effect of writing to this variable is undefined.

int Weapon
 * The weapon used by this enemy. Use the WPN_ constants (NOT the EW_ constants)
 * in std.zh to set or compare this value.

int ItemSet
 * The items that the NPC might drop when killed. Use the IS_ constants
 * in std.zh to set or compare this value.

int CSet
 * The CSet used by this NPC.

int BossPal
 * The boss pallete used by this NPC; this pallete is only used if CSet
 * is 14 (the reserved boss cset). Use the BPAL_ constants in std.zh to
 * set or compare this value.

int SFX
 * The sound effects emitted by the enemy. Use the SFX_ constants in
 * std.zh to set or compare this value.

int Extend
 * Whether to extend the sprite of the enemy.

int TileWidth
 * The number of tile columns composing the sprite. Writing to this is ignored unless Extend is set to values >=3.

int TileHeight
 * The number of tile rows composing the sprite. Writing to this is ignored unless Extend is set to values >=3.

int HitWidth
 * The width of the sprite's hitbox, or collision rectangle. Writing to this is ignored unless Extend is set to values >=3.

int HitHeight
 * The height of the sprite's hitbox, or collision rectangle. Writing to this is ignored unless Extend is set to values >=3.

int HitZHeight
 * The Z-axis height of the sprite's hitbox, or collision rectangle. The greater it is, the higher Link must jump or fly over the sprite to avoid taking damage. Writing to this is ignored unless Extend is set to values >=3.

int HitXOffset
 * The X offset of the sprite's hitbox, or collision rectangle. Setting it to positive or negative values will move the sprite's hitbox left or right. Writing to this is ignored unless Extend is set to values >=3.

int HitYOffset
 * The Y offset of the sprite's hitbox, or collision rectangle. Setting it to positive or negative values will move the sprite's hitbox up or down. Writing to this is ignored unless Extend is set to values >=3.

int DrawXOffset
 * The X offset of the sprite. Setting it to positive or negative values will move the sprite's tiles left or right relative to its position. Writing to this is ignored unless Extend is set to values >=3.

int DrawYOffset
 * The Y offset of the sprite. In non-sideview screens, this is usually -2. Setting it to positive or negative values will move the sprite's tiles up or down relative to its position. Writing to this is ignored unless Extend is set to values >=3.

int DrawZOffset
 * The Z offset of the sprite. This is ignored unless Extend is set to values >=3.

float Misc[]
 * An array of 8 miscellaneous variables for you to use as your please.
