Functions

float LogToBase int Floor int Ceiling int Round int VBound int Div int Rand float Randf float Randf float DegtoRad float RadtoDeg int Sign float Distance float Angle float RadianAngle float VectorX float VectorY float Lerp float DotProduct float CrossProduct float DistanceSquared float Midpoint float SmoothStep float WrapAngle float WrapDegrees float TurnTowards int AngleDir8 int RadianAngleDir8 int AngleDir4 int RadianAngleDir4 int OppositeDir int SpinDir void DrawString void DrawString void DrawTileSimple void DrawToLayer T Cond float Choose float Choose float Choose float Choose float Choose bool RectCollision bool SquareCollision bool SquareCollision2 bool CircleCollision bool Collision bool LinkCollision int HitboxLeft int HitboxTop int HitboxRight int HitboxBottom bool CanWalk bool OnSidePlatform bool OnSidePlatform void SetScreenDBit void SetScreenDBit void SetScreenDBit bool GetScreenDBit bool GetScreenDBit bool GetScreenDBit bool InputLeftClick bool InputRightClick int GetEquipmentA int GetEquipmentB bool UsingItem int ScreenFlag int ScreenEFlag bool GetDMapFlag void SetDMapFlag bool GetItemPickup void SetItemPickup bool GetNPCMiscFlag bool GetLevelItem bool GetLevelItem void SetLevelItem void SetLevelItem lweapon NextToLink lweapon NextToLink eweapon NextToNPC eweapon NextToNPC void AimEWeapon void AimLWeapon void AimLWeapon int WeaponTypeToID npc CreateNPCAt item CreateItemAt lweapon CreateLWeaponAt eweapon CreateEWeaponAt void Remove int NumLWeaponsOf int NumEWeaponsOf int NumNPCsOf int NumItemsOf lweapon LoadLWeaponOf eweapon LoadEWeaponOf npc LoadNPCOfType npc LoadNPCOf item CreateTimeoutItem int GridX int GridY int AtFrontX int AtFrontY int InFrontX int InFrontY int CenterX int CenterY int CenterX int CenterY int CenterX int CenterY int CenterX int CenterY int CenterLinkX int CenterLinkY int ComboAt int ComboX int ComboY bool ComboFI bool ComboFI int GetLayerComboD void SetLayerComboD int GetLayerComboF void SetLayerComboF int GetLayerComboT void SetLayerComboT int GetLayerComboS void SetLayerComboS int FirstComboOf int LastComboOf int FirstComboTypeOf int LastComboTypeOf int FirstComboFlagOf int LastComboFlagOf bool IsWater bool IsPit void SwapTileRow void CopyTileRow void ClearTileRow void SwapTileBlock void CopyTileBlock void ClearTileBlock void Waitframes void NoAction void WaitNoAction void WaitNoAction void ScreenCopy int FFCNum int NumTriforcePieces void GetNPCName void GetMessage itemdata GetItemData int GetHighestLevelItem int GetHighestLevelItem bool IsSideview int DMapToMap int MapToDMap
Back to Top
Pages: Global | FFC | Link | Screen | Item | Weapon | Itemdata | Game | NPC | std | string

std Documentation

Functions and Properties

Return Type Function Information
floatLogToBase(float x, float base)
Returns the logarithm of x to the given base
intFloor(float x)
Truncates x to an integer
intCeiling(float x)
Raises x to the nearest integer
intRound(float x)
Rounds x to the nearest integer
intVBound(int x, int high, int low)
Bounds x between two values
intDiv(float x, float y)
Modulo's complement; returns the quotient only of x divided by y
intRand(int min, int max)
Overload to rand, returning a random integer in the bounds of min and max
floatRandf(float n)
Returns a random floating point number up to n
floatRandf(float n1, float n2)
Overloaded to take two boundaries as arguments
floatDegtoRad(float d)
Converts 'd' in degrees to radians
floatRadtoDeg(float r)
Converts 'r' in radians to degrees
intSign(int n)
Returns the sign of n
floatDistance(int x1, int y1, int x2, int y2)
Returns the distance between two sets of coordinates using Pythagoras' Theorem
floatAngle(int x1, int y1, int x2, int y2)
Returns the direction of the vector from point 1 to point 2, in degrees from -180 to 180. (0 = right)
floatRadianAngle(int x1, int y1, int x2, int y2)
The above, but in radians.
floatVectorX(int len, float angle)
Returns the X component of a vector with a degree angle.
A length of 3 and angle of 0 returns 3.
A length of 3 and angle of 45 returns approx. 1.57.
A length of 3 and angle of 90 returns 0.
floatVectorY(int len, float angle)
Returns the Y component of a vector with a degree angle.
A length of 3 and angle of 0 returns 0.
A length of 3 and angle of 45 returns approx. 1.57.
A length of 3 and angle of 90 returns 3.
floatLerp(float p1, float p2, float t)
Interpolates between p1 and p2 given 't' clamped within range 0,1.
floatDotProduct(float x1, float y1, float x2, float y2)
Returns the dot product of two vectors.
floatCrossProduct(float x1, float y1, float x2, float y2)
Returns the cross product of two vectors.
floatDistanceSquared(float x, float y)
Returns the squared distance of a vector.
floatMidpoint(float p1, float p2)
Finds the center of p1 and p2.
floatSmoothStep(float p1, float p2, float t)
Performs a "Smooth" Interpolation given 't' clamped within range 0,1.
floatWrapAngle(float radians)
Wraps radian value towards the range of -PI,PI.
floatWrapDegrees(float degrees)
Wraps degree value towards the range of -180,180.
floatTurnTowards(int X, int Y, int targetX, int targetY, float radian_angle, float t)
Returns an angle pointing (t)percentage more accurate to the target than the specified radian_angle.
intAngleDir8(float angle)
Converts a counterclockwise degree angle (from -180 to 180) into one of the eight
standard directions (DIR_UP etc.) used by ZC.
intRadianAngleDir8(float angle)
The above, but for radian angles.
intAngleDir4(float angle)
Converts a counterclockwise degree angle (from -180 to 180) into one of the four
standard directions (DIR_UP, DIR_DOWN, DIR_LEFT, DIR_RIGHT) used by ZC.
intRadianAngleDir4(float angle)
The above, but for radian angles.
intOppositeDir(int dir)
Returns the opposite direction to 'dir'
intSpinDir(int dir)
Converts directions to go round in a circle rather than U, D, L, R
voidDrawString(int layer, int x, int y, int font, int color, int background_color, int format, int opacity, int string, int start)
Overload to Screen->DrawString which includes a position to start drawing from in the string
Does not check for overflow
Overload to Screen->DrawString which includes a start and end position to draw the string
Does not check for overflow
voidDrawString(int layer, int x, int y, int font, int color, int background_color, int format, int opacity, int string, int start, int end)
Overload to Screen->DrawString which includes a start and end position to draw the string
Does not check for overflow
 A very simple layer 0 tile drawing routine.
voidDrawTileSimple(int x, int y, int tile, int color)
 A very simple layer 0 tile drawing routine.
voidDrawToLayer(T ptr, int layer, int opacity)
Draws a pointer to given layer. Overloaded to take all pointers as arguments
TCond(bool cond, T a, T b)
Returns a if cond is true, else b. Overloaded to take all types as arguments
floatChoose(float a, float b)
Chooses one of the options randomly and fairly.
floatChoose(float a, float b, float c)
Chooses one of the options randomly and fairly.
floatChoose(float a, float b, float c, float d)
Chooses one of the options randomly and fairly.
floatChoose(float a, float b, float c, float d, float e)
Chooses one of the options randomly and fairly.
floatChoose(float a, float b, float c, float d, float e, float f)
Chooses one of the options randomly and fairly.
boolRectCollision(int box1_x1, int box1_y1, int box1_x2, int box1_y2, int box2_x1, int box2_y1, int box2_x2, int box2_y2)
Generalized and optimized rectangle collision checking function.
Returns true if the bounding box of box1 and box2 overlap.
boolSquareCollision(int c1x, int c1y, int side1, int c2x, int c2y, int side2)
Check for collisions of two squares given upper-left coordinates and a side length for each.
boolSquareCollision2(int c1x, int c1y, int radius1, int c2x, int c2y, int radius2)
Check for collisions of two squares given center coordinates and a halved side length for each.
boolCircleCollision(int c1x, int c1y, int radius1, int c2x, int c2y, int radius2)
Returns true if the two circles c1 and c2 overlap.
boolCollision(T a, S b)
Returns true if there is a collision between the hitboxes of any two pointers
boolLinkCollision(T ptr)
Returns true if there is a collision between Link's hitbox and any pointer's
intHitboxLeft(T ptr)
Returns the X coordinate of the left edge of the hitbox for any pointer
intHitboxTop(T ptr)
Returns the Y coordinate of the top edge of the hitbox for any pointer
intHitboxRight(T ptr)
Returns the X coordinate of the right edge of the hitbox for any pointer
intHitboxBottom(T ptr)
Returns the Y coordinate of the bottom edge of the hitbox.
boolCanWalk(int x, int y, int dir, int step, bool full_tile)
This should allow any scripted object to easily mimic Link styled LOZ solidity collision
checking, be it Link, FFCs, or enemies.
Note - You should use full_tile=true if you don't want the upper eight pixels to overlap
solid combos as per LOZ1 behavior.
boolOnSidePlatform(int x, int y)
Returns true if the sprite at (x,y) is standing on a sideview platform on a sideview screen, as worked out
by ZC's internal code.
boolOnSidePlatform(int x, int y, int xOff, int yOff, int h)
Returns true if the sprite at (x,y) is standing on a sideview platform on a sideview screen, as worked out
by ZC's internal code.
voidSetScreenDBit(int dmap, int screen, int d, int bit, bool state)
Sets bit 'bit' of Screen->D[] register 'd' to 'state', overloaded to set on other screens
voidSetScreenDBit(int screen, int d, int bit, bool state)
Sets bit 'bit' of Screen->D[] register 'd' to 'state', overloaded to set on other screens
voidSetScreenDBit(int d, int bit, bool state)
Sets bit 'bit' of Screen->D[] register 'd' to 'state', overloaded to set on other screens
boolGetScreenDBit(int dmap, int screen, int d, int bit)
Returns the state of bit 'bit' of Screen->D[] register 'd'
Overloaded to get from other screens
boolGetScreenDBit(int screen, int d, int bit)
Returns the state of bit 'bit' of Screen->D[] register 'd'
Overloaded to get from other screens
boolGetScreenDBit(int d, int bit)
Returns the state of bit 'bit' of Screen->D[] register 'd'
Overloaded to get from other screens
boolInputLeftClick()
Returns true if the left mouse button is pressed
boolInputRightClick()
Returns true if the right mouse button is pressed
intGetEquipmentA()
Returns the item ID of the item equipped to Link's A button
intGetEquipmentB()
Returns the item ID of the item equipped to Link's B button
boolUsingItem(int id)
Returns true if Link is using item 'id'
intScreenFlag(int category, int flag)
Returns 1 if Screen Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
Flags are numbered starting from 0
intScreenEFlag(int category, int flag)
Returns 1 if Screen Enemy Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
Flags are numbered starting from 0
boolGetDMapFlag(int dmap, int flag)
Returns true if DMap Flag 'flag' is set on dmap 'dmap'
voidSetDMapFlag(int dmap, int flag, bool state)
Sets a certain DMap flag to 'state'
boolGetItemPickup(item i, int pickup)
Returns true if an item's Pickup state is set
Use the IP_ constants for the 'pickup' argument of this function
voidSetItemPickup(item i, int pickup, bool state)
Sets an item's Pickup state to 'state'
boolGetNPCMiscFlag(npc e, int flag)
Returns true if an npc's Misc. flag is set.
boolGetLevelItem(int level, int itm)
Returns true if Link has the level item 'itm' from level 'level'
Overloaded to use the current level if no 'level' arg is entered
Use the LI_ constants for the 'itm' argument
boolGetLevelItem(int itm)
Returns true if Link has the level item 'itm' from level 'level'
Overloaded to use the current level if no 'level' arg is entered
Use the LI_ constants for the 'itm' argument
voidSetLevelItem(int level, int itm, bool state)
Gives or removes a level item from Link's inventory
voidSetLevelItem(int itm, bool state)
Gives or removes a level item from Link's inventory
lweaponNextToLink(int id, int distx, int disty)
Creates an lweapon at 'distx, disty' away from where Link is facing
lweaponNextToLink(int id, int dist)
Creates an lweapon at 'distx, disty' away from where Link is facing
eweaponNextToNPC(npc n, int id, int distx, int disty)
Creates an eweapon at 'distx, disty' away from where npc 'n' is facing
eweaponNextToNPC(npc n, int id, int dist)
Creates an eweapon at 'distx, disty' away from where npc 'n' is facing
voidAimEWeapon(eweapon e, int aimtype)
Aims eweapon e according to the AT_* constant passed to aimtype
voidAimLWeapon(apon Functions and Variables.html'>lweapon l, npc n, int aimtype)
Aims lweapon l according to the AT_* constant passed to aimtype, overloaded to shoot
at an npc or at random
voidAimLWeapon(lweapon l, int aimtype)
Aims lweapon l according to the AT_* constant passed to aimtype, overloaded to shoot
at an npc or at random
intWeaponTypeToID(int weapontype)
Turns a WPN_* constant to an EW_* constant
npcCreateNPCAt(int id, int x, int y)
Create an NPC and set its X and Y position in one command
itemCreateItemAt(int id, int x, int y)
Create an Item and set its X and Y position in one command
lweaponCreateLWeaponAt(int id, int x, int y)
Create an LWeapon and set its X and Y position in one command
eweaponCreateEWeaponAt(int id, int x, int y)
Create an EWeapon and set its X and Y position in one command
voidRemove(T n)
Removes sprite 'n' from the screen. Overloaded.
intNumLWeaponsOf(int type)
Returns the number of lweapons of type 'type' currently on the screen
intNumEWeaponsOf(int type)
Returns the number of weapons of type 'type' currently on the screen
intNumNPCsOf(int type)
Returns the number of npcs of type 'type' currently on the screen
intNumItemsOf(int type)
Returns the number of items of type 'type' currently on the screen
lweaponLoadLWeaponOf(int type)
Returns the first LWeapon of the given type. Use the LW_ constants.
If none exist, it returns an uninitialised pointer.
eweaponLoadEWeaponOf(int type)
Returns the first EWeapon of the given type. Use the EW_ constants.
If none exist, it returns an uninitialised pointer.
npcLoadNPCOfType(int type)
Returns the first NPC of the given type. Use the NPCT_ constants.
If none exist, it returns an uninitialised pointer.
npcLoadNPCOf(int type)
Returns the first NPC of the given ID. Use the NPC_ constants.
If none exist, it returns an uninitialised pointer.
itemCreateTimeoutItem(int id, int x, int y)
Creates a timeout item (such as a rupee or heart) with ID 'id' at '(x, y)'
intGridX(int x)
Snaps 'x' to the combo grid
Equivalent to calling ComboX(ComboAt(x, foo));
intGridY(int y)
Snaps 'y' to the combo grid
Equivalent to calling ComboY(ComboAt(foo, y));
intAtFrontX(int dir)
Returns the correct offset to be at the front of a sprite facing in
the direction 'dir'
intAtFrontY(int dir)
Returns the correct offset to be at the front of a sprite facing in
the direction 'dir'
intInFrontX(int dir, int dist)
Returns the correct offset to be 'dist' pixels away from the front of
a sprite facing in the direction 'dir'
intInFrontY(int dir, int dist)
Returns the correct offset to be 'dist' pixels away from the front of
a sprite facing in the direction 'dir'
intCenterX(ffc anFFC)
Returns the X or Y coordinate at the center of the given sprite.
intCenterY(ffc anFFC)
Returns the X or Y coordinate at the center of the given sprite.
intCenterX(npc anNPC)
Returns the X or Y coordinate at the center of the given sprite.
intCenterY(npc anNPC)
Returns the X or Y coordinate at the center of the given sprite.
intCenterX(eweapon anEWeapon)
Returns the X or Y coordinate at the center of the given sprite.
intCenterY(eweapon anEWeapon)
Returns the X or Y coordinate at the center of the given sprite.
intCenterX(lweapon anLWeapon)
Returns the X or Y coordinate at the center of the given sprite.
intCenterY(lweapon anLWeapon)
Returns the X or Y coordinate at the center of the given sprite.
intCenterLinkX()
Returns the X or Y coordinate at the center of the given sprite.
intCenterLinkY()
Returns the X or Y coordinate at the center of the given sprite.
intComboAt(int x, int y)
Finds the location of a combo, given its (x,y) coordinates on the screen
intComboX(int loc)
Return the coordinates of a combo on the screen
intComboY(int y)
Return the coordinates of a combo on the screen
boolComboFI(int x, int y, int flag)
Returns true if the combo at '(x, y)' or 'loc' has either an
inherent or placed flag of type 'flag'
boolComboFI(int loc, int flag)
Returns true if the combo at '(x, y)' or 'loc' has either an
inherent or placed flag of type 'flag'
intGetLayerComboD(int layer, int pos)
A shorthand way to get a combo on the current layer.
Layer 0 is the screen itself.
voidSetLayerComboD(int layer, int pos, int combo)
A shorthand way to set a combo on the current layer.
Layer 0 is the screen itself.
intGetLayerComboF(int layer, int pos)
A shorthand way to get a combo flag on the current layer.
Layer 0 is the screen itself.
voidSetLayerComboF(int layer, int pos, int flag)
A shorthand way to set a combo flag on the current layer.
Layer 0 is the screen itself.
intGetLayerComboT(int layer, int pos)
A shorthand way to get a combo type on the current layer.
Layer 0 is the screen itself.
voidSetLayerComboT(int layer, int pos, int type)
A shorthand way to set a combo type on the current layer.
Layer 0 is the screen itself.
intGetLayerComboS(int layer, int pos)
A shorthand way to get a combo's solidity on the current layer.
Layer 0 is the screen itself.
voidSetLayerComboS(int layer, int pos, int solidity)
A shorthand way to set a combo's solidity on the current layer.
Layer 0 is the screen itself.
intFirstComboOf(int t, int layer)
Returns the position of the first instance of the given combo, or -1.
intLastComboOf(int t, int layer)
Returns the position of the last instance of the given combo, or -1.
intFirstComboTypeOf(int t, int layer)
Returns the position of the first instance of the given combo, or -1.
intLastComboTypeOf(int t, int layer)
Returns the position of the last instance of the given combo, or -1.
intFirstComboFlagOf(int t, int layer)
Returns the position of the first instance of the given combo flag, or -1.
Checks inherent flags too!
intLastComboFlagOf(int t, int layer)
Returns the position of the last instance of the given combo flag, or -1.
Checks inherent flags too!
boolIsWater(int position)
Returns true if the combo at the given position is water or a swim or dive warp. Shallow water doesn't count.
boolIsPit(int position)
Returns true if the combo at the given position is a pit.
voidSwapTileRow(int first, int second, int length)
Swaps a row of tiles of length 'length' between positions 'first' and 'second'
voidCopyTileRow(int source, int dest, int length)
Copies a row of tiles of length 'length' from 'source' onto 'dest'
voidClearTileRow(int ref, int length)
Clears a row of tiles of length 'length' starting from tile 'ref'
voidSwapTileBlock(int first, int last, int second)
Swaps a block of tiles defined by diagonal corners 'first' and 'last'
with the block starting with top left tile 'second'
voidCopyTileBlock(int sourcefirst, int sourcelast, int destfirst)
Copies a block of tiles defined by diagonal corners 'sourcefirst' and 'sourcelast'
onto the block starting with top left tile 'destfirst'
voidClearTileBlock(int reffirst, int reflast)
Clears a block of tiles defined by diagonal corners 'reffirst' and 'reflast'
voidWaitframes(int n)
Wait for 'n' frames
voidNoAction()
Kills all of Link's inputs
voidWaitNoAction()
NoAction, then Waitframe or (equivalent of) Waitframes
voidWaitNoAction(int frames)
NoAction, then Waitframe or (equivalent of) Waitframes
voidScreenCopy(int destmap, int destscr, int srcmap, int srcscr)
Copies the combos and csets from one screen to another.
Only copies layer 0!
intFFCNum(ffc f)
Returns the number of an FFC, and -1 for a non-valid FFC (which should never happen)
intNumTriforcePieces()
Returns the number of Triforce Pieces Link currently has
voidGetNPCName(int ID, int string[])
Puts the name of an npc into a string
voidGetMessage(int ID, int string[])
Puts string 'ID' into 'string', removing the trailing spaces.
itemdataGetItemData(item i)
Returns an itemdata pointer from an item pointer
intGetHighestLevelItem(int itemclass)
Returns the highest level item of a given itemclass, or of the class 'i' belongs to
intGetHighestLevelItem(item i)
Returns the highest level item of a given itemclass, or of the class 'i' belongs to
boolIsSideview()
Returns true if Link is on a sideview screen
intDMapToMap(int screen, int dmap)
Convert between map and DMap screen coordinates
intMapToDMap(int screen, int dmap)
Convert between map and DMap screen coordinates