MAP interface implements a two-dimensional map of fixed-size tiles, which are
stacks of elements
Element types include:
Graphical elements define two displacements in pixels of the image from the tile's origin, the centering offset and the motion offset.
The centering offset is typically assigned by a level designer, and the motion offset is for animation purposes. If the map is drawn scaled, the centering offset is scaled to the tile size, but the motion offset is not.
Graphical elements provide the renderer with a list of graphical transformations that should be applied before the tile is drawn (the resulting tile is cached). A per-element layer attribute also defines the attributed layer.
The MAP_NodeInit() function initializes a node. The MAP_NodeDestroy() function frees resources allocated by a node (such as the item stack). To reinitialize a node, this function must be followed by MAP_NodeInit().
The MAP_NodeLoad() function loads a node from ds, returning 0 on success or -1 on failure. MAP_NodeSave() saves a node to ds.
The MAP_ItemInit() function initializes a node element structure.
The MAP_ItemSetCenter() function sets the centering offset of a graphical element. MAP_ItemSetMotion() sets the motion offset of a graphical element.
The functions MAP_ItemSetTile() and MAP_ItemSetAnim() associate a new tile or animation to the element r (of type MAP_ITEM_TILE).
The MAP_ItemSetLayer() function associates the graphical element r with the given layer. The layer does not need to exist; the element will not be visible if that is the case.
The MAP_ItemDestroy() function frees the resources reserved by a node element. It must be followed by MAP_ItemInit to reinitialize the node element structure.
The MAP_NodeMoveItem() function moves src_r from src_node to the node at specific map coordinates and returns 0, or -1 if the coordinates are outside of dst_map. The element is associated with the layer dlayer, unless it is -1.
The MAP_NodeCopyItem() function inserts a copy of src_r on top of dst_node, and associate with dst_layer (unless it is -1).
The MAP_NodeDelItem() function detaches and destroys the given node element.
The MAP_NodeAddTile() function creates a graphical element (a reference to a RG_Tile(3)), where tileID is a tile name (an index into the tiletbl of a RG_Tileset(3)).
The MAP_NodeAddAnim() function creates an animation element (a reference to a RG_Anim(3)), where animID is an animation name (an index into the animtbl of a RG_Tileset(3)).
MAP_NodeAddWarpPoint() Creates a warp point, where targetMap is the pathname of the destination map (as returned by AG_ObjectCopyName()), and the x, y and dir arguments describe the initial position and direction of the object (whatever it may be) in the destination map.
MAP_AttachActor() attaches the given actor to the map. An object dependency is automatically created, and the map operation of the actor is invoked. This operation is usually responsible for inserting tiles onto the map.
MAP_DetachActor() detaches the given actor from the map. Any pending timer events related to the actor are cancelled, tiles related to the actor are removed and the object dependency is removed.
See MAP_Actor(3) for more information.
|AG_Object(3), MAP_Actor(3), MAP_View(3), SG_Intro(3)|
|The MAP class first appeared in Agar 1.0.|