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

  1. global gRunningMovie, gLstAnimPals, gLstAnimHS, gMoviePal, gShowAll, gCurrAnimation, gRedTagData, gPictureOnly, glstlabels, gCurrentLabel, gLstLabelButtonHS, gLstRectHS, gActiveHS, gPalSwapped, gAnimsButtons, gActualRate, gPictLocV, gGoldenRate, gCurrentScreen, gCurrentCut
  2.  
  3. on AnimationEnterFrame i
  4.   set AnimActionID to getAt(getAt(gLstRectHS, i), 3)
  5.   if getAt(gRunningMovie, 1) <> #stop then
  6.     if getAt(getAt(gLstAnimHS, getAt(gRunningMovie, 2)), 5) = #button then
  7.       return 
  8.     end if
  9.   end if
  10.   if count(gLstAnimPals) = 0 then
  11.     ProcessOnePalAnim(AnimActionID)
  12.   else
  13.     if getAt(gLstAnimPals, 1) = i then
  14.       if count(gLstAnimPals) = 2 then
  15.         HideSecondPalette()
  16.       end if
  17.       ProcessOnePalAnim(AnimActionID)
  18.     else
  19.       if getAt(gRunningMovie, 1) = #stop then
  20.         HideFirstPalette()
  21.         ShowFirstPalette(AnimActionID)
  22.         ProcessOnePalAnim(AnimActionID)
  23.       else
  24.         ProcessTwoPalAnim(AnimActionID)
  25.       end if
  26.     end if
  27.   end if
  28.   set gActiveHS to []
  29.   add(gActiveHS, getAt(getAt(gLstRectHS, i), 2))
  30.   add(gActiveHS, getAt(getAt(gLstRectHS, i), 3))
  31. end
  32.  
  33. on PrepAnimLabels
  34.   if gPictureOnly then
  35.     return 
  36.   end if
  37.   if gShowAll then
  38.     repeat with i = 1 to count(glstlabels)
  39.       if getAt(getAt(glstlabels, i), 5) = gCurrAnimation then
  40.         set TempData to getAt(glstlabels, i)
  41.         set LabelData to getAt(TempData, 3)
  42.         set Language to getAt(TempData, 4)
  43.         if count(LabelData) > 0 then
  44.           set castNum to getAt(getProp(glstlabels, getAt(LabelData, 1)), 1) + ((Language - 1) * 100)
  45.           set PosX to getAt(LabelData, 2)
  46.           set PosY to getAt(LabelData, 3)
  47.           set Point1 to getAt(LabelData, 9)
  48.           set Justification to getAt(LabelData, 4)
  49.           if Justification = 0 then
  50.             set P1 to point(PosX - (the width of cast castNum / 2), PosY)
  51.             set P2 to point(PosX + (the width of cast castNum / 2), PosY - the height of cast castNum)
  52.           else
  53.             if Justification = 1 then
  54.               set P1 to point(PosX - the width of cast castNum, PosY)
  55.               set P2 to point(PosX + 15, PosY - the height of cast castNum)
  56.               set Point4 to point(getAt(Point1, 1) - the width of cast castNum, getAt(Point1, 2))
  57.             else
  58.               if Justification = 2 then
  59.                 set P1 to point(PosX + the width of cast castNum, PosY)
  60.                 set P2 to point(PosX - 15, PosY - the height of cast castNum)
  61.                 set Point4 to point(getAt(Point1, 1) + the width of cast castNum, getAt(Point1, 2))
  62.               end if
  63.             end if
  64.           end if
  65.           set the rect of sprite 45 to rect(P1, P2)
  66.           updateStage()
  67.           set the rect of sprite 45 to rect(getAt(LabelData, 10), getAt(LabelData, 11)) + rect(0, 0, 1, 1)
  68.           updateStage()
  69.           set the locH of sprite 45 to -1000
  70.           updateStage()
  71.           set the rect of sprite 45 to rect(getAt(LabelData, 10), Point4) + rect(0, 0, 1, 1)
  72.           updateStage()
  73.           set the locH of sprite 45 to -1000
  74.         end if
  75.       end if
  76.     end repeat
  77.   else
  78.     if gCurrentLabel <> [] then
  79.       if getAt(gCurrentLabel, 6) = #REDTAG then
  80.         if getAt(getAt(gRedTagData, getAt(gCurrentLabel, 7)), 6) = gCurrAnimation then
  81.           drawOneFilet(gCurrentLabel, 0)
  82.           set the castNum of sprite 40 to 10001
  83.           set the castNum of sprite 39 to 10001
  84.           set gCurrentLabel to []
  85.           setAt(gLstLabelButtonHS, 3, [])
  86.         end if
  87.       end if
  88.     end if
  89.   end if
  90.   updateStage()
  91. end
  92.  
  93. on setAnimLabels
  94.   if gShowAll then
  95.     set gCurrAnimation to -1
  96.     ShowAll()
  97.   else
  98.     repeat with i = 1 to count(gRedTagData)
  99.       set TempData to getAt(gRedTagData, i)
  100.       if getAt(TempData, 6) = gCurrAnimation then
  101.         DrawRedTag(TempData)
  102.       end if
  103.     end repeat
  104.     set gCurrAnimation to -1
  105.   end if
  106. end
  107.  
  108. on CheckAnimPalettes
  109.   if count(gLstAnimPals) <> 0 then
  110.     if rollOver(35) and not gPalSwapped then
  111.       if count(gLstAnimPals) = 2 then
  112.         HideSecondPalette()
  113.       end if
  114.       ProcessOnePalAnim(getAt(gLstAnimPals, 1))
  115.       return 0
  116.     else
  117.       if rollOver(36) and not gPalSwapped then
  118.         if getAt(gRunningMovie, 1) = #stop then
  119.           MakeSecondPalFirst()
  120.           ProcessOnePalAnim(getAt(gLstAnimPals, 1))
  121.         else
  122.           ProcessTwoPalAnim(getAt(gLstAnimPals, 2))
  123.         end if
  124.         return 0
  125.       else
  126.         if count(gLstAnimPals) = 2 then
  127.           if getAt(gRunningMovie, 1) = #stop then
  128.             MakeSecondPalFirst()
  129.           else
  130.             HideSecondPalette()
  131.           end if
  132.           return 0
  133.         else
  134.           if count(gLstAnimPals) = 1 then
  135.             if getAt(gRunningMovie, 1) = #stop then
  136.               MovieStop(getAt(gRunningMovie, 2))
  137.               HideFirstPalette()
  138.               return 0
  139.             end if
  140.           end if
  141.         end if
  142.       end if
  143.     end if
  144.   end if
  145.   return 1
  146. end
  147.  
  148. on TurnButtonOn button, palette
  149.   if palette = 1 then
  150.     set the locH of sprite 37 to SpriteLeft(35) + 2 + (18 * (button - 1)) + (17 / 2.0)
  151.     set the locV of sprite 37 to SpriteTop(35) + 1 + (17 / 2.0)
  152.   else
  153.     if palette = 2 then
  154.       set the locH of sprite 37 to SpriteLeft(36) + 2 + (18 * (button - 1)) + (17 / 2.0)
  155.       set the locV of sprite 37 to SpriteTop(36) + 1 + (17 / 2.0)
  156.     else
  157.       alert("Mauvaise palette pass├⌐e en param├¿tre..." & palette)
  158.     end if
  159.   end if
  160.   if button = 1 then
  161.     set the castNum of sprite 37 to 10976
  162.   else
  163.     if button = 2 then
  164.       if palette = 1 then
  165.         if (gMoviePal = #PausePlus) or (gMoviePal = #PauseMoins) then
  166.           set the castNum of sprite 37 to 10978
  167.         else
  168.           set the castNum of sprite 37 to 10977
  169.         end if
  170.       else
  171.         set the castNum of sprite 37 to 10977
  172.       end if
  173.     else
  174.       if button = 3 then
  175.         set the castNum of sprite 37 to 10979
  176.       else
  177.         if button = 4 then
  178.           set the castNum of sprite 37 to 10980
  179.         else
  180.           if button = 5 then
  181.             if palette = 1 then
  182.               if (gMoviePal = #PlayMoins) or (gMoviePal = #PauseMoins) then
  183.                 set the castNum of sprite 37 to 10982
  184.               else
  185.                 set the castNum of sprite 37 to 10981
  186.               end if
  187.             else
  188.               set the castNum of sprite 37 to 10982
  189.             end if
  190.           else
  191.             if button = 0 then
  192.               set the castNum of sprite 37 to 10001
  193.             else
  194.               alert("Aucune palette n'est s├⌐lectionn├⌐... Il manque une initialisation.")
  195.             end if
  196.           end if
  197.         end if
  198.       end if
  199.     end if
  200.   end if
  201.   set the ink of sprite 37 to 8
  202.   updateStage()
  203. end
  204.  
  205. on SetgRunningMovie Mode, PosLst, State
  206.   set gRunningMovie to []
  207.   add(gRunningMovie, Mode)
  208.   add(gRunningMovie, PosLst)
  209.   add(gRunningMovie, State)
  210.   if Mode = #stop then
  211.     set gCurrAnimation to -1
  212.   else
  213.     set ActualHS to getAt(gLstAnimHS, PosLst)
  214.     set gCurrAnimation to getAt(getAt(ActualHS, 6), 1)
  215.   end if
  216. end
  217.  
  218. on GetButtonNumber
  219.   set Position to 0
  220.   if count(gAnimsButtons) = 0 then
  221.     return Position
  222.   end if
  223.   repeat with i = 1 to 5
  224.     set Depart to point(the mouseH, the mouseV)
  225.     set Arrivee to getAt(gAnimsButtons, i)
  226.     if sqrt(power(getAt(Depart, 1) - getAt(Arrivee, 1), 2) + power(getAt(Depart, 2) - getAt(Arrivee, 2), 2)) < 7 then
  227.       set Position to i
  228.       exit repeat
  229.     end if
  230.   end repeat
  231.   return Position
  232. end
  233.  
  234. on GetAction button
  235.   if button = 1 then
  236.     return #stop
  237.   else
  238.     if button = 2 then
  239.       return #play
  240.     else
  241.       if ((button = 3) and (gCurrentCut = 1)) or ((button = 4) and (gCurrentCut = 2)) then
  242.         return #STEPBACK
  243.       else
  244.         if ((button = 4) and (gCurrentCut = 1)) or ((button = 3) and (gCurrentCut = 2)) then
  245.           return #STEPFORWARD
  246.         else
  247.           if button = 5 then
  248.             return #SPEED
  249.           else
  250.             if button = 0 then
  251.               return #None
  252.             else
  253.               alert("Bouton invalide..." & button)
  254.             end if
  255.           end if
  256.         end if
  257.       end if
  258.     end if
  259.   end if
  260. end
  261.  
  262. on Wait2
  263.   startTimer()
  264.   repeat while the timer < 60
  265.     nothing()
  266.   end repeat
  267. end
  268.  
  269. on StepMovieMouseDown AnimHS, Direction
  270.   set ActualHS to getAt(gLstAnimHS, AnimHS)
  271.   set HsPos to getAt(ActualHS, 1)
  272.   set MoviePos to getAt(ActualHS, 2)
  273.   set CastNo to getAt(ActualHS, 3)
  274.   set QtSpriteNo to getAt(getAt(ActualHS, 4), 2)
  275.   set PictSpriteNo to getAt(getAt(ActualHS, 4), 1)
  276.   set type to getAt(ActualHS, 5)
  277.   if type = #TOGGLE then
  278.     if getAt(gRunningMovie, 3) = #end then
  279.       if the movieTime of sprite QtSpriteNo = the duration of cast CastNo then
  280.         if Direction = #BACKWARD then
  281.           set the movieRate of sprite QtSpriteNo to -(gGoldenRate * 2)
  282.         else
  283.           set the movieRate of sprite QtSpriteNo to 0
  284.         end if
  285.       else
  286.         if the movieTime of sprite QtSpriteNo = 0 then
  287.           if Direction = #FORWARD then
  288.             set the movieRate of sprite QtSpriteNo to gGoldenRate * 2
  289.           end if
  290.         else
  291.           if Direction = #FORWARD then
  292.             set the movieRate of sprite QtSpriteNo to gGoldenRate * 2
  293.           else
  294.             set the movieRate of sprite QtSpriteNo to -(gGoldenRate * 2)
  295.           end if
  296.         end if
  297.       end if
  298.     else
  299.       if the movieTime of sprite QtSpriteNo = the duration of cast CastNo then
  300.         if Direction = #BACKWARD then
  301.           set the movieRate of sprite QtSpriteNo to -(gGoldenRate * 2)
  302.         else
  303.           set the movieRate of sprite QtSpriteNo to 0
  304.         end if
  305.       else
  306.         if the movieTime of sprite QtSpriteNo = 0 then
  307.           if Direction = #FORWARD then
  308.             set the movieRate of sprite QtSpriteNo to gGoldenRate * 2
  309.           else
  310.             set the movieRate of sprite QtSpriteNo to 0
  311.           end if
  312.         else
  313.           if Direction = #FORWARD then
  314.             set the movieRate of sprite QtSpriteNo to gGoldenRate * 2
  315.           else
  316.             set the movieRate of sprite QtSpriteNo to -(gGoldenRate * 2)
  317.           end if
  318.         end if
  319.       end if
  320.     end if
  321.   else
  322.     if Direction = #FORWARD then
  323.       set the movieRate of sprite QtSpriteNo to gGoldenRate * 2
  324.     else
  325.       set the movieRate of sprite QtSpriteNo to -(gGoldenRate * 2)
  326.     end if
  327.   end if
  328.   SetgRunningMovie(#step, AnimHS, getAt(gRunningMovie, 3))
  329.   set gMovieMode to #SLOWSTEP
  330. end
  331.  
  332. on CheckAnimStatus
  333.   if getAt(gRunningMovie, 1) = #stop then
  334.     return 
  335.   end if
  336.   set MovieMode to getAt(gRunningMovie, 1)
  337.   set HsID to getAt(gRunningMovie, 2)
  338.   set State to getAt(gRunningMovie, 3)
  339.   set ActualHS to getAt(gLstAnimHS, HsID)
  340.   set QtSpriteNo to getAt(getAt(ActualHS, 4), 2)
  341.   set PictSpriteNo to getAt(getAt(ActualHS, 4), 1)
  342.   set CastNo to getAt(ActualHS, 3)
  343.   set type to getAt(getAt(gLstAnimHS, HsID), 5)
  344.   set ActualTime to the movieTime of sprite QtSpriteNo
  345.   set MovieDuration to the duration of cast CastNo
  346.   if type = #TOGGLE then
  347.     if State = #start then
  348.       if ActualTime = MovieDuration then
  349.         SetgRunningMovie(#stop, HsID, #end)
  350.         DoTransitionStop(HsID)
  351.         MovieStop(HsID)
  352.         SetgRunningMovie(#stop, HsID, #end)
  353.         SetGoodAnimPal(#stop)
  354.       end if
  355.     else
  356.       if ActualTime = 0 then
  357.         SetgRunningMovie(#play, HsID, #start)
  358.         DoTransitionStop(HsID)
  359.         MovieStop(HsID)
  360.         SetgRunningMovie(#stop, HsID, #start)
  361.         SetGoodAnimPal(#stop)
  362.       end if
  363.     end if
  364.   else
  365.     if type = #OneShotEnd then
  366.       if ActualTime = MovieDuration then
  367.         DoTransitionStop(HsID)
  368.         MovieStop(HsID)
  369.       end if
  370.     else
  371.       if (type = #OneShotStart) or (type = #button) then
  372.         if ActualTime = MovieDuration then
  373.           DoTransitionStop(HsID)
  374.           MovieStop(HsID)
  375.         end if
  376.       end if
  377.     end if
  378.   end if
  379. end
  380.