diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-10-13 02:27:12 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-10-13 02:27:12 -0300 |
commit | 3c00014739c395c1d225b6392713f9d77a1ecd30 (patch) | |
tree | 97a8d3fbb1a116d0d2ae21d9059d514df0103618 | |
parent | ec71b5552d0e2270677d6769239f5276c6c890dc (diff) | |
download | serverdata-3c00014739c395c1d225b6392713f9d77a1ecd30.tar.gz serverdata-3c00014739c395c1d225b6392713f9d77a1ecd30.tar.bz2 serverdata-3c00014739c395c1d225b6392713f9d77a1ecd30.tar.xz serverdata-3c00014739c395c1d225b6392713f9d77a1ecd30.zip |
Only missing to fix south and east wall
Output from Dungeon Generator (5x5):
WLL WLL WLL WLL WLL
WLL|WLL|1_0 0_0|1_1|WLL WLL|2_1|WLL WLL|3_1|WLL WLL|WLL|5_0
WLL 1_0 2_0 3_0 WLL
WLL|0_2|1_1 0_1|WLL|WLL WLL|WLL|3_1 2_1|WLL|WLL WLL|WLL|5_1
0_1 WLL WLL WLL WLL
WLL|0_3|1_2 0_2|1_3|WLL WLL|2_3|3_2 2_2|WLL|WLL WLL|4_3|5_2
0_2 1_2 2_2 WLL 4_2
WLL|0_4|WLL WLL|WLL|2_3 1_3|WLL|WLL WLL|3_4|WLL WLL|WLL|5_3
0_3 WLL WLL 3_3 WLL
WLL|0_5|WLL WLL|WLL|2_4 1_4|WLL|3_4 2_4|3_5|WLL WLL|WLL|5_4
-rw-r--r-- | npc/maze0/config.txt | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/npc/maze0/config.txt b/npc/maze0/config.txt index 36a520ee5..32a55894a 100644 --- a/npc/maze0/config.txt +++ b/npc/maze0/config.txt @@ -33,7 +33,7 @@ function script SetMazeCon { // UpdateMazeCon(Maze, x, y) function script UpdateMazeCon { if (getd(getarg(0)+"$["+MAZENORTH+"]") != "WALL") - setd(getarg(0)+"$["+MAZENORTH+"]", str(getarg(1))+"_"+str(getarg(2)+1)); + setd(getarg(0)+"$["+MAZENORTH+"]", str(getarg(1))+"_"+str(getarg(2)-1)); if (getd(getarg(0)+"$["+MAZE_WEST+"]") != "WALL") setd(getarg(0)+"$["+MAZE_WEST+"]", str(getarg(1)-1)+"_"+str(getarg(2))); @@ -67,6 +67,9 @@ function script ParseMaze { switch (.@t) { case MAZEMAPTYPE_NULL: SetMazeCon(.@v$, "WALL", "WALL", "WALL", "WALL"); + // It's a fallback + Exception("ERROR IN PARSER, FALLBACK", RB_DEBUGMES|RB_ISFATAL); + return true; break; // N W E S @@ -127,6 +130,8 @@ function script ParseMaze { // Now that connectors are set, we do simulations /* + debugmes "(%d, %d) found %s (ID %d)", .@x, .@y, getd(MazeVar(.@x, .@y, "$["+MAZENORTH+"]")), getd(MazeVar(.@x, .@y, "_ID")); + debugmes "(%d, %d) is with north %s (ID %d)", .@x, .@y, getd(MazeVar(.@x, .@y, "$["+MAZENORTH+"]")), getd(MazeVar(.@x, .@y, "_ID")); debugmes ".@v$ is %s", .@v$; debugmes ".@v$[NORTH] is %s", getd(.@v$+"$["+MAZENORTH+"]"); @@ -148,7 +153,15 @@ function script ParseMaze { //debugmes "(%d, %d) found %s (ID %d)", .@x, .@y, getd(MazeVar(.@x, .@y-1, "$["+MAZESOUTH+"]")), getd(MazeVar(.@x, .@y-1, "_ID")); // Okay, this is a valid movement, we continue + } else { + // Case 1: We're in the edge + if (.@y != 0) { + // Case 2: South direction thinks it is a wall + if (getd(MazeVar(.@x, .@y-1, "$["+MAZESOUTH+"]")) != "WALL") + return false; + } } + ////////////////////////// // Way west if (getd(.@v$+"$["+MAZE_WEST+"]") != "WALL") { @@ -163,6 +176,13 @@ function script ParseMaze { return false; // Okay, this is a valid movement, we continue + } else { + // Case 1: We're in the edge + if (.@x != 0) { + // Case 2: West direction thinks it is a wall + if (getd(MazeVar(.@x-1, .@y, "$["+MAZE_EAST+"]")) != "WALL") + return false; + } } ////////////////////////// @@ -300,7 +320,6 @@ function script GenerateMaze { while (.@y < MAZE_MY) { // For every cell: while (.@x < MAZE_MX) { - freeloop(true); //debugmes "[STATUS] [BUILD %d %d] Running...", .@x, .@y; // While connections weren't parsed @@ -309,17 +328,22 @@ function script GenerateMaze { // Then we go to (0,MAZE_MY) until (MAZE_MX,MAZE_MY) // Shuffle the array array_shuffle(getd(MazeVar(.@x, .@y, "_ALLOWEDTYPES"))); - .@maze_typexy=array_pop(getd(MazeVar(.@x, .@y, "_ALLOWEDTYPES"))); + freeloop(true); + + if (getarraysize(getd(MazeVar(.@x, .@y, "_ALLOWEDTYPES")))) + .@mztype=array_pop(getd(MazeVar(.@x, .@y, "_ALLOWEDTYPES"))); + else + .@mztype=-1; // XXX: MAZEMAPTYPE_NULL is also a bug - if (.@maze_typexy <= 0) { - Exception("ERROR IN MAZE BUILDER ("+.@x+","+.@y+") MTYPEXY"); - .@maze_typexy=MAZEMAPTYPE_NULL; + if (.@mztype <= 0) { + Exception("ERROR IN MAZE BUILDER ("+.@x+","+.@y+") MTYPEXY", RB_DEBUGMES|RB_IRCBROADCAST); + .@mztype=MAZEMAPTYPE_NULL; } - setd(MazeVar(.@x, .@y, "_ID"), .@maze_typexy); + setd(MazeVar(.@x, .@y, "_ID"), .@mztype); // Attempt to parse connections - } while (!ParseMaze(.@maze_typexy, .@x, .@y)); + } while (!ParseMaze(.@mztype, .@x, .@y)); // End the build loop .@x++; @@ -344,7 +368,6 @@ function script GenerateMaze { // Sanity Check for (.@y=0; .@y < MAZE_MY; .@y++) { - freeloop(true); for (.@x=0; .@x < MAZE_MX; .@x++) { .@mid=getd(MazeVar(.@x, .@y, "_ID")); .@v$=MazeVar(.@x, .@y); @@ -352,11 +375,10 @@ function script GenerateMaze { .@w$=getd(.@v$+"$["+MAZE_WEST+"]"); .@e$=getd(.@v$+"$["+MAZE_EAST+"]"); .@s$=getd(.@v$+"$["+MAZESOUTH+"]"); - debugmes "%s (%d): %s ", .@v$, .@mid, .@n$; - //debugmes "%s | %s | %s", .@w$, .@s$, .@e$; - + debugmes "\t%s\t\t\t", .@n$; + debugmes "%s|%s|%s", .@w$, .@s$, .@e$; } - debugmes "[REPORT] %s", .@l$; + debugmes "%s (%d)", .@v$, .@mid; } |