diff options
Diffstat (limited to 'hunt/huntd/makemaze.c')
-rw-r--r-- | hunt/huntd/makemaze.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/hunt/huntd/makemaze.c b/hunt/huntd/makemaze.c index 8beee4ff..47a01bb3 100644 --- a/hunt/huntd/makemaze.c +++ b/hunt/huntd/makemaze.c @@ -1,4 +1,4 @@ -/* $NetBSD: makemaze.c,v 1.5 2009/07/04 02:37:20 dholland Exp $ */ +/* $NetBSD: makemaze.c,v 1.6 2009/07/04 04:29:55 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,24 +32,24 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: makemaze.c,v 1.5 2009/07/04 02:37:20 dholland Exp $"); +__RCSID("$NetBSD: makemaze.c,v 1.6 2009/07/04 04:29:55 dholland Exp $"); #endif /* not lint */ -# include "hunt.h" +#include "hunt.h" -# define ISCLEAR(y,x) (Maze[y][x] == SPACE) -# define ODD(n) ((n) & 01) +#define ISCLEAR(y,x) (Maze[y][x] == SPACE) +#define ODD(n) ((n) & 01) -static int candig(int, int); -static void dig(int, int); -static void dig_maze(int, int); -static void remap(void); +static int candig(int, int); +static void dig(int, int); +static void dig_maze(int, int); +static void remap(void); void makemaze(void) { - char *sp; - int y, x; + char *sp; + int y, x; /* * fill maze with walls @@ -64,29 +64,29 @@ makemaze(void) remap(); } -# define NPERM 24 -# define NDIR 4 +#define NPERM 24 +#define NDIR 4 -int dirs[NPERM][NDIR] = { - {0,1,2,3}, {3,0,1,2}, {0,2,3,1}, {0,3,2,1}, - {1,0,2,3}, {2,3,0,1}, {0,2,1,3}, {2,3,1,0}, - {1,0,3,2}, {1,2,0,3}, {3,1,2,0}, {2,0,3,1}, - {1,3,0,2}, {0,3,1,2}, {1,3,2,0}, {2,0,1,3}, - {0,1,3,2}, {3,1,0,2}, {2,1,0,3}, {1,2,3,0}, - {2,1,3,0}, {3,0,2,1}, {3,2,0,1}, {3,2,1,0} - }; +int dirs[NPERM][NDIR] = { + {0,1,2,3}, {3,0,1,2}, {0,2,3,1}, {0,3,2,1}, + {1,0,2,3}, {2,3,0,1}, {0,2,1,3}, {2,3,1,0}, + {1,0,3,2}, {1,2,0,3}, {3,1,2,0}, {2,0,3,1}, + {1,3,0,2}, {0,3,1,2}, {1,3,2,0}, {2,0,1,3}, + {0,1,3,2}, {3,1,0,2}, {2,1,0,3}, {1,2,3,0}, + {2,1,3,0}, {3,0,2,1}, {3,2,0,1}, {3,2,1,0} +}; -int incr[NDIR][2] = { - {0, 1}, {1, 0}, {0, -1}, {-1, 0} - }; +int incr[NDIR][2] = { + {0, 1}, {1, 0}, {0, -1}, {-1, 0} +}; static void dig(int y, int x) { - int *dp; - int *ip; - int ny, nx; - int *endp; + int *dp; + int *ip; + int ny, nx; + int *endp; Maze[y][x] = SPACE; /* Clear this spot */ dp = dirs[rand_num(NPERM)]; @@ -107,7 +107,7 @@ dig(int y, int x) static int candig(int y, int x) { - int i; + int i; if (ODD(x) && ODD(y)) return FALSE; /* can't touch ODD spots */ @@ -137,13 +137,13 @@ candig(int y, int x) void dig_maze(int x, int y) { - int tx, ty; - int i, j; - int order[4]; -#define MNORTH 0x1 -#define MSOUTH 0x2 -#define MEAST 0x4 -#define MWEST 0x8 + int tx, ty; + int i, j; + int order[4]; +#define MNORTH 0x1 +#define MSOUTH 0x2 +#define MEAST 0x4 +#define MWEST 0x8 tx = ty = 0; Maze[y][x] = SPACE; @@ -184,9 +184,9 @@ dig_maze(int x, int y) void remap(void) { - int y, x; - char *sp; - int stat; + int y, x; + char *sp; + int stat; for (y = 0; y < HEIGHT; y++) for (x = 0; x < WIDTH; x++) { @@ -214,12 +214,12 @@ remap(void) *sp = WALL2; break; case 0: -# ifdef RANDOM +#ifdef RANDOM *sp = DOOR; -# endif -# ifdef REFLECT +#endif +#ifdef REFLECT *sp = rand_num(2) ? WALL4 : WALL5; -# endif +#endif break; default: *sp = WALL3; |