home *** CD-ROM | disk | FTP | other *** search
/ PC/CD Gamer UK 39 / PCGAMER39.bin / games / amber / amberhub.dxr / 00020_cStoryteller.2.ls < prev    next >
Encoding:
Text File  |  1996-11-08  |  4.2 KB  |  133 lines

  1. on ancestorTest me
  2.   put "<!>  Here I am; ancestor functioning nicely, without a birth() handler!!"
  3. end
  4.  
  5. on ensureProperCD me, destination, lastOuterDomain
  6.   global domainIsReady, gAmberPath, gSoundPath2, gCPU, gVoid, gProjectorPath, gIdleNow, gCDswapStash, gCDtry
  7.   set desiredDisc to 1
  8.   if (destination = "roxy") and (count(the lsStateData of me) > 0) then
  9.     set ghostRoster to getaProp(the lsStateData of me, #ghostsRemaining)
  10.     if voidp(ghostRoster) then
  11.       set roxyState to getProp(the lsStateData of me, #StateOnIce)
  12.       set ghostRoster to getProp(roxyState, #ghostsRemaining)
  13.     end if
  14.     if count(ghostRoster) < 1 then
  15.       set desiredDisc to 2
  16.       set whichTunnel to lastOuterDomain
  17.     end if
  18.   end if
  19.   addProp(gCDswapStash, #desiredDisc, desiredDisc)
  20.   put "<i>  gCDswapStash = " & gCDswapStash
  21.   put "<i>  looking for DISC " & desiredDisc
  22.   if gCPU = #PC then
  23.     set buildTest to new(xtra("FileIO"))
  24.     if not objectp(buildTest) then
  25.       alert("Sorry, couldn't create FileIO object (Has the game program been moved from its folder?)")
  26.       quit()
  27.     end if
  28.     openFile(buildTest, gProjectorPath & "building.txt", 1)
  29.     if 1 then
  30.       set buildTest to 0
  31.       set gAmberPath to the pathName
  32.       set gSoundPath2 to gAmberPath & "CD_DATA\"
  33.     else
  34.       set buildTest to 0
  35.       put "ensureProperCD():  going to GetCDletter() for disc " & desiredDisc
  36.       set cdLetter to GetCDletter("amber_jb.", desiredDisc)
  37.       put "cdLetter = "
  38.       put cdLetter
  39.       if stringp(cdLetter) then
  40.         put "cdLetter = " & cdLetter
  41.         set gAmberPath to char 1 to 2 of cdLetter & "\"
  42.         put "ensureProperCD(): gAmberPath ( based on GetCDLetter() ) = "
  43.         put gAmberPath
  44.         return 
  45.       else
  46.         put "ΓÇóΓÇóΓÇówrong disc, proceeding to LIFEBOAT.."
  47.         set gCDtry to 1
  48.         if stringp(whichTunnel) then
  49.           go(whichTunnel, gProjectorPath & "LIFEBOAT")
  50.         else
  51.           go(1, gProjectorPath & "LIFEBOAT")
  52.         end if
  53.       end if
  54.       abort()
  55.     end if
  56.   else
  57.     if the pathName contains "Jumbo" then
  58.       alert("OK, since I'm on Jumbo we'll play from the hard-disk..")
  59.       set gAmberPath to "Jumbo:Desktop Folder:AMBER project:AMBER Disc " & desiredDisc & ":"
  60.       set gSoundPath2 to gAmberPath & "CD_SOUNDS:"
  61.       exit
  62.     else
  63.       set volumeTest to FileIO(mnew, "read", "AMBER Disc " & desiredDisc & ":Read Me")
  64.       if objectp(volumeTest) then
  65.         volumeTest(mdispose)
  66.         set gAmberPath to "AMBER Disc " & desiredDisc & ":"
  67.         put "gAmberPath = "
  68.         put gAmberPath
  69.         return 
  70.       else
  71.         put "ΓÇóΓÇóΓÇóvolumetest = " & volumeTest
  72.         put "ΓÇóΓÇóΓÇówrong disc, proceeding to LIFEBOAT.."
  73.         set gCDtry to 1
  74.         if stringp(whichTunnel) then
  75.           go(whichTunnel, gProjectorPath & "LIFEBOAT")
  76.         else
  77.           go(2, gProjectorPath & "LIFEBOAT")
  78.         end if
  79.         abort()
  80.       end if
  81.     end if
  82.   end if
  83.   put "<!>  ensureProperCD(): You shouldn't be able to see this.."
  84. end
  85.  
  86. on quitGame me
  87.   global oPuppeteer, gCPU, gAmberPath, gOldSndLevel, oBackdrop, oUtility, oMemory, colorcrsr, gSavePath, domainIsReady, testData
  88.   puppetTransition(1)
  89.   installMenu(0)
  90.   updateStage()
  91.   if objectp(oBackdrop) then
  92.     oBackdrop(mPatToWindow, -5)
  93.   end if
  94.   if objectp(colorcrsr) then
  95.     colorcrsr(mGetSetCursor, getProp(YugoCursors, #noCursor))
  96.   else
  97.     cursor(200)
  98.   end if
  99.   set gCursorSwitch to #off
  100.   fadeOutTransit()
  101.   go("quit", gAmberPath & "AMBERHUB")
  102.   wait(240)
  103.   writePrefsFile(oPuppeteer)
  104.   if integerp(gOldSndLevel) then
  105.     set the soundLevel to gOldSndLevel
  106.   end if
  107.   set the traceLogFile to EMPTY
  108.   if objectp(testData) then
  109.     testData(mdispose)
  110.   end if
  111.   put "quitGame: into object disposal"
  112.   if objectp(oBackdrop) then
  113.     put "disposing of oBackdrop: " & oBackdrop(mdispose)
  114.   end if
  115.   if objectp(oUtility) then
  116.     put "disposing of oUtility: " & oUtility(mdispose)
  117.   end if
  118.   if objectp(colorcrsr) then
  119.     put "colorcrsr = " & colorcrsr
  120.     put "disposing of colorcrsr: " & colorcrsr(mdispose)
  121.   end if
  122.   if objectp(oMemory) then
  123.     put "disposing of oMemory: " & oMemory(mdispose)
  124.   end if
  125.   set oStoryteller to 0
  126.   put "oStoryteller: Hm, back from the grave.."
  127.   set oPuppeteer to 0
  128.   closeXLib()
  129.   closeResFile()
  130.   quit()
  131.   abort()
  132. end
  133.