xref: /csrg-svn/games/robots/init_field.c (revision 21465)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)init_field.c	5.1 (Berkeley) 05/30/85";
9 #endif not lint
10 
11 # include	"robots.h"
12 
13 /*
14  * init_field:
15  *	Lay down the initial pattern whih is constant across all levels,
16  *	and initialize all the global variables.
17  */
18 init_field()
19 {
20 	register int	i;
21 	register WINDOW	*wp;
22 	register int	j;
23 	static bool	first = TRUE;
24 	static char	*desc[] = {
25 				"Directions:",
26 				"",
27 				"y k u",
28 				" \\|/",
29 				"h- -l",
30 				" /|\\",
31 				"b j n",
32 				"",
33 				"Commands:",
34 				"",
35 				"w:  wait for end",
36 				"t:  teleport",
37 				"q:  quit",
38 				"^L: redraw screen",
39 				"",
40 				"Legend:",
41 				"",
42 				"+:  robot",
43 				"*:  junk heap",
44 				"@:  you",
45 				"",
46 				"Score: 0",
47 				NULL
48 	};
49 
50 	Dead = FALSE;
51 	Waiting = FALSE;
52 	flushok(stdscr, TRUE);
53 	Score = 0;
54 
55 	erase();
56 	move(0, 0);
57 	addch('+');
58 	for (i = 1; i < Y_FIELDSIZE; i++) {
59 		move(i, 0);
60 		addch('|');
61 	}
62 	move(Y_FIELDSIZE, 0);
63 	addch('+');
64 	for (i = 1; i < X_FIELDSIZE; i++)
65 		addch('-');
66 	addch('+');
67 	if (first)
68 		refresh();
69 	move(0, 1);
70 	for (i = 1; i < X_FIELDSIZE; i++)
71 		addch('-');
72 	addch('+');
73 	for (i = 1; i < Y_FIELDSIZE; i++) {
74 		move(i, X_FIELDSIZE);
75 		addch('|');
76 	}
77 	if (first)
78 		refresh();
79 	for (i = 0; desc[i] != NULL; i++) {
80 		move(i, X_FIELDSIZE + 2);
81 		addstr(desc[i]);
82 	}
83 	if (first)
84 		refresh();
85 	first = FALSE;
86 #ifdef	FANCY
87 	if (Pattern_roll)
88 		Next_move = &Move_list[-1];
89 #endif
90 }
91