Commit | Line | Data |
---|---|---|
faa490bb KM |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
4cd7a139 KB |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
b7647a4b KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
faa490bb KM |
16 | */ |
17 | ||
18 | #ifndef lint | |
b7647a4b | 19 | static char sccsid[] = "@(#)init_field.c 5.3 (Berkeley) %G%"; |
4cd7a139 | 20 | #endif /* not lint */ |
faa490bb KM |
21 | |
22 | # include "robots.h" | |
23 | ||
24 | /* | |
25 | * init_field: | |
26 | * Lay down the initial pattern whih is constant across all levels, | |
27 | * and initialize all the global variables. | |
28 | */ | |
29 | init_field() | |
30 | { | |
31 | register int i; | |
32 | register WINDOW *wp; | |
33 | register int j; | |
34 | static bool first = TRUE; | |
35 | static char *desc[] = { | |
36 | "Directions:", | |
37 | "", | |
38 | "y k u", | |
39 | " \\|/", | |
40 | "h- -l", | |
41 | " /|\\", | |
42 | "b j n", | |
43 | "", | |
44 | "Commands:", | |
45 | "", | |
46 | "w: wait for end", | |
47 | "t: teleport", | |
48 | "q: quit", | |
49 | "^L: redraw screen", | |
50 | "", | |
51 | "Legend:", | |
52 | "", | |
53 | "+: robot", | |
54 | "*: junk heap", | |
55 | "@: you", | |
56 | "", | |
57 | "Score: 0", | |
58 | NULL | |
59 | }; | |
60 | ||
61 | Dead = FALSE; | |
62 | Waiting = FALSE; | |
63 | flushok(stdscr, TRUE); | |
64 | Score = 0; | |
65 | ||
66 | erase(); | |
67 | move(0, 0); | |
68 | addch('+'); | |
69 | for (i = 1; i < Y_FIELDSIZE; i++) { | |
70 | move(i, 0); | |
71 | addch('|'); | |
72 | } | |
73 | move(Y_FIELDSIZE, 0); | |
74 | addch('+'); | |
75 | for (i = 1; i < X_FIELDSIZE; i++) | |
76 | addch('-'); | |
77 | addch('+'); | |
78 | if (first) | |
79 | refresh(); | |
80 | move(0, 1); | |
81 | for (i = 1; i < X_FIELDSIZE; i++) | |
82 | addch('-'); | |
83 | addch('+'); | |
84 | for (i = 1; i < Y_FIELDSIZE; i++) { | |
85 | move(i, X_FIELDSIZE); | |
86 | addch('|'); | |
87 | } | |
88 | if (first) | |
89 | refresh(); | |
90 | for (i = 0; desc[i] != NULL; i++) { | |
91 | move(i, X_FIELDSIZE + 2); | |
92 | addstr(desc[i]); | |
93 | } | |
94 | if (first) | |
95 | refresh(); | |
96 | first = FALSE; | |
97 | #ifdef FANCY | |
98 | if (Pattern_roll) | |
99 | Next_move = &Move_list[-1]; | |
100 | #endif | |
101 | } |