]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/hack.mkmaze.c
1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.mkmaze.c - version 1.0.2 */
5 #include "def.mkroom.h" /* not really used */
6 extern struct monst
*makemon();
7 extern struct permonst pm_wizard
;
8 extern struct obj
*mkobj_at();
10 struct permonst hell_hound
=
11 { "hell hound", 'd', 12, 14, 2, 3, 6, 0 };
18 boolean al
= (dlevel
>= 30 && !flags
.made_amulet
);
20 for(x
= 2; x
< COLNO
-1; x
++)
21 for(y
= 2; y
< ROWNO
-1; y
++)
22 levl
[x
][y
].typ
= (x%2
&& y%2
) ? 0 : HWALL
;
24 register struct monst
*mtmp
;
28 for(x
= zx
-2; x
< zx
+4; x
++) for(y
= zy
-2; y
<= zy
+2; y
++) {
30 (y
== zy
-2 || y
== zy
+2 || x
== zx
-2 || x
== zx
+3) ? POOL
:
31 (y
== zy
-1 || y
== zy
+1 || x
== zx
-1 || x
== zx
+2) ? HWALL
:
34 (void) mkobj_at(AMULET_SYM
, zx
, zy
);
35 flags
.made_amulet
= 1;
37 if(mtmp
= makemon(&hell_hound
, zx
, zy
))
39 if(mtmp
= makemon(PM_WIZARD
, zx
+1, zy
)) {
41 flags
.no_of_wizards
= 1;
48 (void) mksobj_at(WAN_WISHING
, zx
, zy
);
49 (void) mkobj_at(ROCK_SYM
, zx
, zy
); /* put a rock on top of it */
52 for(x
= 2; x
< COLNO
-1; x
++)
53 for(y
= 2; y
< ROWNO
-1; y
++) {
54 switch(levl
[x
][y
].typ
) {
56 levl
[x
][y
].scrsym
= '-';
59 levl
[x
][y
].scrsym
= '.';
63 for(x
= rn1(8,11); x
; x
--) {
65 (void) mkobj_at(rn2(2) ? GEM_SYM
: 0, mm
.x
, mm
.y
);
67 for(x
= rn1(10,2); x
; x
--) {
69 (void) mkobj_at(ROCK_SYM
, mm
.x
, mm
.y
);
72 (void) makemon(PM_MINOTAUR
, mm
.x
, mm
.y
);
73 for(x
= rn1(5,7); x
; x
--) {
75 (void) makemon((struct permonst
*) 0, mm
.x
, mm
.y
);
77 for(x
= rn1(6,7); x
; x
--) {
81 for(x
= rn1(6,7); x
; x
--)
82 mktrap(0,1,(struct mkroom
*) 0);
84 levl
[(xupstair
= mm
.x
)][(yupstair
= mm
.y
)].scrsym
= '<';
85 levl
[xupstair
][yupstair
].typ
= STAIRS
;
86 xdnstair
= ydnstair
= 0;
89 walkfrom(x
,y
) int x
,y
; {
92 levl
[x
][y
].typ
= ROOM
;
95 for(a
= 0; a
< 4; a
++)
96 if(okay(x
,y
,a
)) dirs
[q
++]= a
;
100 levl
[x
][y
].typ
= ROOM
;
111 case 0: --(*y
); break;
112 case 1: (*x
)++; break;
113 case 2: (*y
)++; break;
114 case 3: --(*x
); break;
124 if(x
<3 || y
<3 || x
>COLNO
-3 || y
>ROWNO
-3 || levl
[x
][y
].typ
!= 0)
133 mm
.x
= 3 + 2*rn2(COLNO
/2 - 2);
134 mm
.y
= 3 + 2*rn2(ROWNO
/2 - 2);