warp/README 644 171 5 7235 5121747671 5735 Warp Kit, Version 7.0
Copyright (c) 1986, Larry Wall
You may copy the warp kit in whole or in part as long as you don't try to
make money off it, or pretend that you wrote it.
--------------------------------------------------------------------------
Warp is a real-time space war game that doesn't get boring very quickly.
Read warp.doc and the manual page for more information.
Warp will probably not run on V7 systems that don't have a non-blocking read,
or on machines with a small address space like the PDP-11. Caveat Emptor.
Please read all the directions below before you proceed any further, and
then follow them carefully. Failure to do so may void your warranty. :-)
After you have unpacked your kit, you should have all the files listed
in MANIFEST.
IMPORTANT
You must choose the uid that you want warp to run under, since warp runs
setuid to protect its files. Choose a uid (not root) that is used only
by trustworthy persons. If you do your make install as root, the installed
version will be chowned to this uid. Otherwise, you should login to your
selected uid before proceeding. The Configure script will ask you which
uid you want warp to run under.
Installation
1) Run Configure. This will figure out various things about your system.
Some things Configure will figure out for itself, other things it will
ask you about. It will then proceed to make config.h, config.sh, and
Makefile.
You might possibly have to trim # comments from the front of Configure
if your sh doesn't handle them, but all other # comments will be taken
care of.
(If you don't have sh, you'll have to copy the sample file config.H to
config.h and edit the config.h to reflect your system's peculiarities.)
2) Glance through config.h to make sure system dependencies are correct.
Most of them should have been taken care of by running the Configure script.
If you have any additional changes to make to the C definitions, they
can be done in the Makefile, or in config.h. Bear in mind that they will
get undone next time you run Configure.
3) make depend
This will look for all the includes and modify Makefile accordingly.
Configure will offer to do this for you.
4) make
This will attempt to make warp in the current directory.
5) make install
This will put warp into a public directory (normally /usr/games).
It will also try to put the man pages in a reasonable place. It will not
nroff the man page, however. You may need to be root to do this. If
you are not root, you must own the directories in question and you should
ignore any messages about chown not working.
6) Read the manual entry before running warp.
7) Feel free to edit warp.news.
8) IMPORTANT! Help save the world! Communicate any problems and
suggested patches to me, [email protected] (Larry Wall), so we can
keep the world in sync. If you have a problem, there's someone else
out there who either has had or will have the same problem.
If possible, send in patches such that the patch program will apply them.
Context diffs are the best, then normal diffs. Don't send ed scripts--
I've probably changed my copy since the version you have.
Watch for warp patches in comp.sources.bugs. Patches will generally be
in a form usable by the patch program. If you are just now bringing up
warp and aren't sure how many patches there are, write to me and I'll
send any you don't have. Your current patch level is shown in patchlevel.h.
NEW FEATURES IN THIS RELEASE
Uses a Configure script for greater portability.
Space Amoebas!!!
Pirates
Friendly Freighters
Harry Mudd
Damage
Keyboard mapping
hanged my copy since the version you have.
Watch for warp patches in comp.sources.bugs. Patches will generally be
in a form usable by the patch program. If you are just now bringing up
warp and aren't sure how many patches there are, write to me and I'll
send any you don't have. Your current patch level is shown in patchlevel.h.
NEwarp/score.c 644 171 5 44335 5121747700 6347 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.2 86/10/20 12:06:56 lwall
* Made all exits reset tty.
*
* Revision 7.0.1.1 86/10/16 10:52:47 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:13:14 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "intrp.h"
#include "object.h"
#include "play.h"
#include "sig.h"
#include "term.h"
#include "us.h"
#include "util.h"
#include "weapon.h"
#include "INTERN.h"
#include "score.h"
void
score_init()
{
Reg1 char *s;
Reg2 int i;
FILE *savfil;
if (stat(SAVEDIR,&filestat)) {
printf("Cannot access %s\r\n",SAVEDIR);
finalize(1);
}
if (filestat.st_uid != geteuid()) {
#ifdef GETPWENT
printf("Warp will not run right without being setuid.\r\n");
#else
getpw(filestat.st_uid, spbuf);
s = index(spbuf, ':');
*s = '\0';
printf("Warp will not run right without being setuid to %s.\r\n",spbuf);
#endif
finalize(1);
}
if ((filestat.st_mode & 0605) != 0605) {
printf("%s is not protected correctly (must be u+rw o+rx).\r\n",SAVEDIR);
finalize(1);
}
#ifdef SCOREFULL
interp(longlognam, sizeof longlognam, "%N");
for (i=strlen(longlognam); i<24; i++)
longlognam[i] = ' '; /* make sure it is 24 long for strncmp */
longlognam[24] = '\0';
#else
interp(longlognam, sizeof longlognam, "%L");
for (i=strlen(longlognam); i<8; i++)
longlognam[i] = ' '; /* make sure it is 8 long for strncmp */
longlognam[8] = '\0';
#endif
if (scorespec)
wscore();
Sprintf(savefilename, "save.%s", logname);
savfil = experimenting ? NULL : fopen(savefilename,"r");
if (savfil != NULL && fgets(spbuf,100,savfil) != NULL) {
char tmpbuf[80];
spbuf[strlen(spbuf)-1] = '\0';
if (fgets(tmpbuf,80,savfil) != NULL) {
int processnum;
tmpbuf[strlen(tmpbuf)-1] = '\0';
printf("You seem to have left a game %s.\r\n",tmpbuf+9);
s = index(tmpbuf+9, ',');
*s = '\0';
processnum = atoi(s+11);
if (kill(processnum, SIGINT)) {
/* does process not exist? */
/* (warp ignores SIGINT) */
printf("\r\n\
That process does not seem to exist anymore, so you'll have to start the\r\n");
printf(
"last wave over.\r\n\n");
printf(
" [type anything to continue]");
Fflush(stdout);
eat_typeahead();
getcmd(tmpbuf);
if (*tmpbuf == INTRCH)
finalize(0);
printf("\r\n");
}
else {
if (strcmp(term+8,tmpbuf+23)) {
printf(
"That is not your current terminal--you are on %s.\r\n", term+5);
printf("\r\nYour options:\r\n");
printf(" 1) Exit and find the terminal it's running on\r\n");
}
else {
printf("\r\nYour options:\r\n");
printf(" 1) Exit and try to foreground it\r\n");
}
printf(" 2) Let me terminate the other game\r\n\n");
printf("What do you want to do? ");
Fflush(stdout);
eat_typeahead();
getcmd(tmpbuf);
printf("\r\n");
if (*tmpbuf == INTRCH)
finalize(0);
if (*tmpbuf == '1') {
printf(
"If you don't succeed, come back and do option 2 instead. Good luck.\r\n");
finalize(0);
}
printf(
"Ok, hang on a few moments \r\n");
Fclose(savfil);
if (kill(processnum, SIGQUIT)) {
printf("Unable to kill process #%d!\r\n",processnum);
roundsleep(2);
}
else {
#ifdef SIGCONT
kill(processnum, SIGCONT);
#endif
for (i=15; i; --i) {
sleep(1);
if (kill(processnum,SIGINT))
/* does process not exist? */
/* (warp ignores SIGINT) */
break;
}
didkill++;
}
savfil = fopen(savefilename,"r");
if (savfil != NULL) {
Fgets(spbuf,100,savfil);
}
}
}
}
else
savfil = NULL;
if (savfil == NULL) {
totalscore = smarts = cumsmarts = wave = 0;
numents = 5;
numbases = 3;
}
else {
totalscore = atol(spbuf+9);
smarts = atoi(spbuf+20);
cumsmarts = atoi(spbuf+24);
numents = atoi(spbuf+30);
numbases = atoi(spbuf+33);
wave = atoi(spbuf+36);
apolspec = (spbuf[40] == 'a');
beginner = (spbuf[41] == 'b');
crushspec = (spbuf[42] == 'c');
gornspec = (spbuf[43] == 'g');
massacre = (spbuf[44] == 'm');
romspec = (spbuf[45] == 'r');
tholspec = (spbuf[46] == 't');
lowspeed = (spbuf[47] == 'l') || lowspeed;
amoebaspec = (spbuf[48] == '&');
Fclose(savfil);
}
if (!ismarts) {
ismarts = 1;
clear();
page(NEWSFILE,FALSE);
if (smarts) {
printf("\r\nSaved game: SCORE DIFF CUMDIFF ENTERPRISES BASES WAVE");
printf("\r\n %7ld %2d %4d %1d %1d %3d",
totalscore,smarts,cumsmarts,numents,numbases,wave);
}
printf("\r\nWould you like instructions? ");
Fflush(stdout);
eat_typeahead();
getcmd(buf);
printf("\r\n");
if (*buf == INTRCH)
finalize(0);
if (*buf == 'Y' || *buf == 'y') {
page(HELPFILE,FALSE);
printf("\r\nWould you like to play easy games for a while? ");
Fflush(stdout);
eat_typeahead();
getcmd(buf);
printf("\r\n");
if (*buf == 'Y' || *buf == 'y') {
beginner = TRUE;
lowspeed = TRUE;
}
}
}
if (!smarts)
smarts = ismarts;
}
void
wscore()
{
clear();
printf(" TOP WARPISTS\r\n\n");
printf("RANK WHO AKA SCORE DIFF CUMDIFF WHEN\r\n");
page(SCOREBOARD,TRUE);
printf(" [Type anything to continue]");
Fflush(stdout);
getcmd(spbuf);
if (*spbuf == INTRCH)
finalize(0);
clear();
printf(" TOP LOW-SPEED WARPISTS\r\n\n");
printf("RANK WHO AKA SCORE DIFF CUMDIFF WHEN\r\n");
page(LSCOREBOARD,TRUE);
printf(" [Type anything to continue]");
Fflush(stdout);
getcmd(spbuf);
if (*spbuf == INTRCH)
finalize(0);
clear();
printf(" TOP FUNNY WARPISTS\r\n\n");
printf("RANK WHO AKA SCORE DIFF CUMDIFF WHEN\r\n");
page(FSCOREBOARD,TRUE);
printf(" [Type anything to continue]");
Fflush(stdout);
getcmd(spbuf);
if (*spbuf == INTRCH)
finalize(0);
clear();
printf(" GAMES SAVED OR IN PROGRESS\r\n\n");
printf("WHO SCORE DF CDF E B WV FLAGS\r\n");
resetty();
Sprintf(spbuf,"/bin/cat %ssave.*",SAVEDIR);
#ifndef lint
execl("/bin/sh", "sh", "-c", spbuf, 0);
#endif
finalize(1);
}
void
display_status()
{
Reg1 int tmp;
static char *status_names[] = {"Impl", "Warp", "Base", "****" };
if (oldstatus != status) {
Sprintf(spbuf,"%-4s",status_names[status]);
mvaddstr(0,0, spbuf);
oldstatus = status;
}
if (ent) {
if (ent->energy != oldeenergy) {
oldeenergy = ent->energy;
Sprintf(spbuf,"%4d",oldeenergy);
mvaddstr(0,8, spbuf);
}
if (etorp != oldetorp) {
Sprintf(spbuf,"%2d",etorp);
mvaddstr(0,13, spbuf);
oldetorp = etorp;
}
}
else {
if (etorp >= 0) {
etorp = -1;
mvaddstr(0,8,"*******");
damage = 0;
}
}
if (base) {
if (base->energy != oldbenergy) {
oldbenergy = base->energy;
Sprintf(spbuf,"%5d",oldbenergy);
mvaddstr(0,19, spbuf);
}
if (btorp != oldbtorp) {
Sprintf(spbuf,"%3d",btorp);
mvaddstr(0,25, spbuf);
oldbtorp = btorp;
}
}
else {
if (btorp >= 0) {
btorp = -1;
mvaddstr(0,19,"*********");
}
}
if (damage) {
if (!olddamage)
mvaddstr(0,42,"*** ");
if (damage > 1 || !damflag[dam]) {
do {
if (++dam == MAXDAMAGE)
dam = 0;
} while (!damflag[dam]);
}
if (!--damflag[dam]) {
olddamage = damage;
damage--;
Sprintf(spbuf,"%s OK *** ",dammess[dam]);
spbuf[15] = '\0';
mvaddstr(0,46,spbuf);
}
else if (dam == NOSHIELDS) {
olddamage = damage;
tmp = (34 - damflag[dam]) * 3 - rand_mod(3);
if (tmp < 0)
tmp = 0;
Sprintf(spbuf,"%d%% %s *** ",tmp,dammess[dam]);
spbuf[15] = '\0';
mvaddstr(0,46,spbuf);
}
else if (dam != lastdam || !olddamage) {
olddamage = damage;
Sprintf(spbuf,"NO %s *** ",dammess[dam]);
spbuf[15] = '\0';
mvaddstr(0,46,spbuf);
}
if (status < 2) {
if (dam == NOIMPULSE && !entmode)
status = entmode = 1;
if (dam == NOWARP && entmode)
status = entmode = 0;
}
tmp = damflag[dam] * damage;
Sprintf(spbuf,"%3d.%1d ETR",tmp/10,tmp%10);
mvaddstr(0,69,spbuf);
lastdam = dam;
}
else {
if (olddamage) {
Sprintf(spbuf,"Stars: %-3d Stardate",numstars);
mvaddstr(0,42,spbuf);
lastdam = -1;
olddamage = 0;
oldcurscore = -1;
}
else if (numstars != oldstrs) {
Sprintf(spbuf,"%-3d",numstars);
mvaddstr(0,49, spbuf);
}
oldstrs = numstars;
}
if (numenemies != oldenemies) {
Sprintf(spbuf,"%-3d",numenemies);
mvaddstr(0,38, spbuf);
oldenemies = numenemies;
}
if (tmp = timer%10) {
Sprintf(spbuf,"%1d",tmp);
mvaddstr(0,67, spbuf);
}
else {
Sprintf(spbuf,"%5d.%1d",timer/10+smarts*100,tmp);
mvaddstr(0,61, spbuf);
}
if ((!damage || !damflag[dam]) && curscore != oldcurscore) {
Sprintf(spbuf,"%9ld",curscore);
mvaddstr(0,69, spbuf);
oldcurscore = curscore;
}
}
void
wavescore()
{
double power, effectscore, starscore, pi_over_2;
long bonuses;
long tmp;
FILE *mapfp;
int row;
double pow();
#ifndef lint
double atan2();
#endif
clear();
if (curscore > possiblescore)
curscore = possiblescore;
pi_over_2 = 3.14159265 / 2.0;
power = pow((double)inumenemies+ /* total number of enemies */
inumroms*2+ /* count roms 3 times */
inumgorns+ /* count gorns 2 times */
inumthols+ /* count thols 2 times */
inumapollos*4+ /* count apollo 5 times */
inumcrushes*3+ /* count crushers 4 times */
inumamoebas*5 /* count amoebas 6 times */
, 0.50) * /* skew it a little */
(double)smarts; /* average energy and intelligence */
if (inumstars < 350 && inumenemies > 5)
power += (350.0 - (double)inumstars) * ((double)inumenemies - 5.0);
if (inumstars > 850 && inumenemies > 2)
power += ((double)inumstars - 850.0) * ((double)inumenemies - 2.0);
#ifndef lint
effectscore = ((double)curscore / possiblescore) *
atan2(power, (double) timer + 1.0) / pi_over_2;
#else
effectscore = pi_over_2;
#endif
if (inumstars)
starscore = (double) numstars / (double) inumstars;
else
starscore = 1.0;
wave++;
Sprintf(spbuf,"Wave = %d, Difficulty = %d, cumulative difficulty = %d",
wave, smarts, cumsmarts);
mvaddstr(1, 13+(smarts<10), spbuf);
mvaddstr( 4, 68, " BONUS");
Sprintf(spbuf,"Efficiency rating: %1.8f (diff=%0.2f,time=%d)",
effectscore, power, timer + 1);
mvaddstr( 5,5, spbuf);
if (effectscore < 0.8)
bonuses = tmp = 0;
else
bonuses = tmp = (long) ((effectscore-0.8) * smarts * 1000);
Sprintf(spbuf, "%6ld", tmp);
mvaddstr( 5, 68, spbuf);
Sprintf(spbuf,"Star save ratio: %1.8f (%d/%d)",
starscore, numstars, inumstars);
mvaddstr( 6,5, spbuf);
#ifndef lint
bonuses += tmp = (long) (((double)curscore / possiblescore) *
(starscore*starscore) * smarts * 20);
#endif
Sprintf(spbuf, "%6ld", tmp);
mvaddstr( 6, 68, spbuf);
row = 7;
if (inuminhab != numinhab) {
Sprintf(spbuf, "Inhabited stars depopulated: %5d", inuminhab-numinhab);
mvaddstr(row,5, spbuf);
bonuses += tmp = (long) (inuminhab-numinhab) * -500;
Sprintf(spbuf, "%6ld", tmp);
mvaddstr(row, 68, spbuf);
row++;
}
if (inumfriends != numfriends) {
Sprintf(spbuf, "Friendly craft destroyed: %5d",
inumfriends-numfriends);
mvaddstr(row,5, spbuf);
bonuses += tmp = (long) (inumfriends-numfriends) * -250;
Sprintf(spbuf, "%6ld", tmp);
mvaddstr(row, 68, spbuf);
row++;
}
if (deadmudds) {
mvaddstr(row,5,"For destroying Harry Mudd:");
bonuses += tmp = (long) rand_mod(deadmudds * 20 + 1) - deadmudds*10;
Sprintf(spbuf, "%6ld", tmp);
mvaddstr(row, 68, spbuf);
row++;
}
if (bombed_out) {
mvaddstr(row,5, "For running away from reality:");
bonuses += tmp = (long) -possiblescore/2;
Sprintf(spbuf, "%6ld", tmp);
mvaddstr(row, 68, spbuf);
row++;
}
if (row < 9)
row++;
Sprintf(spbuf, "Enterprise: %-9s%5d remaining",
!ient?"":ent?"saved":"destroyed", numents);
mvaddstr(row,5, spbuf);
bonuses += tmp = ent && !bombed_out ? (smarts+1)*15 : 0;
Sprintf(spbuf, "%6ld", tmp);
mvaddstr(row, 68, spbuf);
row++;
Sprintf(spbuf, "Base: %-9s %5d remaining",
!ibase?"":base?"saved":"destroyed", numbases);
mvaddstr(row,5, spbuf);
bonuses += tmp = base && !bombed_out ? (smarts+1)*10 : 0;
Sprintf(spbuf, "%6ld", tmp);
mvaddstr(row, 68, spbuf);
if (beginner) {
mvaddstr(13+(row>11),19, "(Special games count only a tenth as much)");
curscore /= 10;
bonuses /= 10;
}
Sprintf(spbuf, "Previous point total:%10ld",lastscore);
mvaddstr(15,24, spbuf);
Sprintf(spbuf, "Points this round: %10ld",curscore);
mvaddstr(16,24, spbuf);
Sprintf(spbuf, "Bonuses: %10ld",bonuses);
mvaddstr(17,24, spbuf);
totalscore = lastscore + curscore + bonuses;
Sprintf(spbuf, "New point total: %10ld",totalscore);
mvaddstr(18,24, spbuf);
if (lastscore / ENTBOUNDARY < totalscore / ENTBOUNDARY) {
mvaddstr(row-1,42,"+ 1 new");
numents++;
}
else if (numents>0 &&
lastscore / ENTBOUNDARY > totalscore / ENTBOUNDARY) {
mvaddstr(row-1,42,"- 1 obsolete");
numents--;
}
if (lastscore / BASEBOUNDARY < totalscore / BASEBOUNDARY) {
mvaddstr(row,42,"+ 1 new");
numbases++;
}
else if (numbases>0 &&
lastscore / BASEBOUNDARY > totalscore / BASEBOUNDARY) {
mvaddstr(row,42,"- 1 obsolete");
numbases--;
}
if (starscore < 0.8 && inumstars > 200 && numstars > 50) {
Sprintf(spbuf, "smap.%d",rand_mod(MAPS-PERMMAPS)+PERMMAPS);
if ((mapfp = fopen(spbuf,"w")) != NULL) {
Reg1 OBJECT *obj;
fprintf(mapfp,"%d\n",numstars);
for (obj = root.next; obj != &root; obj = obj->next) {
if (obj->type == Star) {
fprintf(mapfp,"%d %d\n",obj->posy,obj->posx);
}
}
Fclose(mapfp);
}
}
}
void
score()
{
char tmp, *retval, cdate[30];
Reg1 FILE *logfd;
Reg2 FILE *outfd;
Reg3 int i;
long nowtime, time();
char *scoreboard;
for (i=0; link(LOGFILE, LOCKFILE) == -1 && i<10; i++)
sleep(1);
nowtime = time((long *)0);
strcpy(cdate,ctime(&nowtime));
if ((logfd = fopen(LOGFILE,"a")) != NULL) {
fprintf(logfd,
"%-24s%-9s%7ld%c%2d %4d %s",
realname, logname, totalscore, c,smarts, cumsmarts, cdate);
Fclose(logfd);
}
strcpy(cdate+11,cdate+20);
if (beginner)
scoreboard = FSCOREBOARD;
else if (lowspeed)
scoreboard = LSCOREBOARD;
else
scoreboard = SCOREBOARD;
if (eaccess(scoreboard,0)) {
if ((logfd = fopen(scoreboard,"w")) != NULL)
Fclose(logfd);
}
if ((logfd = fopen(scoreboard,"r")) != NULL &&
(outfd = fopen(TMPSCOREBOARD,"w")) != NULL) {
for (i=0; i<20; i++) {
if ((retval = fgets(buf, 100, logfd)) == NULL)
break;
if (atol(buf+32) < totalscore)
break;
if (strnEQ(buf+COMPOFF,COMPNAME,COMPLEN)) {
i = 100;
break;
}
fprintf(outfd, "%s", buf);
}
if (i == 100) {
mvaddstr(20,21, "You did not better your previous score");
Fclose(outfd);
unlink(TMPSCOREBOARD);
}
else if (i < 20) {
fprintf(outfd, "%-24s%-8s%8ld%c %2d %4d %s",
realname, logname, totalscore, c,smarts, cumsmarts, cdate);
i++;
Sprintf(spbuf, " Congratulations--you've placed %d%s",
i, i==1?"st":(i==2?"nd":(i==3?"rd":"th")));
if (retval != NULL) {
if (strnNE(buf+COMPOFF,COMPNAME,COMPLEN)) {
fprintf(outfd, "%s", buf);
i++;
}
else
strcpy(spbuf,"Congratulations--you've bettered your score");
while (i<20) {
if (fgets(buf, 100, logfd) == NULL)
break;
if (strnNE(buf+COMPOFF,COMPNAME,COMPLEN)) {
fprintf(outfd, "%s", buf);
i++;
}
}
}
mvaddstr(20,19, spbuf);
Fclose(logfd);
Fclose(outfd);
while (unlink(scoreboard) == 0)
;
link(TMPSCOREBOARD,scoreboard);
unlink(TMPSCOREBOARD);
logfd = fopen(scoreboard,"r");
}
else {
mvaddstr(20,22,"You did not place within the top 20");
Fclose(outfd);
}
}
else {
Sprintf(spbuf,"(Cannot access %s file, error %d)",
(logfd==NULL?"log":"tmp"),errno);
mvaddstr(20,22,spbuf);
}
move(23,0,0);
erase_eol();
mvaddstr(23,11,
"[Hit space for scoreboard, 'r' for new game, 'q' to quit]");
unlink(LOCKFILE);
Fflush(stdout);
eat_typeahead();
do {
getcmd(&tmp);
} while (tmp != INTRCH && tmp != BREAKCH && !index(" rqQ",tmp));
if (index("qQr",tmp)) {
justonemoretime = (tmp == 'r');
if (logfd != NULL)
Fclose(logfd);
}
else {
clear();
if (logfd != NULL) {
fseek(logfd, 0, 0);
if (beginner)
mvaddstr(0,31,"TOP FUNNY WARPISTS");
else if (lowspeed)
mvaddstr(0,29,"TOP LOW-SPEED WARPISTS");
else
mvaddstr(0,33,"TOP WARPISTS");
mvaddstr(2,0,"RANK WHO AKA SCORE DIFF CUMDIFF WHEN");
for (i=1; i<=20; i++) {
if (fgets(buf, 100, logfd) == NULL)
break;
buf[strlen(buf)-1] = '\0';
Sprintf(spbuf, " %2d %s", i, buf);
mvaddstr(i+2,0, spbuf);
}
Fclose(logfd);
}
roundsleep(1);
mvaddstr(23,25,"Would you like to play again?");
eat_typeahead();
do {
getcmd(&tmp);
} while (tmp != INTRCH && tmp != BREAKCH && !index("nNyY \n\r",tmp));
if (tmp == 'n' || tmp == 'N' || tmp == INTRCH || tmp == BREAKCH)
justonemoretime = FALSE;
}
smarts = ismarts;
totalscore = cumsmarts = wave = 0;
numents = 5;
numbases = 3;
apolspec = FALSE;
beginner = FALSE;
crushspec = FALSE;
gornspec = FALSE;
massacre = (ismarts >= 40);
romspec = FALSE;
tholspec = FALSE;
}
void
save_game()
{
FILE *savfil;
if (experimenting)
return;
if ((savfil = fopen(savefilename,"w")) == NULL) {
resetty();
printf("Cannot save game\r\n");
finalize(1);
}
fprintf(savfil, "%-8s %10ld, %2d,%5d,%2d,%2d,%3d %c%c%c%c%c%c%c%c\n",
logname, totalscore, smarts, cumsmarts, numents, numbases, wave,
apolspec ? 'a' : ' ',
beginner ? 'b' : ' ',
crushspec ? 'c' : ' ',
gornspec ? 'g' : ' ',
massacre ? 'm' : ' ',
romspec ? 'r' : ' ',
tholspec ? 't' : ' ',
lowspeed ? 'l' : ' ',
amoebaspec ? '&' : ' '
);
Fclose(savfil);
resetty();
if (panic)
finalize(0);
clear();
finalize(0);
}
f("Cannot save game\r\n");
finalize(1);
}
fprintf(savfil, "%-8s %10ld, %2d,%5d,%2d,%2d,%3d %c%c%c%c%c%c%c%c\n",
logname, totalscore, smarts, cumsmarts, numents, numbases, wave,
apolspec ? 'a' : ' ',
beginner ? 'b' : ' ',
crushspec ? 'c' : ' ',
gornspec ? 'g' : ' ',
massawarp/term.c 644 171 5 43531 5121747710 6201 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.2 86/12/12 17:04:09 lwall
* Baseline for net release.
*
* Revision 7.0.1.1 86/10/16 10:53:20 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:14:02 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "bang.h"
#include "intrp.h"
#include "object.h"
#include "play.h"
#include "score.h"
#include "sig.h"
#include "us.h"
#include "util.h"
#include "weapon.h"
#include "INTERN.h"
#include "term.h"
int typeahead = FALSE;
char tcarea[TCSIZE]; /* area for "compiled" termcap strings */
/* guarantee capability pointer != Nullch */
/* (I believe terminfo will ignore the &tmpaddr argument.) */
#define Tgetstr(key) ((tstr = tgetstr(key,&tmpaddr)) ? tstr : nullstr)
#ifdef PUSHBACK
struct keymap {
char km_type[128];
union km_union {
struct keymap *km_km;
char *km_str;
} km_ptr[128];
};
#define KM_NOTHIN 0
#define KM_STRING 1
#define KM_KEYMAP 2
#define KM_BOGUS 3
#define KM_TMASK 3
#define KM_GSHIFT 4
#define KM_GMASK 7
typedef struct keymap KEYMAP;
KEYMAP *topmap INIT(Null(KEYMAP*));
void mac_init();
KEYMAP *newkeymap();
void pushstring();
#endif
/* terminal initialization */
void
term_init()
{
savetty(); /* remember current tty state */
#ifdef TERMIO
ospeed = _tty.c_cflag & CBAUD; /* for tputs() */
ERASECH = _tty.c_cc[VERASE]; /* for finish_command() */
KILLCH = _tty.c_cc[VKILL]; /* for finish_command() */
#else
ospeed = _tty.sg_ospeed; /* for tputs() */
ERASECH = _tty.sg_erase; /* for finish_command() */
KILLCH = _tty.sg_kill; /* for finish_command() */
#endif
/* The following could be a table but I can't be sure that there isn't */
/* some degree of sparsity out there in the world. */
switch (ospeed) { /* 1 second of padding */
#ifdef BEXTA
case BEXTA: just_a_sec = 1920; break;
#else
#ifdef B19200
case B19200: just_a_sec = 1920; break;
#endif
#endif
case B9600: just_a_sec = 960; break;
case B4800: just_a_sec = 480; break;
case B2400: just_a_sec = 240; break;
case B1800: just_a_sec = 180; break;
case B1200: just_a_sec = 120; break;
case B600: just_a_sec = 60; break;
case B300: just_a_sec = 30; break;
/* do I really have to type the rest of this??? */
case B200: just_a_sec = 20; break;
case B150: just_a_sec = 15; break;
case B134: just_a_sec = 13; break;
case B110: just_a_sec = 11; break;
case B75: just_a_sec = 8; break;
case B50: just_a_sec = 5; break;
default: just_a_sec = 960; break;
/* if we are running detached I */
} /* don't want to know about it! */
}
/* set terminal characteristics */
void
term_set(tcbuf)
char *tcbuf; /* temp area for "uncompiled" termcap entry */
{
char *tmpaddr; /* must not be register */
Reg1 char *tstr;
char *tgetstr();
char *s;
int retval;
#ifdef PENDING
#ifndef FIONREAD
#ifndef RDCHK
/* do no delay reads on something that always gets closed on exit */
devtty = open("/dev/tty",0);
if (devtty < 0) {
printf(cantopen,"/dev/tty");
finalize(1);
}
fcntl(devtty,F_SETFL,O_NDELAY);
#endif
#endif
#endif
/* get all that good termcap stuff */
#ifdef HAVETERMLIB
retval = tgetent(tcbuf,getenv("TERM")); /* get termcap entry */
if (retval < 1) {
#ifdef VERBOSE
printf("No termcap %s found.\n", retval ? "file" : "entry");
#else
fputs("Termcap botch\n",stdout);
#endif
finalize(1);
}
tmpaddr = tcarea; /* set up strange tgetstr pointer */
s = Tgetstr("pc"); /* get pad character */
PC = *s; /* get it where tputs wants it */
if (!tgetflag("bs")) { /* is backspace not used? */
BC = Tgetstr("bc"); /* find out what is */
if (BC == nullstr) /* terminfo grok's 'bs' but not 'bc' */
BC = Tgetstr("le");
} else
BC = "\b"; /* make a backspace handy */
UP = Tgetstr("up"); /* move up a line */
ND = Tgetstr("nd"); /* non-destructive move cursor right */
DO = Tgetstr("do"); /* move cursor down */
if (!*DO)
DO = Tgetstr("nl");
CL = Tgetstr("cl"); /* get clear string */
CE = Tgetstr("ce"); /* clear to end of line string */
CM = Tgetstr("cm"); /* cursor motion - PWP */
HO = Tgetstr("ho"); /* home cursor if no CM - PWP */
CD = Tgetstr("cd"); /* clear to end of display - PWP */
SO = Tgetstr("so"); /* begin standout */
SE = Tgetstr("se"); /* end standout */
if ((SG = tgetnum("sg"))<0)
SG = 0; /* blanks left by SG, SE */
US = Tgetstr("us"); /* start underline */
UE = Tgetstr("ue"); /* end underline */
if ((UG = tgetnum("ug"))<0)
UG = 0; /* blanks left by US, UE */
if (*US)
UC = nullstr; /* UC must not be NULL */
else
UC = Tgetstr("uc"); /* underline a character */
if (!*US && !*UC) { /* no underline mode? */
US = SO; /* substitute standout mode */
UE = SE;
UG = SG;
}
LINES = tgetnum("li"); /* lines per page */
COLS = tgetnum("co"); /* columns on page */
AM = tgetflag("am"); /* terminal wraps automatically? */
XN = tgetflag("xn"); /* then eats next newline? */
VB = Tgetstr("vb");
if (!*VB)
VB = "\007";
CR = Tgetstr("cr");
if (!*CR) {
if (tgetflag("nc") && *UP) {
CR = safemalloc((MEM_SIZE)strlen(UP)+2);
Sprintf(CR,"%s\r",UP);
}
else
CR = "\r";
}
#else
?????? /* Roll your own... */
#endif
if (LINES <= 0)
LINES = 24;
if (COLS <= 0)
COLS = 80;
BCsize = comp_tc(bsptr,BC,1);
BC = bsptr;
if (!*ND) /* not defined? */
NDsize = 1000; /* force cursor addressing */
else {
NDsize = comp_tc(cmbuffer,ND,1);
myND = malloc((unsigned)NDsize);
movc3(NDsize,cmbuffer,myND);
if (debugging) {
int scr;
printf("ND");
for (scr=0; scr<NDsize; scr++)
printf(" %d",myND[scr]);
printf("\n");
}
}
if (!*UP) /* not defined? */
UPsize = 1000; /* force cursor addressing */
else {
UPsize = comp_tc(cmbuffer,UP,1);
myUP = malloc((unsigned)UPsize);
movc3(UPsize,cmbuffer,myUP);
if (debugging) {
int scr;
printf("UP");
for (scr=0; scr<UPsize; scr++)
printf(" %d",myUP[scr]);
printf("\n");
}
}
if (!*DO) { /* not defined? */
myDO = DO = "\n"; /* assume a newline */
DOsize = 1;
}
else {
DOsize = comp_tc(cmbuffer,DO,1);
myDO = malloc((unsigned)DOsize);
movc3(DOsize,cmbuffer,myDO);
if (debugging) {
int scr;
printf("DO");
for (scr=0; scr<DOsize; scr++)
printf(" %d",myDO[scr]);
printf("\n");
}
}
if (debugging)
Fgets(cmbuffer,(sizeof cmbuffer),stdin);
CMsize = comp_tc(cmbuffer,tgoto(CM,20,20),0);
if (PC != '\0') {
char *p;
for (p=filler+(sizeof filler)-1;!*p;--p)
*p = PC;
}
charsperhalfsec = ospeed >= B9600 ? 480 :
ospeed == B4800 ? 240 :
ospeed == B2400 ? 120 :
ospeed == B1200 ? 60 :
ospeed == B600 ? 30 :
/* speed is 300 (?) */ 15;
gfillen = ospeed >= B9600 ? (sizeof filler) :
ospeed == B4800 ? 13 :
ospeed == B2400 ? 7 :
ospeed == B1200 ? 4 :
1+BCsize;
if (ospeed < B2400)
lowspeed = TRUE;
strcpy(term,ttyname(2));
if (!*CM || !BCsize)
no_can_do("dumb");
if (!scorespec && (LINES < 24 || COLS < 80))
no_can_do("puny");
crmode();
raw();
noecho(); /* turn off echo */
nonl();
#ifdef PUSHBACK
mac_init(tcbuf);
#endif
}
#ifdef PUSHBACK
void
mac_init(tcbuf)
char *tcbuf;
{
char tmpbuf[1024];
tmpfp = fopen(filexp(getval("WARPMACRO",WARPMACRO)),"r");
if (tmpfp != Nullfp) {
while (fgets(tcbuf,1024,tmpfp) != Nullch) {
mac_line(tcbuf,tmpbuf,(sizeof tmpbuf));
}
Fclose(tmpfp);
}
}
void
mac_line(line,tmpbuf,tbsize)
char *line;
char *tmpbuf;
int tbsize;
{
Reg1 char *s;
Reg2 char *m;
Reg3 KEYMAP *curmap;
Reg4 int ch;
Reg5 int garbage = 0;
static char override[] = "\r\nkeymap overrides string\r\n";
if (topmap == Null(KEYMAP*))
topmap = newkeymap();
if (*line == '#' || *line == '\n')
return;
if (line[ch = strlen(line)-1] == '\n')
line[ch] = '\0';
m = dointerp(tmpbuf,tbsize,line," \t");
if (!*m)
return;
while (*m == ' ' || *m == '\t') m++;
for (s=tmpbuf,curmap=topmap; *s; s++) {
ch = *s & 0177;
if (s[1] == '+' && isdigit(s[2])) {
s += 2;
garbage = (*s & KM_GMASK) << KM_GSHIFT;
}
else
garbage = 0;
if (s[1]) {
if ((curmap->km_type[ch] & KM_TMASK) == KM_STRING) {
puts(override);
free(curmap->km_ptr[ch].km_str);
curmap->km_ptr[ch].km_str = Nullch;
}
curmap->km_type[ch] = KM_KEYMAP + garbage;
if (curmap->km_ptr[ch].km_km == Null(KEYMAP*))
curmap->km_ptr[ch].km_km = newkeymap();
curmap = curmap->km_ptr[ch].km_km;
}
else {
if ((curmap->km_type[ch] & KM_TMASK) == KM_KEYMAP)
puts(override);
else {
curmap->km_type[ch] = KM_STRING + garbage;
curmap->km_ptr[ch].km_str = savestr(m);
}
}
}
}
KEYMAP*
newkeymap()
{
Reg1 int i;
Reg2 KEYMAP *map;
#ifndef lint
map = (KEYMAP*)safemalloc(sizeof(KEYMAP));
#else
map = Null(KEYMAP*);
#endif /* lint */
for (i=127; i>=0; --i) {
map->km_ptr[i].km_km = Null(KEYMAP*);
map->km_type[i] = KM_NOTHIN;
}
return map;
}
#endif
/* print out a file, stopping at form feeds */
void
page(filename,num)
char *filename;
bool num;
{
int linenum = 1;
tmpfp = fopen(filename,"r");
if (tmpfp != NULL) {
while (fgets(spbuf,(sizeof spbuf),tmpfp) != NULL) {
if (*spbuf == '\f') {
printf("[Type anything to continue] ");
Fflush(stdout);
getcmd(spbuf);
printf("\r\n");
if (*spbuf == INTRCH)
finalize(0);
if (*spbuf == 'q' || *spbuf == 'Q')
break;
}
else {
if (num)
printf("%3d %s\r",linenum++,spbuf);
else
printf("%s\r",spbuf);
}
}
Fclose(tmpfp);
}
}
void
move(y, x, chadd)
int y, x;
int chadd;
{
Reg1 int ydist;
Reg2 int xdist;
Reg3 int i;
Reg4 char *s;
ydist = y - real_y;
xdist = x - real_x;
i = ydist * (ydist < 0 ? -UPsize : DOsize) +
xdist * (xdist < 0 ? -BCsize : NDsize);
beg_qwrite();
if (i <= CMsize) {
if (ydist < 0)
for (; ydist; ydist++)
for (i=UPsize,s=myUP; i; i--)
qaddch(*s++);
else
for (; ydist; ydist--)
for (i=DOsize,s=myDO; i; i--)
qaddch(*s++);
if (xdist < 0)
for (; xdist; xdist++)
for (i=BCsize,s=BC; i; i--)
qaddch(*s++);
else
for (; xdist; xdist--)
for (i=NDsize,s=myND; i; i--)
qaddch(*s++);
}
else {
tputs(tgoto(CM,x,y),0,cmstore);
}
real_y = y;
real_x = x;
if (chadd) {
qaddch(chadd);
}
if (maxcmstring != cmbuffer)
end_qwrite();
}
void
do_tc(s,l)
char *s;
int l;
{
beg_qwrite();
tputs(s,l,cmstore);
end_qwrite();
}
int
comp_tc(dest,s,l)
char *dest;
char *s;
int l;
{
maxcmstring = dest;
tputs(s,l,cmstore);
return(maxcmstring-dest);
}
void
helper()
{
clear();
mvaddstr(0,4,"h or 4 left");
mvaddstr(1,4,"j or 2 down Use with SHIFT to fire torpedoes.");
mvaddstr(2,4,"k or 8 up Use with CTRL or FUNCT to fire");
mvaddstr(3,4,"l or 6 right phasers or turbolasers.");
mvaddstr(4,4,"b or 1 down and left Use preceded by 'a' or 'r' for");
mvaddstr(5,4,"n or 3 down and right attractors or repulsors.");
mvaddstr(6,4,"y or 7 up and left Use normally for E or B motion.");
mvaddstr(7,4,"u or 9 up and right");
mvaddstr(8,4,"");
mvaddstr(9,4,"del or % fire photon torpedoes in every (reasonable) direction.");
mvaddstr(10,4,"s stop all torpedoes.");
mvaddstr(11,4,"S or 0 stop the Enterprise when in warp mode.");
mvaddstr(12,4,"d/D destruct all torpedoes/current vessel.");
mvaddstr(13,4,"i/w switch to Enterprise & put into impulse/warp mode.");
mvaddstr(14,4,"c/v switch to Enterprise & make cloaked/visible.");
mvaddstr(15,4,"p switch to Base.");
mvaddstr(16,4,"o toggle to other vessel (from E to B, or vice versa.)");
mvaddstr(17,4,"z zap (suppress) blasts near Enterprise next cycle");
mvaddstr(18,4,"");
mvaddstr(19,4,"^R refresh the screen. ^Z suspend the game.");
mvaddstr(20,4,"q exit this round (if you haven't typed q within 10 cycles).");
mvaddstr(21,4,"Q exit this game.");
mvaddstr(22,4,"");
mvaddstr(23,4," [Hit space to continue]");
Fflush(stdout);
do {
getcmd(spbuf);
} while (*spbuf != ' ');
rewrite();
}
void
rewrite()
{
Reg1 int x;
Reg2 int y;
Reg3 OBJECT *obj;
clear();
for (y=0; y<YSIZE; y++) {
for (x=0; x<XSIZE; x++) {
if (numamoebas && amb[y][x] != ' ')
mvaddc(y+1,x*2,amb[y][x]);
if (obj=occupant[y][x]) {
if (obj->image != ' ')
mvaddc(y+1,x*2,obj->image);
}
}
}
Sprintf(spbuf,
"%-4s E: %4d %2d B: %5d %3d Enemies: %-3d Stars: %-3d Stardate%5d.%1d %9ld",
" ", 0, 0, 0, 0, 0, 0, timer/10+smarts*100, timer%10, 0L);
mvaddstr(0,0,spbuf);
oldeenergy = oldbenergy = oldcurscore =
oldstatus = oldetorp = oldbtorp = oldstrs = oldenemies = -1;
/* force everything to fill in */
if (damage)
olddamage = 0;
if (!ent)
etorp = 0;
if (!base)
btorp = 0;
display_status();
}
char
cmstore(ch)
Reg1 char ch;
{
*maxcmstring++ = ch;
}
/* discard any characters typed ahead */
void
eat_typeahead()
{
#ifdef PUSHBACK
if (!typeahead && nextin==nextout) /* cancel only keyboard stuff */
#else
if (!typeahead)
#endif
{
#ifdef PENDING
while (input_pending())
Read_tty(buf,sizeof(buf));
#else /* this is probably v7, with no rdchk() */
ioctl(_tty_ch,TIOCSETP,&_tty);
#endif
}
}
void
settle_down()
{
dingaling();
Fflush(stdout);
sleep(1);
#ifdef PUSHBACK
nextout = nextin; /* empty circlebuf */
#endif
eat_typeahead();
}
#ifdef PUSHBACK
/* read a character from the terminal, with multi-character pushback */
int
read_tty(addr,size)
char *addr;
int size; /* ignored for now */
{
#ifdef lint
size = size;
#endif
if (nextout != nextin) {
*addr = circlebuf[nextout++];
nextout %= PUSHSIZE;
return 1;
}
else {
size = read(0,addr,1);
if (size < 0)
sig_catcher(SIGHUP);
if (metakey) {
if (*addr & 0200) {
pushchar(*addr & 0177);
*addr = '\001';
}
}
else
*addr &= 0177;
return 1;
}
}
#ifdef PENDING
#ifndef FIONREAD
#ifndef RDCHK
int
circfill()
{
Reg1 int howmany;
Reg2 int i;
assert (nextin == nextout);
howmany = read(devtty,circlebuf+nextin,metakey?1:PUSHSIZE-nextin);
if (howmany > 0) {
if (metakey) {
if (circlebuf[nextin] & 0200) {
circlebuf[nextin] &= 0177;
pushchar('\001');
}
}
else
for (i = howmany+nextin-1; i >= nextin; i--)
circlebuf[i] &= 0177;
nextin += howmany;
nextin %= PUSHSIZE; /* may end up 1 if metakey */
}
return howmany;
}
#endif /* RDCHK */
#endif /* FIONREAD */
#endif /* PENDING */
void
pushchar(ch)
char ch;
{
nextout--;
if (nextout < 0)
nextout = PUSHSIZE - 1;
if (nextout == nextin) {
fputs("\r\npushback buffer overflow\r\n",stdout);
sig_catcher(0);
}
circlebuf[nextout] = ch;
}
#else /* PUSHBACK */
#ifndef read_tty
/* read a character from the terminal, with hacks for O_NDELAY reads */
int
read_tty(addr,size)
char *addr;
int size;
{
if (is_input) {
*addr = pending_ch;
is_input = FALSE;
return 1;
}
else {
size = read(0,addr,size);
if (size < 0)
sig_catcher(SIGHUP);
if (metakey) {
if (*addr & 0200) {
pending_ch = *addr & 0177;
is_input = TRUE;
*addr = '\001';
}
}
else
*addr &= 0177;
return size;
}
}
#endif /* read_tty */
#endif /* PUSHBACK */
int
read_nd(buff, siz)
char *buff;
int siz;
{
if (!input_pending())
return 0;
getcmd(buff);
return 1;
}
/* get a character into a buffer */
void
getcmd(whatbuf)
Reg3 char *whatbuf;
{
#ifdef PUSHBACK
Reg1 KEYMAP *curmap;
Reg2 int i;
bool no_macros;
int times = 0; /* loop detector */
char scrchar;
tryagain:
curmap = topmap;
/* no_macros = (whatbuf != buf && nextin == nextout); */
no_macros = FALSE;
#endif
for (;;) {
errno = 0;
if (read_tty(whatbuf,1) < 0 && !errno)
errno = EINTR;
#ifdef read_tty
if (metakey) {
if (*whatbuf & 0200) {
*what_buf &= 037; /* punt and hope they don't notice */
}
}
else
*whatbuf &= 0177;
#endif /* read_tty */
if (errno && errno != EINTR) {
perror(readerr);
sig_catcher(0);
}
#ifdef PUSHBACK
if (*whatbuf & 0200 || no_macros) {
*whatbuf &= 0177;
goto got_canonical;
}
if (curmap == Null(KEYMAP*))
goto got_canonical;
for (i = (curmap->km_type[*whatbuf] >> KM_GSHIFT) & KM_GMASK; i; --i){
Read_tty(&scrchar,1);
}
switch (curmap->km_type[*whatbuf] & KM_TMASK) {
case KM_NOTHIN: /* no entry? */
if (curmap == topmap) /* unmapped canonical */
goto got_canonical;
settle_down();
goto tryagain;
case KM_KEYMAP: /* another keymap? */
curmap = curmap->km_ptr[*whatbuf].km_km;
assert(curmap != Null(KEYMAP*));
break;
case KM_STRING: /* a string? */
pushstring(curmap->km_ptr[*whatbuf].km_str);
if (++times > 20) { /* loop? */
fputs("\r\nmacro loop?\r\n",stdout);
settle_down();
}
no_macros = FALSE;
goto tryagain;
}
#else
*whatbuf &= 0177;
break;
#endif
}
got_canonical:
#ifndef TERMIO
if (*whatbuf == '\r')
*whatbuf = '\n';
#endif
if (whatbuf == buf)
whatbuf[1] = FINISHCMD; /* tell finish_command to work */
}
#ifdef PUSHBACK
void
pushstring(str)
char *str;
{
Reg1 int i;
char tmpbuf[PUSHSIZE];
Reg2 char *s = tmpbuf;
assert(str != Nullch);
interp(s,PUSHSIZE,str);
for (i = strlen(s)-1; i >= 0; --i) {
s[i] ^= 0200;
pushchar(s[i]);
}
}
#endif
= FALSE;
goto tryagain;
}
#else
*whatbuf &= 0177;
break;
#endif
}
got_canonical:
#ifndef TERMIO
if (*whatbuf == '\r')
*whatbuf = '\n';
#endif
if warp/util.c 644 171 5 12314 5121747713 6205 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.2 86/10/20 12:07:46 lwall
* Made all exits reset tty.
*
* Revision 7.0.1.1 86/10/16 10:54:02 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:14:31 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "ndir.h"
#include "object.h"
#include "sig.h"
#include "term.h"
#include "INTERN.h"
#include "util.h"
void
util_init()
{
;
}
void
movc3(len,src,dest)
#ifdef vax
char *dest, *src;
int len;
{
asm("movc3 4(ap),*8(ap),*12(ap)");
}
#else
Reg1 char *dest;
Reg2 char *src;
Reg3 int len;
{
if (dest <= src) {
for (; len; len--) {
*dest++ = *src++;
}
}
else {
dest += len;
src += len;
for (; len; len--) {
*--dest = *--src;
}
}
}
#endif
void
no_can_do(what)
char *what;
{
fprintf(stderr,"Sorry, your terminal is too %s to play warp.\r\n",what);
finalize(1);
}
int
exdis(maxnum)
int maxnum;
{
double temp, temp2;
double exp();
double log();
temp = (double) maxnum;
#ifndef lint
temp2 = (double) myrand();
#else
temp2 = 0.0;
#endif
#if RANDBITS == 15
return (int) exp(temp2 * log(temp)/0x7fff);
#else
#if RANDBITS == 16
return (int) exp(temp2 * log(temp)/0xffff);
#else
return (int) exp(temp2 * log(temp)/0x7fffffff);
#endif
#endif
}
static char nomem[] = "warp: out of memory!\r\n";
/* paranoid version of malloc */
char *
safemalloc(size)
MEM_SIZE size;
{
char *ptr;
char *malloc();
ptr = malloc(size?size:1); /* malloc(0) is NASTY on our system */
if (ptr != Nullch)
return ptr;
else {
fputs(nomem,stdout);
sig_catcher(0);
}
/*NOTREACHED*/
}
/* safe version of string copy */
char *
safecpy(to,from,len)
char *to;
Reg2 char *from;
Reg1 int len;
{
Reg3 char *dest = to;
if (from != Nullch)
for (len--; len && (*dest++ = *from++); len--) ;
*dest = '\0';
return to;
}
/* copy a string up to some (non-backslashed) delimiter, if any */
char *
cpytill(to,from,delim)
Reg2 char *to;
Reg1 char *from;
Reg3 int delim;
{
for (; *from; from++,to++) {
if (*from == '\\' && from[1] == delim)
from++;
else if (*from == delim)
break;
*to = *from;
}
*to = '\0';
return from;
}
/* return ptr to little string in big string, NULL if not found */
char *
instr(big, little)
char *big, *little;
{
Reg3 char *t;
Reg1 char *s;
Reg2 char *x;
for (t = big; *t; t++) {
for (x=t,s=little; *s; x++,s++) {
if (!*x)
return Nullch;
if (*s != *x)
break;
}
if (!*s)
return t;
}
return Nullch;
}
/* effective access */
#ifdef SETUIDGID
int
eaccess(filename, mod)
char *filename;
int mod;
{
int protection, euid;
mod &= 7; /* remove extraneous garbage */
if (stat(filename, &filestat) < 0)
return -1;
euid = geteuid();
if (euid == ROOTID)
return 0;
protection = 7 & (filestat.st_mode >>
(filestat.st_uid == euid ? 6 :
(filestat.st_gid == getegid() ? 3 : 0)
));
if ((mod & protection) == mod)
return 0;
errno = EACCES;
return -1;
}
#endif
/*
* Get working directory
*/
#ifdef GETWD
#define dot "."
#define dotdot ".."
static char *name;
static DIR *dirp;
static int off;
static struct stat d, dd;
static struct direct *dir;
char *
getwd(np)
char *np;
{
long rdev, rino;
*np++ = '/';
*np = 0;
name = np;
off = -1;
stat("/", &d);
rdev = d.st_dev;
rino = d.st_ino;
for (;;) {
stat(dot, &d);
if (d.st_ino==rino && d.st_dev==rdev)
goto done;
if ((dirp = opendir(dotdot)) == Null(DIR *))
prexit("getwd: cannot open ..\r\n");
stat(dotdot, &dd);
chdir(dotdot);
if(d.st_dev == dd.st_dev) {
if(d.st_ino == dd.st_ino)
goto done;
do
if ((dir = readdir(dirp)) == Null(struct direct *))
prexit("getwd: read error in ..\r\n");
while (dir->d_ino != d.st_ino);
}
else do {
if ((dir = readdir(dirp)) == Null(struct direct *))
prexit("getwd: read error in ..\r\n");
stat(dir->d_name, &dd);
} while(dd.st_ino != d.st_ino || dd.st_dev != d.st_dev);
cat();
closedir(dirp);
}
done:
name--;
if (chdir(name) < 0) {
printf("getwd: can't cd back to %s\r\n",name);
sig_catcher(0);
}
return (name);
}
void
cat()
{
Reg1 int i;
Reg2 int j;
i = -1;
while (dir->d_name[++i] != 0);
if ((off+i+2) > 1024-1)
return;
for(j=off+1; j>=0; --j)
name[j+i+1] = name[j];
if (off >= 0)
name[i] = '/';
off=i+off+1;
name[off] = 0;
for(--i; i>=0; --i)
name[i] = dir->d_name[i];
}
void
prexit(cp)
char *cp;
{
write(2, cp, strlen(cp));
sig_catcher(0);
}
#else
char *
getwd(np) /* shorter but slower */
char *np;
{
FILE *popen();
FILE *pipefp = popen("/bin/pwd","r");
if (pipefp == Nullfp) {
printf("Can't run /bin/pwd\r\n");
finalize(1);
}
Fgets(np,512,pipefp);
np[strlen(np)-1] = '\0'; /* wipe out newline */
pclose(pipefp);
return np;
}
#endif
/* copy a string to a safe spot */
char *
savestr(str)
char *str;
{
Reg1 char *newaddr = safemalloc((MEM_SIZE)(strlen(str)+1));
strcpy(newaddr,str);
return newaddr;
}
char *
getval(nam,def)
char *nam,*def;
{
char *val;
if ((val = getenv(nam)) == Nullch || !*val)
val = def;
return val;
}
efp == Nullfp) {
printf("Can't run /bin/pwd\r\n");
finalize(1);
}
Fgets(np,512,pipefp);
np[strlen(np)-1] = '\0'; /* wipe out newline */
pclose(pipefp);
return np;
}
#endif
/* copy a string to a safe spot */
char *
savestr(str)
char *str;
{
Reg1 char *newaddr = safemalloc((MEM_SIZwarp/intrp.h 644 171 5 1275 5121747714 6356 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
*
* $Log: warp9.tar,v $
* Revision 1.1.1.1 2019/05/29 04:56:34 root
* coherent
*
* Revision 7.0.1.1 86/12/12 16:59:45 lwall
* Baseline for net release.
*
* Revision 7.0 86/10/08 15:12:27 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
EXT char *origdir INIT(Nullch); /* cwd when warp invoked */
EXT char *homedir INIT(Nullch); /* login directory */
EXT char *dotdir INIT(Nullch); /* where . files go */
EXT char *logname INIT(Nullch); /* login id */
EXT char *hostname INIT(Nullch); /* host name */
EXT char *realname INIT(Nullch); /* real name from /etc/passwd */
void intrp_init();
char *filexp();
char *dointerp();
void interp();
char *getrealname();
15:12:27 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
EXT char *origdir INIT(Nullch); /* cwd when warp invoked */
EXT char *homedir INIT(Nullch); /* login directory */
EXT char *dotdir INIT(Nullch); /* where . files go */
EXT char *logname INIT(Nullch); /* login id */
EXT char *hostname warp/Configure 755 171 5 130734 5121750001 6742 #! /bin/sh
#
# If these # comments don't work, trim them. Don't worry about any other
# shell scripts, Configure will trim # comments from them for you.
#
# (If you are trying to port this package to a machine without sh, I would
# suggest you cut out the prototypical config.h from the end of Configure
# and edit it to reflect your system. Some packages may include samples
# of config.h for certain machines, so you might look for one of those.)
#
# $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
#
# Yes, you may rip this off to use in other distribution packages.
# (Note: this Configure script was generated automatically. Rather than
# working with this copy of Configure, you may wish to get metaconfig.)
: sanity checks
PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)
if test ! -t 0; then
echo "Say 'sh Configure', not 'sh <Configure'"
exit 1
fi
(alias) >/dev/null 2>&1 && \
echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \
echo "especially on exotic machines. If yours does, try the Bourne shell instead.)"
if test ! -d ../UU; then
if test ! -d UU; then
mkdir UU
fi
cd UU
fi
d_eunice=''
eunicefix=''
define=''
loclist=''
expr=''
sed=''
echo=''
cat=''
rm=''
mv=''
cp=''
tail=''
tr=''
mkdir=''
sort=''
uniq=''
grep=''
trylist=''
test=''
inews=''
egrep=''
more=''
pg=''
Mcc=''
vi=''
mailx=''
Log=''
Header=''
cc=''
contains=''
cpp=''
d_charsprf=''
d_fcntl=''
d_ftime=''
d_gethname=''
d_douname=''
d_phostname=''
d_getpwent=''
d_havetlib=''
termlib=''
d_index=''
d_ioctl=''
d_normsig=''
jobslib=''
d_portable=''
d_rdchk=''
d_scorfl=''
d_sgndchr=''
d_termio=''
d_usendir=''
d_libndir=''
ndirc=''
ndiro=''
d_whoami=''
hostname=''
phostname=''
mydomain=''
libc=''
libnm=''
mansrc=''
manext=''
models=''
split=''
small=''
medium=''
large=''
huge=''
ccflags=''
ldflags=''
n=''
c=''
nametype=''
d_passnames=''
d_berknames=''
d_usgnames=''
passcat=''
package=''
prefshell=''
randbits=''
registers=''
reg1=''
reg2=''
reg3=''
reg4=''
reg5=''
reg6=''
reg7=''
reg8=''
reg9=''
reg10=''
reg11=''
reg12=''
reg13=''
reg14=''
reg15=''
reg16=''
rootid=''
spitshell=''
shsharp=''
sharpbang=''
startsh=''
voidflags=''
bin=''
chowner=''
privlib=''
CONFIG=''
: set package name
package=warp
echo " "
echo "Beginning of configuration questions for $package kit."
: Eunice requires " " instead of "", can you believe it
echo " "
define='define'
undef='/*undef'
libpth='/usr/lib /usr/local/lib /lib'
smallmach='pdp11 i8086 z8000 i80286 iAPX286'
rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
attrlist="$attrlist ns32000 ns16000 iAPX286"
pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib"
defvoidused=7
: some greps do not return status, grrr.
echo "grimblepritz" >grimble
if grep blurfldyick grimble >/dev/null 2>&1 ; then
contains=contains
elif grep grimblepritz grimble >/dev/null 2>&1 ; then
contains=grep
else
contains=contains
fi
rm -f grimble
: the following should work in any shell
case "$contains" in
contains*)
echo " "
echo "AGH! Grep doesn't return a status. Attempting remedial action."
cat >contains <<'EOSS'
grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
EOSS
chmod 755 contains
esac
: first determine how to suppress newline on echo command
echo "Checking echo to see how to suppress newlines..."
(echo "hi there\c" ; echo " ") >.echotmp
if $contains c .echotmp >/dev/null 2>&1 ; then
echo "...using -n."
n='-n'
c=''
else
cat <<'EOM'
...using \c
EOM
n=''
c='\c'
fi
echo $n "Type carriage return to continue. Your cursor should be here-->$c"
read ans
rm -f .echotmp
: now set up to do reads with possible shell escape and default assignment
cat <<EOSC >myread
ans='!'
while expr "X\$ans" : "X!" >/dev/null; do
read ans
case "\$ans" in
!)
sh
echo " "
echo $n "\$rp $c"
;;
!*)
set \`expr "X\$ans" : "X!\(.*\)\$"\`
sh -c "\$*"
echo " "
echo $n "\$rp $c"
;;
esac
done
rp='Your answer:'
case "\$ans" in
'') ans="\$dflt";;
esac
EOSC
: general instructions
cat <<EOH
This installation shell script will examine your system and ask you questions
to determine how $package and any auxiliary files should be installed. If you
get stuck on a question, you may use a ! shell escape to start a subshell or
execute a command. Many of the questions will have default answers in
square brackets--typing carriage return will give you the default.
On some of the questions which ask for file or directory names you are
allowed to use the ~name construct to specify the login directory belonging
to "name", even if you don't have a shell which knows about that. Questions
where this is allowed will be marked "(~name ok)".
EOH
rp="[Type carriage return to continue]"
echo $n "$rp $c"
. myread
cat <<EOH
Much effort has been expended to ensure that this shell script will run
on any Unix system. If despite that it blows up on you, your best bet is
to edit Configure and run it again. (Trying to install this package
without having run Configure may be well nigh impossible.) Also, let me
([email protected]) know how I blew it.
This installation script affects things in two ways: 1) it may do direct
variable substitutions on some of the files included in this kit, and
2) it builds a config.h file for inclusion in C programs. You may edit
any of these files as the need arises after running this script.
If you make a mistake on a question, there is no easy way to back up to it
currently. The easiest thing to do is to edit config.sh and rerun all the
SH files. Configure will offer to let you do this before it runs the SH files.
EOH
rp="[Type carriage return to continue]"
echo $n "$rp $c"
. myread
: get old answers, if there is a config file out there
if test -f ../config.sh; then
echo " "
dflt=y
rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
echo $n "$rp $c"
. myread
case "$ans" in
n*) echo "OK, I'll ignore it.";;
*) echo "Fetching default answers from your old config.sh file..."
tmp="$n"
ans="$c"
. ../config.sh
n="$tmp"
c="$ans"
;;
esac
fi
: find out where common programs are
echo " "
echo "Locating common programs..."
cat <<EOSC >loc
$startsh
case \$# in
0) exit 1;;
esac
thing=\$1
shift
dflt=\$1
shift
for dir in \$*; do
case "\$thing" in
.)
if test -d \$dir/\$thing; then
echo \$dir
exit 0
fi
;;
*)
if test -f \$dir/\$thing; then
echo \$dir/\$thing
exit 0
fi
;;
esac
done
echo \$dflt
exit 1
EOSC
chmod 755 loc
$eunicefix loc
loclist="
expr
sed
echo
cat
rm
mv
cp
tr
mkdir
sort
uniq
grep
"
trylist="
test
egrep
Mcc
"
for file in $loclist; do
xxx=`loc $file $file $pth`
eval $file=$xxx
eval _$file=$xxx
case "$xxx" in
/*)
echo $file is in $xxx.
;;
*)
echo "I don't know where $file is. I hope it's in everyone's PATH."
;;
esac
done
echo " "
echo "Don't worry if any of the following aren't found..."
ans=offhand
for file in $trylist; do
xxx=`loc $file $file $pth`
eval $file=$xxx
eval _$file=$xxx
case "$xxx" in
/*)
echo $file is in $xxx.
;;
*)
echo "I don't see $file out there, $ans."
ans=either
;;
esac
done
case "$egrep" in
egrep)
echo "Substituting grep for egrep."
egrep=$grep
;;
esac
case "$test" in
test)
echo "Hopefully test is built into your sh."
;;
/bin/test)
echo " "
dflt=n
rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)"
echo $n "$rp $c"
. myread
case "$ans" in
y*) test=test ;;
esac
;;
*)
test=test
;;
esac
case "$echo" in
echo)
echo "Hopefully echo is built into your sh."
;;
/bin/echo)
echo " "
echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
$echo $n "hi there$c" >foo1
echo $n "hi there$c" >foo2
if cmp foo1 foo2 >/dev/null 2>&1; then
echo "They are compatible. In fact, they may be identical."
else
case "$n" in
'-n') n='' c='\c' ans='\c' ;;
*) n='-n' c='' ans='-n' ;;
esac
cat <<FOO
They are not compatible! You are probably running ksh on a non-USG system.
I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
have echo built in and we may have to run some Bourne shell scripts. That
means I'll have to use $ans to suppress newlines now. Life is ridiculous.
FOO
rp="Your cursor should be here-->"
$echo $n "$rp$c"
. myread
fi
$rm -f foo1 foo2
;;
*)
: cross your fingers
echo=echo
;;
esac
rmlist="$rmlist loc"
: get list of predefined functions in a handy place
echo " "
if test -f /lib/libc.a; then
echo "Your C library is in /lib/libc.a. You're normal."
libc=/lib/libc.a
else
ans=`loc libc.a blurfl/dyick $libpth`
if test -f $ans; then
echo "Your C library is in $ans, of all places."
libc=ans
else
if test -f "$libc"; then
echo "Your C library is in $libc, like you said before."
else
cat <<EOM
I can't seem to find your C library. I've looked in the following places:
$libpth
None of these seems to contain your C library. What is the full name
EOM
dflt=None
$echo $n "of your C library? $c"
rp='C library full name?'
. myread
libc="$ans"
fi
fi
fi
echo " "
$echo $n "Extracting names from $libc for later perusal...$c"
if ar t $libc > libc.list; then
echo "done"
else
echo " "
echo "The archiver doesn't think $libc is a reasonable library."
echo "Trying nm instead..."
if nm -g $libc > libc.list; then
echo "done"
else
echo "That didn't work either. Giving up."
exit 1
fi
fi
rmlist="$rmlist libc.list"
: make some quick guesses about what we are up against
echo " "
$echo $n "Hmm... $c"
if $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then
echo "Looks kind of like a BSD system, but we'll see..."
echo exit 0 >bsd
echo exit 1 >usg
echo exit 1 >v7
elif $contains fcntl libc.list >/dev/null 2>&1 ; then
echo "Looks kind of like a USG system, but we'll see..."
echo exit 1 >bsd
echo exit 0 >usg
echo exit 1 >v7
else
echo "Looks kind of like a version 7 system, but we'll see..."
echo exit 1 >bsd
echo exit 1 >usg
echo exit 0 >v7
fi
if $contains vmssystem libc.list >/dev/null 2>&1 ; then
cat <<'EOI'
There is, however, a strange, musty smell in the air that reminds me of
something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
EOI
echo "exit 0" >eunice
eunicefix=unixtovms
d_eunice="$define"
: it so happens the Eunice I know will not run shell scripts in Unix format
else
echo " "
echo "Congratulations. You aren't running Eunice."
eunicefix=':'
d_eunice="$undef"
echo "exit 1" >eunice
fi
if test -f /xenix; then
echo "Actually, this looks more like a XENIX system..."
echo "exit 0" >xenix
else
echo " "
echo "It's not Xenix..."
echo "exit 1" >xenix
fi
chmod 755 xenix
if test -f /venix; then
echo "Actually, this looks more like a VENIX system..."
echo "exit 0" >venix
else
echo " "
if xenix; then
: null
else
echo "Nor is it Venix..."
fi
echo "exit 1" >venix
fi
chmod 755 bsd usg v7 eunice venix xenix
$eunicefix bsd usg v7 eunice venix xenix
rmlist="$rmlist bsd usg v7 eunice venix xenix"
: see if sh knows # comments
echo " "
echo "Checking your sh to see if it knows about # comments..."
if sh -c '#' >/dev/null 2>&1 ; then
echo "Your sh handles # comments correctly."
shsharp=true
spitshell=cat
echo " "
echo "Okay, let's see if #! works on this system..."
echo "#!/bin/echo hi" > try
$eunicefix try
chmod 755 try
try > today
if test -s today; then
echo "It does."
sharpbang='#!'
else
echo "#! /bin/echo hi" > try
$eunicefix try
chmod 755 try
try > today
if test -s today; then
echo "It does."
sharpbang='#! '
else
echo "It doesn't."
sharpbang=': use '
fi
fi
else
echo "Your sh doesn't grok # comments--I will strip them later on."
shsharp=false
echo "exec grep -v '^#'" >spitshell
chmod 755 spitshell
$eunicefix spitshell
spitshell=`pwd`/spitshell
echo "I presume that if # doesn't work, #! won't work either!"
sharpbang=': use '
fi
: figure out how to guarantee sh startup
echo " "
echo "Checking out how to guarantee sh startup..."
startsh=$sharpbang'/bin/sh'
echo "Let's see if '$startsh' works..."
cat >try <<EOSS
$startsh
set abc
test "$?abc" != 1
EOSS
chmod 755 try
$eunicefix try
if try; then
echo "Yup, it does."
else
echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
fi
rm -f try today
: find out how to find out full name
echo " "
case "$d_berknames" in
"$define")
dflt=y;;
"$undef")
dflt=n;;
*)
if bsd; then
dflt=y
else
dflt=n
fi
;;
esac
echo "Does your /etc/passwd file keep full names in Berkeley/V7 format (name first"
$echo $n "thing after ':' in GCOS field)? [$dflt] $c"
rp="Berkeley/V7 format full name? [$dflt]"
. myread
case "$ans" in
y*)
d_passnames="$define"
d_berknames="$define"
d_usgnames="$undef"
nametype=bsd
;;
*)
echo " "
case "$d_usgnames" in
"$define")
dflt=y;;
"$undef")
dflt=n;;
*)
if usg; then
dflt=y
else
dflt=n
fi
;;
esac
echo "Does your passwd file keep full names in USG format (name sandwiched"
$echo $n "between a '-' and a '(')? [$dflt] $c"
rp="USG format full name? [$dflt]"
. myread
case "$ans" in
n*)
echo "Full name will be taken from ~/.fullname"
d_passnames="$undef"
d_berknames="$undef"
d_usgnames="$undef"
nametype=other
;;
*)
d_passnames="$define"
d_berknames="$undef"
d_usgnames="$define"
nametype=usg
;;
esac
;;
esac
: see if we have to deal with yellow pages
if $test -d /usr/etc/yp; then
if $contains '^\+:' /etc/passwd; then
dflt=y
else
dflt=n
fi
rp="Are you getting the passwd file via yellow pages? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
y*) passcat='ypcat passwd';;
*) passcat='cat /etc/passwd';;
esac
else
passcat='cat /etc/passwd'
fi
: see if sprintf is declared as int or pointer to char
echo " "
if $contains 'char.*sprintf' /usr/include/stdio.h >/dev/null 2>&1 ; then
echo "Your sprintf() returns (char*)."
d_charsprf="$define"
else
echo "Your sprintf() returns (int)."
d_charsprf="$undef"
fi
: now get the host name
echo " "
echo "Figuring out host name..."
echo 'Maybe "hostname" will work...'
if ans=`sh -c hostname 2>&1` ; then
hostname=$ans
phostname=hostname
else
echo 'Oh, dear. Maybe "/etc/systemid" will work...'
if ans=`sh -c '/etc/systemid' 2>&1` ; then
hostname=$ans
phostname='/etc/systemid'
if xenix; then
echo "Whadyaknow. Xenix always was a bit strange..."
else
echo "What is a non-Xenix system doing with /etc/systemid?"
fi
else
echo 'No, maybe "uuname -l" will work...'
if ans=`sh -c 'uuname -l' 2>&1` ; then
hostname=$ans
phostname='uuname -l'
else
echo 'Strange. Maybe "uname -n" will work...'
if ans=`sh -c 'uname -n' 2>&1` ; then
hostname=$ans
phostname='uname -n'
else
echo 'Oh well, maybe I can mine it out of whoami.h...'
if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' </usr/include/whoami.h"
else
case "$hostname" in
'') echo "Does this machine have an identity crisis or something?"
phostname=''
;;
*) echo "Well, you said $hostname before...";;
esac
fi
fi
fi
fi
fi
: you do not want to know about this
set $hostname
hostname=$1
: translate upper to lower if necessary
case "$hostname" in
*[A-Z]*)
hostname=`echo $hostname | tr '[A-Z]' '[a-z]'`
echo "(Normalizing case in your host name)"
;;
esac
: verify guess
if $test "$hostname" ; then
dflt=y
echo 'Your host name appears to be "'$hostname'".'
$echo $n "Is this correct? [$dflt] $c"
rp="Sitename is $hostname? [$dflt]"
. myread
case "$ans" in
y*) ;;
*) hostname='' ;;
esac
fi
: bad guess or no guess
while $test "X$hostname" = X ; do
dflt=''
rp="Please type the (one word) name of your host:"
$echo $n "$rp $c"
. myread
hostname="$ans"
done
echo " "
case "$hostname" in
*.*)
dflt=`expr "X$hostname" : "X[^.]*\(\..*\)"`
hostname=`expr "X$hostname" : "X\([^.]*\)\."`
echo "(Trimming domain name from host name--host name is now $hostname)"
;;
*)
dflt='.uucp'
;;
esac
rp="What is your domain name? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
'') ;;
.*) ;;
*) ans=".$ans";;
esac
mydomain="$ans"
: a little sanity check here
case "$phostname" in
'') ;;
*) case `$phostname` in
$hostname$mydomain|$hostname) ;;
*)
case "$phostname" in
sed*)
echo "(That doesn't agree with your whoami.h file, by the way.)"
;;
*)
echo "(That doesn't agree with your $phostname command, by the way.)"
;;
esac
phostname=''
;;
esac
;;
esac
: decide how portable to be
case "$d_portable" in
"$define") dflt=y;;
*) dflt=n;;
esac
$cat <<'EOH'
I can set things up so that your shell scripts and binaries are more portable,
at what may be a noticable cost in performance. In particular, if you
ask to be portable, the following happens:
1) shell scripts will rely on the PATH variable rather than using
the paths derived above.
2) ~username interpretations will be done at run time rather than
by Configure.
3) the system name will be determined at run time, if at all possible.
EOH
rp="Do you expect to run these scripts and binaries on multiple machines? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
y*) d_portable="$define"
for file in $loclist; do
eval $file=$file
done
;;
*) d_portable="$undef" ;;
esac
: see if there is a whoami file
echo " "
if $test -r /usr/include/whoami.h ; then
d_whoami="$define"
echo "whoami.h found."
else
d_whoami="$undef"
fi
: see how we will look up host name
echo " "
d_douname="$undef"
d_gethname="$undef"
d_phostname="$undef"
if xenix; then
echo " "
echo "(Assuming Xenix uname() is broken.)"
elif $contains gethostname libc.list >/dev/null 2>&1 ; then
echo "gethostname() found."
d_gethname="$define"
ans=gethostname
elif $contains uname libc.list >/dev/null 2>&1 ; then
echo "uname() found."
d_douname="$define"
ans=uname
fi
case "$d_douname$d_gethname" in
*define*)
dflt=n
cat <<EOM
Every now and then someone has a $ans() that lies about the hostname
but can't be fixed for political or economic reasons. Would you like to
EOM
rp="pretend $ans() isn't there and maybe compile in the hostname? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
y*) d_douname="$undef" d_gethname="$undef"
$echo $n "Okay... $c"
;;
esac
;;
esac
case "$d_douname$d_gethname" in
*define*) ;;
*)
case "$phostname" in
'') ;;
*)
$cat <<EOT
There is no gethostname() or uname() on this system. You have two
possibilities at this point:
1) You can have your host name ($hostname) compiled into $package, which
lets $package start up faster, but makes your binaries non-portable, or
2) you can have $package use a
popen("$phostname","r")
which will start slower but be more portable.
Option 1 will give you the option of using whoami.h if you have one. If you
want option 2 but with a different command, you can edit config.sh at the
end of this shell script.
EOT
case "$d_phostname" in
"$define") dflt=n;;
"$undef") dflt=y;;
'')
case "$d_portable" in
"$define") dflt=n ;;
*) dflt=y ;;
esac
;;
esac
rp="Do you want your host name compiled in? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
n*) d_phostname="$define" ;;
*) phostname=''
d_phostname="$undef"
;;
esac
;;
esac
case "$phostname" in
'')
case "$d_whoami" in
"$define")
dflt=y
$cat <<EOM
No hostname function--you can either use the whoami.h file, which has this line:
`grep sysname /usr/include/whoami.h`
or you can have the name we came up with earlier ($hostname) hardwired in.
EOM
rp="Use whoami.h to get hostname? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
n*) d_whoami="$undef";;
esac
;;
"$undef")
echo 'No hostname function and no whoami.h--hardwiring "'$hostname'".'
;;
esac
;;
esac
;;
esac
: see if this is an fcntl system
echo " "
if $test -r /usr/include/fcntl.h ; then
d_fcntl="$define"
echo "fcntl.h found."
else
d_fcntl="$undef"
echo "No fcntl.h found, but that's ok."
fi
: see if ftime exists
echo " "
if $contains ftime libc.list >/dev/null 2>&1; then
echo 'ftime() found.'
d_ftime="$define"
else
echo 'ftime() not found--timing may be less accurate.'
d_ftime="$undef"
fi
: see if there is a getpw
echo " "
if $contains getpw.o libc.list >/dev/null 2>&1 ; then
echo "getpw() found."
d_getpwent="$undef"
else
echo "No getpw() found--will use getpwent() instead."
d_getpwent="$define"
fi
: set up shell script to do ~ expansion
cat >filexp <<EOSS
$startsh
: expand filename
case "\$1" in
~/*|~)
echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
;;
~*)
if $test -f /bin/csh; then
/bin/csh -f -c "glob \$1"
echo ""
else
name=\`$expr x\$1 : '..\([^/]*\)'\`
dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
if $test ! -d "\$dir"; then
me=\`basename \$0\`
echo "\$me: can't locate home directory for: \$name" >&2
exit 1
fi
case "\$1" in
*/*)
echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
;;
*)
echo \$dir
;;
esac
fi
;;
*)
echo \$1
;;
esac
EOSS
chmod 755 filexp
$eunicefix filexp
: where do we get termlib routines from
echo " "
ans=`loc libcurses.a x $libpth`
case "$ans" in
/*)
ar t $ans >grimble
if $contains tputs.o grimble >/dev/null 2>&1; then
termlib='-lcurses'
d_havetlib="$define"
echo "Terminfo library found."
else
ans=x
fi
;;
esac
case "$ans" in
x)
ans=`loc libtermlib.a x $libpth`
case "$ans" in
/usr/lib*|/lib*)
termlib='-ltermlib'
d_havetlib="$define"
echo "Termlib library found."
;;
/*)
termlib="$ans"
d_havetlib="$define"
echo "Termlib library found."
;;
*)
ans=`loc libtermcap.a x $libpth`
case "$ans" in
/usr/lib*|/lib*)
termlib='-ltermcap'
d_havetlib="$define"
echo "Termcap library found."
;;
/*)
termlib="$ans"
d_havetlib="$define"
echo "Termcap library found."
;;
*)
case "$termlib" in
'')
dflt=y
rp="Your system appears to NOT have termlib-style routines. Is this true? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
n*|f*) d_havetlib="$define"
echo "Then where are the termlib-style routines kept (specify either -llibname"
$echo $n " or full pathname (~name ok))? $c"
rp='Specify termlib:'
. myread
termlib=`filexp $ans`
;;
*) d_havetlib="$undef"
termlib=''
echo "You will have to play around with term.c then."
;;
esac
echo " "
;;
*) echo "You said termlib was $termlib before."
;;
esac
;;
esac
;;
esac
;;
esac
: index or strcpy
echo " "
dflt=y
if $contains index libc.list >/dev/null 2>&1 ; then
echo "Your system appears to use index() and rindex() rather than strchr()"
$echo $n "and strrchr(). Is this correct? [$dflt] $c"
rp='index() rather than strchr()? [$dflt]'
. myread
case "$ans" in
n*|f*) d_index="$define" ;;
*) d_index="$undef" ;;
esac
else
echo "Your system appears to use strchr() and strrchr() rather than index()"
$echo $n "and rindex(). Is this correct? [$dflt] $c"
rp='strchr() rather than index()? [$dflt]'
. myread
case "$ans" in
n*|f*) d_index="$undef" ;;
*) d_index="$define" ;;
esac
fi
: see if ioctl defs are in sgtty/termio or sys/ioctl
echo " "
if $test -r /usr/include/sys/ioctl.h ; then
d_ioctl="$define"
echo "sys/ioctl.h found."
else
d_ioctl="$undef"
echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
fi
: see if there are directory access routines out there
echo " "
if $test -r /usr/include/ndir.h && \
( $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ); then
echo "Ndir library found."
if $test -r /usr/lib/libndir.a; then
ndirlib='-lndir'
else
ndirlib="/usr/local/lib/libndir.a"
fi
d_libndir="$define"
d_usendir="$undef"
ndirc=''
ndiro=''
else
ndirlib=''
d_libndir="$undef"
if bsd && $contains readdir libc.list >/dev/null 2>&1 ; then
echo "No ndir library found, but you have readdir() so we'll use that."
d_usendir="$undef"
ndirc=''
ndiro=''
else
echo "No ndir library found--using ./ndir.c."
d_usendir="$define"
ndirc='ndir.c'
ndiro='ndir.o'
fi
fi
: see if we need -ljobs and if we have sigset, etc.
echo " "
if $test -r /usr/lib/libjobs.a || $test -r /usr/local/lib/libjobs.a ; then
echo "Jobs library found."
d_normsig="$undef"
jobslib='-ljobs'
else
if bsd; then
echo "No jobs library found. (I suppose this is at least 4.2...)"
else
echo "No jobs library found. (That's okay, we all have our faults.)"
fi
d_normsig="$define"
jobslib=''
fi
: see if rdchk exists
echo " "
if $contains rdchk libc.list >/dev/null 2>&1; then
echo 'rdchk() found.'
d_rdchk="$define"
else
if v7; then
echo "rdchk() not found--you'd better have FIONREAD or O_NDELAY."
else
echo 'rdchk() not found.'
fi
d_rdchk="$undef"
fi
: see how they want the scoreboard kept
case "$d_scorfl" in
"$define") dflt=y ;;
*) dflt=n ;;
esac
case "$nametype" in
other) d_scorfl="$undef" ;;
*)
$cat <<'EOM'
The scoreboard can be kept with one score per login name, or one score
per full name. If users can change their full name, or if there is
more than one person on your system with the same full name, you should
keep the score by login name (the full name is still printed).
EOM
rp="Do you want the scoreboard kept by full name? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
y*) d_scorfl="$define" ;;
*) d_scorfl="$undef" ;;
esac
;;
esac
: check for signed chars
echo " "
echo "Checking to see if your C compiler can do signed chars..."
$cat >try.c <<'EOCP'
main()
{
char c = 0;
c--;
exit(c >= 0);
}
EOCP
cc -o a.out try.c
if a.out; then
d_sgndchr="$define"
echo "It certainly can."
else
d_sgndchr="$undef"
echo "It can't. I'll have to make some things type short."
fi
$rm -f try.* a.out
: see how we invoke the C preprocessor
echo " "
echo "Checking to see how your C preprocessor is invoked..."
cat <<'EOT' >testcpp.c
#define ABC abc
#define XYZ xyz
ABC.XYZ
EOT
echo 'Maybe "cc -E" will work...'
cc -E testcpp.c >testcpp.out 2>&1
if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, it does."
cpp='cc -E'
else
echo 'Nope...maybe "cc -P" will work...'
cc -P testcpp.c >testcpp.out 2>&1
if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, that does."
cpp='cc -P'
else
echo 'Nixed again...maybe "/lib/cpp" will work...'
/lib/cpp testcpp.c >testcpp.out 2>&1
if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Hooray, it works! I was beginning to wonder."
cpp='/lib/cpp'
else
echo 'Hmm...maybe you already told me...'
case "$cpp" in
'') ;;
*) $cpp testcpp.c >testcpp.out 2>&1;;
esac
if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Hooray, you did! I was beginning to wonder."
else
dflt=blurfl
$echo $n "Nope. I can't find a C preprocessor. Name one: $c"
rp='Name a C preprocessor:'
. myread
cpp="$ans"
$cpp testcpp.c >testcpp.out 2>&1
if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
echo "OK, that will do."
else
echo "Sorry, I can't get that to work. Go find one."
exit 1
fi
fi
fi
fi
fi
rm -f testcpp.c testcpp.out
: get C preprocessor symbols handy
echo " "
echo $attrlist | $tr '[ ]' '[\012]' >Cppsym.know
$cat <<EOSS >Cppsym
$startsh
case "\$1" in
-l) list=true
shift
;;
esac
unknown=''
case "\$list\$#" in
1|2)
for sym do
if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
exit 0
elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
:
else
unknown="\$unknown \$sym"
fi
done
set X \$unknown
shift
;;
esac
case \$# in
0) exit 1;;
esac
echo \$* | $tr '[ ]' '[\012]' | $sed -e 's/\(.*\)/\\
#ifdef \1\\
exit 0; _ _ _ _\1\\ \1\\
#endif\\
/' >/tmp/Cppsym\$\$
echo exit 1 >>/tmp/Cppsym\$\$
$cpp /tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
case "\$list" in
true) awk '\$6 != "" {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
*)
sh /tmp/Cppsym2\$\$
status=\$?
;;
esac
$rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
exit \$status
EOSS
chmod 755 Cppsym
$eunicefix Cppsym
echo "Your C preprocessor defines the following symbols:"
Cppsym -l $attrlist >Cppsym.true
cat Cppsym.true
rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
: see if this is a termio system
echo " "
if Cppsym pyr && $test -r /usr/include/sgtty.h ; then
d_termio="$undef"
echo "sgtty.h found."
elif $test -r /usr/include/termio.h ; then
d_termio="$define"
echo "termio.h found."
elif $test -r /usr/include/sgtty.h ; then
d_termio="$undef"
echo "sgtty.h found."
else
d_termio="$undef"
echo "Neither termio.h nor sgtty.h found--you could have problems."
fi
: find out which shell people like to use most
case "$prefshell" in
'')
if $test -f /bin/ksh; then
dflt='/bin/ksh'
elif $test -f /bin/csh; then
dflt='/bin/csh'
else
dflt='/bin/sh'
fi
;;
*) dflt="$prefshell";;
esac
cont=true
while $test "$cont" ; do
echo " "
echo "Give the full path name of the shell most people like to use on your"
$echo $n "system: [$dflt] $c"
rp="Preferred shell: [$dflt]"
. myread
prefshell=$ans
if test -f $ans; then
cont=''
else
dflt=n
rp="File $ans doesn't exist. Use that name anyway? [$dflt]"
$echo $n "$rp $c"
. myread
dflt=''
case "$ans" in
y*) cont='';;
esac
fi
done
: determine where private files go
case "$privlib" in
'')
dflt=/usr/games/lib/$package
;;
*) dflt="$privlib"
;;
esac
$cat <<EOM
The $package package has a some auxiliary files that should be put in a library
that is accessible by everyone. Where do you want to put these private"
EOM
$echo $n "but accessible files? [$dflt] (~name ok) $c"
rp="Put private files where? [$dflt]"
. myread
privlib="$ans"
case "$privlib" in
'') privlib=$dflt ;;
esac
case "$d_portable" in
"$undef")
privlib=`filexp $privlib`
;;
esac
: check for size of random number generator
echo " "
case "$randbits" in
'')
echo "Checking to see how many bits your rand function produces..."
$cat >try.c <<'EOCP'
#include <stdio.h>
main()
{
register int i;
register unsigned long tmp;
register unsigned long max;
for (i=1000; i; i--) {
tmp = (unsigned long)rand();
if (tmp > max) max = tmp;
}
for (i=0; max; i++)
max /= 2;
printf("%d\n",i);
}
EOCP
if cc try.c -o try >/dev/null 2>&1 ; then
dflt=`try`
else
dflt='?'
echo "(I can't seem to compile the test program...)"
fi
;;
*)
dflt="$randbits"
;;
esac
rp="How many bits does your rand() function produce? [$dflt]"
$echo $n "$rp $c"
. myread
randbits="$ans"
$rm -f try.c try
: see how many register declarations we want to use
case "$registers" in
'')
if Cppsym vax; then
dflt=6
elif Cppsym sun mc68000; then
dflt=10
elif Cppsym pyr; then
dflt=14
elif Cppsym ns32000 ns16000; then
dflt=5
elif Cppsym $smallmach; then
dflt=3
else
: if you have any other numbers for me, send them in
dflt=6
fi
;;
*) dflt=$registers ;;
esac
cat <<EOM
Different C compilers on different machines pay attention to different
numbers of register declarations. About how many register declarations in
EOM
$echo $n "each routine does your C compiler pay attention to? (OK to guess) [$dflt] $c"
rp="# register declarations used? [$dflt]"
. myread
registers=$ans
reg1=''
awk "END { for (i=1; i<=16; i++) printf \"reg%d=''\n\", i}" </dev/null >.foo
. .foo
awk "END { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \
</dev/null >.foo
. .foo
rm -f .foo
: determine root id
echo " "
rootid=`$sed -e "/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e "q" -e "}" -e "d" </etc/passwd`
case "$rootid" in
'') rootid=0 ;;
*) echo "Root uid = $rootid" ;;
esac
: check for void type
echo " "
$cat <<EOM
Checking to see how well your C compiler groks the void type...
Support flag bits are:
1: basic void declarations.
2: arrays of pointers to functions returning void.
4: operations between pointers to and addresses of void functions.
EOM
case "$voidflags" in
'')
$cat >try.c <<'EOCP'
#if TRY & 1
void main() {
#else
main() {
#endif
extern void *moo();
void (*goo)();
#if TRY & 2
void (*foo[10])();
#endif
#if TRY & 4
if(goo == moo) {
exit(0);
}
#endif
exit(0);
}
EOCP
if cc -S -DTRY=7 try.c >.out 2>&1 ; then
voidflags=7
echo "It appears to support void fully."
if $contains warning .out >/dev/null 2>&1; then
echo "However, you might get some warnings that look like this:"
$cat .out
fi
else
echo "Hmm, you compiler has some difficulty with void. Checking further..."
if cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
echo "It supports 1..."
if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
voidflags=3
echo "And it supports 2 but not 4."
else
echo "It doesn't support 2..."
if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
voidflags=5
echo "But it supports 4."
else
voidflags=1
echo "And it doesn't support 4."
fi
fi
else
echo "There is no support at all for void."
voidflags=0
fi
fi
esac
dflt="$voidflags";
rp="Your void support flags add up to what? [$dflt]"
$echo $n "$rp $c"
. myread
voidflags="$ans"
$rm -f try.* .out
: preserve RCS keywords in files with variable substitution, grrr
Log='$Log'
Header='$Header'
: determine where public executables go
case "$bin" in
'')
dflt=`loc . /bin /usr/games /usr/local/bin /usr/lbin /usr/local /usr/bin`
;;
*) dflt="$bin"
;;
esac
bin='blurfl/dyick'
while $test ! -d "$bin" ; do
case "$bin" in
blurfl*) ;;
*) $echo "$bin does not appear to exist." ;;
esac
$echo " "
rp="Where do you want to put the public executables? [$dflt]"
$echo $n "$rp $c"
. myread
bin="$ans"
bin=`filexp $bin`
case "$bin" in
'') bin=$dflt ;;
esac
done
: determine where manual pages go
case "$mansrc" in
'')
dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
;;
*) dflt="$mansrc"
;;
esac
cont=true
while $test "$cont" ; do
echo " "
rp="Where do the manual pages (source) go? [$dflt]"
$echo $n "$rp $c"
. myread
mansrc=`filexp "$ans"`
if test -d $mansrc; then
cont=''
else
dflt=n
rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
$echo $n "$rp $c"
. myread
dflt=''
case "$ans" in
y*) cont='';;
esac
fi
done
case "$mansrc" in
*l)
manext=l
;;
*n)
manext=n
;;
*)
manext=1
;;
esac
: see what memory models we can support
case "$models" in
'')
if Cppsym pdp11; then
dflt='unsplit split'
else
ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
case "$ans" in
X) dflt='none';;
*) if $test -d /lib/small || $test -d /usr/lib/small; then
dflt='small'
else
dflt=''
fi
if $test -d /lib/medium || $test -d /usr/lib/medium; then
dflt="$dflt medium"
fi
if $test -d /lib/large || $test -d /usr/lib/large; then
dflt="$dflt large"
fi
if $test -d /lib/huge || $test -d /usr/lib/huge; then
dflt="$dflt huge"
fi
esac
fi
;;
*) dflt="$models" ;;
esac
$cat <<EOM
Some systems have different model sizes. On most systems they are called
small, medium, large, and huge. On the PDP11 they are called unsplit and
split. If your system doesn't support different memory models, say "none".
If you wish to force everything to one memory model, say "none" here and
put the appropriate flags later when it asks you for other cc and ld flags.
Venix systems may wish to put "none" and let the compiler figure things out.
(In the following question multiple model names should be space separated.)
EOM
rp="Which models are supported? [$dflt]"
$echo $n "$rp $c"
. myread
models="$ans"
case "$models" in
none)
small=''
medium=''
large=''
huge=''
unsplit=''
split=''
;;
*split)
case "$split" in
'')
if $contains '-i' $mansrc/ld.1 >/dev/null 2>&1 || \
$contains '-i' $mansrc/cc.1 >/dev/null 2>&1; then
dflt='-i'
else
dflt='none'
fi
;;
*) dflt="$split";;
esac
rp="What flag indicates separate I and D space? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';;
esac
split="$ans"
unsplit=''
;;
*large*|*small*|*medium*|*huge*)
case "$model" in
*large*)
case "$large" in
'') dflt='-Ml';;
*) dflt="$large";;
esac
rp="What flag indicates large model? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
large="$ans"
;;
*) large='';;
esac
case "$model" in
*huge*)
case "$huge" in
'') dflt='-Mh';;
*) dflt="$huge";;
esac
rp="What flag indicates huge model? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
huge="$ans"
;;
*) huge="$large";;
esac
case "$model" in
*medium*)
case "$medium" in
'') dflt='-Mm';;
*) dflt="$medium";;
esac
rp="What flag indicates medium model? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
medium="$ans"
;;
*) medium="$large";;
esac
case "$model" in
*small*)
case "$small" in
'') dflt='none';;
*) dflt="$small";;
esac
rp="What flag indicates small model? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
small="$ans"
;;
*) small='';;
esac
;;
*)
echo "Unrecognized memory models--you may have to edit Makefile.SH"
;;
esac
case "$ccflags" in
'') dflt='none';;
*) dflt="$ccflags";;
esac
echo " "
rp="Any additional cc flags? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
ccflags="$ans"
case "$ldflags" in
'') if venix; then
dflt='-i -z'
else
dflt='none'
fi
;;
*) dflt="$ldflags";;
esac
echo " "
rp="Any additional ld flags? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
ldflags="$ans"
: see if we need a special compiler
echo " "
if usg; then
case "$cc" in
'')
case "$Mcc" in
/*) dflt='Mcc'
;;
*)
case "$large" in
-M*)
dflt='cc'
;;
*)
if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
dflt='cc -M'
else
dflt='cc'
fi
;;
esac
;;
esac
;;
*) dflt="$cc";;
esac
$cat <<'EOM'
On some systems the default C compiler will not resolve multiple global
references that happen to have the same name. On some such systems the
"Mcc" command may be used to force these to be resolved. On other systems
a "cc -M" command is required. (Note that the -M flag on other systems
indicates a memory model to use!) What command will force resolution on
EOM
$echo $n "this system? [$dflt] $c"
rp="Command to resolve multiple refs? [$dflt]"
. myread
cc="$ans"
else
echo "Not a USG system--assuming cc can resolve multiple definitions."
cc=cc
fi
: get uid to chown everything to
case "$chowner" in
'') dflt=daemon
;;
*) dflt="$chowner"
;;
esac
$cat <<'EOM'
If you do a make install as the superuser, I can chown all the publicly
visible files to be owned by some particular user id. Any setuid programs
in this package will run under this uid, and be able to access the files
that belong to this uid. You should pick a uid that nobody can log into
that you don't trust to modify the programs or data files of this package.
You should probably not pick root if there are any setuid programs in this
package. If you want to create a uid for this, do so before the make install.
EOM
rp="Uid to chown public files to? [$dflt]"
$echo $n "$rp $c"
. myread
chowner="$ans"
case "$chowner" in
'') chowner=$dflt ;;
esac
: see if we should include -lnm
echo " "
if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
echo "New math library found."
libnm='-lnm'
else
ans=`loc libtermlib.a x $libpth`
case "$ans" in
x)
echo "No nm library found--the normal math library will have to do."
libnm=''
;;
*)
echo "New math library found in $ans."
libnm="$ans"
;;
esac
fi
: Warnings
if v7; then
cat <<'EOM'
NOTE: the V7 compiler may ignore some #undefs that $package uses. If so,
you may get messages about redefining EXT. Some V7 compilers also have
difficulties with #defines near buffer boundaries, so beware. You may have
to play with the spacing in some .h files, believe it or not.
EOM
fi
: Warnings
if v7; then
cat <<'EOM'
NOTE: many V7 systems do not have a way to do a non-blocking read. If you
don't have any of FIONREAD, O_NDELAY, or rdchk(), the $package package
may not work as well as it might. It might not work at all.
EOM
fi
$echo " "
$echo "End of configuration questions."
$echo " "
: create config.sh file
echo " "
if test -d ../UU; then
cd ..
fi
echo "Creating config.sh..."
$spitshell <<EOT >config.sh
$startsh
# config.sh
# This file was produced by running the Configure script.
d_eunice='$d_eunice'
eunicefix='$eunicefix'
define='$define'
loclist='$loclist'
expr='$expr'
sed='$sed'
echo='$echo'
cat='$cat'
rm='$rm'
mv='$mv'
cp='$cp'
tail='$tail'
tr='$tr'
mkdir='$mkdir'
sort='$sort'
uniq='$uniq'
grep='$grep'
trylist='$trylist'
test='$test'
inews='$inews'
egrep='$egrep'
more='$more'
pg='$pg'
Mcc='$Mcc'
vi='$vi'
mailx='$mailx'
Log='$Log'
Header='$Header'
cc='$cc'
contains='$contains'
cpp='$cpp'
d_charsprf='$d_charsprf'
d_fcntl='$d_fcntl'
d_ftime='$d_ftime'
d_gethname='$d_gethname'
d_douname='$d_douname'
d_phostname='$d_phostname'
d_getpwent='$d_getpwent'
d_havetlib='$d_havetlib'
termlib='$termlib'
d_index='$d_index'
d_ioctl='$d_ioctl'
d_normsig='$d_normsig'
jobslib='$jobslib'
d_portable='$d_portable'
d_rdchk='$d_rdchk'
d_scorfl='$d_scorfl'
d_sgndchr='$d_sgndchr'
d_termio='$d_termio'
d_usendir='$d_usendir'
d_libndir='$d_libndir'
ndirc='$ndirc'
ndiro='$ndiro'
d_whoami='$d_whoami'
hostname='$hostname'
phostname='$phostname'
mydomain='$mydomain'
libc='$libc'
libnm='$libnm'
mansrc='$mansrc'
manext='$manext'
models='$models'
split='$split'
small='$small'
medium='$medium'
large='$large'
huge='$huge'
ccflags='$ccflags'
ldflags='$ldflags'
n='$n'
c='$c'
nametype='$nametype'
d_passnames='$d_passnames'
d_berknames='$d_berknames'
d_usgnames='$d_usgnames'
passcat='$passcat'
package='$package'
prefshell='$prefshell'
randbits='$randbits'
registers='$registers'
reg1='$reg1'
reg2='$reg2'
reg3='$reg3'
reg4='$reg4'
reg5='$reg5'
reg6='$reg6'
reg7='$reg7'
reg8='$reg8'
reg9='$reg9'
reg10='$reg10'
reg11='$reg11'
reg12='$reg12'
reg13='$reg13'
reg14='$reg14'
reg15='$reg15'
reg16='$reg16'
rootid='$rootid'
spitshell='$spitshell'
shsharp='$shsharp'
sharpbang='$sharpbang'
startsh='$startsh'
voidflags='$voidflags'
bin='$bin'
chowner='$chowner'
privlib='$privlib'
CONFIG=true
EOT
CONFIG=true
echo " "
dflt=''
echo "If you didn't make any mistakes, then just type a carriage return here."
rp="If you need to edit config.sh, do it as a shell escape here:"
$echo $n "$rp $c"
. myread
case "$ans" in
'') ;;
*) : in case they cannot read
eval $ans;;
esac
echo " "
echo "Doing variable substitutions on .SH files..."
set `$grep '\.SH' <MANIFEST | awk '{print $1}'`
for file in $*; do
case "$file" in
*/*)
dir=`$expr X$file : 'X\(.*\)/'`
file=`$expr X$file : 'X.*/\(.*\)'`
(cd $dir && . $file)
;;
*)
. $file
;;
esac
done
if test -f config.h.SH; then
if test ! -f config.h; then
: oops, they left it out of MANIFEST, probably, so do it anyway.
. config.h.SH
fi
fi
if $contains '^depend:' Makefile >/dev/null 2>&1; then
dflt=n
$cat <<EOM
Now you need to generate make dependencies by running "make depend".
You might prefer to run it in background: "make depend > makedepend.out &"
It can take a while, so you might not want to run it right now.
EOM
rp="Run make depend now? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
y*) make depend
echo "Now you must run a make."
;;
*) echo "You must run 'make depend' then 'make'."
;;
esac
elif test -f Makefile; then
echo " "
echo "Now you must run a make."
else
echo "Done."
fi
$rm -f kit*isdone
cd UU && $rm -f $rmlist
: end of Configure
fer to run it in background: "make dwarp/smp.7 644 171 5 2620 5121750002 5713 * * * * * *
* * * * * * *
* * * * * * *
* * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * *
* * * * * * * *
* * * * * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * *
* * * * * * * *
* * * * * * * * * *
* * * * * * * * * * *
* * * * * * * * *
* * * * * * * * * * * * *
* * *
* * *
* * *
* * * * *
* * * * * * * * *
* * *
* * * * * *
* * * * * * * * * * * * *
warp/move.c 644 171 5 40273 5121750015 6170 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.2 86/10/20 14:37:06 lwall
* Picked some lint.
*
* Revision 7.0.1.1 86/10/16 10:52:09 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:12:40 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "bang.h"
#include "object.h"
#include "move.h"
#include "play.h"
#include "score.h"
#include "term.h"
#include "them.h"
#include "us.h"
#include "util.h"
#include "weapon.h"
#include "INTERN.h"
#include "move.h"
void
move_init()
{
;
}
void
bounce(obj)
Reg4 OBJECT *obj;
{
Reg1 int x;
Reg2 int y;
Reg3 int count=0;
y = (obj->posy - sgn(obj->vely) + YSIZE00) % YSIZE;
x = (obj->posx - sgn(obj->velx) + XSIZE00) % XSIZE;
while (occupant[y][x]) {
y = (y + rand_mod(3) - 1 + YSIZE00) % YSIZE;
x = (x + rand_mod(3) - 1 + XSIZE00) % XSIZE;
if (++count > 10000) { /* if universe full, get out of it fast */
unmake_object(obj);
if (ent) unmake_object(ent);
if (base) unmake_object(base);
finish = 1;
return;
}
}
obj->posy = y;
obj->posx = x;
obj->vely = 0;
obj->velx = 0;
occupant[y][x] = obj;
if (numamoebas && obj->image == ' ')
mvaddc(y+1, x*2, amb[y][x]);
else
mvaddc(y+1, x*2, obj->image);
}
void
move_universe()
{
Reg1 OBJECT *curobj;
Reg2 int x;
Reg3 int y;
Reg4 OBJECT *temp;
OBJECT *thenext;
for (curobj = movers; curobj != &root; curobj = curobj->next) {
x = curobj->posx;
y = curobj->posy;
if (curobj == occupant[y][x]) {
occupant[y][x] = 0;
}
else if (curobj->type != Torp && curobj->type != Web) {
resetty();
abort();
}
}
for (curobj = movers; curobj != &root; curobj = thenext) {
thenext = curobj->next;
if (curobj->vely || curobj->velx) {
y = curobj->posy;
x = curobj->posx;
if (curobj->image != ' ' &&
(!(temp=occupant[y][x]) || temp->image==' ') ) {
move(y+1, x*2, numamoebas ? amb[y][x] : ' ');
}
y = (y + curobj->vely + YSIZE00) % YSIZE;
x = (x + curobj->velx + XSIZE00) % XSIZE;
if (!(temp=occupant[y][x]) || temp->type != Star ||
curobj->type != Torp || curobj->image == '+' ||
curobj->image == 'x') {
curobj->posy = y;
curobj->posx = x;
}
else {
if (curobj->image == '0') {
curobj->vely = rand_mod(3)-1;
curobj->velx = rand_mod(3)-1;
}
else
curobj->vely = curobj->velx = 0;
y = curobj->posy;
x = curobj->posx;
}
}
else { /* not moving */
y = curobj->posy;
x = curobj->posx;
if (curobj->type == Torp ||
curobj->type == Star ||
curobj->type == Web) {
curobj->flags |= STATIC;
curobj->next->prev = curobj->prev;
curobj->prev->next = curobj->next;
curobj->prev = movers->prev;
curobj->next = movers;
movers->prev->next = curobj;
movers->prev = curobj;
}
}
if (temp = occupant[y][x]) { /* already occupied? */
if (!temp->contend) {
if (temp->type == Torp) {
if (temp->image == '+')
blast[y][x] += 1250;
else if (temp->image == 'o' && (base||ent))
blast[y][x] += 500+super*20;
else if (temp->image == 'O' && (base||ent))
blast[y][x] += 5000+super*100;
}
}
yblasted[y] |= 1;
xblasted[x] |= 1;
blasted = TRUE;
curobj->contend = temp;
occupant[y][x] = curobj;
switch (curobj->type) {
case Enemy:
if (numamoebas && curobj == nuke && temp->image == '+')
blast[y][x] += 80000;
else if (temp->type == Enemy)
blast[y][x] += 10;
else
goto defblast;
break;
case Crusher:
if (curobj->velx)
blast[y][x] += 100000;
else
goto defblast;
break;
case Torp:
if (curobj->image == '+')
blast[y][x] += (temp==nuke ? 80000 : 1250);
else if (curobj->image == 'o')
blast[y][x] += 500+super*20;
else if (curobj->image == 'O')
blast[y][x] += 5000+super*100;
goto defblast;
case Star:
if (temp == ent)
goto damshield;
goto defblast;
case Enterprise:
if (temp->type == Star) {
damshield:
if (!rand_mod(10)) {
if (!damflag[NOSHIELDS])
damage++;
if (damflag[NOSHIELDS] < 100)
damflag[NOSHIELDS] += rand_mod(smarts)/5+2;
}
}
goto defblast;
default:
defblast:
blast[y][x] += rand_mod(751)+1;
break;
}
}
else {
occupant[y][x] = curobj;
if (curobj->image != ' ' &&
(curobj->velx || curobj->vely ||
curobj->type == Torp || curobj->type == Web) ) {
mvaddc(y+1, x*2, curobj->image);
}
if (curobj->type == Crusher && curobj->velx) {
blast[y][x] += 100000;
yblasted[y] |= 1;
xblasted[x] |= 1;
blasted = TRUE;
}
}
}
if (blasted) {
Reg7 int minxblast = -1;
Reg8 int maxxblast = -2;
Reg5 long tmpblast;
blasted = numamoebas;
for (x=0; x<XSIZE; x++) {
if (xblasted[x]) {
xblasted[x] = 0;
maxxblast = x;
if (minxblast < 0)
minxblast = x;
}
}
for (y=0; y<YSIZE; y++) {
if (yblasted[y]) {
yblasted[y] = 0;
for (x=minxblast; x<=maxxblast; x++) {
tmpblast = blast[y][x];
if (numamoebas && amb[y][x] == '~') {
if (temp = occupant[y][x]) {
if (temp->image == '&')
tmpblast >>= 1;
else if (temp->type == Web)
tmpblast = 100000;
else
tmpblast += 50 + temp->energy/100;
if (tmpblast > 250 && !rand_mod(5+(inumstars>>4)))
modify_amoeba(y,x,1,'~',5);
}
xblasted[x] = 2;
yblasted[y] = 2;
}
if (tmpblast) {
Reg6 OBJECT *biggie = 0;
blast[y][x] = 0;
temp = occupant[y][x];
if (tmpblast < 0) {
if (numamoebas && tmpblast < -1000000 &&
amb[y][x] == '~' && temp != nuke) {
amb[y][x] = ' ';
if (!temp)
make_plink(y,x);
ambsize--;
}
tmpblast = 0;
}
if (temp) {
if ((!numamoebas || amb[y][x]==' ') &&
tmpblast < 100000)
make_plink(y,x);
for ( ;temp;
temp = curobj->contend,curobj->contend = 0){
curobj = temp;
switch (curobj->type) {
case Enterprise: {
long tmp = curobj->energy;
if (ent->energy>500 || apolloflag & 1)
curobj->energy -= tmpblast /
((apolloflag & 1)
? 20
: (5+abs(ent->velx)+abs(ent->vely))
/ ((damflag[NOSHIELDS]>>3)+1)+1);
else
curobj->energy -= tmpblast;
if (rand_mod(1 + tmp - curobj->energy) > 100
|| ent->energy < (entmax>>1)) {
if (debug & 128 ||
(damage <= smarts/10 &&
!rand_mod(6-smarts/20-massacre) )) {
tmp = rand_mod(MAXDAMAGE);
if (damflag[tmp]) {
if (damflag[tmp] < 60)
damflag[tmp] += rand_mod(60);
}
else {
damflag[tmp] =
rand_mod(smarts+10)+2;
damage++;
}
}
}
break;
}
case Base:
if (base->energy > 1000 || apolloflag & 2)
curobj->energy -= tmpblast /
((apolloflag & 2)?20:5);
else
curobj->energy -= tmpblast;
break;
case Crusher:
if (tmpblast > 132767)
curobj->energy -= (tmpblast - 100000);
else if (tmpblast >= 100000) {
curobj->energy += (tmpblast - 100000);
if (curobj->energy > 32767)
curobj->energy = 32767;
}
else /* vulnerable while feeding */
curobj->energy -= tmpblast;
break;
case Enemy:
curobj->energy -= tmpblast*10/enemshields;
break;
default:
curobj->energy -= tmpblast;
break;
}
if (curobj->energy < 0) { /* killed it? */
switch (curobj->image) {
case 'A':
tmpblast = 100000;
make_blast(y,x,8192L,1);
numapollos = apolloflag = 0;
numstars--;
numenemies--;
curscore += 5000;
deados = 0;
break;
case 'E': case 'e': case 'C': case 'c':
ent = 0;
numents--;
if (base)
status = 2;
else
status = 3;
deados = 0;
break;
case 'B': case 'b':
base = 0;
numbases--;
if (ent)
status = entmode;
else
status = 3;
deados = 0;
break;
case '&': {
int i, xxx, yyy;
for (i = 0; i < YSIZE; i++)
yblasted[i] &= 1;
for (i = 0; i < XSIZE; i++)
xblasted[i] &= 1;
numamoebas = 0; /* ignore amb[][] now */
for (yyy = 0; yyy < YSIZE; yyy++) {
for (xxx = 0; xxx < XSIZE; xxx++) {
if (amb[yyy][xxx] == '~' &&
!occupant[yyy][xxx]) {
mvaddch(yyy+1,xxx*2,' ');
}
}
}
numenemies--;
curscore += 10000;
if (curobj == enemies)
enemies = curobj->next;
deados = 0;
break;
}
case '<': case '>': {
int i;
numenemies--;
numcrushes = 0;
curscore += 10000;
if (curobj == movers)
movers = curobj->next;
if (curobj == enemies)
enemies = curobj->next;
deados = 0;
tmpblast = 100000;
make_blast(y,(x+XSIZE00)%XSIZE,10000L,0);
if (curobj->image == '<') {
for (i=XSIZE00; i<=XSIZE01; i++)
make_blast(y,(x+i)%XSIZE,
10000L,0);
for (i=XSIZE00; i<=XSIZE02; i++)
make_blast(y,(x+i)%XSIZE,
10000L,0);
make_blast(y,(x+XSIZE03)%XSIZE,
10000L,1);
for (i=XSIZE00; i<=XSIZE08; i++)
make_blast(y,(x+i)%XSIZE,
10000L,0);
}
else {
for (i=XSIZE00; i>=XSIZE99; i--)
make_blast(y,(x+i)%XSIZE,
10000L,0);
for (i=XSIZE00; i>=XSIZE98; i--)
make_blast(y,(x+i)%XSIZE,
10000L,0);
make_blast(y,(x+XSIZE97)%XSIZE,
10000L,1);
for (i=XSIZE00; i>=XSIZE92; i--)
make_blast(y,(x+i)%XSIZE,
10000L,0);
}
}
break;
case 'K':
numenemies--;
curscore += curobj->mass;
if (curobj == enemies)
enemies = curobj->next;
deados = 0;
break;
case 'T':
numenemies--;
curscore += curobj->mass*3/2;
if (curobj == enemies)
enemies = curobj->next;
deados = 0;
break;
case 'R': case ' ': case 'P':
numenemies--;
if (curobj->flags & PIRATE)
curscore += curobj->mass;
else
curscore += curobj->mass*3;
if (curobj == enemies)
enemies = curobj->next;
deados = 0;
break;
case 'G':
numenemies--;
numgorns--;
tmpblast = 100000;
if (madgorns)
curscore += curobj->mass/2;
else
curscore += curobj->mass*2;
if (curobj == enemies)
enemies = curobj->next;
{
int xxx,yyy;
for (xxx = -1; xxx<=1; xxx++)
for (yyy = -1; yyy<=1; yyy++)
if (rand_mod(2+massacre))
fire_torp(curobj,
yyy,xxx);
}
deados = 0;
break;
case '@':
numinhab--;
/* FALL THROUGH */
case '*':
banging = TRUE;
numstars--;
break;
case '|': case '-': case '/': case '\\':
tmpblast = 100000;
make_blast(y,x,curobj->mass,1);
banging = TRUE;
deados = 0;
break;
case 'x':
curscore += 10;
deados = 0;
break;
case 'X':
curscore += 100;
numxes--;
deados = 0;
break;
case '0':
curscore += 35;
numos--;
deados += 3;
break;
case 'o':
curscore += 100;
numos--;
deados++;
break;
case 'O':
curscore += 200;
numos--;
deados += 2;
break;
case 'M':
deadmudds++;
inumfriends--;
numfriends--;
if (curobj == enemies)
enemies = curobj->next;
break;
case 'Q': case 'W': case 'Y': case 'U':
case 'I': case 'S': case 'D': case 'H':
case 'J': case 'L': case 'Z': case 'V':
case 'F':
numfriends--;
if (curobj == enemies)
enemies = curobj->next;
if (inumfriends < 10)
madfriends += 500;
else
madfriends += 10000/inumfriends;
break;
}
if (tmpblast < 100000)
make_blast(y,x,curobj->mass,1);
unmake_object(curobj);
}
else { /* didn't kill anything */
if (!biggie)
biggie = curobj;
else {
if (biggie->mass > curobj->mass)
bounce(curobj);
else {
bounce(biggie);
biggie = curobj;
}
}
}
}
if (biggie) {
occupant[y][x] = biggie;
if (numamoebas && biggie->image == ' ')
mvaddch(y+1,x*2, amb[y][x]);
else
mvaddch(y+1,x*2, biggie->image);
}
else {
occupant[y][x] = 0;
mvaddch(y+1, x*2, numamoebas ? amb[y][x] : ' ');
}
}
}
}
}
}
}
do_bangs();
if (numcrushes && movers->type == Crusher)
movers->vely = 0;
if (curobj = base) {
char ch;
curobj->velx = 0;
curobj->vely = 0;
curobj->energy += 25*lookaround(curobj->posy,curobj->posx,Star);
if (curobj->energy > basemax)
curobj->energy = basemax;
if (curobj->energy >= 1000)
ch = 'B';
else
ch = 'b';
if (ch != curobj->image) {
setimage(curobj, ch);
}
}
if (curobj = ent) {
char ch;
if (entmode == 0) {
curobj->velx = 0;
curobj->vely = 0;
}
if (base && !cloaking && !curobj->velx && !curobj->vely &&
lookfor(curobj->posy,curobj->posx,Base)) {
int tmp;
#ifdef lint
tmp = 0;
#else
tmp = (int) (base->energy - 1000 < entmax - curobj->energy ?
base->energy - 1000 : entmax - curobj->energy);
#endif
if (tmp < 0)
tmp = 0;
curobj->energy += tmp;
base->energy -= tmp;
tmp = (btorp < 50 - etorp ?
btorp : 50 - etorp);
etorp += tmp;
btorp -= tmp;
if (damage) {
tmp = rand_mod(MAXDAMAGE);
if (damflag[tmp] > 5) {
damflag[tmp] = rand_mod(5)+1;
}
}
}
if (curobj->energy >= 500 && (!damage || !damflag[NOSHIELDS]))
ch = cloaked?'C':'E';
else
ch = cloaked?'c':'e';
if (ch != curobj->image) {
setimage(curobj, ch);
}
}
}
int
lookaround(y, x, what)
Reg1 int y;
Reg2 int x;
Reg4 char what;
{
Reg3 OBJECT *obj;
Reg5 int count=0;
Reg6 int xp;
Reg7 int xm;
if ((obj=occupant[y][xp=(x+XSIZE01)%XSIZE])&&obj->type == what) /* 0, 1 */
count++;
if ((obj=occupant[y][xm=(x+XSIZE99)%XSIZE])&&obj->type == what) /* 0, -1 */
count++;
if ((obj=occupant[y=(y+YSIZE99)%YSIZE][xp])&&obj->type == what) /* -1, 1 */
count++;
if ((obj=occupant[y][x])&&obj->type == what) /* -1, 0 */
count++;
if ((obj=occupant[y][xm])&&obj->type == what) /* -1, -1 */
count++;
if ((obj=occupant[y=(y+2)%YSIZE][xp])&&obj->type == what) /* 1, 1 */
count++;
if ((obj=occupant[y][x])&&obj->type == what) /* 1, 0 */
count++;
if ((obj=occupant[y][xm])&&obj->type == what) /* 1, -1 */
count++;
return (count);
}
int
lookfor(y, x, what)
Reg1 int y;
Reg2 int x;
Reg4 char what;
{
Reg3 OBJECT *obj;
Reg5 int xp;
Reg6 int xm;
if ((obj=occupant[y][xp=(x+XSIZE01)%XSIZE])&&obj->type == what ||/* 0, 1 */
(obj=occupant[y][xm=(x+XSIZE99)%XSIZE])&&obj->type == what ||/* 0, -1 */
(obj=occupant[y=(y+YSIZE99)%YSIZE][xp])&&obj->type == what ||/* -1, 1 */
(obj=occupant[y][x])&&obj->type == what ||/* -1, 0 */
(obj=occupant[y][xm])&&obj->type == what ||/* -1,-1 */
(obj=occupant[y=(y+2)%YSIZE][xp])&&obj->type == what ||/* 1, 1 */
(obj=occupant[y][x])&&obj->type == what ||/* 1, 0 */
(obj=occupant[y][xm])&&obj->type == what) /* 1, -1 */
return(1);
return (0);
}
OBJECT*
lookimg(y, x, what)
Reg1 int y;
Reg2 int x;
Reg4 char what;
{
Reg3 OBJECT *obj;
Reg5 int xp;
Reg6 int xm;
if ((obj=occupant[y][xp=(x+XSIZE01)%XSIZE])&&obj->image==what ||/* 0, 1 */
(obj=occupant[y][xm=(x+XSIZE99)%XSIZE])&&obj->image==what ||/* 0, -1 */
(obj=occupant[y=(y+YSIZE99)%YSIZE][xp])&&obj->image==what ||/* -1, 1 */
(obj=occupant[y][x])&&obj->image==what ||/* -1, 0 */
(obj=occupant[y][xm])&&obj->image==what ||/* -1,-1 */
(obj=occupant[y=(y+2)%YSIZE][xp])&&obj->image==what ||/* 1, 1 */
(obj=occupant[y][x])&&obj->image==what ||/* 1, 0 */
(obj=occupant[y][xm])&&obj->image==what) /* 1, -1 */
return obj;
return Null(OBJECT*);
}
(obj=occupant[y=(y+YSIZE99)%YSIZE][xp])&&obj->image==what ||/* -1, 1 */
(obj=occupant[y][x])&&obj->image==what ||/* -1, 0 */
(obj=occupant[y][xm])&&obj->image==what ||/* -1,-1 */
(obj=occupant[y=(y+2)%YSIZE][xp])&&obj->image==what ||/* 1, 1 */
(obj=warp/weapon.c 644 171 5 40211 5121750024 6503 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.2 86/10/20 14:36:33 lwall
* Picked some lint.
*
* Revision 7.0.1.1 86/10/16 10:54:42 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:18:08 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "bang.h"
#include "object.h"
#include "move.h"
#include "score.h"
#include "sig.h"
#include "term.h"
#include "them.h"
#include "us.h"
#include "util.h"
#include "INTERN.h"
#include "weapon.h"
void
weapon_init()
{
;
}
void
fire_torp(from, ydir, xdir)
Reg1 OBJECT *from;
Reg3 int ydir;
Reg4 int xdir;
{
Reg2 OBJECT *to;
if (from->type == Enemy ||
(from == ent && etorp > 0) ||
(from == base && btorp > 0)) {
to = occupant[(from->posy+from->vely+ydir+YSIZE00)%YSIZE]
[(from->posx+from->velx+xdir+XSIZE00)%XSIZE];
if (from->type != Enemy || !to || to->vely || to->velx) {
if (from->type != Enemy &&
(to = isatorp[from==base][ydir+1][xdir+1])) {
to->vely += ydir;
to->velx += xdir;
}
else {
if (from == ent) {
to = make_object(Torp, '+', from->posy,from->posx,
from->vely+ydir,from->velx+xdir, 0L, 1L,&root);
aretorps++;
isatorp[0][ydir+1][xdir+1] = to;
etorp--;
}
else if (from == base) {
to = make_object(Torp, '+', from->posy,from->posx,
from->vely+ydir,from->velx+xdir, 0L, 1L,&root);
aretorps++;
isatorp[1][ydir+1][xdir+1] = to;
btorp--;
}
else if (from->image == 'G') {
numos++;
to = make_object(Torp, 'o', from->posy,from->posx,
from->vely+ydir,from->velx+xdir, 100L, 1L,&root);
if (madgorns) {
possiblescore += 35;
to->image = '0';
to->mass = 2000;
to->energy = 2000;
}
else if (rand_mod(120)+10 > smarts)
possiblescore += 100;
else {
possiblescore += 200;
to->image = 'O';
}
}
else {
to = make_object(Torp, 'x', from->posy,from->posx,
from->vely+ydir,from->velx+xdir, 0L, 1L,&root);
if (rand_mod(160)+10 > smarts)
possiblescore += 10;
else {
possiblescore += 100;
to->image = 'X';
to->mass = 1000+super*20;
numxes++;
}
}
}
}
}
}
void
attack(attackee)
Reg7 OBJECT *attackee;
{
Reg1 int dx;
Reg2 int dy;
Reg3 int curx;
Reg4 int cury;
Reg5 int prob;
Reg6 OBJECT *obj;
Reg8 bool torps;
Reg9 bool webnear = FALSE;
Reg10 bool thru_stars;
int nukey;
int nukex;
int nukedist;
if (attackee) {
if (attackee == nuke) {
if (amb[attackee->posy][attackee->posx] != '~')
return;
nukey = nukex = 0;
nukedist = 100;
}
for (dx= -1; dx<=1 ; dx++) {
for (dy= -1; dy<=1; dy++) {
if (dx||dy) {
cury = attackee->posy;
curx = attackee->posx;
torps = thru_stars = FALSE;
if (massacre || madgorns || !rand_mod(53-super) )
webnear += rand_mod(2);
else
webnear = FALSE;
for (prob = scandist;prob;prob--) {
cury = (cury + dy + YSIZE00) % YSIZE;
curx = (curx + dx + XSIZE00) % XSIZE;
if (obj = occupant[cury][curx]) {
switch (obj->image) {
case 'P': case 'K': case 'R': case ' ':
pot_shot:
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
Tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
if (rand_mod(51 - sm50) <= prob) {
switch (obj->strategy||thru_stars?0:
rand_mod(ent?4:2)) {
case 1: case 2:
if (-dy + attackee->vely == obj->vely
&& -dx + attackee->velx == obj->velx)
fire_torp(obj,
-dy + attackee->vely,
-dx + attackee->velx);
else
fire_torp(obj,
-dy + attackee->vely - obj->vely,
-dx + attackee->velx - obj->velx);
if (obj->image == ' ')
setimage(obj,
obj->flags & PIRATE ? 'P' : 'R');
break;
case 3: {
int newspeed =
rand_mod(prob<5&&smarts>70?4:3)-1;
obj->vely = -dy * newspeed;
obj->velx = -dx * newspeed;
if (newspeed >= 0 &&
!rand_mod(82-sm80)) {
obj->vely += attackee->vely;
obj->velx += attackee->velx;
}
break;
}
case 0:
if (!torps && obj->energy > 1000) {
fire_phaser(obj, -dy, -dx);
if (smarts > 40 &&
(scandist-prob > 5
|| attackee==base) &&
(massacre || obj->strategy ||
rand_mod(2)))
while (rand_mod(2))
fire_phaser(obj, -dy, -dx);
if (obj->image == ' ')
setimage(obj,
obj->flags&PIRATE ? 'P':'R');
}
if (obj->strategy) {
obj->velx = obj->vely = 0;
if (obj->energy < 1000 ||
bvely || bvelx)
obj->strategy = 0;
}
else if ((attackee==base ||
(cloaking && attackee==ent)
) &&
scandist-prob > 5 &&
!(rand_mod(
ent?antibase*2:antibase)) )
obj->strategy = 1;
break;
}
}
goto bombout;
case 'G':
if (thru_stars && obj->strategy < 7)
goto bombout;
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
Tract(nuke,dy,dx,rand_mod(3)?1:-1);
goto bombout;
}
if (obj->strategy) {
if (madgorns || !rand_mod(4)) {
obj->vely = attackee->vely;
obj->velx = attackee->velx;
}
obj->strategy += (!torps && deados > 10);
if (obj->strategy > 4)
madgorns = TRUE;
if (!torps && obj->strategy > 5) {
do {
fire_phaser(obj, -dy, -dx);
} while (rand_mod(2));
}
}
else if (numgorns >= numenemies-1 &&
deados > 15+numgorns*5)
obj->strategy = 1;
if (madgorns || rand_mod(51 - sm50) <= prob) {
if (-dy + attackee->vely == obj->vely
&& -dx + attackee->velx == obj->velx)
fire_torp(obj,
-dy + attackee->vely,
-dx + attackee->velx);
else
fire_torp(obj,
-dy + attackee->vely - obj->vely,
-dx + attackee->velx - obj->velx);
}
goto bombout;
case 'T':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
Tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
if (thru_stars)
goto bombout;
if (webnear && scandist-prob > 5) {
if (massacre || rand_mod(50) < super) {
if (!torps && obj->energy > 1000) {
fire_phaser(obj, -dy, -dx);
while (!rand_mod(57-sm55))
fire_phaser(obj, -dy, -dx);
}
}
}
goto bombout;
case 'C': case 'c':
if (thru_stars)
goto bombout;
break;
case 'Q': case 'W': case 'Y': case 'U':
case 'I': case 'S': case 'D': case 'H': case 'J':
case 'L': case 'Z': case 'V': case 'M': case 'F':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
Tract(nuke,dy,dx,rand_mod(3)?1:-1);
if (rand_mod(2))
goto pot_shot;
}
if (madfriends > 1000) {
madfriends -= 200;
goto pot_shot;
}
/* FALL THROUGH */
case '+':
if (attackee == nuke) {
if (smarts > 70) {
if (
(obj->posx + obj->velx + XSIZE00)%XSIZE
== attackee->posx &&
(obj->posy + obj->vely + YSIZE00)%YSIZE
== attackee->posy ) {
Tract(nuke,dy,dx,-1);
}
else
while (!rand_mod(82-sm80))
Tract(nuke,dy,dx,-1);
}
else if (smarts > 60 ||
rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1))
Tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
torps = FALSE;
thru_stars = FALSE;
break;
case '|': case '-': case '/': case '\\':
if (thru_stars)
goto bombout;
webnear = (scandist-prob < 3);
torps = FALSE;
break;
case 'x':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1))
Tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
if (thru_stars)
goto bombout;
torps = TRUE;
break;
case 'o': case 'O': case '0':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1))
Tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
if (thru_stars)
goto bombout;
torps = TRUE;
if (rand_mod(99+3*scandist) < smarts+3*prob) {
obj->vely = -dy + attackee->vely;
obj->velx = -dx + attackee->velx;
if (obj->flags & STATIC) {/* not a mover? */
obj->flags &= ~STATIC;
obj->prev->next = obj->next;
obj->next->prev = obj->prev;
root.prev->next = obj;
obj->prev = root.prev;
root.prev = obj;
obj->next = &root;
}
}
if (obj->image != '0')
break;
/* DROP THROUGH! */
case 'X':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1))
Tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
torps = TRUE;
if (thru_stars)
goto bombout;
if (prob == scandist) {
int y, x;
blast[y=(obj->posy+obj->vely+YSIZE00)%YSIZE]
[x=(obj->posx+obj->velx+XSIZE00)%XSIZE]
+= (obj->image == '0' ? 2000 : 200);
yblasted[y] |= 1;
xblasted[x] |= 1;
blasted = TRUE;
}
break;
case 'A':
if (attackee != nuke) {
if (scandist-prob>1 && !rand_mod(51-super))
Tract(obj,-dy,-dx,1);
}
/* FALL THROUGH */
case '*': case '@':
if (attackee == nuke) {
if (amb[cury][curx] != '~') {
if (scandist-prob < nukedist) {
nukedist = scandist-prob;
nukey = dy; /* nearest food in */
nukex = dx; /* this direction */
}
if (smarts > 55 && scandist-prob > 8) {
if (rand_mod(30+scandist-prob) <
rand_mod(smarts/20+1))
Tract(nuke,dy,dx,1);
}
}
else if (obj->vely || obj->velx) {
Tract(nuke,dy,dx,1); /* for looks */
obj->vely = obj->velx = 0;
}
}
if (!thru_stars)
if (rand_mod(97-sm95))
goto bombout;
else
thru_stars = TRUE;
break;
case '<': case '>':
if (attackee == nuke) {
if ((!dy && scandist-prob < 8) ||
rand_mod(2+scandist-prob) <
rand_mod(smarts/20+1) ) {
nuke->mass += 10000;
Tract(nuke,dy,dx,-1);
nuke->mass -= 10000;
}
}
goto bombout;
case 'E': case 'B':
if (attackee == nuke) {
if (rand_mod(2+scandist-prob) <
rand_mod(smarts/40+1))
Tract(nuke,dy,dx,rand_mod(3)?1:-1);
}
goto bombout;
default:
goto bombout;
}
}
else {
if (thru_stars)
goto bombout;
}
}
bombout: ; /* end of loop */
}
}
}
if (attackee == nuke && nukedist < 100) {/* aim amoeba at nearest */
if (nukey < 0) /* free star */
nukey = 2;
if (nukex < 0)
nukex = 2;
nuke->strategy = nukey + (nukex << 2);
}
}
}
void
fire_phaser(obj, dy, dx)
Reg7 OBJECT *obj;
Reg5 int dy;
Reg6 int dx;
{
Reg1 int y;
Reg2 int x;
Reg3 int skipping;
Reg4 int size=5000;
int decr = 50, oldy, oldx;
static char curchar[] = "@* ";
if (obj == ent)
decr = 100;
else if (obj == base) {
decr = 1000;
size = 200;
}
if (!dy)
curchar[2] = '-';
else if (!dx)
curchar[2] = '!';
else if (dy == dx)
curchar[2] = '\\';
else
curchar[2] = '/';
if (obj->energy >= decr) {
obj->energy -= decr;
for (
/* initialize */
skipping = (obj != base),
y = (obj->posy+(obj==base?dy*2:dy)+YSIZE00)%YSIZE,
x = (obj->posx+(obj==base?dx*2:dx)+XSIZE00)%XSIZE;
/* while */
size && (!occupant[y][x]||(skipping && occupant[y][x]->type==Star));
/* at end of loop */
y = (y+dy+YSIZE00) % YSIZE,
x = (x+dx+XSIZE00) % XSIZE,
size = size * 3 / 4 ) {
move(y+1,x*2,0);
beg_qwrite();
if (obj == base || obj->image == 'T') {
*filler = '@';
qwrite();
*filler = '#';
qwrite();
*filler = '~';
qwrite();
*filler = '%';
qwrite();
*filler = ':';
qwrite();
*filler = '@';
}
else {
*filler = size >= 500 ?
*curchar : (size >= 50 ?
curchar[1] :
curchar[2]);
}
qwrite();
if (occupant[y][x])
qaddc(occupant[y][x]->image);
else {
if (numamoebas)
qaddc(amb[y][x]);
else
qaddspace();
if (skipping)
skipping = 0;
}
end_qwrite();
}
if (size) {
char img;
assert(occupant[y][x]);
img = occupant[y][x]->image;
if (occupant[y][x]->type == Crusher) {
if (dy)
return;
if (dx==(img == '<' ? 1 : -1) ) {
occupant[y][x]->image =
(occupant[y][x]->velx *= -1) < 0 ? '>' : '<';
return;
}
}
else if (occupant[y][x]->flags & FRIENDLY)
madfriends += 200;
if (numamoebas && amb[y][x] == '~' && smarts % 3 &&
(smarts > 70 || rand_mod(smarts) > rand_mod(20)) ) {
if (size > 10000)
modify_amoeba(y,x,1,'~',10);
else if (size > 1000)
modify_amoeba(y,x,1,'~',7);
else if (size > 50)
modify_amoeba(y,x,1,'~',5);
else
modify_amoeba(y,x,1,'~',2);
if (occupant[y][x] == nuke) {
nuke->strategy = rand_mod(30);
nuke->flags |= COUNTDOWN;
}
return;
}
else {
move(y+1,x*2,0);
beg_qwrite();
if (img == ' ') {
*filler = occupant[y][x]->flags & PIRATE ? 'P' : 'R';
occupant[y][x]->image = *filler;
occupant[y][x]->strategy = 0;
qwrite();
qwrite();
}
else if (img == 'C' || img == 'c') {
cloaked = 0;
img += 2;
occupant[y][x]->image = img;
*filler = img;
qwrite();
qwrite();
}
else if (img == 'K' && size > 50)
occupant[y][x]->strategy = 0;
*filler = '@';
qwrite();
*filler = '#';
qwrite();
*filler = '@';
qwrite();
*filler = '#';
qwrite();
*filler = '@';
qwrite();
qaddc(img);
end_qwrite();
oldy = y;
oldx = x;
y = (occupant[oldy][oldx]->posy + occupant[oldy][oldx]->vely +
YSIZE00) % YSIZE;
x = (occupant[oldy][oldx]->posx + occupant[oldy][oldx]->velx +
XSIZE00) % XSIZE;
if (occupant[y][x] && occupant[y][x]->type == Star) {
y = occupant[oldy][oldx]->posy;
x = occupant[oldy][oldx]->posx;
}
if (obj==base)
blast[y][x] += size>50 ? 15000 : (size>15 ? 1500 : 150);
else if (obj==ent)
blast[y][x] += size*4;
else if (obj->image=='T')
blast[y][x] += 15000;
else
blast[y][x] += size*smarts/25;
yblasted[y] |= 1;
xblasted[x] |= 1;
blasted = TRUE;
}
}
}
}
int
tract(obj, dy, dx, to_or_fro)
Reg7 OBJECT *obj;
Reg4 int dy;
Reg5 int dx;
int to_or_fro;
{
Reg1 int y;
Reg2 int x;
Reg3 int size=10;
static char ch;
Reg6 OBJECT *tractee;
if (!dy)
ch = '|';
else if (!dx)
ch = '-';
else if (dy == dx)
ch = '/';
else
ch = '\\';
{
for (
y = (obj->posy+dy+YSIZE00)%YSIZE,
x = (obj->posx+dx+XSIZE00)%XSIZE;
size && (!occupant[y][x]);
y = (y+dy+YSIZE00) % YSIZE, x = (x+dx+XSIZE00) % XSIZE, size--) {
move(y+1,x*2,0);
beg_qwrite();
*filler = ch;
qwrite();
qwrite();
if (numamoebas)
qaddch(amb[y][x]);
else
qaddspace();
end_qwrite();
}
tractee = occupant[y][x];
if (size) {
assert(tractee);
if (numamoebas && obj != nuke && amb[y][x] == '~') {
if (to_or_fro > 0)
modify_amoeba(y,x,2,'~',size);
else
modify_amoeba(y,x,1,' ',size);
}
if (tractee->type != Web &&
(tractee->mass < obj->mass * 5 ||
(tractee->type == Crusher && !dx) ) ) {
if (tractee == ent) {
evely -= dy * to_or_fro;
evelx -= dx * to_or_fro;
}
else if (tractee == base) {
bvely -= dy * to_or_fro;
bvelx -= dx * to_or_fro;
}
else {
tractee->vely -= dy * to_or_fro;
tractee->velx -= dx * to_or_fro;
}
if (tractee->type == Torp ||
tractee->type == Star) {
if (tractee->flags & STATIC) { /* not a mover? */
tractee->flags &= ~STATIC;
tractee->prev->next = tractee->next;
tractee->next->prev = tractee->prev;
root.prev->next = tractee;
tractee->prev = root.prev;
root.prev = tractee;
tractee->next = &root;
}
}
}
else if (tractee->type == Crusher && !dy &&
dx==(tractee->image == '<' ? 1 : -1) ) {
setimage(tractee, (tractee->velx *= -1) < 0 ? '>' : '<');
}
if (tractee->mass * 5 > obj->mass)
return(1);
}
}
return(0);
}
STATIC) { /* not a mover? */
tractee->flags &= ~STATIC;
tractee->prev->next = tractee->next;
tractee->next->prev = tractee->prev;
root.prev->next = tractee;
tractee->prev = root.prev;
root.prev = tractee;
tractee->next = &root;
}
}
}
else if (tractee->type == Crusher && !dy &&
dx==(tractee->image == '<' ? 1 : -1) ) {
setimagwarp/init.c 644 171 5 32736 5121750032 6171 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.4 86/12/12 16:58:03 lwall
* Baseline for net release.
*
* Revision 7.0.1.3 86/10/20 14:35:31 lwall
* Picked some lint.
*
* Revision 7.0.1.2 86/10/17 15:53:30 lwall
* Added random walk star fields.
*
* Revision 7.0.1.1 86/10/16 10:51:19 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:12:10 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "bang.h"
#include "object.h"
#include "move.h"
#include "play.h"
#include "score.h"
#include "term.h"
#include "them.h"
#include "us.h"
#include "util.h"
#include "weapon.h"
#include "INTERN.h"
#include "init.h"
void
initialize()
{
Reg1 int i;
Reg2 int x;
Reg3 int y;
Reg4 int dist;
Reg5 int ydist;
Reg6 int xdist;
long e;
int yoff, xoff, ypred, xpred;
Reg7 OBJECT *obj;
char ch;
FILE *mapfp = NULL;
bool tmptholspec;
int inhabjackpot;
long inhenergy;
int walksplit = 200;
static char *distname[] =
{" #"," -"," \\"," /",
" |"," *"," `"," '"};
cloaking = madgorns = FALSE;
deados = madfriends = 0;
curscore = possiblescore = 0L;
yamblast = xamblast = ambsize = 0;
if (smarts > 90)
massacre = TRUE;
scandist = (massacre?20:15);
antibase = (smarts>60?1:(smarts>40?2:(smarts>25?4:100)));
sm35 = (smarts>35?35:smarts);
sm45 = (smarts>45?45:smarts);
sm50 = (smarts>50?50:smarts);
sm55 = (smarts>55?55:smarts);
sm80 = (smarts>80?80:smarts);
sm95 = (smarts>95?95:smarts);
super = (smarts>50?smarts-50:0);
enemshields = 10 + super/2; /* (scaled by 10) 1 @ 50 .. 3 @ 90 */
if (smarts>90)
enemshields += (smarts-90)*10; /* lay it on thick: ~13 @ 99 */
entmax = (smarts>=75?5000:(smarts>=50?4000:(smarts>=40?3000:2000)));
basemax = (smarts>=75?20000:(smarts>=50?15000:(smarts>=40?12500:10000)));
clear();
while (root.next != &root) {
root.next = root.next->next;
free_object(root.next->prev);
}
root.prev = &root;
enemies = movers = NULL;
numos = numxes = 0;
#if defined(vax) && XYSIZEx4 == 3680
asm("movc5 $0,_occupant,$0,$3680,_occupant");
asm("movc5 $0,_blast,$0,$3680,_blast"); /* 3680 = XYSIZEx4 */
asm("movc5 $0,_amb,$32,$920,_amb");
#else
for (y=0;y<YSIZE;y++)
for (x=0;x<XSIZE;x++) {
occupant[y][x] = 0;
blast[y][x] = 0;
amb[y][x] = ' ';
}
#endif
for (y=0; y<YSIZE; y++)
yblasted[y] = 0;
for (x=0; x<XSIZE; x++)
xblasted[x] = 0;
blasted = FALSE;
if (!starspec)
if (smarts < 15)
inumstars = 50 + rand_mod(50);
else if (smarts < 50 || smarts > 85)
inumstars = exdis(800) + rand_mod(100) + 1;
else /* too few stars makes 50..85 too hard */
inumstars = exdis(700) + rand_mod(150-super*2) + 50+super*2;
tmptholspec = (smarts > 15 && inumstars < 450 && ! rand_mod(90-sm80));
if (!klingspec) {
inumenemies = rand_mod((smarts+1)/2) + 1;
if (massacre || tmptholspec)
inumenemies += 10;
}
if (!friendspec)
inumfriends = rand_mod(smarts/8+1);
if (!piratespec)
inumpirates = rand_mod(inumfriends/2+1);
if (inumfriends+inumenemies+inumstars > YSIZE*XSIZE-20)
inumstars = YSIZE*XSIZE-20 - inumenemies - inumfriends;
if (inumstars < 0) {
inumfriends += inumstars;
inumstars = 0;
}
if (inumfriends < 0) {
inumenemies += inumfriends;
inumfriends = 0;
}
if (inumenemies < 0)
inumenemies = 0;
numstars = inumstars;
inuminhab = numinhab = 0;
inumroms = inumthols = inumgorns = 0;
numapollos = apolspec || massacre ? 1 :
((!numstars || rand_mod(2) || smarts < 10) ? 0 : 1);
inumapollos = apolloflag = 0;
realapollo = NULL;
inumcrushes = numcrushes =
crushspec||massacre?1:(rand_mod(2000) < inumstars);
inumenemies += inumcrushes;
inumamoebas = numamoebas = (amoebaspec ? 1 :
!rand_mod(inumcrushes?3-massacre:8) ); /* < and & are fun together */
inumenemies += inumamoebas;
if (!rand_mod(40)) {
inhabjackpot = 32767;
inumfriends += rand_mod(10);
inumpirates += rand_mod(10);
}
else
inhabjackpot = inumpirates;
inhenergy = 30000-super*150;
if (!rand_mod(10))
inhenergy = 50000;
if (!rand_mod(4))
inhenergy += rand_mod(3500+super*150);
numfriends = inumfriends;
numpirates = inumpirates;
numenemies = inumenemies;
deadmudds = 0;
/* do stars */
stars_again:
if (prespec)
dist = 4;
else if (numstars > 750)
dist = 0;
else
dist = rand_mod(starspec||smarts<=5?3:5);
if (debugging) {
real_y = real_x = -100;
printf("\r\n");
}
switch (dist) {
case 0: /* uniform random */
ydist = xdist = 0;
if (inumstars < 700 && !rand_mod(3-(inumstars<50))) {
ydist = xdist = 6; /* well, maybe not so random */
y = rand_mod(YSIZE);
x = rand_mod(XSIZE);
if (rand_mod(2))
walksplit = inumstars/(exdis(40)+1);
}
if (debugging)
printf(" R\r\n");
break;
case 1: case 2: /* clumped, maybe skewed, maybe superposed */
ydist = rand_mod(4);
xdist = rand_mod(2);
if (debugging)
printf("%s\r\n",distname[ydist+4*xdist]);
yoff = rand_mod(YSIZE);
xoff = rand_mod(XSIZE);
if (dist == 2)
dist = numstars/2 + exdis(numstars/2) - exdis(numstars/2);
else
dist = 0;
break;
case 3: case 4: /* predefined or residual */
scenario_again:
if (debugging)
printf(" P\r\n");
dist = 0;
Sprintf(spbuf,"smap.%d",
(prescene>=0?prescene:rand_mod(MAPS)) );
if ((mapfp = fopen(spbuf,"r")) != NULL &&
fgets(spbuf,10,mapfp) != NULL ) {
inumstars = numstars = atoi(spbuf);
if (inumenemies+inumstars > YSIZE*XSIZE-20)
inumstars = numstars = YSIZE*XSIZE-20 - inumenemies;
ydist = rand_mod(2) + 4; /* flip y axis? */
xdist = rand_mod(2) + 4; /* flip x axis? */
yoff = rand_mod(YSIZE); /* how much to shift y */
xoff = rand_mod(XSIZE); /* how much to shift x */
}
else {
prespec = FALSE;
prescene = -1;
if (rand_mod(2))
goto scenario_again;
goto stars_again;
}
break;
}
for (i = 1; i <= numstars; i++) {
if (dist && i == dist) { /* flip to another skewing? */
ydist = rand_mod(4);
xdist = rand_mod(2);
if (!rand_mod(4)) {
ydist = xdist = 6;
if (debugging)
printf("&\r\n");
}
else if (debugging)
printf("%s\r\n",distname[ydist+4*xdist]);
yoff = rand_mod(YSIZE);
xoff = rand_mod(XSIZE);
dist = 0;
}
do { /* until an open spot found */
switch (xdist) {
case 0:
x = rand_mod(XSIZE); /* pick from 0..39, uniform */
break;
case 1: case 2: case 3:
#ifndef lint
x = (int)((((double)(myrand()-HALFRAND)) *
((double)(myrand()-HALFRAND))/RANDRAND)
* 20.0) + xoff; /* pick from -20..20, clumped */
#endif
break;
case 4:
if (fscanf(mapfp,"%d %d\n",&ypred,&xpred) == EOF)
ydist = xdist = 0;
x = xpred + xoff;
break;
case 5:
if (fscanf(mapfp,"%d %d\n",&ypred,&xpred) == EOF)
ydist = xdist = 0;
x = -xpred + xoff;
break;
case 6:
x += rand_mod(3) - 1;
break;
}
switch (ydist) {
case 0:
y = rand_mod(YSIZE);
break;
case 1:
#ifndef lint
y = (int)((((double)(myrand()-HALFRAND)) *
((double)(myrand()-HALFRAND))/RANDRAND)
* 12.0) + yoff; /* pick from -12..12, clumped */
#endif
break;
case 2:
#ifndef lint
y = (int)((((double)(myrand()-HALFRAND)) *
((double)(myrand()-HALFRAND))/RANDRAND)
* 12.0) + yoff + x*YSIZE/XSIZE;
/* clumped & skewed */
#endif
break;
case 3:
#ifndef lint
y = (int)((((double)(myrand()-HALFRAND)) *
((double)(myrand()-HALFRAND))/RANDRAND)
* 12.0) + yoff - x*YSIZE/XSIZE;
/* clumped & skewed */
#endif
break;
case 4:
y = ypred + yoff;
break;
case 5:
y = -ypred + yoff;
break;
case 6:
y += rand_mod(3) - 1;
#ifdef lint
walksplit = walksplit;
#endif
if (!rand_mod(walksplit)) {
y = rand_mod(YSIZE);
x = rand_mod(XSIZE);
}
break;
}
while (x<0) x += XSIZE00;
while (y<0) y += YSIZE00;
x %= XSIZE;
y %= YSIZE;
} while (occupant[y][x]);
e = rand_mod(32768);
if (--inhabjackpot > 0 || e >= inhenergy) {
ch = '@';
if (inhabjackpot && e < 10000)
e += 10000;
inuminhab = ++numinhab;
}
else {
ch = '*';
}
obj = make_object(Star,ch,y,x,0,0,e+rand_mod(super*100+1),e/4,&root);
obj->flags |= STATIC;
}
if (inumstars > 30 && inhabjackpot <= 0 &&
!rand_mod(3 - (inumstars > 400) - (inhenergy > 32768)) ) {
int initx;
int inity;
x = initx = obj->posx;
y = inity = obj->posy;
while (rand_mod(2) && inuminhab < inumstars/2) {
for (i=rand_mod(smarts)*2+20; i; i--) {
if ((obj = occupant[y][x]) && obj->image == '*') {
setimage(obj,'@');
if (obj->energy < 10000)
obj->energy += 20000; /* the benefits of civilization */
inuminhab = ++numinhab;
}
if (i&15) {
y = (y + rand_mod(3) + YSIZE99) % YSIZE;
x = (x + rand_mod(3) + XSIZE99) % XSIZE;
}
else { /* don't wander too far */
y = inity;
x = initx;
}
}
x = initx = rand_mod(XSIZE);
y = inity = rand_mod(YSIZE);
}
}
if (mapfp != NULL)
Fclose(mapfp);
if (numcrushes) {
do {
x = rand_mod(XSIZE);
y = rand_mod(YSIZE);
} while (occupant[y][x]);
movers = make_object(Crusher,'<',y,x,0,1,32767L,32768L,&root);
possiblescore += 10000;
}
ient = (numents != 0);
if (ient) {
do {
x = rand_mod(XSIZE);
y = rand_mod(YSIZE);
} while (occupant[y][x]);
e = entmax;
ent = make_object(Enterprise,'E',y,x,0,0,e,e/2,&root);
if (!movers)
movers = ent;
}
ibase = (numbases != 0);
if (ibase) {
e = 52-super;
do {
x = rand_mod(XSIZE);
y = rand_mod(YSIZE);
} while (occupant[y][x] || lookaround(y,x,Star) * 7 < e--);
e = basemax;
base = make_object(Base, 'B',y,x,0,0,e,e/4,&root);
if (!movers)
movers = base;
}
if (numamoebas) {
do {
x = rand_mod(XSIZE);
y = rand_mod(YSIZE);
} while (occupant[y][x]);
nuke = make_object(Enemy,'&',y,x,0,0,32767L,
(long)entmax+entmax+rand_mod(entmax),&root);
possiblescore += 10000;
amb[y][x] = '~';
if (rand_mod(2))
modify_amoeba(y,x,2,'~',(int)rand_mod(smarts<<1));/* just make blob */
else {
for (i=smarts/10+1; i; i--) {
nuke->strategy = rand_mod(256); /* random direction */
modify_amoeba(y,x,2,'~',(int)rand_mod(5));
modify_amoeba(y,x,2,'~',(int)rand_mod(5));
modify_amoeba(y,x,2,'~',(int)rand_mod(5));
modify_amoeba(y,x,2,'~',(int)rand_mod(5)); /* extend pseudopod */
}
}
if (!enemies)
enemies = nuke;
if (!movers)
movers = nuke;
}
if (rand_mod(27-sm50/2) && !romspec && !gornspec)
dist = 27-sm50/2;
else
dist = rand_mod(4) + 1;
for (i = 1+inumcrushes+inumamoebas; i <= numenemies; i++) {
do {
x = rand_mod(XSIZE);
y = rand_mod(YSIZE);
} while (occupant[y][x]);
if (rand_mod(dist)) {
if (!tholspec && !tmptholspec && rand_mod((inumstars*3)/sm50+2))
ch = 'K';
else {
ch = 'T';
inumthols++;
}
}
else {
if (romspec == gornspec)
e = 50;
else if (gornspec)
e = 10;
else
e = 90;
if (rand_mod(100) < e) {
ch = 'R';
inumroms++;
}
else {
ch = 'G';
inumgorns++;
}
}
if (possiblescore > ENTBOUNDARY - 10000)
e = (ENTBOUNDARY - possiblescore) / 5;
else
e = 250 + (sm50-1) * 30 * 20 / numenemies+1;
#ifndef lint
e = exdis((int)e) + e - exdis((int)e);
obj = make_object(Enemy,ch,y,x,0,0,
e + rand_mod(super*200+2) + 10000*massacre,e/4,&root);
#endif
e /= 4;
switch (ch) {
case 'K':
possiblescore += e;
break;
case 'T':
possiblescore += e*3/2;
break;
case 'G':
possiblescore += e*2;
break;
case 'R':
possiblescore += e*3;
obj->flags |= CLOAKS;
break;
}
if (!enemies)
enemies = obj;
if (!movers)
movers = obj;
}
numgorns = inumgorns;
for (i=0; i<numfriends; i++) {
do {
x = rand_mod(XSIZE);
y = rand_mod(YSIZE);
} while (occupant[y][x]);
e = 250 + (sm50-1) * 30 * 20 / numenemies+1;
#ifndef lint
e = exdis((int)e) + e - exdis((int)e);
#endif
{
static char let[] = "QWYUISDHJLZVMFFFFFFFFF";
dist = rand_mod(20);
ch = let[dist];
} /* grr, venix doesn't like indexing into string */
obj = make_object(Enemy,ch,y,x,0,0,
e + rand_mod(super*200+2),e/4,&root);
if (numpirates-- > 0) {
obj->flags |= PIRATE;
if (smarts >= 20 && !rand_mod(10-smarts/10))
obj->flags |= CLOAKS;
}
obj->flags |= FRIENDLY;
if (!enemies)
enemies = obj;
if (!movers)
movers = obj;
}
if (!movers)
movers = &root;
if (!enemies)
enemies = &root;
if (ent)
mvaddch(ent->posy+1, ent->posx*2, ent->image);
if (base)
mvaddch(base->posy+1, base->posx*2, base->image);
sleep(2);
{
Reg7 OBJECT *curobj;
for (curobj = root.next; curobj != &root; curobj = curobj->next) {
mvaddch(curobj->posy+1, curobj->posx*2, curobj->image);
}
}
for (i=0;i<2;i++) for (y=0;y<3;y++) for (x=0;x<3;x++)
isatorp[i][y][x]=0;
whenok = 0;
timer = 0;
finish = 0;
bombed_out = FALSE;
if (ent)
entmode = status = 0;
else
if (base)
status = 2;
else
status = 3;
Sprintf(spbuf,
"%-4s E: %4d %2d B: %5d %3d Enemies: %-3d Stars: %-3d Stardate%5d.%1d %9ld",
" ", 0, 0, 0, 0, 0, 0, smarts * 100, 0, 0L);
mvaddstr(0,0,spbuf);
oldeenergy = oldbenergy = oldcurscore =
oldstatus = oldetorp = oldbtorp = oldstrs = oldenemies = -1;
/* force everything to fill in */
damage = olddamage = 0;
for (i=0; i<MAXDAMAGE; i++)
damflag[i] = 0;
btorp = 500;
etorp = 50;
}
ode = status = 0;
else
if (bawarp/intrp.c 644 171 5 33764 5121750045 6370 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
*
* $Log: warp9.tar,v $
* Revision 1.1.1.1 2019/05/29 04:56:34 root
* coherent
*
* Revision 7.0.1.2 86/12/12 16:59:04 lwall
* Baseline for net release.
*
* Revision 7.0.1.1 86/10/16 10:51:43 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:12:19 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "sig.h"
#include "util.h"
#include "term.h"
#include "INTERN.h"
#include "intrp.h"
/* name of this host */
#ifdef GETHOSTNAME
char *hostname;
# undef HOSTNAME
# define HOSTNAME hostname
#else /* !GETHOSTNAME */
# ifdef DOUNAME
# include <sys/utsname.h>
struct utsname uts;
# undef HOSTNAME
# define HOSTNAME uts.nodename
# else /* !DOUNAME */
# ifdef PHOSTNAME
char *hostname;
# undef HOSTNAME
# define HOSTNAME hostname
# else /* !PHOSTNAME */
# ifdef WHOAMI
# undef HOSTNAME
# define HOSTNAME sysname
# endif /* WHOAMI */
# endif /* PHOSTNAME */
# endif /* DOUNAME */
#endif /* GETHOSTNAME */
#ifdef TILDENAME
static char *tildename = Nullch;
static char *tildedir = Nullch;
#endif
char *dointerp();
char *getrealname();
#ifdef CONDSUB
char *skipinterp();
#endif
static void abort_interp();
void
intrp_init(tcbuf)
char *tcbuf;
{
char *getlogin();
/* get environmental stuff */
/* get home directory */
homedir = getenv("HOME");
if (homedir == Nullch)
homedir = getenv("LOGDIR");
dotdir = getval("DOTDIR",homedir);
/* get login name */
logname = getenv("USER");
if (logname == Nullch)
logname = getenv("LOGNAME");
#ifdef GETLOGIN
if (logname == Nullch)
logname = savestr(getlogin());
#endif
/* get the real name of the person (%N) */
/* Must be done after logname is read in because BERKNAMES uses that */
strcpy(tcbuf,getrealname(getuid()));
realname = savestr(tcbuf);
/* name of this host (%H) */
#ifdef GETHOSTNAME
gethostname(buf,sizeof buf);
hostname = savestr(buf);
#else
#ifdef DOUNAME
/* get sysname */
uname(&uts);
#else
#ifdef PHOSTNAME
{
FILE *popen();
FILE *pipefp = popen(PHOSTNAME,"r");
if (pipefp == Nullfp) {
printf("Can't find hostname\r\n");
sig_catcher(0);
}
Fgets(buf,sizeof buf,pipefp);
buf[strlen(buf)-1] = '\0'; /* wipe out newline */
hostname = savestr(buf);
pclose(pipefp);
}
#endif
#endif
#endif
if (index(HOSTNAME,'.'))
hostname = savestr(HOSTNAME);
else {
char hname[128];
strcpy(hname,HOSTNAME);
strcat(hname,MYDOMAIN);
hostname=savestr(hname);
}
warplib = savestr(filexp(WARPLIB));
if (scorespec) /* that getwd below takes ~1/3 sec. */
return; /* and we do not need it for -s */
(void) getwd(tcbuf); /* find working directory name */
origdir = savestr(tcbuf); /* and remember it */
}
/* expand filename via %, ~, and $ interpretation */
/* returns pointer to static area */
/* Note that there is a 1-deep cache of ~name interpretation */
char *
filexp(s)
Reg1 char *s;
{
static char filename[CBUFLEN];
char scrbuf[CBUFLEN];
Reg2 char *d;
#ifdef DEBUGGING
if (debug & DEB_FILEXP)
printf("< %s\r\n",s);
#endif
interp(filename, (sizeof filename), s); /* interpret any % escapes */
#ifdef DEBUGGING
if (debug & DEB_FILEXP)
printf("%% %s\r\n",filename);
#endif
s = filename;
if (*s == '~') { /* does destination start with ~? */
if (!*(++s) || *s == '/') {
Sprintf(scrbuf,"%s%s",homedir,s);
/* swap $HOME for it */
#ifdef DEBUGGING
if (debug & DEB_FILEXP)
printf("~ %s\r\n",scrbuf);
#endif
strcpy(filename,scrbuf);
}
else {
#ifdef TILDENAME
for (d=scrbuf; isalnum(*s); s++,d++)
*d = *s;
*d = '\0';
if (tildedir && strEQ(tildename,scrbuf)) {
strcpy(scrbuf,tildedir);
strcat(scrbuf, s);
strcpy(filename, scrbuf);
#ifdef DEBUGGING
if (debug & DEB_FILEXP)
printf("r %s %s\r\n",tildename,tildedir);
#endif
}
else {
if (tildename) {
free(tildename);
free(tildedir);
}
tildedir = Nullch;
tildename = savestr(scrbuf);
#ifdef GETPWENT /* getpwnam() is not the paragon of efficiency */
{
struct passwd *getpwnam();
struct passwd *pwd = getpwnam(tildename);
Sprintf(scrbuf,"%s%s",pwd->pw_dir,s);
tildedir = savestr(pwd->pw_dir);
strcpy(filename,scrbuf);
#ifdef GETPWENT
endpwent();
#endif
}
#else /* this will run faster, and is less D space */
{ /* just be sure LOGDIRFIELD is correct */
FILE *pfp = fopen("/etc/passwd","r");
char tmpbuf[512];
int i;
if (pfp == Nullfp) {
printf(cantopen,"passwd");
sig_catcher(0);
}
while (fgets(tmpbuf,512,pfp) != Nullch) {
d = cpytill(scrbuf,tmpbuf,':');
#ifdef DEBUGGING
if (debug & DEB_FILEXP)
printf("p %s\r\n",tmpbuf);
#endif
if (strEQ(scrbuf,tildename)) {
for (i=LOGDIRFIELD-2; i; i--) {
if (d)
d = index(d+1,':');
}
if (d) {
Cpytill(scrbuf,d+1,':');
tildedir = savestr(scrbuf);
strcat(scrbuf,s);
strcpy(filename,scrbuf);
}
break;
}
}
Fclose(pfp);
}
#endif
}
#else /* !TILDENAME */
#ifdef VERBOSE
IF(verbose)
fputs("~loginname not implemented.\r\n",stdout);
ELSE
#endif
#ifdef TERSE
fputs("~login not impl.\r\n",stdout);
#endif
#endif
}
}
else if (*s == '$') { /* starts with some env variable? */
d = scrbuf;
*d++ = '%';
if (s[1] == '{')
strcpy(d,s+2);
else {
*d++ = '{';
for (s++; isalnum(*s); s++) *d++ = *s;
/* skip over token */
*d++ = '}';
strcpy(d,s);
}
#ifdef DEBUGGING
if (debug & DEB_FILEXP)
printf("$ %s\r\n",scrbuf);
#endif
interp(filename, (sizeof filename), scrbuf);
/* this might do some extra '%'s but */
/* that is how the Mercedes Benz */
}
#ifdef DEBUGGING
if (debug & DEB_FILEXP)
printf("> %s\r\n",filename);
#endif
return filename;
}
#ifdef CONDSUB
/* skip interpolations */
char *
skipinterp(pattern,stoppers)
Reg1 char *pattern;
char *stoppers;
{
while (*pattern && (!stoppers || !index(stoppers,*pattern))) {
#ifdef DEBUGGING
if (debug & 8)
printf("skipinterp till %s at %s\r\n",stoppers?stoppers:"",pattern);
#endif
if (*pattern == '%' && pattern[1]) {
switch (*++pattern) {
case '{':
for (pattern++; *pattern && *pattern != '}'; pattern++)
if (*pattern == '\\')
pattern++;
break;
#ifdef CONDSUB
case '(': {
pattern = skipinterp(pattern+1,"!=");
if (!*pattern)
goto getout;
for (pattern++; *pattern && *pattern != '?'; pattern++)
if (*pattern == '\\')
pattern++;
if (!*pattern)
goto getout;
pattern = skipinterp(pattern+1,":)");
if (*pattern == ':')
pattern = skipinterp(pattern+1,")");
break;
}
#endif
#ifdef BACKTICK
case '`': {
pattern = skipinterp(pattern+1,"`");
break;
}
#endif
#ifdef PROMPTTTY
case '"':
pattern = skipinterp(pattern+1,"\"");
break;
#endif
default:
break;
}
pattern++;
}
else {
if (*pattern == '^' && pattern[1])
pattern += 2;
else if (*pattern == '\\' && pattern[1])
pattern += 2;
else
pattern++;
}
}
getout:
return pattern; /* where we left off */
}
#endif
/* interpret interpolations */
char *
dointerp(dest,destsize,pattern,stoppers)
Reg1 char *dest;
Reg2 int destsize;
Reg3 char *pattern;
char *stoppers;
{
Reg4 char *s;
Reg5 int i;
char scrbuf[512];
bool upper = FALSE;
bool lastcomp = FALSE;
int metabit = 0;
while (*pattern && (!stoppers || !index(stoppers,*pattern))) {
#ifdef DEBUGGING
if (debug & 8)
printf("dointerp till %s at %s\r\n",stoppers?stoppers:"",pattern);
#endif
if (*pattern == '%' && pattern[1]) {
upper = FALSE;
lastcomp = FALSE;
for (s=Nullch; !s; ) {
switch (*++pattern) {
case '^':
upper = TRUE;
break;
case '_':
lastcomp = TRUE;
break;
case '{':
pattern = cpytill(scrbuf,pattern+1,'}');
if (s = index(scrbuf,'-'))
*s++ = '\0';
else
s = nullstr;
s = getval(scrbuf,s);
break;
#ifdef CONDSUB
case '(': {
char rch;
bool matched;
pattern = dointerp(dest,destsize,pattern+1,"!=");
rch = *pattern;
if (rch == '!')
pattern++;
if (*pattern != '=')
goto getout;
pattern = cpytill(scrbuf,pattern+1,'?');
if (!*pattern)
goto getout;
if (*scrbuf == '^' && scrbuf[strlen(scrbuf)-1] == '$') {
scrbuf[strlen(scrbuf)-1] = '\0';
matched = strEQ(scrbuf+1,dest);
}
else
matched = instr(dest,scrbuf) != Nullch;
if (matched==(rch == '=')) {
pattern = dointerp(dest,destsize,pattern+1,":)");
if (*pattern == ':')
pattern = skipinterp(pattern+1,")");
}
else {
pattern = skipinterp(pattern+1,":)");
if (*pattern == ':')
pattern++;
pattern = dointerp(dest,destsize,pattern,")");
}
s = dest;
break;
}
#endif
#ifdef BACKTICK
case '`': {
FILE *pipefp, *popen();
pattern = dointerp(scrbuf,(sizeof scrbuf),pattern+1,"`");
pipefp = popen(scrbuf,"r");
if (pipefp != Nullfp) {
int len;
len = fread(scrbuf,sizeof(char),(sizeof scrbuf)-1,
pipefp);
scrbuf[len] = '\0';
pclose(pipefp);
}
else {
printf("\r\nCan't run %s\r\n",scrbuf);
*scrbuf = '\0';
}
for (s=scrbuf; *s; s++) {
if (*s == '\n') {
if (s[1])
*s = ' ';
else
*s = '\0';
}
}
s = scrbuf;
break;
}
#endif
#ifdef PROMPTTTY
case '"':
pattern = dointerp(scrbuf,(sizeof scrbuf),pattern+1,"\"");
fputs(scrbuf,stdout);
resetty();
gets(scrbuf);
crmode();
raw();
noecho();
nonl();
s = scrbuf;
break;
#endif
case '~':
s = homedir;
break;
case '.':
s = dotdir;
break;
case '$':
s = scrbuf;
Sprintf(s,"%d",getpid());
break;
case 'H': /* host name */
s = hostname;
break;
case 'L': /* login id */
s = logname;
break;
case 'N': /* full name */
s = getval("NAME",realname);
break;
case 'O':
s = origdir;
break;
case 'p':
s = cwd;
break;
case 'X': /* warp library */
s = warplib;
break;
default:
if (--destsize <= 0)
abort_interp();
*dest++ = *pattern | metabit;
s = nullstr;
break;
}
}
if (!s)
s = nullstr;
pattern++;
if (upper || lastcomp) {
char *t;
if (s != scrbuf) {
Safecpy(scrbuf,s,(sizeof scrbuf));
s = scrbuf;
}
if (upper || !(t=rindex(s,'/')))
t = s;
while (*t && !isalpha(*t))
t++;
if (islower(*t))
*t = toupper(*t);
}
i = metabit; /* maybe get into register */
if (s == dest) {
while (*dest) {
if (--destsize <= 0)
abort_interp();
*dest++ |= i;
}
}
else {
while (*s) {
if (--destsize <= 0)
abort_interp();
*dest++ = *s++ | i;
}
}
}
else {
if (--destsize <= 0)
abort_interp();
if (*pattern == '^' && pattern[1]) {
++pattern; /* skip uparrow */
i = *pattern; /* get char into a register */
if (i == '?')
*dest++ = '\177' | metabit;
else if (i == '(') {
metabit = 0200;
destsize++;
}
else if (i == ')') {
metabit = 0;
destsize++;
}
else
*dest++ = i & 037 | metabit;
pattern++;
}
else if (*pattern == '\\' && pattern[1]) {
++pattern; /* skip backslash */
i = *pattern; /* get char into a register */
/* this used to be a switch but the if may save space */
if (i >= '0' && i <= '7') {
i = 1;
while (i < 01000 && *pattern >= '0' && *pattern <= '7') {
i <<= 3;
i += *pattern++ - '0';
}
*dest++ = i & 0377 | metabit;
--pattern;
}
else if (i == 'b')
*dest++ = '\b' | metabit;
else if (i == 'f')
*dest++ = '\f' | metabit;
else if (i == 'n')
*dest++ = '\n' | metabit;
else if (i == 'r')
*dest++ = '\r' | metabit;
else if (i == 't')
*dest++ = '\t' | metabit;
else
*dest++ = i | metabit;
pattern++;
}
else
*dest++ = *pattern++ | metabit;
}
}
*dest = '\0';
getout:
return pattern; /* where we left off */
}
void
interp(dest,destsize,pattern)
char *dest;
int destsize;
char *pattern;
{
(void) dointerp(dest,destsize,pattern,Nullch);
#ifdef DEBUGGING
if (debug & DEB_FILEXP)
fputs(dest,stdout);
#endif
}
/* get the person's real name from /etc/passwd */
/* (string is overwritten, so it must be copied) */
char *
getrealname(uid)
int uid;
{
char *s, *c;
#ifdef PASSNAMES
#ifdef GETPWENT
struct passwd *pwd = getpwuid(uid);
s = pwd->pw_gecos;
#else
char tmpbuf[512];
int i;
getpw(uid, tmpbuf);
for (s=tmpbuf, i=GCOSFIELD-1; i; i--) {
if (s)
s = index(s,':')+1;
}
if (!s)
return nullstr;
Cpytill(tmpbuf,s,':');
s = tmpbuf;
#endif
#ifdef BERKNAMES
#ifdef BERKJUNK
while (*s && !isalnum(*s) && *s != '&') s++;
#endif
if ((c = index(s, ',')) != Nullch)
*c = '\0';
if ((c = index(s, ';')) != Nullch)
*c = '\0';
s = cpytill(buf,s,'&');
if (*s == '&') { /* whoever thought this one up was */
c = buf + strlen(buf); /* in the middle of the night */
strcat(c,logname); /* before the morning after */
strcat(c,s+1);
if (islower(*c))
*c = toupper(*c); /* gack and double gack */
}
#else
if ((c = index(s, '(')) != Nullch)
*c = '\0';
if ((c = index(s, '-')) != Nullch)
s = c;
strcpy(buf,tmpbuf);
#endif
#ifdef GETPWENT
endpwent();
#endif
return buf; /* return something static */
#else
if ((tmpfp=fopen(filexp(FULLNAMEFILE),"r")) != Nullfp) {
Fgets(buf,sizeof buf,tmpfp);
Fclose(tmpfp);
}
else {
resetty();
printf("What is your name? ");
Fgets(buf,(sizeof buf),stdin);
crmode();
raw();
noecho();
nonl();
if (fork())
wait(0);
else {
setuid(getuid());
if ((tmpfp = fopen(filexp(FULLNAMEFILE),"w")) == NULL)
exit(1);
fprintf(tmpfp, "%s\n", buf);
Fclose(tmpfp);
exit(0);
}
}
buf[strlen(buf)-1] = '\0';
return buf;
#endif
}
static void
abort_interp()
{
fputs("\r\n% interp buffer overflow!\r\n",stdout);
sig_catcher(0);
}
se(tmpfp);
warp/warp.h 644 171 5 25033 5121750052 6176 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.2 86/12/12 17:08:42 lwall
* Baseline for net release.
*
* Revision 7.0.1.1 86/10/16 10:54:26 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:17:55 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
extern int errno;
#include "config.h" /* generated by Configure script */
#include <stdio.h>
#include <signal.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
/* WARPLIB must be readable and writeable by warp, but not by anyone who you
* don't trust. In other words, to set up warp so everyone can play and
* no one can cheat, give warp a uid of its own and make warp setuid to
* that uid. WARPLIB must then NOT be made writeable by the world,
* since no attempt is made to encrypt saved games or anything.
* (It must be readable by the world, however, due to a strangeness in
* access.)
*/
#define SAVEDIR "./"
#define NEWSFILE "warp.news"
#define HELPFILE "warp.doc"
#define LOCKFILE ".warp.lock"
#define LOGFILE "warp.log"
#define SCOREBOARD "warp.top"
#define LSCOREBOARD "warp.lowtop"
#define FSCOREBOARD "warp.funtop"
#define TMPSCOREBOARD "warp.topnew"
#define WARPMACRO "%X/Kbmap.%{TERM}"
/* warp library */
#ifndef WARPLIB /* ~ and %l only ("~%l" is permissable) */
# ifdef PRIVLIB
# define WARPLIB PRIVLIB
# else
# define WARPLIB "/usr/games/warp"
# endif
#endif
EXT char *warplib;
#define PERMMAPS 8 /* how many starmaps are permanent */
#define MAPS 20 /* how many starmaps to choose from */
/* (MAPS - PERMMAPS is # of half-gone universes) */
/*
* Screen size info, minimum screen size is 23x40 (actually 24x80).
* YSIZE and XSIZE should be relatively prime so that a torpedo launched
* at an angle will eventually cover the whole screen.
* To calculate a new position for something:
* new_position = (current_position + delta + ?SIZE00) % ?SIZE
* This allows for negative deltas of up to ?SIZE00 (% doesn't work right
* on negative numbers).
* ?SIZE01, etc. are fudges for efficiency--they already include a delta.
*/
#define XYSIZE 920
#define XYSIZEx4 3680
#define YSIZE 23
#define YSIZE00 2300
#define YSIZE01 2301
#define YSIZE99 2299
#define XSIZE 40
#define XSIZE00 4000
#define XSIZE01 4001
#define XSIZE99 3999
#define XSIZE02 4002
#define XSIZE98 3998
#define XSIZE03 4003
#define XSIZE97 3997
#define XSIZE08 4008
#define XSIZE92 3992
EXT char amb[YSIZE][XSIZE];
#ifdef WHOAMI
# include <whoami.h>
#endif
#ifndef isalnum
# define isalnum(c) (isalpha(c) || isdigit(c))
#endif
#ifdef IOCTL
#include <sys/ioctl.h>
#endif /* IOCTL */
#ifdef FCNTL
# include <fcntl.h>
#endif
#ifdef TERMIO
# include <termio.h>
#else
# include <sgtty.h>
#endif
#ifdef FTIMER
#include <sys/timeb.h>
#endif
#ifdef GETPWENT
# include <pwd.h>
#endif
#define BITSPERBYTE 8
#define LBUFLEN 512 /* line buffer length */
#ifdef pdp11
# define CBUFLEN 256 /* command buffer length */
# define PUSHSIZE 128
#else
# define CBUFLEN 512 /* command buffer length */
# define PUSHSIZE 256
#endif
#ifdef pdp11
# define MAXFILENAME 128
#else
# define MAXFILENAME 512
#endif
#define FINISHCMD 0177
/* some handy defs */
#define bool char
#define TRUE (1)
#define FALSE (0)
#define Null(t) ((t)0)
#define Nullch Null(char *)
#define Nullfp Null(FILE *)
#define Ctl(ch) (ch & 037)
#define strNE(s1,s2) (strcmp(s1,s2))
#define strEQ(s1,s2) (!strcmp(s1,s2))
#define strnNE(s1,s2,l) (strncmp(s1,s2,l))
#define strnEQ(s1,s2,l) (!strncmp(s1,s2,l))
#define sgn(x) ((x) < 0 ? -1 : (x) > 0)
/* Things we can figure out ourselves */
#ifdef SIGPROF
# define BSD42 /* do we have Berkeley 4.2? */
#endif
#ifdef FIONREAD
# define PENDING
#else
# ifdef O_NDELAY
# define PENDING
# else
# ifdef RDCHK
# define PENDING
# endif
# endif
#endif
#ifdef EUNICE
# define UNLINK(victim) while (!unlink(victim))
#else
# define UNLINK(victim) unlink(victim)
#endif
/* Valid substitutions for strings marked with % comment are:
* %H Host name (yours)
* %L Login name (yours)
* %N Full name (yours)
* %O Original working directory (where you ran warp from)
* %X Warp library directory
* %~ Home directory
* %. Directory containing . files
* %$ current process number
* %{name} Environment variable "name". %{name-default} form allowed.
* %"prompt"
* Print prompt and insert what is typed.
* %`command`
* Insert output of command.
* %(test_text=pattern?if_text:else_text)
* Substitute if_text if test_text matches pattern, otherwise
* substitute else_text. Use != for negated match.
* % substitutions are done on test_text, if_text, and else_text.
* (Note: %() only works if CONDSUB defined.)
*/
/* *** System Dependent Stuff *** */
/* NOTE: many of these are defined in the config.h file */
#ifndef ROOTID
# define ROOTID 0 /* uid of superuser */
#endif
#ifdef NORMSIG
# define sigset Signal
# define sigignore(sig) Signal(sig,SIG_IGN)
#endif
#ifndef LOGDIRFIELD
# define LOGDIRFIELD 6 /* Which field (origin 1) is the */
/* login directory in /etc/passwd? */
/* (If it is not kept in passwd, */
/* but getpwnam() returns it, */
/* define the symbol GETPWENT) */
#endif
#ifndef GCOSFIELD
# define GCOSFIELD 5
#endif
/* Undefine any of the following features to save both I and D space */
/* In general, earlier ones are easier to get along without */
/* Pdp11's without split I and D may have to undefine them all */
#define DEBUGGING /* include debugging code */
#define PUSHBACK /* macros and keymaps using pushback buffer */
#define CONDSUB /* allow %(cond?text:text) */
#define BACKTICK /* allow %`command` */
#define PROMPTTTY /* allow %"prompt" */
#define GETLOGIN /* use getlogin() routine as backup to environment */
/* variables USER or LOGNAME */
#define TILDENAME /* allow ~logname expansion */
#define GETWD /* use our getwd() instead of piped in pwd */
#define SETUIDGID /* substitute eaccess() for access() so that rn */
/* can run setuid or setgid */
/* if not setuid or setgid, you don't need it */
#define VERBOSE /* compile in more informative messages */
#define TERSE /* compile in shorter messages */
/* some dependencies among options */
#ifndef SETUIDGID
# define eaccess access
#endif
#ifdef VERBOSE
# ifdef TERSE
# define IF(c) if (c)
# define ELSE else
# else /* !TERSE */
# define IF(c)
# define ELSE
# endif
#else /* !VERBOSE */
# ifndef TERSE
# define TERSE
# endif
# define IF(c) "IF" outside of VERBOSE???
# define ELSE "ELSE" outside of VERBOSE???
#endif
#ifdef DEBUGGING
# define assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\r\n", __FILE__, __LINE__);sig_catcher(0);}}
#else
# define assert(ex) ;
#endif
#define TCSIZE 512 /* capacity for termcap strings */
/* End of Space Conservation Section */
/* More System Dependencies */
/* preferred shell for use in doshell routine */
/* ksh or sh would be okay here */
#ifndef PREFSHELL
# define PREFSHELL "/bin/csh"
#endif
/* path to fastest starting shell */
#ifndef SH
# define SH "/bin/sh"
#endif
/* location of macro file */
#ifndef WARPMACRO
# ifdef PUSHBACK
# define WARPMACRO "%./.warpmac"
# endif
#endif
/* location of full name */
#ifndef FULLNAMEFILE
# ifndef PASSNAMES
# define FULLNAMEFILE "%./.fullname"
# endif
#endif
/* a motd-like file for warp */
#ifndef WARPNEWSNAME /* % and ~ */
# define WARPNEWSNAME "%X/warp.news"
#endif
/* typedefs */
typedef unsigned int MEM_SIZE; /* for passing to malloc */
/* *** end of the machine dependent stuff *** */
/* GLOBAL THINGS */
/* file statistics area */
EXT struct stat filestat;
/* various things of type char */
char *index();
char *rindex();
char *getenv();
char *strcat();
char *strcpy();
#ifdef CHARSPRINTF
char *sprintf();
#else
int sprintf();
#endif
EXT char buf[LBUFLEN+1]; /* general purpose line buffer */
EXT char *cwd INIT(Nullch); /* current working directory */
/* switches */
#ifdef DEBUGGING
EXT int debug INIT(0); /* -D */
# define DEB_FILEXP 64
#endif
#ifdef VERBOSE
# ifdef TERSE
EXT bool verbose INIT(TRUE); /* +t */
# endif
#endif
/* miscellania */
EXT FILE *tmpfp INIT(Nullfp); /* scratch fp */
#define NOMARKING 0
#define STANDOUT 1
#define UNDERLINE 2
/* Factored strings */
EXT char nullstr[] INIT("");
EXT char readerr[] INIT("warp read error");
EXT char cantopen[] INIT("Can't open %s\r\n");
#ifdef VERBOSE
EXT char nocd[] INIT("Can't chdir to directory %s\r\n");
#else
EXT char nocd[] INIT("Can't find %s\r\n");
#endif
extern int errno;
EXT bool justonemoretime INIT(TRUE);
EXT bool keepgoing INIT(TRUE);
EXT bool friendspec INIT(FALSE);
EXT bool piratespec INIT(FALSE);
EXT bool amoebaspec INIT(FALSE);
EXT bool starspec INIT(FALSE);
EXT bool klingspec INIT(FALSE);
EXT bool apolspec INIT(FALSE);
EXT bool crushspec INIT(FALSE);
EXT bool romspec INIT(FALSE);
EXT bool prespec INIT(FALSE);
EXT bool tholspec INIT(FALSE);
EXT bool gornspec INIT(FALSE);
EXT bool beginner INIT(FALSE);
EXT bool massacre INIT(FALSE);
EXT bool lowspeed INIT(FALSE);
EXT bool debugging INIT(FALSE);
EXT bool didkill INIT(FALSE);
EXT bool experimenting INIT(FALSE);
EXT bool scorespec INIT(FALSE);
EXT bool metakey INIT(FALSE);
EXT bool bombed_out;
EXT bool panic INIT(FALSE);
EXT bool madgorns;
EXT int madfriends;
EXT int inumpirates;
EXT int numpirates;
EXT int inumfriends;
EXT int numfriends;
EXT int inumamoebas;
EXT int numamoebas;
EXT int inumstars;
EXT int numstars;
EXT int inumenemies;
EXT int numenemies;
EXT int inumroms;
EXT int inumthols;
EXT int inumapollos;
EXT int numapollos;
EXT int apolloflag;
EXT int inumcrushes;
EXT int numcrushes;
EXT int inumgorns;
EXT int numgorns;
EXT int deados;
EXT int deadmudds;
EXT int smarts;
EXT int ismarts INIT(0);
EXT int numos INIT(0);
EXT int numxes INIT(0);
EXT int ient;
EXT int numents;
EXT int ibase;
EXT int numbases;
EXT int inuminhab;
EXT int numinhab;
EXT int wave;
EXT int cumsmarts;
EXT int prescene INIT(-1);
EXT int scandist;
EXT int antibase;
EXT int sm35;
EXT int sm45;
EXT int sm50;
EXT int sm55;
EXT int sm80;
EXT int sm95;
EXT int entmax;
EXT int basemax;
EXT int enemshields;
EXT int super;
EXT int whenok;
EXT int yamblast;
EXT int xamblast;
EXT int ambsize;
EXT char spbuf[512];
char *index(), *ttyname(), *malloc(), *ctime(), *strcpy();
char *getenv(), cmstore(), *tgoto();
long atol();
#define Fclose (void)fclose
#define Fflush (void)fflush
#define Fgets (void)fgets
#define Sprintf (void)sprintf
#define Signal (void)signal
#define Safecpy (void)safecpy
#define Cpytill (void)cpytill
#define Tract (void)tract
#define Make_object (void)make_object
#define Read_tty (void)read_tty
XT int super;
EXT int whenok;
EXT int yamblast;
EXT int xamblast;
EXT int ambsize;
EXT char spbuf[512];
char *index(), *ttyname(), *malloc(), *ctime(), *strcpy();
char *getenv(), cmstore(), *tgoto();
long atol();
#define Fclose (void)fclose
#define Fflush (void)fflush
#define Fgets (void)fgets
#define Sprintf (void)sprintf
#define Signal (void)signal
#define Safecpy (void)safecpy
#define Cpytill (void)cpytill
#define Tract (void)tract
#define Make_object (void)make_object
#defiwarp/term.h 644 171 5 24112 5121750060 6170 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.2 86/12/12 17:05:15 lwall
* Baseline for net release.
*
* Revision 7.0.1.1 86/10/16 10:53:33 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:14:07 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
/* warp will still work without the following, but may get ahead at low speed */
#ifdef TIOCOUTQ /* chars left in output queue */
#define output_pending() (ioctl(1, TIOCOUTQ, &iocount),iocount)
#endif
/* If some of the following look something like curses calls, it is because
* warp used to use curses but doesn't now. Warp was neither as efficient nor
* as portable with curses, and since the program had to cheat on curses all
* over the place anyway, we ripped it out.
*/
#define setimage(of,to) (mvaddch(of->posy+1,of->posx*2,of->image=(to)))
#define mvaddch(y,x,ch) move((y),(x),(ch))
/* #define addch(ch) (tmpchr=(ch), write(1,&tmpchr,1), real_x++) */
#define mvaddc(y,x,ch) move((y),(x),(ch))
#define addc(ch) (write(1,&(ch),1), real_x++)
#define addspace() (write(1," ",1), real_x++)
#define mvaddstr(y,x,s) (move((y),(x),0), tmpstr = (s), \
tmplen = strlen(tmpstr), write(1, tmpstr, tmplen), real_x += tmplen)
EXT int tmplen;
EXT char *tmpstr;
/* EXT char tmpchr; */
/* The following macros are like the pseudo-curses macros above, but do
* certain amount of controlled output buffering.
*
* NOTE: a beg_qwrite()..end_qwrite() sequence must NOT contain a cursor
* movement (move), because the move() routine uses beg_qwrite()..end_qwrite()
* itself.
*/
#define beg_qwrite() (maxcmstring = cmbuffer)
#ifdef vax
#define qwrite() asm("movc3 _gfillen,_filler,*_maxcmstring"); maxcmstring += gfillen
#else
#define qwrite() (movc3(gfillen,filler,maxcmstring), maxcmstring += gfillen)
#endif
#define qaddc(ch) (*maxcmstring++ = (ch), real_x++)
#define qaddch(ch) (*maxcmstring++ = (ch), real_x++)
#define qaddspace() (*maxcmstring++ = ' ', real_x++)
#define end_qwrite() (write(1,cmbuffer,maxcmstring-cmbuffer))
/* setting a ??size to infinity forces cursor addressing in that direction */
EXT int CMsize;
EXT int BCsize INIT(1);
EXT int DOsize INIT(1000);
EXT int UPsize INIT(1000);
EXT int NDsize INIT(1000);
EXT int charsperhalfsec;
EXT int real_y INIT(-100);
EXT int real_x INIT(-100);
#ifdef DOINIT
char filler[] = {0,'\b',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
#else
EXT char filler[];
#endif
EXT char *bsptr INIT(filler+1);
EXT char term[12];
EXT char gfillen INIT(25);
EXT char *maxcmstring;
EXT char cmbuffer[512];
#define BREAKCH '\0'
EXT char INTRCH INIT('\03');
#ifdef PUSHBACK
EXT char circlebuf[PUSHSIZE];
EXT int nextin INIT(0);
EXT int nextout INIT(0);
# ifdef PENDING
# ifdef FIONREAD
EXT long iocount INIT(0);
# ifndef lint
# define input_pending() (nextin!=nextout || \
(ioctl(0, FIONREAD, &iocount),(int)iocount))
# else
# define input_pending() bizarre
# endif /* lint */
# else /* FIONREAD */
int circfill();
# ifdef RDCHK
# ifndef lint
# define input_pending() rdchk(0)
# else /* lint */
# define input_pending() bizarre
# endif /* lint */
# else /* RDCHK */
# ifndef O_NDELAY /* assert O_NDELAY */
??? PENDING isn't defined correctly in warp.h
# endif
EXT int devtty INIT(0);
# ifndef lint
# define input_pending() (nextin!=nextout || circfill())
# else
# define input_pending() bizarre
# endif /* lint */
# endif /* RDCHK */
# endif /* FIONREAD */
# else /* PENDING */
??? warp won't work without PENDING
# ifndef lint
# define input_pending() (nextin!=nextout)
# else
# define input_pending() bizarre
# endif /* lint */
# endif /* PENDING */
#else /* PUSHBACK */
# ifdef PENDING
# ifdef FIONREAD /* must have FIONREAD or O_NDELAY for input_pending() */
# define read_tty(addr,size) read(0,addr,size)
# ifndef lint
# define input_pending() (ioctl(0, FIONREAD, &iocount), \
(int)iocount)
# else
# define input_pending() bizarre
# endif /* lint */
EXT long iocount INIT(0);
# else /* FIONREAD */
# ifdef RDCHK /* actually, they can have rdchk() too */
# define read_tty(addr,size) read(0,addr,size)
# ifndef lint
# define input_pending() rdchk(0)
# else /* lint */
# define input_pending() bizarre
# endif /* lint */
# else /* RDCHK */
# ifndef O_NDELAY /* assert O_NDELAY */
??? PENDING isn't defined correctly in warp.h
# endif
EXT int devtty INIT(0);
EXT bool is_input INIT(FALSE);
EXT char pending_ch INIT(0);
# ifndef lint
# define input_pending() (is_input || \
(is_input=read(devtty,&pending_ch,1)))
# else
# define input_pending() bizarre
# endif /* lint */
# endif /* RDCHK */
# endif /* FIONREAD */
# else /* PENDING */
??? warp won't work without PENDING
# define read_tty(addr,size) read(0,addr,size)
# define input_pending() (FALSE)
# endif /* PENDING */
#endif /* PUSHBACK */
/* stuff wanted by terminal mode diddling routines */
#ifdef TERMIO
EXT struct termio _tty, _oldtty;
#else
EXT struct sgttyb _tty;
EXT int _res_flg INIT(0);
#endif
EXT int _tty_ch INIT(2);
EXT bool bizarre INIT(FALSE); /* do we need to restore terminal? */
/* terminal mode diddling routines */
#ifdef TERMIO
#define raw() ((bizarre=1),_tty.c_lflag &=~ISIG,_tty.c_cc[VMIN] = 1,ioctl(_tty_ch,TCSETAF,&_tty))
#define noraw() ((bizarre=1),_tty.c_lflag |= ISIG,_tty.c_cc[VEOF] = CEOF,ioctl(_tty_ch,TCSETAF,&_tty))
#define crmode() ((bizarre=1),_tty.c_lflag &=~ICANON,_tty.c_cc[VMIN] = 1,ioctl(_tty_ch,TCSETAF,&_tty))
#define nocrmode() ((bizarre=1),_tty.c_lflag |= ICANON,_tty.c_cc[VEOF] = CEOF,ioctl(_tty_ch,TCSETAF,&_tty))
#define echo() ((bizarre=1),_tty.c_lflag |= ECHO, ioctl(_tty_ch, TCSETAW, &_tty))
#define noecho() ((bizarre=1),_tty.c_lflag &=~ECHO, ioctl(_tty_ch, TCSETAW, &_tty))
#define nl() ((bizarre=1),_tty.c_iflag |= ICRNL,_tty.c_oflag |= ONLCR,ioctl(_tty_ch, TCSETAW, &_tty))
#define nonl() ((bizarre=1),_tty.c_iflag &=~ICRNL,_tty.c_oflag &=~ONLCR,ioctl(_tty_ch, TCSETAW, &_tty))
#define savetty() (ioctl(_tty_ch, TCGETA, &_oldtty),ioctl(_tty_ch, TCGETA, &_tty))
#define resetty() ((bizarre=0),ioctl(_tty_ch, TCSETAF, &_oldtty))
#define unflush_output()
#else
#define raw() ((bizarre=1),_tty.sg_flags|=RAW, stty(_tty_ch,&_tty))
#define noraw() ((bizarre=1),_tty.sg_flags&=~RAW,stty(_tty_ch,&_tty))
#define crmode() ((bizarre=1),_tty.sg_flags |= CBREAK, stty(_tty_ch,&_tty))
#define nocrmode() ((bizarre=1),_tty.sg_flags &= ~CBREAK,stty(_tty_ch,&_tty))
#define echo() ((bizarre=1),_tty.sg_flags |= ECHO, stty(_tty_ch, &_tty))
#define noecho() ((bizarre=1),_tty.sg_flags &= ~ECHO, stty(_tty_ch, &_tty))
#define nl() ((bizarre=1),_tty.sg_flags |= CRMOD,stty(_tty_ch, &_tty))
#define nonl() ((bizarre=1),_tty.sg_flags &= ~CRMOD, stty(_tty_ch, &_tty))
#define savetty() (gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags)
#define resetty() ((bizarre=0),_tty.sg_flags = _res_flg, stty(_tty_ch, &_tty))
#endif /* TERMIO */
#ifdef TIOCSTI
#ifdef lint
#define forceme(c) ioctl(_tty_ch,TIOCSTI,Null(long*)) /* ghad! */
#else
#define forceme(c) ioctl(_tty_ch,TIOCSTI,c) /* pass character in " " */
#endif /* lint */
#else
#define forceme(c)
#endif
/* termcap stuff */
/*
* NOTE: if you don't have termlib you'll have to define these strings,
* the tputs routine, and the tgoto routine.
* The tgoto routine simply produces a cursor addressing string for a given
* x and y. The 1st argument is a generic string to be interpreted.
* If you are hardwiring it you might just ignore the 1st argument.
* The tputs routine interprets any leading number as a padding factor, possibly
* scaled by the number of lines (2nd argument), puts out the string (1st arg)
* and the padding using the routine specified as the 3rd argument.
*/
#ifdef HAVETERMLIB
EXT char *BC INIT(Nullch); /* backspace character */
EXT char *UP INIT(Nullch); /* move cursor up one line */
EXT char *myUP;
EXT char *ND INIT(Nullch); /* non-destructive cursor right */
EXT char *myND;
EXT char *DO INIT(Nullch); /* move cursor down one line */
EXT char *myDO;
EXT char *CR INIT(Nullch); /* get to left margin, somehow */
EXT char *VB INIT(Nullch); /* visible bell */
EXT char *CL INIT(Nullch); /* home and clear screen */
EXT char *CE INIT(Nullch); /* clear to end of line */
EXT char *CM INIT(Nullch); /* cursor motion -- PWP */
EXT char *HO INIT(Nullch); /* home cursor -- PWP */
EXT char *CD INIT(Nullch); /* clear to end of display -- PWP */
EXT char *SO INIT(Nullch); /* begin standout mode */
EXT char *SE INIT(Nullch); /* end standout mode */
EXT int SG INIT(0); /* blanks left by SO and SE */
EXT char *US INIT(Nullch); /* start underline mode */
EXT char *UE INIT(Nullch); /* end underline mode */
EXT char *UC INIT(Nullch); /* underline a character, if that's how it's done */
EXT int UG INIT(0); /* blanks left by US and UE */
EXT bool AM INIT(FALSE); /* does terminal have automatic margins? */
EXT bool XN INIT(FALSE); /* does it eat 1st newline after automatic wrap? */
EXT char PC INIT(0); /* pad character for use by tputs() */
EXT short ospeed INIT(0); /* terminal output speed, for use by tputs() */
EXT int LINES INIT(0), COLS INIT(0); /* size of screen */
EXT int just_a_sec INIT(960); /* 1 sec at current baud rate */
/* (number of nulls) */
EXT char ERASECH; /* rubout character */
EXT char KILLCH; /* line delete character */
/* define a few handy macros */
#define clear() (do_tc(CL,LINES),real_y=real_x=0)
#define erase_eol() do_tc(CE,1)
#define backspace() (do_tc(BC,0),real_x--)
#define clear_rest() do_tc(CD,LINES)
#define underline() do_tc(US,1)
#define un_underline() do_tc(UE,1)
#define underchar() do_tc(UC,0)
#define standout() do_tc(SO,1)
#define un_standout() do_tc(SE,1)
#define up_line() do_tc(UP,1)
#define carriage_return() do_tc(CR,1)
#define dingaling() do_tc(VB,1)
#else
???????? /* up to you */
#endif
void term_init();
void term_set();
#ifdef PUSHBACK
void pushchar();
void mac_init();
void mac_line();
#endif
void eat_typeahead();
void settle_down();
#ifndef read_tty
int read_tty();
#endif
void getcmd();
int read_nd();
void page();
void move();
void do_tc();
int comp_tc();
void helper();
void rewrite();
char cmstore();
SO,1)
#define un_standout() do_tc(SE,1)
#define up_line() do_tc(UP,1)
#define carriage_return() do_tc(CR,1)
#define dingaling() do_tc(VB,1)
#else
???????? /* up to you */
#endif
void term_init();
void term_set();
#ifdef PUSHBACK
void pushchar();
void mac_init();
void mac_line();
#endif
void eat_typeahead();
void settle_down();
#ifndef read_tty
int read_tty();
#endif
void getcmd();
int read_nd();
void page();
void move();
voiwarp/warp.doc 644 171 5 24042 5121750064 6516 Warp is a real-time space war game. This means that the enemies will keep
playing even when you sit still. Another peculiarity is that things which
blow up can damage other things around them. Universes above a critical
density may chain react.
The game starts at difficulty 1, and gets more difficult with each
succeeding wave, up to difficulty 99. You're not likely to get that far.
(Invoking warp with a -b switch causes the difficulty to increase more
slowly, but games count only a tenth as much.) The game starts with
5 Enterprises and 3 Bases, and you get more for surviving long enough.
The game is over when you run out of Enterprises and Bases.
The object of the game is to get as many points as possible. This is done
by destroying as many enemies as possible. This is not a trivial task.
Each wave starts with one Enterprise and one Base, and continues until
either both the Enterprise and Base are destroyed, or all the enemies
(including any homing torpedoes) are destroyed. It is possible to abort a
wave, but you will be penalized for it. The game may be saved between waves.
A -x switch causes any saved game to be ignored, and causes the new game
not to be saveable. Hence it is possible to run test games without
invalidating a currently saved game.
The game is played in a 23 x 40 double wrap-around universe. Everybody
(both you and the enemies) gets the chance to move once every second,
unless a -l (low-speed) switch was given or you are under 2400 baud, in
which case it's every two seconds. The following symbols are displayed:
FRIENDS
E Enterprise with shields e Enterprise without shields
C Cloaked E with shields c Cloaked E without shields
B Base with shields b Base without shields
+ Friendly torpedo M Harry Mudd
ENEMIES
K Klingon G Gorn
R Romulan A Apollo
Romulan with cloaking device! & Space Amoeba Nucleus
T Tholian >,< Planet crusher
x,X Hostile torpedo o,O Homing torpedo
P Pirate M Harry Mudd
MISCELLANEOUS
* Star @ Inhabited star
|,-,/,\ Web ~ Protoplasm
other Friendly Freighter, for now...
The following keys control the DIRECTION of your various actions:
h or 4 left
j or 2 down
k or 8 up
l or 6 right
b or 1 down and left
n or 3 down and right
y or 7 up and left
u or 9 up and right
(You will note that the letters are the same as other visual games, and the
numbers are for use with a keypad.) By themselves, these keys move either
the Enterprise or the Base, whichever is the current vessel. When shifted,
they fire photon torpedoes in the specified direction from the current
vessel. When used with either the CTRL key or the FUNCT key, phasers
(turbo-lasers for the Base) are fired in the specified direction. (CTRL
won't work with numbers, and FUNCT probably doesn't exist on non-TVI
terminals.) When preceded by an 'a', an attractor beam is fired in the
specified direction, and when preceded by an 'r', a repulsor beam is fired.
These keys have special functions:
del or % fire photon torpedoes in every (reasonable) direction
s stop all friendly torpedoes
S or 0 stop the Enterprise when in warp mode
d destruct all friendly torpedoes (quite useful)
D destruct the current vessel (commit suicide)
i/w switch to Enterprise and put into impulse/warp mode
c/v switch to Enterprise and put into cloaking/visible mode
p switch to Base (not very mnemonic, but 'b' is taken)
o switch from Enterprise to Base, or vice versa
z zap explosions (multiple zaps extend further) (E only)
^R refresh the screen
^Z suspend the game (on a bsd system)
q asks if you want to exit this wave (will not work
within 10 cycles of previous q command)
Q exit this game (not wave)
? display a summary of these commands
There may be additional commands listed in your terminal's keymap file.
Unrecognized keystrokes are ignored. IF YOU FORGET ALL THE OTHER COMMANDS,
REMEMBER "?", which gives you help.
Commands for moving the Enterprise may operate in one of two ways. If it
is in impulse mode, movement commands affect the position of the ship;
if it is in warp mode, movement commands affect the velocity instead.
The Base always moves in impulse mode. Since multiple commands may be
entered in one turn (if you can type fast enough), it is possible to jump
over things even in impulse mode. In a crowded universe this may be the
only way to go.
(Actually, motion commands always change the velocity--the actual motion
does not occur until the next turn. Impulse mode simply causes the
velocity to be zeroed out at the end of every turn. Phaser commands, on
the other hand, are executed immediately. If you want to move and fire a
phaser, you must wait for the motion to actually occur before typing the
phaser command, or the phaser fires from your old position. This is a
feature, not a bug, and is intended to reflect reality. Really.)
If multiple torpedo launching commands are given in a turn, a single torpedo
is launched with extra velocity. You can thus launch photon torpedoes over
objects in the way, and get them where you want them quickly. This feature
works well with the destruct button. Variations on this may be useful
against the Space Amoeba.
NOTE: Phasers destroy the target by blasting the projected next location of
the object hit. This means that if the object hit, be it Klingon, Romulan or
Enterprise, changes velocity in the same turn, it can elude the effect of
the phaser! (Note that this also means that if you phaser a Klingon or
torpedo that is about to ram you, you will be phasered as well as he/she/it.
This can be embarrassing, not to mention deadly.) Smart players move
immediately upon phasering something at short range, or whenever they
think they might get phasered (in other words, most of the time).
Objects with larger mass can bounce objects with smaller mass out of the way.
In a crowded universe the bouncee can bounce quite a way before finding an
empty place to land. If you let the Tholians fill up the universe with web,
so that there is no place to bounce to, the Tholians win that wave.
The status line across the top gives the current mode, the number of
points accumulated this wave, the Enterprise's energy and torpedoes, the
Base's energy and torpedoes, the number of stars, the number of enemies,
and the stardate. You will note that nice things happen to your energy levels
when you put the Enterprise next to the Base, or the Base next to some stars.
Bad things happen inside an Amoeba.
An object is destroyed when its energy goes negative, either from a direct
hit, or from the blast of the previous turn's explosions. Enemies and
stars start with random amounts of energy. High energy enemies can go warp
2. A Romulan with sufficient energy maintains a cloaking device. Tholians
spin web, Gorns shoot homing torpedoes, and the Planet Crusher munches
anything in its way, even Apollo. Apollo won't let you go unless you kill
him, but he loves you very much and beefs up your shields considerably.
Both Apollo and the Planet Crusher recharge themselves, so you must hit
them hard in a single turn to do them in. (Yes, the Planet Crusher must be
shot in the mouth--he can only die of gluttony--and he blasts out of his
mouth when he dies.) Tholian web may be crossed only by coasting across it
in warp mode, or by blasting it (but web blasts extend twice as far as
normal blasts, so keep your distance). The Space Amoeba sucks energy and
grows, and you must destroy the nucleus. Somehow. There are at least four
ways. Phasers won't work on the big ones.
Pirates turn inhabited star systems into uninhabited ones. Even Friendly
Freighters will take potshots at you if you get them mad enough.
Note that because of the size of the Base's turbo-lasers (the Base does not
have phasers) they cannot shoot anything next to the Base. (This is why the
Death Star died!) In part, this is to protect the Enterprise. It also lets
you shoot over one adjacent star. The Enterprise's phasers will shoot over
a arbitrary number of adjacent, contiguous stars, including inhabited ones.
Phasers die away with distance, so don't expect them to kill everything with
one blow.
While the Enterprise's shields are up (when it is displayed as "E" rather
than "e"), hits on it count only a fifth as much (or even less if you are
moving in warp mode). The shields are automatically maintained as long as
there are more than 500 units of energy for the Enterprise. The Base also
has shields, which stay up as long as it has at least 1000 units of energy.
Aside from losing energy, the Enterprise can also take damage, either random
damage from getting blasted, or specific damage when a system is in use
and breaks down under the load. In place of the score you will see the
Estimated Time to Repair. Sometimes docking helps to get things fixed faster.
If you lose both your warp and impulse engines, try the tractors. The
Base doesn't take damage because it has much more redundancy than the
Enterprise.
You get points for destroying enemies and hostile torpedoes. At the end of
a wave, you also get bonus points for saving stars, saving the Enterprise
and Base, and for having an efficiency rating higher that 0.8. You get
NEGATIVE bonus points for letting friendly life forms get blown up, and for
giving up. Bonuses tend to be scaled by the ratio of the number of points
you got over the number of points you could have got. If you think you are
done with a wave, but it won't quit, there may be homing torpedoes that you
haven't destroyed--you must make the universe safe for posterity, you know.
When you have used up your Enterprises and Bases (or quit), your score will
be posted to the scoreboard. You may see the scoreboard outside of the game
simply by giving the command "warp -s".
If you get bored, you can always play with some of the undocumented switches
that are used to test warp. Such funny games go on their own scoreboard.
For kicks try "warp -x -d50 -C -\& -G -T -E400 -S5" and then go hide. Quick.
that you
haven't destroyed--you must make the universe safe for posterity, you know.
When you have used up your Enterprises and Bases (or quit), your score will
be posted to the scoreboard. You may see the scoreboard outside of the game
simply by giving the command "warp -s".
If you get bored, you can always play with some of the undocumented switches
that are used to test warp. Such funny games go on their own scoreboard.
For kicks try "warp -x -d50 -C -\& -G -T -E400warp/score.h 644 171 5 1701 5121750066 6321 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:13:21 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#define ENTBOUNDARY 100000 /* point boundary across which a new E is
awarded */
#define BASEBOUNDARY 250000 /* point boundary across which a new B is
awarded */
EXT int oldstatus;
EXT int oldetorp;
EXT int oldbtorp;
EXT int oldstrs;
EXT int oldenemies;
EXT long totalscore;
EXT long lastscore INIT(0);
EXT long curscore;
EXT long possiblescore;
EXT long oldeenergy;
EXT long oldbenergy;
EXT long oldcurscore;
EXT char savefilename[40];
#ifdef SCOREFULL
#define COMPOFF 0
#define COMPNAME longlognam
#define COMPLEN 24
#else
#define COMPOFF 24
#define COMPNAME longlognam
#define COMPLEN 8
#endif
EXT char longlognam[128];
EXT char c INIT(' ');
void score_init();
void wscore();
void display_status();
void wavescore();
void score();
void save_game();
enemies;
EXT long totalscore;
EXT long lastscore INIT(0);
EXT warp/warp.c 644 171 5 23766 5121750116 6205 char rcsid[] = "@(#)$Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $";
/* warp -- a real-time space war program
* author: Larry Wall
* helpers: Jonathan and Mark Biggar, and Dan Faigin
* special thanks to my sweetie Gloria who suggested the Planet Crusher
*
* Copyright (C) 1986, Larry Wall
*
* This program may be copied as long as this copyright notice is
* included, and as long as it is not being copied for purposes
* of profit. If you want to modify this program in any way other
* than normal configuration changes, common decency would suggest
* that you also modify the name of the program so that my good name
* (what there is of it) is not impugned. (Calling it something like
* "warpx" or "superwarp" would be fine.) Also, give it another
* WARPDIR so that the scoreboards don't get confused.
*
* version 5.0 04/20/83
* 5.1 05/05/83 various tidbits
* 5.2 05/12/83 VAX -> vax, ifdef'ed a SIGCONT
* 5.3 05/24/83 RCS
*
* $Log: warp9.tar,v $
* Revision 1.1.1.1 2019/05/29 04:56:34 root
* coherent
*
* Revision 7.0.1.3 86/12/12 17:07:44 lwall
* Baseline for net release.
*
* Revision 7.0.1.2 86/10/20 12:08:00 lwall
* Made all exits reset tty.
*
* Revision 7.0.1.1 86/10/16 10:54:13 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:14:47 lwall
* Split into separate files. Added amoebas and pirates.
*
* Revision 6.4 83/12/16 13:11:45 lwall
* Handled 15 bit random number generators.
*
* Fixed array overflow bug on multiple zaps.
*
* Multiple zaps now consolidated to minimize output.
*
* Tholian jackpot games outlawed under difficulty 15.
*
* Revision 6.3 83/08/24 11:17:49 lwall
* Fixed array overflow bug on multiple zap.
*
* Revision 6.2 83/08/23 18:06:37 lwall
* Added zap command.
* Warp -s should now work on dumb terminals
* Specifying difficulty >= 40 now just makes it a special game.
* SIGTTOU #ifdef'ed.
* No-delay read provided as alternative to FIONREAD.
* Warp won't report "-1 obsolete" when there are no Enterprises left.
* Some high-difficulty tuning.
*
* Revision 6.1 83/08/17 08:49:03 lwall
* Fixed obscure bug in storing UP that caused a %. in CM to occasionally
* foist garbage onto the screen.
*
* Revision 6.0 83/08/08 17:09:26 lwall
* New baseline version for net release.
*
* Revision 5.5 83/08/01 10:59:56 lwall
* Cloaking for the Enterprise.
* Difficulty now goes to 99, and many activities depending on difficulty
* have been adjusted in frequency.
* Simplified exit sequence, and reduced dependencies on control
* characters. You needn't see the scoreboard if you don't want to.
* Hitting i,w,c, or v switches to Enterprise. Hitting p switches to Base.
* Excessive use of q is not allowed.
* Excessive use of D is not allowed.
* Scoreboard may depend on either full name or login name.
* Integrated scoreboard lister. Login name now shows up on scoreboard.
* "Hidden" startup options are now upper case.
* Checks upon startup for no cursor movement, or screen too small.
* Checks upon startup that WARPDIR is correctly protected, and that warp
* is running setuid. As an additional bonus this prevents root from
* running warp, which mucks things up, UN*X be blessed.
* All gets's turned into fgets's for safety.
* Bonus Enterprises and Bases.
* Escalating bonuses for saving Base and Enterprise.
* Escalating Enterprise energy.
* Turbolasers decrease with distance.
* Really smart enemies can see through stars occasionally.
* Occasional Tholian jackpot waves. Tholians are a trifle nastier.
* Choleric Gorns.
* An O or o can miss seeing you. Enemies can avoid a stationary O, o, or X.
* Warp 3 enemies and other nastinesses are possible in massacre mode.
* Enemies that decide to navigate when they see you can do other things than
* just come toward you.
* Gorns occasionally launch a salvo for the fun of it.
* Only star and enemy explosions can keep the round going now.
* Bounces don't always go back to starting spot now.
* Better full name processing. USG quirks handled. & substitution also
* handled now (whoever dreamed up that one must have been in the middle
* of the night before the morning after).
* Catch ^D on fgets.
* Version number printer.
* Less signal catching during debugging.
*
* Revision 5.4 83/06/24 09:28:38 lwall
* 16 bit random number generators are now supported.
* Made warp not blow up on a null save file.
* Warp now prints E and B before the stars.
* Fixed bug which caused torp count to get decremented even when no torp
* was launched because of an obstacle.
* Put %<n>ld formats where appropriate.
* Fixed E: 0 0 bug on refresh.
*
* Revision 5.3 83/05/24 14:03:10 lwall
* Starting RCS
*
*/
#include "INTERN.h"
#include "warp.h"
#include "EXTERN.h"
#include "bang.h"
#include "init.h"
#include "intrp.h"
#include "object.h"
#include "move.h"
#include "play.h"
#include "score.h"
#include "sig.h"
#include "term.h"
#include "them.h"
#include "us.h"
#include "util.h"
#include "version.h"
#include "weapon.h"
main(argc,argv)
int argc;
char *argv[];
{
char tmp, *s, *tcbuf;
int i;
FILE *savfil;
#if RANDBITS > 16
for (i=100; i; i--)
if (rand() >= 65536)
goto rand_ok;
printf("Recompile with RANDBITS = 15 or 16.\n");
exit(1);
#else
#if RANDBITS > 15
for (i=100; i; i--) {
if (rand() >= 32768)
goto rand_ok;
}
printf("Recompile with RANDBITS = 15.\n");
exit(1);
#endif
#endif
rand_ok:
#ifdef lint /* to suppress "defined but never used" */
# ifdef SIGTSTP
(void)stop_catcher();
# endif
# ifdef SIGCONT
(void)cont_catcher();
# endif
#endif
while (--argc > 0 && (*++argv)[0] == '-')
for (s = argv[0]+1; *s != '\0'; s++)
switch (*s) {
case '&':
amoebaspec = TRUE;
beginner = TRUE;
break;
case 'A':
apolspec = TRUE;
beginner = TRUE;
break;
case 'b':
beginner = TRUE;
break;
case 'C':
crushspec = TRUE;
beginner = TRUE;
break;
case 'D':
debugging = TRUE;
#ifdef DEBUGGING
debug = atoi(++s);
#endif
s += strlen(s)-1;
break;
case 'd':
s++;
if (*s == '=') s++;
ismarts = atoi(s);
if (ismarts <= 0)
ismarts = 1;
if (ismarts > 99)
ismarts = 99;
if (ismarts > 40)
beginner = TRUE;
s += strlen(s)-1;
break;
case 'E':
klingspec = TRUE;
beginner = TRUE;
s++;
if (*s == '=') s++;
inumenemies = atoi(s);
s += strlen(s)-1;
break;
case 'F':
friendspec = TRUE;
beginner = TRUE;
s++;
if (*s == '=') s++;
inumfriends = atoi(s);
s += strlen(s)-1;
break;
case 'G':
gornspec = TRUE;
beginner = TRUE;
break;
case 'l':
lowspeed = TRUE;
break;
case 'm':
metakey = TRUE;
break;
case 'M':
massacre = TRUE;
break;
case 'P':
piratespec = TRUE;
beginner = TRUE;
s++;
if (*s == '=') s++;
inumpirates = atoi(s);
s += strlen(s)-1;
break;
case 'S':
prespec = TRUE;
beginner = TRUE;
s++;
if (*s == '=') s++;
if (*s)
prescene = atoi(s);
else
prescene = -1;
s += strlen(s)-1;
break;
case 'R':
romspec = TRUE;
beginner = TRUE;
break;
case '*':
starspec = TRUE;
beginner = TRUE;
s++;
if (*s == '=') s++;
inumstars = atoi(s);
s += strlen(s)-1;
break;
case 's':
scorespec = TRUE;
break;
case 'T':
tholspec = TRUE;
beginner = TRUE;
break;
case 'x':
experimenting = TRUE;
break;
case 'v':
version();
exit(0);
break;
default:
fprintf(stderr,"warp: illegal option %c\n", *s);
fprintf(stderr, "Usage: warp -dn -b -x -v -s\n");
exit(1);
}
if (argc != 0) {
fprintf(stderr, "Usage: warp -dn -b -x -v -s\n");
exit(1);
}
bang_init();
move_init();
object_init();
play_init();
them_init();
us_init();
util_init();
weapon_init();
tcbuf = malloc(1024);
intrp_init(tcbuf);
if (chdir(warplib) < 0)
fprintf(stderr,nocd,warplib);
term_init();
term_set(tcbuf);
free(tcbuf);
umask(022); /* mustn't rely on incoming umask--could be 033 which */
/* would disable people from running wscore */
score_init();
sig_init();
if (totalscore) {
clear();
mvaddstr(12,25,"*** restoring saved game ***");
roundsleep(1);
}
srand(getpid());
do {
for (keepgoing = TRUE;;) {
if (!experimenting) {
if ((savfil = fopen(savefilename,"w")) == NULL) {
resetty();
printf("Can't open savefile\r\n");
finalize(1);
}
fprintf(savfil,
"%-8s %10ld, %2d,%5d,%2d,%2d,%3d %c%c%c%c%c%c%c%c%c\n",
logname, totalscore, smarts, cumsmarts,
numents, numbases, wave,
apolspec ? 'a' : ' ',
beginner ? 'b' : ' ',
crushspec ? 'c' : ' ',
gornspec ? 'g' : ' ',
massacre ? 'm' : ' ',
romspec ? 'r' : ' ',
tholspec ? 't' : ' ',
lowspeed ? 'l' : ' ',
amoebaspec ? '&' : ' '
);
fprintf(savfil," running on %s, process #%d\n",
term+5,getpid());
Fclose(savfil);
}
lastscore = totalscore;
initialize();
play();
cumsmarts += smarts;
wavescore();
if (numents<=0 && numbases<=0)
keepgoing = FALSE;
if (!keepgoing) break;
do {
if (experimenting) {
mvaddstr(23,15,
" [Hit space to continue, 'q' to quit] ");
}
else {
mvaddstr(23,15,
"[Hit space to continue, 's' to save, 'q' to quit]");
}
sleep(1);
Fflush(stdout);
eat_typeahead();
getcmd(&tmp);
if (tmp == BREAKCH || tmp == INTRCH) {
mvaddstr(23,15,
" ");
mvaddstr(23,33,
"Really quit? ");
getcmd(&tmp);
if (tmp == 'y' || tmp == 'Y')
tmp = 'q';
else
tmp = 1;
}
} while (tmp != INTRCH && tmp != BREAKCH && !index(" qQs",tmp));
if (tmp != ' ' && tmp != 's') break;
if (!beginner && smarts < 20)
smarts += 4;
else if (!beginner && smarts < 35)
smarts += 2;
else if (smarts < 99)
smarts++;
if (tmp == 's') save_game();
}
score();
} while (justonemoretime);
if (!experimenting)
unlink(savefilename);
clear();
resetty();
exit(0);
}
tcmd(&tmp)warp/us.c 644 171 5 23563 5121750123 5654 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.3 87/01/13 17:13:21 lwall
* Partially fixed ^S behavior. It now just ignores ^S.
*
* Revision 7.0.1.2 86/12/12 17:06:09 lwall
* Baseline for net release.
*
* Revision 7.0.1.1 86/10/16 10:53:50 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:14:21 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "bang.h"
#include "object.h"
#include "play.h"
#include "sig.h"
#include "term.h"
#include "util.h"
#include "weapon.h"
#include "INTERN.h"
#include "us.h"
void
us_init()
{
;
}
void
do_direction(dy,dx)
int dy, dx;
{
Reg1 int decr;
Reg2 OBJECT *obj;
if (status < 2) {
if (cloaking) {
char ch;
cloaked = FALSE;
ch = (ent->energy >= 500?'E':'e');
if (ch != ent->image) {
setimage(ent, ch);
}
}
decr = 5+abs(evely)+abs(evelx)+tractor*tractor;
if (ent->energy >= decr) {
ent->energy -= decr;
if (tractor) {
if (!damage || !damflag[NOTRACTORS]) {
if (!rand_mod(50)) {
damage++;
damflag[NOTRACTORS] = rand_mod(smarts+10)+2;
}
if (tract(ent,dy,dx,tractor)) {
evely += tractor*dy;
evelx += tractor*dx;
}
}
}
else if (!damage ||
(!entmode && !damflag[NOIMPULSE]) ||
(entmode && !damflag[NOWARP]) ) {
if (!rand_mod(30+500/(abs(evely)+abs(evelx)+1))) {
damage++;
damflag[entmode?NOWARP:NOIMPULSE] = rand_mod(smarts+10)+2;
}
evely += dy;
evelx += dx;
}
if (inumthols &&
(obj=occupant[(ent->posy+evely+YSIZE00)%YSIZE]
[(ent->posx+evelx+XSIZE00)%XSIZE] ) &&
obj->type == Web)
evely = evelx = 0;
}
}
else if (status == 2) {
decr = 500+abs(bvely)*5+abs(bvelx)*5+tractor*tractor*100;
if (base->energy >= decr) {
base->energy -= decr;
if (tractor) {
if (tract(base,dy,dx,tractor)) {
bvely += tractor*dy;
bvelx += tractor*dx;
}
}
else {
bvely += dy;
bvelx += dx;
}
if (inumthols &&
(obj=occupant[(base->posy+bvely+YSIZE00)%YSIZE]
[(base->posx+bvelx+XSIZE00)%XSIZE] ) &&
obj->type == Web)
bvely = bvelx = 0;
}
}
tractor = 0;
}
void
ctrl_direction(dy,dx)
int dy, dx;
{
if (status < 2) {
if (cloaking) {
char ch;
cloaked = FALSE;
ch = (ent->energy >= 500?'E':'e');
if (ch != ent->image) {
setimage(ent, ch);
}
}
if (!damage || !damflag[NOPHASERS]) {
if (!rand_mod(200)) {
damage++;
damflag[NOPHASERS] = rand_mod(smarts+10)+2;
}
fire_phaser(ent, dy, dx);
}
}
else if (status == 2)
fire_phaser(base, dy, dx);
}
void
shift_direction(dy,dx)
int dy, dx;
{
if (status < 2) {
if (cloaking) {
char ch;
cloaked = FALSE;
ch = (ent->energy >= 500?'E':'e');
if (ch != ent->image) {
setimage(ent, ch);
}
}
if (!damage || !damflag[NOTORPS]) {
if (!rand_mod(300)) {
damage++;
damflag[NOTORPS] = rand_mod(smarts+10)+2;
}
fire_torp(ent, dy, dx);
}
}
else if (status == 2)
fire_torp(base, dy, dx);
}
void
get_commands(done)
bool *done;
{
static char ch[80];
Reg1 int i;
Reg2 int count;
Reg3 bool ctrla = FALSE;
char numdestructs = 0, numzaps = 0;
top:
while (count = read_nd(ch,(sizeof ch))) {
for (i=0; i<count; i++) {
if (ch[i] == 'Q') {
bombed_out = TRUE;
*done = TRUE;
keepgoing = FALSE;
return;
}
if (ch[i] == 'q' || ch[i] == BREAKCH || ch[i] == INTRCH) {
int x;
static char quest[] = "Do you wish to escape from reality? ";
if (timer >= whenok) {
mvaddstr(12,22,quest);
do {
getcmd(&ch[i]);
} while (ch[i] != 'y' && ch[i] != 'n');
if (ch[i] == 'y') {
bombed_out = TRUE;
*done = TRUE;
return;
}
else {
for (x=11; x<=28; x++) {
mvaddch(12,x*2,
occupant[11][x]
? occupant[11][x]->image
: numamoebas
? amb[11][x]
: ' ');
addspace();
}
roundsleep(2);
whenok = timer + 10;
goto top;
}
}
else {
write(1,"\07",1);
goto top;
}
}
}
for (i=0; i<count; i++) {
if (ctrla) {
switch (ch[i]) {
case '1': case 'b':
ctrl_direction(1, -1);
break;
case '2': case 'j':
ctrl_direction(1, 0);
break;
case '3': case 'n':
ctrl_direction(1, 1);
break;
case '4': case 'h':
ctrl_direction(0, -1);
break;
case '6': case 'l':
ctrl_direction(0, 1);
break;
case '7': case 'y':
ctrl_direction(-1, -1);
break;
case '8': case 'k':
ctrl_direction(-1, 0);
break;
case '9': case 'u':
ctrl_direction(-1, 1);
break;
case 'r':
rewrite();
roundsleep(3);
ctrla = FALSE;
goto top;
case 'w':
clear();
while (!input_pending())
sleep(1);
rewrite();
roundsleep(3);
ctrla = FALSE;
goto top;
#ifdef SIGTSTP
case 'z':
clear();
mytstp();
sleep(4);
ctrla = FALSE;
goto top;
#endif
default:
break;
}
ctrla = FALSE;
}
else {
switch (ch[i]) {
case 'Z':
clear();
mytstp();
sleep(4);
goto top;
case 'i':
if (ent && (!damage || !damflag[NOIMPULSE])) {
entmode = 0;
status = 0;
}
break;
case 'w':
if (ent && (!damage || !damflag[NOWARP])) {
entmode = 1;
status = 1;
}
break;
case 'p':
if (base) {
status = 2;
}
break;
case 'o':
if (status < 2) {
if (base)
status = 2;
}
else if (status == 2) {
if (ent)
status = entmode;
}
break;
case 'v':
if (ent) {
status = entmode;
}
cloaking=FALSE;
cloaked=FALSE;
break;
case 'c':
if (ent) {
status = entmode;
if (ent->energy >= 250)
cloaking = TRUE;
}
break;
case 'z':
if (ent && (!damage || !damflag[NOZAPPER])) {
++numzaps;
if (!rand_mod(100/numzaps)) {
damage++;
damflag[NOZAPPER] = rand_mod(smarts+10)+2;
}
if (nxtbang && bangm[nxtbang-1] < 0)
--nxtbang; /* consolidate zaps */
make_blast(evely*2+ent->posy,evelx*2+ent->posx,
-5000000L, 3*numzaps);
ent->energy /= 2;
}
break;
case 'D':
if (status < 2 && (!damage || !damflag[NODESTRUCT])) {
if (ent && !rand_mod(10)) {
damage++;
damflag[NODESTRUCT] = rand_mod(smarts+10)+2;
}
if (++numdestructs <= 2)
make_blast(evely*2+ent->posy,evelx*2+ent->posx,
15000L, 3);
ent->energy /= 4;
}
else if (status == 2) {
if (numdestructs)
base->energy = base->energy / 2;
if (++numdestructs <= 2)
make_blast(base->posy, base->posx, 15000L, 5);
}
break;
case 'd':
if ((!damage || !damflag[NODESTRUCT]) && (base||ent)) {
Reg4 OBJECT *obj;
int x, y;
if (ent && !rand_mod(200)) {
damage++;
damflag[NODESTRUCT] = rand_mod(smarts+10)+2;
}
for (obj = root.prev;
obj != &root;
obj = obj->prev) {
if (obj->image == '+') {
blast[y=(obj->posy+obj->vely+YSIZE00)%YSIZE]
[x=(obj->posx+obj->velx+XSIZE00)%XSIZE]
+= 1;
yblasted[y] |= 1;
xblasted[x] |= 1;
blasted = TRUE;
obj->mass = (massacre?3000:4000);
}
}
}
break;
case 's':
if ((!damage || !damflag[NODESTRUCT]) && (base||ent)) {
Reg4 OBJECT *obj;
if (ent && !rand_mod(200)) {
damage++;
damflag[NODESTRUCT] = rand_mod(smarts+10)+2;
}
for (obj = root.prev;
obj->type == Torp || obj->type == Web ||
obj->type == Star;
obj = obj->prev) {
if (obj->image == '+')
obj->vely = obj->velx = 0;
}
}
break;
case '\001':
ctrla = TRUE;
break;
case '\002':
case '\003':
case '\004':
case '\005':
case '\006':
case '\007':
case '\010':
case '\011':
case '\012':
case '\013':
case '\014':
case '\015':
case '\016':
case '\017':
case '\020':
case '\021':
case '\022':
case '\023':
case '\024':
case '\025':
case '\026':
case '\027':
case '\030':
case '\031':
case '\032':
ch[i] += 96;
i--;
ctrla = TRUE;
break;
case '\033':
tractor = 0;
break;
case 'a':
tractor++;
break;
case 'r':
tractor--;
break;
case '1': case 'b':
do_direction(1,-1);
break;
case '2': case 'j':
do_direction(1,0);
break;
case '3': case 'n':
do_direction(1,1);
break;
case '4': case 'h':
do_direction(0,-1);
break;
case '6': case 'l':
do_direction(0,1);
break;
case '7': case 'y':
do_direction(-1,-1);
break;
case '8': case 'k':
do_direction(-1,0);
break;
case '9': case 'u':
do_direction(-1,1);
break;
case '0': case 'S':
if (status < 2) {
evely = 0;
evelx = 0;
}
break;
case '-':
if (status < 2 && ent->energy >= 10) {
evely *= -1;
evelx *= -1;
ent->energy -= 10;
}
break;
case '%': case '\177': case '_':
shift_direction(0, -1);
shift_direction(0, 1);
shift_direction(-1, 0);
shift_direction(1, 0);
shift_direction(-1, -1);
shift_direction(-1, 1);
shift_direction(1, -1);
shift_direction(1, 1);
break;
case '!': case 'B':
shift_direction(1, -1);
break;
case '@': case 'J':
shift_direction(1, 0);
break;
case '#': case 'N':
shift_direction(1, 1);
break;
case '$': case 'H':
shift_direction(0, -1);
break;
case '^': case 'L':
shift_direction(0, 1);
break;
case '&': case 'Y':
shift_direction(-1, -1);
break;
case '*': case 'K':
shift_direction(-1, 0);
break;
case '(': case 'U':
shift_direction(-1, 1);
break;
case '?':
helper();
roundsleep(3);
goto top;
default:
break;
}
}
}
}
}
break;
case '#': case 'N':
shift_direction(1, 1);
break;
case '$': case 'H':
shift_direction(0, -1);
break;
warp/them.c 644 171 5 23051 5121750127 6156 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.5 86/12/12 17:05:41 lwall
* Baseline for net release.
*
* Revision 7.0.1.4 86/10/20 12:32:38 lwall
* Wasn't clearing FRIENDLY flag on pirate creation.
*
* Revision 7.0.1.3 86/10/20 12:15:33 lwall
* Was trying to create pirates from cloaked pirates.
*
* Revision 7.0.1.2 86/10/17 10:03:44 lwall
* Fixed Romulan writing spaces while cloaked.
*
* Revision 7.0.1.1 86/10/16 10:53:39 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:14:15 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "bang.h"
#include "object.h"
#include "move.h"
#include "score.h"
#include "term.h"
#include "us.h"
#include "util.h"
#include "weapon.h"
#include "INTERN.h"
#include "them.h"
void
them_init()
{
;
}
void
their_smarts()
{
Reg1 OBJECT *curkl;
Reg2 OBJECT *obj;
Reg3 int prob;
Reg4 int count;
Reg5 int y;
Reg6 int x;
if (numcrushes && (obj=movers)->type == Crusher) {
if (numamoebas) {
y = obj->posy;
x = (obj->posx+(obj->image=='<'?1:-1)+XSIZE00)%XSIZE;
if (amb[y][x] == '~') {
obj->velx = 0; /* stop and munch amoeba */
modify_amoeba(y,x,1,' ',(int)rand_mod(5+ambsize/10)+1);
if (occupant[y][x] == nuke) /* except go for nucleus */
obj->velx = (obj->image=='<' ? 1 : -1);
}
else if (!obj->velx) {
if (!rand_mod(4))
obj->image = rand_mod(2) ? '<' : '>';
obj->velx = obj->image == '<' ? 1 : -1;
}
}
obj->vely += (rand_mod(222) - 111) / 100;
if (!(rand_mod(100))) {
setimage(obj, (obj->velx *= -1) < 0 ? '>' : '<');
}
}
if (numamoebas) {
if (!rand_mod(3))
nuke->velx = nuke->vely = 0;
if (nuke->strategy && ambsize < 90 && !rand_mod(200-smarts))
modify_amoeba(0,0,0,'~',(int)rand_mod(10));
if (ambsize > 200 || (ambsize > 100 && !rand_mod(15)))
modify_amoeba(yamblast,xamblast,2,' ',(ambsize-100)/5);
}
for (curkl = enemies; curkl->type == Enemy; curkl = curkl->next) {
if ((curkl->flags & (CLOAKS|FRIENDLY)) == CLOAKS &&
(curkl->image != ' ') &&
(curkl->energy > 300 || massacre) ) {
setimage(curkl, ' ');
}
if (madgorns)
prob = 3;
else if (curkl->vely || curkl->velx)
prob = massacre?10:20;
else if ((curkl->flags & (PIRATE|FRIENDLY)) == PIRATE) {
/* pirates want to sit sometimes */
if (curkl->strategy) {
if ((obj = lookimg(curkl->posy, curkl->posx, '@')) ||
(obj = lookimg(curkl->posy, curkl->posx, 'B')) ) {
make_plink(obj->posy, obj->posx);
if (!--curkl->strategy) { /* clock ran down */
if (obj->image == '@') {
obj->image = '*';
numinhab--;
if (obj->flags & STATIC)
mvaddch(obj->posy+1,obj->posx*2,obj->image);
if (curkl->energy < 20000)
curkl->energy += 5000;
}
prob = 2; /* our work here is done */
}
else if (obj->image == 'B') {
btorp -= rand_mod(50);
if (btorp < 0)
btorp = 0;
obj->energy -= rand_mod(500);
if (obj->energy < 0)
obj->energy = 0;
prob = 10000; /* stay here */
}
else
prob = 10000;
}
else { /* it went away--go elsewhere */
prob = 4;
curkl->strategy = 0;
}
}
else if (lookimg(curkl->posy, curkl->posx, '@') ||
lookimg(curkl->posy, curkl->posx, 'B')) {
curkl->strategy = rand_mod(15)+5;
prob = 10000;
}
else
prob = 4;
}
else if (curkl->image == 'M') { /* Mudd wants to sit sometimes */
if ((obj = lookimg(curkl->posy, curkl->posx, 'E')) ||
(obj = lookimg(curkl->posy, curkl->posx, 'B')) ) {
if (obj->image == 'B') {
btorp -= rand_mod(40);
if (btorp < 0)
btorp = 0;
obj->energy -= rand_mod(100);
if (obj->energy < 0)
obj->energy = 0;
}
else if (!obj->vely && !obj->velx) {
etorp -= rand_mod(10);
if (etorp < 0)
etorp = 0;
obj->energy -= rand_mod(20);
if (obj->energy < 0)
obj->energy = 0;
}
prob = 10000; /* stay here */
}
else /* it went away--go elsewhere */
prob = 4;
}
else if (curkl->flags & FRIENDLY) {
if (curkl->energy < 10000 &&
lookimg(curkl->posy, curkl->posx, '@') ) {
curkl->energy += 100;
prob = 20; /* do some loading */
}
else
prob = 4;
}
else if (curkl->image == '&') {
if (curkl->flags & COUNTDOWN) {
if (curkl->strategy)
curkl->strategy--;
else
curkl->flags &= ~COUNTDOWN;
prob = 100; /* someone's feeding us, so sit still */
}
else
prob = 4;
}
else
prob = 4; /* don't sit still too long */
count = 11;
for (;;) {
if (--count <= 0) /* no opening, just ram something */
break;
#ifdef lint
prob = prob;
#endif
if (!(rand_mod(prob))) /* turn randomly occasionally */
goto accell;
y=(curkl->posy+curkl->vely+YSIZE00)%YSIZE; /* find prospective */
x=(curkl->posx+curkl->velx+XSIZE00)%XSIZE; /* new position */
if (numamoebas) {
if (curkl == nuke) {
if (amb[y][x] != '~')
goto accell; /* never move nucleus from protoplasm */
}
else {
if (amb[y][x] == '~' && rand_mod(2)) {
yamblast = y;
xamblast = x;
goto accell;
}
}
}
obj = occupant[y][x];
if (!obj) break; /* is anyone there? */
switch (obj->type) {
case Star:
if (obj->image == '@' && (curkl->flags & PIRATE)) {
if (curkl->image != 'P' && curkl->image != ' ') {
if (curkl->flags & FRIENDLY) {
curkl->flags &= ~FRIENDLY;
curkl->energy += 1000;
possiblescore += curkl->mass;
inumfriends--;
numfriends--;
inumenemies++;
numenemies++;
}
curkl->image = 'P';
}
break; /* go ahead and ram the star */
}
goto accell; /* try not to ram stars */
case Torp:
if (!obj->vely && !obj->velx && (rand_mod(100) <= smarts) &&
(obj->image == 'o' || obj->image == 'O' || obj->image == 'X'))
goto accell; /* try not to ram "friendly" torps */
break;
case Web:
if (curkl->image != 'T')
goto accell; /* non-Tholians shouldn't ram web */
if (count <= 5)
break; /* Tholians retrace web if desperate */
if (obj->image ==
(curkl->vely?
(curkl->velx?
(curkl->velx==curkl->vely?
'\\'
:
'/'
)
:
'|'
)
:
'-'
)
) goto accell; /* Tholians try not to retrace web */
break; /* No problem with crossing web */
}
break; /* okay to move over object */
accell:
/* determine maximum velocity */
if (massacre && curkl->image != 'T') {
curkl->vely = rand_mod(7) - 3;
curkl->velx = rand_mod(7) - 3;
}
else if (curkl->image == '&') {
if (rand_mod(2)) {
curkl->vely = rand_mod(3) - 1;
curkl->velx = rand_mod(3) - 1;
}
else {
curkl->vely = curkl->strategy & 3;
if (curkl->vely & 2)
curkl->vely = -1;
curkl->velx = (curkl->strategy >> 2) & 3;
if (curkl->velx & 2)
curkl->velx = -1;
}
}
else if (curkl->energy >= 2500 && curkl->image != 'T') {
curkl->vely = rand_mod(5) - 2;
curkl->velx = rand_mod(5) - 2;
}
else {
curkl->vely = rand_mod(3) - 1;
curkl->velx = rand_mod(3) - 1;
}
}
if (count != 10) {
if (curkl->image == ' ') {
setimage(curkl, curkl->flags & PIRATE ? 'P' : 'R');
}
if (!count) {
curkl->vely = 0;
curkl->velx = 0;
}
}
if (curkl->image == 'G' && (base||ent) &&
!rand_mod((103-smarts)*10) ) {
int xxx,yyy;
for (xxx = -1; xxx<=1; xxx++)
for (yyy = -1; yyy<=1; yyy++)
if ((xxx||yyy) && rand_mod(2))
fire_torp(curkl,yyy,xxx);
}
else if (curkl->image == 'T' && (curkl->velx || curkl->vely)) {
Make_object(Web,
curkl->vely?
(curkl->velx?
(curkl->velx==curkl->vely?
'\\'
:
'/'
)
:
'|'
)
:
'-',
curkl->posy,curkl->posx,0,0,32767L,32767L,&root);
if (obj && obj->type == Web) {
unmake_object(obj);
occupant[y][x] = Null(OBJECT*);
}
}
}
/* klingon-style fighting */
if (numamoebas)
attack(nuke);
attack(base);
if (ent && (!cloaked || ent->image=='E' || ent->image=='e'))
attack(ent);
}
void
modify_amoeba(y,x,where,ch,quant)
Reg1 int y;
Reg2 int x;
int where;
Reg6 int ch;
Reg7 int quant;
{
Reg3 int dy;
Reg4 int dx;
Reg5 int count = 15;
if (!numamoebas)
return;
if (!where || (where==1 && rand_mod(2))) {
y = nuke->posy;
x = nuke->posx;
}
if (nuke->strategy && rand_mod(3)) {
dy = nuke->strategy & 3;
if (dy & 2)
dy = -1;
dx = (nuke->strategy >> 2) & 3;
if (dx & 2)
dx = -1;
if (ch == ' ') { /* take from the tail */
dy = -dy;
dx = -dx;
}
if (!rand_mod(100))
nuke->strategy = rand_mod(256);
}
else {
dy = rand_mod(3) - 1;
dx = rand_mod(3) - 1;
}
if (!dy && !dx)
return;
do {
if (--count < 0)
return;
y = (y + dy + YSIZE00) % YSIZE;
x = (x + dx + XSIZE00) % XSIZE;
} while (amb[y][x] != ' ');
if (ch == ' ') {
y = (y - dy + YSIZE00) % YSIZE;
x = (x - dx + XSIZE00) % XSIZE;
}
if (ambsize > 100 && quant > 2) {
quant >>= (ambsize/100);
}
if ((nuke->energy += quant << 6) > 32767)
nuke->energy = 32767;
count = quant << 3; /* endless loop catcher */
while (count-- > 0 && quant > 0) {
if (amb[y][x] != ch) {
quant--;
amb[y][x] = ch;
if (ch == '~') {
ambsize++;
yblasted[y] |= 2;
xblasted[x] |= 2;
blasted = TRUE;
}
else
ambsize--;
if (!occupant[y][x])
mvaddch(y+1,x*2,ch);
}
y = (y + rand_mod(3) + YSIZE99) % YSIZE;
x = (x + rand_mod(3) + XSIZE99) % XSIZE;
}
}
>>= (ambsize/100);
}
if ((nuke->energy += quant << 6) > 32767)
nuke->energy = 32767;
count = quant << 3; /* endless loop catcher */
while (count-- > 0 && quant > 0) {
if (amb[y][x] != ch) {
quant--;
amb[y][x] = ch;
if (ch == '~') {
ambsize++;
yblasted[y] |= 2;
xblasted[x] |= 2;
blasted = TRUE;
}
else
ambsize--;
if (!occupant[y][x])
mvaddch(y+1,x*2,ch);
}
y = (y + rand_mod(3) + YSIZE99) % YSIZE;
x = (x +warp/config.h.SH 644 171 5 21316 5121750133 7003 case $CONFIG in
'')
if test ! -f config.sh; then
ln ../config.sh . || \
ln ../../config.sh . || \
ln ../../../config.sh . || \
(echo "Can't find config.sh."; exit 1)
echo "Using config.sh from above..."
fi
. config.sh
;;
esac
echo "Extracting config.h (with variable substitutions)"
cat <<!GROK!THIS! >config.h
/* config.h
* This file was produced by running the config.h.SH script, which
* gets its values from config.sh, which is generally produced by
* running Configure.
*
* Feel free to modify any of this as the need arises. Note, however,
* that running config.h.SH again will wipe out any changes you've made.
* For a more permanent change edit config.sh and rerun config.h.SH.
*/
/* EUNICE:
* This symbol, if defined, indicates that the program is being compiled
* under the EUNICE package under VMS. The program will need to handle
* things like files that don't go away the first time you unlink them,
* due to version numbering. It will also need to compensate for lack
* of a respectable link() command.
*/
/* VMX:
* This symbol, if defined, indicates that the program is running under
* VMS. It is currently only set in conjunction with the EUNICE symbol.
*/
#$d_eunice EUNICE /**/
#$d_eunice VMS /**/
/* CHARSPRINTF:
* This symbol is defined if this system declares "char *sprintf()" in
* stdio.h. The trend seems to be to declare it as "int sprintf()". It
* is up to the package author to declare sprintf correctly based on the
* symbol.
*/
#$d_charsprf CHARSPRINTF /**/
/* FCNTL:
* This symbol, if defined, indicates to the C program that it should
* include fcntl.h.
*/
#$d_fcntl FCNTL /**/
/* FTIMER:
* This symbol, if defined, indicates that the ftime() routine exists.
*/
#$d_ftime FTIMER /**/
/* GETHOSTNAME:
* This symbol, if defined, indicates that the C program may use the
* gethostname() routine to derive the host name. See also DOUNAME
* and PHOSTNAME.
*/
/* DOUNAME:
* This symbol, if defined, indicates that the C program may use the
* uname() routine to derive the host name. See also GETHOSTNAME and
* PHOSTNAME.
*/
/* PHOSTNAME:
* This symbol, if defined, indicates that the C program may use the
* contents of PHOSTNAME as a command to feed to the popen() routine
* to derive the host name. See also GETHOSTNAME and DOUNAME.
*/
#$d_gethname GETHOSTNAME /**/
#$d_douname DOUNAME /**/
#$d_phostname PHOSTNAME "$phostname" /**/
/* GETPWENT:
* This symbol, if defined, indicates that the getpwent() routine
* should be used instead of the getpw() routine.
*/
#$d_getpwent GETPWENT /**/
/* HAVETERMLIB:
* This symbol, when defined, indicates that termlib-style routines
* are available. There is nothing to include.
*/
#$d_havetlib HAVETERMLIB /**/
/* index:
* This preprocessor symbol is defined, along with rindex, if the system
* uses the strchr and strrchr routines instead.
*/
/* rindex:
* This preprocessor symbol is defined, along with index, if the system
* uses the strchr and strrchr routines instead.
*/
#$d_index index strchr /* cultural */
#$d_index rindex strrchr /* differences? */
/* IOCTL:
* This symbol, if defined, indicates that sys/ioctl.h exists and should
* be included.
*/
#$d_ioctl IOCTL /**/
/* NORMSIG:
* This symbol, if defined, indicates that normal signal handling routines
* should be used, as opposed to the ones in 4.1bsd (sigset, etc.).
*/
#$d_normsig NORMSIG /**/
/* PORTABLE:
* This symbol, if defined, indicates to the C program that it should
* not assume that it is running on the machine it was compiled on.
* The program should be prepared to look up the host name, translate
* generic filenames, use PATH, etc.
*/
#$d_portable PORTABLE /**/
/* RDCHK:
* This symbol, if defined, indicates that the rdchk routine is available
* to find out if there is input pending on an IO channel. Generally
* the routine is used only if FIONREAD and O_NDELAY aren't available.
*/
#$d_rdchk RDCHK /**/
/* SCOREFULL:
* This symbol, if defined, indicates that any scoreboard kept by the
* program should be kept on the basis of the user's full name as opposed
* to the user's login name. If the user can change his full name he
* can enter multiple scores if this is defined.
*/
#$d_scorfl SCOREFULL /**/
/* SIGNEDCHAR:
* This symbol, if defined, indicates that characters are a signed type.
* If not defined, things declared as signed characters (and that make
* use of negative values) should probably be declared as shorts instead.
*/
#$d_sgndchr SIGNEDCHAR /**/
/* TERMIO:
* This symbol, if defined, indicates that the program should include
* termio.h rather than sgtty.h. There are also differences in the
* ioctl() calls that depend on the value of this symbol.
*/
#$d_termio TERMIO /**/
/* USENDIR:
* This symbol, if defined, indicates that the program should compile
* the ndir.c code provided with the package.
*/
/* LIBNDIR:
* This symbol, if defined, indicates that the program should include the
* system's version of ndir.h, rather than the one with this package.
*/
#$d_usendir USENDIR /**/
#$d_libndir LIBNDIR /**/
/* WHOAMI:
* This symbol, if defined, indicates that the program may include
* whoami.h.
*/
#$d_whoami WHOAMI /**/
/* HOSTNAME:
* This symbol contains name of the host the program is going to run on.
* The domain is not kept with hostname, but must be gotten from MYDOMAIN.
* The dot comes with MYDOMAIN, and need not be supplied by the program.
* If gethostname() or uname() exist, HOSTNAME may be ignored.
*/
/* MYDOMAIN:
* This symbol contains the domain of the host the program is going to
* run on. The domain must be appended to HOSTNAME to form a complete
* host name. The dot comes with MYDOMAIN, and need not be supplied by
* the program. If the host name is derived from PHOSTNAME, the domain
* may or may not already be there, and the program should check.
*/
#define HOSTNAME "$hostname" /**/
#define MYDOMAIN "$mydomain" /**/
/* PASSNAMES:
* This symbol, if defined, indicates that full names are stored in
* the /etc/passwd file.
*/
/* BERKNAMES:
* This symbol, if defined, indicates that full names are stored in
* the /etc/passwd file in Berkeley format (name first thing, everything
* up to first comma, with & replaced by capitalized login id, yuck).
*/
/* USGNAMES:
* This symbol, if defined, indicates that full names are stored in
* the /etc/passwd file in USG format (everything after - and before ( is
* the name).
*/
#$d_passnames PASSNAMES /* (undef to take name from ~/.fullname) */
#$d_berknames BERKNAMES /* (that is, ":name,stuff:") */
#$d_usgnames USGNAMES /* (that is, ":stuff-name(stuff):") */
/* PREFSHELL:
* This symbol contains the full name of the preferred user shell on this
* system. Usual values are /bin/csh, /bin/ksh, /bin/sh.
*/
#define PREFSHELL "$prefshell" /**/
/* RANDBITS:
* This symbol contains the number of bits of random number the rand()
* function produces. Usual values are 15, 16, and 31.
*/
#define RANDBITS $randbits /**/
/* Reg1:
* This symbol, along with Reg2, Reg3, etc. is either the word "register"
* or null, depending on whether the C compiler pays attention to this
* many register declarations. The intent is that you don't have to
* order your register declarations in the order of importance, so you
* can freely declare register variables in sub-blocks of code and as
* function parameters. Do not use Reg<n> more than once per routine.
*/
#define Reg1 $reg1 /**/
#define Reg2 $reg2 /**/
#define Reg3 $reg3 /**/
#define Reg4 $reg4 /**/
#define Reg5 $reg5 /**/
#define Reg6 $reg6 /**/
#define Reg7 $reg7 /**/
#define Reg8 $reg8 /**/
#define Reg9 $reg9 /**/
#define Reg10 $reg10 /**/
#define Reg11 $reg11 /**/
#define Reg12 $reg12 /**/
#define Reg13 $reg13 /**/
#define Reg14 $reg14 /**/
#define Reg15 $reg15 /**/
#define Reg16 $reg16 /**/
/* ROOTID:
* This symbol contains the uid of root, normally 0.
*/
#define ROOTID $rootid /**/
/* VOIDFLAGS:
* This symbol indicates how much support of the void type is given by this
* compiler. What various bits mean:
*
* 1 = supports declaration of void
* 2 = supports arrays of pointers to functions returning void
* 4 = supports comparisons between pointers to void functions and
* addresses of void functions
*
* The package designer should define VOIDUSED to indicate the requirements
* of the package. This can be done either by #defining VOIDUSED before
* including config.h, or by defining defvoidused in Myinit.U.
*/
#ifndef VOIDUSED
#define VOIDUSED $defvoidused
#endif
#define VOIDFLAGS $voidflags
#if (VOIDFLAGS & VOIDUSED) != VOIDUSED
#$define void int /* is void to be avoided? */
#$define M_VOID /* Xenix strikes again */
#endif
/* $package private library, may use ~ expansion, %x and %l */
#define PRIVLIB "$privlib" /**/
!GROK!THIS!
ine VOIDUSED to indicate the requirements
* of the package. This can be done either by #defining VOIDUSED before
* including config.h, or by defining defvoidused in Myinit.U.
*/
#ifndef VOIDUSED
#define VOIDUSED $defvoidused
#endif
#define VOIDFLAGS $voidflags
#if (VOIDFLAGS & VOIDUSED) != VOIDUSED
#$warp/warp.man 644 171 5 10714 5121750136 6525 .TH WARP 6
.SH NAME
warp - a real-time space war game
.SH SYNOPSIS
.B warp [options]
.SH DESCRIPTION
.I Warp
is a real-time space war game that requires skill and quick thinking.
"Real-time" in this context means that the enemies keep moving (and shooting)
even if you don't.
A unique feature of
.I warp
is that blast propagates; it is unhealthy to remain near things that are
in the process of blowing up.
If a given universe is above a critical density it may chain react.
Scoring is like many popular arcade games--there are multiple waves which
get harder and harder as you go along.
Nobody has ever maxed out the scoreboard without cheating.
.PP
Unlike many space-war games,
.I warp
is not simply a shooting gallery.
Along with phasers and photon torpedoes, you have tractor beams and a cloaking
device.
Skill in navigation is important.
It helps to be schizophrenic, because you must manage an Enterprise and a Base
simultaneously.
And enemies do not simply shoot back.
You can get tailed, absorbed, snuck up upon, hemmed in, rammed, loved to death,
reprimanded for destroying civilized life, dragged around, robbed, damaged
and eaten.
And if you should happen to get bored by the enemies (a trifle unlikely),
you can always watch the interesting star patterns.
In fact, you'll have to, since your tactics will depend upon what kind of
universe you find yourself in.
.PP
.I Warp
is played in a double wraparound universe, i.e. the bottom is connected to the
top, and the right is connected to the left.
You need a crt with random cursor addressing and at least 24 lines by 80
columns.
For more information about about how to play, simply run
.I warp
and say "y" when it asks if you want to see the instructions.
There is also a single-page command summary that you can get while playing
by typing a "?".
.PP
Command line options include:
.TP 5
.B -b
Put
.I warp
into beginner mode.
Makes the difficulty increase more slowly, but penalizes you for it.
.TP 5
.B -d<n>
Sets the initial difficulty to
.BR n .
.TP 5
.B -l
Play a low-speed game.
Changes the basic cycle time from 1 second to 2 seconds.
This switch is automatically set at baud rates below 2400.
You may want to set it at higher speeds if your terminal cannot keep up
with the output.
(This should never happen on BSD systems, which have an IOCTL call to
determine output queue length.)
Because this makes the game easier, a separate scoreboard is kept for
low-speed games.
.TP 5
.B -m
Terminal has a meta key which turns on the eighth bit. Ordinarily the
eighth bit is stripped in order to ignore parity.
Metacharacters will appear to the keymap as prefixed with a ^A, and will
subsequently have the same effect as a control character, unless otherwise
mapped.
.TP 5
.B -s
Just prints out the scoreboards and saved games and then exits.
.TP 5
.B -v
Prints out the version number.
.TP 5
.B -x
Play an experimental game.
This causes
.I warp
to ignore any saved game, and disables the ability to save
the current game.
Thus you can play around with something or show
.I warp
to someone without jeopardizing a currently saved game.
.SH ENVIRONMENT
.TP 5
.B WARPMACRO
If defined, names a file containing keyboard mappings and macros.
If not defined, the value %X/Kbmap.%{TERM} is assumed.
The macro file contains lines of the following form:
.sp
<keystroke-sequence> <whitespace> <canonical-keystroke-sequence>
.sp
You may use certain % interpolations and ^<letter> control characters.
For possible % interpolations see warp.h.
Sequences in the canonical-keystroke-sequence bounded by ^(...^) are
subject to reinterpretation via the keymap.
This file has two major uses.
First, you can set up your commands to use any kind of prefix key your terminal
might have, or change the key bindings in any other way you choose.
Second, you can define arbitrary macros, such as this:
.sp
# define Corbamite maneuver
= DDllllll
.SH AUTHOR
Larry Wall <[email protected]>
.SH FILES
~/.fullname, if full names aren't in /etc/passwd
.SH DIAGNOSTICS
Generally self-documenting, as they say.
.SH BUGS
Addicting.
At the end of a wave, all you have to do to keep going is hit a space.
You see the message "Hit space to continue" and automatically hit space.
About 2 seconds later you remember you wanted to go home, but by then
it's too late to escape without penalty.
.PP
You can't kill a backgrounded
.I warp
process directly, because it is running setuid.
You have to use the killer built in to
.IR warp .
.PP
Now that there is a space amoeba, there ought to be tribbles.
But it might be too much trouble...
UGS
Addicting.
At the end of a wave, all you have towarp/MANIFEST 644 171 5 5715 5121750140 6170 After all the warp kits are run you should have the following files:
Filename Kit Description
-------- --- -----------
Configure 1 An entertaining little shell script
EXTERN.h 6 Set up for external .h files
INTERN.h 6 Set up for internal .h files
MANIFEST 1 This file
Makefile.SH 5 Makefile for warp
README 5 Instructions--please read
bang.c 5 Routines having to do with blast propagation
bang.h 6 Visible declarations for above
config.H 4 Sample config.h for if you can't Configure
init.c 3 Initialization for a wave.
init.h 2 Visible declarations for above
intrp.c 4 Code to interpret % substitutions
intrp.h 6 Visible declarations for above
makedepend.SH 6 Generates makefile dependencies
makedir.SH 6 Makes multilevel directories
move.c 3 Object movement and display
move.h 6 Visible declarations for above
ndir.c 5 Directory manipulation routines
ndir.h 5 Visible declarations for above
object.c 6 Object management
object.h 6 Visible declarations for above
patchlevel.h 4 How patched the kit is
play.c 5 What to do each second
play.h 6 Visible declarations for above
score.c 2 Scoring and saving
score.h 6 Visible declarations for above
sig.c 5 Signal handling
sig.h 6 Visible declarations for above
sm.c 6 Starmap translator
smp.0 3 "Straight Grid" scenario
smp.1 6 "Offset Grid" scenario
smp.2 6 "Shooting Gallery" scenario
smp.3 6 "Superfortress" scenario
smp.4 6 "Blocks" scenario
smp.5 6 "Microfortress" scenario
smp.6 6 "Passage" scenario
smp.7 6 "Wall" scenario
term.c 2 Terminal handling
term.h 5 Visible declarations for above
them.c 5 Smarts for enemies
them.h 6 Visible declarations for above
us.c 4 Smarts for us
us.h 6 Visible declarations for above
util.c 1 Utility routines
util.h 5 Visible declarations for above
version.c 6 Prints version number.
version.h 1 Visible declarations for above
warp.c 2 Main loop
warp.doc 4 How to play warp
warp.h 4 Visible declarations for everyone
warp.man 5 How to start warp
warp.news 5 Sample startup message
weapon.c 3 Our firepower
weapon.h 6 Visible declarations for above
util.h 5 Visible declarations fowarp/Makefile.SH 644 171 5 10214 5121750147 7025 case $CONFIG in
'')
if test ! -f config.sh; then
ln ../config.sh . || \
ln ../../config.sh . || \
ln ../../../config.sh . || \
(echo "Can't find config.sh."; exit 1)
fi
. config.sh
;;
esac
echo "Extracting Makefile (with variable substitutions)"
: This section of the file will have variable substitutions done on it.
: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
: Protect any dollar signs and backticks that you do not want interpreted
: by putting a backslash in front.
$spitshell >Makefile <<!GROK!THIS!
# $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
#
# $Log: warp9.tar,v $
# Revision 1.1.1.1 2019/05/29 04:56:34 root
# coherent
#
# Revision 7.0.1.1 86/12/12 16:54:03 lwall
# Frozen for net release.
#
# Revision 7.0 86/10/08 15:11:42 lwall
# Split into separate files. Added amoebas and pirates.
#
#
CC = $cc
bin = $bin
mansrc = $mansrc
manext = $manext
CFLAGS = $ccflags -O
LDFLAGS = $ldflags
CHOWNER = $chowner
privlib = $privlib
NDIRC = $ndirc
NDIRO = $ndiro
LARGE = $large $split
SMALL = $small
libs = $ndirlib $termlib $jobslib $libnm -lm
!GROK!THIS!
: In the following dollars and backticks do not need the extra backslash.
$spitshell >>Makefile <<'!NO!SUBS!'
public = warp
private = warp.doc smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
manpages = warp.man
util = Makefile makedepend makedir smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
sh = Makefile.SH makedepend.SH makedir.SH
h1 = bang.h init.h intrp.h move.h ndir.h
h2 = patchlevel.h object.h play.h score.h
h3 = sig.h term.h them.h us.h
h4 = util.h version.h warp.h weapon.h
h = $(h1) $(h2) $(h3) $(h4)
c1 = bang.c init.c intrp.c move.c
c2 = object.c play.c score.c
c3 = sig.c term.c them.c us.c
c4 = util.c version.c warp.c weapon.c
c = $(c1) $(c2) $(c3) $(c4) $(NDIRC)
obj1 = bang.o init.o intrp.o move.o
obj2 = object.o play.o score.o
obj3 = sig.o term.o them.o us.o
obj4 = util.o version.o warp.o weapon.o
obj = $(obj1) $(obj2) $(obj3) $(obj4) $(NDIRO)
lintflags = -phbvxac
add1 = Makefile.old
add2 = bsd config.h config.sh eunice filexp
add3 = loc makedepend
add4 =
add5 = pdp11 warp usg v7
addedbyconf = $(add1) $(add2) $(add3) $(add4) $(add5)
# grrr
SHELL = /bin/sh
.c.o:
$(CC) -c $(CFLAGS) $(LARGE) $*.c
all: $(public) $(private) $(util)
touch all
warp: $(obj)
$(CC) $(LDFLAGS) $(obj) $(LARGE) $(libs) -o warp
# if a .h file depends on another .h file...
$(h):
touch $@
install: warp
# won't work with csh
export PATH || exit 1
- mv $(bin)/warp $(bin)/warp.old
- if test `pwd` != $(bin); then cp $(public) $(bin); fi
- cd $(bin); chmod 755 $(public); chown '$(CHOWNER)' $(public)
- chmod 4711 $(bin)/warp
- chmod 755 makedir
- ./makedir `./filexp $(privlib)`
- \
if test `pwd` != `./filexp $(privlib)`; then \
cp $(private) `./filexp $(privlib)`; \
fi
- \
cd `./filexp $(privlib)`; \
chmod 755 $(private); \
chown '$(CHOWNER)' . $(private) \
cp /dev/null save.blurfl
- \
if test ! -f `./filexp $(privlib)/warp.news`; then \
cp warp.news `./filexp $(privlib)`; \
fi
- \
if test `pwd` != $(mansrc); then \
for page in $(manpages); do \
cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
done; \
fi
clean:
rm -f core *.o
realclean:
rm -f warp *.o core $(addedbyconf) $(util)
# The following lint has practically everything turned on. Unfortunately,
# you have to wade through a lot of mumbo jumbo that can't be suppressed.
# If the source file has a /*NOSTRICT*/ somewhere, ignore the lint message
# for that spot.
lint:
lint $(lintflags) $(defs) $(c) > warp.fuzz
smap.0: smp.0 sm
sm <smp.0 >smap.0
smap.1: smp.1 sm
sm <smp.1 >smap.1
smap.2: smp.2 sm
sm <smp.2 >smap.2
smap.3: smp.3 sm
sm <smp.3 >smap.3
smap.4: smp.4 sm
sm <smp.4 >smap.4
smap.5: smp.5 sm
sm <smp.5 >smap.5
smap.6: smp.6 sm
sm <smp.6 >smap.6
smap.7: smp.7 sm
sm <smp.7 >smap.7
sm: sm.c
cc sm.c $(SMALL) -o sm
depend: makedepend
makedepend
clist:
echo $(c) | tr ' ' '\012' >.clist
hlist:
echo $(h) | tr ' ' '\012' >.hlist
shlist:
echo $(sh) | tr ' ' '\012' >.shlist
# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
$(obj):
@ echo "You haven't done a "'"make depend" yet!'; exit 1
makedepend: makedepend.SH
/bin/sh makedepend.SH
!NO!SUBS!
$eunicefix Makefile
5 sm
sm <smp.5 >smap.5
smap.6: smp.6 sm
sm <smp.6 >smap.6
smap.7: smp.7 sm
sm <smp.7 >smap.7
sm: sm.c
cc sm.c $(SMALL) -o sm
depend: makedepend
makedepend
clist:
echo $(c) | tr ' ' '\012' >.clist
hlist:
echo $(h) | tr ' ' '\012' >.hlist
shlist:
echo $(sh) | tr ' ' '\012' >.shlist
# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
$(objwarp/makedepend.SH 644 171 5 10175 5121750152 7407 case $CONFIG in
'')
if test ! -f config.sh; then
ln ../config.sh . || \
ln ../../config.sh . || \
ln ../../../config.sh . || \
(echo "Can't find config.sh."; exit 1)
fi
. config.sh
;;
esac
case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac
echo "Extracting makedepend (with variable substitutions)"
$spitshell >makedepend <<!GROK!THIS!
$startsh
# $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
#
# $Log: warp9.tar,v $
# Revision 1.1.1.1 2019/05/29 04:56:34 root
# coherent
#
# Revision 7.0.1.1 86/12/12 17:00:05 lwall
# Baseline for net release.
#
# Revision 4.3.1.2 85/05/13 15:53:42 lwall
# Made cpp look in /usr/local/include too.
#
# Revision 4.3.1.1 85/05/10 11:35:10 lwall
# Branch for patches.
#
# Revision 4.3 85/05/01 11:42:26 lwall
# Baseline for release with 4.3bsd.
#
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
cat='$cat'
cp='$cp'
cpp='$cpp'
echo='$echo'
egrep='$egrep'
expr='$expr'
mv='$mv'
rm='$rm'
sed='$sed'
sort='$sort'
test='$test'
tr='$tr'
uniq='$uniq'
!GROK!THIS!
$spitshell >>makedepend <<'!NO!SUBS!'
$cat /dev/null >.deptmp
$echo "(Note: this is going to take a while.)"
$rm -f *.c.c c/*.c.c
if test -f Makefile; then
mf=Makefile
else
mf=makefile
fi
if test -f $mf; then
defrule=`<$mf sed -n \
-e '/^\.c\.o:.*;/{' \
-e 's/\$\*\.c//' \
-e 's/^[^;]*;[ ]*//p' \
-e q \
-e '}' \
-e '/^\.c\.o: *$/{' \
-e N \
-e 's/\$\*\.c//' \
-e 's/^.*\n[ ]*//p' \
-e q \
-e '}'`
fi
case "$defrule" in
'') defrule='$(CC) -c $(CFLAGS)' ;;
esac
make clist || ($echo "Searching for .c files..."; \
$echo *.c */*.c | $tr ' ' '\012' | $egrep -v '\*' >.clist)
for file in `$cat .clist`; do
# for file in `cat /dev/null`; do
filebase=`basename $file .c`
$echo "Finding dependencies for $filebase.o."
$sed -n <$file >$file.c \
-e "/^${filebase}_init(/q" \
-e '/^#/{' \
-e 's|/\*.*$||' \
-e 's|\\$||' \
-e p \
-e '}'
$cpp -I/usr/local/include -I. -I./h $file.c | \
$sed \
-e '/^# *[0-9]/!d' \
-e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
-e 's|: \./|: |' \
-e 's|\.c\.c|.c|' | \
$uniq | $sort | $uniq >> .deptmp
done
$sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d'
make shlist || ($echo "Searching for .SH files..."; \
$echo *.SH */*.SH | $tr ' ' '\012' | $egrep -v '\*' >.shlist)
if $test -s .deptmp; then
for file in `cat .shlist`; do
$echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
/bin/sh $file >> .deptmp
done
$echo "Updating Makefile..."
$echo "# If this runs make out of memory, delete /usr/include lines." \
>> Makefile.new
$sed 's|^\(.*\.o:\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
>>Makefile.new
else
make hlist || ($echo "Searching for .h files..."; \
$echo *.h */*.h | $tr ' ' '\012' | $egrep -v '\*' >.hlist)
$echo "You don't seem to have a proper C preprocessor. Using grep instead."
$egrep '^#include ' `cat .clist` `cat .hlist` >.deptmp
$echo "Updating Makefile..."
<.clist $sed -n \
-e '/\//{' \
-e 's|^\(.*\)/\(.*\)\.c|\2.o: \1/\2.c; '"$defrule \1/\2.c|p" \
-e d \
-e '}' \
-e 's|^\(.*\)\.c|\1.o: \1.c|p' >> Makefile.new
<.hlist $sed -n 's|\(.*/\)\(.*\)|s= \2= \1\2=|p' >.hsed
<.deptmp $sed -n 's|c:#include "\(.*\)".*$|o: \1|p' | \
$sed 's|^[^;]*/||' | \
$sed -f .hsed >> Makefile.new
<.deptmp $sed -n 's|c:#include <\(.*\)>.*$|o: /usr/include/\1|p' \
>> Makefile.new
<.deptmp $sed -n 's|h:#include "\(.*\)".*$|h: \1|p' | \
$sed -f .hsed >> Makefile.new
<.deptmp $sed -n 's|h:#include <\(.*\)>.*$|h: /usr/include/\1|p' \
>> Makefile.new
for file in `$cat .shlist`; do
$echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
/bin/sh $file >> Makefile.new
done
fi
$rm -f Makefile.old
$cp Makefile Makefile.old
$cp Makefile.new Makefile
$rm Makefile.new
$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
$rm -f .deptmp `sed 's/\.c/.c.c/' .clist` .shlist .clist .hlist .hsed
!NO!SUBS!
$eunicefix makedepend
chmod 755 makedepend
case `pwd` in
*SH)
$rm -f ../makedepend
ln makedepend ../makedepend
;;
esac
e in `$cat .shlist`; do
$echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
/bin/sh $file >> Makefile.new
done
fi
$rm -f Makefile.old
$cp Makefile Makefile.old
$cp Makefile.new Makefile
$rm Makefile.new
$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
$rm -f .deptmp `sed 's/\.c/.c.c/' .clist` .shlist .clist .hlist .hsed
!NO!SUBS!
$eunicwarp/play.c 644 171 5 7142 5121750154 6151 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.1 86/10/16 10:52:39 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:13:09 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "bang.h"
#include "score.h"
#include "object.h"
#include "move.h"
#include "term.h"
#include "them.h"
#include "us.h"
#include "util.h"
#include "weapon.h"
#include "INTERN.h"
#include "play.h"
void
play_init()
{
;
}
void
play()
{
bool done = FALSE;
Reg1 OBJECT *curobj;
Reg2 OBJECT *to;
Reg3 int i;
Reg4 int x;
Reg5 int y;
display_status();
#ifdef TIOCOUTQ
while (output_pending() > charsperhalfsec)
sleep(1); /* allow buffers to empty */
#endif
sleep(3);
do {
timer++;
nxtbang = 0;
banging = FALSE;
display_status();
#ifdef TIOCOUTQ
while (output_pending() > charsperhalfsec)
sleep(1);
#endif
if (lowspeed)
roundsleep(2);
else
roundsleep(1);
if (ent) {
evely = ent->vely;
evelx = ent->velx;
if (cloaking && ent->energy >= 250 && !damflag[NOCLOAKING]) {
if (!rand_mod(300)) {
damage++;
damflag[NOCLOAKING] = rand_mod(smarts+1)+2;
}
ent->energy -= ent->energy/40;
}
else
cloaking = FALSE;
cloaked = cloaking;
}
if (base) {
bvely = base->vely;
bvelx = base->velx;
}
get_commands(&done);
if (done)
break;
their_smarts();
apolloflag = 0;
if (ent) {
if (numapollos) {
if (numstars) {
if (realapollo) {
if (lookfor(realapollo->posy,realapollo->posx,
Enterprise)) {
apolloflag = 1;
}
}
else if (lookfor(root.next->posy,root.next->posx,
Enterprise)) {
apolloflag = 1;
realapollo = root.next;
mvaddch(realapollo->posy+1,realapollo->posx*2,
'A');
realapollo->image = 'A';
realapollo->mass = 6000;
inumapollos = 1;
numenemies++;
inumenemies++;
possiblescore += 5000;
}
if (apolloflag) {
if (blast[realapollo->posy][realapollo->posx] <= 32000)
evely = evelx = 0;
realapollo->energy = 32000;
}
}
else
numapollos = 0;
}
ent->vely = evely;
ent->velx = evelx;
}
if (base) {
if (numapollos) {
if (numstars) {
if (realapollo) {
if (lookfor(realapollo->posy,realapollo->posx,
Base)) {
apolloflag |= 2;
}
}
else if (lookfor(root.next->posy,root.next->posx,
Base)) {
apolloflag |= 2;
realapollo = root.next;
mvaddch(realapollo->posy+1,realapollo->posx*2,
'A');
realapollo->image = 'A';
realapollo->mass = 6000;
inumapollos = 1;
numenemies++;
inumenemies++;
possiblescore += 5000;
}
if (apolloflag & 2) {
if (blast[realapollo->posy][realapollo->posx] <= 32000)
bvely = bvelx = 0;
realapollo->energy = 32000;
}
}
else
numapollos = 0;
}
base->vely = bvely;
base->velx = bvelx;
}
if (aretorps) {
aretorps = 0;
for (i=0;i<2;i++) for (y=0;y<3;y++) for (x=0;x<3;x++) {
if (curobj = isatorp[i][y][x]) {
to = occupant[(curobj->posy+curobj->vely+YSIZE00)%YSIZE]
[(curobj->posx+curobj->velx+XSIZE00)%XSIZE];
if (to && !to->vely && !to->velx) {
unmake_object(curobj);
if (i)
btorp++;
else
etorp++;
}
isatorp[i][y][x]=0;
}
}
}
move_universe();
if (finish) {
finish--;
if (!finish && (!(numenemies || numos) || (!ent && !base))) {
done = TRUE;
timer -= 5;
}
}
else if (!banging && (!(numenemies || numos) || (!ent && !base)))
finish = 5;
} while (!done);
}
>posy+curobj->vely+YSIZE00)%YSIZE]
[(curobj->posx+curobj->velx+XSIZE00)%XSIZE];
if (to && !to->vely && !to->velx) {
unmake_object(curobj);
if (i)
btorp++;
else
etorp++;
}
isatorp[i][y][x]=0;
}
}
}
move_universe();
if (finish) {
finish--;
if (!finish && (!(numenemies || numos) || (!ent && !base))) {
done = TRUE;
timer -= 5;
}
}
else if warp/sig.c 644 171 5 7131 5121750157 5767 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.1 86/12/12 17:02:44 lwall
* Baseline for net release.
*
* Revision 7.0 86/10/08 15:13:24 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "play.h"
#include "score.h"
#include "term.h"
#include "util.h"
#include "INTERN.h"
#include "sig.h"
void
sig_init()
{
#ifdef lint
;
#else
sigignore(SIGINT); /* for inquiry of existence via kill call */
#ifdef SIGTTOU
sigignore(SIGTTOU);
#endif
sigset(SIGHUP, sig_catcher);
if (!debugging) {
sigset(SIGQUIT, sig_catcher);
sigset(SIGILL, sig_catcher);
sigset(SIGFPE, sig_catcher);
sigset(SIGBUS, sig_catcher);
sigset(SIGSEGV, sig_catcher);
sigset(SIGSYS, sig_catcher);
sigset(SIGTERM, sig_catcher);
}
#ifdef SIGXCPU
sigset(SIGXCPU, sig_catcher);
#endif
#ifdef SIGCONT
sigset(SIGCONT, cont_catcher);
#endif
#ifdef SIGTSTP
sigset(SIGTSTP, stop_catcher);
sigset(SIGSTOP, stop_catcher);
#endif
#endif /* lint */
}
#ifdef SIGTSTP
void
cont_catcher()
{
#ifndef lint
sigset(SIGCONT,cont_catcher);
#endif
savetty();
crmode();
raw();
noecho();
nonl();
}
#endif
void
mytstp()
{
resetty();
#ifdef SIGTSTP
kill(0,SIGTSTP);
#else
if (fork())
wait(0);
else {
char *shell = getenv("SHELL");
setuid(getuid());
if (!*shell)
shell = "/bin/sh";
execl(shell,shell,0);
exit(1);
}
#endif
rewrite();
}
void /* very much void */
finalize(status)
int status;
{
if (bizarre)
resetty();
if (status < 0) {
chdir("/usr/tmp");
sigset(SIGILL,SIG_DFL);
abort();
}
exit(status);
}
/* come here on signal other than interrupt, stop, or cont */
void
sig_catcher(signo)
{
#ifdef VERBOSE
static char *signame[] = {
"",
"HUP",
"INT",
"QUIT",
"ILL",
"TRAP",
"IOT",
"EMT",
"FPE",
"KILL",
"BUS",
"SEGV",
"SYS",
"PIPE",
"ALRM",
"TERM",
"???"
#ifdef SIGTSTP
,"STOP",
"TSTP",
"CONT",
"CHLD",
"TTIN",
"TTOU",
"TINT",
"XCPU",
"XFSZ"
#ifdef SIGPROF
,"VTALARM",
"PROF"
#endif
#endif
};
#endif
#ifdef SIGTTOU
#ifndef lint
sigignore(SIGTTOU);
#endif /* lint */
#endif
#ifdef DEBUGGING
if (debug) {
printf("\r\nSIG%s--game not saved in debug\r\n",signame[signo]);
finalize(-1);
}
#endif
panic++;
if (panic >= 2) {
if (panic >= 3)
abort();
chdir(SAVEDIR);
kill(0,SIGIOT);
}
(void) sigset(SIGILL,SIG_DFL);
if (signo == SIGHUP && (timer < 10 || didkill))
signo = SIGQUIT;
if (signo == SIGQUIT) { /* can't let them bomb out without penalty */
if (smarts < 20)
smarts += 4;
else if (smarts < 35)
smarts += 2;
else
smarts++;
totalscore -= possiblescore / 2;
}
save_game();
if (signo != SIGHUP && signo != SIGQUIT)
#ifdef VERBOSE
IF(verbose)
printf("\r\nCaught %s%s--%s\r\n",
signo ? "a SIG" : "an internal error", signame[signo],
experimenting ? "game saved" : "bye bye");
ELSE
#endif
#ifdef TERSE
printf("\r\nSignal %d--bye bye\r\n",signo);
#endif
switch (signo) {
case SIGBUS:
case SIGILL:
case SIGSEGV:
finalize(-signo);
}
finalize(1); /* and blow up */
}
#ifdef SIGTSTP
/* come here on stop signal */
void
stop_catcher()
{
if (!waiting) {
resetty(); /* this is the point of all this */
#ifdef DEBUGGING
if (debug)
write(2,"stop_catcher\r\n",13);
#endif
sigset(SIGTSTP,SIG_DFL); /* enable stop */
#ifdef BSD42
sigsetmask(sigblock(0) & ~(1 << (SIGTSTP-1)));
#endif
kill(0,SIGTSTP); /* and do the stop */
}
#ifndef lint
sigset(SIGTSTP,stop_catcher); /* unenable the stop */
#endif
}
#endif
igno);
}
finalize(1); /* and blow up */
}
#ifdef SIGTSTP
/* come here on stop signal */
void
stop_catcher()
{
if (!waiting) {
resetty(); /* this is the point of all this */
#ifdef DEBUGGING
if (debug)
write(2,"stop_catcher\r\n",13);
#endif
sigset(SIGTSTP,SIG_DFL); /* enable stop */
#ifdef BSD42
sigsetmask(sigblock(0) & ~(1 << (SIGTSTP-1)));
#endif
kill(0,SIGTSTP); /* and do the stop */
warp/bang.c 644 171 5 5472 5121750161 6115 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.3 86/12/12 16:57:00 lwall
* Made circular explosions.
*
* Revision 7.0.1.2 86/10/20 14:36:02 lwall
* Picked some lint.
*
* Revision 7.0.1.1 86/10/16 10:49:45 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:11:57 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "object.h"
#include "move.h"
#include "sig.h"
#include "term.h"
#include "them.h"
#include "INTERN.h"
#include "bang.h"
void
bang_init()
{
;
}
void
make_plink(y,x)
Reg1 int x;
Reg2 int y;
{
Reg3 OBJECT *obj;
move(y+1,x*2,0);
beg_qwrite();
*filler = '@';
qwrite();
obj = occupant[y][x];
if (obj) {
if (numamoebas && obj->image == ' ')
qaddc(amb[y][x]);
else
qaddc(obj->image);
}
else if (numamoebas)
qaddc(amb[y][x]);
else
qaddspace();
end_qwrite();
}
void
make_blast(y,x,mass,size)
Reg1 int x;
Reg2 int y;
int size;
long mass;
{
bangy[nxtbang] = y;
bangx[nxtbang] = x;
bangm[nxtbang] = mass;
bangs[nxtbang++] = size;
assert(nxtbang <= XSIZE * YSIZE);
if (numamoebas && amb[y][x] == '~') {
if (mass > 10000)
modify_amoeba(y,x,1,'~', 10);
else if (mass > 100)
modify_amoeba(y,x,1,'~', 5);
bangs[nxtbang-1] = 0; /* don't propagate */
return;
}
else if (mass >= 0) {
Reg3 OBJECT *obj;
move(y+1,x*2,0);
beg_qwrite();
*filler = '@';
qwrite();
*filler = '#';
qwrite();
*filler = '@';
qwrite();
*filler = '#';
qwrite();
*filler = '@';
qwrite();
obj = occupant[y][x];
if (obj) {
if (numamoebas && obj->image == ' ')
qaddc(amb[y][x]);
else
qaddc(obj->image);
}
else if (numamoebas)
qaddc(amb[y][x]);
else
qaddspace();
end_qwrite();
}
}
void
do_bangs()
{
Reg1 int x;
Reg2 int y;
Reg3 int i;
Reg4 int j;
Reg7 int k;
Reg5 int lastxy;
Reg6 OBJECT *obj;
/* read blast list and update blast array */
assert(nxtbang >= 0 && nxtbang <= XSIZE * YSIZE);
for (i=0; i<nxtbang; i++) {
if (bangm[i] != 32767)
bangm[i] *= 4;
lastxy = bangs[i] << 1;
if (lastxy >= MAXBDIST)
lastxy = MAXBDIST - 1;
for (y=bangy[i]-bangs[i],x=bangx[i]-bangs[i],j=lastxy;
j>=0;
y++,x++,--j) {
yblasted[yy[j] = (y+YSIZE00) % YSIZE] |= 1;
xblasted[xx[j] = (x+XSIZE00) % XSIZE] |= 1;
}
blasted = TRUE;
for (y=lastxy;y>=0;--y) {
for (x=lastxy;x>=0;--x) {
if (lastxy > 2) {
j = abs(y-bangs[i]);
k = abs(x-bangs[i]);
if (j < k) /* distance is long + 1/2 short */
j += k + k;
else
j += j + k;
if (--j > lastxy)
continue;
}
if (bangm[i] != 32767 ||
!(obj=occupant[yy[y]][xx[x]]) || obj->type != Web)
blast[yy[y]][xx[x]] += bangm[i];
}
}
}
}
d[yy[j] = (y+YSIZE00) % YSIZE] |= 1;
xblasted[xx[j] = (x+XSIZE00) % XSIZE] |= 1;
}
blasted = TRUE;
for (y=lastxy;y>=0;--y) {
for (x=lastxy;x>=0;--x) {
if (lastxy > 2) {
j = abs(warp/config.H 644 171 5 5101 5121750163 6407 /* config.h
* This file was produced by running the Configure script.
*
* Feel free to modify any of this as the need arises. Note, however,
* that running Configure again will wipe out any changes you've made.
*/
#/*undef EUNICE /* no file linking? */
#/*undef VMS /* other assorted ickies? */
/* how to cancel an article */
#define CANCEL "/usr/lib/news/inews -h <%h" /**/
#define FCNTL /* should we include fcntl.h? */
#define FTIMER /* do we have the ftime() routine? */
#define GETHOSTNAME /* do we have a gethostname function? */
#/*undef DOUNAME /* do we have a uname function? */
#/*undef PHOSTNAME "hostname" /* how to get host name with popen */
#/*undef GETPWENT /* need we include slow getpwent? */
#define HAVETERMLIB /* do we have termlib-style routines? */
#/*undef index strchr /* cultural */
#/*undef rindex strrchr /* differences? */
#define IOCTL /* are ioctl args all defined in one place? */
#define NORMSIG /* use signal rather than sigset? */
#/*undef PORTABLE /* do we do extra lookups to start up? */
#/*undef SCOREFULL /* keep scoreboard by fullname? */
#/*undef TERMIO /* is this a termio system? */
#/*undef USENDIR /* include ndir.c? */
#/*undef LIBNDIR /* include /usr/include/ndir.h? */
#/*undef vfork fork /* is vfork too virtual? */
#/*undef void int /* is void to be avoided? */
#define WHOAMI /* should we include whoami.h? */
#define PASSNAMES /* do names come from the passwd file? */
/* (undef to take name from ~/.fullname) */
#define BERKNAMES /* if so, are they Berkeley format? */
/* (that is, ":name,stuff:") */
#/*undef USGNAMES /* or are they USG format? */
/* (that is, ":stuff-name(stuff):") */
/* news library, may use only ~ and %l expansion */
#define NEWSLIB "/usr/lib/news" /**/
/* default shell--ok to be a slow shell like csh */
#define PREFSHELL "/bin/csh" /**/
/* warp private library, may use ~ expansion, %x and %l */
#define PRIVLIB "/a/lwall/src/warp" /**/
/* bits produced by the rand() function */
#define RANDBITS 31 /**/
/* How many register declarations are paid attention to? */
#define Reg1 register /**/
#define Reg2 register /**/
#define Reg3 register /**/
#define Reg4 register /**/
#define Reg5 register /**/
#define Reg6 register /**/
#define Reg7 /**/
#define Reg8 /**/
#define Reg9 /**/
#define Reg10 /**/
#define Reg11 /**/
#define Reg12 /**/
#define Reg13 /**/
#define Reg14 /**/
#define Reg15 /**/
#define Reg16 /**/
/* root uid */
#define ROOTID 0 /**/
/* name of the site. May be overridden by gethostname, uname, etc. */
#define SITENAME "sdcrdcf" /**/
Reg1 register /**/
#define Reg2 register /**/
#define Reg3 register /**/
#define Reg4 register /**/
#define Reg5 register /**/
#define Reg6 register /**/
#define Reg7 /**/
#define Reg8 /**/
#define Reg9 /**/
#define Reg10 /**/
#define Reg11 /**/
#define Reg12 /**/
#define Reg13 /**/
#define Reg14 /**/
#define Reg15 /**/
#define Reg16 /**/
/* root uid */
#define ROOTID 0 /**/
/* name of the site. May be overridden warp/ndir.c 644 171 5 4447 5121750165 6147 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
*
* $Log: warp9.tar,v $
* Revision 1.1.1.1 2019/05/29 04:56:34 root
* coherent
*
* Revision 7.0.1.1 86/12/12 17:01:02 lwall
* Baseline for net release.
*
* Revision 7.0 86/10/08 15:12:48 lwall
* Split into separate files. Added amoebas and pirates.
*
* Revision 4.3.1.3 85/05/23 11:19:24 lwall
* Oops, shouldn't have included sys/types.h again.
*
* Revision 4.3.1.2 85/05/15 14:46:00 lwall
* Changed short to ino_t, which may be ushort on some systems.
*
* Revision 4.3.1.1 85/05/10 11:35:34 lwall
* Branch for patches.
*
* Revision 4.3 85/05/01 11:42:55 lwall
* Baseline for release with 4.3bsd.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "INTERN.h"
#include "ndir.h"
#ifdef USENDIR
/*
* support for Berkeley directory reading routine on a V7 file system
*/
/*
* open a directory.
*/
DIR *
opendir(name)
char *name;
{
register DIR *dirp;
register int fd;
if ((fd = open(name, 0)) == -1)
return NULL;
if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
close (fd);
return NULL;
}
dirp->dd_fd = fd;
dirp->dd_loc = 0;
return dirp;
}
/*
* read an old style directory entry and present it as a new one
*/
#ifndef pyr
#define ODIRSIZ 14
struct olddirect {
ino_t od_ino;
char od_name[ODIRSIZ];
};
#else /* a Pyramid in the ATT universe */
#define ODIRSIZ 248
struct olddirect {
long od_ino;
short od_fill1, od_fill2;
char od_name[ODIRSIZ];
};
#endif
/*
* get next entry in a directory.
*/
struct direct *
readdir(dirp)
register DIR *dirp;
{
register struct olddirect *dp;
static struct direct dir;
for (;;) {
if (dirp->dd_loc == 0) {
dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf,
DIRBLKSIZ);
if (dirp->dd_size <= 0)
return NULL;
}
if (dirp->dd_loc >= dirp->dd_size) {
dirp->dd_loc = 0;
continue;
}
dp = (struct olddirect *)(dirp->dd_buf + dirp->dd_loc);
dirp->dd_loc += sizeof(struct olddirect);
if (dp->od_ino == 0)
continue;
dir.d_ino = dp->od_ino;
strncpy(dir.d_name, dp->od_name, ODIRSIZ);
dir.d_name[ODIRSIZ] = '\0'; /* insure null termination */
dir.d_namlen = strlen(dir.d_name);
dir.d_reclen = DIRSIZ(&dir);
return (&dir);
}
}
/*
* close a directory.
*/
void
closedir(dirp)
register DIR *dirp;
{
close(dirp->dd_fd);
dirp->dd_fd = -1;
dirp->dd_loc = 0;
free(dirp);
}
#endif /* USENDIR */
olddirect *)(dirp->dd_buf + dirp->dd_loc);
dirp->dd_loc += sizeof(struct olddirect);
if (dp->od_ino == 0)
continue;
dir.d_ino = dp->od_ino;
strncpy(dir.d_name, dp->od_name, ODIRSIZ);
dir.d_name[ODIRSIZ] warp/util.h 644 171 5 4150 5121750167 6166 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:14:37 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#if RANDBITS < 15 || defined(lint)
#define rand_mod(m) getpid()
#define RANDRAND 0.0
#define HALFRAND 0
#define myrand() getpid()
#else
#if RANDBITS == 15 /* 15 bits of rand()? */
#define RANDRAND 268435456.0 /* that's 2**28 */
#define HALFRAND 0x4000 /* that's 2**14 */
int rand();
#define myrand() (rand()&32767)
#define rand_mod(m) ((int)((double)myrand() / 32768.0 * ((double)(m))))
/* pick number in 0..m-1 */
#else
#if RANDBITS < 31 /* 16 bits of rand()? */
#define RANDRAND 1073741824.0 /* that's 2**30 */
#define HALFRAND 0x8000 /* that's 2**15 */
unsigned rand();
#define myrand() (rand()&65535)
#define rand_mod(m) ((int)((double)myrand() / 65536.0 * ((double)(m))))
/* pick number in 0..m-1 */
#else /* assume 31 bits */
#define RANDRAND 1152921504606846976.0 /* that's 2**60 */
#define HALFRAND 0x40000000 /* that's 2**30 */
long rand();
#define myrand() rand()
#define rand_mod(m) ((myrand() / 37) % (m)) /* pick number in 0..m-1 */
/*
* The reason for the /37 above is that our random number generator yields
* successive evens and odds, for some reason. This makes strange star maps.
*/
#endif
#endif
#endif
/* we get fractions of seconds from calling ftime on timebuf */
#ifdef FTIMER
EXT struct timeb timebuf;
#define roundsleep(x) (ftime(&timebuf),sleep(timebuf.millitm > 500?x+1:x))
#else
#define roundsleep(x) sleep(x)
#endif
void movc3();
void no_can_do();
int exdis();
EXT bool waiting INIT(FALSE); /* are we waiting for subprocess (in doshell)? */
#ifdef NOTDEF
EXT int len_last_line_got INIT(0);
/* strlen of some_buf after */
/* some_buf = get_a_line(bufptr,buffersize,fp) */
#endif
#ifdef NOTDEF
/* is the string for makedir a directory name or a filename? */
#define MD_DIR 0
#define MD_FILE 1
#endif
void util_init();
char *safemalloc();
char *safecpy();
char *cpytill();
char *instr();
#ifdef SETUIDGID
int eaccess();
#endif
char *getwd();
void cat();
void prexit();
char *savestr();
char *getval();
iting for subprocess (in doshell)? */
#ifdef NOTDEF
EXT int len_last_line_got INIT(0);
/* strlen of some_buf after */
/* some_buf = get_a_line(bufptr,buffersize,fp) */
#endif
#ifdef NOTDEF
/* is the string for makedir a directory name or a filename? */
#define MD_DIR 0
#define MD_FILE 1
#endif
void util_init();
char *safemalloc();
char *safecpy();
char *cpytill();
char *instr();
#ifdef SETUIDGIwarp/smp.0 644 171 5 3460 5121750171 5716 * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * warp/smp.1 644 171 5 3460 5121750172 5720 * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
* * * * warp/smp.6 644 171 5 3444 5121750174 5731 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * warp/ndir.h 644 171 5 3042 5121750176 6144 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
*
* $Log: warp9.tar,v $
* Revision 1.1.1.1 2019/05/29 04:56:34 root
* coherent
*
* Revision 7.0 86/10/08 15:12:52 lwall
* Split into separate files. Added amoebas and pirates.
*
* Revision 4.3.1.1 85/05/10 11:35:37 lwall
* Branch for patches.
*
* Revision 4.3 85/05/01 11:43:00 lwall
* Baseline for release with 4.3bsd.
*
*/
#ifdef LIBNDIR
# include <ndir.h>
#else
# ifndef USENDIR
# include <sys/dir.h>
# else
#ifndef DEV_BSIZE
#define DEV_BSIZE 512
#endif
#define DIRBLKSIZ DEV_BSIZE
#define MAXNAMLEN 255
struct direct {
long d_ino; /* inode number of entry */
short d_reclen; /* length of this record */
short d_namlen; /* length of string in d_name */
char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
};
/*
* The DIRSIZ macro gives the minimum record length which will hold
* the directory entry. This requires the amount of space in struct direct
* without the d_name field, plus enough space for the name with a terminating
* null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
*/
#undef DIRSIZ
#define DIRSIZ(dp) \
((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
/*
* Definitions for library routines operating on directories.
*/
typedef struct _dirdesc {
int dd_fd;
long dd_loc;
long dd_size;
char dd_buf[DIRBLKSIZ];
} DIR;
#ifndef NULL
#define NULL 0
#endif
extern DIR *opendir();
extern struct direct *readdir();
extern long telldir();
extern void seekdir();
#define rewinddir(dirp) seekdir((dirp), (long)0)
extern void closedir();
# endif
#endif
#undef DIRSIZ
#define DIRSIZ(dp) \
((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
/*
* Definitions for library routines operating on directories.
*/
typedef struct _dirdesc {
int dd_fd;
long dd_loc;
long dd_size;
char dd_buf[DIRBLKSIZ];
} DIR;
#ifndef NULL
#define NULL 0
#endif
extern DIR *opendir();
extern struct direct *readdir();
extern long telldir();
extern void seekdir();
#define rewinddir(dirp) seekdir((dirp), (long)0)
extern vwarp/object.h 644 171 5 2754 5121750200 6453 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.2 86/12/12 17:01:38 lwall
* Baseline for net release.
*
* Revision 7.0.1.1 86/10/16 10:52:30 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:13:04 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#define Root 0
#define Base 1
#define Enterprise 2
#define Star 3
#define Torp 4
#define Enemy 5
#define Web 6
#define Crusher 7
typedef struct object {
char posx, posy;
#ifdef SIGNEDCHAR
char velx, vely;
#else
short velx, vely;
#endif
struct object *next, *prev, *contend;
long energy;
long mass;
char type;
char image;
char strategy;
char flags;
} OBJECT;
#define PIRATE 1 /* we may mutiny */
#define FRIENDLY 2 /* we aren't really an enemy, for now */
#define STATIC 4 /* we are not in the movers list at the moment */
#define COUNTDOWN 8 /* we are counting down for something */
#define CLOAKS 16 /* we can cloak */
#ifdef DOINIT
OBJECT root = {0, 0, 0, 0, &root, &root, 0, 0, 0, Root, '?', 0, 0};
#else
EXT OBJECT root;
#endif
#ifdef DOINIT
OBJECT free_root = {0, 0, 0, 0, &free_root, &free_root, 0, 0, 0, Root, '?', 0, 0};
#else
EXT OBJECT free_root;
#endif
EXT OBJECT *ent;
EXT OBJECT *base;
EXT OBJECT *enemies;
EXT OBJECT *movers;
EXT OBJECT *realapollo;
EXT OBJECT *nuke;
EXT OBJECT *occupant[YSIZE][XSIZE];
OBJECT *make_object();
void unmake_object();
void free_object();
void object_init();
16 /* we can cloak warp/object.c 644 171 5 2744 5121750201 6446 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:12:55 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "EXTERN.h"
#include "warp.h"
#include "INTERN.h"
#include "object.h"
void
object_init()
{
;
}
OBJECT *
make_object(typ, img, py, px, vy, vx, energ, mas, where)
char typ;
char img;
int px, py, vx, vy;
long energ, mas;
OBJECT *where;
{
Reg1 OBJECT *obj;
if (free_root.next == &free_root)
#ifndef lint
obj = (OBJECT *) malloc(sizeof root);
#else
obj = Null(OBJECT*);
#endif
else {
obj = free_root.next;
free_root.next = obj->next;
obj->next->prev = &free_root;
}
obj->type = typ;
obj->image = img;
obj->next = where;
obj->prev = where->prev;
where->prev = obj;
obj->prev->next = obj;
obj->velx = vx;
obj->vely = vy;
obj->contend = 0;
obj->strategy = 0;
obj->flags = 0;
obj->posx = px;
obj->posy = py;
if (typ != Torp && typ != Web) {
occupant[py][px] = obj;
}
obj->energy = energ;
obj->mass = mas;
return(obj);
}
void
unmake_object(curobj)
Reg1 OBJECT *curobj;
{
curobj->prev->next = curobj->next;
curobj->next->prev = curobj->prev;
if (curobj == movers) {
movers = curobj->next;
}
free_object(curobj);
}
void
free_object(curobj)
Reg1 OBJECT *curobj;
{
curobj->next = free_root.next;
curobj->prev = &free_root;
free_root.next->prev = curobj;
free_root.next = curobj;
}
orp && typ != Web) {
occupawarp/sm.c 644 171 5 2661 5121750203 5617 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:13:35 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include <stdio.h>
#include <ctype.h>
#include "config.h"
main()
{
char screen[23][90], buf[10];
Reg1 int y;
Reg2 int x;
int tmpy, tmpx;
for (x=0; x<79; x++)
screen[0][x] = ' ';
screen[0][79] = '\0';
fgets(screen[0],90,stdin);
if (isdigit(screen[0][0])) {
int numstars = atoi(screen[0]);
for (y=0; y<23; y++) {
for (x=0; x<79; x++)
screen[y][x] = ' ';
screen[y][79] = '\0';
}
for ( ; numstars; numstars--) {
scanf("%d %d\n",&tmpy,&tmpx);
y = tmpy;
x = tmpx;
screen[y][x+x] = '*';
}
for (y=0; y<23; y++) {
printf("%s\n",screen[y]);
}
}
else {
Reg3 int numstars = 0;
for (y=1; y<23; y++) {
for (x=0; x<79; x++)
screen[y][x] = ' ';
screen[y][79] = '\0';
}
for (y=1; y<23; y++) {
fgets(screen[y],90,stdin);
}
for (y=0; y<23; y++) {
for (x=0; x<80; x += 2) {
if (screen[y][x] == '*') {
numstars++;
}
else if (screen[y][x] == '\t' || screen[y][x+1] == '\t') {
fprintf(stderr,"Cannot have tabs in starmap--please expand.\n");
exit(1);
}
}
}
printf("%d\n",numstars);
for (y=0; y<23; y++) {
for (x=0; x<80; x += 2) {
if (screen[y][x] == '*') {
printf("%d %d\n",y,x/2);
}
}
}
}
exit(0);
}
;
}
for (y=1; y<23; y++) {
fgets(screen[y],90,stdin);
}
for (y=0; ywarp/smp.4 644 171 5 2601 5121750204 5713 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * *warp/makedir.SH 644 171 5 2354 5121750206 6706 case $CONFIG in
'') . config.sh ;;
esac
echo "Extracting makedir (with variable substitutions)"
$spitshell >makedir <<!GROK!THIS!
$startsh
# $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
#
# $Log: warp9.tar,v $
# Revision 1.1.1.1 2019/05/29 04:56:34 root
# coherent
#
# Revision 7.0 86/10/08 15:12:34 lwall
# Split into separate files. Added amoebas and pirates.
#
# Revision 4.3.1.1 85/05/10 11:35:14 lwall
# Branch for patches.
#
# Revision 4.3 85/05/01 11:42:31 lwall
# Baseline for release with 4.3bsd.
#
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
case \$# in
0)
$echo "makedir pathname filenameflag"
exit 1
;;
esac
: guarantee one slash before 1st component
case \$1 in
/*) ;;
*) set ./\$1 \$2 ;;
esac
: strip last component if it is to be a filename
case X\$2 in
X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
*) set \$1 ;;
esac
: return reasonable status if nothing to be created
if $test -d "\$1" ; then
exit 0
fi
list=''
while true ; do
case \$1 in
*/*)
list="\$1 \$list"
set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
;;
*)
break
;;
esac
done
set \$list
for dir do
$mkdir \$dir >/dev/null 2>&1
done
!GROK!THIS!
$eunicefix makedir
chmod 755 makedir
t ./\$1 \$2 ;;
esac
: strip last component if it is to be a filename
case X\$2 in
X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
*) set \$1 ;;
esac
: return reasonable status if nothing to be created
if $test -d "\$1" ; then
exit 0
fi
list=''
while true ; warp/smp.2 644 171 5 2167 5121750207 5723 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * * warp/us.h 644 171 5 2112 5121750211 5622 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0.1.1 86/10/16 10:53:58 lwall
* Added Damage. Fixed random bugs.
*
* Revision 7.0 86/10/08 15:14:27 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
EXT bool cloaking;
EXT bool cloaked;
EXT int status;
EXT int entmode;
EXT int evely;
EXT int evelx;
EXT int bvely;
EXT int bvelx;
#define MAXDAMAGE 9
#define NOWARP 0
#define NOIMPULSE 1
#define NOPHASERS 2
#define NOTORPS 3
#define NOCLOAKING 4
#define NOSHIELDS 5
#define NOZAPPER 6
#define NODESTRUCT 7
#define NOTRACTORS 8
EXT int dam INIT(0);
EXT int lastdam INIT(-1);
EXT int damage INIT(0);
EXT int olddamage INIT(-1);
#ifdef DOINIT
char *dammess[MAXDAMAGE] = {
"WARP",
"IMPULSE",
"PHASERS",
"TORPS",
"CLOAKING",
"SHIELDS",
"ZAPPER",
"DESTRUCT",
"TRACTORS"
};
char damflag[MAXDAMAGE] = {0,0,0,0,0,0,0,0,0};
#else
extern char *dammess[];
extern char damflag[];
#endif
void do_direction();
void ctrl_direction();
void shift_direction();
void get_commands();
void us_init();
#define NOTRACTORS 8
EXT int dam INIT(0);
EXT int lastdam INIT(-1);
EXT int damage INIT(0);
EXT int olddamage INIT(-1);
#ifdef DOINIT
char *dammess[MAXDAMAGE] = {
"WARP",
"IMPULSE",
"PHASERS",
"TORPS",
"CLOAKING",
"SHIELDS",
"ZAPPER",
"DESTRUCT",
"TRACTORS"
};
char damflag[MAXDAMAGE] = {0,0,0,0,0,0,0,0,0};
#else
extern char *dammess[];
extern char damflag[];
#endif
void do_direction();
void ctrl_warp/bang.h 644 171 5 1106 5121750212 6105 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:12:03 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
EXT long blast[YSIZE][XSIZE];
EXT bool blasted;
EXT bool xblasted[XSIZE];
EXT bool yblasted[YSIZE];
EXT char bangy[YSIZE*XSIZE];
EXT char bangx[YSIZE*XSIZE];
EXT char bangs[YSIZE*XSIZE];
EXT long bangm[YSIZE*XSIZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT int yy[MAXBDIST];
EXT int nxtbang;
EXT bool banging;
void make_plink();
void make_blast();
void do_bangs();
void bang_init();
ng.h,v $
* Revision 7.0 86/10/08 15:12:03 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
EXT long blast[YSIZE][XSIZE];
EXT bool blasted;
EXT bool xblasted[XSIZE];
EXT bool yblasted[YSIZE];
EXT char bangy[YSIZE*XSIZE];
EXT char bangx[YSIZE*XSIZE];
EXT char bangs[YSIZE*XSIZE];
EXT long bangm[YSIZE*XSIZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT int yy[MAXBDIST];
EXT int nxtbang;
EXT bool banging;
voiwarp/EXTERN.h 644 171 5 622 5121750213 6166 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
*
* $Log: warp9.tar,v $
* Revision 1.1.1.1 2019/05/29 04:56:34 root
* coherent
*
* Revision 7.0.1.1 86/12/12 16:46:50 lwall
* Guarded the undefs.
*
* Revision 7.0 86/10/08 15:11:31 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#ifdef EXT
#undef EXT
#endif
#define EXT extern
#ifdef INIT
#undef INIT
#endif
#define INIT(x)
#ifdef DOINIT
#undef DOINIT
#endif
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ���warp/version.c 644 171 5 622 5121750215 6643 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
*
* $Log: warp9.tar,v $
* Revision 1.1.1.1 2019/05/29 04:56:34 root
* coherent
*
* Revision 7.0 86/10/08 15:14:39 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#include "patchlevel.h"
#include "INTERN.h"
#include "version.h"
/* Print out the version number. */
void
version()
{
extern char rcsid[];
printf("%s\r\nPatch level: %d\r\n", rcsid, PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ���warp/weapon.h 644 171 5 602 5121750216 6453 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:18:20 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
EXT int tractor INIT(0);
EXT int etorp;
EXT int btorp;
EXT OBJECT *isatorp[2][3][3];
EXT int aretorps;
void fire_torp();
void attack();
void fire_phaser();
int tract();
void weapon_init();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ���warp/INTERN.h 644 171 5 573 5121750217 6171 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
*
* $Log: warp9.tar,v $
* Revision 1.1.1.1 2019/05/29 04:56:34 root
* coherent
*
* Revision 7.0.1.1 86/12/12 16:51:45 lwall
* Guarded the undefs.
*
* Revision 7.0 86/10/08 15:11:37 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
#ifdef EXT
#undef EXT
#endif
#define EXT
#ifdef INIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ���warp/sig.h 644 171 5 500 5121750220 5734 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:13:32 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
void sig_catcher();
#ifdef SIGTSTP
void cont_catcher();
void stop_catcher();
#endif
void mytstp();
void sig_init();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ~��warp/move.h 644 171 5 450 5121750222 6126 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:12:46 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
void bounce();
void move_universe();
int lookaround();
int lookfor();
OBJECT *lookimg();
void move_init();
nit();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ��warp/smp.3 644 171 5 437 5121750227 5704 * * * *
* * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * *
* * * *
_init();
nit();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ~��warp/play.h 644 171 5 404 5121750230 6123 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:13:12 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
EXT int finish INIT(0);
EXT int timer;
void play();
void play_init();
* * * *
_init();
nit();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ��warp/them.h 644 171 5 372 5121750231 6120 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:14:19 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
void their_smarts();
void modify_amoeba();
void them_init();
y_init();
* * * *
_init();
nit();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ��warp/version.h 644 171 5 322 5121750233 6645 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $
*
* $Log: warp9.tar,v $
* Revision 1.1.1.1 2019/05/29 04:56:34 root
* coherent
*
* Revision 7.0 86/10/08 15:14:43 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
void version();
void modify_amoeba();
void them_init();
y_init();
* * * *
_init();
nit();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ���warp/init.h 644 171 5 320 5121750234 6122 /* $Header: /var/lib/cvsd/repos/coherent/coherent/a/usr/spool/uucppublic/warp9.tar,v 1.1.1.1 2019/05/29 04:56:34 root Exp $ */
/* $Log: warp9.tar,v $
/* Revision 1.1.1.1 2019/05/29 04:56:34 root
/* coherent
/*
* Revision 7.0 86/10/08 15:12:17 lwall
* Split into separate files. Added amoebas and pirates.
*
*/
void initialize();
;
void modify_amoeba();
void them_init();
y_init();
* * * *
_init();
nit();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ��warp/smp.5 644 171 5 255 5121750235 5703 * * *
* *
* * *
* * *
* *
* * *
rates.
*
*/
void initialize();
;
void modify_amoeba();
void them_init();
y_init();
* * * *
_init();
nit();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ~��warp/warp.news 644 171 5 210 5121750236 6655 *** WARP NEWS ***
Welcome to warp! Please send any gripes, comments, fantastic ideas, etc.
to [email protected] (Larry Wall).
* * *
rates.
*
*/
void initialize();
;
void modify_amoeba();
void them_init();
y_init();
* * * *
_init();
nit();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ���warp/patchlevel.h 644 171 5 25 5121750237 7273 #define PATCHLEVEL 2
***
Welcome to warp! Please send any gripes, comments, fantastic ideas, etc.
to [email protected] (Larry Wall).
* * *
rates.
*
*/
void initialize();
;
void modify_amoeba();
void them_init();
y_init();
* * * *
_init();
nit();
void finalize();
NIT
#undef INIT
#endif
#define INIT(x) = x
#define DOINIT
nit();
PATCHLEVEL);
}
ZE];
#define MAXBDIST 40
EXT int xx[MAXBDIST];
EXT in �m@ T];
@��[H 1; ���warp/UU/myread 755 171 5 424 5162423514 6556 ans='!'
while expr "X$ans" : "X!" >/dev/null; do
read ans
case "$ans" in
!)
sh
echo " "
echo "$rp \c"
;;
!*)
set `expr "X$ans" : "X!\(.*\)$"`
sh -c "$*"
echo " "
echo "$rp \c"
;;
esac
done
rp='Your answer:'
case "$ans" in
'') ans="$dflt";;
esac
�m@ ���}: {��y��1; :��warp/UU/filexp 755 171 5 1126 5162423565 6612 : use /bin/sh
: expand filename
case "$1" in
~/*|~)
echo $1 | sed "s|~|${HOME-$LOGDIR}|"
;;
~*)
if test -f /bin/csh; then
/bin/csh -f -c "glob $1"
echo ""
else
name=`expr x$1 : '..\([^/]*\)'`
dir=`sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
if test ! -d "$dir"; then
me=`basename $0`
echo "$me: can't locate home directory for: $name" >&2
exit 1
fi
case "$1" in
*/*)
echo $dir/`expr x$1 : '..[^/]*/\(.*\)'`
;;
*)
echo $dir
;;
esac
fi
;;
*)
echo $1
;;
esac
DIR}|"
;;
~*)
if test -f /bin/csh; then
/bin/csh -f -c "glob $1"
echo ""
else
name=`expr x$1 : '..\([^/]*\)'`
dir=`sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
if test ! -d "$dir"; then
me=`basename $0`
echo "$me: can't locate home directory for: $name" >&2
exit 1
fi
case "$1" in
*/*)
echo $dir/`expr x$1 : '..[^/]*/\(.*\warp/UU/grimble 644 0 1 6761 5162423567 6700 _addch.o
_addchnstr.o
_addchstr.o
_addnstr.o
_addstr.o
_attroff.o
_attron.o
_attrset.o
_beep.o
_bkgd.o
_bkgdset.o
_border.o
_box.o
_clear.o
_clrtobot.o
_clrtoeol.o
_crmode.o
_del_curterm.o
_delch.o
_deleteln.o
_echo.o
_echochar.o
_erase.o
_fixterm.o
_flash.o
_garbagedwin.o
_garbagdlins.o
_getch.o
_getstr.o
_halfdelay.o
_hline.o
_inch.o
_inchnstr.o
_inchstr.o
_innstr.o
_insch.o
_insdelln.o
_insertln.o
_insnstr.o
_insstr.o
_instr.o
_intrflush.o
_meta.o
_move.o
_mvaddchnstr.o
_mvaddch.o
_mvaddchstr.o
_mvaddnstr.o
_mvaddstr.o
_mvdelch.o
_mvgetch.o
_mvgetstr.o
_mvhline.o
_mvinch.o
_mvinchnstr.o
_mvinchstr.o
_mvinnstr.o
_mvinsch.o
_mvinsnstr.o
_mvinsstr.o
_mvinstr.o
_mvvline.o
_mvwaddchnst.o
_mvwaddchstr.o
_mvwaddch.o
_mvwaddnstr.o
_mvwaddstr.o
_mvwdelch.o
_mvwgetch.o
_mvwgetstr.o
_mvwhline.o
_mvwinch.o
_mvwinchnst.o
_mvwinchstr.o
_mvwinnstr.o
_mvwinsch.o
_mvwinsnstr.o
_mvwinsstr.o
_mvwinstr.o
_mvwvline.o
_newterm.o
_nl.o
_nocrmode.o
_noecho.o
_nonl.o
_noqiflush.o
_overlay.o
_overwrite.o
_qiflush.o
_refresh.o
_resetterm.o
_saveterm.o
_scr_init.o
_scr_restore.o
_scr_set.o
_scrl.o
_scroll.o
_set_curterm.o
_set_term.o
_setscrreg.o
_slk_init.o
_standend.o
_standout.o
_subpad.o
_timeout.o
_touchline.o
_unctrl.o
_vline.o
_waddchstr.o
_waddstr.o
_wclear.o
_wdeleteln.o
_werase.o
_winsertln.o
_winsstr.o
_wstandend.o
_wstandout.o
V2._sprintw.o
V2.__sscans.o
V2.makenew.o
V3.box.o
V3.initscr.o
V3.m_addch.o
V3.m_addstr.o
V3.m_clear.o
V3.m_erase.o
V3.m_initscr.o
V3.m_move.o
V3.m_newterm.o
V3.m_refresh.o
V3.newterm.o
V3.pechochar.o
V3.upd_old_y.o
V3.vidattr.o
V3.vidputs.o
V3.waddch.o
V3.wattroff.o
V3.wattron.o
V3.wattrset.o
V3.wechochar.o
V3.winsch.o
baudrate.o
cbreak.o
chkinput.o
clearok.o
copywin.o
curs_set.o
curserr.o
curses.o
def_prog.o
delay.o
delay_out.o
delkey.o
delkeymap.o
delscreen.o
delterm.o
delwin.o
derwin.o
doupdate.o
draino.o
dupwin.o
endwin.o
erasechar.o
flushinp.o
getattrs.o
getbegyx.o
getbkgd.o
getmaxyx.o
getparyx.o
getsyx.o
gettmode.o
getwin.o
getyx.o
has_ic.o
has_il.o
idcok.o
idlok.o
immedok.o
init_acs.o
init_costs.o
initscr.o
is_linetou.o
is_wintou.o
keyname.o
keypad.o
killchar.o
leaveok.o
longname.o
makenew.o
memSset.o
meta.o
mvcur.o
mvderwin.o
mvprintw.o
mvscanw.o
mvwin.o
mvwprintw.o
mvwscanw.o
napms.o
newkey.o
newpad.o
newscreen.o
newwin.o
nocbreak.o
nodelay.o
noraw.o
notimeout.o
outch.o
overlap.o
pechochar.o
pnoutref.o
prefresh.o
printw.o
putp.o
putwin.o
quick_echo.o
raw.o
redrawwin.o
reset_sh.o
resetty.o
restart.o
ring.o
ripoffline.o
savetty.o
scanw.o
scr_all.o
scr_dump.o
scr_ll_dump.o
scr_reset.o
scrollok.o
setcurscreen.o
setcurterm.o
setecho.o
setkeymap.o
setnonl.o
setqiflush.o
setsyx.o
setterm.o
setupterm.o
slk_atroff.o
slk_atron.o
slk_atrset.o
slk_clear.o
slk_label.o
slk_noutref.o
slk_refresh.o
slk_restore.o
slk_set.o
slk_start.o
slk_touch.o
subwin.o
syncok.o
tcsearch.o
termattrs.o
termcap.o
termerr.o
termname.o
tgetch.o
tgoto.o
tifget.o
tifnames.o
tiget.o
tinames.o
tinputfd.o
tnames.o
touchwin.o
tparm.o
tputs.o
trace.o
tstp.o
ttimeout.o
typeahead.o
unctrl.o
ungetch.o
untouchwin.o
vidputs.o
vidupdate.o
vsscanf.o
vwprintw.o
vwscanw.o
waddch.o
waddchnstr.o
waddnstr.o
wattroff.o
wattron.o
wattrset.o
wbkgd.o
wbkgdset.o
wborder.o
wclrtobot.o
wclrtoeol.o
wdelch.o
wechochar.o
wgetch.o
wgetstr.o
whline.o
winch.o
winchnstr.o
winchstr.o
winnstr.o
winsch.o
winsdelln.o
winsnstr.o
winstr.o
wmove.o
wnoutref.o
wprintw.o
wredrawln.o
wrefresh.o
wscanw.o
wscrl.o
wsetscrreg.o
wsyncdown.o
wsyncup.o
wtimeout.o
wtouchln.o
wvline.o
can_change.o
color_cont.o
init_color.o
init_pair.o
has_colors.o
pair_cont.o
start_col.o
update.o
vsscanwarp/UU/core 644 0 1 220000 5162423605 6220 �[�� �"��Р�Р�Р � � <�Аc��U� �I� �U� ��U� @(� ��� �Р�Р�Р � � ���0�Ѐ
Р�� � � ����f���� �I� ��Ѐ
� � � ����f���� �I� ���@���� � �<(� h^� �u� ���0��@� � < �lw�0��X�� 0���u�h ��]�0��� �$�
� �������x ��x ���� ` ` ���� � � ���� ��� j�X +м�� �H� �n#� ��Ѐ
� N#� �n#� ���
�+�$ �G� g$� (� � N#� ����G��G�D
��"��G�*�x
�F���G� � (�d � @ �� x
�v��*�d ��
���*� �*�d �(�� $�� /shlib libc_s �� ���Є9� �� �
�;core �G��
� �(r�(r�D �+��0 �d ��f��f�
core 300 9�� ��
�H � � /usr bin awk b/libjobs.a �� �h�
�D�
� � �b� �]B� v� [���� $ ���f'�$ ����� � `�` �� �v�p �T � �� f'�X� � ���Є@Ѐ� �cР �]B� lU)� � ���� � � \���f�(�� �I� (�Ѐ
�
���� � ��� �� ����� � `�`� � � <���f��c� �I� �c�@��c� d
�<(� h^� � � ����f���� �I� ��Ѐ
���� �
�<(� h^� �u� ���0��@� � �
�lw�0��X�� 0���u� ��]�0��� �$�
� �f�4 �]B� �З�x L �����L ����� � ` +�r� �F� g$�Si �9Є �])� (� � �!�ШF� (r� N#� �F�� ��"ШF�(r� �,�ШFИ_�h��(r��_гn#�+�r� �F� g$И_�(rШFИ_�H ���� � (� �fЈ3 �(r� � 9i �9�x �A�(r��f��f�
�� ���fЌ �K>�
� �{�� 8� � 8� � � ��д � $��� � J �� � �� �� � �
o ��� awk $6 != "" {print substr($6,2,100)} le � �8� �8�
Ш �| �t�� �f�H � �@ � *� ��
� libc_s 9300 � � ��@ �H@ � � B`� �J "� x ܇ `= H hy Z H h @ � �J! awk ym29300 �'�)�!� 2 2 � � � � hI ���m eI ���] � � \*X �� �C��G�4D� �` �` �` B!� f� H �
� ༔��f�` X ` ` @ h ��������������������������������������������������������������������������������������������������������������������������������X��\X���� �� � �� � �� |� �@� ������ 0 1 2 4 5 7 8 < ( + - / I J K L { ���� ���� �������� ����' g ; g ���� ����1 g ; g ���� ����W g ; g ���� ����X g ; g ���� ����f g ; g ���� ����i g ; g ���� ����� g ; g ���� ����� ; g ���� ����� g ; g ���� ����� g ; g ���� ����� ) g ���� ����� ) g ���� ����� g ; g ���� ����� g ; g ���� ����� g ; g ���� 7 ! # E C D � � � � "