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 $ */
4 /* $DragonFly: src/games/hack/hack.mkmaze.c,v 1.3 2006/08/21 19:45:32 pavalos Exp $ */
7 extern struct permonst pm_wizard
;
8 struct permonst hell_hound
=
9 { "hell hound", 'd', 12, 14, 2, 3, 6, 0 };
11 static void walkfrom(int, int);
12 static void move(int *, int *, int);
13 static bool okay(int, int, int);
21 boolean al
= (dlevel
>= 30 && !flags
.made_amulet
);
23 for (x
= 2; x
< COLNO
- 1; x
++)
24 for (y
= 2; y
< ROWNO
- 1; y
++)
25 levl
[x
][y
].typ
= (x
% 2 && y
% 2) ? 0 : HWALL
;
29 zx
= 2 * (COLNO
/ 4) - 1;
30 zy
= 2 * (ROWNO
/ 4) - 1;
31 for (x
= zx
- 2; x
< zx
+ 4; x
++)
32 for (y
= zy
- 2; y
<= zy
+ 2; y
++) {
34 (y
== zy
- 2 || y
== zy
+ 2 || x
==
35 zx
- 2 || x
== zx
+ 3) ? POOL
:
36 (y
== zy
- 1 || y
== zy
+ 1 || x
==
37 zx
- 1 || x
== zx
+ 2) ? HWALL
:
41 mkobj_at(AMULET_SYM
, zx
, zy
);
42 flags
.made_amulet
= 1;
44 if ((mtmp
= makemon(&hell_hound
, zx
, zy
)) != NULL
)
46 if ((mtmp
= makemon(PM_WIZARD
, zx
+ 1, zy
)) != NULL
) {
48 flags
.no_of_wizards
= 1;
55 mksobj_at(WAN_WISHING
, zx
, zy
);
56 mkobj_at(ROCK_SYM
, zx
, zy
); /* put a rock on top of it */
59 for (x
= 2; x
< COLNO
- 1; x
++)
60 for (y
= 2; y
< ROWNO
- 1; y
++) {
61 switch (levl
[x
][y
].typ
) {
63 levl
[x
][y
].scrsym
= '-';
66 levl
[x
][y
].scrsym
= '.';
70 for (x
= rn1(8, 11); x
; x
--) {
72 mkobj_at(rn2(2) ? GEM_SYM
: 0, mm
.x
, mm
.y
);
74 for (x
= rn1(10, 2); x
; x
--) {
76 mkobj_at(ROCK_SYM
, mm
.x
, mm
.y
);
79 makemon(PM_MINOTAUR
, mm
.x
, mm
.y
);
80 for (x
= rn1(5, 7); x
; x
--) {
82 makemon(NULL
, mm
.x
, mm
.y
);
84 for (x
= rn1(6, 7); x
; x
--) {
86 mkgold(0L, mm
.x
, mm
.y
);
88 for (x
= rn1(6, 7); x
; x
--)
91 levl
[(xupstair
= mm
.x
)][(yupstair
= mm
.y
)].scrsym
= '<';
92 levl
[xupstair
][yupstair
].typ
= STAIRS
;
93 xdnstair
= ydnstair
= 0;
97 walkfrom(int x
, int y
)
102 levl
[x
][y
].typ
= ROOM
;
105 for (a
= 0; a
< 4; a
++)
112 levl
[x
][y
].typ
= ROOM
;
119 move(int *x
, int *y
, int dir
)
138 okay(int x
, int y
, int dir
)
142 if (x
< 3 || y
< 3 || x
> COLNO
- 3 || y
> ROWNO
- 3 ||
154 mm
.x
= 3 + 2 * rn2(COLNO
/ 2 - 2);
155 mm
.y
= 3 + 2 * rn2(ROWNO
/ 2 - 2);