Finish splitting wallification into two
This commit is contained in:
29
src/mkmaze.c
29
src/mkmaze.c
@@ -123,13 +123,9 @@ int wall_there, dx, dy;
|
||||
return spine;
|
||||
}
|
||||
|
||||
/*
|
||||
* Wall cleanup. This function has two purposes: (1) remove walls that
|
||||
* are totally surrounded by stone - they are redundant. (2) correct
|
||||
* the types so that they extend and connect to each other.
|
||||
*/
|
||||
/* Remove walls totally surrounded by stone */
|
||||
void
|
||||
wallification(x1, y1, x2, y2)
|
||||
wall_cleanup(x1, y1, x2, y2)
|
||||
int x1, y1, x2, y2;
|
||||
{
|
||||
uchar type;
|
||||
@@ -138,9 +134,9 @@ int x1, y1, x2, y2;
|
||||
|
||||
/* sanity check on incoming variables */
|
||||
if (x1 < 0 || x2 >= COLNO || x1 > x2 || y1 < 0 || y2 >= ROWNO || y1 > y2)
|
||||
panic("wallification: bad bounds (%d,%d) to (%d,%d)", x1, y1, x2, y2);
|
||||
panic("wall_cleanup: bad bounds (%d,%d) to (%d,%d)", x1, y1, x2, y2);
|
||||
|
||||
/* Step 1: change walls surrounded by rock to rock. */
|
||||
/* change walls surrounded by rock to rock. */
|
||||
for (x = x1; x <= x2; x++)
|
||||
for (y = y1; y <= y2; y++) {
|
||||
lev = &levl[x][y];
|
||||
@@ -153,10 +149,9 @@ int x1, y1, x2, y2;
|
||||
lev->typ = STONE;
|
||||
}
|
||||
}
|
||||
|
||||
fix_wall_spines(x1,y1,x2,y2);
|
||||
}
|
||||
|
||||
/* Correct wall types so they extend and connect to each other */
|
||||
void
|
||||
fix_wall_spines(x1, y1, x2, y2)
|
||||
int x1, y1, x2, y2;
|
||||
@@ -181,11 +176,7 @@ int x1, y1, x2, y2;
|
||||
if (x1<0 || x2>=COLNO || x1>x2 || y1<0 || y2>=ROWNO || y1>y2)
|
||||
panic("wall_extends: bad bounds (%d,%d) to (%d,%d)",x1,y1,x2,y2);
|
||||
|
||||
/*
|
||||
* Step 2: set the correct wall type. We can't combine steps
|
||||
* 1 and 2 into a single sweep because we depend on knowing if
|
||||
* the surrounding positions are stone.
|
||||
*/
|
||||
/* set the correct wall type. */
|
||||
for (x = x1; x <= x2; x++)
|
||||
for (y = y1; y <= y2; y++) {
|
||||
lev = &levl[x][y];
|
||||
@@ -217,6 +208,14 @@ int x1, y1, x2, y2;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
wallification(x1, y1, x2, y2)
|
||||
int x1, y1, x2, y2;
|
||||
{
|
||||
wall_cleanup(x1,y1,x2,y2);
|
||||
fix_wall_spines(x1,y1,x2,y2);
|
||||
}
|
||||
|
||||
STATIC_OVL boolean
|
||||
okay(x, y, dir)
|
||||
int x, y;
|
||||
|
||||
Reference in New Issue
Block a user