home *** CD-ROM | disk | FTP | other *** search
/ LAUNCH 3 / LAUNCH.BIN / pc / sony / mainmov.dir / 00010_Script_10 < prev    next >
Text File  |  1995-06-07  |  13KB  |  461 lines

  1. --3D Spin
  2.  
  3.  
  4. ---------------------------------------------------------------------
  5. ---------------------------------------------------------------------
  6.  
  7. --called from the score to initialize the spinning discman section
  8.  
  9. on SPIN3D
  10.   global QTMovieSprite,xframecount,yframecount,ChosenView,QTPath
  11.   global MaxX,MaxY
  12.   
  13.   set QTPath = the pathName
  14.   
  15.   put 0 into ChosenView
  16.   put 20 into QTMovieSprite
  17.   
  18.   set the movietime of sprite(QTMovieSprite) = 184
  19.   set the movierate of sprite(QTMovieSprite) = 0
  20.   
  21.   updatestage
  22.   
  23.   put 9 into maxY  --number of rotations along Y
  24.   put 22 into maxX --number of rotations around X
  25.   put 4 into xframecount
  26.   put 5 into yFrameCount
  27. end
  28.  
  29.  
  30. ---------------------------------------------------------------------
  31. ---------------------------------------------------------------------
  32.  
  33. --called on the mousedown when the user clicks on a draggable portion
  34. --of the discman
  35.  
  36. on TRACKUSER
  37.   
  38.   global clickoriginH,clickoriginV,xFrameCount,FirstXFrame,yFrameCount,FirstYFrame
  39.   global MaxX,MaxY,LastXMouseMove,LastYMouseMove
  40.   
  41.   put 0 into LastXMouseMove
  42.   put 0 into LastYMouseMove
  43.   if xframecount = "" then put 1 into xframecount
  44.   if yFrameCount = "" then put 7 into yFrameCount
  45.   put xFrameCount into FirstXFrame
  46.   put yFrameCount into FirstYFrame
  47.   set clickoriginH = the mouseH
  48.   set clickoriginV = the mouseV
  49.   
  50.   repeat while the stillDown
  51.     
  52.     --Number of pixels user must move to advance 1 frame
  53.     put 10 into PixPerFrame
  54.     
  55.     --Get x movement
  56.     put clickoriginH into XOrigin    
  57.     put (XOrigin - MouseH()) into MouseMove  
  58.     if MouseMove < 0 then put true into ItsNeg
  59.     else put false into ItsNeg
  60.     
  61.     --Figure x movement
  62.     put mousemove into LastXMouseMove
  63.     put abs (mouseMove) into mouseMove
  64.     put integer(MouseMove / PixPerFrame) into xFramemove
  65.     if ItsNeg then put FirstXFrame + xFramemove into xFrameCount
  66.     else put FirstXFrame - xFramemove into xFrameCount
  67.     if xFrameCount <= 0 then
  68.       repeat while xFrameCount <= 0
  69.         put (MaxX + xFrameCount) into xFrameCount
  70.       end repeat
  71.     end if
  72.     if xFrameCount >= (MaxX) then
  73.       repeat while xFrameCount >= (MaxX)
  74.         put (xFrameCount - MaxX) into xFrameCount
  75.       end repeat
  76.     end if
  77.     
  78.     --Get y movement
  79.     put clickoriginV into YOrigin    
  80.     put (YOrigin - MouseV()) into MouseMove  
  81.     if MouseMove < 0 then put true into ItsNeg
  82.     else put false into ItsNeg
  83.     
  84.     --Figure y movement
  85.     put mousemove into LastYMouseMove
  86.     put abs(mouseMove) into mouseMove
  87.     put integer(MouseMove / PixPerFrame) into yFramemove
  88.     if not ItsNeg then put FirstYFrame - yFramemove into yFrameCount
  89.     else put FirstYFrame + yFramemove into yFrameCount  
  90.     if yFrameCount <= 0 then put 1 into yFrameCount
  91.     if yFrameCount > (MaxY) then put MaxY into yFrameCount
  92.     
  93.     --this calls the handler to update the discman to display
  94.     --the current frame the user wants to see
  95.     PlayThisFrame (xFrameCount,yFrameCount)
  96.     
  97.   end repeat
  98. end  
  99.  
  100.  
  101. ---------------------------------------------------------------------
  102. ---------------------------------------------------------------------
  103.  
  104. --show the user the frame they want to see on the 3D draggable
  105. --discman
  106.  
  107. on PlayThisFrame xFrameCount,yFrameCount
  108.   
  109.   global MaxX,QTMovieSprite
  110.   
  111.   put (xFrameCount + ((yFrameCount-1)*MaxX)) * 4 into frameCount
  112.   set the movieTime of sprite(QTMovieSprite) to (frameCount/2)
  113.   updatestage
  114.   -- go to the frame
  115. end
  116.  
  117.  
  118. ---------------------------------------------------------------------
  119. ---------------------------------------------------------------------
  120.  
  121. --when the user lets go of the 3D discman after spinning it around
  122. --the discman will spin to one of the six positions
  123. --called from the mouseup of the discman
  124.  
  125. on RESET3D
  126.   global QTMovieSprite
  127.   PICKVIEW
  128.   CHECKVIEW
  129. end
  130.  
  131.  
  132. ---------------------------------------------------------------------
  133. ---------------------------------------------------------------------
  134.  
  135. --selects one of the six views to rotate the disman to
  136. --called from RESET3D
  137.  
  138. on PICKVIEW
  139.   
  140.   global XframeCount,YframeCount
  141.   
  142.   
  143.   -------------------------
  144.   --Y is forward
  145.   set sideForwardX = 0.0
  146.   set sideForwardY = 1.0
  147.   
  148.   --X=5 is 5th axis, 22 rotations
  149.   set sideFrontx = 4.0
  150.   set sideFronty = 5.0
  151.   set sideLeftx = 10.0
  152.   set sideLefty = 5.0
  153.   set sideRightx = 21.0
  154.   set sideRighty = 5.0
  155.   set sideBackx = 15.0
  156.   set sideBacky = 5.0
  157.   
  158.   --Y is rear side
  159.   set sideRearX = 19.0
  160.   set sideRearY = 9.0
  161.   -------------------------
  162.   
  163.   if YframeCount < 3 then 
  164.     ROTATETOVIEW(sideForwardX,sideForwardY)
  165.   else
  166.     if YframeCount > 7 then 
  167.       ROTATETOVIEW(sideRearX,sideRearY)
  168.     else 
  169.       if XframeCount < 7 then ROTATETOVIEW(sideFrontX,sideFrontY)
  170.       else if XframeCount <14 then ROTATETOVIEW(sideLeftX,sideLeftY)
  171.       else if XframeCount >18 then ROTATETOVIEW(sideRightX,sideRightY)
  172.       else ROTATETOVIEW(sideBackX,sideBackY)
  173.     end if
  174.   end if
  175. end
  176.  
  177.  
  178. ---------------------------------------------------------------------
  179. ---------------------------------------------------------------------
  180.  
  181. --rotates the disman to one of the six views
  182. --called from PICKVIEW
  183.  
  184. on ROTATETOVIEW XdestFrame, YdestFrame
  185.   
  186.   global XframeCount,YframeCount
  187.   
  188.   set Xdif =(XdestFrame) - (XframeCount)
  189.   set Xdif = (Xdif  + .0)
  190.   set Ydif = (YdestFrame) - (YframeCount)
  191.   set Ydif = (Ydif  + .0)
  192.   
  193.   If Xdif = 0 then
  194.     set slope = 0
  195.   else
  196.     set slope = float(Ydif/Xdif)
  197.   end if
  198.   
  199.   set offSet = (YframeCount) - (slope * XframeCount)
  200.   
  201.   If abs(Xdif) > abs(Ydif) then
  202.     set numPoints = abs(Xdif) - 1
  203.     If numpoints  <= 0 then
  204.       set XframeCount = XdestFrame
  205.       set YframeCount = YdestFrame
  206.       PlayThisFrame(XframeCount,YframeCount)
  207.       exit
  208.     end if
  209.     
  210.     set step = (Xdif) / (numPoints +1)
  211.     repeat with i = 1 to numPoints
  212.       set Xpoint = integer(XframeCount + (i * step))
  213.       set Ypoint = integer((slope * Xpoint) + offSet)
  214.       PlayThisFrame(Xpoint,Ypoint)
  215.     end repeat
  216.     
  217.   else
  218.     set numPoints = abs(Ydif) - 1
  219.     IF numPoints <= 0 then
  220.       set XframeCount = XdestFrame
  221.       set YframeCount = YdestFrame
  222.       PlayThisFrame(XframeCount,YframeCount)
  223.       exit
  224.     end if
  225.     set step =(Ydif) / (numPoints + 1)
  226.     repeat with i = 1 to numpoints
  227.       set Ypoint =  integer(YframeCount + (i * step))
  228.       IF slope = 0 then
  229.         set Xpoint = XframeCount
  230.       else
  231.         set Xpoint = integer((Ypoint - offSet) / slope)
  232.       end if
  233.       PlayThisFrame(Xpoint,Ypoint)
  234.     end repeat        
  235.   end if
  236.   
  237.   set XframeCount = XdestFrame
  238.   set YframeCount = YdestFrame
  239.   PlayThisFrame(XframeCount,YframeCount)
  240. end
  241.  
  242.  
  243. ---------------------------------------------------------------------
  244. ---------------------------------------------------------------------
  245.  
  246. --sets the variable telling me what view the user stopped to
  247. --look at from the 3D discman
  248. --called from RESET3D
  249.  
  250. on CHECKVIEW
  251.   global ChosenView,QTMovieSprite,WhatSide
  252.   global Area1,Area2,Area3,Area4,Area5,Area6
  253.   
  254.   put the movieTime of sprite(QTMovieSprite) into ChosenView
  255.   
  256.   --the numbers below is the current frame of the movie
  257.   if ChosenView = 0 then set WhatSide = 1  --forward side
  258.   else if ChosenView = 390 then set WhatSide = 2  --rear side
  259.   else if ChosenView = 184 then set WhatSide = 3  --front/top side
  260.   else if ChosenView = 196 then set WhatSide = 4  --left side
  261.   else if ChosenView = 218 then set WhatSide = 5  --right side
  262.   else if ChosenView = 206 then set WhatSide = 6  --back side
  263.   
  264.   --now we have the side, next determine the hotspots
  265.   set textBlock = the number of cast("Side" & "." & WhatSide)
  266.   set numItem = (the number of lines in the text of cast(textblock))
  267.   
  268.   repeat with i = 1 to (numItem)
  269.     put (item 1 to 4 of line i of the text of cast(textBlock)) into it
  270.     set Area= rect(integer(item 1 of it),integer(item 2 of it),integer(item 3 of it),integer(item 4 of it))
  271.     if i = 1 then set Area1 = Area
  272.     else if i = 2 then set Area2 = Area
  273.     else if i = 3 then set Area3 = Area
  274.     else if i = 4 then set Area4 = Area
  275.     else if i = 5 then set Area5 = Area
  276.     else if i = 6 then set Area6 = Area
  277.   end repeat
  278.   
  279. end
  280.  
  281.  
  282. ---------------------------------------------------------------------
  283. ---------------------------------------------------------------------
  284.  
  285. --checks for the mouseloc during the playback head loop
  286. --in the score, changes the cursor to allow user to click
  287. --a choice or simply spin the discman
  288.  
  289. on CHECKMOUSELOC
  290.   global QTMovieSprite,area
  291.   global Area1,Area2,Area3,Area4,Area5,Area6
  292.   
  293.   set rollPoint = point(the mouseH,the mouseV)
  294.   if inside(rollPoint,Area1) then CLICKCURSOR  --now the pointer
  295.   else if inside(rollPoint,Area2) then CLICKCURSOR
  296.   else if inside(rollPoint,Area3) then CLICKCURSOR
  297.   else if inside(rollPoint,Area4) then CLICKCURSOR
  298.   else if inside(rollPoint,Area5) then CLICKCURSOR
  299.   else if inside(rollPoint,Area6) then CLICKCURSOR
  300.   else SPINCURSOR  
  301.   
  302. end
  303.  
  304.  
  305. ---------------------------------------------------------------------
  306. ---------------------------------------------------------------------
  307.  
  308. --change to a clickable cursor for 3D discman
  309. --initialize variable
  310.  
  311. on CLICKCURSOR
  312.   global gCursorState
  313.   
  314.   --route 66 cursor
  315.   set Z = the number of cast "PointerCursor"
  316.   set ZZ = the number of cast "PointerCursor" + 1
  317.   set the cursor of sprite(20) to [Z,ZZ]
  318.   
  319.   -- cursor 3
  320.   
  321.   set gCursorState = true
  322. end
  323.  
  324.  
  325. ---------------------------------------------------------------------
  326. ---------------------------------------------------------------------
  327.  
  328. --change to the spinning cursor for 3D discman
  329. --initialize variable
  330.  
  331. on SPINCURSOR
  332.   global gCursorState
  333.   
  334.   --open hand cursor
  335.   set Z = the number of cast "OpenHandCursor"
  336.   set ZZ = the number of cast "OpenHandCursor" + 1
  337.   set the cursor of sprite(20) to [Z,ZZ]
  338.   
  339.   set gCursorState = false
  340. end
  341.  
  342.  
  343. ---------------------------------------------------------------------
  344. ---------------------------------------------------------------------
  345.  
  346. --called from the mouseup on the 3D discman as the user selects
  347. --a hotspot to call up info
  348.  
  349. on SHOWINFO
  350.   global WhatSide, gCursorState,gPopUpLoc
  351.   global Area1,Area2,Area3,Area4,Area5,Area6
  352.   
  353.   set PopUp = the number of cast("PopUp" & "." & WhatSide)
  354.   
  355.   if PopUp = the number of cast("PopUp.1") then
  356.     OPENANIM
  357.     exit
  358.   end if
  359.   
  360.   updatestage
  361.   
  362.   puppetsound "POP.AIFF"
  363.   updatestage
  364.   -- PlayQTSound "DryPop.MOV"
  365.   
  366.   if inside(the clickLoc,Area1) then 
  367.     puppetsprite(45), true
  368.     CHECKPOPUP PopUp
  369.     set the castNum of sprite(45) to cast PopUp
  370.     set the loc of sprite(45) to gPopUpLoc
  371.     set the visible of sprite(45) to true
  372.     updateStage
  373.   else if inside(the clickLoc,Area2) then 
  374.     puppetsprite(45), true
  375.     set the castNum of sprite(45) to cast "PopUp.5B"
  376.     set the loc of sprite(45) to point(485,74)
  377.     set the visible of sprite(45) to true
  378.     updateStage
  379.   end if
  380.   
  381. end
  382.  
  383.  
  384. ---------------------------------------------------------------------
  385. ---------------------------------------------------------------------
  386.  
  387. --checks which popup then sets the stage point
  388.  
  389. on CHECKPOPUP PopUp
  390.   global gPopUpLoc
  391.   
  392.   --pcmcia
  393.   if the name of cast PopUp contains "PopUp.2" then
  394.     set gPopUpLoc = point(416,49)
  395.     exit
  396.   end if
  397.   
  398.   --control panel
  399.   if the name of cast PopUp contains "PopUp.3" then
  400.     set gPopUpLoc = point(342,337)
  401.     exit
  402.   end if
  403.   
  404.   --battery
  405.   if the name of cast PopUp contains "PopUp.6" then
  406.     set gPopUpLoc = point(531,43)
  407.     exit
  408.   end if
  409.   
  410.   --audio controls
  411.   if the name of cast PopUp contains "PopUp.5" then
  412.     set gPopUpLoc = point(547,166)
  413.     exit
  414.   end if
  415.   
  416. end
  417.  
  418.  
  419. ---------------------------------------------------------------------
  420. ---------------------------------------------------------------------
  421.  
  422. --initialize the popups
  423.  
  424. on SETPOPUP
  425.   
  426.   set the castNum of sprite(45) to (the number of cast "PopUp.0")
  427.   set the loc of sprite(45) to point(619, 457)
  428.   set the visible of sprite(45) to false
  429. end
  430.  
  431.  
  432. ---------------------------------------------------------------------
  433. ---------------------------------------------------------------------
  434.  
  435. --do the opening animation of the discman
  436.  
  437. on OPENANIM
  438.   
  439.   --PLAY SOUND OF SITAR WHILE DISCMAN IS OPENING
  440.   PlayQTSound "SALLSIT2.MOV"
  441.   
  442.   cursor 200   --no cursor
  443.   set the movierate of sprite(20) = 0
  444.   set the movietime of sprite(20) = 46  --inbetween to look like animating to position
  445.   updatestage
  446.   set the movietime of sprite(20) = 416
  447.   set the movierate of sprite(20) = 1
  448.   repeat while the movietime of sprite(20) < 464
  449.     updatestage
  450.     --wait for opening animation to finish  
  451.   end repeat
  452.   
  453.   cursor -1   -- regular cursor
  454.   
  455.   repeat while the mousedown = false
  456.     nothing
  457.   end repeat
  458.   
  459.   set the movietime of sprite(20) = 0
  460.   set the movierate of sprite(20) = 0
  461. end