1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.mkmaze.c - version 1.0.2 */
3 /* $FreeBSD: src/games/hack/hack.mkmaze.c,v 1.4 1999/11/16 10:26:37 marcel Exp $ */
6 #include "def.mkroom.h" /* not really used */
7 extern struct monst *makemon();
8 extern struct permonst pm_wizard;
9 extern struct obj *mkobj_at();
10 extern coord mazexy();
11 struct permonst hell_hound =
12 { "hell hound", 'd', 12, 14, 2, 3, 6, 0 };
19 boolean al = (dlevel >= 30 && !flags.made_amulet);
21 for(x = 2; x < COLNO-1; x++)
22 for(y = 2; y < ROWNO-1; y++)
23 levl[x][y].typ = (x%2 && y%2) ? 0 : HWALL;
29 for(x = zx-2; x < zx+4; x++) for(y = zy-2; y <= zy+2; y++) {
31 (y == zy-2 || y == zy+2 || x == zx-2 || x == zx+3) ? POOL :
32 (y == zy-1 || y == zy+1 || x == zx-1 || x == zx+2) ? HWALL:
35 (void) mkobj_at(AMULET_SYM, zx, zy);
36 flags.made_amulet = 1;
38 if(mtmp = makemon(&hell_hound, zx, zy))
40 if(mtmp = makemon(PM_WIZARD, zx+1, zy)) {
42 flags.no_of_wizards = 1;
49 (void) mksobj_at(WAN_WISHING, zx, zy);
50 (void) mkobj_at(ROCK_SYM, zx, zy); /* put a rock on top of it */
53 for(x = 2; x < COLNO-1; x++)
54 for(y = 2; y < ROWNO-1; y++) {
55 switch(levl[x][y].typ) {
57 levl[x][y].scrsym = '-';
60 levl[x][y].scrsym = '.';
64 for(x = rn1(8,11); x; x--) {
66 (void) mkobj_at(rn2(2) ? GEM_SYM : 0, mm.x, mm.y);
68 for(x = rn1(10,2); x; x--) {
70 (void) mkobj_at(ROCK_SYM, mm.x, mm.y);
73 (void) makemon(PM_MINOTAUR, mm.x, mm.y);
74 for(x = rn1(5,7); x; x--) {
76 (void) makemon((struct permonst *) 0, mm.x, mm.y);
78 for(x = rn1(6,7); x; x--) {
82 for(x = rn1(6,7); x; x--)
83 mktrap(0,1,(struct mkroom *) 0);
85 levl[(xupstair = mm.x)][(yupstair = mm.y)].scrsym = '<';
86 levl[xupstair][yupstair].typ = STAIRS;
87 xdnstair = ydnstair = 0;
90 walkfrom(x,y) int x,y; {
93 levl[x][y].typ = ROOM;
96 for(a = 0; a < 4; a++)
97 if(okay(x,y,a)) dirs[q++]= a;
101 levl[x][y].typ = ROOM;
112 case 0: --(*y); break;
113 case 1: (*x)++; break;
114 case 2: (*y)++; break;
115 case 3: --(*x); break;
125 if(x<3 || y<3 || x>COLNO-3 || y>ROWNO-3 || levl[x][y].typ != 0)
134 mm.x = 3 + 2*rn2(COLNO/2 - 2);
135 mm.y = 3 + 2*rn2(ROWNO/2 - 2);