Skip to content

Commit

Permalink
Add Fake Arrow
Browse files Browse the repository at this point in the history
  • Loading branch information
x-sheep committed Aug 14, 2024
1 parent 2fab36c commit 67c3541
Show file tree
Hide file tree
Showing 8 changed files with 469 additions and 144 deletions.
2 changes: 1 addition & 1 deletion src-ui/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
<main>
<div style="margin-bottom: 5px;"><b>Latest types</b> (<em><a href="/list.html" target="_parent">all types</a></em>)</div>
<ul>
<li><a href="/p?fakearrow" target="_parent">Fake Arrow フェイクアロー</a></li>
<li><a href="/p?snakeegg" target="_parent">Snake Egg</a></li>
<li><a href="/p?firewalk" target="_parent">Fire Walk</a></li>
<li><a href="/p?batten" target="_parent">Battenberg Painting</a></li>
<li><a href="/p?zabajaba" target="_parent">Zabajaba</a></li>
<li><a href="/p?curving" target="_parent">Curving Road カービングロード</a></li>
<li><a href="/p?sananko" target="_parent">San-Anko サンアンコー</a></li>
<li><a href="/p?bosnianroad" target="_parent">Bosnian Road</a></li>
</ul>
</main>
</body>
1 change: 1 addition & 0 deletions src-ui/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ <h2 id="title"><span lang="ja">パズルの種類のリスト</span><span lang="
<li data-pid="portal"></li>
<li data-pid="bosnianroad"></li>
<li data-pid="firewalk"></li>
<li data-pid="fakearrow"></li>
</ul>
</div>
<div class="lists loops">
Expand Down
1 change: 1 addition & 0 deletions src/pzpr/variety.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
easyasabc: [0, 0, "ABCプレース", "Easy as ABC"],
evolmino: [0, 0, "シンカミノ", "Evolmino"],
factors: [0, 0, "因子の部屋", "Rooms of Factors"],
fakearrow: [0, 0, "フェイクアロー", "Fake Arrow", "nagare"],
familyphoto: [0, 0, "家族写真", "Family Photo"],
fillmat: [1, 0, "フィルマット", "Fillmat", "fillmat"],
fillomino: [
Expand Down
3 changes: 3 additions & 0 deletions src/res/failcode.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
"bkNoSC.dosufuwa": "An area has no iron ball.",
"bkNoShade.shimaguni": "A marine area has no shaded cells.",
"bkNoShade": "A room has no shaded cell.",
"bkNoShade.fakearrow": "A room has no shaded arrow.",
"bkNoStar.tentaisho": "An area has no stars.",
"bkNotAllMSPassed.moonsun": "A line doesn't pass all of the marks of the moon.",
"bkNotAllMUPassed.moonsun": "A line doesn't pass all of the marks of the sun.",
Expand Down Expand Up @@ -235,6 +236,7 @@
"bkShadeDivide.invlitso": "Unshaded cells are divided in a room.",
"bkShadeDivide.shimaguni": "The shaded cells in a marine area are divided.",
"bkShadeDivide": "Shaded cells are divided in a room.",
"bkShadeGe2.fakearrow": "A room has more than one shaded arrow.",
"bkShadeGt2": "A room has three or more shaded cells.",
"bkShadeGt4.invlitso": "A room has three or less unshaded cells.",
"bkShadeGt4.lits": "A room has five or more shaded cells.",
Expand Down Expand Up @@ -603,6 +605,7 @@
"lrAcrossArrow.nagare": "The line passes across an arrow.",
"lrAcrossWind.nagare": "The line passes across the wind.",
"lrAgainstArrow.nagare": "The line passes against an arrow.",
"lrFollowsFake.fakearrow": "The line follows a shaded arrow.",
"lrAgainstWind.nagare": "The line passes against the wind.",
"lrDeadEnd.icebarn": "There is a dead-end line.",
"lrOffField.icebarn": "A line is not reached out the 'OUT' arrow.",
Expand Down
221 changes: 118 additions & 103 deletions src/variety-common/Graphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ pzpr.classmgr.makeCommon({
//---------------------------------------------------------------------------
// pc.drawCellArrows() 矢印だけをCanvasに書き込む
//---------------------------------------------------------------------------
drawCellArrows: function(wide, outline) {
drawCellArrows: function(wide) {
var g = this.vinc("cell_arrow", "auto");
var al, aw, tl, tw;

Expand All @@ -255,6 +255,12 @@ pzpr.classmgr.makeCommon({
aw = this.cw * 0.03; // ArrowWidth
tl = this.cw * 0.16; // 矢じりの長さの座標(中心-長さ)
tw = this.cw * 0.16; // 矢じりの幅
} else if (wide === 0.5) {
/* 太い矢印 */
al = this.cw * 0.35; // ArrowLength
aw = this.cw * 0.1; // ArrowWidth
tl = 0; // 矢じりの長さの座標(中心-長さ)
tw = this.cw * 0.27; // 矢じりの幅
} else {
/* 太い矢印 */
al = this.cw * 0.35; // ArrowLength
Expand All @@ -266,114 +272,123 @@ pzpr.classmgr.makeCommon({
tw = tw >= 5 ? tw : 5;

var clist = this.range.cells;
for (var i = 0; i < clist.length; i++) {
var cell = clist[i],
dir = !cell.numberAsObject ? cell.qdir : cell.getNum();
var color = dir >= 1 && dir <= 4 ? this.getCellArrowColor(cell) : null;
for (var item = 0; item < 2; item++) {
var func =
item === 1 ? this.getCellArrowOutline : this.getCellArrowColor;
if (!func) {
continue;
}

g.vid = "c_arrow_" + cell.id;
if (!!color) {
g.lineWidth = 1.5;
g.strokeStyle = g.fillStyle = color;
g.beginPath();
var px = cell.bx * this.bw,
py = cell.by * this.bh;
switch (dir) {
case cell.UP:
g.setOffsetLinePath(
px,
py,
0,
-al,
-tw,
-tl,
-aw,
-tl,
-aw,
al,
aw,
al,
aw,
-tl,
tw,
-tl,
true
);
break;
case cell.DN:
g.setOffsetLinePath(
px,
py,
0,
al,
-tw,
tl,
-aw,
tl,
-aw,
-al,
aw,
-al,
aw,
tl,
tw,
tl,
true
);
break;
case cell.LT:
g.setOffsetLinePath(
px,
py,
-al,
0,
-tl,
-tw,
-tl,
-aw,
al,
-aw,
al,
aw,
-tl,
aw,
-tl,
tw,
true
);
break;
case cell.RT:
g.setOffsetLinePath(
px,
py,
al,
0,
tl,
-tw,
tl,
-aw,
-al,
-aw,
-al,
aw,
tl,
aw,
tl,
tw,
true
);
break;
}
if (outline) {
g.stroke();
for (var i = 0; i < clist.length; i++) {
var cell = clist[i],
dir = !cell.numberAsObject ? cell.qdir : cell.getNum();
var color = dir >= 1 && dir <= 4 ? func.call(this, cell) : null;

g.vid = "c_arrow_" + item + "_" + cell.id;
if (!!color) {
g.lineWidth = 1.5;
g.strokeStyle = g.fillStyle = color;
g.beginPath();
var px = cell.bx * this.bw,
py = cell.by * this.bh;
switch (dir) {
case cell.UP:
g.setOffsetLinePath(
px,
py,
0,
-al,
-tw,
-tl,
-aw,
-tl,
-aw,
al,
aw,
al,
aw,
-tl,
tw,
-tl,
true
);
break;
case cell.DN:
g.setOffsetLinePath(
px,
py,
0,
al,
-tw,
tl,
-aw,
tl,
-aw,
-al,
aw,
-al,
aw,
tl,
tw,
tl,
true
);
break;
case cell.LT:
g.setOffsetLinePath(
px,
py,
-al,
0,
-tl,
-tw,
-tl,
-aw,
al,
-aw,
al,
aw,
-tl,
aw,
-tl,
tw,
true
);
break;
case cell.RT:
g.setOffsetLinePath(
px,
py,
al,
0,
tl,
-tw,
tl,
-aw,
-al,
-aw,
-al,
aw,
tl,
aw,
tl,
tw,
true
);
break;
}
if (item === 1) {
g.stroke();
} else {
g.fill();
}
} else {
g.fill();
g.vhide();
}
} else {
g.vhide();
}
}
},
getCellArrowOutline: null,
getCellArrowColor: function(cell) {
var dir = !cell.numberAsObject ? cell.qdir : cell.getNum();
if (dir >= 1 && dir <= 4) {
Expand Down
6 changes: 5 additions & 1 deletion src/variety/guidearrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,16 @@
this.drawShadedCells();

this.drawGoalStar();
this.drawCellArrows(true, true);
this.drawCellArrows(true);
this.drawHatenas();

this.drawChassis();
this.drawTarget();
},
getCellArrowColor: null,
getCellArrowOutline: function(cell) {
return cell.qnum !== -1 ? this.quescolor : null;
},

drawGoalStar: function() {
var g = this.vinc("cell_sg", "auto");
Expand Down
Loading

0 comments on commit 67c3541

Please sign in to comment.