home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / tutorial / devglry / bigtop / shockwav / 27_pollu.dcr / 00102.ls < prev    next >
Encoding:
Text File  |  1996-04-10  |  3.0 KB  |  99 lines

  1. on replay playSpr
  2.   global kBaseReplaySpr, dispatchTable, kNbChannels, curFrame, scoreData, kFrameCue, soundData, loopFlag
  3.   repeat while the mouseDown
  4.   end repeat
  5.   set userClicked to 0
  6.   set nbFrames to count(scoreData)
  7.   set stopCastNum to the number of cast "stopBtn"
  8.   if (curFrame >= nbFrames) and not loopFlag then
  9.     exit
  10.   end if
  11.   preloadSounds()
  12.   if curFrame <> 1 then
  13.     triggerSound(1)
  14.   end if
  15.   repeat while curFrame <= nbFrames
  16.     startTimer()
  17.     displayBgd(curFrame)
  18.     triggerSound()
  19.     displayFX(curFrame)
  20.     set curReplaySpr to kBaseReplaySpr
  21.     set slotNum to 1
  22.     repeat with curSlot in dispatchTable
  23.       set dataChannel to getAt(curSlot, 3)
  24.       set curCell to getAnimCell(curFrame, dataChannel)
  25.       if curCell <> 0 then
  26.         set the castNum of sprite curReplaySpr to adjustCastNum(getAt(curCell, 1))
  27.         set the locH of sprite curReplaySpr to getAt(curCell, 2) - 80
  28.         set the locV of sprite curReplaySpr to getAt(curCell, 3) - 35
  29.       else
  30.         set the locH of sprite curReplaySpr to -1000
  31.       end if
  32.       set curReplaySpr to curReplaySpr + 1
  33.     end repeat
  34.     updateShuttle()
  35.     updateStage()
  36.     set curFrame to curFrame + 1
  37.     if the mouseDown then
  38.       set curFrame to curFrame - (curFrame <> 1)
  39.       set userClicked to 1
  40.       exit repeat
  41.     end if
  42.     repeat while the timer < kFrameCue
  43.     end repeat
  44.     if loopFlag and (curFrame > nbFrames) then
  45.       set curFrame to 1
  46.     end if
  47.   end repeat
  48.   set curFrame to curFrame - (curFrame <> 1)
  49.   sound stop 1
  50.   sound stop 2
  51.   puppetSound(0)
  52.   updateStage()
  53.   if userClicked then
  54.     puppetSound("pop")
  55.     updateStage()
  56.   end if
  57.   set the castNum of sprite playSpr to the number of cast "stopBtn.h"
  58.   updateStage()
  59.   doPause(4)
  60.   set the castNum of sprite playSpr to the number of cast "playBtn"
  61.   updateStage()
  62. end
  63.  
  64. on displayFrame frameNum, filterChannel
  65.   global curLayer, scoreData, kNbChannels, kBaseReplaySpr, dispatchTable, kRecordSpr
  66.   if scoreData = [] then
  67.     exit
  68.   end if
  69.   set curLength to count(scoreData)
  70.   set slotNum to 0
  71.   set curReplaySpr to kBaseReplaySpr
  72.   displayBgd(frameNum)
  73.   displayFX(frameNum)
  74.   repeat with curSlot in dispatchTable
  75.     set slotNum to slotNum + 1
  76.     set dataChannel to getAt(curSlot, 3)
  77.     set curCell to getAnimCell(frameNum, dataChannel)
  78.     if dataChannel = filterChannel then
  79.       if curCell <> 0 then
  80.         set the castNum of sprite kRecordSpr to adjustCastNum(getAt(curCell, 1))
  81.         set the locH of sprite kRecordSpr to getAt(curCell, 2) - 80
  82.         set the locV of sprite kRecordSpr to getAt(curCell, 3) - 35
  83.       else
  84.         set the locH of sprite kRecordSpr to -1000
  85.       end if
  86.     else
  87.       if curCell <> 0 then
  88.         set the castNum of sprite curReplaySpr to adjustCastNum(getAt(curCell, 1))
  89.         set the locH of sprite curReplaySpr to getAt(curCell, 2) - 80
  90.         set the locV of sprite curReplaySpr to getAt(curCell, 3) - 35
  91.       else
  92.         set the locH of sprite curReplaySpr to -1000
  93.       end if
  94.     end if
  95.     set curReplaySpr to curReplaySpr + 1
  96.   end repeat
  97.   updateStage()
  98. end
  99.