home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 November / Chip_2000-11_cd1.iso / DATA / INF.Z / BIT16 / MC16.EXE / MC16.DXR / 00001.ls next >
Encoding:
Text File  |  1998-02-20  |  6.8 KB  |  315 lines

  1. global gvolumeName, gStartPath, gSavePath, gHDSoundPath, gHDMoviePath, gSoundPath, CDobj, CDejected, CDstoptime, gCDinDrive, gDeveloping, gDoorClosed, gDirectoryDelimiter, MCobject
  2.  
  3. on stopMovie
  4.   releaseCDxObject()
  5. end
  6.  
  7. on releaseCDxObject
  8.   if objectp(CDobj) then
  9.     CDobj(mdispose)
  10.   end if
  11. end
  12.  
  13. on openAllXlibs
  14.   if the machineType = 256 then
  15.   else
  16.     openXLib(the pathName & "MEANCITY.LIB")
  17.   end if
  18. end
  19.  
  20. on initCDxlib
  21.   releaseCDxObject()
  22.   if the machineType = 256 then
  23.   else
  24.     set CDobj to AppleCD(mnew)
  25.   end if
  26.   set CDejected to 0
  27.   return objectp(CDobj)
  28. end
  29.  
  30. on ejectCD
  31.   if objectp(CDobj) then
  32.     if the machineType = 256 then
  33.       set status to 0
  34.     else
  35.       CDobj(mEject)
  36.       repeat while 1
  37.         set status to CDobj(mService)
  38.         if gDeveloping then
  39.           put "CDeject status:" && status
  40.         end if
  41.         if status <> -10 then
  42.           exit repeat
  43.         end if
  44.       end repeat
  45.     end if
  46.   else
  47.     set status to 99
  48.   end if
  49.   set CDejected to 1
  50.   return status
  51. end
  52.  
  53. on closeCDxlib
  54.   releaseCDxObject()
  55.   if the machineType = 256 then
  56.   else
  57.     closeXLib("MEANCITY.LIB")
  58.   end if
  59. end
  60.  
  61. on displayButton whichCast, handCursor
  62.   if integerp(whichCast) then
  63.     set theNum to whichCast
  64.   else
  65.     set theNum to the number of member whichCast
  66.   end if
  67.   swapCast(3, theNum)
  68.   case whichCast of
  69.     "eject", "ready":
  70.       set the ink of sprite 3 to 36
  71.       set the loc of sprite 3 to point(270, 346)
  72.       swapCast(4, 22)
  73.       set the ink of sprite 4 to 36
  74.       set the loc of sprite 4 to point(384, 344)
  75.     otherwise:
  76.       set the ink of sprite 3 to 8
  77.       set the loc of sprite 3 to point(320, 400)
  78.   end case
  79.   if handCursor then
  80.     set the cursor of sprite 3 to [10, 11]
  81.     set the cursor of sprite 4 to [10, 11]
  82.   end if
  83.   updateStage()
  84. end
  85.  
  86. on hideButton
  87.   swapCast(3, 3)
  88.   set the cursor of sprite 3 to 0
  89.   swapCast(4, 3)
  90.   set the cursor of sprite 4 to 0
  91. end
  92.  
  93. on waitForCD
  94.   if objectp(CDobj) then
  95.     if the machineType = 256 then
  96.     else
  97.       repeat while 1
  98.         CDobj(mReadStatus)
  99.         set status to CDobj(mService)
  100.         if status <> -10 then
  101.           exit repeat
  102.         end if
  103.       end repeat
  104.     end if
  105.     wait(120)
  106.     return 1
  107.   else
  108.     return 0
  109.   end if
  110. end
  111.  
  112. on CDisReady
  113.   if objectp(CDobj) then
  114.     if the machineType = 256 then
  115.       set status to 0
  116.     else
  117.       CDobj(mReadStatus)
  118.       set status to CDobj(mService)
  119.     end if
  120.     if status < 0 then
  121.       return 0
  122.     else
  123.       if CDejected then
  124.         set CDejected to 0
  125.         set CDstoptime to the ticks + 120
  126.         return 0
  127.       else
  128.         if the ticks > CDstoptime then
  129.           return 1
  130.         else
  131.           return 0
  132.         end if
  133.       end if
  134.     end if
  135.   else
  136.     return -1
  137.   end if
  138. end
  139.  
  140. on setUpMacPathNames
  141.   set CDinDrive to CheckMacDrive()
  142.   set gDirectoryDelimiter to ":"
  143.   set gStartPath to the pathName
  144.   set gSavePath to gStartPath & "save:"
  145.   set gHDMoviePath to gStartPath & "Movies:"
  146.   set gHDSoundPath to gStartPath & "atmos:"
  147.   set moviePath to gvolumeName
  148.   set gSoundPath to gvolumeName & "Sounds:"
  149.   return CDinDrive
  150. end
  151.  
  152. on setupWinPathNames
  153.   set CDinDrive to CheckPCDrive()
  154.   set gDirectoryDelimiter to "\"
  155.   set gStartPath to the pathName
  156.   set gSavePath to gStartPath & "SAVE\"
  157.   set gHDMoviePath to gStartPath & "Movies\"
  158.   set gHDSoundPath to gStartPath & "atmos\"
  159.   set moviePath to gvolumeName
  160.   set gSoundPath to gvolumeName & "Sounds\"
  161.   return CDinDrive
  162. end
  163.  
  164. on CheckPCDrive
  165.   set diskNumber to 0
  166.   repeat with i = 66 to 90
  167.     set drive to numToChar(i) & ":\MeanCity\"
  168.     set diskNumber to getLoadedDisk(drive & "DSKCHECK\")
  169.     if diskNumber > 0 then
  170.       set gvolumeName to drive
  171.       exit repeat
  172.     end if
  173.   end repeat
  174.   return diskNumber
  175. end
  176.  
  177. on CheckMacDrive
  178.   set diskNumber to getLoadedDisk("MEAN_CITY:MeanCity:DSKCHECK:")
  179.   if diskNumber > 0 then
  180.     set gvolumeName to "MEAN_CITY:MeanCity:"
  181.   end if
  182.   return diskNumber
  183. end
  184.  
  185. on swapCast whichSprite, whichCast
  186.   puppetSprite(whichSprite, 1)
  187.   set the castNum of sprite whichSprite to whichCast
  188. end
  189.  
  190. on wait howManyTicks
  191.   set whenToStop to the ticks + howManyTicks
  192.   repeat while the ticks < whenToStop
  193.     updateStage()
  194.   end repeat
  195. end
  196.  
  197. on waitForClick
  198.   repeat while 1
  199.     updateStage()
  200.     if the mouseDown then
  201.       return the rollOver
  202.     end if
  203.   end repeat
  204. end
  205.  
  206. on processDisk whichdisk
  207.   if the machineType = 256 then
  208.     set gCDinDrive to CheckPCDrive()
  209.   else
  210.     set gCDinDrive to CheckMacDrive()
  211.   end if
  212.   if gCDinDrive = whichdisk then
  213.     swapCast(2, 11 + random(3))
  214.     set the loc of sprite 2 to point(320, 240)
  215.     set the ink of sprite 2 to 0
  216.     hideButton()
  217.     cursor(4)
  218.     updateStage()
  219.     startAtmos()
  220.     if gDeveloping then
  221.       go(1, gStartPath & "MEANCITY")
  222.     else
  223.       go(1, gvolumeName & "MEANCITY")
  224.     end if
  225.   else
  226.     beep()
  227.   end if
  228. end
  229.  
  230. on checkForExternals
  231.   if not (the quickTimePresent) then
  232.     set message to "The correct version of QuickTime is not installed. Please install it from the CD-ROM, and then restart Mean City." & RETURN
  233.   else
  234.     set message to EMPTY
  235.   end if
  236.   if the machineType = 256 then
  237.     set library to []
  238.   else
  239.     set library to ["MEANCITY.LIB"]
  240.   end if
  241.   set howMany to count(library)
  242.   if howMany > 0 then
  243.     repeat with theName in library
  244.       if fileExists(the pathName & theName) <> "OK" then
  245.         put theName && "must be in the same directory as the Mean City projector. Please copy from the CD-ROM and restart Mean City." & RETURN after message
  246.       end if
  247.     end repeat
  248.   end if
  249.   if fileExists(gSavePath & "save.0MC") <> "OK" then
  250.     put "SAVE.0MC not found in SAVE directory" & RETURN after message
  251.   end if
  252.   return message
  253. end
  254.  
  255. on startAtmos
  256.   puppetSound(1, 26)
  257. end
  258.  
  259. on deleteSwapFile
  260.   set where to the pathName & "Save" & gDirectoryDelimiter
  261.   deleteFile(where & "swap.0MC")
  262.   deleteFile(where & "Revision.0MC")
  263.   return 1
  264. end
  265.  
  266. on fileExists fullFileName
  267.   set MCobject to 0
  268.   set MCobject to new(xtra("fileIO"))
  269.   if not objectp(MCobject) then
  270.     return "Handler FileExists: couldn't create fileIO xtra instance"
  271.   end if
  272.   openFile(MCobject, fullFileName, 1)
  273.   set answer to error(MCobject, status(MCobject))
  274.   closeFile(MCobject)
  275.   set MCobject to 0
  276.   return answer
  277. end
  278.  
  279. on getLoadedDisk thePath
  280.   case getNthFileNameInFolder(thePath, 1) of
  281.     "0MCDISK1.000":
  282.       return 1
  283.     "0MCDISK2.000":
  284.       return 2
  285.     otherwise:
  286.       return 0
  287.   end case
  288. end
  289.  
  290. on deleteFile whichfile
  291.   set MCobject to 0
  292.   set MCobject to new(xtra("fileIO"))
  293.   if not objectp(MCobject) then
  294.     return -2
  295.   end if
  296.   openFile(MCobject, whichfile, 0)
  297.   set code to error(MCobject, status(MCobject))
  298.   if code <> "OK" then
  299.     set MCobject to 0
  300.     return -3
  301.   end if
  302.   closeFile(MCobject)
  303.   delete(MCobject)
  304.   set code to error(MCobject, status(MCobject))
  305.   set MCobject to 0
  306.   if code <> "OK" then
  307.     return -4
  308.   else
  309.     return 0
  310.   end if
  311. end
  312.  
  313. on doDummyWrite whichPath
  314. end
  315.