'*************************************************************
'*           THE WONDERFUL WORLD OF EAMON DELUXE             *
'*                      BY FRANK BLACK                       *
'*                                                           *
'*        A COMPUTERIZED FANTASY ROLE-PLAYING SYSTEM         *
'*     BASED UPON THE APPLE II VERSION BY DONALD BROWN,      *
'*        JOHN NELSON, TOM ZUCHOWSKI, & FRANK BLACK          *
'*                                                           *
'*                 ADVENTURE INTRO PROGRAM                   *
'*                                                           *
'* Best of the Classic Eamon Adventures    Update: 12 JUL 99 *
'*                                                           *
'*        All non-commercial distribution encouraged         *
'*************************************************************

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 pz AS RECORD

READ a
DIM SHARED a$(a), a1$(a), mp$(a), dly#, CC1#, CC2#, CC3#, adv, adv1, adv2

adv2 = a
FOR a = 1 TO adv2
   READ a$(a), a1$(a), mp$(a): a1$(a) = "By " + a1$(a)
NEXT

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, pz: CLOSE
name$ = LTRIM$(RTRIM$(pz.CNAME$)): sex = pz.sex: q$ = CHR$(34)

L$ = STRING$(80, 196)
OPEN "GAMEDIR.DAT" FOR INPUT AS #1: INPUT #1, a: CLOSE
author1$ = "Converted to Eamon Deluxe by Frank Black"
Adventure1$ = "Best of the Classic Adventures"
author$ = author1$: Adventure$ = Adventure1$

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 "EAMONDX.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
adv = adv1: Adventure$ = a$(adv): mp$ = mp$(adv): author$ = a1$(adv)
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 Ngurct, Grail, Clouds, Kophinos, NaGog, Canyon, Guild, Search, Tavern, Fugitive, Camp, Doom, Pittfall, Vigil, Peg
GOTO IntroDone

'              First-time intro
'             ------------------
Intro:
GOSUB Title
a$ = "This is official Eamon Deluxe adventure #12": GOSUB Center: PRINT
PRINT : PRINT : GOSUB KeyWait

Menu:
author$ = author1$: Adventure$ = Adventure1$: GOSUB Title
COLOR 2
FOR a = 1 TO adv2 STEP 2
   PRINT a$(a);
   IF a + 1 <= adv2 THEN LOCATE CSRLIN, 40: PRINT a$(a + 1);
   PRINT
NEXT
COLOR 3: PRINT

PRINT " 1. Read intro stories"
PRINT " 2. Read adventure reviews"
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
GOSUB Pick
ON k GOTO Stories, Reviews, IntroDone0

Stories:
GOSUB Title
ON adv GOSUB Ngurct, Grail, Clouds, Kophinos, NaGog, Canyon, Guild, Search, Tavern, Fugitive, Camp, Doom, Pittfall, Vigil, Peg
GOTO Menu

Reviews:
GOSUB Title
ON adv GOSUB Ngurct1, Grail1, Clouds1, Kophinos1, NaGog1, Canyon1, Guild1, Search1, Tavern1, Fugitive1, Camp1, Doom1, Pittfall1, Vigil1, Peg1
GOTO Menu

IntroDone0:
GOSUB Title
ON adv GOSUB Ngurct, Grail, Clouds, Kophinos, NaGog, Canyon, Guild, Search, Tavern, Fugitive, Camp, Doom, Pittfall, Vigil, Peg
IntroDone:
PRINT "(Waking up the monsters...)"
OPEN "ADV.DAT" FOR OUTPUT AS #1: PRINT #1, adv: CLOSE
RUN mp$

Ngurct:
Ngurct1:
Grail:
Grail1:
Clouds:
Clouds1:
Kophinos:
Kophinos1:
NaGog:
NaGog1:
Canyon:
Canyon1:
Guild:
Guild1:
Search:
Search1:
Tavern:
Tavern1:
Fugitive:
Fugitive1:
Camp:
Camp1:

'                          Dungeon of Doom
'                         -----------------
' Converted Jan, 1997
Doom:
DIM pic%(1 TO 3460)
TYPE pictype
   s AS STRING * 6920
END TYPE
DIM picrec AS pictype
SCREEN 7

OPEN "DOOM.PIC" FOR RANDOM AS #1 LEN = 6920
    GET #1, 1, picrec
    a$ = picrec.s
    z = 1
    FOR a = 1 TO 3460 * 2 STEP 2
       pic%(z) = CVI(MID$(a$, a, 2))
       z = z + 1
    NEXT
    PUT (0, 0), pic%, PSET
    GET #1, 2, picrec
    a$ = picrec.s
    z = 1
    FOR a = 1 TO 3460 * 2 STEP 2
       pic%(z) = CVI(MID$(a$, a, 2))
       z = z + 1
    NEXT
    PUT (140, 0), pic%, PSET
    GET #1, 3, picrec
    a$ = picrec.s
    z = 1
    FOR a = 1 TO 3460 * 2 STEP 2
       pic%(z) = CVI(MID$(a$, a, 2))
       z = z + 1
    NEXT
    PUT (0, 96), pic%, PSET
    GET #1, 4, picrec
    a$ = picrec.s
    z = 1
    FOR a = 1 TO 3460 * 2 STEP 2
       pic%(z) = CVI(MID$(a$, a, 2))
       z = z + 1
    NEXT
    PUT (140, 96), pic%, PSET
CLOSE
FOR x# = 1 TO dly# * 6: NEXT
SCREEN 0: WIDTH 80: CLS : COLOR 3: GOSUB Title
PRINT "Dear Adventurer:": PRINT
PRINT "You have been chosen by the A.A.A. (Adventurers' Association of America) as"
PRINT "the only one capable of the following task:"
PRINT
PRINT "     You are to enter the dark recesses of the Dungeon of the great dragon,"
PRINT "Shantieka, in search of the BLACK SWORD.  It has been said that Shantieka"
PRINT "herself guards the sword, deep in the dungeon's lower level.  You are to find"
PRINT "it, and then return it to the A.A.A. (by making it out of the dungeon alive.)"
PRINT
PRINT "     If you should make it back with the sword, great wealth and fame shall be"
PRINT "yours.  And now, you are teleported into Shantieka's dungeon.  Good luck."
PRINT : PRINT : GOTO KeyWait
'            ------------------
'             Adventure review
'            ------------------
Doom1:
PRINT : PRINT : GOTO KeyWait
Pittfall:
Pittfall1:
Vigil:
Vigil1:
Peg:
Peg1:
PRINT : PRINT : GOTO KeyWait
'                *****************
'                  Review header
'                *****************
Review1:
GOSUB Title: COLOR 2: PRINT "The Eamon Adventurer's Guild"
PRINT "Thomas Zuchowski, Editor": PRINT "7625 Hawkhaven Dr."
PRINT "Clemmons, NC  27012      (336) 766-7490": COLOR 3: PRINT : PRINT
PRINT "The following is from the "; s$; " issue of the Eamon Adventurer's Guild"
PRINT "newsletter.  The EAG supports the Apple II version of Eamon and not Eamon"
PRINT "Deluxe.  The review is for the old Apple II version.": PRINT
PRINT "The EAG rating system is from 1-10 (10 being the best), the average rating"
PRINT "is displayed with the number of people who have rated it.  e.g. 4.6/3 is an"
PRINT "average rating of 4.6 by the ratings of three people.": PRINT
PRINT "Remember, these reviews were written for the OLD versions of these adventures!"
PRINT : PRINT : GOTO KeyWait

'                 ********************
'                   Select adventure
'                 ********************
Pick:
GOSUB Title: PRINT "Select adventure:": PRINT
FOR a = 1 TO adv2 STEP 2
   PRINT RTRIM$(STR$(a)); ": "; a$(a);
   IF a + 1 <= adv2 THEN
     LOCATE CSRLIN, 40: PRINT RTRIM$(STR$(a + 1)); ": "; a$(a + 1);
   END IF
   PRINT
NEXT: PRINT
PRINT "Enter 1-"; LTRIM$(RTRIM$(STR$(adv2)));
LINE INPUT ": "; k$: adv = INT(VAL(k$))
IF adv < 1 OR adv > adv2 THEN GOTO Pick

adv = 12

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
   IF CC# = CC1# THEN PRINT "/"; : LOCATE CSRLIN, BS
   IF CC# = CC2# THEN PRINT CHR$(179); : LOCATE CSRLIN, BS
   IF CC# = CC3# THEN PRINT "\"; : LOCATE CSRLIN, BS: CC# = 0
   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

'
' Adventure data
'
DATA 15
DATA The Temple of Ngurct,AA,NGURCT
DATA Quest for the Holy Grail,AA,GRAIL
DATA City in the Clouds,AA,CLOUDS
DATA Castle Kophinos,AA,KOPHINOS
DATA The Black Castle of NaGog,AA,NAGOG
DATA The Deep Canyon,AA,CANYON
DATA Temple of the Guild,AA,GUILD
DATA The Search for Yourself,AA,SEARCH
DATA The Prince's Tavern,AA,TAVERN
DATA The Fugitive,AA,FUGITIVE
DATA Camp Eamon,AA,CAMP
DATA Dungeon of Doom,Dan Knezek,DOOM
DATA Pittfall,AA,PITTFALL
DATA Wrenhold's Secret Vigil,AA,VIGIL
DATA Peg's Place,AA,PEG

