Code:
// Beta 52
/////////////////
/// ZScript ///
/////////////////
The ZScript language now supports function pointers, using the AT_SIGN token (@) as a delimiter.
The ZScript language now supports C-Style comment blocks using the traditional syntax of:
/*
COMMENT BLOCK
*/
Arrays now support being declared with a formula:
int arr[10*4];
This is now the same as int arr[40];
Nesting array calls should now work properly. (e.g. arrA[ arrB[ arrC[ arrd[4] ] ] ] )
//////////////
// Global //
//////////////
void OverlayTile(int firsttile, int secondtile);
Overlay one tile onto another.
int SizeOfArrayBool(bool array[]);
* As SizeOfArray(int *ptr), save that it works specifically with bool typed arrays.
int SizeOfArrayFFC(ffc array[]);
* As SizeOfArray(int *ptr), save that it works specifically with ffc typed arrays.
int SizeOfArrayNPC(npc array[]);
* As SizeOfArray(int *ptr), save that it works specifically with npc typed arrays.
int SizeOfArrayItem(item array[]);
* As SizeOfArray(int *ptr), save that it works specifically with item typed arrays.
int SizeOfArrayItemdata(itemdata array[]);
* As SizeOfArray(int *ptr), save that it works specifically with itemdata typed arrays.
int SizeOfArrayLWeapon(lweapon array[]);
* As SizeOfArray(int *ptr), save that it works specifically with lweapon typed arrays.
int SizeOfArrayEWeapon(eweapon array[]);
* As SizeOfArray(int *ptr), save that it works specifically with eweapon typed arrays.
/************************************************************************************************************/
////////////
// Game //
////////////
void PauseSound(int soundid)
* Pauses one of the quest's playing sound effects. Use the SFX_ constants in
void ResumeSound(int soundid)
* Resumes one of the quest's paused sound effects. Use the SFX_ constants in
void EndSound(int soundid)
* Kills one of the quest's playing sound effects. Use the SFX_ constants in
void PauseMusic()
* Pauses the present, playing MIDI or Enhanced Music file.
void ResumeMusic()
* Resumes the present, playing MIDI or Enhanced Music file.
void GreyscaleOn()
* Renders the entire display in greyscale.
void GreyscaleOff()
* Returns the display rendering to colour.
int DMapPalette[512]
* Set or get the Level Palette for each DMap
void SetMessage(int message, int str[])
* Places string 'str[]' into ZQ Message 'message'.
void SetMapName(int dmap, int str[])
* Places string 'str[]' into DMap Name for DMap with ID 'dmap'
void SetMapTitle(int dmap, int str[])
* Places string 'str[]' into DMap Title for DMap with ID 'dmap'
void SetMapIntro(int dmap, int str[])
* Places string 'str[]' into DMap Intro for DMap with ID 'dmap'
bool CappedFPS
* Check if the game is uncapped.
int Version;
* Returns the version of ZC being used.
int Build;
* Returns the Build ID of the version of ZC being used.
int Beta;
* Returns the Beta ID of the version of ZC being used. If the build is not a beta, this returns 0.
bool DisableActiveSubscreen;
* If set true, the active subscreen will not fall into view ehen the player presses Start.
int GetPointer(bool *ptr[]);
* Returns the pointer of a bool array as a float.
/************************************************************************************************************/
/////////////
/// FFC ///
/////////////
int ID;
* The screen ref of the ffc. Used primarily for this->ID.
int GetPointer(ffc *ptr[]);
* Returns the pointer of a ffc array as a float.
ffc SetPointer(int value);
* Converts an int pointer to the ffc type, for assigning.
/************************************************************************************************************/
//////////////
/// Item ///
//////////////
float UID;
* Returns the UID of an item.
int GetPointer(item *ptr[]);
* Returns the pointer of a item array as a float.
item SetPointer(int value);
* Converts an int pointer to the item type, for assigning.
int AClock
* The clock used for the item's animation cycle.
/************************************************************************************************************/
/////////////////
/// *weapon ///
/////////////////
float UID;
* Returns the UID of an *weapon.
int GetPointer(lweapon *ptr[]);
* Returns the pointer of a *weapon array as a float.
lweapon SetPointer(int value);
* Converts an int pointer to the lweapon type, for assigning.
float Misc[32];
* Epanded from a size of [16] to [32]. An array of 32 miscellaneous variables for you to use as you please.
///////////////////////////
/// LWeapon Specific ///
///////////////////////////
int Range;
* The range of boomerang and hookshot lweapons in pixels; and arrow lweapons inb frames.
int AClock
* The clock used for the item's animation cycle.
/************************************************************************************************************/
/////////////
/// NPC ///
/////////////
float UID;
* Returns the UID of an npc.
int GetPointer(npc *ptr[]);
* Returns the pointer of a item array as a float.
npc SetPointer(int value);
* Converts an int pointer to the npc type, for assigning.
int ScriptDefense[10];
* The npc's Script Weapon Defense values. This corresponds to the 'Defenses 3' tab in the Enemy Editor.
int InvFrames;
* Returns the number of remaining invincibility frames if the enemy is invincible, otherwise 0.
int Invincible;
* Returns if the enemy is invincible, because of ( superman variable ).
bool HasItem;
* Returns if the enemy is holding the screen item.
bool Ringleader;
* Returns if the enemy is a 'ringleader'.
float Misc[32];
* Epanded fron a size of [16] to [32]. An array of 32 miscellaneous variables for you to use as you please.
/************************************************************************************************************/
//////////////
/// Link ///
//////////////
int Animation;
* Link;s Animation style, as set in Quest->Graphics->Sprites->Link
int WalkASpeed;
* Link's Walking Animation speed as set in Quest->Graphics->Sprites->Link
int SwimASpeed;
* Link's Swiming Animation speed as set in Quest->Graphics->Sprites->Link
int InvFrames;
* This returns how long Link will remain invincible, 0 if not invincible. Can be set.
bool InvFlicker;
* If set false, Link will neither flash, nor flicker when invincible.
int HurtSound;
* The sound that plays when Link is injured. By default this is '16', but you may change it at any time.
int HitHeight;
* link's Hitbox height in pixels starting from his 0x,0y (upper-left) corner, going down.
int HitWidth;
* Link's Hitbox width in pixels starting from his x0,y0 (upper-left) corner, going right.
int HitXOffset;
* The X offset of Link's hitbox, or collision rectangle.
int HitYOffset;
* The Y offset of Link's hitbox, or collision rectangle.
int Eaten;
* It returns 0 if Link is not eaten, otherwise it returns the duration of him being eaten.
int Equipment;
* Link->Equipment is now read-write, and needs testing.
int ItemA;
* Contains the item IDs of what is currently equiped to Link's A button.
int ItemB;
* Contains the item IDs of what is currently equiped to Link's B button.
int SetItemSlot(int itm_id, bool a_button, bool force);
* This allows you to set Link's button items without binary operation. Needs testing. , and to decide whether to
int Extend;
* Sets the extend value for all of Link's various actions.
int GetLinkExtend(int sprite, int dir);
* Gets the extend value for one of Link's various actions based on a direction.
void SetLinkExtend(int sprite, int dir, int extend);
* Sets the extend value for one of Link's various actions.
void SetLinkTile(int sprite, int tile, int dir)
* Sets the tile for Link's various actions. This is intended to work as OTile for Link. Unverified.
int GetLinkTile(int sprite, int dir)
* Returns the OTile for one of Link's various actions. Unverified.
int WalkTile, SwimTile, DiveTile, SlashTile, JumpTile, ChargeTile, StabTile, CastingTile, PoundTile, FloatTile
Hold1LandTile, Hold2LandTile, Hold1WaterTile, Hold2WaterTile;
* A series of fourteen individual setter/getter ints to set or return the tile for all of Link's various actions.
int WarpEffect;
* Sets a warp effect type prior to doing Screen->Warp
int WarpSound;
* Setting this to a value other than '0' will play that sound when Link warps.
bool SideWarpSounds;
* If you enable this setting, the warp sound will play in side warps.
bool PitWarpSounds;
* If you enable this setting, the warp sound will play in a pit warp, one time.
int UseWarpReturn;
* Setting this to a value between 0 and 3 will change the target return square for Link->Warp
int UsingItem;
* Returns the ID of an item used when Link uses an item. Returns -1 if Link is not using an item this frame.
int UsingItemA;
* Returns the ID of an item used when Link uses an item on button A. Returns -1 if Link is not using an item this frame.
int UsingItemB;
* Returns the ID of an item used when Link uses an item on button B. Returns -1 if Link is not using an item this frame.
bool Diagonal;
* This corresponds to whether 'Diagonal Movement' is enabled, or not.
bool BigHitbox;
* This corresponds to whether 'Big Hitbox' is enabled, or not.
float Misc[32];
* Expanded from [16] to [32]. An array of 32 miscellaneous variables for you to use as you please.
/************************************************************************************************************/
//////////////////
/// itemdata ///
//////////////////
int GetPointer(itemdata *ptr[]);
* Returns the pointer of a itemdata array as a float.
itemdata SetPointer(int value);
* Converts an int pointer to the itemdata type, for assigning.
int ID;
* Returns the item number of the item in question.
int Modifier;
* The Link Tile Modifier
int Tile;
* The tile used by the item.
int CSet;
* The CSet of the tile used by the item.
int Flash;
* The Flash value for the CSet
int AFrames;
* The number of animation frames in the item's tile animation.
int ASpeed;
* The speed of the item's animation.
int Delay;
* The Delay value, before the animation begins.
int Script;
* The Action Script for the item.
int PScript;
* The Pickup Script for the item.
int MagicCost;
* The item's maic (or rupees, if this is set) cost.
int MinHearts;
* The minimum number of hearts required to pick up the item.
int Attributes[10]
* An array of ten integers that correspond to the ten <Misc> text entries on the item editor Data tab.
int Sprites[10]
* An array of ten integers that correspond to the ten sprite pulldowns on the item editor Action tab.
bool Flags[5]
* An array of five boolean flags that correspond to the five flag tickboxes on the item editor Data tab.
int Misc1, Misc2, Misc3, Misc4, Misc5, Misc6, Misc7, Misc8, Misc9, Misc10;
* These correspond to the pull-down options in the item editor 'Data' tab.
int Attribute1, Attribute2, Attribute3, Attribute4, Attribute5, Attribute6,
Attribute7, Attribute8, Attribute9, Attribute10;
* These correspond to the pull-down options in the item editor 'Action' tab.
bool Combine;
* Corresponds to 'Upgrade when collected twice'.
bool Downgrade;
* Corresponds to the 'Remove When Used' option on the Action tab of the item editor.
bool KeepOld;
* Corresponds to 'Keep lower level items on the Pickup tab of the item editor.
bool RupeeCost;
* Corresponds to the 'Use Rupees Instead of Magic' option on the item editor 'Action' tab.
bool Edible;
* Corresponds to the 'Can be Eaten by Enemies' box on the Pickup tab of the item editor.
bool GainLower;
* Corresponds to the 'Gain All Lower Level Items' box on the Pickup tab of the item editor.
bool Flag1;
* This corresponds to the box directly below 'Equiment Item'. For swords, this is 'B.H. is Percent'.
bool Flag2;
* This corresponds to the box directly below 'Flag 1, or two boxes down from 'Equiment Item'.
* For swords, this is 'B.D. is Percent'.
bool Flag3;
* This corresponds to the box directly right of 'Equiment Item'. For swords, this is 'B. Penetrates Enemies'.
bool Flag4;
* This corresponds to the box directly right of 'Flag 2'. For swords, this is 'Can Slash'.
bool Flag5;
* This corresponds to the box directly below 'Flag 4'. For swords, this is '<Unused>', and greyed out.
bool Unused;
* ? - An extra script-only flag. It's a mystery to everyone.
/************************************************************************************************************/
////////////////
/// Screen ///
////////////////
void WavyIn();
* Replicates the warping screen wave effect (inbound) from a tile warp.
void WavyOut();
* Replicates the warping screen wave effect (outbound) from a tile warp.
void ZapIn();
* Replicates the warping screen zap effect (inbound) from a tile warp.
void ZapOut();
* Replicates the warping screen zap effect (outbound) from a tile warp.
void OpeningWipe();
* Replicates the opening wipe screen effect (using the quest rule for its type) from a tile warp.
void DrawBitmapEx ( int layer,
int bitmap_id,
int source_x, int source_y, int source_w, int source_h,
int dest_x, int dest_y, int dest_w, int dest_h,
float rotation, int cx, int cy, int mode, int lit, bool mask);
* As DrawBitmap(), except that it can do more things.
/************************************************************************************************************/
Game->DEBUGGING: These might find their way into namespace Debug-> instead of Game-> in the future.
/************************************************************************************************************/
int RefFFC; ZASM Instruction:
REFFFC
/**
* Returns the present ffc refrence from the stack. FOR DEBUGGING ONLY!
* THIS WILL BE DISABLED IN RELEASE BUILDS !
*/ Example Use:
/************************************************************************************************************/
int RefItem; ZASM Instruction:
REFITEM
/**
* Returns the present item refrence from the stack. FOR DEBUGGING ONLY!
* THIS WILL BE DISABLED IN RELEASE BUILDS !
*/ Example Use:
/************************************************************************************************************/
int RefItemdata; ZASM Instruction:
REFIDATA
/**
* Returns the present itemdata refrence from the stack. FOR DEBUGGING ONLY!
* THIS WILL BE DISABLED IN RELEASE BUILDS !
*/ Example Use:
/************************************************************************************************************/
int RefLWeapon; ZASM Instruction:
REFLWPN
/**
* Returns the present lweapon refrence from the stack. FOR DEBUGGING ONLY!
* THIS WILL BE DISABLED IN RELEASE BUILDS !
*/ Example Use:
/************************************************************************************************************/
int RefEWeapon; ZASM Instruction:
REFEWPN
/**
* Returns the present eweapon refrence from the stack. FOR DEBUGGING ONLY!
* THIS WILL BE DISABLED IN RELEASE BUILDS !
*/ Example Use:
/************************************************************************************************************/
int RefNPC; ZASM Instruction:
REFNPC
/**
* Returns the present npc refrence from the stack. FOR DEBUGGING ONLY!
* THIS WILL BE DISABLED IN RELEASE BUILDS !
*/ Example Use:
/************************************************************************************************************/
int SP; ZASM Instruction:
SP
/**
* Returns the value of the stack pointer. FOR DEBUGGING ONLY!
* THIS WILL BE DISABLED IN RELEASE BUILDS !
*/ Example Use:
////////////////////////
/// Not Implemented ///
////////////////////////
BitmapQuad
//sdci[1]=layer
//sdci[2]=x1
//sdci[3]=y1
//sdci[4]=x2
//sdci[5]=y2
//sdci[6]=x3
//sdci[7]=y3
//sdci[8]=x4
//sdci[9]=y4
//sdci[10]=sourcex
//sdci[11]=sourcey
//sdci[12]=sourcew
//sdci[13]=sourceh
//sdci[14]=width
//sdci[15]=height
//sdci[16]=tile/combo
//sdci[17]=polytype
void ComboArray ( int layer, int number_of_combos,
int combos[],
int x_positions[],
int y_positions[],
int csets[]);
ZASM: COMBOARRAY
/**
*
* Draws a number of combos specified by 'number_of_combos' to 'layer'.
* Specify the combos by populating an array with their IDs and passing the array ointer to 'combos'.
* Specify the X coordinate for each by passing an array with their x coordinates to 'x_positions'.
* Specify the Y coordinate for each by passing an array with their y coordinates to 'y_positions'.
* Specify the CSet for each by passing an array with their csets to 'csets'.
*
* This function counts as a single draw.
*
* Transparency is not yet imlemented, but you may draw to a bitmap and render it translucent.
*// Example:
int combos[4] = {16,19,31,20};
int cmbx[4]= {0, 16, 32, 48}:
int cmby[4]={8, 8, 8, 8);
int cmbc[4]={0,0,0,0};
Screen->ComboArray(6, 4, combos, cmbx, cmby, cmbc);
/************************************************************************************************************/
//! This new mode does not work as intended, and will likely be deprecated by Screen->SetRenderSource
void Quad ( int layer,
int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4,
int w, int h, int cset, int flip, int texture, int render_mode);
ZASM Instruction:
QUADR
/**
* Draws a quad on the specified layer with the corners x1,y1 through x4,y4.
* Corners are drawn in a counterclockwise order starting from x1,y1. ( So
* if you draw a "square" for example starting from the bottom-right corner
* instead of the usual top-left, the the image will be textured onto the
* quad so it appears upside-down. -yes, these are rotatable. )
*
* From there a single or block of tiles, combos **or a bitmap** is then texture mapped
* onto the quad using the arguments w, h, cset, flip, and render_mode.
* A positive vale in texture will draw the image from the tilesheet pages,
* whereas a negative value will be drawn from the combo page. 0 will draw combo number 0.
* Both w and h are undefined unless 1 <= blockh, blockw <= 16, and it is a power of
* two. ie: 1, 2 are acceptable, but 2, 15 are not.
*
* To specify a bitmap as a texture, sum 65520 with the bitmap ID, or use the constant TEX_BITMAP + Bitmap
* Example: Screen->Quad(6, 0, 0, 40, 25, 18, 50, 60, 110, 0, 0, 0, 0, TEX_BITMAP+RT_BITMAP0, PT_TEXTURE);
*
*
* Flip specifies how the tiles/combos should be flipped when drawn:
* 0: No flip
* 1: Horizontal flip
* 2: Vertical flip
* 3: Both (180 degree rotation)
* (!) See std.zh for a list of all available render_mode arguments.
*/ Example Use: !#!
void TileArray ( int layer, int number_of_tiles,
int tiles[],
int x_positions[],
int y_positions[],
int csets[]);
ZASM: TILEARRAY
/**
*
* Draws a number of tiles specified by 'number_of_tiles' to 'layer'.
* Specify the tiles by populating an array with their IDs and passing the array ointer to 'tiles'.
* Specify the X coordinate for each by passing an array with their x coordinates to 'x_positions'.
* Specify the Y coordinate for each by passing an array with their y coordinates to 'y_positions'.
* Specify the CSet for each by passing an array with their csets to 'csets'.
*
* This function counts as a single draw.
*
* Transparency is not yet imlemented, but you may draw to a bitmap and render it translucent.
*// Example:
int tiles[4] = {16,19,31,20};
int tilx[4]= {0, 16, 32, 48}:
int tily[4]={8, 8, 8, 8);
int tilc[4]={0,0,0,0};
Screen->TileArray(6, 4, tiles, tilx, tily, tilc);
/************************************************************************************************************/
void PixelArray ( int layer, int number_of_pixels,
int x_positions[],
int y_positions[],
int colours[]);
ZASM: PIXELARRAY
/**
*
* Draws a number of pixel, similar to PutPixel, specified by 'number_of_pixels' to 'layer'.
* Specify the X coordinate for each by passing an array with their x coordinates to 'x_positions'.
* Specify the Y coordinate for each by passing an array with their y coordinates to 'y_positions'.
* Specify the colour for each by passing an array with their csets to 'colours'.
*
* This function counts as a single draw.
*
* Transparency is not yet imlemented, but you may draw to a bitmap and render it translucent.
*// Example:
int pix[4] = {16,19,31,20};
int px[4]= {0, 16, 32, 48}:
int py[4]={8, 8, 8, 8);
int pc[4]={0x12,0xB0,0xDA,0x4F};
Screen->TileArray(6, 4, pix, px, py, pc);
/************************************************************************************************************/
CreateBitmap(int id, int xsize, int ysize)
* Min size 1, max 2048
/************************************************************************************************************/
SetRenderSource(int target, int x, int y, int w, int h)
/************************************************************************************************************/
void Polygon ( int layer, ... );
ZASM: POLYGON
* Adding to Beta 9 : Postponed -Z
/************************************************************************************************************/
// Game->
//! These do not yet work:
//Returns Screen->Door[index] for a given DMap and Screen
int GetDMapScreenDoor( int dmap, int screen, int index )
//Sets Screen->Door[index] for a given DMap and Screen to 'value'
void SetDMapScreenDoor( int dmap, int screen, int index, int value)
//Returns Screen->State[index] for a given DMap and Screen
bool GetDMapScreenState( int dmap, int screen, int index )
//Sets Screen->State[index] for a given DMap and Screen to 'value'
void SetDMapScreenState( int dmap, int screen, int index, bool value)
/************************************************************************************************************/