-/* $Id: display.c,v 1.13 2006/07/25 17:21:51 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
+/* $Id: display.c,v 1.14 2006/07/25 17:59:36 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
/*
* Copyright (C) 1987, 1988 Chuck Simmons
init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
attron(A_BOLD); /* otherwise we get gray for white */
+ keypad(stdscr, TRUE);
}
#endif /* A_COLOR */
(void) addstr (msg);
}
+
+/*
+ * Map input character to direction offset.
+ * Attempts to enable arrow and keypad keys.
+ */
+int direction(c)
+chtype c;
+{
+ switch (c)
+ {
+ case 'w':
+ case 'W':
+ case KEY_UP:
+ return 0;
+
+ case 'e':
+ case 'E':
+ case KEY_A3:
+ case KEY_PPAGE:
+ return 1;
+
+ case 'd':
+ case 'D':
+ case KEY_RIGHT:
+ return 2;
+
+ case 'c':
+ case 'C':
+ case KEY_C3:
+ case KEY_NPAGE:
+ return 3;
+
+ case 'x':
+ case 'X':
+ case KEY_DOWN:
+ return 4;
+
+ case 'z':
+ case 'Z':
+ case KEY_C1:
+ case KEY_END:
+ return 5;
+
+ case 'a':
+ case 'A':
+ case KEY_LEFT:
+ return 6;
+
+ case 'q':
+ case 'Q':
+ case KEY_A1:
+ case KEY_HOME:
+ return 7;
+
+ default:
+ return -1;
+ }
+}
+
/*
This routine is called when the current display has been
trashed and no sector is shown on the screen.
fast.
*/
-static char dirchars[] = "WwEeDdCcXxZzAaQq";
-
char
e_cursor (edit_cursor)
long *edit_cursor;
{
- char e;
- char *p;
+ chtype e;
+ int p;
/* set up terminal */
(void) crmode ();
topini (); /* clear any error messages */
for (;;) {
- p = strchr (dirchars, e);
- if (!p) break;
+ p = direction (e);
+ if (p == -1) break;
- if (!move_cursor (edit_cursor, dir_offset[(p-dirchars) / 2]))
+ if (!move_cursor (edit_cursor, dir_offset[p]))
(void) beep ();
(void) refresh ();
-/* $Id: extern.h,v 1.10 2006/07/25 16:58:26 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
+/* $Id: extern.h,v 1.11 2006/07/25 17:21:51 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
/*
* Copyright (C) 1987, 1988 Chuck Simmons
void addprintf (char *str, int a, int b, int c, int d, int e, int f, int g, int h);
void addprintf1 (char *str, char *a, int b, int c, int d, int e, int f, int g, int h);
void addprintf2 (char *str, char *a, int b, int c, int d, char *e, char *f, int g, int h);
+int direction();
void init_game (void); /* game routines */
void save_game (void);
-.\" $Id: vms-empire.6,v 1.4 2002/08/01 18:58:22 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
+.\" $Id: vms-empire.6,v 1.5 2006/07/25 15:21:01 esr Exp esr $ - (c) Copyright 1987, 1988 Chuck Simmons */
.\"
.\" Copyright (C) 1987, 1988 Chuck Simmons
.\"
.fi
.ft 1
.P
+The arrow and keypad keys on your terminal, if any, should also work.
+.P
These keys move in the direction of the key from S. The
characters are not echoed and only 1 character is
accepted, so there is no need for a <Return>. Hit the <Space>
version completely written in C. In doing so, he completely
modified the computer strategy, the commands, the piece types,
many of the piece attributes, and the algorithm for creating maps.
+.P
+In 1994 Eric Raymond colorized the game.
.SH FILES
.TP 10
\f2empsave.dat\f1
* Tue Jul 25 2006 Eric S. Raymond <esr@snark.thyrsus.com> - 1.8-1
- Joe Wells's patch to enable different-sized worlds. Minor fixes to
map functions by Andrew Morrow. More on the history of the game.
+ Enable arrow keys in edit mode.
* Mon Sep 27 2004 Eric S. Raymond <esr@snark.thyrsus.com> 1.7-1
- Documentation fixes. The old empire.doc file has been replaced