Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fake Arrow #554

Merged
merged 5 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Binary file added src-ui/img/fakearrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src-ui/js/ui/Misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ function toBGimage(pid) {
"doubleback",
"easyasabc",
"evolmino",
"fakearrow",
"firewalk",
"geradeweg",
"heteromino",
Expand Down
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
6 changes: 5 additions & 1 deletion 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 @@ -386,6 +388,7 @@
"cs2x2.snake": "The snake loops back on itself.",
"cs2x2": "There is a 2x2 block of shaded cells.",
"cs3.aqre": "There are more than three shaded cells in a row.",
"csAdjacent.fakearrow": "Shaded arrows are adjacent.",
"csAdjacent.kaidan": "Some circles are adjacent.",
"csAdjacent": "Some shaded cells are adjacent.",
"csConnOut.kurodoko": "Some shaded cells are not connected to the outside.",
Expand Down Expand Up @@ -600,9 +603,10 @@
"lpNumGt2.onsen": "A loop has more than one number.",
"lpPlNum.pipelink": "A loop has multiple kinds of number.",
"lpSepNum.pipelink": "A kind of number is in different loops.",
"lrAcrossArrow.nagare": "The line passes across an arrow.",
"lrAcrossArrow.nagare": "The line doesn't go straight in the arrow's direction.",
"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
Loading