-+-+-+-+-+-+-+-+ START OF PART 32 -+-+-+-+-+-+-+-+ X`09Resetting mode 7 tells the cursor to not wrap, but rather stay put. X `7C If your computer has the Enhanced Graphics Adaptor, modes between X `7C 8 and 15 are also supported; see the EGA BIOS for info. X `7C The EGA also lets you use a shorter character cell in text modes X `7C in order to squeeze 43 lines of text out of the 25-line text modes V. X `7C To enter 43 line mode, set the desired 25-line text mode (0 to 3), X `7C then Set Mode 43. For instance: ESC`5B=3h ESC`5B=43h. X `7C To exit 43 line mode, set the desired 25-line text mode again. X `7C Nansi.sys ignores mode 43 unless there is an EGA on your computer. X XFaster Output X `7C Any program that sets the console to RAW mode, and buffers its X `7C output properly, can achieve extremely high screen update speeds i Vn X `7C return for giving up the special functions of the keys `5EC, `5ES, V and `5EP. X `7C See IOCTL in the MS-DOS 3.x Technical Reference for more info. X`09Also, a small improvement in speed may be noticed with some X`09programs that use the DOS console in normal mode, as this driver X`09efficiently implements the (standard but undocumented) INT 29h X`09most-favored-device putchar used by DOS. X XBUGS X`09Insert and delete character do not work in graphics modes. X`09Graphics mode writing is slow. X`09The simulated cursor in graphics mode slows down single-char X`09writes by a factor of 3; it should be disable-able. X`09Does not support erase-to-end-of-screen and other useful functions. X XVersion X`09This version, 2.2, created February 1986. Problems should X`09be reported to Daniel Kegel, 1-60 CIT, Pasadena, CA 91126 X`09(or, after June 1986, 2648 169th Ave SE, Bellevue, Wa. 98008). X`09Your suggestions for improvement would be most welcome. X XNOTE X`09This program may be distributed for educational and personal use X`09only. Commercial use is verboten; get in touch with the author. $ CALL UNPACK NANSI.DOC;1 1111078067 $ create 'f' Xbegin 666 nansi.sys XM_____Q. RP#6 $-/3B @(" @&ULR2DYA;G-I+G-Y.,R(`5B8_Y>S "`5B%'EP #0 !B4<#!Q`5D?7EU: XM65M8R`5E@* .OF+L<&BP ! ,`5EX$PC#,\##XPJ+_E'HXP)9JN+X,\##Z",#= O% XM'EP B$<-,\#K `5B@ L/H#P.X )T C/ PS/ HX, HX< HXL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20 ? XMHF, _LR()F4 QP9F Z(KWP`5B$ ZX:+'G4 XP`5D.K4EU HK@ MB UP"()\,S XMP(@'0_`5B =?GK`5D !P'_" 3X 07_@ ?X< B( !`5BX !_X!"#X B'X!B+X 2/X XM!23X R7X!RB/ "F/0"J/("N/8"R/$"V/4"Z/,"`5E/<#/ CMB`5B; #'!Q X#include X#include X#else X#include X#include X#ifdef SYSV X# ifdef MSDOS X# ifdef OS2LARN X# define INCL_BASE X# include X# define sleep(x)`09DosSleep(x*1000L) X# endif X# include X# else X# include X# endif X#else X#ifdef BSD X#include X#endif BSD X#endif SYSV X#endif X/* X * routine to take a nap for n milliseconds X */ Xnap(x) X register int x; X `7B X if (x<=0) return; /* eliminate chance for infinite loop */ X lflush(); X if (x > 999) sleep(x/1000); else napms(x); X `7D X X#ifdef NONAP Xstatic napms(x) /* do nothing */ X int x; X `7B X `7D X#else NONAP X#ifdef SYSV X/* napms - sleep for time milliseconds - uses times() */ X/* this assumes that times returns a relative time in 60ths of a second */ X/* this will do horrible things if your times() returns seconds! */ X X#ifdef MSDOS Xunsigned long Xstatic dosgetms() X`7B X#ifdef OS2LARN X DATETIME dt; X DosGetDateTime(&dt); X X /* return hundreths of seconds */ X return ( 360000L * dt.hours + X 6000L * dt.minutes + X 100L * dt.seconds + dt.hundredths ); X#else X union REGS regs; X X regs.h.ah = 0x2C; X intdos(®s, ®s); X X /* return hundreths of seconds X */ X return ( 360000L * regs.h.ch + X 6000L * regs.h.cl + X 100L * regs.h.dh + regs.h.dl ); X#endif X`7D X Xstatic napms(time) Xint time; X`7B X unsigned long matchclock; X X if (time <= 0) X time = 1; /* eliminate chance of infinite loop */ X matchclock = dosgetms() + (time + 5) / 10; X if (matchclock > 8640000L) /* total 100ths-of-seconds in 24 hrs */ X return; X X while (matchclock > dosgetms()) X ; X`7D X X# else Xstatic napms(time) X int time; X `7B X long matchclock, times(); X struct tms stats; X X if (time<=0) time=1; /* eliminate chance for infinite loop */ X if ((matchclock = times(&stats)) == -1 `7C`7C matchclock == 0) X return; /* error, or BSD style times() */ X matchclock += (time / 17); /*17 ms/tic is 1000 ms/sec / 60 tics/sec V */ X X while(matchclock < times(&stats)) X ; X `7D X# endif /* MSDOS */ X X#else not SYSV X#ifdef BSD X#ifdef SIGVTALRM X/* This must be BSD 4.2! */ X#include X#define bit(_a) (1<<((_a)-1)) X Xstatic void nullf() X `7B X `7D X X/* napms - sleep for time milliseconds - uses setitimer() */ Xstatic napms(time) X int time; X `7B X struct itimerval timeout; X#ifdef SIG_RTNS_INT X int (*oldhandler) (); X#else X void (*oldhandler) (); X#endif X int oldsig; X X if (time <= 0) return; X X timerclear(&timeout.it_interval); X timeout.it_value.tv_sec = time / 1000; X timeout.it_value.tv_usec = (time % 1000) * 1000; X X oldsig = sigblock(bit(SIGALRM)); X setitimer(ITIMER_REAL, &timeout, (struct itimerval *)0); X oldhandler = signal(SIGALRM, nullf); X sigpause(oldsig); X signal(SIGALRM, oldhandler); X sigsetmask(oldsig); X `7D X X#else X/* napms - sleep for time milliseconds - uses ftime() */ X Xstatic napms(time) X int time; X `7B X /* assumed to be BSD UNIX */ X struct timeb _gtime; X time_t matchtime; X unsigned short matchmilli; X register struct timeb *tp = & _gtime; X X if (time <= 0) return; X ftime(tp); X matchmilli = tp->millitm + time; X matchtime = tp->time; X while (matchmilli >= 1000) X `7B X ++matchtime; X matchmilli -= 1000; X `7D X X while(1) X `7B X ftime(tp); X if ((tp->time > matchtime) `7C`7C X ((tp->time == matchtime) && (tp->millitm >= matchmilli))) X break; X `7D X `7D X#endif X#else not BSD Xstatic napms(time) int time; `7B`7D /* do nothing, forget it */ X#endif BSD X#endif SYSV X#endif NONAP $ CALL UNPACK NAP.C;1 1379745530 $ create 'f' X/* object.c */ X#include "header.h" X#include "larndefs.h" X#include "monsters.h" X#include "objects.h" X#include "player.h" X X#define min(x,y) (((x)>(y))?(y):(x)) X#define max(x,y) (((x)>(y))?(x):(y)) X X/* LOOK_FOR_OBJECT X subroutine to look for an object and give the player his options if an obje Vct X was found. X*/ Xlookforobject(do_ident, do_pickup, do_action) X char do_ident; /* identify item: T/F */ X char do_pickup; /* pickup item: T/F */ X char do_action; /* prompt for actions on object: T/F */ X`7B X register int i, j; X X /* can't find objects if time is stopped */ X if (c`5BTIMESTOP`5D) X return; X i = item`5Bplayerx`5D`5Bplayery`5D; X if (i == 0) X return; X j = iarg`5Bplayerx`5D`5Bplayery`5D; X showcell(playerx, playery); X cursors(); X yrepcount = 0; X switch (i) X `7B X case OGOLDPILE: X case OMAXGOLD: X case OKGOLD: X case ODGOLD: X lprcat("\n\nYou have found some gold!"); X ogold(i); X break; X X case OPOTION: X if (do_ident) X `7B X lprcat("\n\nYou have found a magic potion"); X if (potionname`5Bj`5D`5B0`5D) X lprintf(" of %s", &potionname`5Bj`5D`5B1`5D); X `7D X if (do_pickup) X if (take(OPOTION, j) == 0) X forget(); X if (do_action) X opotion(j); X break; X X case OSCROLL: X if (do_ident) X `7B X lprcat("\n\nYou have found a magic scroll"); X if (scrollname`5Bj`5D`5B0`5D) X lprintf(" of %s", &scrollname`5Bj`5D`5B1`5D); X `7D X if (do_pickup) X if (take(OSCROLL, j) == 0) X forget(); X if (do_action) X oscroll(j); X break; X X case OALTAR: X if (nearbymonst()) X return; X if (do_ident) X lprcat("\n\nThere is a Holy Altar here!"); X if (do_action) X oaltar(); X break; X X case OBOOK: X if (do_ident) X lprcat("\n\nYou have found a book."); X if (do_pickup) X if (take(OBOOK, j) == 0) X forget(); X if (do_action) X obook(); X break; X X case OCOOKIE: X if (do_ident) X lprcat("\n\nYou have found a fortune cookie."); X if (do_pickup) X if (take(OCOOKIE, 0) == 0) X forget(); X if (do_action) X ocookie(); X break; X X case OTHRONE: X if (nearbymonst()) X return; X if (do_ident) X lprintf("\n\nThere is %s here!", objectname`5Bi`5D); X if (do_action) X othrone(0); X break; X X case OTHRONE2: X if (nearbymonst()) X return; X if (do_ident) X lprintf("\n\nThere is %s here!", objectname`5Bi`5D); X if (do_action) X othrone(1); X break; X X case ODEADTHRONE: X if (do_ident) X lprintf("\n\nThere is %s here!", objectname`5Bi`5D); X if (do_action) X odeadthrone(); X break; X X case OPIT: X /* always perform these actions. */ X lprcat("\n\nYou're standing at the top of a pit."); X opit(); X break; X X case OSTAIRSUP: /* up */ X if (do_ident) X lprcat("\n\nThere is a circular staircase here"); X if (do_action) X ostairs(1); X break; X X case OFOUNTAIN: X if (nearbymonst()) X return; X if (do_ident) X lprcat("\n\nThere is a fountain here"); X if (do_action) X ofountain(); X break; X X case OSTATUE: X if (nearbymonst()) X return; X if (do_ident) X lprcat("\n\nYou are standing in front of a statue"); X if (do_action) X ostatue(); X break; X X case OCHEST: X if (do_ident) X lprcat("\n\nThere is a chest here"); X if (do_pickup) X if (take(OCHEST, j) == 0) X forget(); X if (do_action) X ochest(); X break; X X case OSCHOOL: X if (nearbymonst()) X return; X if (do_ident) X lprcat("\n\nYou have found the College of Larn."); X if (do_action) X prompt_enter(); X break; X +-+-+-+-+-+-+-+- END OF PART 32 +-+-+-+-+-+-+-+-