Update mkmaze.c

szy_
pmje2o5iu 1 year ago
parent fdb66a87fe
commit ec3e852fab

@ -43,9 +43,9 @@ iswall(coordxy x, coordxy y)
{ {
int type; int type;
if (!isok(x, y)) if (!isok(x, y)) // Check if the specified coordinates are valid
return 0; return 0; // Return false if not
type = levl[x][y].typ; type = levl[x][y].typ;// Get the type of the cell at the specified coordinates
return (IS_WALL(type) || IS_DOOR(type) return (IS_WALL(type) || IS_DOOR(type)
|| type == SDOOR || type == IRONBARS); || type == SDOOR || type == IRONBARS);
} }
@ -280,12 +280,12 @@ wallification(coordxy x1, coordxy y1, coordxy x2, coordxy y2)
static boolean static boolean
okay(coordxy x, coordxy y, coordxy dir) okay(coordxy x, coordxy y, coordxy dir)
{ {
mz_move(x, y, dir); mz_move(x, y, dir); // Move the player one space in the given direction
mz_move(x, y, dir); mz_move(x, y, dir); // Move the player another space in the same direction
if (x < 3 || y < 3 || x > gx.x_maze_max || y > gy.y_maze_max if (x < 3 || y < 3 || x > gx.x_maze_max || y > gy.y_maze_max
|| levl[x][y].typ != STONE) || levl[x][y].typ != STONE)
return FALSE; return FALSE;// Return false if the player is not on a valid location
return TRUE; return TRUE;// Return true if the player is on a valid location
} }
/* find random starting point for maze generation */ /* find random starting point for maze generation */
@ -294,7 +294,7 @@ maze0xy(coord *cc)
{ {
cc->x = 3 + 2 * rn2((gx.x_maze_max >> 1) - 1); cc->x = 3 + 2 * rn2((gx.x_maze_max >> 1) - 1);
cc->y = 3 + 2 * rn2((gy.y_maze_max >> 1) - 1); cc->y = 3 + 2 * rn2((gy.y_maze_max >> 1) - 1);
return; return;// Return after storing the generated coordinates
} }
static boolean static boolean

Loading…
Cancel
Save