+/* $NetBSD: pl_7.c,v 1.7 1997/10/13 19:45:39 christos Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
-/*static char sccsid[] = "from: @(#)pl_7.c 5.7 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: pl_7.c,v 1.4 1993/08/10 02:20:52 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: pl_7.c,v 1.7 1997/10/13 19:45:39 christos Exp $");
+#endif
#endif /* not lint */
+#include <sys/ttydefaults.h>
#include "player.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+#include <unistd.h>
+
/*
* Display interface
static char *sc_buf;
static int sc_line;
+void
initscreen()
{
/* initscr() already done in SCREENTEST() */
(void) leaveok(slot_w, 1);
(void) leaveok(stat_w, 1);
(void) leaveok(turn_w, 1);
-#ifdef SIGTSTP
- {
- void susp();
- (void) signal(SIGTSTP, susp);
- }
-#endif
noecho();
crmode();
}
+void
cleanupscreen()
{
/* alarm already turned off */
}
}
+/*ARGSUSED*/
void
-newturn()
+newturn(n)
+ int n;
{
repaired = loaded = fired = changed = 0;
movebuf[0] = '\0';
}
/*VARARGS2*/
-Signal(fmt, ship, a, b, c, d)
-char *fmt;
-register struct ship *ship;
-int a, b, c, d;
+void
+#ifdef __STDC__
+Signal(const char *fmt, struct ship *ship, ...)
+#else
+Signal(va_alist)
+ va_dcl
+#endif
{
+ va_list ap;
+ char format[BUFSIZ];
+#ifndef __STDC__
+ const char *fmt;
+ struct ship *ship;
+
+ va_start(ap);
+ fmt = va_arg(ap, const char *);
+ ship = va_arg(ap, struct ship *);
+#else
+ va_start(ap, ship);
+#endif
if (!done_curses)
return;
if (*fmt == '\7')
putchar(*fmt++);
- if (ship == 0)
- (void) wprintw(scroll_w, fmt, a, b, c, d);
- else
- (void) wprintw(scroll_w, fmt, ship->shipname,
- colours(ship), sterncolour(ship), a, b, c, d);
+ fmtship(format, sizeof(format), fmt, ship);
+ (void) vwprintw(scroll_w, format, ap);
+ va_end(ap);
+ Scroll();
+}
+
+/*VARARGS2*/
+void
+#ifdef __STDC__
+Msg(const char *fmt, ...)
+#else
+Msg(va_alist)
+ va_dcl
+#endif
+{
+ va_list ap;
+#ifndef __STDC__
+ const char *fmt;
+
+ va_start(ap);
+ fmt = va_arg(ap, const char *);
+#else
+ va_start(ap, fmt);
+#endif
+
+ if (!done_curses)
+ return;
+ if (*fmt == '\7')
+ putchar(*fmt++);
+ (void) vwprintw(scroll_w, fmt, ap);
+ va_end(ap);
Scroll();
}
+void
Scroll()
{
if (++sc_line >= SCROLL_Y)
(void) wclrtoeol(scroll_w);
}
+void
prompt(p, ship)
-register char *p;
+char *p;
struct ship *ship;
{
static char buf[60];
(void) waddstr(scroll_w, p);
}
+void
endprompt(flag)
char flag;
{
Scroll();
}
+int
sgetch(p, ship, flag)
char *p;
struct ship *ship;
char flag;
{
- register c;
+ int c;
prompt(p, ship);
blockalarm();
return c;
}
+void
sgetstr(pr, buf, n)
char *pr;
-register char *buf;
-register n;
+char *buf;
+int n;
{
- register c;
- register char *p = buf;
+ int c;
+ char *p = buf;
prompt(pr, (struct ship *)0);
sc_buf = buf;
}
}
+void
draw_screen()
{
draw_view();
(void) wrefresh(scroll_w); /* move the cursor */
}
+void
draw_view()
{
- register struct ship *sp;
+ struct ship *sp;
(void) werase(view_w);
foreachship(sp) {
(void) wrefresh(view_w);
}
+void
draw_turn()
{
(void) wmove(turn_w, 0, 0);
(void) wrefresh(turn_w);
}
+void
draw_stat()
{
(void) wmove(stat_w, STAT_1, 0);
(void) wrefresh(stat_w);
}
+void
draw_slot()
{
if (!boarding(ms, 0)) {
(void) wrefresh(slot_w);
}
+void
draw_board()
{
- register int n;
+ int n;
(void) clear();
(void) werase(view_w);
(void) refresh();
}
+void
centerview()
{
viewrow = mf->row - VIEW_Y / 2;
viewcol = mf->col - VIEW_X / 2;
}
+void
upview()
{
viewrow -= VIEW_Y / 3;
}
+void
downview()
{
viewrow += VIEW_Y / 3;
}
+void
leftview()
{
viewcol -= VIEW_X / 5;
}
+void
rightview()
{
viewcol += VIEW_X / 5;
}
+void
adjustview()
{
if (dont_adjust)
else if (mf->col > viewcol + (VIEW_X - VIEW_X/8))
viewcol = mf->col - VIEW_X/8;
}
-
-#ifdef SIGTSTP
-void
-susp()
-{
- blockalarm();
- tstp(SIGTSTP);
- (void) signal(SIGTSTP, susp);
- unblockalarm();
-}
-#endif