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