From 677b7454a37a0152f50d40993460d8f5a071e181 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 5 Mar 2013 14:17:08 -0800 Subject: Map editor 0.1! --- js/mapspecs.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/mapspecs.js b/js/mapspecs.js index 2387a00..443ddfe 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -92,6 +92,12 @@ function grid_click(obj) { y = tmp[1]; x = tmp[2]; + + if(mapdata[mapid].editMap == true) { + mapClick(obj); + return; + } + //The users solution - prepare it if it's not started if (solution[mapid] == undefined) { getmapdata(mapid); @@ -838,7 +844,7 @@ var Tile = { "x" : "Single-Path-Rock"}; //Map as object. If target width is NULL or False, default width is used. -function mapAsHTML(map, targetWidth, demo) { +function mapAsHTML(map, targetWidth, mapEditor) { map.mapid = map.ID; //console.log("MapID:", map.mapid); @@ -872,9 +878,9 @@ function mapAsHTML(map, targetWidth, demo) { // GOAL WOULD BE THIS LINE INSTEAD.. As it's not retarded. //var idHandle = map.ID+','+x+','+y; - + //oldy is used for Position too... for now - if (type == 'o') { + if (type == 'o' || mapEditor == true) { mapgrid += "
"; mapgrid += "
"; } else { @@ -885,6 +891,8 @@ function mapAsHTML(map, targetWidth, demo) { } mapgrid += ''; + if (mapEditor == true) return mapgrid; + var r = ''; //TODO: Track down where that 1 pixel is comingfrom, width-1 is a hack. -- cgit v1.2.3