Lua Map Maker
By Merick

3/24/07
Changes for v0.9

--	found out that the version of lua player that I was using would sometimes
	crash & freeze the psp when loading images, so I've gone back to using Cool's mod 3

--	I've re-done the tile system to use tile sheets instead of loose tiles
	and have added a function to let you create a list of tile sheets to use
	-- only works with tilesheets where the tiles are all square and have the same
		size and do not have any borders between them
	-- in order to display the tiles correctly, you must now
		 set the tile size to the exact size of the tiles in the tile sheets

--	 the format of the map table has been changed
		
--	controls have changed, see below

--	have added options to save the map as screen shots in png format
	the images created will be named as the project name followed by the
	x and y positions of each screen  and will be located in the project folder


3/19/07
Changes for v0.6

--	fixed a small bug in the save menu
--	empty map locations are now set to nil
--	modified map drawing routines, drawing speed should now be noticably faster
	on larger sized maps

3/15/2007

changes for version 0.5

-- LuMM is now a stand-alone app, using Soulkiller's mod of Cool's mod 3
 
    http://forums.evilmana.com/index.php?topic=526.0
    
quote:
	Image.startBlit()

	Call this function to begin blitting, you MUST do this in order to make fastBlit calls	

	Image:fastBlit( x, y, image [subX, subY, width, height,] alpha)

	This is the function that you call in between Image.startBlit and Image.endBlit, Its pretty much exactly 
	the same thing as a normal Image:blit call and the arguments are for it are the same

	Image.endBlit()

	Call this function to end blitting. Image:fastBlit functions may not be after this unless a new call to Image.startBlit() is made
end quote

  this function increases the speed of blitting images for tile maps, but there is a bug which prevents transparencies so I'm currently only using it for the
  map base layer

-- small change in control layout for menus - all menus now use start button to accept selection

-- my previous method of refrencing tile image was inadequate, any changes to the files in the tile folder
    would completely alter the order in which the images were refrenced. To fix this, I've now made it so that 
    the tile images are refrenced by the image filenames.

-- I've also made the tile loading function more intelligent,  it will now only attempt to load files that acutally are images
   only .jpg and .png are

-- Added a view checking function to the map base layer so that it only blits the tiles that are actually inside the current viewing area

-- added a description of the map table format to this readme 

end of changelog

This is a basic 2d tile map editor for lua games.

Features:

edits map in 3 layers: 
	base layer  : the basic map area
	object layer  : assigns a number value to the current tile area
	overlay layer : this layer is for images that the player can walk behind, or images
		with transparency that you want to be drawn over the base layer, I.E. putting an image
		of a lamp post in front of a house

saves / loads map data to a .map file

Controls:

menus - d-pad up/down to change selection, start to select

text input for create new project:
	left trigger = numbers
	right trigger = shift
	D-pad up = backspace
	start = accept name
	analog and buttons = select letter


map edit mode:
	start = brings up system menu
	d-pad = change current map position
	square = set tile/object code
	cross = erase tile/object code
	right trigger = cycle through layers
	
	in base layer or overlay layer:
		hold down triangle + tap d-pad = select tile
		hold down triangle + tap left shoulder = cycle through loaded tile sheets
		
	in object layer:
		triangle/circle = change number for object code
		
		
Format of map table:

map.tileimg = {}		-- tile sheet image data
map.tilename = {}     	-- tile sheet filenames
map.tilesize 			-- size of the tiles in the tile sheets
map.xsize				-- map width in tiles
map.ysize				-- map height in tiles	
map[x][y]				-- stores map data

	map[x][y].tileS 	-- tile sheet to use for this map location in base layer
	map[x][y].tileX 	-- X start position for the tile at this location in base layer
	map[x][y].tileY 	-- Y start position for the tile at this location in base layer

	map[x][y].otileS 	-- tile sheet to use for this map location in overlay
	map[x][y].otileX 	-- X start position for the tile at this location in overlay
	map[x][y].otileY 	-- Y start position for the tile at this location in overlay

	map[x][y].object	-- stores number value, in your program you can use this for placing path barriers
							or game objects (treasure chests, switches, etc)

Credits:

File browser edited from Tactical Penguin's demo
Uses cancan's version of the Danzeff OSK for text input

tablesave functions - author unknown but found at:
      http://lua-users.org/wiki/SaveTableToFile

The sample tile sheets included were found on http://www.gaminggroundzero.com/home.html

Special thanks to everyone at QJ.net, Evilmana, and PSP3d 
who help me figure some of this stuff out.