|
|
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 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. ! 16: */ ! 17: ! 18: #ifndef lint ! 19: static char sccsid[] = "@(#)make_level.c 5.3 (Berkeley) 6/18/88"; ! 20: #endif /* not lint */ ! 21: ! 22: # include "robots.h" ! 23: ! 24: /* ! 25: * make_level: ! 26: * Make the current level ! 27: */ ! 28: make_level() ! 29: { ! 30: register int i; ! 31: register COORD *cp; ! 32: register WINDOW *wp; ! 33: register int x, *endp; ! 34: ! 35: reset_count(); ! 36: for (i = 1; i < Y_FIELDSIZE; i++) ! 37: for (x = 1; x < X_FIELDSIZE; x++) ! 38: if (Field[i][x] != 0) ! 39: mvaddch(i, x, ' '); ! 40: if (My_pos.y > 0) ! 41: mvaddch(My_pos.y, My_pos.x, ' '); ! 42: ! 43: Waiting = FALSE; ! 44: Wait_bonus = 0; ! 45: leaveok(stdscr, FALSE); ! 46: for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++) ! 47: cp->y = -1; ! 48: My_pos.y = -1; ! 49: ! 50: bzero(Field, sizeof Field); ! 51: Min.y = Y_FIELDSIZE; ! 52: Min.x = X_FIELDSIZE; ! 53: Max.y = 0; ! 54: Max.x = 0; ! 55: if ((i = Level * 10) > MAXROBOTS) ! 56: i = MAXROBOTS; ! 57: Num_robots = i; ! 58: while (i-- > 0) { ! 59: cp = rnd_pos(); ! 60: Robots[i] = *cp; ! 61: Field[cp->y][cp->x]++; ! 62: if (cp->y < Min.y) ! 63: Min.y = cp->y; ! 64: if (cp->x < Min.x) ! 65: Min.x = cp->x; ! 66: if (cp->y > Max.y) ! 67: Max.y = cp->y; ! 68: if (cp->x > Max.x) ! 69: Max.x = cp->x; ! 70: } ! 71: My_pos = *rnd_pos(); ! 72: refresh(); ! 73: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.