From f98c85442f3f0c561d5332c17e1f80386a345542 Mon Sep 17 00:00:00 2001 From: oc Date: Wed, 20 Feb 2019 21:30:30 +0800 Subject: [PATCH] 48 in bg/fg --- _server/editor.js | 30 +++++++++++++----------------- libs/maps.js | 9 +++++++-- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index 2f184f30..42d8c154 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -797,25 +797,21 @@ editor.prototype.listen = function () { currDrawData.info = JSON.parse(JSON.stringify(editor.info)); reDo = null; // console.log(stepPostfix); - if (editor.layerMod!='map' && editor.info.images && editor.info.images.indexOf('48')!==-1){ - printe('前景/背景不支持48的图块'); - } else { - if(editor.brushMod==='tileset' && core.tilesets.indexOf(editor.info.images)!==-1){ - var imgWidth=~~(core.material.images.tilesets[editor.info.images].width/32); - var x0=stepPostfix[0].x; - var y0=stepPostfix[0].y; - var idnum=editor.info.idnum; - for (var ii = 0; ii < stepPostfix.length; ii++){ - if(stepPostfix[ii].y!=y0){ - y0++; - idnum+=imgWidth; - } - editor[editor.layerMod][stepPostfix[ii].y][stepPostfix[ii].x] = editor.ids[editor.indexs[idnum+stepPostfix[ii].x-x0]]; + if(editor.brushMod==='tileset' && core.tilesets.indexOf(editor.info.images)!==-1){ + var imgWidth=~~(core.material.images.tilesets[editor.info.images].width/32); + var x0=stepPostfix[0].x; + var y0=stepPostfix[0].y; + var idnum=editor.info.idnum; + for (var ii = 0; ii < stepPostfix.length; ii++){ + if(stepPostfix[ii].y!=y0){ + y0++; + idnum+=imgWidth; } - } else { - for (var ii = 0; ii < stepPostfix.length; ii++) - editor[editor.layerMod][stepPostfix[ii].y][stepPostfix[ii].x] = editor.info; + editor[editor.layerMod][stepPostfix[ii].y][stepPostfix[ii].x] = editor.ids[editor.indexs[idnum+stepPostfix[ii].x-x0]]; } + } else { + for (var ii = 0; ii < stepPostfix.length; ii++) + editor[editor.layerMod][stepPostfix[ii].y][stepPostfix[ii].x] = editor.info; } // console.log(editor.map); editor.updateMap(); diff --git a/libs/maps.js b/libs/maps.js index e8e3c0e4..3ad953a4 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -432,11 +432,16 @@ maps.prototype.drawBlock = function (block, animate, dx, dy) { if (!blockInfo.isTileset) x = (animate||0)%(block.event.animate||1); if (core.isset(block.name)) { - core.clearMap(block.name, block.x * 32, block.y * 32, 32, 32); + core.clearMap(block.name, block.x * 32, block.y * 32 + 32 - height, 32, height); if (block.name == 'bg') { + if (height>32) { + core.clearMap(block.name, block.x * 32, block.y * 32 - 32, 32, 32); + core.drawImage('bg', core.material.groundCanvas.canvas, block.x * 32, block.y * 32 - 32); + } core.drawImage('bg', core.material.groundCanvas.canvas, block.x * 32, block.y * 32); } - core.drawImage(block.name, image, x * 32, y * 32, 32, 32, block.x * 32, block.y * 32, 32, 32); + core.drawImage(block.name, image, x * 32, y * height, 32, height, + block.x * 32, block.y * 32 + 32 - height, 32, height); return; }