-+-+-+-+-+-+-+-+ START OF PART 41 -+-+-+-+-+-+-+-+ X if ((m=mitem`5Bx`5D`5By`5D) >= DEMONLORD+4) /* demons dispel spheres */ X `7B X show1cell(x,y); /* show the demon (ha ha) */ X cursors(); lprintf("\nThe %s dispels the sphere!",monster`5Bm`5D.nam Ve); X beep(); rmsphere(x,y); /* remove any spheres that are here */ X return(c`5BSPHCAST`5D); X `7D X if (m==DISENCHANTRESS) /* disenchantress cancels spheres */ X `7B X cursors(); lprintf("\nThe %s causes cancellation of the sphere!",mon Vster`5Bm`5D.name); beep(); Xboom: sphboom(x,y); /* blow up stuff around sphere */ X rmsphere(x,y); /* remove any spheres that are here */ X return(c`5BSPHCAST`5D); X `7D X if (c`5BCANCELLATION`5D) /* cancellation cancels spheres */ X `7B X cursors(); lprcat("\nAs the cancellation takes effect, you hear a gr Veat earth shaking blast!"); beep(); X goto boom; X `7D X if (item`5Bx`5D`5By`5D==OANNIHILATION) /* collision of spheres detonates V spheres */ X `7B X cursors(); lprcat("\nTwo spheres of annihilation collide! You hear a V great earth shaking blast!"); beep(); X rmsphere(x,y); X goto boom; X `7D X if (playerx==x && playery==y) /* collision of sphere and player! */ X `7B X cursors(); X lprcat("\nYou have been enveloped by the zone of nothingness!\n"); X beep(); rmsphere(x,y); /* remove any spheres that are here */ X nap(4000); died(258); X `7D X item`5Bx`5D`5By`5D=OANNIHILATION; mitem`5Bx`5D`5By`5D=0; know`5Bx`5D`5 VBy`5D=1; X show1cell(x,y); /* show the new sphere */ X sp->x=x; sp->y=y; sp->lev=level; sp->dir=dir; sp->lifetime=life; sp V->p=0; X if (spheres==0) spheres=sp; /* if first node in the sphere list */ X else /* add sphere to beginning of linked list */ X `7B X sp->p = spheres; spheres = sp; X `7D X return(++c`5BSPHCAST`5D); /* one more sphere in the world */ X `7D X X/* X * rmsphere(x,y) Function to delete a sphere of annihilation from lis Vt X * int x,y; X * X * Enter with the coordinates of the sphere (on current level) X * Returns the number of spheres currently in existence X */ Xrmsphere(x,y) X int x,y; X `7B X register struct sphere *sp,*sp2=0; X for (sp=spheres; sp; sp2=sp,sp=sp->p) X if (level==sp->lev) /* is sphere on this level? */ X if ((x==sp->x) && (y==sp->y)) /* locate sphere at this location */ X `7B X item`5Bx`5D`5By`5D=mitem`5Bx`5D`5By`5D=0; know`5Bx`5D`5By`5D=1; X show1cell(x,y); /* show the now missing sphere */ X --c`5BSPHCAST`5D; `20 X if (sp==spheres) `7B sp2=sp; spheres=sp->p; free((char*)sp2); `7 VD X else X `7B sp2->p = sp->p; free((char*)sp); `7D X break; X `7D X return(c`5BSPHCAST`5D); /* return number of spheres in the world */ X `7D X X/* X * sphboom(x,y) Function to perform the effects of a sphere detonation X * int x,y; X * X * Enter with the coordinates of the blast, Returns no value X */ Xstatic sphboom(x,y) X int x,y; X `7B X register int i,j; X if (c`5BHOLDMONST`5D) c`5BHOLDMONST`5D=1; X if (c`5BCANCELLATION`5D) c`5BCANCELLATION`5D=1; X for (j=max(1,x-2); jp) /* look through sphere list V */ X if (sp2->lev == level) /* only if this level */ X `7B X sph`5Bx`5D = *sp2; sph`5Bx++`5D.p = 0; /* copy the struct */ X if (x>1) sph`5Bx-2`5D.p = &sph`5Bx-1`5D; /* link pointers */ X `7D X if (x) sp= sph; /* if any spheres, point to them */ X else return; /* no spheres */ X X for (sp=sph; sp; sp=sp->p) /* look through sphere list */ X `7B X x = sp->x; y = sp->y; X if (item`5Bx`5D`5By`5D!=OANNIHILATION) continue; /* not really th Vere */ X if (--(sp->lifetime) < 0) /* has sphere run out of gas? */ X `7B X rmsphere(x,y); /* delete sphere */ X continue; X `7D X switch(rnd((int)max(7,c`5BINTELLIGENCE`5D>>1))) /* time to move the V sphere */ X `7B X case 1: X case 2: /* change direction to a random one */ X sp->dir = rnd(8); X default: /* move in normal direction */ X dir = sp->dir; len = sp->lifetime; X rmsphere(x,y); X newsphere(x+diroffx`5Bdir`5D,y+diroffy`5Bdir`5D,dir, Vlen); X `7D; X `7D X `7D $ CALL UNPACK SPHERES.C;1 1031350508 $ create 'f' X/* store.c */ X/* XThis module contains data and routines to handle buildings at the home level V. XRoutines: X X dnd_2hed X dnd_hed X dndstore The DND store main routine X handsfull To tell the player he can carry no more X out_of_stock To tell the player an item is out of stock X no_gold To tell the player he has no gold X dnditem Display DND store items X sch_head print the school header X oschool main school routine X obank Larn National Bank X obank2 5th level branch of the bank X banktitle bank header X ointerest accrue interest to bank account X obanksub bank main subroutine X otradhead trading post header X otradepost trading post main function X cnsitm X olrs larn revenue service function X*/ X X#include "header.h" X#include "larndefs.h" X#include "objects.h" X#include "player.h" X Xstatic int dndcount=0,dnditm=0; X X/* number of items in the dnd inventory table */ X#define MAXITM 83 X X/* this is the data for the stuff in the dnd store */ Xstruct _itm itm`5B90`5D = `7B X/*cost memory iven name iven arg how X gp pointer iven`5B`5D ivenarg`5B`5D many */ X X`7B 2, 0, OLEATHER, 0, 3 `7D, X`7B 10, 0, OSTUDLEATHER, 0, 2 `7D, X`7B 40, 0, ORING, 0, 2 `7D, X`7B 85, 0, OCHAIN, 0, 2 `7D, X`7B 220, 0, OSPLINT, 0, 1 `7D, X`7B 400, 0, OPLATE, 0, 1 `7D, X`7B 900, 0, OPLATEARMOR, 0, 1 `7D, X`7B 2600, 0, OSSPLATE, 0, 1 `7D, X`7B 150, 0, OSHIELD, 0, 1 `7D, X X/*cost memory iven name iven arg how X gp pointer iven`5B`5D ivenarg`5B`5D many */ X X`7B 2, 0, ODAGGER, 0, 3 `7D, X`7B 20, 0, OSPEAR, 0, 3 `7D, X`7B 80, 0, OFLAIL, 0, 2 `7D, X`7B 150, 0, OBATTLEAXE, 0, 2 `7D, X`7B 450, 0, OLONGSWORD, 0, 2 `7D, X`7B 1000, 0, O2SWORD, 0, 2 `7D, X`7B 5000, 0, OSWORD, 0, 1 `7D, X`7B 16500, 0, OLANCE, 0, 1 `7D, X`7B 6000, 0, OSWORDofSLASHING, 0, 0 `7D, X`7B 10000, 0, OHAMMER, 0, 0 `7D, X X/*cost memory iven name iven arg how X gp pointer iven`5B`5D ivenarg`5B`5D many */ X X`7B 150, 0, OPROTRING, 1, 1 `7D, X`7B 85, 0, OSTRRING, 1, 1 `7D, X`7B 120, 0, ODEXRING, 1, 1 `7D, X`7B 120, 0, OCLEVERRING, 1, 1 `7D, X`7B 180, 0, OENERGYRING, 0, 1 `7D, X`7B 125, 0, ODAMRING, 0, 1 `7D, X`7B 220, 0, OREGENRING, 0, 1 `7D, X`7B 1000, 0, ORINGOFEXTRA, 0, 1 `7D, X X`7B 280, 0, OBELT, 0, 1 `7D, X X`7B 400, 0, OAMULET, 0, 1 `7D, X X`7B 6500, 0, OORBOFDRAGON, 0, 0 `7D, X`7B 5500, 0, OSPIRITSCARAB, 0, 0 `7D, X`7B 5000, 0, OCUBEofUNDEAD, 0, 0 `7D, X`7B 6000, 0, ONOTHEFT, 0, 0 `7D, X X`7B 590, 0, OCHEST, 6, 1 `7D, X`7B 200, 0, OBOOK, 8, 1 `7D, X`7B 10, 0, OCOOKIE, 0, 3 `7D, X X/*cost memory iven name iven arg how X gp pointer iven`5B`5D ivenarg`5B`5D many */ X X`7B 20, potionname, OPOTION, 0, 6 `7D, X`7B 90, potionname, OPOTION, 1, 5 `7D, X`7B 520, potionname, OPOTION, 2, 1 `7D, X`7B 100, potionname, OPOTION, 3, 2 `7D, X`7B 50, potionname, OPOTION, 4, 2 `7D, X`7B 150, potionname, OPOTION, 5, 2 `7D, X`7B 70, potionname, OPOTION, 6, 1 `7D, X`7B 30, potionname, OPOTION, 7, 7 `7D, X`7B 200, potionname, OPOTION, 8, 1 `7D, X`7B 50, potionname, OPOTION, 9, 1 `7D, X`7B 80, potionname, OPOTION, 10, 1 `7D, X X/*cost memory iven name iven arg how X gp pointer iven`5B`5D ivenarg`5B`5D many */ X X`7B 30, potionname, OPOTION, 11, 3 `7D, X`7B 20, potionname, OPOTION, 12, 5 `7D, X`7B 40, potionname, OPOTION, 13, 3 `7D, X`7B 35, potionname, OPOTION, 14, 2 `7D, X`7B 520, potionname, OPOTION, 15, 1 `7D, X`7B 90, potionname, OPOTION, 16, 2 `7D, X`7B 200, potionname, OPOTION, 17, 2 `7D, X`7B 220, potionname, OPOTION, 18, 4 `7D, X`7B 80, potionname, OPOTION, 19, 6 `7D, X`7B 370, potionname, OPOTION, 20, 3 `7D, X`7B 50, potionname, OPOTION, 22, 1 `7D, X`7B 150, potionname, OPOTION, 23, 3 `7D, X X/*cost memory iven name iven arg how X gp pointer iven`5B`5D ivenarg`5B`5D many */ X X`7B 100, scrollname, OSCROLL, 0, 2 `7D, X`7B 125, scrollname, OSCROLL, 1, 2 `7D, X`7B 60, scrollname, OSCROLL, 2, 4 `7D, X`7B 10, scrollname, OSCROLL, 3, 4 `7D, X`7B 100, scrollname, OSCROLL, 4, 3 `7D, X`7B 200, scrollname, OSCROLL, 5, 2 `7D, X`7B 110, scrollname, OSCROLL, 6, 1 `7D, X`7B 500, scrollname, OSCROLL, 7, 2 `7D, X`7B 200, scrollname, OSCROLL, 8, 2 `7D, X`7B 250, scrollname, OSCROLL, 9, 4 `7D, X`7B 20, scrollname, OSCROLL, 10, 5 `7D, X`7B 30, scrollname, OSCROLL, 11, 3 `7D, X X/*cost memory iven name iven arg how X gp pointer iven`5B`5D ivenarg`5B`5D many */ X X`7B 340, scrollname, OSCROLL, 12, 1 `7D, X`7B 340, scrollname, OSCROLL, 13, 1 `7D, X`7B 300, scrollname, OSCROLL, 14, 2 `7D, X`7B 400, scrollname, OSCROLL, 15, 2 `7D, X`7B 500, scrollname, OSCROLL, 16, 2 `7D, X`7B 1000, scrollname, OSCROLL, 17, 1 `7D, X`7B 500, scrollname, OSCROLL, 18, 1 `7D, X`7B 340, scrollname, OSCROLL, 19, 2 `7D, X`7B 220, scrollname, OSCROLL, 20, 3 `7D, X`7B 3900, scrollname, OSCROLL, 21, 0 `7D, X`7B 610, scrollname, OSCROLL, 22, 1 `7D, X`7B 3000, scrollname, OSCROLL, 23, 0 `7D X `7D; X X/* X for the college of larn X */ Xchar course`5B26`5D; /* the list of courses taken */ Xstatic char coursetime`5B`5D = `7B 10, 15, 10, 20, 10, 10, 10, 5 `7D; X X/* X function for the dnd store X */ Xstatic dnd_2hed() X `7B X lprcat("Welcome to the Larn Thrift Shoppe. We stock many items explorer Vs find useful\n"); X lprcat(" in their adventures. Feel free to browse to your hearts conten Vt.\n"); X lprcat("Also be advised, if you break 'em, you pay for 'em."); X `7D X Xstatic dnd_hed() X `7B X register int i; X for (i=dnditm; i<26+dnditm; i++) dnditem(i); X cursor(50,18); lprcat("You have "); X `7D X Xdndstore() X `7B X register int i; X dnditm = 0; X nosignal = 1; /* disable signals */ X clear(); dnd_2hed(); X if (outstanding_taxes>0) X `7B X lprcat("\n\nThe Larn Revenue Service has ordered us to not do business w Vith tax evaders.\n"); beep(); X lprintf("They have also told us that you owe %d gp in back taxes, and as V we must\n",(long)outstanding_taxes); X lprcat("comply with the law, we cannot serve you at this time. Soo Sorr Vy.\n"); X cursors(); X lprcat("\nPress "); standout("escape"); lprcat(" to leave: "); lflush(); X i=0; X while (i!='\33') i=ttgetch(); X drawscreen(); nosignal = 0; /* enable signals */ return; X `7D X X dnd_hed(); X while (1) X `7B X cursor(59,18); lprintf("%d gold pieces",(long)c`5BGOLD`5D); X cltoeoln(); cl_dn(1,20); /* erase to eod */ X lprcat("\nEnter your transaction `5B"); standout("space"); X lprcat(" for more, "); standout("escape"); X lprcat(" to leave`5D? "); X i=0; X while ((i<'a' `7C`7C i>'z') && (i!=' ') && (i!='\33') && (i!=12)) i=ttg Vetch(); X if (i==12) `7B clear(); dnd_2hed(); dnd_hed(); `7D X else if (i=='\33') X `7B drawscreen(); nosignal = 0; /* enable signals */ return; `7D X else if (i==' ') X `7B X cl_dn(1,4); X if ((dnditm += 26) >= MAXITM) X dnditm=0; X dnd_hed(); X `7D X else X `7B /* buy something */ +-+-+-+-+-+-+-+- END OF PART 41 +-+-+-+-+-+-+-+-