home *** CD-ROM | disk | FTP | other *** search
/ Diccionario Visual Trilingue / VISUAL.iso / SHARED.DIR / 10065_Animations.ls < prev    next >
Encoding:
Text File  |  1997-07-04  |  11.7 KB  |  381 lines

  1. global gMoviePal, gActualRate, gAnimsButtons, gRunningMovie, gLstAnimPals, gLstAnimHS, gPictLocV, gCurrAnimation, gGoldenRate, gCurrentScreen
  2.  
  3. on ResetAnimHS
  4.   set gMovieAction to #None
  5.   set gMoviePal to #PlayMoins
  6.   set the castNum of sprite 35 to 10985
  7.   set gAnimsButtons to []
  8.   set gActualRate to gGoldenRate
  9.   updateStage()
  10. end
  11.  
  12. on FlushAllAnimationsData
  13.   set QtyAnimPals to count(gLstAnimPals)
  14.   if QtyAnimPals = 1 then
  15.     MovieStop(getAt(gRunningMovie, 2))
  16.     HideFirstPalette()
  17.   else
  18.     if QtyAnimPals = 2 then
  19.       MovieStop(getAt(gRunningMovie, 2))
  20.       HideSecondPalette()
  21.       HideFirstPalette()
  22.     end if
  23.   end if
  24.   set gMoviePal to #PlayMoins
  25.   updateStage()
  26. end
  27.  
  28. on PlayRalenti AnimHS, Direction
  29.   if getAt(gRunningMovie, 1) = #stop then
  30.     modifySpecialItemCursors(1)
  31.     watchCursor()
  32.   end if
  33.   if getAt(gRunningMovie, 3) = #end then
  34.     if Direction = #FORWARD then
  35.       set Direction to #BACKWARD
  36.     else
  37.       set Direction to #FORWARD
  38.     end if
  39.   end if
  40.   set ActualHS to getAt(gLstAnimHS, AnimHS)
  41.   set HsPos to getAt(ActualHS, 1)
  42.   set MoviePos to getAt(ActualHS, 2)
  43.   set CastNo to getAt(ActualHS, 3)
  44.   set QtSpriteNo to getAt(getAt(ActualHS, 4), 2)
  45.   set PictSpriteNo to getAt(getAt(ActualHS, 4), 1)
  46.   if gActualRate = gGoldenRate then
  47.     set gMovieMode to #play
  48.   else
  49.     set gMovieMode to #SLOW
  50.   end if
  51.   if gMovieMode = #SLOW then
  52.     set gMovieMode to #play
  53.     set gActualRate to gGoldenRate
  54.   else
  55.     set gMovieMode to #SLOW
  56.     set gActualRate to gGoldenRate / 2
  57.   end if
  58.   if Direction = #BACKWARD then
  59.     set NewRate to -gActualRate
  60.   else
  61.     set NewRate to gActualRate
  62.   end if
  63.   set the movieRate of sprite QtSpriteNo to NewRate
  64.   repeat while (the movieTime of sprite QtSpriteNo = the duration of cast CastNo) and (getAt(gRunningMovie, 1) = #stop)
  65.     nothing()
  66.   end repeat
  67.   modifySpecialItemCursors(0)
  68.   cursor(0)
  69.   set gRunningMovie to [gMovieMode, AnimHS, getAt(gRunningMovie, 3)]
  70. end
  71.  
  72. on PlayOneStep AnimHS, Direction
  73.   set ActualHS to getAt(gLstAnimHS, AnimHS)
  74.   set QtSpriteNo to getAt(getAt(ActualHS, 4), 2)
  75.   set PictSpriteNo to getAt(getAt(ActualHS, 4), 1)
  76.   set type to getAt(getAt(gLstAnimHS, AnimHS), 5)
  77.   set ActualTime to the movieTime of sprite QtSpriteNo
  78.   set MovieDuration to the duration of cast getAt(getAt(gLstAnimHS, getAt(gRunningMovie, 2)), 3)
  79.   set the movieRate of sprite QtSpriteNo to 0
  80.   if Direction = #FORWARD then
  81.     if ActualTime < (MovieDuration - 59) then
  82.       set the movieTime of sprite QtSpriteNo to ActualTime + 60
  83.     else
  84.       if type = #loop then
  85.         set the movieTime of sprite QtSpriteNo to 0
  86.       else
  87.         set the movieTime of sprite QtSpriteNo to MovieDuration
  88.         updateStage()
  89.       end if
  90.     end if
  91.   else
  92.     if Direction = #BACKWARD then
  93.       if (ActualTime - 59) > 0 then
  94.         set the movieTime of sprite QtSpriteNo to ActualTime - 60
  95.       else
  96.         if type = #loop then
  97.           set the movieTime of sprite QtSpriteNo to MovieDuration
  98.         else
  99.           if getAt(gRunningMovie, 3) = #end then
  100.             set the movieTime of sprite QtSpriteNo to 0
  101.             updateStage()
  102.           else
  103.             set the movieTime of sprite QtSpriteNo to 0
  104.             updateStage()
  105.           end if
  106.         end if
  107.       end if
  108.     else
  109.       alert("Un mauvais param├¿tre a ├⌐t├⌐ pass├⌐ ├á la fonction PlayOneStep:" && Direction)
  110.     end if
  111.   end if
  112. end
  113.  
  114. on PlayMovie HsNo, Direction
  115.   if getAt(gRunningMovie, 1) = #stop then
  116.     modifySpecialItemCursors(1)
  117.     watchCursor()
  118.   end if
  119.   if getAt(gRunningMovie, 3) = #end then
  120.     if Direction = #FORWARD then
  121.       set Direction to #BACKWARD
  122.     else
  123.       set Direction to #FORWARD
  124.     end if
  125.   end if
  126.   set ActualHS to getAt(gLstAnimHS, HsNo)
  127.   set QtSpriteNo to getAt(getAt(ActualHS, 4), 2)
  128.   set PictSpriteNo to getAt(getAt(ActualHS, 4), 1)
  129.   set HsPos to getAt(ActualHS, 1)
  130.   set MoviePos to getAt(ActualHS, 2)
  131.   set CastNo to getAt(ActualHS, 3)
  132.   set MovieMode to getAt(gRunningMovie, 1)
  133.   set NewRate to gActualRate
  134.   if (getAt(gRunningMovie, 1) = #stop) and (getAt(gRunningMovie, 3) = #end) then
  135.     set the movieTime of sprite QtSpriteNo to the duration of cast CastNo
  136.   end if
  137.   if Direction = #BACKWARD then
  138.     set NewRate to -NewRate
  139.   end if
  140.   if (MovieMode = #play) or (MovieMode = #SLOW) or (MovieMode = #SLOWSTEP) then
  141.     set gMovieMode to #pause
  142.     SetgRunningMovie(#pause, HsNo, getAt(gRunningMovie, 3))
  143.     set the movieRate of sprite QtSpriteNo to 0
  144.   else
  145.     SetgRunningMovie(#play, HsNo, getAt(gRunningMovie, 3))
  146.     set the movieRate of sprite QtSpriteNo to NewRate
  147.   end if
  148.   repeat while (the movieTime of sprite QtSpriteNo = the duration of cast CastNo) and (getAt(gRunningMovie, 1) = #stop)
  149.     nothing()
  150.   end repeat
  151.   modifySpecialItemCursors(0)
  152.   cursor(0)
  153. end
  154.  
  155. on MovieStop HsNo
  156.   if getAt(gRunningMovie, 1) = #stop then
  157.     return 
  158.   end if
  159.   set ActualHS to getAt(gLstAnimHS, HsNo)
  160.   set HsPos to getAt(ActualHS, 1)
  161.   set MoviePos to getAt(ActualHS, 2)
  162.   set CastNo to getAt(ActualHS, 3)
  163.   set QtSpriteNo to getAt(getAt(ActualHS, 4), 2)
  164.   set PictSpriteNo to getAt(getAt(ActualHS, 4), 1)
  165.   set type to getAt(ActualHS, 5)
  166.   set gMovieMode to #stop
  167.   set the movieTime of sprite QtSpriteNo to 0
  168.   set the movieRate of sprite QtSpriteNo to 0
  169.   set the movieTime of sprite QtSpriteNo to 0
  170.   if type = #TOGGLE then
  171.     if getAt(gRunningMovie, 3) = #end then
  172.       set the movieTime of sprite QtSpriteNo to the duration of cast CastNo
  173.     else
  174.       set the movieTime of sprite QtSpriteNo to 0
  175.     end if
  176.   else
  177.     set the movieTime of sprite QtSpriteNo to 0
  178.   end if
  179.   set gMoviePal to #PlayMoins
  180.   SetGoodAnimPal(#stop)
  181.   set gActualRate to gGoldenRate
  182.   SetgRunningMovie(#stop, HsNo, getAt(gRunningMovie, 3))
  183. end
  184.  
  185. on DoTransitionStart AnimNo, action
  186.   set ActualHS to getAt(gLstAnimHS, AnimNo)
  187.   set QtSpriteNo to getAt(getAt(ActualHS, 4), 2)
  188.   set PictSpriteNo to getAt(getAt(ActualHS, 4), 1)
  189.   set CastNo to getAt(ActualHS, 3)
  190.   set type to getAt(ActualHS, 5)
  191.   set LocHLocV to getAt(ActualHS, 7)
  192.   set gPictLocV to the locV of sprite PictSpriteNo
  193.   set gCurrAnimation to the castNum of sprite PictSpriteNo
  194.   PrepAnimLabels()
  195.   set the locH of sprite QtSpriteNo to getAt(LocHLocV, 1)
  196.   set the locV of sprite QtSpriteNo to getAt(LocHLocV, 2)
  197.   addRAMobjects(#CastList, [CastNo])
  198.   set the castNum of sprite QtSpriteNo to CastNo
  199.   if (type = #loop) or (type = #OneShotStart) or (type = #button) then
  200.     if action = #STEPBACK then
  201.       set the visible of sprite QtSpriteNo to 0
  202.       updateStage()
  203.       set the movieTime of sprite QtSpriteNo to the duration of cast getAt(ActualHS, 3) - 60
  204.       set the visible of sprite QtSpriteNo to 1
  205.     else
  206.       updateStage()
  207.       set the movieTime of sprite QtSpriteNo to 0
  208.     end if
  209.     updateStage()
  210.     if type = #button then
  211.       Wait2()
  212.     end if
  213.   else
  214.     if type = #OneShotEnd then
  215.       if action = #STEPBACK then
  216.         set the visible of sprite QtSpriteNo to 0
  217.         updateStage()
  218.         set the movieTime of sprite QtSpriteNo to the duration of cast getAt(ActualHS, 3) - 60
  219.         set the visible of sprite QtSpriteNo to 1
  220.         updateStage()
  221.       else
  222.         updateStage()
  223.         set the movieTime of sprite QtSpriteNo to 0
  224.       end if
  225.     else
  226.       if type = #TOGGLE then
  227.         updateStage()
  228.         if getAt(gRunningMovie, 3) = #start then
  229.           set the movieTime of sprite QtSpriteNo to 0
  230.         else
  231.           set the movieTime of sprite QtSpriteNo to the duration of cast CastNo
  232.         end if
  233.       else
  234.         alert("Type invalide d'animation dans DoTransitionStart:" && type)
  235.       end if
  236.     end if
  237.   end if
  238. end
  239.  
  240. on DoTransitionStop AnimNo
  241.   set ActualHS to getAt(gLstAnimHS, AnimNo)
  242.   set QtSpriteNo to getAt(getAt(ActualHS, 4), 2)
  243.   set PictSpriteNo to getAt(getAt(ActualHS, 4), 1)
  244.   set CastNo to getAt(ActualHS, 3)
  245.   addRAMobjects(#CastList, [CastNo])
  246.   set the castNum of sprite QtSpriteNo to CastNo
  247.   set type to getAt(ActualHS, 5)
  248.   if (type = #loop) or (type = #OneShotStart) or (type = #button) then
  249.     set PictCastNo to getAt(getAt(ActualHS, 6), 1)
  250.     if type = #button then
  251.       Wait2()
  252.     end if
  253.     flushQuickTime(QtSpriteNo)
  254.     set the locV of sprite PictSpriteNo to gPictLocV
  255.     updateStage()
  256.     set the rect of sprite 45 to the rect of sprite QtSpriteNo
  257.     set the movieTime of sprite QtSpriteNo to 0
  258.     updateStage()
  259.     DrawAll(1)
  260.     setAnimLabels()
  261.   else
  262.     if type = #OneShotEnd then
  263.       flushQuickTime(QtSpriteNo)
  264.       setAnimLabels()
  265.     else
  266.       if type = #TOGGLE then
  267.         set Mode to getAt(gRunningMovie, 3)
  268.         if Mode = #start then
  269.           set CoupeNo to 1
  270.         else
  271.           if Mode = #end then
  272.             set CoupeNo to 2
  273.           else
  274.             alert("├ëtat invalide d'animation dans DoTransitionStop:" && Mode)
  275.           end if
  276.         end if
  277.         addRAMobjects(#CastList, [gCurrentScreen])
  278.         set tempPictData to getAt(value(line ((CoupeNo - 1) * 15) + 2 of field gCurrentScreen), 1)
  279.         set TempNum to getAt(tempPictData, 1)
  280.         addRAMobjects(#CastList, [TempNum])
  281.         set the castNum of sprite PictSpriteNo to TempNum
  282.         set the locH of sprite PictSpriteNo to getAt(tempPictData, 2)
  283.         set the locV of sprite PictSpriteNo to getAt(tempPictData, 3)
  284.         flushQuickTime(QtSpriteNo)
  285.         createCutHotSpots(CoupeNo, PictSpriteNo)
  286.       else
  287.         alert("Type invalide d'animation dans DoTransitionStop:" && type)
  288.       end if
  289.     end if
  290.   end if
  291. end
  292.  
  293. on flushQuickTime QtSpriteNo
  294.   set rectTemp to the rect of sprite QtSpriteNo
  295.   set the locV of sprite QtSpriteNo to 1000
  296.   set the rect of sprite 45 to rectTemp
  297.   updateStage()
  298.   set the locV of sprite 45 to 1000
  299.   updateStage()
  300. end
  301.  
  302. on ActivateSlowStep AnimHS, Direction
  303.   if getAt(gRunningMovie, 3) = #end then
  304.     if Direction = #FORWARD then
  305.       set Direction to #BACKWARD
  306.     else
  307.       set Direction to #FORWARD
  308.     end if
  309.   end if
  310.   set type to getAt(getAt(gLstAnimHS, AnimHS), 5)
  311.   set gMovieMode to getAt(gRunningMovie, 1)
  312.   if gMovieMode <> #SLOWSTEP then
  313.     if ValidateActivateSlowStep(AnimHS, Direction) then
  314.       StepMovieMouseDown(AnimHS, Direction)
  315.       setAt(gRunningMovie, 1, #SLOWSTEP)
  316.       SetGoodAnimPal(#SLOWSTEP)
  317.       if (gMoviePal = #PlayPlus) or (gMoviePal = #PausePlus) then
  318.         set gMoviePal to #PlayPlus
  319.         set the castNum of sprite 35 to 10986
  320.       else
  321.         set gMoviePal to #PlayMoins
  322.         set the castNum of sprite 35 to 10985
  323.       end if
  324.       updateStage()
  325.       return 
  326.     end if
  327.   end if
  328. end
  329.  
  330. on ValidateActivateSlowStep AnimHS, Direction
  331.   set ActualHS to getAt(gLstAnimHS, AnimHS)
  332.   set type to getAt(ActualHS, 5)
  333.   if type = #loop then
  334.     return 1
  335.   end if
  336.   set MovieDuration to the duration of cast getAt(ActualHS, 3)
  337.   set ActualTime to the movieTime of sprite getAt(getAt(ActualHS, 4), 2)
  338.   if type = #TOGGLE then
  339.     if (Direction = #FORWARD) and (MovieDuration > ActualTime) then
  340.       return 1
  341.     else
  342.       if (Direction = #BACKWARD) and (ActualTime > 0) then
  343.         return 1
  344.       end if
  345.     end if
  346.   end if
  347.   if (type = #OneShotEnd) or (type = #OneShotStart) then
  348.     if (Direction = #BACKWARD) and (ActualTime > 0) then
  349.       return 1
  350.     else
  351.       if (Direction = #FORWARD) and (ActualTime < MovieDuration) then
  352.         return 1
  353.       end if
  354.     end if
  355.   end if
  356.   return 0
  357. end
  358.  
  359. on stepMovie AnimHS, Direction
  360.   set ActualHS to getAt(gLstAnimHS, AnimHS)
  361.   set QtSpriteNo to getAt(getAt(ActualHS, 4), 2)
  362.   set PictSpriteNo to getAt(getAt(ActualHS, 4), 1)
  363.   set CastNo to getAt(ActualHS, 3)
  364.   set MovieMode to getAt(gRunningMovie, 1)
  365.   if getAt(gRunningMovie, 3) = #end then
  366.     if Direction = #FORWARD then
  367.       set Direction to #BACKWARD
  368.     else
  369.       set Direction to #FORWARD
  370.     end if
  371.   end if
  372.   set HsPos to getAt(ActualHS, 1)
  373.   set MoviePos to getAt(ActualHS, 2)
  374.   set CastNo to getAt(ActualHS, 3)
  375.   if MovieMode <> #step then
  376.     set the movieRate of sprite QtSpriteNo to 0
  377.     SetgRunningMovie(#step, AnimHS, getAt(gRunningMovie, 3))
  378.   end if
  379.   PlayOneStep(AnimHS, Direction)
  380. end
  381.