summaryrefslogtreecommitdiffstats
path: root/sail/pl_7.c
diff options
context:
space:
mode:
Diffstat (limited to 'sail/pl_7.c')
-rw-r--r--sail/pl_7.c109
1 files changed, 89 insertions, 20 deletions
diff --git a/sail/pl_7.c b/sail/pl_7.c
index 1268c1fe..c1525b4c 100644
--- a/sail/pl_7.c
+++ b/sail/pl_7.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_7.c,v 1.6 1995/04/22 10:37:17 cgd Exp $ */
+/* $NetBSD: pl_7.c,v 1.7 1997/10/13 19:45:39 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -33,16 +33,23 @@
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: pl_7.c,v 1.6 1995/04/22 10:37:17 cgd Exp $";
+__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>
/*
@@ -54,6 +61,7 @@ static char *sc_prompt;
static char *sc_buf;
static int sc_line;
+void
initscreen()
{
/* initscr() already done in SCREENTEST() */
@@ -71,6 +79,7 @@ initscreen()
crmode();
}
+void
cleanupscreen()
{
/* alarm already turned off */
@@ -82,8 +91,10 @@ cleanupscreen()
}
}
+/*ARGSUSED*/
void
-newturn()
+newturn(n)
+ int n;
{
repaired = loaded = fired = changed = 0;
movebuf[0] = '\0';
@@ -135,23 +146,65 @@ newturn()
}
/*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)
@@ -160,8 +213,9 @@ Scroll()
(void) wclrtoeol(scroll_w);
}
+void
prompt(p, ship)
-register char *p;
+char *p;
struct ship *ship;
{
static char buf[60];
@@ -177,6 +231,7 @@ struct ship *ship;
(void) waddstr(scroll_w, p);
}
+void
endprompt(flag)
char flag;
{
@@ -185,12 +240,13 @@ char flag;
Scroll();
}
+int
sgetch(p, ship, flag)
char *p;
struct ship *ship;
char flag;
{
- register c;
+ int c;
prompt(p, ship);
blockalarm();
@@ -204,13 +260,14 @@ char flag;
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;
@@ -242,6 +299,7 @@ register n;
}
}
+void
draw_screen()
{
draw_view();
@@ -251,9 +309,10 @@ draw_screen()
(void) wrefresh(scroll_w); /* move the cursor */
}
+void
draw_view()
{
- register struct ship *sp;
+ struct ship *sp;
(void) werase(view_w);
foreachship(sp) {
@@ -274,6 +333,7 @@ draw_view()
(void) wrefresh(view_w);
}
+void
draw_turn()
{
(void) wmove(turn_w, 0, 0);
@@ -281,6 +341,7 @@ draw_turn()
(void) wrefresh(turn_w);
}
+void
draw_stat()
{
(void) wmove(stat_w, STAT_1, 0);
@@ -321,6 +382,7 @@ draw_stat()
(void) wrefresh(stat_w);
}
+void
draw_slot()
{
if (!boarding(ms, 0)) {
@@ -384,9 +446,10 @@ draw_slot()
(void) wrefresh(slot_w);
}
+void
draw_board()
{
- register int n;
+ int n;
(void) clear();
(void) werase(view_w);
@@ -431,32 +494,38 @@ draw_board()
(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)