From: Koichi Kamichi Date: Sun, 24 Jan 2016 04:12:21 +0000 (+0900) Subject: 2 updates. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=45dfe74aad98a359dd6e8a0ad46adcb7b3dcfa66;p=chise%2Fkage.git 2 updates. --- diff --git a/kagecd.js b/kagecd.js old mode 100644 new mode 100755 index 220df57..876b943 --- a/kagecd.js +++ b/kagecd.js @@ -329,25 +329,27 @@ function cdDrawCurveU(kage, polygons, x1, y1, sx1, sy1, sx2, sy2, x2, y2, ta1, t // suiheisen ni setsuzoku 2 if(a1 == 22){ - var index = 0; - while(true){ - if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){ - break; + if(x1 > sx1){ + var index = 0; + while(true){ + if(poly2.array[index].y <= y1 && y1 <= poly2.array[index + 1].y){ + break; + } + index++; } - index++; - } - newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) * - (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y); - newy1 = y1; - newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x - 1) * (poly.array[0].y - y1) / - (poly.array[1].y - poly.array[0].y); - newy2 = y1 + 1; - - for(var i = 0; i < index; i++){ - poly2.shift(); + newx1 = poly2.array[index + 1].x + (poly2.array[index].x - poly2.array[index + 1].x) * + (poly2.array[index + 1].y - y1) / (poly2.array[index + 1].y - poly2.array[index].y); + newy1 = y1; + newx2 = poly.array[0].x + (poly.array[0].x - poly.array[1].x - 1) * (poly.array[0].y - y1) / + (poly.array[1].y - poly.array[0].y); + newy2 = y1 + 1; + + for(var i = 0; i < index; i++){ + poly2.shift(); + } + poly2.set(0, newx1, newy1); + poly.unshift(newx2, newy2); } - poly2.set(0, newx1, newy1); - poly.unshift(newx2, newy2); } poly2.reverse(); @@ -1074,6 +1076,10 @@ function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){ x2 - Math.sin(rad) * kMinWidthT * v + (kage.kAdjustKakatoR[opt2] + kMinWidthT) * Math.cos(rad) * v, y2 + Math.cos(rad) * kMinWidthT * v + (kage.kAdjustKakatoR[opt2] + kMinWidthT) * Math.sin(rad) * v); break; + case 24: + poly.set(1, x2 + (kMinWidthT * v) / Math.sin(rad), y2); + poly.set(2, x2 - (kMinWidthT * v) / Math.sin(rad), y2); + break; case 32: poly.set(1, x2 + (kMinWidthT * v) / Math.sin(rad), y2); poly.set(2, x2 - (kMinWidthT * v) / Math.sin(rad), y2); @@ -1081,7 +1087,16 @@ function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){ } polygons.push(poly); - + + if(a2 == 24){ //for T design + poly = new Polygon(); + poly.push(x2, y2 + kage.kMinWidthY); + poly.push(x2 + kMinWidthT * 0.5, y2 - kage.kMinWidthY * 4); + poly.push(x2 + kMinWidthT * 2, y2 - kage.kMinWidthY); + poly.push(x2 + kMinWidthT * 2, y2 + kage.kMinWidthY); + polygons.push(poly); + } + if((a1 == 6) && (a2 == 0 || a2 == 5)){ //KAGI NO YOKO BOU NO SAIGO NO MARU poly = new Polygon(); if(kage.kUseCurve){ @@ -1140,10 +1155,15 @@ function cdDrawLine(kage, polygons, tx1, ty1, tx2, ty2, ta1, ta2){ if(a2 == 13 && opt2 == 4){ //for new GTH box's left bottom corner MUKI KANKEINASHI poly = new Polygon(); - poly.push(x2 - kMinWidthT, y2 - kage.kMinWidthY * 3); - poly.push(x2 - kMinWidthT * 2, y2); - poly.push(x2 - kage.kMinWidthY, y2 + kage.kMinWidthY * 5); - poly.push(x2 + kMinWidthT, y2 + kage.kMinWidthY); + var m = 0; + if(x1 > x2 && y1 != y2){ + m = Math.floor((x1 - x2) / (y2 - y1) * 3); + } + poly.push(x2 + m, y2 - kage.kMinWidthY * 5); + poly.push(x2 - kMinWidthT * 2 + m, y2); + poly.push(x2 - kage.kMinWidthY + m, y2 + kage.kMinWidthY * 5); + poly.push(x2 + kMinWidthT + m, y2 + kage.kMinWidthY); + poly.push(x2 + m, y2); polygons.push(poly); }