home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 108 / gp2demo.iso / multimed / simpdemo / SIMPSONS / SIMPDEMO.EXE / SIMPDEMO.DXR / 00001.ls next >
Encoding:
Text File  |  1980-01-01  |  4.0 KB  |  155 lines

  1. global PCflag, simpdataPath, simpsonsPath, dlogdataPath, toondataPath, exportPath, MSfileObj, usersColorDepth, playBackMode, runningOffCDflag
  2.  
  3. on startMovie
  4.   initSimpsons()
  5. end
  6.  
  7. on initSimpsons
  8.   set PCflag to the machineType = 256
  9.   checkColorDepth()
  10.   if not PCflag then
  11.     initFinderHider()
  12.   end if
  13.   setUpDirectoryPaths()
  14.   set playBackMode to #BEGIN
  15.   set the keyDownScript to "setVolume()"
  16. end
  17.  
  18. on initFinderHider
  19.   global bg
  20.   if objectp(bg) = 0 then
  21.     set bg to backdrop(mnew)
  22.     bg(mRegister, "20184752-943")
  23.   end if
  24.   if objectp(bg) then
  25.     bg(mHideInBack, 0)
  26.     bg(mShow)
  27.   end if
  28. end
  29.  
  30. on setItemDelimiter
  31.   if PCflag then
  32.     set the itemDelimiter to "\"
  33.   else
  34.     set the itemDelimiter to ":"
  35.   end if
  36. end
  37.  
  38. on unSetItemDelimiter
  39.   set the itemDelimiter to ","
  40. end
  41.  
  42. on checkColorDepth
  43.   if PCflag then
  44.     if the colorDepth < 8 then
  45.       alert("Sorry, The Simpsons Cartoon Studio requires 256 colors to run properly.")
  46.       quit()
  47.     else
  48.       if the colorDepth > 8 then
  49.         alert("The Simpsons Cartoon Studio is optimized for a system set to a resolution of 256 colors (8 bit). If you choose to continue the program may run slower and may require more RAM.")
  50.       end if
  51.     end if
  52.   else
  53.     if the colorDepth <> 8 then
  54.       set usersColorDepth to the colorDepth
  55.       set the colorDepth to 8
  56.       if the colorDepth <> 8 then
  57.         alert("Sorry, The Simpsons Cartoon Studio requires 256 colors to run properly.")
  58.         quit()
  59.       end if
  60.     end if
  61.   end if
  62. end
  63.  
  64. on setUpDirectoryPaths
  65.   set simpsonsPath to the moviePath
  66.   if PCflag then
  67.     set theDirDelimiter to "\"
  68.   else
  69.     set theDirDelimiter to ":"
  70.   end if
  71.   set dlogdataPath to simpsonsPath & "support" & theDirDelimiter & "dlogdata" & theDirDelimiter
  72.   set toondataPath to simpsonsPath & "support" & theDirDelimiter & "toondata" & theDirDelimiter
  73.   set exportPath to simpsonsPath & "export" & theDirDelimiter
  74.   if PCflag then
  75.     setupDLLs()
  76.   end if
  77.   setItemDelimiter()
  78.   set simpdataPath to simpsonsPath
  79.   set theItemNumber to the number of items in simpsonsPath - 1
  80.   put "simpdata" into item theItemNumber of simpdataPath
  81.   unSetItemDelimiter()
  82. end
  83.  
  84. on setupDLLs
  85.   set checkNameList to []
  86.   repeat with count = 1 to the maxinteger
  87.     set theFileName to getNthFileNameInFolder(dlogdataPath, count)
  88.     if theFileName = EMPTY then
  89.       exit repeat
  90.     end if
  91.     append(checkNameList, theFileName)
  92.   end repeat
  93.   set DLLsAreAvailable to 0
  94.   set fileioIsAvailable to 0
  95.   set msFileIsAvailable to 0
  96.   repeat with theFileName in checkNameList
  97.     if theFileName = "fileio.dll" then
  98.       set fileioIsAvailable to 1
  99.     end if
  100.     if theFileName = "msFile.dll" then
  101.       set msFileIsAvailable to 1
  102.     end if
  103.   end repeat
  104.   if fileioIsAvailable and msFileIsAvailable then
  105.     set DLLsAreAvailable to 1
  106.   end if
  107.   if DLLsAreAvailable then
  108.     if not objectp(factory("fileIO")) then
  109.       openXLib(dlogdataPath & "fileIO")
  110.     end if
  111.     if not objectp(factory("msFile")) then
  112.       openXLib(dlogdataPath & "msFile")
  113.       set MSfileObj to msfile(mnew)
  114.     end if
  115.   else
  116.     set theMessage to "Please make sure that FILEIO.DLL and MSFILE.DLL are in the Simpdata directory."
  117.     alert(theMessage)
  118.     quit()
  119.   end if
  120. end
  121.  
  122. on turnOffMusic
  123.   puppetSound(1, 0)
  124. end
  125.  
  126. on setVolume
  127.   if (the keyCode = 18) or (the keyCode = 83) then
  128.     set the soundLevel to 1
  129.   else
  130.     if (the keyCode = 19) or (the keyCode = 84) then
  131.       set the soundLevel to 2
  132.     else
  133.       if (the keyCode = 20) or (the keyCode = 85) then
  134.         set the soundLevel to 3
  135.       else
  136.         if (the keyCode = 21) or (the keyCode = 86) then
  137.           set the soundLevel to 4
  138.         else
  139.           if (the keyCode = 23) or (the keyCode = 87) then
  140.             set the soundLevel to 5
  141.           else
  142.             if (the keyCode = 22) or (the keyCode = 88) then
  143.               set the soundLevel to 6
  144.             else
  145.               if (the keyCode = 26) or (the keyCode = 89) then
  146.                 set the soundLevel to 7
  147.               end if
  148.             end if
  149.           end if
  150.         end if
  151.       end if
  152.     end if
  153.   end if
  154. end
  155.