-+-+-+-+-+-+-+-+ START OF PART 7 -+-+-+-+-+-+-+-+ X lprcat("\n and that the players dexterity and strength are 16."); X lprcat("\n to hit: if (rnd(22) < (2`5Bmonst AC`5D + your level + dex V + WC/8 -1)/2) then hit"); X lprcat("\n damage = rund(8) + WC/2 + STR - c`5BHARDGAME`5D - 4"); X lprcat("\n to hit: if rnd(22) < to hit then player hits\n"); X lprcat("\n Each entry is as follows: to hit / damage / number hits t Vo kill\n"); X lprcat("\n monster WC = 4 WC = 20 WC = 40"); X lprcat("\n-------------------------------------------------------------- V-"); X for (i=0; i<=MAXMONST+8; i++) X `7B X hit = 2*monster`5Bi`5D.armorclass+2*monster`5Bi`5D.level+16; X dam = 16 - c`5BHARDGAME`5D; X lprintf("\n%20s %2d/%2d/%2d %2d/%2d/%2d %2d/%2d/%2d", X monster`5Bi`5D.name, X (long)(hit/2),(long)max(0,dam+2),(long)(monster`5Bi`5D.h Vitpoints/(dam+2)+1), X (long)((hit+2)/2),(long)max(0,dam+10),(long)(monster`5Bi V`5D.hitpoints/(dam+10)+1), X (long)((hit+5)/2),(long)max(0,dam+20),(long)(monster`5Bi V`5D.hitpoints/(dam+20)+1)); X `7D X X lprcat("\n\nHere's the list of available potions:\n\n"); X for (i=0; i to save game\n",fn Vame); X nosignal=0; return(-1); X `7D X X set_score_output(); X X# ifdef MSDOS X lwrite((char*)beenhere,MAXLEVEL+MAXVLEVEL); X X /* Some levels may be out on disk, some are in memory. X */ X for (k = 0; k < MAXLEVEL + MAXVLEVEL; k++) X if (beenhere`5Bk`5D) `7B X X /* Is the level in memory already ? X */ X for (rp = ramblks; rp; rp = rp->next) X if (rp->level == k) X break; X if (rp != NULL) `7B X lwrite((char *) &rp->gtime, sizeof (long)); X warn(" %d", k); X# ifdef ndef X warn("From memory\n", k); X# endif X lwrite((char *) rp->cell, sizeof rp->cell); X continue; X `7D X X /* Is it on disk ? X */ X for (dp = diskblks; dp; dp = dp->next) X if (dp->level == k) X break; X X if (dp == NULL) `7B X levelinfo(); X error("Level %d is neither in memory nor on disk\n", k); X `7D X X /* Copy the contents of the SWAPFILE */ X lwrite((char *) &dp->gtime, sizeof (long)); X# ifdef ndef X warn("From swap file...\n", k); X# endif X warn(" %ds", k); X if (lseek(swapfd, dp->fpos, 0) < 0) `7B X warn("Can't seek to %ld\n", dp->fpos); X return -1; X `7D X for (i = 0; i < MAXY; i++) `7B X# ifdef ndef X warn("Copying swap file...\n"); X# endif X if (vread(swapfd, (char *) buf, sizeof buf) != X sizeof buf) `7B X warn("Swap file short!\n"); X return -1; X `7D X lwrite((char *) buf, sizeof buf); X `7D X `7D X# else X lwrite((char*)beenhere,MAXLEVEL+MAXVLEVEL); X for (k=0; kp) X lwrite((char*)sp,sizeof(struct sphere)); /* save spheres of annih Vilation */ X time(&zzz); lprint((long)(zzz-initialtime)); X lwrite((char*)&zzz,sizeof(long)); X# ifndef MSDOS X if (fstat(lfd,&statbuf)< 0) lprint(0L); X else lprint((long)statbuf.st_ino); /* inode # */ X# endif X X lwclose(); lastmonst`5B0`5D = 0; X#ifndef VT100 X setscroll(); X#endif VT100 X lcreat((char*)0); nosignal=0; X return(0); X `7D X Xrestoregame(fname) X char *fname; X `7B X register int i,k; X register struct sphere *sp,*sp2; X struct stat filetimes; X# ifdef MSDOS X RAMBLOCK *rp, *getramblk(); X# endif X X cursors(); lprcat("\nRestoring . . ."); lflush(); X if (lopen(fname) <= 0) X `7B X lcreat((char*)0); lprintf("\nCan't open file <%s>to restore game\n", Vfname); X nap(2000); c`5BGOLD`5D=c`5BBANKACCOUNT`5D=0; died(-265); return; X `7D X lrfill((char*)beenhere,MAXLEVEL+MAXVLEVEL); X X# ifdef MSDOS X /* As levels get read in from the save file, store them away X * by calling putsavelevel. X */ X for (k = 0; k < MAXLEVEL + MAXVLEVEL; k++) X if (beenhere`5Bk`5D) `7B X rp = getramblk(k); X lrfill((char *) &rp->gtime, sizeof (long)); X lrfill((char *) rp->cell, sizeof rp->cell); X rp->level = k; X `7D X# else X for (k=0; kp=0; /* null out pointer */ X if (i==0) spheres=sp; /* beginning of list */ X else sp2->p = sp; X `7D X X time(&zzz); X initialtime = zzz-lrint(); X fstat(fd,&filetimes); /* get the creation and modification time of fi Vle */ X lrfill((char*)&zzz,sizeof(long)); zzz += 6; X if (filetimes.st_ctime > zzz) fsorry(); /* file create time */ X else if (filetimes.st_mtime > zzz) fsorry(); /* file modify time */ X if (c`5BHP`5D<0) `7B died(284); return; `7D /* died a post mortem death V */ X X oldx = oldy = 0; X#ifndef VMS X# ifndef MSDOS X i = lrint(); /* inode # */ X if (i && (filetimes.st_ino!=i)) fsorry(); X# endif MSDOS X#endif VMS X lrclose(); X if (strcmp(fname,ckpfile) == 0) X `7B X if (lappend(fname) < 0) fcheat(); else `7B lprc(' '); lwclose(); `7 VD X lcreat((char*)0); X `7D X else if (unlink(fname) < 0) fcheat(); /* can't unlink save file */ X/* for the greedy cheater checker */ X for (k=0; k<6; k++) if (c`5Bk`5D>99) greedy(); X if (c`5BHPMAX`5D>999 `7C`7C c`5BSPELLMAX`5D>125) greedy(); X if (c`5BLEVEL`5D==25 && c`5BEXPERIENCE`5D>skill`5B24`5D) /* if patch up V lev 25 player */ X `7B X long tmp; X tmp = c`5BEXPERIENCE`5D-skill`5B24`5D; /* amount to go up */ X c`5BEXPERIENCE`5D = skill`5B24`5D; X raiseexperience((long)tmp); X `7D X getlevel(); lasttime=gtime; X `7D X X/* X subroutine to not allow greedy cheaters X */ Xstatic greedy() X `7B X#if WIZID X if (wizard) return; X#endif X X lprcat("\n\nI am so sorry, but your character is a little TOO good! Sin Vce this\n"); X lprcat("cannot normally happen from an honest game, I must assume that y Vou cheated.\n"); X lprcat("In that you are GREEDY as well as a CHEATER, I cannot allow this V game\n"); X lprcat("to continue.\n"); nap(5000); c`5BGOLD`5D=c`5BBANKACCOUNT`5D=0; V died(-267); return; X `7D X X/* X subroutine to not allow altered save files and terminate the attempted X restart X */ Xstatic fsorry() X `7B X lprcat("\nSorry, but your savefile has been altered.\n"); X lprcat("However, seeing as I am a good sport, I will let you play.\n"); X lprcat("Be advised though, you won't be placed on the normal scoreboard. V"); X cheat = 1; nap(4000); X `7D X X/* X subroutine to not allow game if save file can't be deleted X */ Xstatic fcheat() X `7B X#if WIZID X if (wizard) return; X#endif X X lprcat("\nSorry, but your savefile can't be deleted. This can only mean V\n"); X lprcat("that you tried to CHEAT by protecting the directory the savefile V\n"); X lprcat("is in. Since this is unfair to the rest of the larn community, V I\n"); X lprcat("cannot let you play this game.\n"); X nap(5000); c`5BGOLD`5D=c`5BBANKACCOUNT`5D=0; died(-268); return; X `7D $ CALL UNPACK DIAG.C;1 890168055 $ create 'f' X/* display.c */ X#include "header.h" X#include "larndefs.h" X#include "objects.h" X#include "player.h" X X#define botsub( _idx, _x, _y, _str ) \ X if ( c`5B(_idx)`5D != cbak`5B(_idx)`5D ) \ X `7B \ X cbak`5B(_idx)`5D = c`5B(_idx)`5D; \ X cursor( (_x), (_y) ); \ X lprintf( (_str), (long)c`5B(_idx)`5D ); \ X `7D X Xstatic int minx,maxx,miny,maxy,k; Xstatic char bot1f=0,bot2f=0,bot3f=0; Xstatic char always=0; X char regen_bottom = 0; X X/* X bottomline() X X now for the bottom line of the display X */ Xbottomline() X `7B recalc(); bot1f=1; `7D Xbottomhp() X `7B bot2f=1; `7D Xbottomspell() X `7B bot3f=1; `7D Xbottomdo() X `7B X if (bot1f) `7B bot3f=bot1f=bot2f=0; bot_linex(); return; `7D X if (bot2f) `7B bot2f=0; bot_hpx(); `7D X if (bot3f) `7B bot3f=0; bot_spellx(); `7D X `7D X Xbot_linex() X `7B X register int i; X if ( regen_bottom `7C`7C (always)) X `7B X regen_bottom = FALSE ; X cursor( 1,18); X if (c`5BSPELLMAX`5D>99) lprintf("Spells:%3d(%3d)",(long)c`5BSPELLS` V5D,(long)c`5BSPELLMAX`5D); X else lprintf("Spells:%3d(%2d) ",(long)c`5BSPELLS`5D, V(long)c`5BSPELLMAX`5D); X lprintf(" AC: %-3d WC: %-3d Level",(long)c`5BAC`5D,(long)c`5BWCLAS VS`5D); X if (c`5BLEVEL`5D>99) lprintf("%3d",(long)c`5BLEVEL`5D); X else lprintf(" %-2d",(long)c`5BLEVEL`5D); X lprintf(" Exp: %-9d %s\n",(long)c`5BEXPERIENCE`5D,class`5Bc`5BLEVEL` V5D-1`5D); X lprintf("HP: %3d(%3d) STR=%-2d INT=%-2d ", +-+-+-+-+-+-+-+- END OF PART 7 +-+-+-+-+-+-+-+-