home *** CD-ROM | disk | FTP | other *** search
/ PC Action 1997 February / PCA0297.ISO / demos / shine / shared.dxr / 01028.ls < prev    next >
Encoding:
Text File  |  1996-08-18  |  11.8 KB  |  349 lines

  1. global t_speed, chunk, c_cursor, cLinks, cRechts, cStraight, cDown, cHand, cityLoc, mymovie, myFrame, mypuppets, myvisibility, mycastnr, stringref, colorsetting, hintlist, ckey, CDloc, mac, sep, shineHpath, cdobj, fixpal, hschwarz, mainpath, ShineID, bigmovie, Hymne1, Hymne2, Finger, callmovie, dead
  2.  
  3. on savethatmovie
  4.   global stringref, chunk, t_speed, access, cityLoc, prevLoc, geenaTalk1, cops, TCMCsnake, RamsMov, symbols, c_symbols, schrank, cLinks, cRechts, cStraight, Finger, cDown, cHand, c_cursor, old_access, shamen_visit, s1vol, s2vol, Hymne1, Hymne2, Locations, Nat_deckel, gee_bar, geenadate, TCMCpizza, duration, schrank_ok, S_open, liftopen, gee_terminal, RRDoor, solarpower, nRpos, mpos, chip, treppe, liftH, KiZidoor, kx, ky, kkos, madEnter, orgelH, stuhlH, mainH, sideH, mytempo, VentH, colorpower, kellergitter, room1term, room2term, room3term, water1, water2, water3, SHA_code, badschlange, mymovie, myFrame, mypuppets, myvisibility, mycastnr, colorsetting, hintlist, stadtmov, oldframe, eetermpwr, hymnpos, ckey, ShineID, H2mixavail, gCitysnd, gCity2snd, solution, bigmovie, selfdtimer, hloaded, Myclone, back, dampf, m_schrank, shi_schrank, sha_schrank, fin, dead
  5.   makeshineID()
  6.   set oldpal to the framePalette
  7.   set oldframe to the frame
  8.   set mymovie to string(the moviePath & the movieName)
  9.   set myFrame to the frame
  10.   savecondition()
  11.   go("Blackend")
  12.   go(1, shineHpath & "saver")
  13.   if objectp(me) then
  14.     me(mdispose)
  15.   end if
  16.   if the machineType = 256 then
  17.     set me to FileIO(mnew, "?write", "Mygame.TXT")
  18.   else
  19.     set me to FileIO(mnew, "?write", "Mygame")
  20.   end if
  21.   if objectp(me) then
  22.     set GList to list("stringref", "chunk", "t_speed", "access", "cityLoc", "prevLoc", "geenaTalk1", "cops", "TCMCsnake", "RamsMov", "symbols", "c_symbols", "schrank", "cLinks", "cRechts", "cStraight", "Finger", "cDown", "cHand", "c_cursor", "old_access", "shamen_visit", "s1vol", "s2vol", "Hymne1", "Hymne2", "locations", "Nat_deckel", "gee_bar", "geenadate", "TCMCpizza", "duration", "schrank_ok", "S_open", "liftopen", "gee_terminal", "RRdoor", "solarpower", "nRpos", "mpos", "chip", "treppe", "lifth", "kizidoor", "kx", "ky", "kkos", "madEnter", "orgelh", "stuhlh", "mainh", "sideh", "mytempo", "venth", "colorpower", "kellergitter", "room1term", "room2term", "room3term", "water1", "water2", "water3", "sha_code", "badschlange", "mymovie", "myframe", "mypuppets", "myvisibility", "mycastnr", "colorsetting", "hintlist", "stadtmov", "oldframe", "eetermpwr", "hymnpos", "ckey", "ShineID", "H2mixavail", "gCitysnd", "gCity2snd", "solution", "bigmovie", "selfdtimer", "hloaded", "Myclone", "back", "m_schrank", "shi_schrank", "sha_schrank", "fin", "dead")
  23.     me(mWriteString, "SHINEDATA" & RETURN)
  24.     set i to count(GList)
  25.     set stringref to []
  26.     repeat with x = 1 to i
  27.       setAt(stringref, x, 0)
  28.       set mval to value(getAt(GList, x))
  29.       if stringp(mval) then
  30.         setAt(stringref, x, 1)
  31.       end if
  32.     end repeat
  33.     repeat with x = 1 to i
  34.       setAt(stringref, x, 0)
  35.       set mval to value(getAt(GList, x))
  36.       if voidp(mval) then
  37.         set mval to -1
  38.       end if
  39.       encrypt(mval)
  40.       me(mWriteString, the result & RETURN)
  41.     end repeat
  42.     set GList to EMPTY
  43.     me(mdispose)
  44.   end if
  45.   go(myFrame, mymovie)
  46.   restorecondition()
  47.   flushlists()
  48. end
  49.  
  50. on savecondition
  51.   set mypuppets to []
  52.   set myvisibility to []
  53.   set mycastnr to []
  54.   repeat with x = 1 to 48
  55.     setAt(mypuppets, x, the puppet of sprite x)
  56.     setAt(myvisibility, x, the visible of sprite x)
  57.     setAt(mycastnr, x, the castNum of sprite x)
  58.   end repeat
  59. end
  60.  
  61. on flushlists
  62.   set mypuppets to EMPTY
  63.   set myvisibility to EMPTY
  64.   set mycastnr to EMPTY
  65. end
  66.  
  67. on restorecondition
  68.   repeat with x = 1 to 48
  69.     set the visible of sprite x to getAt(myvisibility, x)
  70.     set the puppet of sprite x to getAt(mypuppets, x)
  71.     set the castNum of sprite x to getAt(mycastnr, x)
  72.   end repeat
  73. end
  74.  
  75. on encrypt mval
  76.   set a to string(mval)
  77.   set b to EMPTY
  78.   repeat with x = 1 to the number of chars in a
  79.     set b to b & numToChar(charToNum(char x of a) + 7)
  80.   end repeat
  81.   return b
  82. end
  83.  
  84. on decrypt mval
  85.   set a to string(mval)
  86.   set b to EMPTY
  87.   repeat with x = 1 to the number of chars in a
  88.     set b to b & numToChar(charToNum(char x of a) - 7)
  89.   end repeat
  90.   return b
  91. end
  92.  
  93. on loadamovie
  94.   loader2()
  95. end
  96.  
  97. on loader2
  98.   global stringref, chunk, t_speed, access, cityLoc, prevLoc, geenaTalk1, cops, TCMCsnake, RamsMov, symbols, c_symbols, schrank, cLinks, cRechts, cStraight, Finger, cDown, cHand, c_cursor, old_access, shamen_visit, s1vol, s2vol, Hymne1, Hymne2, Locations, Nat_deckel, gee_bar, geenadate, TCMCpizza, duration, schrank_ok, S_open, liftopen, gee_terminal, RRDoor, solarpower, nRpos, mpos, chip, treppe, liftH, KiZidoor, kx, ky, kkos, madEnter, orgelH, stuhlH, mainH, sideH, mytempo, VentH, colorpower, kellergitter, room1term, room2term, room3term, water1, water2, water3, SHA_code, badschlange, mymovie, myFrame, mypuppets, myvisibility, mycastnr, colorsetting, hintlist, stadtmov, oldframe, eetermpwr, hymnpos, ckey, ShineID, H2mixavail, gCitysnd, gCity2snd, solution, bigmovie, selfdtimer, hloaded, Myclone, back, m_schrank, shi_schrank, sha_schrank, fin, dead, firststart
  99.   set oldframe to the frame
  100.   set mymovie to string(the moviePath & the movieName)
  101.   set myFrame to the frame
  102.   savecondition()
  103.   if callmovie = "player" then
  104.   else
  105.     go("Blackend")
  106.     go(1, shineHpath & "saver")
  107.   end if
  108.   if objectp(me) then
  109.     me(mdispose)
  110.   end if
  111.   if the machineType = 256 then
  112.     set me to FileIO(mnew, "?read", "TXT")
  113.   else
  114.     set me to FileIO(mnew, "?read", "TEXT")
  115.   end if
  116.   if objectp(me) then
  117.     set ver to me(mReadLine)
  118.     if ver = ("SHINEDATA" & RETURN) then
  119.       closebarobj()
  120.       clearGlobals()
  121.       loadsetup()
  122.       set GList to list("stringref", "chunk", "t_speed", "access", "cityLoc", "prevLoc", "geenaTalk1", "cops", "TCMCsnake", "RamsMov", "symbols", "c_symbols", "schrank", "cLinks", "cRechts", "cStraight", "Finger", "cDown", "cHand", "c_cursor", "old_access", "shamen_visit", "s1vol", "s2vol", "Hymne1", "Hymne2", "locations", "Nat_deckel", "gee_bar", "geenadate", "TCMCpizza", "duration", "schrank_ok", "S_open", "liftopen", "gee_terminal", "RRdoor", "solarpower", "nRpos", "mpos", "chip", "treppe", "lifth", "kizidoor", "kx", "ky", "kkos", "madEnter", "orgelh", "stuhlh", "mainh", "sideh", "mytempo", "venth", "colorpower", "kellergitter", "room1term", "room2term", "room3term", "water1", "water2", "water3", "sha_code", "badschlange", "mymovie", "myframe", "mypuppets", "myvisibility", "mycastnr", "colorsetting", "hintlist", "stadtmov", "oldframe", "eetermpwr", "hymnpos", "ckey", "ShineID", "H2mixavail", "gCitysnd", "gCity2snd", "solution", "bigmovie", "selfdtimer", "hloaded", "Myclone", "back", "m_schrank", "shi_schrank", "sha_schrank", "fin", "dead")
  123.       set i to count(GList)
  124.       decrypt(me(mReadToken, RETURN, RETURN))
  125.       set stringref to value(the result)
  126.       repeat with x = 2 to i
  127.         decrypt(me(mReadToken, RETURN, RETURN))
  128.         if getAt(stringref, x) = 0 then
  129.           if value(the result) > -1 then
  130.             do("set " & getAt(GList, x) & "=" & value(the result))
  131.           else
  132.           end if
  133.           next repeat
  134.         end if
  135.         do("set " & getAt(GList, x) & "=" & QUOTE & the result & QUOTE)
  136.       end repeat
  137.       set GList to []
  138.       me(mdispose)
  139.       puppetPalette(0)
  140.       restoreC_symbols()
  141.       updateStage()
  142.       pathfromID()
  143.       if ShineID = "Shine1" then
  144.         play frame "CDin1"
  145.       else
  146.         play frame "CDin2"
  147.       end if
  148.       checkcdloc()
  149.       makesearchpath(ShineID)
  150.       set GList to EMPTY
  151.       makebarobj()
  152.       puppetSound(0)
  153.       puppetSound(2, 0)
  154.       puppetSound(3, 0)
  155.       go(myFrame, mymovie)
  156.       restorecondition()
  157.       flushlists()
  158.     else
  159.       alert("No Shine Game!" & RETURN & "Please choose a saved Game.")
  160.       me(mdispose)
  161.       go(myFrame, mymovie)
  162.       restorecondition()
  163.     end if
  164.     set firststart to 1
  165.   else
  166.     if callmovie = "player" then
  167.       play done
  168.     else
  169.       go(myFrame, mymovie)
  170.       restorecondition()
  171.       flushlists()
  172.     end if
  173.   end if
  174. end
  175.  
  176. on checkcdloc
  177.   getCDrom(CDloc & "check" & sep)
  178.   set my to the result
  179.   if ShineID = "Shine1" then
  180.     if my <> 1 then
  181.       play frame "sureCD1"
  182.     end if
  183.   else
  184.     if my <> 2 then
  185.       play frame "sureCD2"
  186.     end if
  187.   end if
  188. end
  189.  
  190. on restoreC_symbols
  191.   repeat with x = 1 to 4
  192.     set c to getAt(c_symbols, x)
  193.     if c = Hymne1 then
  194.       setAt(c_symbols, x, Hymne1)
  195.       next repeat
  196.     end if
  197.     if c = Hymne2 then
  198.       setAt(c_symbols, x, Hymne2)
  199.       next repeat
  200.     end if
  201.     if c = Finger then
  202.       setAt(c_symbols, x, Finger)
  203.       next repeat
  204.     end if
  205.     if c = ckey then
  206.       setAt(c_symbols, x, ckey)
  207.     end if
  208.   end repeat
  209. end
  210.  
  211. on getCDnew
  212.   repeat with x = 65 to 90
  213.     set b to numToChar(x) & ":" & sep & "check" & sep
  214.     getCDrom(b)
  215.     set my to the result
  216.     if (my = 1) or (my = 2) then
  217.       set CDloc to numToChar(x) & ":" & sep
  218.       exit
  219.     end if
  220.   end repeat
  221.   if (x = 90) and ((my < 1) or (my > 2)) then
  222.     alert("CD-ROM not found!")
  223.     quit()
  224.   end if
  225. end
  226.  
  227. on loadsetup
  228.   global colorsetting, CDloc, chunk, mac, sep, shineHpath
  229.   set setfile to FileIO(mnew, "read", the moviePath & "SHINE.dat")
  230.   if objectp(setfile) then
  231.     set colorsetting to setfile(mReadWord)
  232.     setfile(mReadLine)
  233.     set CDloc to setfile(mReadToken, RETURN, RETURN)
  234.     setfile(mReadLine)
  235.     set chunk to value(setfile(mReadWord))
  236.     setfile(mReadLine)
  237.     set mac to value(setfile(mReadWord))
  238.     setfile(mReadLine)
  239.     set sep to setfile(mReadWord)
  240.     setfile(mReadLine)
  241.     set shineHpath to setfile(mReadToken, RETURN, RETURN)
  242.     setfile(mReadLine)
  243.     setfile(mdispose)
  244.   else
  245.     if (the movieName = "Shine") or (the movieName = "SHINE.EXE") then
  246.       alert("File not found! The file " & QUOTE & "SHINE.dat" & QUOTE & " must reside inside the " & QUOTE & "SHINE" & QUOTE & "-folder." & RETURN & "If you started the game from your Hard Disk, please run the Installer again, if you tried to start the Game from CD-ROM, please start it from the folder on your Hard Disk.")
  247.       quit()
  248.     end if
  249.   end if
  250. end
  251.  
  252. on pathfromID
  253.   if mac then
  254.     if ShineID = "Shine1" then
  255.       set CDloc to "Shine 1:"
  256.     else
  257.       if ShineID = "Shine2" then
  258.         set CDloc to "Shine 2:"
  259.       end if
  260.     end if
  261.     savesetup()
  262.   end if
  263. end
  264.  
  265. on savesetup
  266.   set savelist to colorsetting & RETURN & CDloc & RETURN & chunk & RETURN & mac & RETURN & sep & RETURN & shineHpath & RETURN
  267.   set setfile to FileIO(mnew, "write", shineHpath & "SHINE.dat")
  268.   if objectp(setfile) then
  269.     setfile(mWriteString, savelist)
  270.     setfile(mdispose)
  271.   end if
  272. end
  273.  
  274. on getCDrom thepath
  275.   set x to getNthFileNameInFolder(thepath, 1)
  276.   if x = "A1XXX" then
  277.     return 1
  278.   else
  279.     if x = "A2XXX" then
  280.       return 2
  281.     else
  282.       if x <> EMPTY then
  283.         return 3
  284.       else
  285.         return 0
  286.       end if
  287.     end if
  288.   end if
  289. end
  290.  
  291. on makeshineID
  292.   getmainpath()
  293.   set checkpath to the result & "check" & sep
  294.   getCDrom(checkpath)
  295.   set my to the result
  296.   if my = 1 then
  297.     set ShineID to "Shine1"
  298.   else
  299.     if my = 2 then
  300.       set ShineID to "Shine2"
  301.     end if
  302.   end if
  303. end
  304.  
  305. on getmainpath
  306.   set olddel to the itemDelimiter
  307.   set the itemDelimiter to sep
  308.   set x to item 1 of the moviePath & the itemDelimiter
  309.   set the itemDelimiter to olddel
  310.   return x
  311. end
  312.  
  313. on getcd cdname
  314.   global ld
  315.   openXLib("labeldrv")
  316.   set ld to labeldrv(mnew)
  317.   ld(msetrange, "A", "Z")
  318.   set drive to ld(mgetdrive, cdname)
  319.   closeXLib("labeldrv")
  320.   ld(mdispose)
  321.   return drive
  322. end
  323.  
  324. on makecdobj
  325.   global cdobj
  326.   if the commandDown then
  327.   else
  328.     if mac then
  329.       openXLib(the moviePath & "applecd xobj")
  330.       if objectp(cdobj) then
  331.         cdobj(mdispose)
  332.       else
  333.         set cdobj to applecd(mnew)
  334.         cdobj(mEject)
  335.         cdobj(mdispose)
  336.       end if
  337.       closeXLib(the moviePath & "applecd xobj")
  338.     end if
  339.   end if
  340. end
  341.  
  342. on getmoviename
  343.   set olditemdel to the itemDelimiter
  344.   set the itemDelimiter to "."
  345.   set me to item 1 of the movieName
  346.   set the itemDelimiter to olditemdel
  347.   return me
  348. end
  349.