]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/hack.mkmaze.c
2 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
6 static char rcsid
[] = "$NetBSD: hack.mkmaze.c,v 1.3 1995/03/23 08:30:46 cgd Exp $";
10 #include "def.mkroom.h" /* not really used */
11 extern struct monst
*makemon();
12 extern struct permonst pm_wizard
;
13 extern struct obj
*mkobj_at();
14 extern coord
mazexy();
15 struct permonst hell_hound
=
16 { "hell hound", 'd', 12, 14, 2, 3, 6, 0 };
23 boolean al
= (dlevel
>= 30 && !flags
.made_amulet
);
25 for(x
= 2; x
< COLNO
-1; x
++)
26 for(y
= 2; y
< ROWNO
-1; y
++)
27 levl
[x
][y
].typ
= (x%2
&& y%2
) ? 0 : HWALL
;
29 register struct monst
*mtmp
;
33 for(x
= zx
-2; x
< zx
+4; x
++) for(y
= zy
-2; y
<= zy
+2; y
++) {
35 (y
== zy
-2 || y
== zy
+2 || x
== zx
-2 || x
== zx
+3) ? POOL
:
36 (y
== zy
-1 || y
== zy
+1 || x
== zx
-1 || x
== zx
+2) ? HWALL
:
39 (void) mkobj_at(AMULET_SYM
, zx
, zy
);
40 flags
.made_amulet
= 1;
42 if(mtmp
= makemon(&hell_hound
, zx
, zy
))
44 if(mtmp
= makemon(PM_WIZARD
, zx
+1, zy
)) {
46 flags
.no_of_wizards
= 1;
53 (void) mksobj_at(WAN_WISHING
, zx
, zy
);
54 (void) mkobj_at(ROCK_SYM
, zx
, zy
); /* put a rock on top of it */
57 for(x
= 2; x
< COLNO
-1; x
++)
58 for(y
= 2; y
< ROWNO
-1; y
++) {
59 switch(levl
[x
][y
].typ
) {
61 levl
[x
][y
].scrsym
= '-';
64 levl
[x
][y
].scrsym
= '.';
68 for(x
= rn1(8,11); x
; x
--) {
70 (void) mkobj_at(rn2(2) ? GEM_SYM
: 0, mm
.x
, mm
.y
);
72 for(x
= rn1(10,2); x
; x
--) {
74 (void) mkobj_at(ROCK_SYM
, mm
.x
, mm
.y
);
77 (void) makemon(PM_MINOTAUR
, mm
.x
, mm
.y
);
78 for(x
= rn1(5,7); x
; x
--) {
80 (void) makemon((struct permonst
*) 0, mm
.x
, mm
.y
);
82 for(x
= rn1(6,7); x
; x
--) {
86 for(x
= rn1(6,7); x
; x
--)
87 mktrap(0,1,(struct mkroom
*) 0);
89 levl
[(xupstair
= mm
.x
)][(yupstair
= mm
.y
)].scrsym
= '<';
90 levl
[xupstair
][yupstair
].typ
= STAIRS
;
91 xdnstair
= ydnstair
= 0;
94 walkfrom(x
,y
) int x
,y
; {
97 levl
[x
][y
].typ
= ROOM
;
100 for(a
= 0; a
< 4; a
++)
101 if(okay(x
,y
,a
)) dirs
[q
++]= a
;
105 levl
[x
][y
].typ
= ROOM
;
116 case 0: --(*y
); break;
117 case 1: (*x
)++; break;
118 case 2: (*y
)++; break;
119 case 3: --(*x
); break;
129 if(x
<3 || y
<3 || x
>COLNO
-3 || y
>ROWNO
-3 || levl
[x
][y
].typ
!= 0)
138 mm
.x
= 3 + 2*rn2(COLNO
/2 - 2);
139 mm
.y
= 3 + 2*rn2(ROWNO
/2 - 2);