' THE WONDERFUL WORLD OF EAMON DELUXE EDITION (v2)
'           BY FRANK BLACK 1997-1999
'
'   A COMPUTERIZED FANTASY ROLE-PLAYING SYSTEM
' BASED UPON THE APPLE II VERSION BY DONALD BROWN,
'    JOHN NELSON, TOM ZUCHOWSKI, & FRANK BLACK
'
'            ADVENTURE INTRO PROGRAM
'
'  Updated 21 MAY 1999
'
'  The Jim Jacobson Adventures
'  By Jim Jacobson and Frank Black
'
TYPE RECORD
  CNAME AS STRING * 40: Status AS INTEGER: a1 AS INTEGER: a2 AS INTEGER
  A3 AS INTEGER: SP1 AS INTEGER: SP2 AS INTEGER: SP3 AS INTEGER
  SP4 AS INTEGER: WA1 AS INTEGER: WA2 AS INTEGER: WA3 AS INTEGER
  WA4 AS INTEGER: WA5 AS INTEGER: ae AS INTEGER: SEX AS INTEGER: gold AS LONG
  bank AS LONG: ac AS INTEGER: WN1 AS STRING * 20: WN2 AS STRING * 20
  WN3 AS STRING * 20: WN4 AS STRING * 20: WCOMPLX1 AS INTEGER
  WCOMPLX2 AS INTEGER: WCOMPLX3 AS INTEGER: WCOMPLX4 AS INTEGER
  WTYPE1 AS INTEGER: WTYPE2 AS INTEGER: WTYPE3 AS INTEGER: WTYPE4 AS INTEGER
  WDICE1 AS INTEGER: WDICE2 AS INTEGER: WDICE3 AS INTEGER: WDICE4 AS INTEGER
  WSIDES1 AS INTEGER: WSIDES2 AS INTEGER: WSIDES3 AS INTEGER
  WSIDES4 AS INTEGER
END TYPE
DIM z AS RECORD

DIM SHARED dly, CC1, CC2, CC3
OPEN "SETTINGS.DAT" FOR INPUT AS #1: INPUT #1, dly, CC1, CC2, CC3: CLOSE

OPEN "NEW-MEAT" FOR RANDOM AS #1 LEN = 200: GET #1, 1, z: CLOSE
name$ = LTRIM$(RTRIM$(z.CNAME$)): SEX = z.SEX: q$ = CHR$(34)
OPEN "captive.dat" FOR RANDOM AS #1 LEN = 200: GET #1, 1, z: CLOSE
friend$ = LTRIM$(RTRIM$(z.CNAME$))

L$ = STRING$(80, 196)
OPEN "GAMEDIR.DAT" FOR INPUT AS #1: INPUT #1, a: CLOSE
'
a1$ = "Converted to Eamon Deluxe by Frank Black"
a2$ = "The Jim Jacobson Adventures"
author$ = a1$: adventure$ = a2$: GOSUB Title
mp$(1) = "CAVEMIND.BAS": mp$(2) = "ZYPHUR.BAS"
mp$(3) = "TOMB.BAS": mp$(4) = "ABDUCTOR.BAS"
mp$(5) = "TREZORE.BAS"
'
a$(1) = "The Cave of the Mind": a$(2) = "The Zypur Riverventure"
a$(3) = "The Devil's Tomb": a$(4) = "The Abductor's Quarters"
a$(5) = "The Quest for Trezore"
'
a1$(1) = "By Red Varnum, Jim Jacobson, & Frank Black"
FOR x = 2 TO 5: a1$(x) = "By Jim Jacobson & Frank Black": NEXT
'
COLOR 3: GOSUB Title
IF ASC(MID$(name$, 1)) = 0 THEN
  CLS : PRINT "!! WARNING !!": PRINT
  PRINT "This adventure has a corrupted file.  File is being restored and you are"
  PRINT "being returned to the main menu."
  PRINT : PRINT : GOSUB KeyWait
  OPEN "GAMEDIR.DAT" FOR OUTPUT AS #1
  PRINT #1, -1
  FOR m = 1 TO 5
     PRINT #1, "(none)"
  NEXT: CLOSE : CHDIR "..": RUN "STARTUP.BAS"
END IF

IF a = -1 THEN
  a = -2: OPEN "GAMEDIR.DAT" FOR OUTPUT AS #1
  PRINT #1, a
  FOR m = 1 TO 5
     PRINT #1, "(none)"
  NEXT: CLOSE
END IF
IF a = -2 THEN GOTO Intro
OPEN "ADV.DAT" FOR INPUT AS #1: INPUT #1, adv1: CLOSE
adventure$ = a$(adv1): mp$ = mp$(adv1): adv = adv1: author$ = a1$(adv1)
PRINT "Welcome back to "; adventure$; "!": PRINT
PRINT "Do you want to see the intro story again? (Y/N):"; : GOSUB KeyWait1
IF k$ <> "y" AND k$ <> "Y" THEN GOTO IntroDone
ON adv GOSUB Cave, Zyphur, Tomb, Abductor, Trezore
GOTO IntroDone

'                    -----------------------
'                      Blast from the past
'                    -----------------------
Intro:
CLS : WIDTH 40: COLOR 2: PRINT "  THE WONDERFUL WORLD OF EAMON DELUXE"
PRINT STRING$(40, "-"): PRINT SPC(13); "BY FRANK BLACK"
s$ = STRING$(40, "*"): LOCATE 6: PRINT SPC(14); "ADVENTURE #3": PRINT
COLOR 0, 2: PRINT s$; "*"; SPC(38); "*";
PRINT "*"; SPC(6); "THE JIM JACOBSON ADVENTURES";
PRINT SPC(5); "*"; : PRINT "*"; SPC(38); "*"; s$: COLOR 2, 0: PRINT
PRINT SPC(12); "BY JIM JACOBSON": PRINT : PRINT
PRINT "TO GO ON THESE ADVENTURES YOU MUST FIRST"
PRINT SPC(5); "MAKE SURE YOUR SPEAR IS SHARP": PRINT : PRINT
PRINT " NON COMMERCIAL DISTRIBUTION ENCOURAGED": PRINT
PRINT "]"; : LOCATE 23, 1
FOR x = 1 TO dly * 20
   IF INKEY$ <> "" THEN x = dly * 20
NEXT
GOSUB KeyWait: CLS : WIDTH 80: COLOR 3

'
'  First time intro
'
First:
GOSUB Title
a$ = "This is official Eamon Deluxe adventure #3": GOSUB Center: PRINT
PRINT : PRINT : GOSUB KeyWait
Menu:
author$ = a1$: adventure$ = a2$: GOSUB Title: COLOR 2
PRINT a$(1); : LOCATE CSRLIN, 40: PRINT a$(3)
PRINT a$(2); : LOCATE CSRLIN, 40: PRINT a$(4)
PRINT a$(5); : LOCATE CSRLIN, 40: PRINT a$(7)
PRINT a$(6); : COLOR 2: LOCATE CSRLIN, 40: PRINT a$(8): COLOR 3: PRINT
'
PRINT " 1. Read intro stories"
PRINT " 2. View/modify VISITORS file"
PRINT " 3. Play an adventure": PRINT
PRINT "Enter 1-3: "; : GOSUB KeyWait1: k = INT(VAL(k$))
IF k < 1 OR k > 3 THEN GOTO Menu
IF k <> 2 THEN GOSUB Pick
ON k GOTO Stories, Visitors, IntroDone0
'
Stories:
ON adv GOSUB Cave, Zyphur, Tomb, Abductor, Trezore
GOTO Menu
'
Visitors:
RUN "visitors.bas"
'
IntroDone0:
ON adv GOSUB Cave, Zyphur, Tomb, Abductor, Trezore
IntroDone:
IF adv <> 3 THEN PRINT "(Waking up the monsters...)"
OPEN "ADV.DAT" FOR OUTPUT AS #1: PRINT #1, adv: CLOSE
RUN mp$
END
'
'                   The Cave of the Mind
'                 ------------------------
'  Original ver.  Jan 1980
Cave:
GOSUB Title
PRINT "As you were leaving the Main Hall one evening, you encountered a short little"
PRINT "man who beckoned you to see what he was holding.  It turned out to be a grail"
PRINT "which contained a bubbling green liquid."
PRINT
PRINT "In a strange low voice he said, "; q$; "Most adventures are for normal adventurers,"
PRINT "but you are special.  Drink this and you will be transported to the most"
PRINT "challenging adventure you could imagine.  DANGER!  TREASURE!  GLORY!  Do you"
PRINT "dare try and conquer...The Cave of the Mind!?!  Ha-ha-ha-ha!"; q$
PRINT
PRINT "With a sly wink, he then hands you the grail.  You study it for a moment,"
PRINT "then glance back at the little man...But he has vanished!"
PRINT
PRINT "Never being weak on courage, you raise the grail to your lips and quaff the"
PRINT "potion..."
PRINT : PRINT : GOSUB KeyWait
PRINT "...And instantly wish you hadn't!  Ackkk!  The stuff tastes like green cough"
PRINT "cough syrup!  Blechh!  It isn't mixing well with the Double Dragon Blombs that"
PRINT "you had with dinner either!"
PRINT
PRINT "What a fool you were for believing that little wretch.  'Special Adventurer'"
PRINT "indeed!  If you ever get your hands on...  Wait, what's this?  What's"
PRINT "happening?"
PRINT : PRINT : GOSUB KeyWait
FOR a = 1 TO 10
   FOR x = 1 TO 15
      COLOR 0, x
      FOR xa = 1 TO 13: PRINT "x+x+x+"; : NEXT: COLOR 0, 0: PRINT
   NEXT
   COLOR 3, 0
NEXT
PRINT : PRINT : GOSUB KeyWait
RETURN
'
'                     The Zypur Riverventure
'                   --------------------------
Zyphur:
GOSUB Title
PRINT "Greetings, "; name$; "."
PRINT
PRINT "You have just been selected for a very large and important task.  Three"
PRINT "months ago a very important scientist, Professor Axom, disappeared.  It was"
PRINT "recently discovered that he was kidnapped by an evil villian known as the"
PRINT "Black Knight."
PRINT
PRINT "The Black Knight is keeping the Professor in his stronghold, which is"
PRINT "rumored to be located in a series of caves somewhere off of the dangerous"
PRINT "Zyphur River.  The Black Knight is forcing the Professor to use his"
PRINT "knowledge to make weapons of destruction which he will use to try and"
PRINT "overthrow the Free Adventurer's Guild."
PRINT : PRINT : GOSUB KeyWait
PRINT "Aside from being morally bound to this task, the SPS (Society for the"
PRINT "Preservation of Scientists) will pay you a reward of 2000 gold pieces and"
PRINT "provide you with a boat for your quest."
PRINT
PRINT "You must explore the dangerous river, find the Black Knight's lair, free"
PRINT "Professor Axom, and make it back to the Main Hall alive.  Piece of cake,"
PRINT "right?"
PRINT : PRINT : GOSUB KeyWait
RETURN
'
'                      The Devil's Tomb
'                    --------------------
Tomb:
GOSUB Title
a$ = "Now you've done it!": GOSUB Center
PRINT
PRINT "While lounging about at the Main Hall one day, you noticed an old book"
PRINT "sitting on the bar, apparently forgotten by someone."
PRINT
PRINT "Curiously you opened it and started to read a tale describing a very"
PRINT "dangerous and challenging dungeon...  In Hades!  As soon as you began to grow"
PRINT "interested, a booming voice appeared from nowhere:"
PRINT : COLOR 2
PRINT "SO, YOU CONSIDER YOURSELF AN ADVENTURER?  WANT A CHALLENGE?  TRY MY DUNGEON!"
PRINT : COLOR 3
PRINT : PRINT : GOSUB KeyWait
PRINT "The voice began to chuckle fiendishly and a hole appeared beneath you.  You"
PRINT "found yourself falling down a dark narrow shaft."
PRINT
PRINT "You hit the bottom and find yourself locked in dungeon cell.  Someplace in the"
PRINT "distance a voice says, ";
COLOR 2: PRINT "GOOD LUCK, SUCKER!": COLOR 3
PRINT : PRINT : GOSUB KeyWait
RETURN
'
'                     The Abductor's Quarters
'                   ---------------------------
Abductor:
GOSUB Title
PRINT name$; ", you are needed."
PRINT
a$ = "A friend of yours, " + friend$ + ", is in trouble.  After trying to retrieve some of"
a$ = a$ + " the many valuable treasures in a nearby dungeon, your friend mysteriously"
a$ = a$ + " disappeared."
GOSUB Lp0: PRINT
PRINT "After careful research, you discover that the dungeon your friend went to"
PRINT "is controlled by a renegade adventurer known only as the Abductor.  You must"
PRINT "find your friend before the Abductor gets nasty and heads start to roll!"
PRINT
PRINT "Good luck!"
PRINT : PRINT : GOTO KeyWait
'
'                     The Quest for Trezore
'                   -------------------------
Trezore:
GOSUB Title
PRINT "You are about to face your most trying task!"
PRINT
PRINT "You must therefore set off to find Trezore, the powerful and great wizard"
PRINT "whose spells have helped (or is it plauged?) you before."
PRINT
PRINT "However, Trezore does not like just anyone to barge in on him, so he has set up"
PRINT "a test to find out if adventurers like yourself are worthy of his attention."
PRINT
PRINT "Good luck to you."
PRINT : PRINT : GOSUB KeyWait
RETURN
'------------------
' Select adventure
'------------------
Pick:
GOSUB Title: PRINT "Select adventure:": PRINT
FOR x = 1 TO 5
PRINT RTRIM$(STR$(x)); ": "; a$(x)
NEXT
PRINT "Enter 1-4: "; : GOSUB KeyWait1: adv = INT(VAL(k$))
IF adv < 1 OR adv > 4 THEN GOTO Pick
adventure$ = a$(adv): mp$ = mp$(adv): author$ = a1$(adv)
RETURN
'-------------------
' Wait for keypress
'-------------------
KeyWait:
PRINT "Press any key to continue...";
KeyWait1:
k$ = INKEY$
BS = POS(0): CC = 0
DO
   CC = CC + 1                           ' CC = Cursor Counter
   IF CC = CC1 THEN PRINT "/": LOCATE CSRLIN - 1, BS
   IF CC = CC2 THEN PRINT CHR$(179): LOCATE CSRLIN - 1, BS
   IF CC = CC3 THEN
     PRINT "\": LOCATE CSRLIN - 1, BS: CC = 0
   END IF
   k$ = INKEY$
LOOP UNTIL k$ <> ""
'
' Clear screen and print adventure name and author
'
Title:
CLS
a$ = adventure$: GOSUB Center: a$ = author$: GOSUB Center
PRINT L$: PRINT : RETURN
'-------------------------------------
' Center a string on 80-column screen
'-------------------------------------
Center:
PRINT SPC((79 - LEN(a$)) / 2); a$
RETURN
'------------------------------
' Print a$ without wrap-around
'------------------------------
Lp0:
xm = 0: a$ = LTRIM$(a$)
IF LEN(a$) <= 79 THEN PRINT a$:  RETURN
FOR k = 79 TO 1 STEP -1
   IF MID$(a$, k, 1) = " " THEN
     PRINT LEFT$(a$, k - 1): a$ = RIGHT$(a$, LEN(a$) - k): k = 1: xm = 1
   END IF
NEXT: IF xm = 1 THEN GOTO Lp0

