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