home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / tutorial / casestdy / ch14_csa / d4vers / csaa.dir / 00003.ls < prev    next >
Encoding:
Text File  |  1996-06-17  |  6.1 KB  |  234 lines

  1. global gTargetList, gHistory, gEyeBallChan, gVioConChan, gAlertChan, gRearViewChan, gCarByeSnd, gCarHiSnd
  2.  
  3. on moveSpeedNeedle dir
  4. end
  5.  
  6. on moveRadioNeedle dir
  7. end
  8.  
  9. on turnSteering
  10. end
  11.  
  12. on honkHorn arg
  13.   global gOldVol
  14.   if arg then
  15.     set gOldVol to the volume of sound 1
  16.     sound fadeIn 1, 6
  17.     set the volume of sound 1 to 50
  18.     puppetSound("BellTone")
  19.     updateStage()
  20.   else
  21.     sound fadeOut 1, 2
  22.     updateStage()
  23.   end if
  24. end
  25.  
  26. on doMap arg
  27.   global gTopButton, gButtonInks, gFoldChan, gOldTempo, gTopCheck, gBigMapChan, gBottomButton, gTerrainChan, gThisOne
  28.   if not arg then
  29.     set gFoldChan to the clickOn
  30.     allSprites(-1, 1, gVioConChan - 1, gVioConChan)
  31.     set the visible of sprite gFoldChan to 0
  32.     set the visible of sprite gBigMapChan to 1
  33.     updateStage()
  34.     puppetSprite(gVioConChan, 1)
  35.     set gBottomButton to gTopButton + count(gTargetList) - 1
  36.     allSprites(0, 1, gTopButton, gBottomButton)
  37.     allSprites(-1, 0, gTopCheck, gBottomButton)
  38.     updateStage()
  39.     set gOldTempo to the frameTempo
  40.     puppetTempo(2)
  41.     repeat with i in gTerrainChan
  42.       set the visible of sprite i to 0
  43.     end repeat
  44.     exit
  45.   else
  46.     if integerp(arg) then
  47.       set gThisOne to arg - gTopButton + 1
  48.       allSprites(0, 0, gBigMapChan, gTopCheck + count(gTargetList) - 1)
  49.       set the visible of sprite gFoldChan to 1
  50.       updateStage()
  51.       puppetTempo(gOldTempo)
  52.       setTargetPage(gThisOne)
  53.       exit
  54.     else
  55.       if arg = "configure" then
  56.         if not gTopButton then
  57.           repeat with i = 1 to 48
  58.             if the castNum of sprite i = the number of cast "mapMarker" then
  59.               set gTopButton to i
  60.               exit repeat
  61.             end if
  62.             set gTopButton to 0
  63.           end repeat
  64.           repeat with j = i to 48
  65.             if the castNum of sprite j <> the number of cast "mapMarker" then
  66.               set gTopCheck to j
  67.               exit repeat
  68.             end if
  69.             set gTopCheck to 0
  70.           end repeat
  71.         end if
  72.         if gTopCheck then
  73.           repeat with k = gTopButton to gTopCheck + count(gTargetList) - 1
  74.             set the visible of sprite k to 0
  75.           end repeat
  76.           updateStage()
  77.         end if
  78.       else
  79.         if arg = "animate" then
  80.           if gTopCheck then
  81.             repeat with l = gTopCheck to gTopCheck + count(gTargetList) - 1
  82.               if getPos(gHistory, getAt(gTargetList, l - gTopCheck + 1)) then
  83.                 set the visible of sprite l to 1
  84.                 next repeat
  85.               end if
  86.               set the visible of sprite l to 0
  87.             end repeat
  88.             updateStage()
  89.           end if
  90.         end if
  91.       end if
  92.     end if
  93.   end if
  94. end
  95.  
  96. on hideRearView
  97.   global gSegStart, gNextRandTime, oldVol
  98.   set oldVol to the volume of sound 1
  99.   set the volume of sound 1 to 70
  100.   puppetSound(gCarByeSnd)
  101.   set fadeDur to 60
  102.   sound fadeOut 1, fadeDur
  103.   updateStage()
  104.   set the castNum of sprite gRearViewChan to the number of cast "rv-b"
  105.   updateStage()
  106.   waitForTicks(20)
  107.   set the visible of sprite gRearViewChan to 0
  108.   puppetSprite(gRearViewChan, 0)
  109.   updateStage()
  110.   set gSegStart to the ticks
  111.   set gNextRandTime to 600 + random(800)
  112. end
  113.  
  114. on animateRearView
  115.   global gShowTime, gSegStart, gNextRandTime, gBeepRand, oldVol
  116.   if the visible of sprite gRearViewChan = 0 then
  117.     set oldVol to the volume of sound 1
  118.     set the volume of sound 1 to 75
  119.     puppetSprite(gRearViewChan, 1)
  120.     set the castNum of sprite gRearViewChan to the number of cast "rv-b"
  121.     set the visible of sprite gRearViewChan to 1
  122.     puppetSound("honk")
  123.     updateStage()
  124.     waitForTicks(5)
  125.     puppetSound("honk")
  126.     updateStage()
  127.     set gShowTime to the ticks
  128.     repeat while soundBusy(1)
  129.       if the mouseDown then
  130.         exit repeat
  131.       end if
  132.     end repeat
  133.     set the castNum of sprite gRearViewChan to the number of cast "rv"
  134.     updateStage()
  135.   else
  136.     if not gShowTime then
  137.       set gShowTime to the ticks
  138.     end if
  139.     if (the ticks - gShowTime) > (300 + (random(60) * 10)) then
  140.       if the castNum of sprite gRearViewChan <> the number of cast "rv-lTilt" then
  141.         set the castNum of sprite gRearViewChan to the castNum of sprite gRearViewChan + 1
  142.         puppetSound("honk")
  143.         updateStage()
  144.         waitForTicks(12)
  145.         puppetSound("honk")
  146.         repeat while soundBusy(1)
  147.           if the mouseDown then
  148.             exit repeat
  149.           end if
  150.         end repeat
  151.         updateStage()
  152.         waitForTicks(10 + random(50))
  153.       else
  154.         hideRearView()
  155.         updateStage()
  156.         set gShowTime to the ticks
  157.         return 1
  158.       end if
  159.     end if
  160.   end if
  161. end
  162.  
  163. on followEyes
  164.   repeat with i = gEyeBallChan to gEyeBallChan + 1
  165.     set realAngle to integer(getFollowAngle(i) / 60)
  166.     set nextCast to string(realAngle) & "i"
  167.     if not (the castNum of sprite i = the number of cast nextCast) then
  168.       set the castNum of sprite i to the number of cast nextCast
  169.     end if
  170.   end repeat
  171.   updateStage()
  172. end
  173.  
  174. on checkMapRolz
  175.   global gTopButton, gBottomButton
  176.   repeat with i = gTopButton to gBottomButton
  177.     if rollOver(i) then
  178.       if the castNum of sprite gVioConChan <> (41 + i - gTopButton) then
  179.         set the castNum of sprite gVioConChan to 41 + i - gTopButton
  180.         updateStage()
  181.       end if
  182.       exit
  183.     end if
  184.   end repeat
  185. end
  186.  
  187. on warn
  188.   global returnDown
  189.   allSprites(-1, 1, getAt(gAlertChan, 1), getLast(gAlertChan))
  190.   updateStage()
  191.   set rVal to 1
  192.   repeat while 1
  193.     if the key = RETURN then
  194.       set rVal to 1
  195.       exit repeat
  196.     end if
  197.     if the mouseDown then
  198.       if rollOver(getAt(gAlertChan, 2)) then
  199.         set rVal to 1
  200.         exit repeat
  201.         next repeat
  202.       end if
  203.       if rollOver(getAt(gAlertChan, 3)) then
  204.         set rVal to 0
  205.         exit repeat
  206.         next repeat
  207.       end if
  208.       nothing()
  209.     end if
  210.   end repeat
  211.   set the ink of sprite (getAt(gAlertChan, 2) + not rVal) to 6
  212.   updateStage()
  213.   waitForTicks(8)
  214.   set the ink of sprite (getAt(gAlertChan, 2) + not rVal) to 8
  215.   allSprites(-1, 0, getAt(gAlertChan, 1), getLast(gAlertChan))
  216.   return rVal
  217. end
  218.  
  219. on keyDown
  220.   global returnDown
  221.   if the key = RETURN then
  222.     set returnDown to 1
  223.   end if
  224.   pass()
  225. end
  226.  
  227. on keyUp
  228.   global returnDown
  229.   if returnDown then
  230.     set returnDown to 0
  231.   end if
  232.   pass()
  233. end
  234.