home *** CD-ROM | disk | FTP | other *** search
- global gvolumeName, gStartPath, gSavePath, gHDSoundPath, gHDMoviePath, gSoundPath, CDobj, CDejected, CDstoptime, gCDinDrive, gDeveloping, gDoorClosed, gDirectoryDelimiter, MCobject
-
- on stopMovie
- releaseCDxObject()
- end
-
- on releaseCDxObject
- if objectp(CDobj) then
- CDobj(mdispose)
- end if
- end
-
- on openAllXlibs
- if the machineType = 256 then
- else
- openXLib(the pathName & "MEANCITY.LIB")
- end if
- end
-
- on initCDxlib
- releaseCDxObject()
- if the machineType = 256 then
- else
- set CDobj to AppleCD(mnew)
- end if
- set CDejected to 0
- return objectp(CDobj)
- end
-
- on ejectCD
- if objectp(CDobj) then
- if the machineType = 256 then
- set status to 0
- else
- CDobj(mEject)
- repeat while 1
- set status to CDobj(mService)
- if gDeveloping then
- put "CDeject status:" && status
- end if
- if status <> -10 then
- exit repeat
- end if
- end repeat
- end if
- else
- set status to 99
- end if
- set CDejected to 1
- return status
- end
-
- on closeCDxlib
- releaseCDxObject()
- if the machineType = 256 then
- else
- closeXLib("MEANCITY.LIB")
- end if
- end
-
- on displayButton whichCast, handCursor
- if integerp(whichCast) then
- set theNum to whichCast
- else
- set theNum to the number of member whichCast
- end if
- swapCast(3, theNum)
- case whichCast of
- "eject", "ready":
- set the ink of sprite 3 to 36
- set the loc of sprite 3 to point(270, 346)
- swapCast(4, 22)
- set the ink of sprite 4 to 36
- set the loc of sprite 4 to point(384, 344)
- otherwise:
- set the ink of sprite 3 to 8
- set the loc of sprite 3 to point(320, 400)
- end case
- if handCursor then
- set the cursor of sprite 3 to [10, 11]
- set the cursor of sprite 4 to [10, 11]
- end if
- updateStage()
- end
-
- on hideButton
- swapCast(3, 3)
- set the cursor of sprite 3 to 0
- swapCast(4, 3)
- set the cursor of sprite 4 to 0
- end
-
- on waitForCD
- if objectp(CDobj) then
- if the machineType = 256 then
- else
- repeat while 1
- CDobj(mReadStatus)
- set status to CDobj(mService)
- if status <> -10 then
- exit repeat
- end if
- end repeat
- end if
- wait(120)
- return 1
- else
- return 0
- end if
- end
-
- on CDisReady
- if objectp(CDobj) then
- if the machineType = 256 then
- set status to 0
- else
- CDobj(mReadStatus)
- set status to CDobj(mService)
- end if
- if status < 0 then
- return 0
- else
- if CDejected then
- set CDejected to 0
- set CDstoptime to the ticks + 120
- return 0
- else
- if the ticks > CDstoptime then
- return 1
- else
- return 0
- end if
- end if
- end if
- else
- return -1
- end if
- end
-
- on setUpMacPathNames
- set CDinDrive to CheckMacDrive()
- set gDirectoryDelimiter to ":"
- set gStartPath to the pathName
- set gSavePath to gStartPath & "save:"
- set gHDMoviePath to gStartPath & "Movies:"
- set gHDSoundPath to gStartPath & "atmos:"
- set moviePath to gvolumeName
- set gSoundPath to gvolumeName & "Sounds:"
- return CDinDrive
- end
-
- on setupWinPathNames
- set CDinDrive to CheckPCDrive()
- set gDirectoryDelimiter to "\"
- set gStartPath to the pathName
- set gSavePath to gStartPath & "SAVE\"
- set gHDMoviePath to gStartPath & "Movies\"
- set gHDSoundPath to gStartPath & "atmos\"
- set moviePath to gvolumeName
- set gSoundPath to gvolumeName & "Sounds\"
- return CDinDrive
- end
-
- on CheckPCDrive
- set diskNumber to 0
- repeat with i = 66 to 90
- set drive to numToChar(i) & ":\MeanCity\"
- set diskNumber to getLoadedDisk(drive & "DSKCHECK\")
- if diskNumber > 0 then
- set gvolumeName to drive
- exit repeat
- end if
- end repeat
- return diskNumber
- end
-
- on CheckMacDrive
- set diskNumber to getLoadedDisk("MEAN_CITY:MeanCity:DSKCHECK:")
- if diskNumber > 0 then
- set gvolumeName to "MEAN_CITY:MeanCity:"
- end if
- return diskNumber
- end
-
- on swapCast whichSprite, whichCast
- puppetSprite(whichSprite, 1)
- set the castNum of sprite whichSprite to whichCast
- end
-
- on wait howManyTicks
- set whenToStop to the ticks + howManyTicks
- repeat while the ticks < whenToStop
- updateStage()
- end repeat
- end
-
- on waitForClick
- repeat while 1
- updateStage()
- if the mouseDown then
- return the rollOver
- end if
- end repeat
- end
-
- on processDisk whichdisk
- if the machineType = 256 then
- set gCDinDrive to CheckPCDrive()
- else
- set gCDinDrive to CheckMacDrive()
- end if
- if gCDinDrive = whichdisk then
- swapCast(2, 11 + random(3))
- set the loc of sprite 2 to point(320, 240)
- set the ink of sprite 2 to 0
- hideButton()
- cursor(4)
- updateStage()
- startAtmos()
- if gDeveloping then
- go(1, gStartPath & "MEANCITY")
- else
- go(1, gvolumeName & "MEANCITY")
- end if
- else
- beep()
- end if
- end
-
- on checkForExternals
- if not (the quickTimePresent) then
- set message to "The correct version of QuickTime is not installed. Please install it from the CD-ROM, and then restart Mean City." & RETURN
- else
- set message to EMPTY
- end if
- if the machineType = 256 then
- set library to []
- else
- set library to ["MEANCITY.LIB"]
- end if
- set howMany to count(library)
- if howMany > 0 then
- repeat with theName in library
- if fileExists(the pathName & theName) <> "OK" then
- 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
- end if
- end repeat
- end if
- if fileExists(gSavePath & "save.0MC") <> "OK" then
- put "SAVE.0MC not found in SAVE directory" & RETURN after message
- end if
- return message
- end
-
- on startAtmos
- puppetSound(1, 26)
- end
-
- on deleteSwapFile
- set where to the pathName & "Save" & gDirectoryDelimiter
- deleteFile(where & "swap.0MC")
- deleteFile(where & "Revision.0MC")
- return 1
- end
-
- on fileExists fullFileName
- set MCobject to 0
- set MCobject to new(xtra("fileIO"))
- if not objectp(MCobject) then
- return "Handler FileExists: couldn't create fileIO xtra instance"
- end if
- openFile(MCobject, fullFileName, 1)
- set answer to error(MCobject, status(MCobject))
- closeFile(MCobject)
- set MCobject to 0
- return answer
- end
-
- on getLoadedDisk thePath
- case getNthFileNameInFolder(thePath, 1) of
- "0MCDISK1.000":
- return 1
- "0MCDISK2.000":
- return 2
- otherwise:
- return 0
- end case
- end
-
- on deleteFile whichfile
- set MCobject to 0
- set MCobject to new(xtra("fileIO"))
- if not objectp(MCobject) then
- return -2
- end if
- openFile(MCobject, whichfile, 0)
- set code to error(MCobject, status(MCobject))
- if code <> "OK" then
- set MCobject to 0
- return -3
- end if
- closeFile(MCobject)
- delete(MCobject)
- set code to error(MCobject, status(MCobject))
- set MCobject to 0
- if code <> "OK" then
- return -4
- else
- return 0
- end if
- end
-
- on doDummyWrite whichPath
- end
-