home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 7 Games
/
07-Games.zip
/
MVTREK.ZIP
/
MAIN.C
< prev
next >
Wrap
Text File
|
1990-06-04
|
4KB
|
170 lines
/*
* 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
*
*/
#include "vtrek.h"
#include <os2.h>
char playership[] = " ? ";
int rolines = 0;
main()
{
int cmd, ch;
char str[44];
#ifdef AZTEC
int errortrap();
Sysvec[FLT_FAULT] = errortrap;
#endif
fflush(stdout);
cls();
fflush(stdout);
printf("Welcome to ANSI VTREK! This program was adopted from a UNIX based SYSTEM\n\r");
printf("and ported to OS/2. Additional modifications to the code in order to allow\n\r");
printf("VTREK to run under the MAXIMUS BBS SYSTEM was developed and put into place\n\r");
printf("by Steve Lesner. It uses the MAXPIPE program written by Peter Fitzsimmons.\n\r");
printf("\n\r");
printf("The best way to get familiar with this program is to read the Instructions\n\r");
printf("at least ONCE! If you get loss anytime and forgot how to QUIT, REMEMBER\n\r");
printf("that typing 'K' will kill your ship and quit the game and return to the BBS!\n\r");
printf("\n\r");
fflush(stdout);
printf("Do you have Ansi Graphics ON <Y/n> ? ");
fflush(stdout);
ch = getchar();
fflush(stdout);
fflush(stdin);
if (Toupper(ch) == 'N')
exit(1);
printf("\n\r");
fflush(stdout);
instructions();
fflush(stdout);
initvars();
fflush(stdout);
terminit();
fflush(stdout);
replot();
fflush(stdout);
sprintf(str, "You have %.1f stardates to save the", lastdate - stardate);
fflush(stdout);
readout(ADDLINE, str);
fflush(stdout);
readout(ADDLINE, "Federation from the Klingon invasion.");
fflush(stdout);
setcondition();
while (numkling > 0) {
fflush(stdout);
switch (cmd = getcmd()) {
case 'H' : /* hyper-space */
hyperspace();
break;
case 'S' : /* short range scan */
srs();
break;
case 'L' : /* long range scan */
lrs();
break;
case 'P' : /* fire phasers */
phasers();
break;
case 'T' : /* fire photon torpedo */
torpedo();
break;
case 'U' : /* change shield level */
defense();
break;
case 'R' : /* replot screen */
replot();
continue;
case 'Q' : /* move using impulse engines */
case 'W' :
case 'E' :
case 'A' :
case 'D' :
case 'Z' :
case 'X' :
case 'C' :
impulse(cmd);
break;
case 'K' : /* kill - commit suicide */
fflush(stdout);
prompt("Quit <y/N> ? ");
fflush(stdout);
ch = getchar();
fflush(stdout);
fflush(stdin);
if (Toupper(ch) == 'Y')
die();
break;
case 'F' : /* fix devices */
repdevices();
break;
case 03 : /* exit without warning */
case 04 :
die();
break;
case '?' : /* help */
help();
fflush(stdout);
readout(ADDLINE, "K = Kill & Quit (Press RETURN)");
ch = getchar();
fflush(stdout);
fflush(stdin);
break;
default : /* illegal command */
readout(ADDLINE, "Type '?' for help.");
break;
}
fixdev(REL, RND, 5);
setcondition();
klingmove();
if ((stardate += 0.1) > lastdate)
timeout();
plt_stat(ELEMENT, STARDATE);
plt_num(INFO);
if (energy <= 0 && shields <= 0)
dead();
}
win();
}
#ifdef AZTEC
errortrap(errcode, addr)
int errcode, addr;
{
}
#endif