' THE WONDERFUL WORLD OF EAMON  (QBASIC VERSION)
'           BY FRANK BLACK 1996-1999
'
'   A COMPUTERIZED FANTASY ROLE-PLAYING SYSTEM
' BASED UPON THE APPLE II VERSION BY DONALD BROWN,
'    JOHN NELSON, TOM ZUCHOWSKI, & FRANK BLACK
'
'                   MAIN HALL v2.0
'                                         Update: 22 JUN 99
'  Text Main Hall by Frank Black, 1996
'  Based upon Don Brown's version
'
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 C AS RECORD

TYPE ADV
   ANAME AS STRING * 78
   NUMBER AS INTEGER
END TYPE
DIM ADV AS ADV

DIM SP%(4), WA%(5), WN$(5), WC%(5), WT%(5), WD%(5), WS%(5), s%(10)

OPEN "DELAY.DAT" FOR INPUT AS #1: INPUT #1, dly, CC1, CC2, CC3: CLOSE
OPEN "settings.dat" FOR INPUT AS #1
FOR x = 1 TO 10: INPUT #1, s%(x): NEXT
CLOSE : IF s%(3) < 1 OR s%(3) > 15 THEN s%(3) = 3

GOSUB Init

CHDIR ".."
OPEN "ADVENTRS" FOR RANDOM AS #2 LEN = 90
GET #2, 1, ADV
NUMADV = ADV.NUMBER
DIM AN$(NUMADV), ANUM(NUMADV)

FOR a = 2 TO NUMADV + 1
   GET #2, a, ADV
   AN$(a - 1) = RTRIM$(ADV.ANAME$): ANUM(a - 1) = ADV.NUMBER
NEXT
CLOSE #2: CHDIR "MAIN"
'--------------------------
Menu:
CLS : COLOR 0, s%(3)
PRINT STRING$(80, " ")
PRINT "      The Wonderful World of Eamon Deluxe ---  Main Hall Version 1.0            "
PRINT STRING$(80, " ")
COLOR s%(3), 0: LOCATE 6
PRINT "As you wander about the Main Hall, you realize you can do one of six things:"
PRINT
PRINT "       1. Go on an adventure.": PRINT
PRINT "       2. Visit the Weapons/Armor shop.": PRINT
PRINT "       3. Hire a Wizard to teach you some spells": PRINT
PRINT "       4. Find the banker to deposit or withdraw some gold.": PRINT
PRINT "       5. Examine your abilities.": PRINT
PRINT "       6. Temporarily leave the universe.": PRINT : PRINT
Choice:
LOCATE 20
PRINT "   Enter the number of your choice (1-6) :"; : GOSUB GetKey
a = VAL(a$): IF a < 1 OR a > 6 THEN GOTO Choice
ON a GOTO Adventure, Shop, Wizard, BANK, Examine, Quit
'------------------------------
' Play an adventure
'
Adventure:
CLS : L = 0
GOSUB Update: PUT #1, rec, C
FOR a = 1 TO NUMADV
   a$ = LTRIM$(RTRIM$(STR$(a))) + ": " + AN$(a): PRINT a$
   L = L + 1: IF L = 20 THEN GOSUB KeyWait: L = 0
NEXT

PRINT
LINE INPUT "Enter the number of your choice (0 exits):"; a$
a = INT(VAL(a$)): IF a < 1 OR a > NUMADV THEN GOTO Menu

a$ = LTRIM$(RTRIM$(STR$(ANUM(a))))
AD$ = LEFT$("E000", 4 - LEN(a$)) + a$
'
' Make sure directory exists before changing char. status
'
CHDIR "..": CHDIR AD$
'
' Make sure other characters aren't in adventure
'
OPEN "GAMEDIR.DAT" FOR INPUT AS #2: INPUT #2, a: CLOSE #2
IF a <> -1 THEN
  OPEN "NEW-MEAT" FOR RANDOM AS #4 LEN = 200: GET #4, 1, C: CLOSE #4
  IF C.status > -1 THEN
    COLOR 14: PRINT : PRINT "You already have a character adventuring there."
    PRINT "(Character: "; RTRIM$(C.cname); ")": PRINT : COLOR s%(3)
    CHDIR "..": CHDIR "MAIN": GOSUB KeyWait: RUN
  END IF
END IF

CHDIR "..": CHDIR "MAIN"
GET #1, rec, C
C.status = 3
PUT #1, rec, C
CLOSE
'
CHDIR "..": CHDIR AD$
OPEN "NEW-MEAT" FOR RANDOM AS #4 LEN = 200
a = 1: C.status = rec
PUT #4, a, C
CLOSE #4
'
' Make sure no old saved games exist
'
OPEN "GAMEDIR.DAT" FOR OUTPUT AS #4
PRINT #4, -1
FOR m = 1 TO 5: PRINT #4, "(none)": NEXT: CLOSE
'
OPEN "delay.dat" FOR OUTPUT AS #1: PRINT #1, dly, CC1, CC2, CC3: CLOSE
RUN "INTRO.BAS"
'------------------------------------
' Buy weapons and/or armor
'
Shop:
CLS : LOCATE 5
PRINT "As you enter the weapon shop, Marcos Cavielli (the owner) comes from out of"
PRINT "the back room and says, "; Q$; "Well, as I live and breathe, if it isn't my old pal,"
PRINT N$; "!": PRINT
PRINT "   "; Q$; "So, what do you need?:"; Q$: PRINT
PRINT " 1. Buy a weapon"
PRINT " 2. Sell a weapon"
PRINT " 3. Get some better Armor?"
PRINT : PRINT "Enter 1-3 or (0 to exit): "; : GOSUB GetKey
CLS : a = INT(VAL(a$)): IF a < 0 OR a > 3 THEN GOTO Shop
F = 0
FOR m = 1 TO 4
   IF WN$(m) <> "NONE" THEN F = F + 1
NEXT
ON a + 1 GOTO Menu, BuyWeapon, SellWeapon, BuyArmour
'
'  Buy a new weapon
'
BuyWeapon:
IF F = 4 THEN
  LOCATE 8
  PRINT "Marcos smiles at you and says, "; Q$; "Thatsa good, but first you must sell me a"
  PRINT "Weapon.  You know the law: No more than four weapons per person!"; Q$
  GOSUB KeyWait: GOTO Menu
END IF

PRINT "Marcos smiles at you and says, "; Q$; "Good! I gotta the best. What kind do you want?"; Q$
GOSUB WepChoice: IF a = 0 THEN GOTO Menu
a$ = "a " + N$: IF a = 1 THEN a$ = "an " + N$
PRINT "Marcos says, "; Q$; "Well I just happen to have "; a$; " in stock of a decent"
PRINT "quality.  I can let you have it for "; LTRIM$(RTRIM$(STR$(P))); " gold pieces."; Q$
PRINT

IF GOLD < P THEN
   PRINT Q$; "However, I see you can't afford that much.  Come back when you can."; Q$
   GOSUB KeyWait: GOTO Menu
END IF

WepLoop:
FOR W = 1 TO 4
   IF WN$(W) = N$ THEN
      N$ = N$ + "#": GOTO WepLoop
   END IF
NEXT

FOR W = 1 TO 4
   IF WN$(W) = "NONE" THEN
      WN$(W) = N$: WT%(W) = TP: WC%(W) = 10: WD%(W) = 1: WS%(W) = SI
      W = 4
   END IF
NEXT
GOLD = GOLD - P
PRINT "Marcos hands you your new weapon and takes the price from you."
GOTO LeaveShop
'
'  Player sells a weapon
'
SellWeapon:
IF F = 0 THEN
  LOCATE 8: PRINT Q$; "You don't have any weapons to sell, "; N$; Q$
  GOTO LeaveShop
END IF
PRINT Q$; "Which weapon do you wanna sell?"; Q$: PRINT
FOR m = 1 TO 4
   IF WN$(m) <> "NONE" THEN
     PRINT " "; LTRIM$(RTRIM$(STR$(m))); ". "; WN$(m)
   END IF
NEXT
PRINT "Enter no. of weapon (0 exits): "; : GOSUB GetKey: a = INT(VAL(a$))
PRINT : IF a < 1 OR a > 4 THEN GOTO Menu
a$ = WN$(a): IF a$ = "NONE" THEN GOTO SellWeapon

Sell1:
IF RIGHT$(a$, 1) = "#" AND LEN(a$) > 1 THEN
  a$ = LEFT$(a$, LEN(a$) - 1): GOTO Sell1
END IF
P = 15: IF WC%(a) > 10 THEN P = P + 25
IF WD%(a) * WS%(a) > 15 THEN P = P + 50
IF WD%(a) * WS%(a) > 25 THEN P = P + 200
IF P > 15 AND P < 200 THEN PRINT Q$; "Hey, this is a pretty good weapon."; Q$
IF P > 200 THEN PRINT Q$; "Very nice, this is a magical weapon."; Q$
PRINT : PRINT Q$; "Well, I can give you "; LTRIM$(RTRIM$(STR$(P)));
PRINT " gold pieces for it."; Q$: PRINT
PRINT "Do you want to sell? (Y/N): "; : GOSUB GetKey: PRINT
IF UCASE$(a$) <> "Y" THEN GOTO Menu

GOLD = GOLD + P
FOR a = a TO 4
   m = a + 1: WN$(a) = WN$(m): WT%(a) = WT%(m): WC%(a) = WC%(m)
   WD%(a) = WD%(m): WS%(a) = WS%(m)
NEXT
PRINT "Marcos gives you your money and takes your weapon.": PRINT
WN$(4) = "NONE": GOTO LeaveShop
'
'  Player buys armor
'
BuyArmour:
A2 = INT(AC / 2): IF AC / 2 <> A2 THEN SH = 1
P1 = A2 * 30 + 10: IF P1 > 100 THEN P1 = 450
IF P1 = 40 THEN P1 = 25
IF P1 = 10 THEN P1 = 0
P2 = INT(P1 / 2)
PRINT "Marcos takes you to the armor section of his shop and shows you suits of"
PRINT "leather, chain and plate armor.": PRINT
PRINT "He says, "; Q$; "I can fit you in any of these pretty cheaply, I need 100 for the"
PRINT "leather, 250 for the chain, and 500 for the plate."; Q$: PRINT
IF P1 > 0 THEN
  PRINT Q$; "Also, I can give you a trade in on your old armor of ";
  PRINT LTRIM$(RTRIM$(STR$(P2))); " gold pieces."; Q$
END IF
PRINT : PRINT Q$; "Well, what will it be?"; Q$: PRINT
PRINT " 1. Leather....100"
PRINT " 2. Chain......250"
PRINT " 3. Plate......500": PRINT
PRINT "Enter 1-3 (0 exits): "; : GOSUB GetKey: a = INT(VAL(a$)): PRINT
IF a < 1 OR a > 3 THEN GOTO Armor1
P = 100: IF a > 1 THEN P = P + 150
IF a = 3 THEN P = P * 2
IF GOLD + P2 < P THEN
  PRINT "Marcos frowns when he sees that you don't have enough to pay for your armor"
  PRINT "and says, "; Q$; "I don't give credit!"; Q$: GOTO LeaveShop
END IF
GOLD = GOLD + P2: a$ = "gold": IF P2 > 0 THEN a$ = a$ + " and your old armor"
PRINT "Marcos takes your "; a$; " and helps you into your new armor.": PRINT
GOLD = GOLD - P: A2 = a
Armor1:
IF SH = 1 THEN GOTO Leave0
PRINT "Marcos smiles and says, "; Q$; "Now how about a shield?  I can let you have one for"
PRINT "only 50 gold pieces."; Q$: PRINT
IF GOLD < 50 THEN
  PRINT Q$; "But, I see that you can't afford that.  Well see me again when you can."; Q$
  GOTO Leave0
END IF
PRINT "Do you want a shield? (Y/N): "; : GOSUB GetKey: PRINT
IF UCASE$(a$) <> "Y" THEN GOTO Leave0
GOLD = GOLD - 50: SH = 1
PRINT "Marcos takes your gold and gives you a shield."

Leave0:
AC = A2 * 2 + SH
LeaveShop:
PRINT
PRINT "Marcos smiles and says, "; Q$; "Come back again soon!"; Q$; " as he shoos you out of his shop."
PRINT : PRINT : GOSUB KeyWait: GOTO Menu

WepChoice:
PRINT : PRINT "  Enter weapon of choice:"
PRINT " 1. Axe          4. Spear": PRINT " 2. Bow          5. Sword"
PRINT " 3. Mace"
PRINT "Enter 1-5 (or 0 to exit): "; : GOSUB GetKey: a = INT(VAL(a$)): PRINT
IF a < 0 OR a > 5 THEN GOTO WepChoice
IF a = 0 THEN RETURN
ON a GOTO Axe, Bow, Mace, Spear, Sword
Axe:
N$ = "axe": P = 25: TP = 1: SI = 6: RETURN
Bow:
N$ = "bow": P = 40: TP = 2: SI = 6: RETURN
Mace:
N$ = "mace": P = 20: TP = 3: SI = 4: RETURN
Spear:
N$ = "spear": P = 25: TP = 4: SI = 5: RETURN
Sword:
N$ = "sword": P = 30: TP = 5: SI = 8: RETURN
'------------------------------
' Learn spells from the Wizard
'
Wizard:
CLS
PRINT "After a few minutes diligent searching, you find Hokas Tokas, the old Mage."
PRINT "He looks at you and says, "; Q$; "So you want old Hokey to teach you some magic, eh?"
PRINT "Well, it'll cost you.  My fees are:": PRINT
PRINT "   Blast...1000 GP"
PRINT "   Heal.....500 GP"
PRINT "   Speed...4000 GP"
PRINT "   Power....100 GP"
PRINT : PRINT Q$; "Well, which will it be?"; Q$: PRINT

WChoice:
LOCATE 12
PRINT "Hit a key, B, H, S, P, or (N)one :"; : GOSUB GetKey
IF a$ = "N" THEN GOTO Menu
FOR SP = 1 TO 4
   IF a$ = MID$("BHSP", SP, 1) THEN GOTO WChoice2
NEXT: GOTO WChoice

WChoice2:
PRINT
ON SP GOTO Blast, Heal, Speed, Power

Blast:
P = 1000: GOTO BuySpell
Heal:
P = 500: GOTO BuySpell
Speed:
P = 4000: GOTO BuySpell
Power:
P = 100: GOTO BuySpell

BuySpell:
IF P > GOLD THEN
   PRINT "When Hokas sees that you don't have enough to pay him, he stalks to the bar,"
   PRINT "muttering about youngsters who should be turned into frogs."
   GOSUB KeyWait: GOTO Menu
END IF

IF SP%(SP) > 0 THEN
   PRINT "Hokas says, "; Q$; "I ought to take your gold anyway, but haven't you forgotten"
   PRINT "something?  I already taught you that spell!"; Q$: PRINT
   PRINT "Shaking his head sadly, he returns to the bar."
   GOSUB KeyWait: GOTO Menu
END IF

GOLD = GOLD - P: SP%(SP) = (RND(1) * 50) + 26
PRINT "Hokas teaches you your spell, takes his fee, and returns to his stool on the"
PRINT "bar.  As you walk away, you hear him order a Double Dragon Blomb."
GOSUB KeyWait: GOTO Menu
'-----------------------------
'  Banker routines
'
BANK:
CLS : LOCATE 5
PRINT "You have no trouble spotting Shylock McFenny, the local banker, due to his large"
PRINT "belly.  You attract his attention, and he comes over to you.": PRINT
a$ = Q$ + "Well, " + N$ + " my dear" + GEN$(SEX) + "what a pleasure to see you!"
a$ = a$ + "  Do you want to make a deposit or a withdrawal?" + Q$: GOSUB PS
PRINT
PRINT "You have "; LTRIM$(RTRIM$(STR$(GOLD))); " GP in hand, ";
PRINT LTRIM$(RTRIM$(STR$(BANK))); " GP in the bank.": PRINT
BChoice:
LOCATE 13
PRINT "(Hit "; Q$; "D"; Q$; " for a Deposit, "; Q$; "W"; Q$; " for a Withdrawl): ";
GOSUB GetKey: IF a$ <> "D" AND a$ <> "W" THEN GOTO BChoice
IF a$ = "W" THEN GOTO Withdraw

Deposit:
CLS : LOCATE 5
PRINT "Shylock gets a wide grin on his face and says, "; Q$; "Good for you!  How much do you"
PRINT "want to deposit?"; Q$: PRINT
PRINT "You have "; LTRIM$(RTRIM$(STR$(GOLD))); " GP in hand, ";
PRINT LTRIM$(RTRIM$(STR$(BANK))); " GP in the bank.": PRINT
LINE INPUT "(Enter the amount to deposit.): "; a$: a$ = LTRIM$(RTRIM$(a$))
MN = VAL(a$): PRINT

IF MN < 0 OR MN <> INT(MN) OR LTRIM$(RTRIM$(STR$(MN))) <> a$ THEN
   PRINT "The banker scowls at you and says, "; Q$; "Come come, you're not making sense!  Try"
   PRINT "again."; Q$
   GOSUB KeyWait: GOTO Deposit
END IF

IF MN > GOLD THEN
   PRINT "The banker was very pleased when you told him the sum, but when he discovered"
   PRINT "that you didn't have that much on you, he walked away shouting about fools who"
   PRINT "try to play tricks on a kindly banker."
   GOSUB KeyWait: GOTO Menu
END IF

GOLD = GOLD - MN: BANK = BANK + MN
PRINT "Shylock takes your money, puts it in his bag, listens to it jingle, then thanks"
PRINT "you and walks away."
GOSUB KeyWait: GOTO Menu

Withdraw:
CLS : LOCATE 5
a$ = "Shylock says, " + Q$ + "Well, you have " + LTRIM$(RTRIM$(STR$(BANK)))
a$ = a$ + " gold pieces stored with me.  How many do you want to take back?" + Q$
GOSUB PS: PRINT
PRINT "You have "; LTRIM$(RTRIM$(STR$(GOLD))); " GP in hand, ";
PRINT LTRIM$(RTRIM$(STR$(BANK))); " GP in the bank.": PRINT
LINE INPUT "(Enter the amount to withdraw.): "; a$: a$ = LTRIM$(RTRIM$(a$))
MN = VAL(a$): PRINT

IF MN < 0 OR MN <> INT(MN) OR LTRIM$(RTRIM$(STR$(MN))) <> a$ THEN
   PRINT "The banker scowls at you and says, "; Q$; "Come, come, you're not making sense!  Try"
   PRINT "again."; Q$
   GOSUB KeyWait: GOTO Withdraw
END IF

IF MN > BANK THEN
   PRINT "Shylock throws you a terrible glance and says, "; Q$; "That's more than you got!  You"
   PRINT "know I don't make loans to your kind!"; Q$; "  With that, he loses himself in the"
   PRINT "crowd. "
   GOSUB KeyWait: GOTO Menu
END IF

GOLD = GOLD + MN: BANK = BANK - MN: PRINT
a$ = "Shylock hands you your gold and says, " + Q$ + "That leaves you with "
a$ = a$ + LTRIM$(RTRIM$(STR$(BANK))) + " gold pieces in my care." + Q$
GOSUB PS: PRINT : PRINT "He shakes your hand and walks away."
GOSUB KeyWait: GOTO Menu

'---------------------------------
' View player data
'
Examine:
FOR a = 1 TO 4
   SP$(a) = LTRIM$(STR$(SP%(a))) + "%"
   IF SP%(a) < 1 THEN SP$(a) = "None"
NEXT
a = INT(AC / 2): SH = ABS((a < AC / 2))
a = ABS((a < 5)) * a + ABS((a > 4)) * 4
AR$ = AR$(a)
IF SH > 0 THEN AR$ = AR$ + " & Shield"
EA = -5 * ABS((AR * 2 <> AC))
IF AR > 0 THEN
   EA = EA - AR * 10: IF AR = 3 THEN EA = EA - 30
END IF

CLS : PRINT "You are the "; SEX$(SEX); N$: PRINT
PRINT "Hardiness: "; HD: LOCATE 3, 20: PRINT "Agility: "; AG
LOCATE 3, 37: PRINT "Charisma: "; CH; "   (Charm Mon:";
a = (CH - 10) * 2
a$ = LTRIM$(STR$(a)) + "%)"
PRINT MID$("+", ABS((a < 1)) * 1 + 1, 1); a$: PRINT

PRINT "Weapon Abilities:"; : LOCATE 5, 41: PRINT "Spell Abilities:"
PRINT "1. Axe:  "; WA%(1); : LOCATE 6, 42: PRINT "Blast..."; SP$(1)
PRINT "2. Bow:  "; WA%(2); : LOCATE 7, 42: PRINT "Heal...."; SP$(2)
PRINT "3. Mace: "; WA%(3); : LOCATE 8, 42: PRINT "Speed..."; SP$(3)
PRINT "4. Spear:"; WA%(4); : LOCATE 9, 42: PRINT "Power..."; SP$(4)
PRINT "5. Sword:"; WA%(5); : LOCATE 10, 24: PRINT "Gold:"; GOLD
LOCATE 10, 56: PRINT "In bank:"; BANK: PRINT

a$ = RTRIM$(STR$(AE)) + "%"
PRINT "Armor:  "; AR$: LOCATE 12, 34: PRINT "Armour Expertise: "; a$
PRINT : a = HD * 10: a$ = LTRIM$(RTRIM$(STR$(a)))

PRINT "Weight Carryable: "; a$; " Gronds  (";
a$ = LTRIM$(RTRIM$(STR$(a * 10)))
PRINT a$; " Dos)": PRINT

PRINT "Weapon Names:             Complexity:         Damage:    Base % to hit:"
FOR a = 1 TO 71: PRINT "-"; : NEXT: PRINT
FOR W = 1 TO 4
   IF WN$(W) = "" OR WN$(W) = "NONE" THEN GOTO WLoop
   IF LEN(WN$(W)) > 30 THEN WN$(W) = LEFT$(WN$(W), 30)
   PRINT WN$(W); SPC(31 - LEN(WN$(W)));
   a$ = LTRIM$(RTRIM$(STR$(WC%(W)))) + "%"
   PRINT a$; SPC(18 - LEN(a$));
   a$ = LTRIM$(RTRIM$(STR$(WD%(W)))) + "D" + LTRIM$(RTRIM$(STR$(WS%(W))))
   PRINT a$; SPC(14 - LEN(a$));
   EA = 0: IF AE < AC * AC THEN EA = AE - AC * AC
   a = INT(50 + (AG - AC) * 2 + WA%(WT%(W)) / 4 + EA + WC%(W) / 2)
   PRINT LTRIM$(RTRIM$(STR$(a))); "%"
WLoop:
NEXT: GOSUB KeyWait: GOTO Menu

'-------------------------------------------
' Update player record and exit to main menu
'
Quit:
GOSUB Update
PUT #1, rec, C
CLOSE
CHDIR "..": RUN "STARTUP.BAS"
END

'---------------------------------
'       SUBROUTINES
'
' Print A$ string in 80 columns
'
PS:
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): GOTO PS
   END IF
NEXT
PRINT "Word too long error!": RETURN
'
' Pause for a moment, fall into GetKey
'
KeyWait:
LOCATE 23: PRINT "Hit any key to continue...";
'
' Get a single keypress, randomize RND seed while waiting
'
GetKey:
BS = POS(0): CC = 0: a$ = INKEY$
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
   a$ = UCASE$(INKEY$): xx = RND
LOOP UNTIL a$ <> ""
PRINT a$: RETURN
'
' Update player record data
'
Update:
C.SP1 = SP%(1): C.SP2 = SP%(2): C.SP3 = SP%(3): C.SP4 = SP%(4)
C.GOLD = GOLD: C.BANK = BANK: C.AC = AC
C.WN1 = WN$(1): C.WN2 = WN$(2): C.WN3 = WN$(3): C.WN4 = WN$(4)
C.WCOMPLX1 = WC%(1): C.WCOMPLX2 = WC%(2): C.WCOMPLX3 = WC%(3): C.WCOMPLX4 = WC%(4)
C.WTYPE1 = WT%(1): C.WTYPE2 = WT%(2): C.WTYPE3 = WT%(3): C.WTYPE4 = WT%(4)
C.WDICE1 = WD%(1): C.WDICE2 = WD%(2): C.WDICE3 = WD%(3): C.WDICE4 = WD%(4)
C.WSIDES1 = WS%(1): C.WSIDES2 = WS%(2): C.WSIDES3 = WS%(3): C.WSIDES4 = WS%(4)
RETURN
'
' Initialize data
'
Init:
OPEN "PLAYER" FOR INPUT AS #1: INPUT #1, rec: CLOSE
OPEN "PLAYERS.DAT" FOR RANDOM AS #1 LEN = 200
GET #1, rec, C

N$ = RTRIM$(C.cname): STAT = C.status: HD = C.A1: AG = C.A2: CH = C.A3
SP%(1) = C.SP1: SP%(2) = C.SP2: SP%(3) = C.SP3: SP%(4) = C.SP4
WA%(1) = C.WA1: WA%(2) = C.WA2: WA%(3) = C.WA3: WA%(4) = C.WA4: WA%(5) = C.WA5
AE = C.AE: SEX = C.SEX: GOLD = C.GOLD: BANK = C.BANK: AC = C.AC
WN$(1) = RTRIM$(C.WN1): WN$(2) = RTRIM$(C.WN2): WN$(3) = RTRIM$(C.WN3): WN$(4) = RTRIM$(C.WN4)
WC%(1) = C.WCOMPLX1: WC%(2) = C.WCOMPLX2: WC%(3) = C.WCOMPLX3: WC%(4) = C.WCOMPLX4
WT%(1) = C.WTYPE1: WT%(2) = C.WTYPE2: WT%(3) = C.WTYPE3: WT%(4) = C.WTYPE4
WD%(1) = C.WDICE1: WD%(2) = C.WDICE2: WD%(3) = C.WDICE3: WD%(4) = C.WDICE4
WS%(1) = C.WSIDES1: WS%(2) = C.WSIDES2: WS%(3) = C.WSIDES3: WS%(4) = C.WSIDES4

FOR a = 1 TO 4
   IF WN$(a) = "" THEN WN$(a) = "NONE"
NEXT

IF SEX < 0 OR SEX > 1 THEN SEX = 0
FOR a = 0 TO 4: READ AR$(a): NEXT
SEX$(0) = "Mighty ": SEX$(1) = "Fair ": GEN$(0) = " boy ": GEN$(1) = " girl "
Q$ = CHR$(34)
RETURN

DATA Clothes,Leather,Chain Mail,Plate Mail,Magic/Exotic

