home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 October / Pcwk1097.iso / REKLAMY / ATA-INT / 3220 / 3220.EXE / 3220.DXR / 00075_DCAnimation.ls < prev    next >
Encoding:
Text File  |  1997-02-13  |  6.4 KB  |  213 lines

  1. property CHECK_BOX_SPRS, CHECK_BOX_NAMES, CHECK_BOX_GRAPHICS, CHECK_BOX_TEXTS, GRAPHICS_ANIMS, TEXT_ANIMS, HILITES, SHARED_SPRS, FRAME_ONLY_SPRS, MASTER_CHECK, CHECK_BOX_NUMS, GRAPHIC_NUMS, TEXT_NUMS
  2. global gDONT_ANIMATE
  3.  
  4. on birth me, checkBoxSprs, checkBoxNames, graphicCastNames, textCastNames, graphicAnims, txtAnims, sharedSprs, frameOnlySprs, masterCheck, checkBoxNums, graphicNums, textNums
  5.   set CHECK_BOX_SPRS to checkBoxSprs
  6.   set CHECK_BOX_NAMES to checkBoxNames
  7.   set CHECK_BOX_GRAPHICS to graphicCastNames
  8.   set CHECK_BOX_TEXTS to textCastNames
  9.   set HILITES to []
  10.   repeat with i = 1 to count(checkBoxNames)
  11.     add(HILITES, 0)
  12.   end repeat
  13.   set GRAPHICS_ANIMS to graphicAnims
  14.   set TEXT_ANIMS to txtAnims
  15.   set SHARED_SPRS to sharedSprs
  16.   set FRAME_ONLY_SPRS to frameOnlySprs
  17.   set MASTER_CHECK to masterCheck
  18.   set CHECK_BOX_NUMS to checkBoxNums
  19.   set GRAPHIC_NUMS to graphicNums
  20.   set TEXT_NUMS to textNums
  21.   return me
  22. end
  23.  
  24. on checkState me
  25.   set hiliteList to [:]
  26.   repeat with i = 1 to count(CHECK_BOX_SPRS)
  27.     set cNum to the castNum of sprite getAt(CHECK_BOX_SPRS, i)
  28.     addProp(hiliteList, the name of cast cNum, the hilite of cast cNum)
  29.   end repeat
  30.   repeat with i = 1 to count(hiliteList)
  31.     set propName to getPropAt(hiliteList, i)
  32.     set btnPos to getPos(CHECK_BOX_NAMES, propName)
  33.     if getaProp(hiliteList, propName) = 1 then
  34.       if getAt(HILITES, i) = 0 then
  35.         set textAnim to getAt(TEXT_ANIMS, btnPos)
  36.         if textAnim <> [] then
  37.           doAnim(me, textAnim, btnPos, CHECK_BOX_TEXTS, TEXT_NUMS)
  38.         end if
  39.         set graphicsAnim to getAt(GRAPHICS_ANIMS, btnPos)
  40.         if graphicsAnim <> [] then
  41.           doAnim(me, graphicsAnim, btnPos, CHECK_BOX_GRAPHICS, GRAPHIC_NUMS)
  42.         end if
  43.       end if
  44.       next repeat
  45.     end if
  46.     if getAt(HILITES, i) = 1 then
  47.       set textAnim to getAt(TEXT_ANIMS, btnPos)
  48.       if textAnim <> [] then
  49.         set spr to getAt(textAnim, 1)
  50.         if canTurnOffSpr(me, i) then
  51.           puppetSprite(spr, 0)
  52.           updateStage()
  53.         end if
  54.       end if
  55.       set graphicsAnim to getAt(GRAPHICS_ANIMS, btnPos)
  56.       if graphicsAnim <> [] then
  57.         set spr to getAt(graphicsAnim, 1)
  58.         if canTurnOffSpr(me, i) then
  59.           puppetSprite(spr, 0)
  60.           updateStage()
  61.         end if
  62.       end if
  63.     end if
  64.   end repeat
  65.   repeat with i = 1 to count(hiliteList)
  66.     setAt(HILITES, i, getAt(hiliteList, i))
  67.   end repeat
  68.   checkDeadRadio(me)
  69. end
  70.  
  71. on checkDeadRadio me
  72.   repeat with i = 1 to count(SHARED_SPRS)
  73.     set nxtLst to getAt(SHARED_SPRS, i)
  74.     set allOff to 0
  75.     repeat with j = getAt(nxtLst, 1) to getLast(nxtLst)
  76.       set allOff to allOff + getAt(HILITES, j)
  77.     end repeat
  78.     if allOff = 0 then
  79.       repeat with j = getAt(nxtLst, 1) to getLast(nxtLst)
  80.         set anim to getAt(GRAPHICS_ANIMS, j)
  81.         if anim <> [] then
  82.           set spr to getAt(anim, 1)
  83.           puppetSprite(spr, 0)
  84.           updateStage()
  85.         end if
  86.         set anim to getAt(TEXT_ANIMS, j)
  87.         if anim <> [] then
  88.           set spr to getAt(anim, 1)
  89.           puppetSprite(spr, 0)
  90.           updateStage()
  91.         end if
  92.       end repeat
  93.     end if
  94.   end repeat
  95. end
  96.  
  97. on canTurnOffSpr me, hiliteIndex
  98.   repeat with i = 1 to count(SHARED_SPRS)
  99.     set nxtLst to getAt(SHARED_SPRS, i)
  100.     if getOne(nxtLst, hiliteIndex) <> 0 then
  101.       return 0
  102.     end if
  103.   end repeat
  104.   return 1
  105. end
  106.  
  107. on doAnim me, theAnim, btnPos, castList, castNums
  108.   set spr to getAt(theAnim, 1)
  109.   puppetSprite(spr, 1)
  110.   set cstName to getAt(castList, btnPos)
  111.   set the castNum of sprite spr to getAt(castNums, btnPos)
  112.   set endLoc to getAt(theAnim, 3)
  113.   set doesAnim to getAt(theAnim, 4)
  114.   if gDONT_ANIMATE = 1 then
  115.     if getAt(theAnim, 6) = 1 then
  116.       set the castNum of sprite spr to the number of cast getAt(theAnim, 7)
  117.     end if
  118.     set the loc of sprite spr to endLoc
  119.     updateStage()
  120.   else
  121.     set startLoc to getAt(theAnim, 2)
  122.     set the loc of sprite spr to startLoc
  123.     updateStage()
  124.     if doesAnim = 1 then
  125.       set increment to getAt(getAt(theAnim, 5), 1)
  126.       if getAt(theAnim, 6) = 1 then
  127.         set switchMember to getAt(theAnim, 7)
  128.         set cond to getAt(theAnim, 8)
  129.       end if
  130.       moveSpr(spr, startLoc, endLoc, increment, getAt(theAnim, 6), switchMember, cond)
  131.     else
  132.       if doesAnim = 2 then
  133.         alert("unimplimented.")
  134.       else
  135.         set the loc of sprite spr to endLoc
  136.         updateStage()
  137.       end if
  138.     end if
  139.   end if
  140. end
  141.  
  142. on moveSpr spr, startLoc, endLoc, increment, switchWhileMoving, switchMember, cond
  143.   if switchWhileMoving = 1 then
  144.     set c1 to getAt(cond, 1)
  145.     set c2 to getAt(cond, 2)
  146.   end if
  147.   if getAt(startLoc, 2) > getAt(endLoc, 2) then
  148.     set v to getAt(startLoc, 2)
  149.     repeat while 1 = 1
  150.       set v to v - increment
  151.       if v < getAt(endLoc, 2) then
  152.         exit repeat
  153.       end if
  154.       if switchWhileMoving = 1 then
  155.         if value(c1 && string(spr) && c2) = 1 then
  156.           set the castNum of sprite spr to the number of cast switchMember
  157.           updateStage()
  158.         end if
  159.       end if
  160.       set the locV of sprite spr to v
  161.       updateStage()
  162.     end repeat
  163.     set the loc of sprite spr to endLoc
  164.     updateStage()
  165.   else
  166.     if getAt(startLoc, 2) < getAt(endLoc, 2) then
  167.       set v to getAt(startLoc, 2)
  168.       repeat while 1 = 1
  169.         set v to v + increment
  170.         if v > getAt(endLoc, 2) then
  171.           exit repeat
  172.         end if
  173.         if switchWhileMoving = 1 then
  174.           if value(c1 && string(spr) && c2) = 1 then
  175.             set the castNum of sprite spr to the number of cast switchMember
  176.             updateStage()
  177.           end if
  178.         end if
  179.         set the locV of sprite spr to v
  180.         updateStage()
  181.       end repeat
  182.       set the loc of sprite spr to endLoc
  183.       updateStage()
  184.     else
  185.       set h to getAt(startLoc, 1)
  186.       set switchcondition to c1 && string(spr) && c2
  187.       repeat while 1 = 1
  188.         set h to h + increment
  189.         if h > getAt(endLoc, 1) then
  190.           exit repeat
  191.         end if
  192.         if switchWhileMoving = 1 then
  193.           if value(switchcondition) = 1 then
  194.             set the castNum of sprite spr to switchMember
  195.             updateStage()
  196.           end if
  197.         end if
  198.         set the locH of sprite spr to h
  199.         updateStage()
  200.       end repeat
  201.       set the loc of sprite spr to endLoc
  202.       updateStage()
  203.     end if
  204.   end if
  205. end
  206.  
  207. on killFrameOnlySprs me
  208.   repeat with i = 1 to count(FRAME_ONLY_SPRS)
  209.     puppetSprite(getAt(FRAME_ONLY_SPRS, i), 0)
  210.   end repeat
  211.   updateStage()
  212. end
  213.