|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 17604 (0x44c4)
Types: TextFile
Names: »patches01«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Tess/patches01«
*** tess2/parser.c Mon Dec 12 17:34:04 1988
--- tess/parser.c Tue Dec 13 23:30:25 1988
***************
*** 33,43 ****
--- 33,76 ----
*str = tolower (*str);
return (orig);
}
+
+ int intlwr(c)
+ int c;
+
+ {
+ return (c = (isupper(c)) ? tolower(c) : c);
+ }
+
/*----------------------- END of additions for portable version. */
+ char *trapEOF(s,stream)
+ char *s;
+ FILE *stream;
+ {
+ if (s == NULL) {
+ if (feof(stream)) {
+ prints("(EOF)");
+ exit(1);
+ } else {
+ perror("fgets: ");
+ exit(1);
+ }
+ }
+ return(s);
+ }
+ strip_nl(s)
+ char *s;
+ {
+ auto int i;
+ i = strlen(s);
+ if (*(s+i-1)=='\n') *(s+i-1) = '\0'; /* fgets is safer, but imbeds \n */
+ }
+
+ #define eofgets(st, nu, fi) trapEOF(fgets(st,nu,fi), fi)
+
#define v_sig 4 /* 1st 4 letters of vocab words significant */
#define max_cmd_size 64 /* at most 63 chars per command */
***************
*** 88,99 ****
q = strchr( cm, '\0'); /* get last char */
if (!p) p = q; /* if 1 word, set ptr */
! strncat( verb, cm, min(p-cm, max_word_len) );
if (*p) /* if >1 word */
{
while (*p && *p==' ') p++; /* skip lead blanks */
! strncat( noun, p, min(q-p, max_word_len) );
}
}
--- 121,132 ----
q = strchr( cm, '\0'); /* get last char */
if (!p) p = q; /* if 1 word, set ptr */
! (void)strncat( verb, cm, min(p-cm, max_word_len) );
if (*p) /* if >1 word */
{
while (*p && *p==' ') p++; /* skip lead blanks */
! (void)strncat( noun, p, min(q-p, max_word_len) );
}
}
***************
*** 105,112 ****
char *s;
{
int i;
!
! for ( i=strlen(s); i<v_sig; i++ )
*(s+i) = ' ';
*(s+v_sig)='\0';
}
--- 138,145 ----
char *s;
{
int i;
!
! for (i = strlen(s); i<v_sig; i++ )
*(s+i) = ' ';
*(s+v_sig)='\0';
}
***************
*** 118,127 ****
char *w;
vocab_type *voc;
{
! int wn,i;
v_word sh_word;
! strcpy( sh_word, w );
resize_word( sh_word );
for ( wn=0; *voc->name; voc++ )
{
--- 151,160 ----
char *w;
vocab_type *voc;
{
! int wn;
v_word sh_word;
! (void)strcpy( sh_word, w );
resize_word( sh_word );
for ( wn=0; *voc->name; voc++ )
{
***************
*** 159,165 ****
int nn;
cprintf( prompt );
! gets( noun );
nn = GetNounNum( noun );
resize_word( noun );
return( nn );
--- 192,198 ----
int nn;
cprintf( prompt );
! strip_nl(eofgets(noun,max_word_size,stdin));
nn = GetNounNum( noun );
resize_word( noun );
return( nn );
***************
*** 172,186 ****
CmdRec *cmd;
{
ParseCommand( cmd->cm, cmd->verb, cmd->noun );
! strlwr( cmd->verb );
! strlwr( cmd->noun );
cmd->vn = GetVerbNum( cmd->verb );
cmd->nn = GetNounNum( cmd->noun );
! strcpy( cmd->sh_verb, cmd->verb );
! resize_word( cmd->sh_verb );
! strcpy( cmd->sh_noun, cmd->noun );
! resize_word( cmd->sh_noun );
}
--- 205,219 ----
CmdRec *cmd;
{
ParseCommand( cmd->cm, cmd->verb, cmd->noun );
! (void)strlwr( cmd->verb );
! (void)strlwr( cmd->noun );
cmd->vn = GetVerbNum( cmd->verb );
cmd->nn = GetNounNum( cmd->noun );
! (void)strcpy(cmd->sh_verb, cmd->verb);
! resize_word(cmd->sh_verb);
! (void)strcpy(cmd->sh_noun, cmd->noun);
! resize_word(cmd->sh_noun);
}
*** tess.1 Mon Dec 12 11:17:07 1988
--- tess/tess.1 Mon Dec 12 11:32:34 1988
***************
*** 3,7 ****
tess - beyond the tesseract, an abstract adventure
.SH SYNOPSIS
! tess
.SH DESCRIPTION
.SH Scenario:
--- 3,7 ----
tess - beyond the tesseract, an abstract adventure
.SH SYNOPSIS
! tess [-f]
.SH DESCRIPTION
.SH Scenario:
***************
*** 23,26 ****
--- 23,28 ----
of each word are significant. The adventure recognizes about 200 words,
so if one word doesn't work, try another.
+ .SH OPTIONS
+ -f Fast start-up; skip title, scenario and instructions.
.SH Notes:
.LP
*** tess2/tess.c Mon Dec 12 17:34:09 1988
--- tess/tess.c Wed Dec 14 00:14:55 1988
***************
*** 7,15 ****
/*
Portable version V2.0p By Dennis Lo 10/30/88
This version can compile with Datalight C 2.20, Microsoft C 5.0,
! QuickC 1.0, Turbo C 1.5, Unix cc (SunOs 3.?), and GNU cc.
- Changed ANSI-style function parameter declarations to K & R-style.
- Removed #include <string.h> and added the string routines
--- 7,18 ----
/*
Portable version V2.0p By Dennis Lo 10/30/88
+ V2.1p patches by Dave Lawrence 12/14/88
+ (fixed probability read, pass by
+ long screens, EOF endless loops)
This version can compile with Datalight C 2.20, Microsoft C 5.0,
! QuickC 1.0, Turbo C 1.5, Unix cc (SunOs 3.?), GNU cc and *C87.
- Changed ANSI-style function parameter declarations to K & R-style.
- Removed #include <string.h> and added the string routines
***************
*** 31,40 ****
--- 34,48 ----
will use Turbo-C screen manipulation library routines. ******/
#define tty
+ /****** quick alias for *C87 on MTS; loader only recognizes 8 chars. ****/
+ #define goto_new_lev GoNewLev
+ #define goto_new_loc GoNewLoc
#include <ctype.h>
/*#include <string.h>*/
#include <stdio.h>
+ extern char *strcpy(), *strncat(), *strcat();
+ extern int strcmp();
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
***************
*** 46,61 ****
*/
nl() { putchar('\n'); }
- /*----------------------------*/
- int get_enter()
- {
- int i=0, ch;
- while ((ch=getchar()) != '\n')
- i+=ch;
- return (i);
- }
-
/*----------------------------*/
/* if tty-mode, then using standard library functions for I/O, and ignore the
screen I/O functions
--- 54,60 ----
***************
*** 62,69 ****
*/
#ifdef tty
! # define cprintf printf
! # define cputs printf
# define prints puts
# define clrscr()
--- 61,68 ----
*/
#ifdef tty
! # define cprintf (void)printf
! # define cputs (void)printf
# define prints puts
# define clrscr()
***************
*** 88,93 ****
--- 87,93 ----
#include "tess-def.c"
#include "parser.c"
+ #include <sys/time.h>
/*------------------------------------------------------------*/
***************
*** 126,131 ****
--- 126,133 ----
InitAdv()
{
int i;
+ struct timeval tp;
+ struct timezone tzp;
for ( i=1; i<MaxObjs; i++ )
{
***************
*** 141,146 ****
--- 143,153 ----
zap = cc = wa = ep = dr = af = gp = mi = ti = kp = 0;
+ if (gettimeofday(&tp,&tzp)==-1) {
+ perror("gettimeofday");
+ exit(1);
+ }
+ (void)srand ((int)tp.tv_sec);
for ( sum=0, i=0; i<3; i++ )
sum += (dc [i] = rand() & 31);
***************
*** 454,461 ****
for ( i=1; i<MaxObjs; i++ )
if ( ObjOnPlayer(i) )
{
! strcpy( s, obj[i].name );
! if (WearingObj(i)) strcat( s, " (wearing)" );
len = strlen(s);
if (currx+ len + 3 > 78 ) { currx=0; nl(); }
cprintf(" %s.", s );
--- 461,468 ----
for ( i=1; i<MaxObjs; i++ )
if ( ObjOnPlayer(i) )
{
! (void)strcpy ( s, obj[i].name );
! if (WearingObj(i)) (void)strcat( s, " (wearing)" );
len = strlen(s);
if (currx+ len + 3 > 78 ) { currx=0; nl(); }
cprintf(" %s.", s );
***************
*** 472,478 ****
/*----------------------------*/
do_get()
{
! int where, attr, i, get_flag;
char s[16], *p;
if (ObjOnPlayer(cmd.nn))
--- 479,485 ----
/*----------------------------*/
do_get()
{
! int i, get_flag;
char s[16], *p;
if (ObjOnPlayer(cmd.nn))
***************
*** 529,539 ****
else if (cmd.nn==o_improb) /* improbability */
{
cprintf("What is the probability of getting this improbability? ");
! gets( s );
! p = strchr( s, '.' ); /* skip past decimal point */
! if (p) p++;
! i = atoi( p );
! if (i!=sum && i*10!=sum)
{
prints("Wrong.");
get_flag = 0;
--- 536,548 ----
else if (cmd.nn==o_improb) /* improbability */
{
cprintf("What is the probability of getting this improbability? ");
! strip_nl(eofgets(s,16,stdin));
! if ((p=strchr(s,'.')) && atoi(s)==0)
! i = atoi(p + 1);
! else if (p = strchr(s,'/')) i = (i = atoi(p+1)) ?
! atoi(s)/(float)i * 100 : atoi(s);
! else i = atoi(s);
! if (i!=sum)
{
prints("Wrong.");
get_flag = 0;
***************
*** 551,557 ****
/*----------------------------*/
do_drop()
{
! int where, i;
if (ObjInRoom(cmd.nn))
prints("It's already here.");
--- 560,566 ----
/*----------------------------*/
do_drop()
{
! int i;
if (ObjInRoom(cmd.nn))
prints("It's already here.");
***************
*** 589,596 ****
/*----------------------------*/
do_throw()
{
- char *s;
-
if (ObjInRoom(cmd.nn))
prints("It's already here.");
--- 598,603 ----
***************
*** 1509,1533 ****
char s[80];
cprintf("Filename to save game to: ");
! gets( s );
! if (!*s) return;
f=fopen(s,"w");
if (f)
{
for ( i=1; i<MaxObjs; i++ )
! fprintf( f, "%d ", obj[i].loc );
! fprintf( f, "%d %d %d %d %d %d ",
curr_lev, curr_loc,
level_loc[1], level_loc[2], level_loc[3], sleep_lev );
! fprintf( f, "%d %d %d %d %d %d %d %d %d %d %d %d ",
cc, wa, ep, dr, af, gp, mi, ti, kp, dc[0], dc[1], dc[2] );
putc( '\n', f );
! fclose( f );
! prints("Game saved.");
}
else
{
--- 1516,1541 ----
char s[80];
cprintf("Filename to save game to: ");
! (void)eofgets(s,80,stdin);
! if (s[0] == '\n') return;
! else strip_nl(s);
f=fopen(s,"w");
if (f)
{
for ( i=1; i<MaxObjs; i++ )
! (void)fprintf( f, "%d ", obj[i].loc );
! (void)fprintf( f, "%d %d %d %d %d %d ",
curr_lev, curr_loc,
level_loc[1], level_loc[2], level_loc[3], sleep_lev );
! (void)fprintf( f, "%d %d %d %d %d %d %d %d %d %d %d %d ",
cc, wa, ep, dr, af, gp, mi, ti, kp, dc[0], dc[1], dc[2] );
putc( '\n', f );
! if (fclose(f)) perror("Error saving game: ");
! else prints("Game saved.");
}
else
{
***************
*** 1543,1569 ****
char s[80];
cprintf("Filename to load game from: ");
! gets( s );
! if (!*s) return;
f=fopen(s,"r");
if (f)
{
for ( i=1; i<MaxObjs; i++ )
! fscanf( f, "%d ", &obj[i].loc );
! fscanf( f, "%d %d %d %d %d %d ",
&curr_lev, &curr_loc,
! &level_loc[1], &level_loc[2], &level_loc[3], &sleep_lev );
! fscanf( f, "%d %d %d %d %d %d %d %d %d %d %d %d ",
! &cc, &wa, &ep, &dr, &af, &gp, &mi, &ti, &kp, &dc[0], &dc[1], &dc[2] );
for ( sum=0, i=0; i<3; i++ )
sum += dc[i];
! fclose( f );
! prints("Game loaded.");
print_room = 1;
}
else
--- 1551,1579 ----
char s[80];
cprintf("Filename to load game from: ");
! (void)eofgets(s,80,stdin);
! if (s[0] == '\n') return;
! else strip_nl(s);
f=fopen(s,"r");
if (f)
{
for ( i=1; i<MaxObjs; i++ )
! if(fscanf( f, "%d ", &obj[i].loc ) != 1) goto erred;
! if(fscanf( f, "%d %d %d %d %d %d ",
&curr_lev, &curr_loc,
! &level_loc[1],&level_loc[2],&level_loc[3],&sleep_lev)!=6) goto erred;
! if(fscanf( f, "%d %d %d %d %d %d %d %d %d %d %d %d ",
! &cc, &wa, &ep, &dr, &af, &gp, &mi, &ti, &kp, &dc[0], &dc[1], &dc[2] )
! != 12) goto erred;
for ( sum=0, i=0; i<3; i++ )
sum += dc[i];
! if (fclose(f)) perror("Error closing save file: ");
! else prints("Game loaded.");
print_room = 1;
}
else
***************
*** 1570,1575 ****
--- 1580,1589 ----
{
cprintf("Unable to load game from %s", s); nl();
}
+ return;
+ erred:
+ prints("load: save file of inconsistent format");
+ exit(1);
}
/*----------------------------*/
***************
*** 1712,1723 ****
flag = stack_say("sonic harmony present.");
if (!flag)
! stack_say("nothing special to report.");
}
else
{
! stack_say( "" );
switch ( cmd.nn )
{
case o_mirror:
--- 1726,1737 ----
flag = stack_say("sonic harmony present.");
if (!flag)
! (void)stack_say("nothing special to report.");
}
else
{
! (void)stack_say( "" );
switch ( cmd.nn )
{
case o_mirror:
***************
*** 2069,2093 ****
else
{
prints(
! "As the complex disintegrates around you, the stack, sensing your\n");
prints(
! "danger, overloads all it's circuits to regain a moment's control.\n");
prints(
! "With a final burst of energy, the stack implodes, projecting a\n");
prints(
! "stasis field around you that protects you from the destruction.\n");
prints(
! "...\n");
prints(
! "From the smoldering debris of the Doomsday complex you pick up the\n");
prints(
! "pieces of the stack and reflect on how as you risked your life to\n");
prints(
! "save Earth, the stack has given its own to save yours. As you walk\n");
prints(
! "away, you solemnly swear to repair the stack, for the adventures\n");
prints(
! "that lie ahead.\n"
);
}
break;
--- 2083,2107 ----
else
{
prints(
! "As the complex disintegrates around you, the stack, sensing your");
prints(
! "danger, overloads all it's circuits to regain a moment's control.");
prints(
! "With a final burst of energy, the stack implodes, projecting a");
prints(
! "stasis field around you that protects you from the destruction.");
prints(
! "...");
prints(
! "From the smoldering debris of the Doomsday complex you pick up the");
prints(
! "pieces of the stack and reflect on how as you risked your life to");
prints(
! "save Earth, the stack has given its own to save yours. As you walk");
prints(
! "away, you solemnly swear to repair the stack, for the adventures");
prints(
! "that lie ahead."
);
}
break;
***************
*** 2142,2153 ****
intro()
{
! int i,j,k;
clrscr();
intro1();
! prints("Press <Enter> to continue");
! i=get_enter();
clrscr();
prints("Scenario:");
--- 2156,2170 ----
intro()
{
! int ch;
clrscr();
intro1();
! do {
! prints("Scenario and instructions? ");
! (void)eofgets(cmd.cm,max_cmd_size,stdin);
! if ((ch=intlwr(cmd.cm[0]))=='n' || ch == '\n') return;
! } while (ch != 'y');
clrscr();
prints("Scenario:");
***************
*** 2182,2198 ****
prints("");
prints("Press <Enter> to begin");
! j=get_enter();
clrscr();
- srand( i*i + j + k );
}
/*------------------------------------------------------------*/
! main()
{
! int i, keep_playing;
! intro();
do
{
--- 2199,2222 ----
prints("");
prints("Press <Enter> to begin");
! (void)eofgets(cmd.cm,max_cmd_size,stdin);
clrscr();
}
/*------------------------------------------------------------*/
! main(argc,argv)
! int argc;
! char *argv[];
!
{
! int l, fast = 0, keep_playing;
! for (l=1; l < argc; l++) {
! if(fast=(strcmp(argv[l],"-f")==0)) break;
! }
! if ((argc == 2 && !fast) || argc > 2)
! prints("Only -f for fast start-up is allowed. Unknown options ignored.\n");
! if (!fast) intro();
do
{
***************
*** 2219,2230 ****
#endif
if (InDreamWorld( curr_loc ))
! printf("(sleeping) ");
else if (InBookWorld( curr_loc ))
! printf("(reading) ");
cprintf("Enter command: ");
! gets( cmd.cm );
if (cmd.cm[0])
{
AnalyseCommand( &cmd );
--- 2243,2254 ----
#endif
if (InDreamWorld( curr_loc ))
! (void)printf("(sleeping) ");
else if (InBookWorld( curr_loc ))
! (void)printf("(reading) ");
cprintf("Enter command: ");
! strip_nl(eofgets(cmd.cm,max_cmd_size,stdin));
if (cmd.cm[0])
{
AnalyseCommand( &cmd );
***************
*** 2237,2248 ****
Ending( zap );
nl();
cprintf("Play again (y/n)? ");
! gets( cmd.cm );
! keep_playing = (cmd.cm[0]!='n' && cmd.cm[0] !='N');
nl();
}
while ( keep_playing );
clrscr();
- intro1();
}
--- 2261,2271 ----
Ending( zap );
nl();
cprintf("Play again (y/n)? ");
! (void)eofgets(cmd.cm,max_cmd_size,stdin);
! keep_playing = (intlwr(cmd.cm[0])!='n');
nl();
}
while ( keep_playing );
clrscr();
}
*** tess.doc Mon Dec 12 11:17:08 1988
--- tess/tess.doc Mon Dec 12 11:21:41 1988
***************
*** 34,37 ****
--- 34,40 ----
so if one word doesn't work, try another.
+ The game also accepts an argument of -f at run-time for fast start-up.
+ This skips the title screen, scenario and instructions. Very useful
+ for people at lower baud rates.
Notes: