Skip to content
Closed
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
62 changes: 58 additions & 4 deletions src/variety/nurimaze.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,33 @@
mouseinput_auto: function() {
if (this.puzzle.playmode) {
if (this.mousestart || this.mousemove) {
this.inputtile_nurimaze();
if (this.mousestart) {
this.inputData = null;
this.isLineDrag = false;
this.dragStartCell = this.getcell();
} else if (this.mousemove && !this.isLineDrag) {
var curCell = this.getcell();
if (
!curCell.isnull &&
!this.dragStartCell.isnull &&
curCell !== this.dragStartCell
) {
this.isLineDrag = true;
// ドラッグ開始セルを prevPos にセットして最初の線分も確実に描画する
this.prevPos = this.dragStartCell.getaddr();
}
}
if (this.isLineDrag) {
this.inputLine();
}
// isLineDrag が false の間は何もしない(mouseend でクリック判定する)
} else if (this.mouseend) {
if (!this.isLineDrag) {
// ドラッグなし=クリックのみ → 部屋の補助記号を切り替え
this.mousestart = true;
this.inputtile_nurimaze();
this.mousestart = false;
}
}
} else if (this.puzzle.editmode) {
if (this.mousestart || this.mousemove) {
Expand All @@ -59,7 +85,8 @@
if (
clist[i].ques !== 0 ||
bd.startpos.equals(clist[i]) ||
bd.goalpos.equals(clist[i])
bd.goalpos.equals(clist[i]) ||
clist[i].lcnt > 0
) {
if (this.mousestart) {
this.inputData = cell.qsub !== 1 ? 2 : 0;
Expand Down Expand Up @@ -295,6 +322,32 @@
LineGraph: {
enabled: true
},
Border: {
posthook: {
line: function() {
// 補助線が引かれたら、両側のエリアを通路として確定する(壁かどうかに関わらず)
if (this.line > 0) {
for (var i = 0; i < this.sidecell.length; i++) {
var cell = this.sidecell[i];
if (!cell.isnull) {
var clist = cell.room.clist;
var changed = false;
for (var j = 0; j < clist.length; j++) {
if (clist[j].isShade() || clist[j].qsub !== 1) {
clist[j].clrShade();
clist[j].setQsub(1);
changed = true;
}
}
if (changed) {
clist.draw();
}
}
}
}
}
}
},
BorderList: {
subclear: function() {
this.propclear(["sub", "info", "ans"], true);
Expand All @@ -308,6 +361,7 @@
bgcellcolor_func: "qsub1",
errbcolor2: "rgb(192, 192, 255)",
bbcolor: "rgb(96, 96, 96)",
linecolor: "rgb(160, 160, 160)",

irowake: true,

Expand All @@ -316,6 +370,8 @@
this.drawShadedCells();
this.drawGrid();

this.drawLines();

this.drawQuesMarks();
this.drawStartGoal();

Expand All @@ -326,8 +382,6 @@
this.drawBoxBorders(true);

this.drawTarget();

this.drawLines();
},

drawQuesMarks: function() {
Expand Down
20 changes: 10 additions & 10 deletions test/script/nurimaze.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,32 +112,32 @@ ui.debug.addDebugData("nurimaze", {
{
input: ["mouse,left, 1,3, 7,3"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /+ + + + /+ + + + /. . . . /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /+ + + + /+ + + + /. . . . /0 0 0 /1 1 1 /0 0 0 /0 0 0 0 /0 0 0 0 /"
},
{
input: ["mouse,left, 7,3, 1,3"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /+ # # # /+ # # # /. . . . /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /+ + + + /+ + + + /. . . . /"
},
{
input: ["mouse,left, 1,3, 7,3"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /. . . . /. . . . /. . . . /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /+ + + + /+ + + + /. . . . /0 0 0 /1 1 1 /0 0 0 /0 0 0 0 /0 0 0 0 /"
},
{
input: ["mouse,left, 1,3, 7,3", "mouse,right, 7,3, 1,3"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /. . . . /. . . . /. . . . /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /+ + + + /+ + + + /. . . . /0 0 0 /1 1 1 /0 0 0 /0 0 0 0 /0 0 0 0 /"
},
{
input: ["mouse,right, 1,5, 7,5"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /. . . . /. . . . /+ + + + /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /+ + + + /+ + + + /+ + + + /0 0 0 /1 1 1 /1 1 1 /0 0 0 0 /0 0 0 0 /"
},
{
input: ["mouse,left, 1,5, 7,5"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /. . . . /. . . . /# # # + /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . . . /. . . g /+ + + + /+ + + + /+ + + + /0 0 0 /1 1 1 /0 0 0 /0 0 0 0 /0 0 0 0 /"
},
{
input: [
Expand All @@ -153,7 +153,7 @@ ui.debug.addDebugData("nurimaze", {
{
input: ["mouse,left, 7,3, 1,3, 1,5, 7,5"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . o . /. t . g /. # . # /. # . # /# . # . /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . o . /. t . g /+ + + + /+ + + + /+ + + + /0 0 0 /1 1 1 /1 1 1 /0 0 0 0 /1 0 0 0 /"
},
{
input: ["mouse,right, 7,3, 1,3, 1,5, 7,5"],
Expand All @@ -164,20 +164,20 @@ ui.debug.addDebugData("nurimaze", {
{
input: ["mouse,left, 7,3, 1,3, 1,5, 7,5"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . o . /. t . g /. . . . /. . . . /. . . . /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . o . /. t . g /+ + + + /+ + + + /+ + + + /"
},
{
input: ["ansclear", "playmode,line"]
},
{
input: ["mouse,left, 7,3, 1,3, 1,5, 7,5"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . o . /. t . g /. . . . /. . . . /. . . . /0 0 0 /1 1 1 /1 1 1 /0 0 0 0 /1 0 0 0 /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . o . /. t . g /+ + + + /+ + + + /+ + + + /0 0 0 /1 1 1 /1 1 1 /0 0 0 0 /1 0 0 0 /"
},
{
input: ["mouse,left, 3,3, 1,3, 1,5, 3,5"],
result:
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . o . /. t . g /. . . . /. . . . /. . . . /0 0 0 /0 1 1 /0 1 1 /0 0 0 0 /0 0 0 0 /"
"pzprv3/nurimaze/3/4/8/0 1 2 3 /0 1 2 3 /4 5 6 7 /s . . . /. . o . /. t . g /+ + + + /+ + + + /+ + + + /0 0 0 /0 1 1 /0 1 1 /0 0 0 0 /0 0 0 0 /"
},
{
input: ["subclear"],
Expand Down
Loading