-/* $NetBSD: display.h,v 1.5 2009/03/15 00:35:42 dholland Exp $ */
+/* $NetBSD: display.h,v 1.6 2009/03/15 00:50:47 dholland Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <stdbool.h>
+
void display_show_obp(int which, bool show);
void display_show_dbp(int which, bool show);
void display_refresh_slot_w(void);
+
+void display_hide_prompt(void);
+void display_reshow_prompt(void);
+void display_adjust_view(void);
-/* $NetBSD: pl_2.c,v 1.11 2003/08/07 09:37:43 agc Exp $ */
+/* $NetBSD: pl_2.c,v 1.12 2009/03/15 00:50:47 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)pl_2.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_2.c,v 1.11 2003/08/07 09:37:43 agc Exp $");
+__RCSID("$NetBSD: pl_2.c,v 1.12 2009/03/15 00:50:47 dholland Exp $");
#endif
#endif /* not lint */
#include <signal.h>
+#include <unistd.h>
+#include "display.h"
#include "extern.h"
#include "player.h"
+/*ARGSUSED*/
+void
+newturn(int n __unused)
+{
+ repaired = loaded = fired = changed = 0;
+ movebuf[0] = '\0';
+
+ alarm(0);
+ if (mf->readyL & R_LOADING) {
+ if (mf->readyL & R_DOUBLE)
+ mf->readyL = R_LOADING;
+ else
+ mf->readyL = R_LOADED;
+ }
+ if (mf->readyR & R_LOADING) {
+ if (mf->readyR & R_DOUBLE)
+ mf->readyR = R_LOADING;
+ else
+ mf->readyR = R_LOADED;
+ }
+ if (!hasdriver)
+ send_ddead();
+
+ display_hide_prompt();
+ if (Sync() < 0)
+ leave(LEAVE_SYNC);
+ if (!hasdriver)
+ leave(LEAVE_DRIVER);
+ display_reshow_prompt();
+
+ if (turn % 50 == 0)
+ send_alive();
+ if (mf->FS && (!mc->rig1 || windspeed == 6))
+ send_fs(ms, 0);
+ if (mf->FS == 1)
+ send_fs(ms, 2);
+
+ if (mf->struck)
+ leave(LEAVE_QUIT);
+ if (mf->captured != 0)
+ leave(LEAVE_CAPTURED);
+ if (windspeed == 7)
+ leave(LEAVE_HURRICAN);
+
+ display_adjust_view();
+ draw_screen();
+
+ signal(SIGALRM, newturn);
+ alarm(7);
+}
+
void
play(void)
{
-/* $NetBSD: pl_7.c,v 1.33 2009/03/15 00:35:42 dholland Exp $ */
+/* $NetBSD: pl_7.c,v 1.34 2009/03/15 00:50:47 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
#if 0
static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_7.c,v 1.33 2009/03/15 00:35:42 dholland Exp $");
+__RCSID("$NetBSD: pl_7.c,v 1.34 2009/03/15 00:50:47 dholland Exp $");
#endif
#endif /* not lint */
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
#include "extern.h"
#include "player.h"
static void Scroll(void);
static void endprompt(int);
-static void adjustview(void);
/*
* Display interface
}
}
-/*ARGSUSED*/
-void
-newturn(int n __unused)
-{
- repaired = loaded = fired = changed = 0;
- movebuf[0] = '\0';
-
- alarm(0);
- if (mf->readyL & R_LOADING) {
- if (mf->readyL & R_DOUBLE)
- mf->readyL = R_LOADING;
- else
- mf->readyL = R_LOADED;
- }
- if (mf->readyR & R_LOADING) {
- if (mf->readyR & R_DOUBLE)
- mf->readyR = R_LOADING;
- else
- mf->readyR = R_LOADED;
- }
- if (!hasdriver)
- send_ddead();
-
- if (sc_hasprompt) {
- wmove(scroll_w, sc_line, 0);
- wclrtoeol(scroll_w);
- }
- if (Sync() < 0)
- leave(LEAVE_SYNC);
- if (!hasdriver)
- leave(LEAVE_DRIVER);
- if (sc_hasprompt)
- wprintw(scroll_w, "%s%s", sc_prompt, sc_buf);
-
- if (turn % 50 == 0)
- send_alive();
- if (mf->FS && (!mc->rig1 || windspeed == 6))
- send_fs(ms, 0);
- if (mf->FS == 1)
- send_fs(ms, 2);
-
- if (mf->struck)
- leave(LEAVE_QUIT);
- if (mf->captured != 0)
- leave(LEAVE_CAPTURED);
- if (windspeed == 7)
- leave(LEAVE_HURRICAN);
-
- adjustview();
- draw_screen();
-
- signal(SIGALRM, newturn);
- alarm(7);
-}
-
/*VARARGS2*/
void
Signal(const char *fmt, struct ship *ship, ...)
Scroll();
}
+/*
+ * Next two functions called from newturn() to poke display. Shouldn't
+ * exist... XXX
+ */
+
+void
+display_hide_prompt(void)
+{
+ if (sc_hasprompt) {
+ wmove(scroll_w, sc_line, 0);
+ wclrtoeol(scroll_w);
+ }
+}
+
+void
+display_reshow_prompt(void)
+{
+ if (sc_hasprompt)
+ wprintw(scroll_w, "%s%s", sc_prompt, sc_buf);
+}
+
+
int
sgetch(const char *p, struct ship *ship, int flag)
{
viewcol += VIEW_X / 5;
}
-static void
-adjustview(void)
+/* Called from newturn()... rename? */
+void
+display_adjust_view(void)
{
if (dont_adjust)
return;