Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rem /// Sphinx Adventure '/ V1 (Tape for BBC & Electron) '/ V2 (Disc for BBC)
- Rem /// (c) 1982, 1984 Acornsoft & Paul Fellows
- Rem
- Rem /// Sphinx 2 | Converted by ihardcas TO QB64 August 2021
- Rem /// Sphinx 2.1 | Added SAVE/LOAD logic - use xsave/xload UNTIL I can GET filenames into the noun/verb mechanism
- Rem /// Sphinx 2.1a | Working AND plays through - few cosmetic glitches TO sort.
- Rem /// Sphinx 2.1b | Most old BBC reference code stripped OUT from comments
- Rem /// Sphinx 2.1c | Properly implemented file names in SAVE/LOAD. xsave AND xload removed
- Rem /// Sphinx 2.1d | Moved Responses TO subResponse
- Rem /// Sphinx 2.1e | Fixed post DIAXOS movement.
- Rem | Changed some labels/procs etc TO something more meaningful
- Rem | Added turnincrementer logic
- Rem | PUT the ObjLocs AND ExitData TO arrays AND PUT in a SUB.
- Rem | Removed the initialize SUB. Brought code TO start of main.
- Rem /// Sphinx 2.1f | appended .sav TO FILES loaded AND saved.
- Rem | Some more tidyup of labels etc
- Rem | Added dis/ena dwarf command TO disable the fckng dwarf
- Rem | finagled some more variable names
- Rem /// Sphinx 2.1g | fixed bridge printing glitch.
- Rem | Fixed some Dwarf business
- Rem /// Sphinx 2.1h | Added decent wordwrappery SUB
- Rem /// Sphinx 2.1i | Moved text OUTPUT TO new wordwrap routing
- Rem | Disabled old text OUTPUT routines
- Rem | Fixed dwarf fight routine.
- Rem /// Sphinx 2.1j | Some variable tidyup
- Rem | fixed iffy pirate behavior.
- Rem /// Sphinx 2.2 | Release TO other platforms -- still need TO DO a playthrough TO make sure it all still works!!
- Rem | Removed all compound statements (:)
- Rem /// Sphinx 2.3 | Removed references TO subResponse AND statically entered responses
- Rem /// Sphinx 2.4 | Moved reading in of descriptions TO own SUB
- Rem /// Sphinx 2.5 | Moved reading in of objects TO own SUB
- Rem | Changed the EXIT printing a bit since it relied ON over-reading the object DATA (cheeky!)
- Rem /// Sphinx 2.6 | Moved the verb reading bit OUT TO own SUB
- Rem | Changed the XOR safe opening logic.
- ' QB Specific screen setup
- DIM SHARED colGreen
- DIM SHARED colRed
- DIM SHARED colCyan
- colGreen = 2
- colRed = 4
- colCyan = 3
- SCREEN 0
- WIDTH 80, 40
- Color colGreen
- ' QB Done
- DIM SHARED varObjectLocations(56)
- DIM SHARED varObjectDesc$(56)
- DIM SHARED varExitArray(6)
- DIM SHARED varExits(143 * 6)
- DIM SHARED varLocationDescription$(143)
- DIM SHARED varVerb$(44)
- DIM SHARED varKilledFlag, varKneelingFlag, varFlamesFlag, varLampLitFlag, varScore, varBearFlag, varRabbitFlag
- DIM SHARED varLampFuel, varScreenWidth, varSafeOpenFlag, varDwarfChance, varDwarfFlag, varTurnIncrement, varGoblinEncounters
- DIM SHARED varCurrentLocation, varTurnCount, varChasmFlag, varCasketOpenFlag, varDwarfEncounters, varMAX
- DIM SHARED varWord1$, varWord2$, varWord1Index, varWord2Index, varGotWaterFlag, varDirections$, varVampireEncounters
- DIM SHARED varTurnLastSeenDwarf, varSuppressDwarf ' varTurnLastSeenDwarf is a counter that resets after meeting the Dwarf. Means we dont see him for 25 turns.
- DIM SHARED X, varCarryingCounter, K, varWavingAtSphinxFlag, M, cn, N, W, Q, varSpacePos, varBridgeFlag, MAP, O$, R$
- 'Set up some variables
- varDirections$ = "nsewud"
- varKneelingFlag = 0
- varWavingAtSphinxFlag = 0
- varTurnLastSeenDwarf = 0
- varGotWaterFlag = 0
- varDwarfChance = 0.97
- varLampFuel = 150 ' put some fuel in t'lamp
- B2$ = " "
- K = 0
- varWord1Index = 0
- I = 0
- X = 0
- varTurnCount = 0
- varChasmFlag = 0
- varBridgeFlag = 0
- varKilledFlag = 0
- varCasketOpenFlag = 0
- varSuppressDwarf = 0
- varDwarfEncounters = 0
- varSafeOpenFlag = 0
- varFlamesFlag = 1
- varLampLitFlag = 0
- varScore = 0
- varCarryingCounter = -3 ' varCarryingCounter is the number of items currently being carried. Wonder why it starts at -3?
- varVampireEncounters = 0
- varGoblinEncounters = 0
- varBearFlag = 0
- varRabbitFlag = 0
- varScreenWidth = 80 ' Set varScreenWidth
- varTurnIncrement = 1 ' Set this flag if the Turn counter is to increment. Some subs will set it to zero so the varTurnCount doesnt increment (inv, save etc)
- CALL subReadExits
- CALL subReadObjectLocations
- CALL subReadLocationDescriptions
- CALL subReadObjects
- CALL subReadVerbs
- varCurrentLocation = 6 'set starting location
- PRINT
- PRINT " W E L C O M E T O "
- PRINT
- PRINT " .d8888b. 8888888b. 888 888 8888888 888b 888 Y88b d88P "
- PRINT "d88P Y88b 888 Y88b 888 888 888 8888b 888 Y88b d88P "
- PRINT "Y88b. 888 888 888 888 888 88888b 888 Y88o88P "
- PRINT " `Y888b. 888 d88P 8888888888 888 888Y88b 888 Y888P "
- PRINT " `Y88b. 8888888P' 888 888 888 888 Y88b888 d888b "
- PRINT " `888 888 888 888 888 888 Y88888 d88888b "
- PRINT "Y88b d88P 888 888 888 888 888 Y8888 d88P Y88b "
- PRINT " `Y8888P' 888 888 888 8888888 888 Y888 d88P Y88b "
- PRINT
- PRINT " A D V E N T U R E "
- PRINT
- PRINT
- PRINT " GOOD LUCK IN YOUR EXPLORATIONS HERE!! "
- PRINT
- PRINT " Try to find all the treasure and take it to the sphinx. "
- PRINT
- PRINT " Original (c) Acornsoft 1982. Dragged into 21st Century by Iain "
- PRINT
- PRINT
- PRINT "Press Enter to continue!"
- INPUT "", dummy$
- CLS
- CALL subPrintLocation(varCurrentLocation)
- labMainLoop: ' Start of main loop
- A$ = " "
- X = 0
- varWord2$ = " "
- varWord1$ = " "
- varOutputString$ = ""
- M = 0
- K = 0
- IF varTurnIncrement = 1 THEN
- varTurnCount = varTurnCount + 1 ' Increment turn counter
- END IF
- 'If Light is lit then decrease fuel
- IF varLampLitFlag = 1 AND varTurnIncrement = 1 THEN
- varLampFuel = varLampFuel - 1
- varWord1Index = 0
- varWord2Index = 0
- END IF
- 'Reset the Turn Incrementer thingy flag
- varTurnIncrement = 1
- ' varObjectLocations(31) is the frigging dwarf. This makes the dwarf appear 3% of the time if Turns - s >25. Resets varTurnLastSeenDwarf to turns.
- ' Dwarf might reappear after 25 turns
- ' I replaced RND(1)>0.97 with varDwarfChance. That way I can stop the damn thing killing me while debugging.
- ' Need a better variable name for varTurnLastSeenDwarf
- IF RND(1) > varDwarfChance AND varDwarfFlag = 0 AND (varTurnCount - varTurnLastSeenDwarf) > 25 THEN
- varObjectLocations(31) = varCurrentLocation 'put the dwarf in this loc
- varDwarfFlag = 1
- varTurnLastSeenDwarf = varTurnCount
- END IF
- IF varCurrentLocation <> varObjectLocations(31) OR varDwarfChance = 2 THEN 'is the Dwarf NOT here or been disabled
- GOTO labNoDwarf
- ELSE
- ' Assume Dwarf IS here
- varDwarfEncounters = varDwarfEncounters + 1 'increment the dwarf encounter counter.
- CALL subPrintText("There is a dwarf here. He throws an axe at you.")
- IF varObjectLocations(1) = 0 THEN 'we have no axe in inventory
- varObjectLocations(1) = varCurrentLocation 'if no then leave axe here
- END IF
- IF varDwarfEncounters > 6 OR RND(1) > 0.95 THEN 'Have we seen the dwarf 6 times or do hit the unlucky 5%? =we die
- CALL subPrintText("The axe hits you hard in the chest and you bleed to death.")
- CALL subKill
- END IF
- IF varObjectLocations(1) = varCurrentLocation THEN 'do I have axe in inventory (location1)?
- CALL subPrintText("The axe misses and lands on the ground next to you.")
- ELSE
- IF varObjectLocations(1) <> varCurrentLocation THEN
- CALL subPrintText("The axe misses then vanishes into thin air.")
- END IF
- END IF
- END IF
- 'Reset Dwarf Suppress flag (things like inv, debug etc set this
- varSuppressDwarf = 0
- labNoDwarf:
- ' Lets do the Goblins now.
- R$ = " "
- IF varCurrentLocation = 48 AND varCurrentLocation = varObjectLocations(33) THEN ' Are we in location 48(Hall of the mountain king) and are there goblins here?
- varGoblinEncounters = varGoblinEncounters + 1 'Increment the goblin encounter counTer.
- IF varGoblinEncounters >= 5 THEN 'kill us if more than 5 encounters
- CALL subPrintText("The goblins suddenly leap upon you and tear you limb from limb!")
- CALL subKill
- R$ = ""
- END IF
- END IF
- IF varCurrentLocation = varObjectLocations(43) THEN 'Test for presence of vampires
- varVampireEncounters = varVampireEncounters + 1 'increment vampire encounter counter
- IF varVampireEncounters >= 2 THEN 'if more than two encounters then....
- CALL subPrintText("The vampire leaps on you and drains your blood.")
- CALL subKill ' oh dear...
- END IF
- END IF
- 'is our location>8 ("inside?"), do we not have a lamp, nor is there a lamp here then...
- IF varCurrentLocation > 8 AND varObjectLocations(3) <> 1 AND varCurrentLocation <> varObjectLocations(3) THEN
- PRINT
- CALL subPrintText("IT'S VERY DARK.")
- CALL subPrintText("IF YOU MOVE YOU MAY FALL INTO A PIT.")
- GOTO lab200
- END IF
- 'Is the lamp out of fuel? is it lit and do we have it?
- IF varLampFuel <= 0 AND varLampLitFlag = 1 AND varObjectLocations(3) = 1 THEN
- PRINT
- CALL subPrintText("Your lamp has run out.")
- varLampLitFlag = 0
- ELSE
- IF varLampFuel < 10 AND varLampLitFlag = 1 AND varObjectLocations(3) = 1 THEN 'same tests but for dimming light.
- PRINT
- CALL subPrintText("Your lamp is getting dim.")
- END IF
- END IF
- IF varLampLitFlag = 0 AND varCurrentLocation > 8 THEN
- PRINT
- CALL subPrintText("It's very dark.")
- CALL subPrintText("If you move, you may fall into a pit.")
- END IF
- lab200: 'Get user input and parse it.
- PRINT
- INPUT "Command "; A$
- PRINT
- IF LEN(A$) = 0 THEN
- CALL subPrintText("What?")
- GOTO lab200
- END IF
- A$ = funConvertLowerCase$(A$)
- IF LEFT$(A$, 3) = "inv" THEN
- varTurnIncrement = 0 'Tell the turnIncrementer not to increment
- CALL subPrintLocation(1)
- GOTO labMainLoop
- END IF
- IF A$ = "disdwarf" THEN
- CALL subPrintText("Dwarf disabled")
- varTurnIncrement = 0
- varDwarfChance = 2
- varDwarfFlag = 0
- varDwarfIncrement = 0
- varTurnLastSeenDwarf = 0
- varObjectLocations(31) = 0
- ' GoTo lab200
- END IF
- IF A$ = "enadwarf" THEN
- CALL subPrintText("Dwarf enabled")
- varDwarfIncrement = 0
- varTurnIncrement = 0
- varDwarfChance = 0.97
- GOTO lab200
- END IF
- IF A$ = "debug" THEN
- varTurnIncrement = 0 'Tell the turnIncrementer not to increment
- CALL subDebug
- GOTO labMainLoop
- END IF
- 'If single letter command then treat as a direction (NSEWUD)
- IF LEN(A$) = 1 THEN
- CALL subVerbMove(A$, varCurrentLocation)
- GOTO labMainLoop
- END IF
- 'Look for a space in the command. Then look for another space in the bit of
- 'string after the space. Tells us there's more than one word.
- varSpacePos = INSTR(A$, " ")
- IF INSTR(funTrimSpaces$(RIGHT$(A$, LEN(A$) - varSpacePos)), " ") <> 0 THEN
- CALL subPrintText("I'm sorry. I can't understand more than two words at a time")
- varTurnIncrement = 0
- GOTO labMainLoop
- END IF
- 'If no spaces then process as a single verb
- 'else there must be two words so split into varWord1$ and varWord2$ and pass as verb then noun.
- IF varSpacePos = 0 THEN
- CALL subProcessVerb(A$)
- GOTO lab211
- ELSE
- varWord1$ = funTrimSpaces$(LEFT$(A$, varSpacePos - 1))
- varWord2$ = funTrimSpaces$(RIGHT$(A$, LEN(A$) - varSpacePos))
- IF varWord1$ = "load" THEN 'this is a bit cheeky but since the interpreter doesnt take an arbitrary 2nd param, have to intercept & do this.
- varTurnIncrement = 0 'Tell the turnIncrementer not to increment
- CALL subLoad(varWord2$)
- GOTO lab200
- END IF
- IF varWord1$ = "save" THEN
- varTurnIncrement = 0 'Tell the turnIncrementer not to increment
- CALL subSave(varWord2$)
- GOTO lab200
- END IF
- CALL subProcessVerb(varWord1$) 'Get the index of the Verb entered
- CALL subProcessNoun(varWord2$) 'Get the index of the noun entered
- END IF
- IF varWord1$ = "go" OR varWord1$ = "exit" OR varWord1$ = "leave" THEN
- GOTO lab244
- END IF
- IF varWord1$ = "drink" THEN
- CALL subVerbEat(varWord2Index, 2)
- GOTO labMainLoop
- END IF
- 'varWord1Index and varWord2Index are the indexes of the inputted verb and noun.
- 'If varWord1Index isnt indexed as a known word then print "I don't understand the word"
- IF varWord1Index = -1 THEN
- CALL subPrintText("I don't understand the word " + varWord1$)
- varTurnIncrement = 0
- IF varWord2Index <> -1 THEN
- GOTO labMainLoop
- END IF
- END IF
- 'Do same for varWord2Index
- IF varWord2Index = -1 THEN
- CALL subPrintText("I don't understand the word " + varWord2$)
- varTurnIncrement = 0
- GOTO labMainLoop
- ELSE
- IF varWord1Index > 14 THEN 'not one of the first 14 words defined at labVerbs: so process otherwise
- GOTO lab211
- END IF
- END IF
- ' Verbs:
- ' We can see that Get and Take jump to the same routine
- ' get, take, open, wave, throw, drop, kill, eat, cross, feed, rub, light, read, pay
- ON varWord1Index GOTO lab213, lab213, lab214, lab215, lab216, lab217, lab218, lab220, lab221, lab224, lab225, lab226, lab227, lab228
- lab211:
- IF A$ = "exit" THEN
- CALL subVerbOut(varCurrentLocation) 'synonym with Out.
- GOTO labMainLoop
- ELSE
- IF varWord1Index <> -1 THEN
- K = varWord1Index - 14 'so now we've detected a verb that has no noun K=index of that verb - 14 (<14=two word verbs)
- ELSE
- CALL subProcessNoun(A$)
- IF varWord2Index = -1 THEN
- CALL subPrintText("I don't understand the word " + A$)
- GOTO labMainLoop
- ELSE
- CALL subPrintText("What do you want to do to the " + A$)
- GOTO labMainLoop
- END IF
- END IF
- END IF
- lab212:
- ON K GOTO lab237, lab229, lab230, lab230, lab231, lab232, lab235, lab236, lab229, lab238, lab240, lab243, lab243, lab243, lab243, lab243, lab243, lab219, lab244
- CALL subPrintText("I can't apply that without a noun")
- GOTO labMainLoop
- lab213: 'Get/Take
- CALL subVerbGetTake(varWord2Index, varCurrentLocation, 1)
- IF X = 0 THEN 'X seems to be set to 1 on an unsuccesful get
- varCarryingCounter = varCarryingCounter + 1 'varCarryingCounter=Carrying = there's a max of 15
- GOTO labMainLoop
- ELSE
- GOTO labMainLoop
- END IF
- lab214: 'Open
- CALL subVerbOpen(varWord2Index)
- GOTO labMainLoop
- lab215: 'Wave
- CALL subVerbWave(varWord2Index)
- GOTO labMainLoop
- lab216: 'Throw
- CALL subVerbThrow(varWord2Index)
- IF X = 0 THEN 'X seems to be set to 1 on an unsuccesful throw
- varCarryingCounter = varCarryingCounter - 1 'varCarryingCounter=Carrying - there's a max of 15
- GOTO labMainLoop
- ELSE
- GOTO labMainLoop
- END IF
- lab217: 'drop = takes you to Get routine
- CALL subVerbGetTake(varWord2Index, 1, varCurrentLocation) 'Drop - calls 'get with INV a location
- IF X = 0 THEN
- varCarryingCounter = varCarryingCounter - 1 'varCarryingCounter=Carrying - there's a max of 15
- GOTO labMainLoop
- ELSE
- GOTO labMainLoop
- END IF
- lab218: 'Kill
- CALL subVerbKill(varWord2Index)
- GOTO labMainLoop
- lab219: 'Fill
- CALL subVerbFill(varWord2Index)
- GOTO labMainLoop
- lab220: 'Eat
- CALL subVerbEat(varWord2Index, 1)
- GOTO labMainLoop
- lab221: 'Cross
- CALL subVerbCross(varWord2Index)
- GOTO labMainLoop
- IF varWord2Index = 53 THEN
- CALL subVerbCross(varWord2Index)
- GOTO labMainLoop
- END IF
- IF varWord2Index = 56 THEN 'varWord2Index=building
- IF varCurrentLocation <> 3 AND varCurrentLocation < 9 THEN 'Not Blacksmiths Forge and not outside
- varCurrentLocation = 3
- CALL subPrintLocation(varCurrentLocation)
- GOTO labMainLoop
- ELSE
- IF varCurrentLocation = 3 THEN
- varCurrentLocation = 2
- CALL subPrintLocation(varCurrentLocation)
- GOTO labMainLoop
- ELSE
- CALL subPrintText("I can't apply that")
- GOTO labMainLoop
- END IF
- END IF
- END IF
- lab224:
- CALL subVerbFeed(varWord2Index)
- GOTO labMainLoop
- lab225:
- CALL subVerbRub(varWord2Index)
- GOTO labMainLoop
- lab226:
- CALL subVerbLight(varWord2Index)
- GOTO labMainLoop
- lab227:
- CALL subVerbRead(varWord2Index)
- GOTO labMainLoop
- lab228: 'pay
- CALL subVerbPay(varWord2Index)
- GOTO labMainLoop
- lab229:
- CALL subVerbIn(varCurrentLocation)
- GOTO labMainLoop
- lab230:
- CALL subVerbOut(varCurrentLocation)
- GOTO labMainLoop
- lab231:
- R$ = "#" 'This # was something different
- varKneelingFlag = 1
- CALL subPrintText("You are kneeling down.")
- GOTO labMainLoop
- lab232:
- CALL subPrintText("You don't want to quit already do you?")
- varTurnIncrement = 0 'dont need to increment the turn counter
- lab233:
- INPUT "yes or no", A$
- A$ = LEFT$(funConvertLowerCase$(A$), 1)
- IF A$ = "n" THEN
- GOTO labMainLoop
- END IF
- IF A$ = "y" THEN
- CALL subPrintText("OK")
- CALL subCalculateScore(varCurrentLocation)
- END
- ELSE
- GOTO lab233
- END IF
- lab235: 'score
- CALL subCalculateScore(varCurrentLocation)
- GOTO labMainLoop
- lab236: 'look
- CALL subPrintLocation(varCurrentLocation)
- GOTO labMainLoop
- lab237: 'inventory
- CALL subPrintLocation(1)
- GOTO labMainLoop
- lab238: 'help
- CALL subPrintHelp
- GOTO labMainLoop
- lab240: 'DIAXOS
- 'not all BASICs seem to handle XORing so tidily so have done it manually.
- IF varSafeOpenFlag = 0 THEN
- varSafeOpenFlag = 1
- ELSEIF varSafeOpenFlag = 1 THEN
- varSafeOpenFlag = 0
- END IF
- 'varSafeOpenFlag = varSafeOpenFlag Xor 1 'varSafeOpenFlag is the safe door open flag. Every time we say diaxos, the safe door toggles
- CALL subPrintText("There was a very loud creaking sound then!")
- IF varCurrentLocation = 137 THEN 'Wizards spell chamber
- varCurrentLocation = 138 'West Antechamber
- ELSE
- IF varCurrentLocation = 141 THEN 'Room similar to spell chamber
- varCurrentLocation = 11 ' Sorcerers Lair
- END IF
- END IF
- CALL subPrintLocation(varCurrentLocation)
- GOTO labMainLoop
- lab243:
- varWord1$ = LEFT$(varWord1$, 1)
- CALL subVerbMove(varWord1$, varCurrentLocation)
- GOTO labMainLoop
- lab244:
- varWord2$ = funTrimSpaces$(varWord2$)
- CALL subProcessVerb(varWord2$)
- IF varWord1Index > 25 AND varWord1Index < 32 THEN 'varWord1Index is the verb index. 26=N s,e,w,u 31=D
- CALL subVerbMove(LEFT$(varWord2$, 1), varCurrentLocation)
- GOTO labMainLoop
- ELSE
- IF LEN(varWord2$) = 1 THEN
- CALL subVerbMove(varWord2$, varCurrentLocation)
- GOTO labMainLoop
- ELSE
- IF varWord1Index <> -1 THEN
- K = varWord1Index - 14
- GOTO lab212
- END IF
- END IF
- END IF
- 'double check this logic if there's problems
- CALL subProcessNoun(varWord2$)
- IF varWord2Index = -1 THEN
- CALL subPrintText("I can't apply that")
- GOTO labMainLoop
- END IF
- IF varWord2Index = 53 THEN 'bridge
- CALL subVerbCross(varWord2Index)
- GOTO labMainLoop
- END IF
- IF varWord2Index <> 56 THEN 'building
- CALL subPrintText("I can't apply that")
- GOTO labMainLoop
- ELSE
- IF varCurrentLocation <> 3 AND varCurrentLocation < 9 THEN
- varCurrentLocation = 3
- CALL subPrintLocation(varCurrentLocation)
- GOTO labMainLoop
- ELSE
- IF varCurrentLocation = 3 THEN
- varCurrentLocation = 2
- CALL subPrintLocation(varCurrentLocation)
- GOTO labMainLoop
- END IF
- END IF
- END IF
- CALL subPrintText("I can't apply that")
- GOTO labMainLoop
- SUB subKill ()
- PRINT
- CALL subPrintText("Oh dear you seem to have been killed !")
- varKilledFlag = varKilledFlag - 100
- CALL subCalculateScore(varCurrentLocation)
- CALL subPrintText("You had " + STR$(varTurnCount) + " turns.")
- END
- END SUB
- SUB subGetObjName (n) 'returns the nth object
- 'can get rid of this sub really.
- R$ = varObjectDesc$(n)
- END SUB
- SUB subProcessNoun (B2$)
- 'Process Nouns (B2$ is the second part of a two word command)
- 'we're going to get the index number of the noun
- WHILE B2$ <> R$ AND i% <= 57
- i% = i% + 1
- R$ = varObjectDesc$(i%)
- WEND
- IF i% >= 57 THEN
- X = 1
- varWord2Index = -1
- ELSE
- varWord2Index = i% 'Set varWord2Index to the index of the word
- varWord2$ = R$ 'and R$ to the word itself
- END IF
- END SUB
- SUB subProcessVerb (b1$) 'Verb?
- 'Process Verbs (B1$ is the first part of a two word command)
- i% = 0
- RESTORE labVerbs
- WHILE b1$ <> R$ AND i% <= 38
- i% = i% + 1
- R$ = varVerb$(i%)
- WEND
- IF i% = 38 THEN
- X = 1
- varWord1Index = -1
- ELSE
- varWord1Index = i%
- varWord1$ = R$
- END IF
- END SUB
- SUB subPrintLocation (varCurrentLocation) 'prints out location, exits, objects plus other bits
- DIM varOutputString$
- varCounter = 0
- cn = 0
- varOutputString$ = ""
- IF varCurrentLocation = 1 THEN GOTO lab278 'called for INV so jump to INV processing
- R$ = varLocationDescription$(varCurrentLocation)
- 'Some Dwarf shenanigans
- IF varObjectLocations(31) <> 0 THEN
- varObjectLocations(31) = 0
- varDwarfFlag = 1 'weve bumped into the dwarf so set his flag on.
- END IF
- CALL subPrintText("You are " + R$)
- IF varCurrentLocation = 136 OR varCurrentLocation = 15 THEN varObjectLocations(56) = varCurrentLocation
- IF varCurrentLocation = 16 AND varFlamesFlag = 1 THEN
- CALL subPrintText("The walls are very hot!")
- ELSE
- IF varCurrentLocation = 16 THEN
- CALL subPrintText("The walls are steaming!")
- END IF
- END IF
- 'If loc isnt Forge, serpents stomach or bottom of rock slide then call subPrintExits with varCurrentLocation. These locs dont have exits?
- IF varCurrentLocation <> 3 AND varCurrentLocation <> 142 AND varCurrentLocation <> 143 THEN
- CALL subPrintExits(varCurrentLocation)
- IF ABS(varCurrentLocation - 19) = 1 AND varChasmFlag = 1 THEN
- PRINT
- ELSE
- IF ABS(varCurrentLocation - 42) = 1 AND varBridgeFlag = 1 THEN
- PRINT
- END IF
- END IF
- END IF
- IF varChasmFlag = 1 AND ABS(varCurrentLocation - 19) = 1 THEN
- CALL subPrintText("A bridge now spans the chasm.")
- varObjectLocations(53) = varCurrentLocation 'A bridge now spans the
- END IF
- IF varBridgeFlag = 1 AND ABS(varCurrentLocation - 42) = 1 THEN
- CALL subPrintText("A bridge now spans the glacier.")
- varObjectLocations(53) = varCurrentLocation
- END IF
- IF varCurrentLocation = 26 OR varCurrentLocation = 27 THEN
- varObjectLocations(53) = varCurrentLocation
- END IF
- lab278: 'display the objects, either INV if varCurrentLocation=1 or just what's here
- j = 0
- I = 0
- varCounter = 0
- WHILE j < 52 'objects under #52 only.
- j = j + 1
- IF varObjectLocations(j) = varCurrentLocation THEN
- varCounter = varCounter + 1 'count the number of things at this location.
- END IF
- WEND
- IF varCounter = 0 AND varCurrentLocation = 1 THEN 'if count=0 and location=1 then print 'not carrying anything'
- CALL subPrintText("You are not carrying anything.")
- GOTO lab284
- ELSE
- IF varCounter = 0 AND varCurrentLocation <> 1 THEN
- GOTO lab284 'there's nothing here
- ELSE
- PRINT
- varMAX = varCounter
- END IF
- END IF
- IF varCurrentLocation = 1 THEN 'is location =1 (inv)
- varOutputString$ = "You're currently holding "
- ELSE
- varOutputString$ = "There is "
- END IF
- I = 0
- cn = 0
- varCounter = varMAX
- WHILE I < 52 'Loop through all the objects, poss replace with a for/next. After obj 52 we dont want to display
- I = I + 1
- IF varObjectLocations(I) = varCurrentLocation THEN 'run through the list of objects. check if something is here.
- CALL subObjectText(I, varCounter, varCurrentLocation) 'If there is then..... call OT with the Ith object (in the object list) and the number of objects at this location, had to add varCurrentLocation - poss QB bug?
- varOutputString$ = varOutputString$ + R$
- varCounter = varCounter - 1 'reduce the count and repeat
- END IF
- WEND
- CALL subPrintText(varOutputString$)
- lab284:
- IF varDwarfEncounters <> 0 AND varDwarfFlag = 1 THEN
- varObjectLocations(31) = varCurrentLocation
- END IF
- IF varCasketOpenFlag = 1 AND varCurrentLocation = 94 THEN
- CALL subPrintText("The casket is open.")
- END IF
- IF varCurrentLocation = 24 AND varSafeOpenFlag = 1 THEN
- CALL subPrintText("The safe door is open.")
- END IF
- PRINT
- END SUB
- SUB subPrintExits (varCurrentLocation)
- 'This routine just prints out "there are exits to the North... etc"
- I = varCurrentLocation * 6 - 6
- FOR J = 1 TO 6
- MAP = varExits(I + J)
- IF MAP > 0 THEN
- varCounter = varCounter + 1 'increment exit counter
- varExitArray(J) = 1
- ELSE
- varExitArray(J) = 0
- END IF
- NEXT J
- IF varCounter > 1 THEN
- O$ = "There are exits to the "
- ELSE
- IF varCounter = 1 THEN
- O$ = "There is an exit "
- END IF
- END IF
- FOR J = 1 TO 6
- ' changed this a bit from original code because of data mappings
- IF J = 1 THEN R$ = "north"
- IF J = 2 THEN R$ = "south"
- IF J = 3 THEN R$ = "east"
- IF J = 4 THEN R$ = "west"
- IF J = 5 THEN R$ = "up"
- IF J = 6 THEN R$ = "down"
- IF varCounter = 0 OR varExitArray(J) = 0 THEN GOTO lab296
- IF varCounter > 2 THEN O$ = O$ + R$ + ", "
- IF varCounter = 2 THEN O$ = O$ + R$ + " and "
- IF varCounter = 1 THEN O$ = O$ + R$ + "."
- varCounter = varCounter - 1
- lab296:
- NEXT J
- CALL subPrintText(O$)
- END SUB
- SUB subVerbOpen (varWord2Index) 'Open
- IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
- CALL subPrintText("I see no " + varWord2$ + " here.")
- GOTO lab306
- END IF
- IF varWord2Index = 40 AND varCurrentLocation = 94 AND varCasketOpenFlag = 0 THEN
- varObjectLocations(43) = 94
- varCasketOpenFlag = 1
- CALL subPrintLocation(varCurrentLocation)
- GOTO lab306
- END IF
- IF varWord2Index = 39 THEN
- CALL subPrintText("You cant do that at the moment.")
- END IF
- IF varWord2Index = 8 AND varObjectLocations(5) = 1 THEN
- CALL subPrintText("The chest opens easily with the keys revealing many rubies.")
- varObjectLocations(16) = varCurrentLocation
- ELSE
- IF varWord2Index = 8 THEN
- CALL subPrintText("You can't with no keys!")
- END IF
- END IF
- IF varWord2Index = 10 AND varObjectLocations(7) = 1 THEN
- CALL subPrintText("You open up the clam with the jack and many pearls roll out.")
- varObjectLocations(18) = varCurrentLocation
- ELSE
- IF varWord2Index = 10 THEN
- CALL subPrintText("You can't do that at the moment")
- END IF
- END IF
- IF varWord2Index = 8 OR varWord2Index = 10 OR varWord2Index = 39 THEN GOTO lab306
- CALL subPrintText("I can't apply that")
- lab306:
- END SUB
- SUB subVerbMove (A$, N)
- 'subVerbMove deals with single letter commands so N,S,E,W,U,D
- 'N=starting location?
- 'A$=the command (N,S... etc)
- M = INSTR(varDirections$, A$) ' M is the offset of the given command in the string varDirections$
- X = 0 'Exit flag
- IF M = 0 THEN
- CALL subPrintText("I don't understand the word " + A$)
- GOTO lab318
- END IF
- CALL subTrialMove(N, M) 'Call subTrialMove with current loc and offset of command
- ' RESTORE labExitData
- IF X = 1 THEN GOTO lab314
- IF varLampLitFlag = 0 THEN
- IF N > 8 THEN
- IF RND(1) > 0.5 THEN
- CALL subPrintText("You fell in a pit")
- CALL subKill
- END IF
- END IF
- END IF
- MAP = varExits(N * 6 - 6 + M)
- IF MAP = 0 THEN
- CALL subPrintText("There is no way to go that direction!")
- ELSE
- varCurrentLocation = MAP
- END IF
- lab314:
- IF varCurrentLocation = 4 THEN 'inside the forest 25% chance of putting you at the end of the road (L2)
- IF RND(1) > 0.75 THEN
- varCurrentLocation = 2
- END IF
- END IF
- IF varBearFlag = 1 THEN varObjectLocations(35) = varCurrentLocation 'Make the Bear follow us if bear=1
- IF varRabbitFlag = 1 THEN varObjectLocations(38) = varCurrentLocation 'Make the rabbit follow us if rabbit=1
- CALL subPrintLocation(varCurrentLocation)
- IF varCurrentLocation = 33 AND RND(1) > 0.5 THEN
- CALL subPrintText("A hollow voice whispers DIAXOS.")
- END IF
- lab318:
- END SUB
- SUB subVerbGetTake (varWord2Index, N, K)
- 'Call subVerbGetTake(varWord2Index, 1, varCurrentLocation) - sample call
- 'jack, food, mouse,bridge,swamp,lake,building
- IF NOT (varWord2Index = 8 OR varWord2Index = 10 OR ABS(varWord2Index - 37) <= 7 OR varWord2Index >= 53) THEN
- GOTO lab321
- ELSE
- X = 1
- IF varObjectLocations(varWord2Index) <> N THEN
- 'Seems to deal with taking something that isnt there. There was some funky code here that I could get the jist of so just removed
- 'Call subResponse(8 - Sgn(N - 1)) '??
- CALL subPrintText("I see no " + varWord2$ + " here")
- GOTO lab332
- ELSE
- CALL subPrintText("You're joking!")
- GOTO lab332
- END IF
- END IF
- lab321:
- R$ = "'"
- IF K = 1 AND varWord2Index = 28 AND varObjectLocations(27) <> 1 AND varCurrentLocation = 15 THEN
- CALL subPrintText("You have nothing to put it in, so it runs away through your fingers.")
- GOTO lab332
- END IF
- IF varWord2Index = 28 AND varGotWaterFlag = 1 THEN
- varObjectLocations(28) = 1
- ELSE
- IF varWord2Index = 28 THEN
- varObjectLocations(28) = 15
- ELSE
- IF varWord2Index = 52 AND K = 1 THEN
- CALL subPrintText("The mouse runs around refusing to be caught.")
- GOTO lab332
- END IF
- END IF
- END IF
- R$ = " "
- IF varWord2Index = 52 AND N = 1 AND K = 111 AND varObjectLocations(42) = 111 THEN
- varObjectLocations(42) = 0
- varWord1$ = "drop"
- varWord2$ = "mouse." + CHR$(10) + CHR$(13) + "The elephant sees it and runs away"
- END IF
- R$ = ""
- IF varCarryingCounter = 15 AND K = 1 THEN
- CALL subPrintText("You can't carry anything more, you'll have to drop something first.")
- X = 1
- GOTO lab332
- END IF
- IF K = 1 AND varObjectLocations(27) = 1 AND varObjectLocations(28) = 1 AND varWord2Index = 28 THEN
- CALL subPrintText("Your bottle is already full.")
- X = 1
- GOTO lab330
- END IF
- IF N = 1 AND varWord2Index = 27 AND varGotWaterFlag = 1 THEN
- varGotWaterFlag = 0
- CALL subPrintText("You drop the bottle and all the water leaks away!")
- varCarryingCounter = varCarryingCounter - 1
- varWord1$ = "will have to get some more from"
- varWord2$ = "lake"
- END IF
- IF varWord2Index = 28 AND K = 1 AND varObjectLocations(28) = N THEN
- varWord1$ = "fill"
- varWord2$ = "bottle with the water"
- END IF
- IF varObjectLocations(varWord2Index) = N THEN
- varObjectLocations(varWord2Index) = K
- CALL subPrintText("You " + varWord1$ + " the " + varWord2$ + ".")
- ELSE
- IF K = 1 THEN
- CALL subPrintText("I see no " + varWord2$ + " here.")
- X = 1
- ELSE
- CALL subPrintText("You're not carrying the " + varWord2$ + " here.")
- X = 1
- END IF
- END IF
- lab330:
- IF varObjectLocations(28) = 1 AND varWord2Index = 28 THEN
- varObjectLocations(28) = 15
- varGotWaterFlag = 1
- ELSE
- IF varWord2Index = 28 THEN
- varObjectLocations(28) = 15
- varGotWaterFlag = 0
- END IF
- END IF
- IF varCurrentLocation = 117 AND N = 1 AND varWord2Index <> 9 THEN
- varObjectLocations(varWord2Index) = 0
- CALL subPrintText("Oh dear the " + varWord2$ + " sank into the swamp.")
- END IF
- lab332:
- END SUB
- SUB subTrialMove (varCurrentLocation, n) 'seems to be like a trial move...
- 'X is set high if a move cant be made for whatever reason.
- IF varCurrentLocation = varObjectLocations(36) THEN
- I = 11
- DO
- I = I + 1
- LOOP UNTIL varObjectLocations(I) = 1 OR I = 30 'Having a quick look through the inv for something the pirate wants
- IF I < 30 THEN
- varObjectLocations(I) = 51
- CALL subGetObjName(I)
- CALL subPrintText("The pirate snatches your " + R$)
- c% = c% - 1
- IF I = 27 AND varGotWaterFlag = 1 THEN
- varGotWaterFlag = 0
- END IF
- END IF
- END IF
- IF varCurrentLocation = varObjectLocations(35) THEN
- varBearFlag = 1
- CALL subPrintText("There is a brown bear following you.")
- END IF
- IF varCurrentLocation = varObjectLocations(38) THEN
- varRabbitFlag = 1
- CALL subPrintText("The giant rabbit is still with you!")
- END IF
- IF varCurrentLocation = 16 AND varFlamesFlag = 1 AND n = 3 THEN
- X = 1
- CALL subPrintText("The flame's heat drives you back.")
- END IF
- IF varCurrentLocation = 117 AND n = 3 AND varObjectLocations(41) = 117 THEN
- CALL subPrintText("The crocodile snaps its jaws neatly biting your leg off. You bleed to death!")
- CALL subKill
- END IF
- IF varCurrentLocation = 94 AND n <> 6 AND varCasketOpenFlag = 0 THEN
- varObjectLocations(43) = 94
- varCasketOpenFlag = 1
- GOTO lab349
- END IF
- IF varCurrentLocation = 111 AND n = 1 AND varCurrentLocation = varObjectLocations(42) THEN
- CALL subPrintText("The elephant is blocking the way.")
- X = 1
- GOTO lab349
- END IF
- IF varCurrentLocation = 48 AND varCurrentLocation = varObjectLocations(33) AND n = 4 THEN
- X = 1
- CALL subPrintText("The goblins crowd around and stop you.")
- END IF
- IF varCurrentLocation = 30 AND n = 1 AND varCurrentLocation = varObjectLocations(32) THEN
- X = 1
- CALL subPrintText("The ogre is blocking the way.")
- END IF
- IF varCurrentLocation = 36 AND n = 6 AND varCurrentLocation = varObjectLocations(30) THEN
- X = 1
- CALL subPrintText("The dragon is blocking the way.")
- END IF
- IF varCurrentLocation = 32 AND varCurrentLocation = varObjectLocations(37) AND varCurrentLocation = varObjectLocations(35) THEN
- CALL subPrintText("The bear growls and chases the orc away.")
- varObjectLocations(35) = 0 'make poor friendly bear gone
- varObjectLocations(37) = 0 'make Orc gone
- varBearFlag = 0 ' Bear flag = off
- END IF
- IF varCurrentLocation = 32 AND varCurrentLocation = varObjectLocations(37) AND n = 1 THEN
- X = 1
- CALL subPrintText("The orc won't let you get by.")
- END IF
- IF (varCurrentLocation = 24 AND n = 5) OR (varCurrentLocation = 51 AND n = 6) THEN
- IF varSafeOpenFlag = 0 THEN
- X = 1
- CALL subPrintText("You can't! The safe door is shut.")
- PRINT
- END IF
- END IF
- IF varCurrentLocation = 51 AND n = 6 THEN
- IF varSafeOpenFlag = 0 THEN
- X = 1
- CALL subPrintText("You can't! The safe door is shut.")
- PRINT
- END IF
- END IF
- IF varCurrentLocation = 28 AND n = 6 THEN
- CALL subPrintText("ARRRGH! CRASH!! The rocks gave way and you rolled to the bottom of the rock slide.")
- PRINT
- END IF
- lab349:
- END SUB
- SUB subVerbKill (w) 'Kill
- IF varObjectLocations(w) <> varCurrentLocation THEN
- CALL subPrintText("I see no " + varWord2$ + " here.")
- GOTO lab354
- ELSE
- IF w < 30 OR w = 39 OR w = 40 OR ABS(w - 48) < 4 OR w > 52 THEN
- CALL subPrintText("You're joking!")
- GOTO lab354
- END IF
- END IF
- lab351:
- INPUT "What with? Your bare hands ? ", b$
- b$ = funConvertLowerCase$(b$)
- IF b$ <> "no" THEN
- GOTO lab353
- ELSE
- INPUT "What with then ? ", varWord2$
- CALL subProcessNoun(funConvertLowerCase$(varWord2$))
- IF X = 1 THEN
- GOTO lab354
- ELSE
- varWord1$ = "throw"
- CALL subVerbThrow(varWord2Index)
- IF X = 1 THEN
- GOTO lab354
- ELSE
- varCarryingCounter = varCarryingCounter - 1
- GOTO lab354
- END IF
- END IF
- END IF
- lab353:
- IF b$ <> "yes" THEN
- CALL subPrintText("yes or no")
- GOTO lab351
- ELSE
- IF w = 30 THEN
- CALL subPrintText("Well done! You vanquished a dragon with your bare hands!")
- varObjectLocations(30) = 0
- varObjectLocations(6) = varCurrentLocation
- ELSE
- CALL subPrintText("Your blows are useless.")
- END IF
- END IF
- lab354:
- END SUB
- SUB subVerbWave (varWord2Index) 'Wave
- IF varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
- CALL subPrintText("You're not carrying the " + varWord2$ + ".")
- GOTO lab362
- ELSE
- IF varWord2Index = 28 THEN
- CALL subPrintText("I can't apply that")
- GOTO lab362
- END IF
- END IF
- IF varWord2Index <> 4 THEN
- CALL subPrintText("OK")
- GOTO lab362
- END IF
- IF varCurrentLocation = 18 AND varChasmFlag = 0 THEN
- CALL subPrintText("A bridge now spans the chasm.")
- varChasmFlag = 1
- varObjectLocations(53) = varCurrentLocation
- GOTO lab362
- ELSE
- IF varCurrentLocation = 135 AND varObjectLocations(26) = 0 THEN
- CALL subPrintText("The fairy king appears, hands you a mithril ring, bows and slips away.")
- varObjectLocations(26) = 1
- GOTO lab362
- END IF
- END IF
- IF varCurrentLocation = 41 AND varBridgeFlag = 0 THEN
- CALL subPrintText("A bridge now spans the glacier.")
- varBridgeFlag = 1
- varObjectLocations(53) = varCurrentLocation
- GOTO lab362
- END IF
- IF varCurrentLocation = 50 AND varKneelingFlag = 1 THEN
- varWavingAtSphinxFlag = 1 'sets flag of waving at sphinx
- CALL subFinish
- END IF
- CALL subPrintText("Nothing happens")
- lab362:
- END SUB
- SUB subVerbEat (varWord2Index, n) 'Eat
- IF varWord2Index = 28 AND n = 2 AND (varGotWaterFlag = 1 OR varCurrentLocation = 15) THEN
- CALL subPrintText("Thanks! It was delicious")
- varGotWaterFlag = 0
- GOTO lab369
- END IF
- IF varWord2Index = 28 THEN
- CALL subPrintText("I can't apply that")
- GOTO lab369
- END IF
- IF varObjectLocations(varWord2Index) <> 1 THEN
- CALL subPrintText("You're not carrying the " + varWord2$ + " here.")
- GOTO lab369
- END IF
- IF n = 1 THEN
- IF varWord2Index = 9 OR varWord2Index = 29 OR varWord2Index = 50 THEN
- CALL subPrintText("Thanks! It was delicuious")
- varObjectLocations(varWord2Index) = 0
- GOTO lab369
- END IF
- END IF
- CALL subPrintText("You're joking!")
- lab369:
- END SUB
- SUB subVerbCross (varWord2Index) 'Cross
- IF varObjectLocations(varWord2Index) <> 1 AND varObjectLocations(varWord2Index) <> varCurrentLocation AND varWord2Index <> 28 THEN
- CALL subPrintText("I see no " + varWord2$ + " here.")
- GOTO lab378
- ELSE
- IF varWord2Index = 28 THEN
- CALL subPrintText("I can't apply that")
- GOTO lab378
- END IF
- END IF
- IF varCurrentLocation <> 18 THEN
- GOTO lab372
- ELSE
- IF varChasmFlag = 1 THEN
- varCurrentLocation = 20
- CALL subPrintLocation(varCurrentLocation)
- GOTO lab378
- ELSE
- CALL subPrintText("You can't! It's too wide to jump.")
- GOTO lab378
- END IF
- END IF
- lab372:
- IF varCurrentLocation <> 20 THEN
- GOTO lab373
- ELSE
- IF varChasmFlag = 1 THEN
- varCurrentLocation = 18
- CALL subPrintLocation(varCurrentLocation)
- GOTO lab378
- ELSE
- CALL subPrintText("You can't! It's too wide to jump.")
- GOTO lab378
- END IF
- END IF
- lab373:
- IF ABS(varCurrentLocation - 42) <> 1 THEN
- GOTO lab374
- ELSE
- IF varBridgeFlag = 0 THEN
- CALL subPrintText("You can't! It's too wide to jump.")
- GOTO lab378
- ELSE
- IF varObjectLocations(26) = 1 THEN
- varCurrentLocation = varCurrentLocation - 2 * SGN(varCurrentLocation - 42)
- CALL subPrintLocation(varCurrentLocation)
- GOTO lab378
- ELSE
- CALL subPrintText("AAARGHH The bridge collapsed!")
- CALL subKill
- END IF
- END IF
- END IF
- lab374:
- IF ABS(varCurrentLocation - 26.5) < 1 AND varObjectLocations(34) = 26 THEN 'Test the ABS thing and presence of troll.
- CALL subPrintText("The troll wont let you get by.")
- GOTO lab378
- END IF
- IF varCurrentLocation <> 27 AND varCurrentLocation <> 26 THEN 'are we next to troll bridge or at troll bridge
- GOTO lab376
- ELSE
- IF varRabbitFlag = 1 OR varBearFlag = 1 THEN 'If the rabbit or bear is with us then....
- CALL subPrintText("AAARGHH The bridge collapsed!")
- CALL subKill
- ELSE
- varCurrentLocation = 27 + (varCurrentLocation = 27) 'everything is good so move us to 27 if we're not at 27 already
- CALL subPrintLocation(varCurrentLocation)
- GOTO lab378
- END IF
- END IF
- lab376:
- IF varCurrentLocation = 15 AND varWord2Index = 55 AND varObjectLocations(48) = 1 THEN
- varCurrentLocation = 142
- CALL subPrintText("You set off in the boat. Suddenly a sea-serpent leaps from beneath the waves and swallows you!")
- CALL subPrintLocation(varCurrentLocation)
- varObjectLocations(48) = 0
- GOTO lab378
- ELSE
- IF varCurrentLocation = 15 AND varWord2Index = 55 THEN
- CALL subPrintText("It's too wide to swim.")
- GOTO lab378
- END IF
- END IF
- CALL subPrintText("I can't apply that")
- lab378:
- END SUB
- SUB subVerbThrow (varWord2Index) ' throw?
- CALL subVerbGetTake(varWord2Index, 1, varCurrentLocation)
- IF X = 1 THEN GOTO lab407
- R$ = " "
- IF varWord2Index > 1 THEN GOTO lab393
- IF varCurrentLocation = varObjectLocations(31) AND RND(1) < 0.6 THEN
- varObjectLocations(31) = 0 'Dwarf is dead, remove him.
- varDwarfEncounters = 0
- varDwarfFlag = 0
- CALL subPrintText("You killed a little dwarf!")
- GOTO lab407
- ELSE
- IF varCurrentLocation = varObjectLocations(31) THEN
- CALL subPrintText("The dwarf dodges neatly aside.")
- GOTO lab407
- END IF
- END IF
- IF varCurrentLocation = varObjectLocations(32) THEN
- CALL subPrintText("The ogre catches the axe and slices you in two with it.")
- CALL subKill
- END IF
- IF varCurrentLocation = varObjectLocations(30) THEN
- CALL subPrintText("The axe bounces harmlessly off the dragon.")
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(33) THEN
- CALL subPrintText("That made the goblins real mad!")
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(34) THEN
- CALL subPrintText("The troll ducks, picks up the fallen axe and kills you with a single blow.")
- CALL subKill
- END IF
- IF varCurrentLocation = varObjectLocations(35) THEN
- CALL subPrintText("The bear is confused. He only wants to be your friend!")
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(36) THEN
- CALL subPrintText("The pirate dodges smartly away into the tunnels!")
- varObjectLocations(36) = 20 + INT(RND(10))
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(37) THEN
- CALL subPrintText("The orc dodges and then growls ominously at you!")
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(38) THEN
- CALL subPrintText("The rabbit hops aside and says NEEERH WHATS UP DOC ?")
- END IF
- GOTO lab407
- lab393:
- IF varWord2Index > 2 THEN
- GOTO lab403
- END IF
- IF varCurrentLocation = varObjectLocations(31) THEN
- CALL subPrintText("You killed a little dwarf!")
- varDwarfEncounters = 0
- varObjectLocations(31) = 0
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(32) THEN
- CALL subPrintText("The sword kills the ogre but then melts away.")
- varObjectLocations(32) = 0
- varObjectLocations(2) = 0
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(30) THEN
- CALL subPrintText("The sword kills the dragon. Then both sword and dragon fade away until only the dragons teeth remain.")
- varObjectLocations(30) = 0
- varObjectLocations(2) = 0
- varObjectLocations(6) = varCurrentLocation
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(33) THEN
- CALL subPrintText("That made the goblins real mad!")
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(34) THEN
- CALL subPrintText("The troll catches the sword and kills you with a single stroke.")
- CALL subKill
- END IF
- IF varCurrentLocation = varObjectLocations(35) THEN
- CALL subPrintText("The bear is confused. He only wants to be your friend!")
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(36) THEN
- CALL subPrintText("The pirate dodges smartly away into the tunnels!")
- varObjectLocations(36) = 20 + INT(RND(10))
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(37) THEN
- CALL subPrintText("The orc dodges and then growls ominously at you!")
- GOTO lab407
- END IF
- IF varCurrentLocation = varObjectLocations(38) THEN
- CALL subPrintText("The rabbit hops aside and says NEEERH WHATS UP DOC ?")
- GOTO lab407
- END IF
- lab403:
- IF varWord2Index = 28 AND varCurrentLocation = 16 AND varFlamesFlag = 1 THEN
- varFlamesFlag = 0
- CALL subPrintText("The flame dies in a cloud of steam.")
- END IF
- IF varWord2Index = 6 AND varCurrentLocation = varObjectLocations(33) THEN
- CALL subPrintText("The teeth become skeleton warriors and drive the goblins away.")
- varObjectLocations(33) = 0
- varObjectLocations(6) = 0
- ELSE 'I think this logic can be separated out; it was like this to save a line?
- IF varCurrentLocation = varObjectLocations(41) AND varWord2Index = 47 THEN
- CALL subPrintText("The mouse eats the stilton and allows itself to be caught.")
- varObjectLocations(41) = 0
- varObjectLocations(47) = 0
- END IF
- END IF
- R$ = ""
- IF varCurrentLocation = 117 AND varWord2Index = 9 THEN
- CALL subPrintText("Suddenly a huge bird swoops down snatches the food and carries you across the swamp.")
- varCurrentLocation = 118
- varObjectLocations(9) = 0
- CALL subPrintLocation(varCurrentLocation)
- END IF
- IF varCurrentLocation = varObjectLocations(43) AND varWord2Index = 49 THEN
- CALL subPrintText("The stake pierces the vampires chest he screams and is dispersed on the wind.")
- varObjectLocations(43) = 0
- varObjectLocations(49) = 0
- END IF
- lab407:
- END SUB
- SUB subVerbFeed (varWord2Index) 'Feed
- IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
- CALL subPrintText("I see no " + varWord2$ + " here.")
- GOTO lab414
- ELSE
- IF varWord2Index = 28 THEN
- CALL subPrintText("I can't apply that")
- GOTO lab414
- END IF
- END IF
- IF varWord2Index = 30 OR varWord2Index = 32 OR varWord2Index = 33 OR varWord2Index = 37 THEN
- CALL subPrintText("The only thing it wants to eat is, possibly, YOU!")
- GOTO lab414
- ELSE
- IF varWord2Index <> 38 AND varWord2Index <> 35 AND varWord2Index <> 41 AND varWord2Index <> 52 THEN
- CALL subPrintText("You're joking")
- GOTO lab414
- END IF
- END IF
- IF varWord2Index = 41 AND varObjectLocations(9) = 1 THEN
- CALL subPrintText("You throw the food to the crocodile. Suddenly a huge bird swoops down snatches the food and carries you across the swamp.")
- varCurrentLocation = 118
- CALL subPrintLocation(varCurrentLocation)
- varObjectLocations(9) = 0
- GOTO lab414
- ELSE
- IF varWord2Index = 41 THEN
- CALL subPrintText("You have nothing it wants.")
- GOTO lab414
- END IF
- END IF
- IF varWord2Index = 52 AND varObjectLocations(50) = 1 THEN
- CALL subPrintText("The mouse eats the stilton and allows itself to be caught.")
- varObjectLocations(52) = 1
- varObjectLocations(50) = 0
- GOTO lab414
- ELSE
- IF varWord2Index = 52 THEN
- CALL subPrintText("You have nothing it wants.")
- GOTO lab414
- END IF
- END IF
- IF varWord2Index = 35 OR varWord2Index = 38 THEN
- CALL subPrintText("What with")
- K = varWord2Index
- O$ = varWord2$
- INPUT A$
- CALL subProcessNoun(funConvertLowerCase$(A$))
- IF varWord2Index <> 29 AND varWord2Index <> 9 THEN
- CALL subPrintText("You're joking!")
- ELSE
- CALL subEat
- varObjectLocations(varWord2Index) = 0
- varObjectLocations(K) = 0
- varCarryingCounter = varCarryingCounter - 2
- IF K = 35 THEN
- varBearFlag = 0
- ELSE
- IF K = 38 THEN
- varRabbitFlag = 0
- END IF
- END IF
- END IF
- END IF
- lab414:
- END SUB
- SUB subVerbRub (varWord2Index) 'Rub?
- IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
- CALL subPrintText("I see no " + varWord2$ + " here.")
- GOTO lab420
- ELSE
- IF varWord2Index = 28 THEN
- CALL subPrintText("I can't apply that")
- GOTO lab420
- END IF
- END IF
- IF varWord2Index = 3 AND varLampLitFlag = 1 AND varLampFuel <= 10 THEN
- varLampFuel = 150
- CALL subPrintText("Your lamp is brighter now.")
- GOTO lab420
- ELSE
- IF varWord2Index = 3 AND varLampFuel <= 0 THEN
- varLampFuel = 150
- CALL subPrintText("Nothing obvious happens!")
- GOTO lab420
- ELSE
- IF varWord2Index = 3 AND varLampFuel > 0 THEN
- CALL subPrintText("Nothing obvious happens!")
- GOTO lab420
- END IF
- END IF
- END IF
- IF varWord2Index = 26 THEN
- varCurrentLocation = 11
- CALL subPrintLocation(varCurrentLocation)
- GOTO lab420
- END IF
- CALL subPrintText("You're joking!")
- lab420:
- END SUB
- SUB subVerbLight (varWord2Index) 'Light verb
- IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 AND varWord2Index <> 28 THEN
- CALL subPrintText("I see no " + varWord2$ + " here.")
- GOTO labExitVerbLight
- ELSE
- IF varWord2Index = 28 THEN
- CALL subPrintText("I can't apply that")
- GOTO labExitVerbLight
- END IF
- END IF
- IF varWord2Index = 51 THEN
- varObjectLocations(51) = 0
- CALL subPrintText("Your matches flare up making a lot of smoke.")
- IF varCurrentLocation = 142 THEN
- CALL subPrintText("The serpent starts to cough violently and you get thrown out.")
- varCurrentLocation = 136
- CALL subPrintLocation(varCurrentLocation)
- GOTO labExitVerbLight
- ELSE
- IF varWord2Index = 51 THEN
- GOTO labExitVerbLight
- END IF
- END IF
- END IF
- IF varWord2Index = 3 AND varLampLitFlag = 0 AND varLampFuel > 0 THEN
- varLampLitFlag = 1
- CALL subPrintText("Your lamp is now on.")
- GOTO labExitVerbLight
- ELSE
- IF varWord2Index = 3 AND varLampLitFlag = 0 THEN
- CALL subPrintText(" Your lamp has run out.")
- GOTO labExitVerbLight
- ELSE
- IF varWord2Index = 3 THEN
- CALL subPrintText("Your lamp is already lit!")
- GOTO labExitVerbLight
- END IF
- END IF
- END IF
- CALL subPrintText("I can't apply that")
- labExitVerbLight:
- END SUB
- SUB subVerbRead (varWord2Index) 'read
- IF varWord2Index = 28 THEN
- CALL subPrintText("I can't apply that")
- GOTO labExitVerbRead
- END IF
- IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 THEN
- CALL subPrintText("I see no " + varWord2$ + " here")
- GOTO labExitVerbRead
- END IF
- IF varWord2Index = 21 THEN
- CALL subPrintText("The books tell of a land across the water.")
- ELSE
- CALL subPrintText("I can't apply that")
- END IF
- labExitVerbRead:
- END SUB
- SUB subVerbPay (varWord2Index)
- IF varWord2Index = 28 THEN
- CALL subPrintText("I can't apply that")
- GOTO labExitVerbPay
- END IF
- I = 11
- IF varObjectLocations(varWord2Index) <> varCurrentLocation AND varObjectLocations(varWord2Index) <> 1 THEN
- CALL subPrintText("I see no " + varWord2$ + " here.")
- GOTO labExitVerbPay
- END IF
- IF varWord2Index = 34 THEN
- WHILE I <> 26 AND varObjectLocations(I) <> 1
- I = I + 1
- WEND
- IF I < 26 THEN
- varObjectLocations(I) = 51
- CALL subGetObjName(I)
- CALL subSnatch
- varObjectLocations(34) = 0
- varCarryingCounter = varCarryingCounter - 1
- ELSE
- CALL subPrintText("You fell in a pit.")
- END IF
- END IF
- labExitVerbPay:
- END SUB
- SUB subVerbIn (n) 'In
- IF n = 2 THEN
- varCurrentLocation = 3
- CALL subPrintLocation(varCurrentLocation)
- ELSE
- IF n = 8 THEN
- varCurrentLocation = 9
- CALL subPrintLocation(varCurrentLocation)
- ELSE
- CALL subPrintText("I can't apply that")
- END IF
- END IF
- END SUB
- SUB subVerbOut (n) 'out or exit
- 'n is current loc
- IF n = 3 THEN '
- varCurrentLocation = 2
- CALL subPrintLocation(varCurrentLocation)
- ELSE
- IF n = 9 THEN
- varCurrentLocation = 8
- CALL subPrintLocation(varCurrentLocation)
- ELSE
- CALL subPrintText("I can't apply that")
- END IF
- END IF
- END SUB
- SUB subCalculateScore (varCurrentLocation)
- 'calculate and print score
- varScore = 0
- 'iterate through these objects. If we have them in inventory (1) or are they at Sphinx (50) then add 30 points
- FOR j = 11 TO 29
- IF varObjectLocations(j) = 1 OR varObjectLocations(j) = 50 THEN varScore = varScore + 30
- NEXT j
- FOR j = 45 TO 48
- IF varObjectLocations(j) = 1 OR varObjectLocations(j) = 50 THEN varScore = varScore + 30
- NEXT j
- IF varWavingAtSphinxFlag = 1 THEN ' varWavingAtSphinxFlag is set if we're kneeling and wand waving
- IF varCurrentLocation = 50 THEN ' are we at the sphinx ?
- varScore = varScore + 170
- END IF
- END IF
- IF varScore + varKilledFlag < 0 THEN
- CALL subPrintText("You have scored 0 out of a possible 800.")
- ELSE
- CALL subPrintText("You have scored " + STR$(varScore + varKilledFlag) + " out of 800.")
- END IF
- END SUB
- FUNCTION funTrimSpaces$ (z$)
- 'seems to just trim off leading spaces. QB seems not to like ASC(x) so jiggled a bit.
- lab453: 'Surely we can do some loopery here
- IF LEFT$(z$, 1) = " " THEN
- z$ = RIGHT$(z$, LEN(z$) - 1)
- GOTO lab453
- END IF
- lab454: 'surely we can do some loopery here
- IF RIGHT$(z$, 1) = " " THEN
- z$ = LEFT$(z$, LEN(z$) - 1)
- GOTO lab454
- END IF
- funTrimSpaces$ = z$
- END FUNCTION
- FUNCTION funConvertLowerCase$ (z$)
- 'Just converts to lower case, puts entire z$ into lower case into B$ and passes to funTrimSpaces$
- b$ = ""
- FOR j = 1 TO LEN(z$)
- Q = ASC(MID$(z$, j, 1))
- IF Q > 64 AND Q < 91 THEN
- Q = Q + 32
- END IF
- b$ = b$ + CHR$(Q)
- NEXT j
- funConvertLowerCase$ = (funTrimSpaces$(b$))
- END FUNCTION
- SUB subVerbFill (w) 'F=Fill?
- IF w = 28 THEN 'is the verb water?
- CALL subPrintText("I can't apply that")
- GOTO labExitVerbFill
- END IF
- IF varObjectLocations(w) <> varCurrentLocation AND varObjectLocations(w) <> 1 THEN
- CALL subPrintText("I see no " + varWord2$ + " here.")
- GOTO labExitVerbFill
- ELSE
- IF varObjectLocations(varWord2Index) <> 1 THEN
- CALL subPrintText("You're not carrying the " + varWord2$ + ".")
- GOTO labExitVerbFill
- END IF
- END IF
- IF w = 27 AND varCurrentLocation = varObjectLocations(28) AND varGotWaterFlag = 0 THEN
- CALL subPrintText("Your bottle is now full of water.")
- varGotWaterFlag = 1
- ELSE
- IF w = 27 AND varCurrentLocation = varObjectLocations(28) THEN
- CALL subPrintText("your bottle is already full.")
- ELSE
- CALL subPrintText("I can't apply that")
- END IF
- END IF
- labExitVerbFill:
- END SUB
- SUB subObjectText (w, n, varCurrentLocation)
- 'process OT for w=object number, n=count left to deal with
- 'OT seems to print out the description of the object given the objects presence eg "a set of keys" when the object is just 'keys'
- R$ = ""
- K = 0
- IF n = 1 AND varMAX <> 1 THEN
- R$ = R$ + " and "
- END IF
- IF w = 5 THEN 'keys
- R$ = R$ + "a set of keys,"
- GOTO lab478
- END IF
- IF w = 6 THEN 'teeth
- R$ = R$ + "a set of dragon's teeth,"
- GOTO lab478
- END IF
- IF w = 26 THEN 'ring
- R$ = R$ + "a mithril "
- GOTO lab477
- END IF
- IF w = 1 OR w = 42 OR w = 17 OR w = 46 THEN 'axe, elephant, emerald, amethyst
- R$ = R$ + "an "
- GOTO lab477
- END IF
- IF w = 50 THEN 'stilton
- R$ = R$ + "a piece of stilton,"
- GOTO lab478
- END IF
- IF w = 9 THEN 'food
- GOTO lab477
- END IF
- IF w = 7 THEN 'jack
- R$ = R$ + "a hydraulic "
- GOTO lab477
- END IF
- IF w = 48 OR w = 49 THEN 'boat, stake
- R$ = R$ + "a wooden "
- GOTO lab477
- END IF
- IF w = 11 OR w = 20 THEN 'sapphires, opals
- R$ = R$ + "a cluster of "
- GOTO lab477
- END IF
- IF w = 16 OR w = 18 THEN 'rubies, pearls
- R$ = R$ + "a small fortune in "
- GOTO lab477
- END IF
- IF w = 51 THEN 'matches
- R$ = R$ + "a box of "
- GOTO lab477
- END IF
- IF w = 33 THEN 'goblins
- R$ = R$ + "a gang of "
- GOTO lab477
- END IF
- IF w = 22 THEN 'spices
- R$ = R$ + "a small jar of "
- GOTO lab477
- END IF
- IF w = 21 THEN 'books
- R$ = R$ + "a collection of library "
- GOTO lab477
- END IF
- IF w = 19 THEN 'coins
- R$ = R$ + "a set of "
- GOTO lab477
- END IF
- IF w = 43 THEN 'vampire
- R$ = R$ + "an evil "
- GOTO lab477
- END IF
- IF w = 36 THEN 'pirate
- R$ = R$ + "a bearded "
- GOTO lab477
- END IF
- IF ABS(w - 14) < 2 THEN 'gold, silver, maybe platinum
- R$ = R$ + "a bar of "
- GOTO lab477
- END IF
- IF w = 44 THEN 'serpent
- R$ = R$ + "a bad smell,"
- GOTO lab478
- END IF
- IF w = 32 OR w = 37 OR w = 41 THEN 'ogre, orc, crocodile
- R$ = R$ + "a mean looking "
- GOTO lab477
- END IF
- IF w = 30 OR w = 42 THEN 'dragon, elephant
- R$ = R$ + "a large "
- GOTO lab477
- END IF
- IF w = 35 OR w = 38 THEN 'bear, rabbit
- R$ = R$ + "a friendly "
- GOTO lab477
- END IF
- IF w <> 27 THEN 'if anything other than the bottle then lab475
- GOTO lab475
- ELSE 'so we have the bottle
- IF varGotWaterFlag = 0 THEN 'does it have water.. no
- R$ = R$ + "a bottle,"
- GOTO lab478
- ELSE
- R$ = R$ + "a bottle of water," 'must have water then
- GOTO lab478
- END IF
- END IF
- lab475:
- IF w = 28 AND varGotWaterFlag = 1 AND LEFT$(A$, 3) = "inv" THEN 'varWord2Index8= water
- GOTO lab478
- ELSE
- IF w = 28 THEN
- GOTO lab477
- END IF
- END IF
- R$ = R$ + "a "
- lab477:
- O$ = R$
- CALL subGetObjName(w)
- R$ = O$ + R$ + ", "
- IF INSTR(R$, " ") = 0 THEN
- R$ = " " + R$
- K = 1
- END IF
- lab478:
- IF n <= 2 THEN
- R$ = LEFT$(R$, LEN(R$) - 1)
- END IF
- IF varCurrentLocation <> 1 AND n = 1 THEN
- R$ = R$ + " here"
- END IF
- IF n = 1 THEN
- R$ = R$ + "."
- END IF
- 'If Pos(0) + Len(R$) > (varScreenWidth - 2) Then
- ' R$ = funScreenPrint$(R$, (varScreenWidth - 1))
- 'End If
- IF K = 1 AND R$ = " " THEN
- R$ = RIGHT$(R$, LEN(R$) - 1)
- END IF
- cn = 0
- ' Call subPrintText(R$)
- END SUB
- SUB subPrintText (varScrText$)
- Color colCyan 'so we can see what is being run through this sub
- DIM a%, z%, varStringLength
- varStringLength = LEN(varScrText$)
- a% = 1
- z% = varScreenWidth + 1 - POS(0)
- DO
- IF z% > varStringLength + 1 THEN
- z% = varStringLength + 1
- ELSE
- DO
- z% = z% - 1
- LOOP UNTIL MID$(varScrText$, z%, 1) = " "
- END IF
- IF z% < a% THEN
- z% = a% + varScreenWidth + 1
- END IF
- PRINT MID$(varScrText$, a%, z% - a%);
- IF z% - a% < varScreenWidth THEN
- PRINT
- ELSE
- IF MID$(varScrText$, z%, 1) = " " THEN
- a% = a% + 1
- ELSE
- z% = z% + 1
- END IF
- END IF
- a% = z% + 1
- z% = a% + varScreenWidth + 1
- LOOP UNTIL a% > varStringLength
- IF POS(0) > 0 THEN
- PRINT
- GOTO labExit
- ELSE
- GOTO labExit
- END IF
- labExit:
- Color colGreen 'put the colour back
- END SUB
- SUB subFinish
- CALL subPrintText("Well done, you've solved the puzzle.")
- CALL subCalculateScore(varCurrentLocation)
- CALL subPrintText("You had " + STR$(varTurnCount) + " turns.")
- END
- END SUB
- SUB subEat
- CALL subPrintText("The " + O$ + " eats the " + varWord2$ + " and runs away.")
- END SUB
- SUB subSnatch
- CALL subPrintText("The troll snatches your " + R$ + " and runs away.")
- END SUB
- SUB subSave (filename$)
- DIM cnt AS INTEGER
- filename$ = filename$ + ".sav"
- OPEN filename$ FOR OUTPUT AS #1
- 'Print #1, varBearFlag, varChasmFlag, varCasketOpenFlag, varCarryingCounter, cn, varDwarfEncounters, varFlamesFlag, varGoblinEncounters, I, j, K
- 'Print #1, varKilledFlag, varCurrentLocation, varLampFuel, I, varWavingAtSphinxFlag, M, varMAX, N, Q, varRabbitFlag, varTurnLastSeenDwarf, varSafeOpenFlag
- 'Print #1, varScore, varSpacePos, varTurnCount, varBridgeFlag, varVampireEncounters, varGotWaterFlag, W, X, si, mi, varLampLitFlag, varDwarfFlag, varDwarfChance
- 'Print #1, varSuppressDwarf
- PRINT #1, varBearFlag, varChasmFlag, varCasketOpenFlag, varCarryingCounter, varDwarfEncounters, varFlamesFlag, varGoblinEncounters
- PRINT #1, varKilledFlag, varCurrentLocation, varLampFuel, varWavingAtSphinxFlag, varRabbitFlag, varTurnLastSeenDwarf, varSafeOpenFlag
- PRINT #1, varScore, varTurnCount, varBridgeFlag, varVampireEncounters, varGotWaterFlag, varLampLitFlag, varDwarfFlag, varDwarfChance
- PRINT #1, varSuppressDwarf
- FOR cnt = 1 TO 56
- PRINT #1, varObjectLocations(cnt)
- NEXT
- CLOSE #1
- CALL subPrintText("Game state saved")
- END SUB
- SUB subLoad (filename$)
- DIM cnt AS INTEGER
- filename$ = filename$ + ".sav"
- OPEN filename$ FOR INPUT AS #1
- 'Input #1, varBearFlag, varChasmFlag, varCasketOpenFlag, varCarryingCounter, varCounter, cn, varDwarfEncounters, varFlamesFlag, varGoblinEncounters, I, j, K
- 'Input #1, varKilledFlag, varCurrentLocation, varLampFuel, I, varWavingAtSphinxFlag, M, varMAX, N, Q, varRabbitFlag, varTurnLastSeenDwarf, varSafeOpenFlag
- 'Input #1, varScore, SP, varTurnCount, varBridgeFlag, varVampireEncounters, varGotWaterFlag, W, X, si, mi, D%, varLampLitFlag, varDwarfFlag, varDwarfChance
- 'Input #1, varSuppressDwarf
- INPUT #1, varBearFlag, varChasmFlag, varCasketOpenFlag, varCarryingCounter, varDwarfEncounters, varFlamesFlag, varGoblinEncounters
- INPUT #1, varKilledFlag, varCurrentLocation, varLampFuel, varWavingAtSphinxFlag, varRabbitFlag, varTurnLastSeenDwarf, varSafeOpenFlag
- INPUT #1, varScore, varTurnCount, varBridgeFlag, varVampireEncounters, varGotWaterFlag, varLampLitFlag, varDwarfFlag, varDwarfChance
- INPUT #1, varSuppressDwarf
- FOR cnt = 1 TO 56
- INPUT #1, varObjectLocations(cnt)
- NEXT
- CLOSE #1
- CALL subPrintText("Game state loaded")
- PRINT
- CALL subPrintLocation(varCurrentLocation)
- END SUB
- SUB subDebug
- 'Prints out the state of play
- IF varDwarfChance = 0.97 THEN
- varDwarfStatus$ = "ENABLED"
- ELSE
- varDwarfStatus$ = "DISABLED"
- END IF
- Color colRed
- PRINT
- PRINT "Environment"
- Color colGreen
- PRINT "Location # :"; varCurrentLocation
- PRINT "Dwarf Status: "; varDwarfStatus$
- PRINT
- Color colRed
- PRINT "Counters"
- Color colGreen
- PRINT "Turn: "; varTurnCount; "Items :"; varCarryingCounter; " Lamp Fuel="; varLampFuel; "DwarfEncounters: "; varDwarfEncounters
- PRINT "DwarfSeenIncr: "; varTurnLastSeenDwarf
- PRINT
- Color colRed
- PRINT "Flags"
- Color colGreen
- PRINT "Bear: "; varBearFlag; " Rabbit: "; varRabbitFlag; " Dwarf: "; varDwarfFlag; " Lamp Lit: "; varLampLitFlag
- PRINT "Water: "; varGotWaterFlag; " Flames: "; varFlamesFlag; " Casket: "; varCasketOpenFlag; " Chasm: "; varChasmFlag
- PRINT "DwarfSuppress: "; varSuppressDwarf; "Safe: "; varSafeOpenFlag
- PRINT
- Color colRed
- PRINT "Exit Array"
- Color colCyan
- PRINT " N S E W U D"
- Color colCyan + 8
- FOR i% = 1 TO 6
- PRINT varExitArray(i%);
- NEXT i%
- Color colRed
- PRINT
- PRINT "Objects array :"
- FOR i% = 1 TO 56
- Color colCyan + 8
- PRINT i%; ":";
- Color colCyan
- PRINT varObjectLocations(i%); " ";
- NEXT
- Color 2
- PRINT
- END SUB
- SUB subReadExits
- labExitData: 'Keeping labExitData here for now since two SUBs use it and QB64 seems to keep DATA local to the sub. Nor does QB64 allow for it at end.
- '1
- DATA 0,0,0,0,0,0
- DATA 4,5,4,4,0,0
- DATA 0,0,0,0,0,0
- DATA 4,4,4,4,0,0
- DATA 2,6,7,4,0,0
- DATA 5,4,4,4,0,0
- DATA 4,4,8,5,0,0
- DATA 4,4,4,7,0,9
- DATA 0,14,10,0,8,0
- DATA 15,11,16,9,0,0
- '11
- DATA 10,0,12,0,0,0
- DATA 0,13,14,11,0,0
- DATA 12,0,0,0,0,17
- DATA 9,0,0,12,0,0
- DATA 0,10,17,0,0,0
- DATA 0,17,18,10,0,0
- DATA 16,0,0,15,13,0
- DATA 19,0,0,16,0,0
- DATA 0,18,0,0,0,0
- DATA 21,0,22,0,0,0
- '21
- DATA 0,20,23,0,0,0
- DATA 0,25,0,20,24,0
- DATA 120,0,24,21,0,0
- DATA 0,0,0,23,51,22
- DATA 22,26,0,0,0,0
- DATA 25,0,0,0,0,0
- DATA 0,0,30,28,0,0
- DATA 0,29,27,0,0,143
- DATA 28,39,0,0,0,0
- DATA 31,0,0,27,33,0
- '31
- DATA 0,30,32,0,0,0
- DATA 40,0,0,31,0,0
- DATA 0,34,35,0,0,30
- DATA 33,0,0,73,0,0
- DATA 0,36,0,33,0,0
- DATA 35,0,0,0,0,37
- DATA 0,0,0,38,36,0
- DATA 0,0,37,0,0,0
- DATA 29,72,0,0,0,0
- DATA 0,32,0,0,42,41
- '41
- DATA 0,0,0,0,40,0
- DATA 0,0,0,0,0,40
- DATA 44,0,0,46,47,0
- DATA 45,43,47,46,0,0
- DATA 0,44,111,0,46,47
- DATA 45,43,44,48,46,47
- DATA 45,43,44,0,0,0
- DATA 0,0,46,49,0,101
- DATA 52,0,48,0,0,0
- DATA 0,71,0,0,0,0
- '51
- DATA 0,0,0,0,0,24
- DATA 0,0,53,49,0,0
- DATA 54,52,52,52,0,0
- DATA 53,55,53,53,0,0
- DATA 54,54,56,54,0,0
- DATA 55,55,55,57,0,0
- DATA 56,56,58,56,0,0
- DATA 57,59,57,57,0,0
- DATA 60,58,58,58,0,0
- DATA 59,61,59,59,0,0
- '61
- DATA 60,60,62,60,0,0
- DATA 61,61,61,63,0,0
- DATA 62,62,64,62,0,0
- DATA 63,65,63,63,0,0
- DATA 66,64,64,64,0,0
- DATA 65,67,65,65,0,0
- DATA 52,66,68,66,0,0
- DATA 67,67,67,69,0,0
- DATA 68,68,70,68,0,0
- DATA 69,71,69,69,0,0
- '71
- DATA 50,70,70,70,0,0
- DATA 73,39,0,74,0,81
- DATA 81,0,86,72,74,0
- DATA 0,72,73,75,0,79
- DATA 74,0,76,0,76,77
- DATA 75,77,0,0,78,75
- DATA 78,79,0,0,75,76
- DATA 76,0,79,77,0,82
- DATA 0,74,78,77,80,0
- DATA 0,81,82,86,79,0
- '81
- DATA 72,0,73,80,0,82
- DATA 80,78,0,0,81,83
- DATA 84,87,0,0,85,82
- DATA 87,0,85,83,0,88
- DATA 0,87,84,83,86,0
- DATA 73,0,80,87,0,85
- DATA 83,84,0,0,85,86
- DATA 84,0,89,90,0,91
- DATA 90,0,90,88,0,91
- DATA 89,89,0,0,88,91
- '91
- DATA 88,89,0,0,92,90
- DATA 0,91,0,93,0,0
- DATA 0,0,92,0,94,0
- DATA 98,99,97,0,95,93
- DATA 0,100,0,0,0,94
- DATA 0,0,0,0,100,0
- DATA 0,0,100,94,0,0
- DATA 0,94,0,100,0,0
- DATA 94,0,0,0,0,100
- DATA 95,0,98,97,99,96
- '101
- DATA 102,0,103,0,48,0
- DATA 0,101,0,108,0,107
- DATA 0,105,0,101,0,109
- DATA 0,106,107,0,110,0
- DATA 103,0,0,0,0,106
- DATA 104,0,0,0,105,0
- DATA 0,0,0,104,102,0
- DATA 0,0,0,102,0,0
- DATA 0,0,0,0,103,0
- DATA 0,0,104,0,0,0
- '111
- DATA 112,0,0,45,0,0
- DATA 0,111,0,0,113,0
- DATA 0,0,114,0,0,112
- DATA 119,0,0,113,0,0
- DATA 0,116,0,120,0,0
- DATA 115,117,0,0,0,0
- DATA 116,0,118,0,0,0
- DATA 0,0,121,117,0,0
- DATA 0,114,0,0,0,0
- DATA 0,23,115,0,0,0
- '121
- DATA 0,123,122,118,0,0
- DATA 0,0,131,121,124,0
- DATA 121,127,0,132,0,0
- DATA 0,126,0,128,0,122
- DATA 126,0,133,134,0,0
- DATA 124,125,0,0,0,0
- DATA 123,0,0,0,135,0
- DATA 0,0,124,129,0,0
- DATA 0,0,128,0,0,130
- DATA 0,0,0,0,129,0
- '131
- DATA 0,0,0,122,0,0
- DATA 0,0,123,0,0,0
- DATA 0,0,0,125,0,0
- DATA 0,0,125,0,0,0
- DATA 0,0,0,0,0,127
- DATA 0,0,0,0,0,137
- DATA 0,0,0,0,136,0
- DATA 0,0,139,0,0,0
- DATA 0,140,0,138,0,0
- DATA 139,0,141,0,0,0
- '141
- DATA 0,0,0,140,0,0
- DATA 0,0,0,0,0,0
- DATA 0,0,0,0,0,0
- RESTORE labExitData
- FOR varCO = 1 TO (143 * 6)
- READ varExits(varCO)
- NEXT varCO
- END SUB
- SUB subReadObjectLocations
- labObjectLocations:
- 'Read in the objects into the array. Rearranged into 10's
- 'Seems to be a discrepancy here - loop to 55, yet there's 56 here.
- 'Perhaps because the building (obj56) plays no pickyupy role
- DATA 0,13,3,11,3,0,143,49,17,40
- DATA 39,38,134,19,51,0,42,0,131,132
- DATA 22,34,49,31,20,0,5,15,14,36
- DATA 0,30,48,26,29,10,32,21,24,94
- DATA 117,111,0,142,110,95,138,92,126,108
- DATA 119,96,0,117,15,3
- RESTORE labObjectLocations
- FOR j = 1 TO 55
- READ varObjectLocations(j)
- NEXT j
- END SUB
- SUB subPrintHelp
- PRINT "I can't, you're on your own."
- PRINT
- PRINT "To move use directions such as N,S or E. I can understand simple instructions."
- PRINT "These statements should be in the form <verb> <noun> separated by a space."
- PRINT
- PRINT "If you get stuck try something completely different."
- PRINT
- PRINT "By the way magic is quite useful!"
- END SUB
- SUB subReadLocationDescriptions
- labdatalocs:
- DATA Dummyloc 'This is because the original code data started at line 2 and was RESTORED to by proc call.
- DATA "at the end of a road, outside a building. All around is forest."
- DATA "in the building, obviously an old blacksmith's forge."
- DATA in the forest.
- DATA "on the road, a small raised path leads east, the road runs north-south."
- DATA ON the top of a mountain. In the distance a small building can be seen. All around you IS dense forest. A road leads north.
- DATA ON a narrow path which seems TO descend TO the east.
- DATA in the valley of doom. The path disappears down a small shaft here. Strange echoes can be heard from below.
- DATA in the hall of spirits. Ghostly laughs AND howls can be heard echoing around the walls. The air IS full of dust AND cobwebs.
- DATA at a cross-roads in the tunnels. A chill wind blows from the north.
- DATA in the Sorcerers lair. The walls resound with the SOUND of LONG forgotten spells.
- DATA at a T-junction.
- DATA "in the sword chamber, a large stone sits in the middle of the floor."
- DATA in the gardeners store.
- DATA by a lake which stretches far away TO the horizon. The far side can only be dimly seen.
- DATA in the fiery passage.
- DATA in the banqueting hall.
- DATA "at the edge of a deep crack, it is too wide to jump."
- DATA in the smelting room. A large furnace sits in the corner.
- DATA "in the oriental room, beside the chasm. The walls are decorated with chinese paintings."
- DATA "in a very large room, the floor is covered with straw."
- DATA in the old library.
- DATA at a T-junction.
- DATA in the bank vault. An enormous safe IS set into the ceiling. There IS no obvious handle.
- DATA in a steep passage.
- DATA at the troll bridge. A sign says STOP! TROLL OPERATED TOLL BRIDGE
- DATA at a fork in the path. Behind you IS the troll bridge.
- DATA "in a very small, dark room. Full of broken rocks. A sign says DANGER FALLING ROCKS."
- DATA in a large cave. It smells of bears.
- DATA in a large room full of huge furniture.
- DATA in the soft room. The walls resemble warm ice-cream.
- DATA "in the slimy passage. A green, sticky slime crawls all around you."
- DATA in a very small rocky cavern containing many stalactites.
- DATA in a tiny room. ON the wall it says Be humble in the eyes of the sphinx AND use your brains!
- DATA in a narrow tunnel.
- DATA in the dragons lair. The bones of many adventurers lie here.
- DATA in a narrow steep-sided passage. The roof cant be seen by lamp-light.
- DATA at the DEAD-END-DIAMOND-MINE.
- DATA in the blue room.
- DATA in the oyster room. A very cold draft comes from below.
- DATA ON the edge of a vast glacier. It IS riddled with deep crevasses too wide TO jump!
- DATA in the green room.
- DATA ON a high plateau. The bridge leads back across the glacier.
- DATA in the catacombs.
- DATA in the catacombs.
- DATA in the catacombs.
- DATA in the catacombs.
- DATA in the hall of the mountain king.
- DATA in an old pirates hideout. Many seafaring relics lie here
- DATA ON the edge of the desert. A huge sphinx sits here.
- DATA in the safe.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the desert.
- DATA in the red room.
- DATA in the red room.
- DATA in the white room.
- DATA in the orange room.
- DATA in the purple room.
- DATA at a cross in the tunnels.
- DATA at a cross in the tunnels.
- DATA at a cross in the tunnels.
- DATA at a cross in the tunnels.
- DATA at a cross in the tunnels.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA wandering about in the iron passages. Your compass directions seem TO be rather confused.
- DATA at the foot of a hill. A castle can be seen at the top of it.
- DATA in the castle gateway. The castle has obviously been left derelict FOR many years AS the walls are begining TO crumble away.
- DATA in an immense courtyard.
- DATA in the ruins of the north tower.
- DATA in the dungeons. The air here IS very musty. The floor IS covered in dust AND cobwebs cling TO you AS you move.
- DATA in the Counts dining room. The decorations ON the walls here are the blood stains of some of his unfortunate victims!
- DATA ON a steep staircase.
- DATA in the south tower.
- DATA in the ballroom. The music of the orchestras which used TO PLAY here still lingers ON.
- DATA at the entrance TO the gnomes halls.
- DATA in the gnomes kitchen.
- DATA in the main hall. The Gnomes are obviously very untidy! They are also very shy AND slip silently away AS you enter.
- DATA at a T-junction.
- DATA at the south END of the main hall.
- DATA in a low tunnel.
- DATA in a low tunnel.
- DATA in the dairy. There IS a mouth_watering smell here of buttermilk AND cheese.
- DATA "in the pit. It is small,dark and very unpleasant here."
- DATA in the rainbow room. The walls are decorated with all the colours imaginable.
- DATA in a large chamber decorated in the style of the Maharajas palace.
- DATA in a tiny water-worn pipe.
- DATA in a tunnel hewn OUT of the rock by a giant explosion.
- DATA in a room full of bottles of chemicals. This IS the alchemists store. The smell of sulphur IS overpowering.
- DATA in a very tight passageway. A cool damp wind blows from the south.
- DATA in a dark damp passageway. The ground IS becoming a little soggy here.
- DATA in the Everglades. It IS rather swampy here AND the mosquitoes are real pests!
- DATA in a dark damp passageway. The ground IS a little soggy here.
- DATA in the alchemists laboratory. Theres a powerful sulphurous odour!
- DATA "on a small path winding its way through a petrified forest."
- DATA at a T-junction.
- DATA at a T-junction.
- DATA in the music room. Beautiful melodies echo all around.
- DATA at a T-junction.
- DATA "on the yellow brick road. Well I think it was yellow once upon a time but it has got rather muddy now."
- DATA in an immense canyon. The sides reach upwards AS far AS the eye can see.
- DATA in a small shrine obviously devoted TO some fairy chief AS pictures of him decorate all the walls.
- DATA in a small passage. The ground IS rather soft underfoot.
- DATA in a patch of quicksand. Luckily though some kind previous adventurer has PUT a plank down so you can go ON safely.
- DATA at a dead_end. Oh dear you seem TO have struggled through that quicksand FOR nothing.
- DATA in the treasury.
- DATA at yet another dead_end.
- DATA at a dead END. Youll have TO follow the yellow brick road once more.
- DATA at the END of the yellow brick road. Im afraid you cant go ANY further in this direction AS the rest of the road hasnt been built yet.
- DATA in a fairy grotto. It IS very beautiful but seems TO be deserted.
- DATA ON the east shore. The mountains rise sharply all around the cove.
- DATA in the wizards spell-chamber. When you entered the wizard was here mumbling about some lost spell-books. He saw you grunted something AND vanished.
- DATA in the west antechamber TO the inner sanctum.
- DATA in the inner sanctum. NOT many have passed this way before. One intrepid adventurer seems TO have written some graffiti DAVE KNEW W LANE.
- DATA in the east antechamber.
- DATA in a room similar TO the spell-chamber.
- DATA in the serpents stomach. Oh dear you seem TO have become the monsters lunch.
- DATA at the bottom of the rock slide. It IS cramped AND airless here. There IS no obvious way TO GET OUT.
- RESTORE labdatalocs
- FOR i% = 1 TO 143
- READ varLocationDescription$(i%)
- NEXT i%
- END SUB
- SUB subReadObjects
- labObjects:
- DATA axe,sword,lamp,wand,keys,teeth,jack,chest,food,clam
- DATA sapphires,diamond,gold,silver,platinum,rubies,emerald,pearls,coins,opals
- DATA books,spices,sceptre,cushion,rug,ring,bottle,water,carrot,dragon
- DATA dwarf,ogre,goblins,troll,bear,pirate,orc,rabbit,safe,casket
- DATA crocodile,elephant,vampire,serpent,bracelet,amethyst,crown,boat,stake,stilton
- DATA matches,mouse,bridge,swamp,lake,building,
- RESTORE labObjects:
- FOR i% = 1 TO 56
- READ varObjectDesc$(i%)
- NEXT i%
- END SUB
- SUB subReadVerbs
- labVerbs:
- DATA GET,take,OPEN,wave,throw,drop,KILL,eat,cross,feed
- DATA rub,light,READ,pay,inventory,enter,OUT,leave,kneel,quit
- DATA score,look,in,help,diaxos,north,south,east,west,up
- DATA down,fill,go,load,save
- RESTORE labVerbs:
- FOR i% = 1 TO 35
- READ varVerb$(i%)
- NEXT i%
- END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement