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 this notice is preserved and that due credit is given 7 * to the University of California at Berkeley. The name of the University 8 * may not be used to endorse or promote products derived from this 9 * software without specific prior written permission. This software 10 * is provided ``as is'' without express or implied warranty. 11 */ 12 13 #ifndef lint 14 static char sccsid[] = "@(#)init_field.c 5.2 (Berkeley) 03/09/88"; 15 #endif /* not lint */ 16 17 # include "robots.h" 18 19 /* 20 * init_field: 21 * Lay down the initial pattern whih is constant across all levels, 22 * and initialize all the global variables. 23 */ 24 init_field() 25 { 26 register int i; 27 register WINDOW *wp; 28 register int j; 29 static bool first = TRUE; 30 static char *desc[] = { 31 "Directions:", 32 "", 33 "y k u", 34 " \\|/", 35 "h- -l", 36 " /|\\", 37 "b j n", 38 "", 39 "Commands:", 40 "", 41 "w: wait for end", 42 "t: teleport", 43 "q: quit", 44 "^L: redraw screen", 45 "", 46 "Legend:", 47 "", 48 "+: robot", 49 "*: junk heap", 50 "@: you", 51 "", 52 "Score: 0", 53 NULL 54 }; 55 56 Dead = FALSE; 57 Waiting = FALSE; 58 flushok(stdscr, TRUE); 59 Score = 0; 60 61 erase(); 62 move(0, 0); 63 addch('+'); 64 for (i = 1; i < Y_FIELDSIZE; i++) { 65 move(i, 0); 66 addch('|'); 67 } 68 move(Y_FIELDSIZE, 0); 69 addch('+'); 70 for (i = 1; i < X_FIELDSIZE; i++) 71 addch('-'); 72 addch('+'); 73 if (first) 74 refresh(); 75 move(0, 1); 76 for (i = 1; i < X_FIELDSIZE; i++) 77 addch('-'); 78 addch('+'); 79 for (i = 1; i < Y_FIELDSIZE; i++) { 80 move(i, X_FIELDSIZE); 81 addch('|'); 82 } 83 if (first) 84 refresh(); 85 for (i = 0; desc[i] != NULL; i++) { 86 move(i, X_FIELDSIZE + 2); 87 addstr(desc[i]); 88 } 89 if (first) 90 refresh(); 91 first = FALSE; 92 #ifdef FANCY 93 if (Pattern_roll) 94 Next_move = &Move_list[-1]; 95 #endif 96 } 97