ccrdave@ucdavis.UUCP (Lord Kahless) (09/16/85)
/* Hail Victory.
* The vtrek game doesn't work with many vt100 termcap entries on
* the local 4.2 BSD systems. The following modifications make it work
* on our 4.2 systems. I suspect it will not work on all versions
* of UNIX, but it works perfectly on a Wyse 75, vt220, and a Microterm
* Ergo 320, all used in the 1200 to 2400 baud range at 4.2 BSD Davis.
*
* I asked if anybody was interested in a fix, and got several requests.
* Here it is.
*
* If you have found your version doesn't work, try replacing the code
* in the original game with the code below. If it still doesn't work,
* consider the amount of padding in your termcap for cursor movement
* and try adding the use of tputs, documented in termcap (3).
*/
/* the following replaces main.c. Basically, I define several variables
* to hold necessary information for the termcap routines.
*/
/*
* main.c
*
* visual star trek
*
* BASIC version written by Tom Goerz and debugged by Dug Patrick
* 22-Dec-79, 13-Nov-80
* C version written by Dug Patrick
* 05-Aug-84, 11-Mar-85
*
* Minor hack to make work on some vt10X emulators, Lord Kahless,
* 850911.0200
*
*/
#include "vtrek.h"
char playership[] = " ? ";
int rolines = 0;
main()
{
int cmd, ch;
char str[44];
#ifdef AZTEC
int errortrap();
Sysvec[FLT_FAULT] = errortrap;
#endif
#ifndef AZTEC /* if it isn't an AZTEC, define the termcap variables */
char c;
char PC;
char *BP;
char bp [1024], *name;
char *TERM;
char *tgetstr ();
char *tgetent ();
char *getenv ();
char *tgoto ();
char *x;
extern char *nCM;
extern char cmbuf [30];
x = cmbuf;
/* get name of term */
name = getenv ("TERM");
/* get the termcap of the terminal */
tgetent (bp,name);
/* get the cursor positioning string */
nCM = tgetstr("cm", &x);
#endif
/* this is the move cursor routine from termio.c */
/* move cursor */
moveyx(ypos,xpos)
int ypos,xpos;
{
#ifdef AZTEC
printf("%s%c%c", cm, ypos+31, xpos+31);
#else /* UNIX 4.2 */
extern char *nCM;
extern char cmbuf [30];
char cmbuf2 [30];
char *ca;
char *tgoto ();
int i;
/* Higher baud rates will probably require use of padding. */
ca = cmbuf2;
ca = tgoto (nCM,xpos-1,ypos-1);
printf ("%s",ca);
# endif
}