* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved.
* Copy permission is hereby granted provided that this notice is
* retained on all partial or complete copies.
* For more info on this and all of my stuff, mail edjames@berkeley.edu.
static char sccsid
[] = "@(#)graphics.c 5.3 (Berkeley) 10/30/90";
WINDOW
*radar
, *cleanradar
, *credit
, *input
, *planes
;
while ((c
= getchar()) == -1 && errno
== EINTR
) ;
for (pp
= air
.head
; pp
!= NULL
; pp
= pp
->next
) {
wmove(cleanradar
, pp
->ypos
, pp
->xpos
* 2);
wmove(radar
, pp
->ypos
, pp
->xpos
* 2);
waddch(radar
, winch(cleanradar
));
wmove(cleanradar
, pp
->ypos
, pp
->xpos
* 2 + 1);
wmove(radar
, pp
->ypos
, pp
->xpos
* 2 + 1);
waddch(radar
, winch(cleanradar
));
for (pp
= air
.head
; pp
!= NULL
; pp
= pp
->next
) {
if (pp
->status
== S_MARKED
)
wmove(radar
, pp
->ypos
, pp
->xpos
* 2);
waddch(radar
, '0' + pp
->altitude
);
if (pp
->status
== S_MARKED
)
wrefresh(input
); /* return cursor */
static char buffer
[BUFSIZ
];
input
= newwin(INPUT_LINES
, COLS
- PLANE_COLS
, LINES
- INPUT_LINES
, 0);
credit
= newwin(INPUT_LINES
, PLANE_COLS
, LINES
- INPUT_LINES
,
planes
= newwin(LINES
- INPUT_LINES
, PLANE_COLS
, 0, COLS
- PLANE_COLS
);
radar
= newwin(scp
->height
, scp
->width
* 2, 0, 0);
cleanradar
= newwin(scp
->height
, scp
->width
* 2, 0, 0);
/* minus one here to prevent a scroll */
for (i
= 0; i
< PLANE_COLS
- 1; i
++) {
waddch(credit
, C_CREDIT
);
wmove(credit
, INPUT_LINES
- 1, i
);
waddch(credit
, C_CREDIT
);
wmove(credit
, INPUT_LINES
/ 2, 1);
waddstr(credit
, AUTHOR_STR
);
for (i
= 1; i
< scp
->height
- 1; i
++) {
for (j
= 1; j
< scp
->width
- 1; j
++) {
waddch(radar
, C_BACKROUND
);
* Draw the lines first, since people like to draw lines
* through beacons and exit points.
for (i
= 0; i
< scp
->num_lines
; i
++) {
draw_line(radar
, scp
->line
[i
].p1
.x
, scp
->line
[i
].p1
.y
,
scp
->line
[i
].p2
.x
, scp
->line
[i
].p2
.y
, str
);
for (i
= 0; i
< scp
->width
- 1; i
++)
waddch(radar
, C_TOPBOTTOM
);
wmove(radar
, scp
->height
- 1, 0);
for (i
= 0; i
< scp
->width
- 1; i
++)
waddch(radar
, C_TOPBOTTOM
);
for (i
= 1; i
< scp
->height
- 1; i
++) {
waddch(radar
, C_LEFTRIGHT
);
wmove(radar
, i
, (scp
->width
- 1) * 2);
waddch(radar
, C_LEFTRIGHT
);
for (i
= 0; i
< scp
->num_beacons
; i
++) {
wmove(radar
, scp
->beacon
[i
].y
, scp
->beacon
[i
].x
* 2);
for (i
= 0; i
< scp
->num_exits
; i
++) {
wmove(radar
, scp
->exit
[i
].y
, scp
->exit
[i
].x
* 2);
for (i
= 0; i
< scp
->num_airports
; i
++) {
str
[0] = airstr
[scp
->airport
[i
].dir
];
wmove(radar
, scp
->airport
[i
].y
, scp
->airport
[i
].x
* 2);
overwrite(radar
, cleanradar
);
draw_line(w
, x
, y
, lx
, ly
, s
)
for (i
= 0; i
< len
; i
++)
waddstr(input
, "Really quit? (y/n) ");
if (c
== EOF
|| c
== 'y') {
itv
.it_value
.tv_usec
= 0;
setitimer(ITIMER_REAL
, &itv
, NULL
);
wprintw(planes
, "Time: %-4d Safe: %d", clck
, safe_planes
);
waddstr(planes
, "pl dt comm");
for (pp
= air
.head
; pp
!= NULL
; pp
= pp
->next
) {
if (waddch(planes
, '\n') == ERR
) {
waddstr(planes
, command(pp
));
for (pp
= ground
.head
; pp
!= NULL
; pp
= pp
->next
) {
if (waddch(planes
, '\n') == ERR
) {
waddstr(planes
, command(pp
));
wmove(planes
, LINES
- INPUT_LINES
- 1, 0);
waddstr(planes
, "---- more ----");
itv
.it_value
.tv_usec
= 0;
setitimer(ITIMER_REAL
, &itv
, NULL
);
wprintw(input
, "Plane '%c' %s\n\nHit space for top players list...",
while ((c
= getchar()) != EOF
&& c
!= ' ')
clear(); /* move to top of screen */
/* refresh input last to get cursor in right place */
endwin(); /* clean up curses */