DECLARE SUB DissolveScreen ()
DECLARE SUB SaveGame ()
DECLARE SUB HitAnyKey ()
'$INCLUDE: 'c:\bc7\programs\yoshi\global.bi'

SUB CannotDo
  a = INT((9) * RND)
  IF a = 0 THEN PRINT "Oops!  That doesn't work here."
  IF a = 1 THEN PRINT "You cannot do that here."
  IF a = 2 THEN PRINT "No can do, Kemosabe."
  IF a = 3 THEN PRINT "The inherent laws of the universe will not allow that."
  IF a = 4 THEN PRINT "That is not a valid command."
  IF a = 5 THEN PRINT "Please rephrase that command."
  IF a = 6 THEN PRINT "Your head spins at the very thought."
  IF a = 7 THEN PRINT "This game doesn't come with a spell checker, you know."
  IF a = 8 THEN PRINT "That wouldn't be prudent at this juncture."
END SUB

SUB CannotGo
  COLOR 15, 0, 9
  PRINT "You cannot go that direction."
  COLOR 7, 0, 8
END SUB

SUB Dead
  COLOR 20, 0, 9: PRINT : PRINT TAB(15); "You are DEAD!": PRINT
  COLOR 11, 0, 9: INPUT "Would you like to play again"; a$: a$ = UCASE$(a$)
  COLOR 7, 0, 8: IF a$ = "Y" OR a$ = "YES" THEN GOTO PlayAgain
  COLOR 9, 0, 9: PRINT : PRINT TAB(15); "The End.": COLOR 7, 0, 8
  HitAnyKey
  DissolveScreen
  END

PlayAgain:
  RUN "c:\kcck\yoshi.exe"
END SUB

SUB HitAnyKey
DO
  LOOP WHILE INKEY$ = ""
END SUB

SUB Inventory
  COLOR 15, 0, 9: PRINT "Your inventory:": COLOR 7, 0, 8
  IF atomicbomb = 1 THEN PRINT " atomic bomb (homemade)"
  IF bananaslug = 1 THEN PRINT "  banana slug"
  IF bathroomkey = 1 THEN PRINT " bathroom key"
  IF beachumbrella = 1 THEN PRINT " beach umbrella"
  IF birdseed = 1 THEN PRINT " birdseed"
  IF birthdaycard = 1 THEN PRINT " birthday card"
  IF branch = 1 THEN PRINT " branch"
  IF brillopad = 1 THEN PRINT " Brillo pad"
  IF camera = 1 OR camera = 2 THEN PRINT " poloriod camera"
  IF canopener = 1 THEN PRINT " can opener"
  IF hockeymask = 1 OR hockeymask = 2 THEN PRINT " hockey mask"
  IF lampshade = 1 OR lampshade = 2 THEN PRINT " tassled lampshade"
  IF oilyrags = 1 THEN PRINT " oily rags"
  IF kaopectate = 1 THEN PRINT " bottle of kaopectate"
  IF photo = 1 THEN PRINT " photograph of UFO"
  IF popsiclesticks = 1 THEN PRINT " popsicle sticks"
  IF prybar = 1 THEN PRINT " pry bar"
  IF qtip = 1 THEN PRINT " Q-Tip"
  IF smellybone = 1 THEN PRINT " smelly bone"
  IF torch = 1 THEN PRINT " unlit torch"
  IF torch = 2 THEN PRINT " lit torch"
  IF twentydollarbill = 1 THEN PRINT " twenty dollar bill"
  IF atomicbomb = 0 AND (qtip = 0 OR qtip = 2) AND (canopener = 0 OR canopener = 2) AND (bananaslug = 0 OR bananaslug = 2) AND bathroomkey = 0 AND beachumbrella = 0 AND birdseed = 0 AND (branch = 0 OR branch = 2) AND (brillopad = 0 OR brillopad = 2) _
 AND (camera = 0 OR camera = 2) AND (hockeymask = 0 OR hockeymask = 2) AND (lampshade = 0 OR lampshade = 2) AND (oilyrags = 0 OR oilyrags = 2) AND (kaopectate = 0 OR kaopecate = 2) AND (photo = 0 OR photo = 2) AND popsiclesticks = 0 AND prybar = 0  _
AND (smellybone = 0 OR smellybone = 2) AND torch = 0 THEN PRINT " Nothing!  Absolutely nothing!  Stupid!  You're so stupid!"
END SUB

SUB Quit
  COLOR 11, 0, 9: PRINT
  INPUT "Are you sure that you want to quit"; a$: a$ = UCASE$(a$)
  IF a$ = "Y" OR a$ = "YES" OR a$ = "YUP" THEN GOTO WantToSave ELSE GOTO NotQuit

WantToSave:
  PRINT
  INPUT "Would you like to save your game"; a$: a$ = UCASE$(a$)
  IF a$ = "Y" OR a$ = "YES" OR a$ = "YUP" THEN SaveGame
  DissolveScreen
  END

NotQuit:
  COLOR 7, 0, 8
END SUB

SUB RestoreGame
  ON LOCAL ERROR RESUME NEXT
  OPEN "c:\kcck\yoshi.sav" FOR INPUT AS #1
  IF ERR > 0 THEN PRINT : PRINT "There is no saved game.  You will start from the beginning.": GOTO NoFile
  INPUT #1, searchfield, talkrhino, chickenhit, fbitalk, fbi, beach1search, stomach, talkman, getmoney, curerhino, birdseed, stench, rustygrate, dumpstersearch, cleangrave, fountainsearch, drinkbeer, road1search, garagedoor, birthdaycard,  _
twentydollarbill, hockeymask, kaopectate, camera, photo, smellybone, beachumbrella, popsiclesticks, bathroomkey, lampshade, prybar, brillopad, torch, branch, oilyrags, bananaslug, pantrydoor, canopener, qtip, atomicbomb
  GOTO EndOfSub

NoFile:
  HitAnyKey
  ON LOCAL ERROR GOTO 0
  GOTO EndOfSub

EndOfSub:
END SUB

SUB SaveGame
  OPEN "C:\kcck\yoshi.sav" FOR OUTPUT AS #1
  PRINT #1, searchfield, talkrhino, chickenhit, fbitalk, fbi, beach1search, stomach, talkman, getmoney, curerhino, birdseed, stench, rustygrate, dumpstersearch, cleangrave, fountainsearch, drinkbeer, road1search, garagedoor, birthdaycard,  _
twentydollarbill, hockeymask, kaopectate, camera, photo, smellybone, beachumbrella, popsiclesticks, bathroomkey, lampshade, prybar, brillopad, torch, branch, oilyrags, bananaslug, pantrydoor, canopener, qtip, atomicbomb
  CLOSE #1
  END
END SUB

