New level compiler: code changes
This commit is contained in:
46
src/mkmaze.c
46
src/mkmaze.c
@@ -556,7 +556,7 @@ register const char *s;
|
||||
#endif
|
||||
|
||||
maze0xy(&mm);
|
||||
walkfrom((int) mm.x, (int) mm.y);
|
||||
walkfrom((int) mm.x, (int) mm.y, 0);
|
||||
/* put a boulder at the maze center */
|
||||
(void) mksobj_at(BOULDER, (int) mm.x, (int) mm.y, TRUE, FALSE);
|
||||
|
||||
@@ -644,14 +644,21 @@ register const char *s;
|
||||
* that is totally safe.
|
||||
*/
|
||||
void
|
||||
walkfrom(x,y)
|
||||
walkfrom(x,y,typ)
|
||||
int x,y;
|
||||
schar typ;
|
||||
{
|
||||
#define CELLS (ROWNO * COLNO) / 4 /* a maze cell is 4 squares */
|
||||
char mazex[CELLS + 1], mazey[CELLS + 1]; /* char's are OK */
|
||||
int q, a, dir, pos;
|
||||
int dirs[4];
|
||||
|
||||
#ifndef WALLIFIED_MAZE
|
||||
if (!typ) typ = CORR;
|
||||
#else
|
||||
if (!typ) typ = ROOM;
|
||||
#endif
|
||||
|
||||
pos = 1;
|
||||
mazex[pos] = (char) x;
|
||||
mazey[pos] = (char) y;
|
||||
@@ -660,11 +667,7 @@ int x,y;
|
||||
y = (int) mazey[pos];
|
||||
if(!IS_DOOR(levl[x][y].typ)) {
|
||||
/* might still be on edge of MAP, so don't overwrite */
|
||||
#ifndef WALLIFIED_MAZE
|
||||
levl[x][y].typ = CORR;
|
||||
#else
|
||||
levl[x][y].typ = ROOM;
|
||||
#endif
|
||||
levl[x][y].typ = typ;
|
||||
levl[x][y].flags = 0;
|
||||
}
|
||||
q = 0;
|
||||
@@ -675,11 +678,7 @@ int x,y;
|
||||
else {
|
||||
dir = dirs[rn2(q)];
|
||||
move(&x, &y, dir);
|
||||
#ifndef WALLIFIED_MAZE
|
||||
levl[x][y].typ = CORR;
|
||||
#else
|
||||
levl[x][y].typ = ROOM;
|
||||
#endif
|
||||
levl[x][y].typ = typ;
|
||||
move(&x, &y, dir);
|
||||
pos++;
|
||||
if (pos > CELLS)
|
||||
@@ -692,19 +691,22 @@ int x,y;
|
||||
#else
|
||||
|
||||
void
|
||||
walkfrom(x,y)
|
||||
walkfrom(x,y,typ)
|
||||
int x,y;
|
||||
schar typ;
|
||||
{
|
||||
register int q,a,dir;
|
||||
int dirs[4];
|
||||
|
||||
#ifndef WALLIFIED_MAZE
|
||||
if (!typ) typ = CORR;
|
||||
#else
|
||||
if (!typ) typ = ROOM;
|
||||
#endif
|
||||
|
||||
if(!IS_DOOR(levl[x][y].typ)) {
|
||||
/* might still be on edge of MAP, so don't overwrite */
|
||||
#ifndef WALLIFIED_MAZE
|
||||
levl[x][y].typ = CORR;
|
||||
#else
|
||||
levl[x][y].typ = ROOM;
|
||||
#endif
|
||||
levl[x][y].typ = typ;
|
||||
levl[x][y].flags = 0;
|
||||
}
|
||||
|
||||
@@ -715,13 +717,9 @@ int x,y;
|
||||
if(!q) return;
|
||||
dir = dirs[rn2(q)];
|
||||
move(&x,&y,dir);
|
||||
#ifndef WALLIFIED_MAZE
|
||||
levl[x][y].typ = CORR;
|
||||
#else
|
||||
levl[x][y].typ = ROOM;
|
||||
#endif
|
||||
levl[x][y].typ = typ;
|
||||
move(&x,&y,dir);
|
||||
walkfrom(x,y);
|
||||
walkfrom(x,y,typ);
|
||||
}
|
||||
}
|
||||
#endif /* MICRO */
|
||||
|
||||
Reference in New Issue
Block a user