...省略... var nDirAdd4 = [new Vec2(0, 0), new Vec2(0, 1), new Vec2(-1, 0), new Vec2(1, 0), new Vec2(0, -1)]; var nAutoTipOffset = [ new Vec2(0, 0), new Vec2(2, 0), new Vec2(2, 0), new Vec2(2, 2), new Vec2(2, 0), new Vec2(0, 2), new Vec2(2, 0), new Vec2(1, 2), new Vec2(2, 0), new Vec2(2, 0), new Vec2(2, 4), new Vec2(2, 3), new Vec2(0, 4), new Vec2(0, 3), new Vec2(1, 4), new Vec2(1, 3) ]; ...省略... function getAutoSPos(pos, idx) { var metip = nMapTip[nMapData.data[pos.y][pos.x][idx]]; var ret = new Vec2(metip.imgpos.x * TIP_SIZE.x, metip.imgpos.y * TIP_SIZE.y); if(metip.auto != 1) return ret; var zorder = nMapData.data[pos.y][pos.x][idx + 1]; var b4 = [false, false, false, false]; var find; var add; var i; var j; var no; for(i = 0; i < 4; i++){ add = new Vec2(nDirAdd4[i + 1]); add.x *= 2; add.y *= 2; if(nMapData.isoutdata(pos.y + add.y, pos.x + add.x) == true) continue; for(j = 0; j < nMapData.data[pos.y + add.y][pos.x + add.x].length; j += 2){ if(zorder == nMapData.data[pos.y + add.y][pos.x + add.x][j + 1]){ find = nMapTip[nMapData.data[pos.y + add.y][pos.x + add.x][j]]; if(find.tipno == metip.tipno) b4[i] = true; } } } j = 1; no = 0; for(i = 0; i < 4; i++){ if(b4[i]) no += j; j *= 2; } find = nAutoTipOffset[no]; ret = new Vec2((metip.imgpos.x + find.x) * TIP_SIZE.x, (metip.imgpos.y + find.y) * TIP_SIZE.y); return ret; } ...省略...
...省略... function getAutoSPos(pos, idx) { var metip = nMapTip[nMapData.data[pos.y][pos.x][idx]]; var ret = new Vec2(metip.imgpos.x * TIP_SIZE.x, metip.imgpos.y * TIP_SIZE.y); if(metip.auto != 1) return ret; var zorder = nMapData.data[pos.y][pos.x][idx + 1]; var b4 = [0x0000, 0x0001, 0x0002, 0x0004, 0x0008]; var flg = b4[0]; var find; var add; var i; var j; var no; for(i = 0; i < 4; i++){ add = new Vec2(nDirAdd4[i + 1]); add.x *= 2; add.y *= 2; if(nMapData.isoutdata(pos.y + add.y, pos.x + add.x) == true) continue; for(j = 0; j < nMapData.data[pos.y + add.y][pos.x + add.x].length; j += 2){ if(zorder == nMapData.data[pos.y + add.y][pos.x + add.x][j + 1]){ find = nMapTip[nMapData.data[pos.y + add.y][pos.x + add.x][j]]; if(find.tipno == metip.tipno) flg = (flg|b4[i + 1]); } } } find = nAutoTipOffset[flg]; ret = new Vec2((metip.imgpos.x + find.x) * TIP_SIZE.x, (metip.imgpos.y + find.y) * TIP_SIZE.y); return ret; } ...省略...