Overworld

From ENIGMA
Jump to navigation Jump to search

TODO: Explain what the Overworld resource is.

This page is the site of plans for the Overworld resource and for the room system extension.

Try to keep it productive, and let the admins decide whose ideas are to just be deleted. Don't start an edit war. If two functions are in dispute and no one can agree, which I think is unlikely, just leave them both in.

Room Region Functions

  • room_region_create(x,y,w,h): Inconvenience function to create a new region. Returns the index of the region created. Operates in O(N), N=number of existing regions.
  • room_region_destroy(reg): Function to remove a region from the room.
  • room_region_contains(reg,obj): Returns whether an object matching the passed id is contained inside a region. If an object index is passed, the first instance by that object index is checked.
  • room_region_count(): Returns the number of room regions in the current room. The user can iterate room regions by counting from 0 to this value.
  • room_region_get_coords(reg): Returns an array of coordinates in the format [x1,y1,x2,y2].
  • instance_deactivate_region(reg): Deactivates all instances in the given region.
  • instance_activate_region(reg): Activates all instances in the given region.
  • instance_deactivate_outside_region(reg): Deactivates all instances outside of the given region.

Overworld Functions

  • overworld_get_room_coordinates(room) Returns an array of the coordinates of the first room by the given id. Coordinates are in format [x1,y1,x2,y2].
  • overworld_get_room_coordinates(name) Same as its room id overload, but returns coordinates of the room with the given name in the Overworld.
  • overworld_get_absolute_coordinates(x,y) Returns the overworld coordinates matching the given room-coordinates in the current room, as an array of [x,y].
  • overworld_get_room_coordinates(overworld_x,overworld_y) Returns the room coordinates as an array of [x,y] inside the room containing the given absolute coordinates.
  • overworld_get_room_at(x,y): Returns the id of the room containing the given absolute coordinates.
  • overworld_get_name_at(x,y): Returns the name of the room containing the given absolute coordinates.