GridButton

GridButton
int GridButton ( 'fixed X, fixed Y, int hudid, int SizeX, int SizeY, int Index, int OriginX, int OriginY, int TileX, int TileY, int Window, int Modifier, int Amount )''

Function is located within Inventory/script/HUD_Funcs.dh

Parameters:
''note: the large amount of parameters is necessary to pass them on to resulting functions. ''
 * X/Y - fixed coordinates for button graphic origin
 * hudid - HudMessage ID#
 * SizeX/Y - integer sizes of item
 * Index - Index of item on ItemList[]
 * OriginX/Y - origin spot of this item on the array
 * TileX/Y - tile integer position on array
 * Window - integer pointer to the Window pointer array (ie WINDOW_INVENTORY, WINDOW_CHEST)
 * Modifier - Modifier value of this array spot
 * Amount - amounts stacked in this array spot

Description:
GridButton makes up the majority of display and interaction within the inventory system. In any two-dimensional array, grid buttons represent the item contained at their OriginX/OriginY positions.

In cases where GridButton's Index is not ITEM_NOTHING, it draws Itemlist[Index].ICON at coordinates derived from the items origin and X/Y+Window offsets, runs DisplayDurabilityBar if the current item has durability, DisplayAmount for stackables, then waits for the cursor coordinates to intersect its position, and runs WaitForCursorText and HighlightSelection. If a click is detected, it returns the click type (MOUSE_LMB/_RMB).

In cases where GridButton's Index is ITEM_NOTHING, it does not display an image, but still responds to clicks. If the player is carrying an item on the cursor, it will run HighlightArea.

Notes:
Currently there are some extra graphic and tile offset instructions contained within GridButton due to my hacky code. These may be replaced by extra offset parameters when I get around to it.