home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Fácil 3 / CDFACIL3.iso / lazer / desafios / stact012.Dxr / 00399_FatLips.ls < prev    next >
Encoding:
Text File  |  1996-12-01  |  14.6 KB  |  470 lines

  1. on ChannelVoice where, who, saywhat, what, sample
  2.   global voicestate, mouthoff, voicegraph, soundgraph, voicestring, voicelength, voicespot, voicestep, oldtime, oldmouth, oldface, facespot, oldxface, oldyface, lastvoice
  3.   if sample = 11 then
  4.     set sample to 11025
  5.   end if
  6.   if sample = 22 then
  7.     set sample to 22050
  8.   end if
  9.   set voicestate to 1
  10.   if lastvoice <> who then
  11.     set mouthindex to [2, 8, 6, 11, 3, 10, 6, 11, 2, 5, 6, 9, 8, 6, 4, 8, 7, 6, 6, 11, 5, 10, 7, 3, 6, 6, 1]
  12.     set stuffumouth to [EMPTY, "A", "E", "O", "U", "C", "W", "M", "L", "F"]
  13.     set tempmouth to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  14.     repeat with xxx = 1 to 10
  15.       set bbb to getAt(stuffumouth, xxx) & who
  16.       set bee to the number of member bbb
  17.       preLoadCast(bee)
  18.       setAt(tempmouth, xxx, bee)
  19.     end repeat
  20.     set voicegraph to []
  21.     repeat with xxx = 1 to 27
  22.       set aaa to getAt(mouthindex, xxx)
  23.       if aaa = 11 then
  24.         set ccc to 0
  25.       else
  26.         set ccc to getAt(tempmouth, aaa)
  27.       end if
  28.       append(voicegraph, ccc)
  29.     end repeat
  30.     set lastvoice to who
  31.   end if
  32.   set soundgraph to the number of member saywhat
  33.   set voicestring to what
  34.   set oldxface to -2000
  35.   set oldyface to -2000
  36.   set facespot to integer(where / 100)
  37.   set voicespot to where - (facespot * 100)
  38.   set ddd to getAt(voicegraph, 27)
  39.   if (soundgraph = 0) or (ddd = 0) then
  40.     novoice()
  41.     exit
  42.   end if
  43.   puppetSprite(voicespot, 1)
  44.   set voicelength to the size of cast soundgraph + 0.01
  45.   if the machineType = 256 then
  46.     set voicelength to voicelength + (sample / 4)
  47.     set voicestring to " " & voicestring
  48.     set what to " " & what
  49.     if soundBusy(1) or soundBusy(2) then
  50.       set voicelength to voicelength + (sample / 2)
  51.       set voicestring to "      " & voicestring
  52.       set what to "      " & what
  53.     end if
  54.   end if
  55.   set voicestep to float(voicelength * 60 / sample) / float(length(what))
  56.   set voicelength to float(voicelength / sample) * 60.00001000000000317
  57.   set oldtime to mouthoff
  58.   set oldmouth to 20000
  59.   set oldface to ddd
  60.   set mouthoff to the timer
  61.   voiceupkeep()
  62.   set mouthoff to the timer
  63. end
  64.  
  65. on PuppetVoice where, who, saywhat, what, sample
  66.   global voicestate, mouthoff, voicegraph, soundgraph, voicestring, voicelength, voicespot, voicestep, oldtime, oldmouth, oldface, facespot, oldxface, oldyface, lastvoice, jellyjam
  67.   if sample = 11 then
  68.     set sample to 11025
  69.   end if
  70.   if sample = 22 then
  71.     set sample to 22050
  72.   end if
  73.   set voicestate to 1
  74.   if (lastvoice <> who) or (lastvoice = jellyjam) then
  75.     set mouthindex to [2, 8, 6, 11, 3, 10, 6, 11, 2, 5, 6, 9, 8, 6, 4, 8, 7, 6, 6, 11, 5, 10, 7, 3, 6, 6, 1]
  76.     set stuffumouth to [EMPTY, "A", "E", "O", "U", "C", "W", "M", "L", "F"]
  77.     set tempmouth to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  78.     repeat with xxx = 1 to 10
  79.       set bbb to getAt(stuffumouth, xxx) & who
  80.       set bee to the number of member bbb
  81.       preLoadCast(bee)
  82.       setAt(tempmouth, xxx, bee)
  83.     end repeat
  84.     set voicegraph to []
  85.     repeat with xxx = 1 to 27
  86.       set aaa to getAt(mouthindex, xxx)
  87.       if aaa = 11 then
  88.         set ccc to 0
  89.       else
  90.         set ccc to getAt(tempmouth, aaa)
  91.       end if
  92.       append(voicegraph, ccc)
  93.     end repeat
  94.     set lastvoice to who
  95.   end if
  96.   set soundgraph to the number of member saywhat
  97.   set voicestring to what
  98.   set oldxface to -2000
  99.   set oldyface to -2000
  100.   set facespot to integer(where / 100)
  101.   set voicespot to where - (facespot * 100)
  102.   set ddd to getAt(voicegraph, 27)
  103.   if (soundgraph = -1) or (ddd = 0) then
  104.     set voicestate to 0
  105.     exit
  106.   end if
  107.   puppetSprite(voicespot, 1)
  108.   set voicelength to the size of cast soundgraph + 0.01
  109.   if the machineType = 256 then
  110.     set voicelength to voicelength + (sample / 4)
  111.     set voicestring to " " & voicestring
  112.     set what to " " & what
  113.     if soundBusy(1) or soundBusy(2) then
  114.       set voicelength to voicelength + (sample / 2)
  115.       set voicestring to "      " & voicestring
  116.       set what to "      " & what
  117.     end if
  118.   end if
  119.   set voicestep to float(voicelength * 60 / sample) / float(length(what))
  120.   set voicelength to float(voicelength / sample) * 60.00001000000000317
  121.   set oldtime to mouthoff
  122.   set oldmouth to 20000
  123.   set oldface to ddd
  124.   puppetSound(saywhat)
  125.   updateStage()
  126.   set mouthoff to the timer
  127.   voiceupkeep()
  128.   set mouthoff to the timer
  129. end
  130.  
  131. on voiceupkeep
  132.   global voicestate, mouthoff, voicegraph, soundgraph, voicestring, voicelength, voicespot, voicestep, oldtime, oldmouth, oldface, facespot, oldxface, oldyface
  133.   if voicestate = 1 then
  134.     if facespot > 0 then
  135.       set xxx to the locH of sprite facespot
  136.       set yyy to the locV of sprite facespot
  137.       if (xxx <> oldxface) or (yyy <> oldyface) then
  138.         set the locH of sprite voicespot to xxx
  139.         set the locV of sprite voicespot to yyy
  140.         set oldxface to xxx
  141.         set oldyface to yyy
  142.       end if
  143.     end if
  144.     set timefor to the timer
  145.     set ack to timefor - mouthoff
  146.     if ack < 0 then
  147.       set mouthoff to mouthoff - oldtime
  148.       set ack to timefor - mouthoff
  149.     end if
  150.     if ack > (voicelength + 1) then
  151.       novoice()
  152.       exit
  153.     end if
  154.     set oldtime to timefor
  155.     set pbsst to integer(ack / voicestep) + 1
  156.     if pbsst = oldmouth then
  157.       exit
  158.     end if
  159.     set oldmouth to pbsst
  160.     set inchar to char pbsst of voicestring
  161.     set invalue to charToNum(inchar)
  162.     set newface to 0
  163.     if inchar = " " then
  164.       set newface to getAt(voicegraph, 27)
  165.     else
  166.       if (invalue > 64) and (invalue < 91) then
  167.         set newface to getAt(voicegraph, invalue - 64)
  168.       else
  169.         if (invalue > 96) and (invalue < 124) then
  170.           set newface to getAt(voicegraph, invalue - 96)
  171.         end if
  172.       end if
  173.     end if
  174.     if newface = 0 then
  175.       set pink to random(13)
  176.       if pink = 11 then
  177.         set newface to getAt(voicegraph, 3)
  178.       else
  179.         if pink > 11 then
  180.           set newface to getAt(voicegraph, 12)
  181.         else
  182.           set newface to getAt(voicegraph, 9)
  183.         end if
  184.       end if
  185.     end if
  186.     if (newface = 0) or (newface = oldface) then
  187.       exit
  188.     end if
  189.     set the castNum of sprite voicespot to newface
  190.     set oldface to newface
  191.   end if
  192. end
  193.  
  194. on ClearVoices
  195.   global lastvoice, lastvoice2
  196.   set lastvoice to "Illbedamned"
  197.   set lastvoice2 to "Illbedamned"
  198. end
  199.  
  200. on VoicePreset who
  201.   global lastvoice, voicegraph
  202.   if lastvoice <> who then
  203.     set mouthindex to [2, 8, 6, 11, 3, 10, 6, 11, 2, 5, 6, 9, 8, 6, 4, 8, 7, 6, 6, 11, 5, 10, 7, 3, 6, 6, 1]
  204.     set stuffumouth to [EMPTY, "A", "E", "O", "U", "C", "W", "M", "L", "F"]
  205.     set tempmouth to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  206.     repeat with xxx = 1 to 10
  207.       set bbb to getAt(stuffumouth, xxx) & who
  208.       set bee to the number of member bbb
  209.       preLoadCast(bee)
  210.       setAt(tempmouth, xxx, bee)
  211.     end repeat
  212.     set voicegraph to []
  213.     repeat with xxx = 1 to 27
  214.       set aaa to getAt(mouthindex, xxx)
  215.       if aaa = 11 then
  216.         set ccc to 0
  217.       else
  218.         set ccc to getAt(tempmouth, aaa)
  219.       end if
  220.       append(voicegraph, ccc)
  221.     end repeat
  222.     set lastvoice to who
  223.   end if
  224. end
  225.  
  226. on novoice Channel
  227.   global voicestate, voicespot, voicegraph
  228.   if voicestate > 0 then
  229.     set the castNum of sprite voicespot to getAt(voicegraph, 27)
  230.     set voicestate to 0
  231.     if Channel = 2 then
  232.       sound stop 2
  233.     end if
  234.     puppetSound(0)
  235.     puppetSprite(voicespot, 0)
  236.   end if
  237. end
  238.  
  239. on ChannelVoice2 where2, who2, saywhat2, what2, sample2
  240.   global voicestate2, mouthoff2, voicegraph2, soundgraph2, voicestring2, voicelength2, voicespot2, voicestep2, oldtime2, oldmouth2, oldface2, facespot2, oldxface2, oldyface2, lastvoice2
  241.   if sample2 = 11 then
  242.     set sample2 to 11025
  243.   end if
  244.   if sample2 = 22 then
  245.     set sample2 to 22050
  246.   end if
  247.   set voicestate2 to 1
  248.   if lastvoice2 <> who2 then
  249.     set mouthindex2 to [2, 8, 6, 11, 3, 10, 6, 11, 2, 5, 6, 9, 8, 6, 4, 8, 7, 6, 6, 11, 5, 10, 7, 3, 6, 6, 1]
  250.     set stuffumouth2 to [EMPTY, "A", "E", "O", "U", "C", "W", "M", "L", "F"]
  251.     set tempmouth2 to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  252.     repeat with xxx2 = 1 to 10
  253.       set bbb2 to getAt(stuffumouth2, xxx2) & who2
  254.       set bee2 to the number of member bbb2
  255.       preLoadCast(bee2)
  256.       setAt(tempmouth2, xxx2, bee2)
  257.     end repeat
  258.     set voicegraph2 to []
  259.     repeat with xxx2 = 1 to 27
  260.       set aaa2 to getAt(mouthindex2, xxx2)
  261.       if aaa2 = 11 then
  262.         set ccc2 to 0
  263.       else
  264.         set ccc2 to getAt(tempmouth2, aaa2)
  265.       end if
  266.       append(voicegraph2, ccc2)
  267.     end repeat
  268.     set lastvoice2 to who2
  269.   end if
  270.   set soundgraph2 to the number of member saywhat2
  271.   set voicestring2 to what2
  272.   set oldxface2 to -2000
  273.   set oldyface2 to -2000
  274.   set facespot2 to integer(where2 / 100)
  275.   set voicespot2 to where2 - (facespot2 * 100)
  276.   set ddd2 to getAt(voicegraph2, 27)
  277.   if (soundgraph2 = 0) or (ddd2 = 0) then
  278.     set voicestate2 to 0
  279.     exit
  280.   end if
  281.   puppetSprite(voicespot2, 1)
  282.   set voicelength2 to the size of cast soundgraph2 + 0.01
  283.   if the machineType = 256 then
  284.     set voicelength2 to voicelength2 + (sample2 / 4)
  285.     set voicestring2 to " " & voicestring2
  286.     set what2 to " " & what2
  287.     if soundBusy(1) or soundBusy(2) then
  288.       set voicelength2 to voicelength2 + (sample2 / 2)
  289.       set voicestring2 to "      " & voicestring2
  290.       set what2 to "      " & what2
  291.     end if
  292.   end if
  293.   set voicestep2 to float(voicelength2 * 60 / sample2) / float(length(what2))
  294.   set voicelength2 to float(voicelength2 / sample2) * 60.00001000000000317
  295.   set oldtime2 to mouthoff2
  296.   set oldmouth2 to 20000
  297.   set oldface2 to ddd2
  298.   set mouthoff2 to the timer
  299.   voiceupkeep2()
  300.   set mouthoff2 to the timer
  301. end
  302.  
  303. on PuppetVoice2 where2, who2, saywhat2, what2, sample2
  304.   global voicestate2, mouthoff2, voicegraph2, soundgraph2, voicestring2, voicelength2, voicespot2, voicestep2, oldtime2, oldmouth2, oldface2, facespot2, oldxface2, oldyface2, lastvoice2
  305.   if sample2 = 11 then
  306.     set sample2 to 11025
  307.   end if
  308.   if sample2 = 22 then
  309.     set sample2 to 22050
  310.   end if
  311.   set voicestate2 to 1
  312.   if lastvoice2 <> who2 then
  313.     set mouthindex2 to [2, 8, 6, 11, 3, 10, 6, 11, 2, 5, 6, 9, 8, 6, 4, 8, 7, 6, 6, 11, 5, 10, 7, 3, 6, 6, 1]
  314.     set stuffumouth2 to [EMPTY, "A", "E", "O", "U", "C", "W", "M", "L", "F"]
  315.     set tempmouth2 to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  316.     repeat with xxx2 = 1 to 10
  317.       set bbb2 to getAt(stuffumouth2, xxx2) & who2
  318.       set bee2 to the number of member bbb2
  319.       preLoadCast(bee2)
  320.       setAt(tempmouth2, xxx2, bee2)
  321.     end repeat
  322.     set voicegraph2 to []
  323.     repeat with xxx2 = 1 to 27
  324.       set aaa2 to getAt(mouthindex2, xxx2)
  325.       if aaa2 = 11 then
  326.         set ccc2 to 0
  327.       else
  328.         set ccc2 to getAt(tempmouth2, aaa2)
  329.       end if
  330.       append(voicegraph2, ccc2)
  331.     end repeat
  332.     set lastvoice2 to who2
  333.   end if
  334.   set soundgraph2 to the number of member saywhat2
  335.   set voicestring2 to what2
  336.   set oldxface2 to -2000
  337.   set oldyface2 to -2000
  338.   set facespot2 to integer(where2 / 100)
  339.   set voicespot2 to where2 - (facespot2 * 100)
  340.   set ddd2 to getAt(voicegraph2, 27)
  341.   if (soundgraph2 = 0) or (ddd2 = 0) then
  342.     novoice2()
  343.     exit
  344.   end if
  345.   puppetSprite(voicespot2, 1)
  346.   set voicelength2 to the size of cast soundgraph2 + 0.01
  347.   if the machineType = 256 then
  348.     set voicelength2 to voicelength2 + (sample2 / 4)
  349.     set voicestring2 to " " & voicestring2
  350.     set what2 to " " & what2
  351.     if soundBusy(1) or soundBusy(2) then
  352.       set voicelength2 to voicelength2 + (sample2 / 2)
  353.       set voicestring2 to "      " & voicestring2
  354.       set what2 to "      " & what2
  355.     end if
  356.   end if
  357.   set voicestep2 to float(voicelength2 * 60 / sample2) / float(length(what2))
  358.   set voicelength2 to float(voicelength2 / sample2) * 60.00001000000000317
  359.   set oldtime2 to mouthoff2
  360.   set oldmouth2 to 20000
  361.   set oldface2 to ddd2
  362.   puppetSound(saywhat2)
  363.   updateStage()
  364.   set mouthoff2 to the timer
  365.   voiceupkeep2()
  366.   set mouthoff2 to the timer
  367. end
  368.  
  369. on voiceupkeep2
  370.   global voicestate2, mouthoff2, voicegraph2, soundgraph2, voicestring2, voicelength2, voicespot2, voicestep2, oldtime2, oldmouth2, oldface2, facespot2, oldxface2, oldyface2
  371.   if voicestate2 = 1 then
  372.     if facespot2 > 0 then
  373.       set xxx2 to the locH of sprite facespot2
  374.       set yyy2 to the locV of sprite facespot2
  375.       if (xxx2 <> oldxface2) or (yyy2 <> oldyface2) then
  376.         set the locH of sprite voicespot2 to xxx2
  377.         set the locV of sprite voicespot2 to yyy2
  378.         set oldxface2 to xxx2
  379.         set oldyface2 to yyy2
  380.       end if
  381.     end if
  382.     set timefor2 to the timer
  383.     set ack2 to timefor2 - mouthoff2
  384.     if ack2 < 0 then
  385.       set mouthoff2 to mouthoff2 - oldtime2
  386.       set ack2 to timefor2 - mouthoff2
  387.     end if
  388.     if ack2 > (voicelength2 + 1) then
  389.       novoice2()
  390.       exit
  391.     end if
  392.     set oldtime2 to timefor2
  393.     set pbsst2 to integer(ack2 / voicestep2) + 1
  394.     if pbsst2 = oldmouth2 then
  395.       exit
  396.     end if
  397.     set oldmouth2 to pbsst2
  398.     set inchar2 to char pbsst2 of voicestring2
  399.     set invalue2 to charToNum(inchar2)
  400.     set newface2 to 0
  401.     if inchar2 = " " then
  402.       set newface2 to getAt(voicegraph2, 27)
  403.     else
  404.       if (invalue2 > 64) and (invalue2 < 91) then
  405.         set newface2 to getAt(voicegraph2, invalue2 - 64)
  406.       else
  407.         if (invalue2 > 96) and (invalue2 < 124) then
  408.           set newface2 to getAt(voicegraph2, invalue2 - 96)
  409.         end if
  410.       end if
  411.     end if
  412.     if newface2 = 0 then
  413.       set pink2 to random(13)
  414.       if pink2 = 11 then
  415.         set newface2 to getAt(voicegraph2, 3)
  416.       else
  417.         if pink2 > 11 then
  418.           set newface2 to getAt(voicegraph2, 12)
  419.         else
  420.           set newface2 to getAt(voicegraph2, 9)
  421.         end if
  422.       end if
  423.     end if
  424.     if (newface2 = 0) or (newface2 = oldface2) then
  425.       exit
  426.     end if
  427.     set the castNum of sprite voicespot2 to newface2
  428.     set oldface2 to newface2
  429.   end if
  430. end
  431.  
  432. on VoicePreset2 who2
  433.   global lastvoice2, voicegraph2
  434.   if lastvoice2 <> who2 then
  435.     set mouthindex2 to [2, 8, 6, 11, 3, 10, 6, 11, 2, 5, 6, 9, 8, 6, 4, 8, 7, 6, 6, 11, 5, 10, 7, 3, 6, 6, 1]
  436.     set stuffumouth2 to [EMPTY, "A", "E", "O", "U", "C", "W", "M", "L", "F"]
  437.     set tempmouth2 to [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  438.     repeat with xxx2 = 1 to 10
  439.       set bbb2 to getAt(stuffumouth2, xxx2) & who2
  440.       set bee2 to the number of member bbb2
  441.       preLoadCast(bee2)
  442.       setAt(tempmouth2, xxx2, bee2)
  443.     end repeat
  444.     set voicegraph2 to []
  445.     repeat with xxx2 = 1 to 27
  446.       set aaa2 to getAt(mouthindex2, xxx2)
  447.       if aaa2 = 11 then
  448.         set ccc2 to 0
  449.       else
  450.         set ccc2 to getAt(tempmouth2, aaa2)
  451.       end if
  452.       append(voicegraph2, ccc2)
  453.     end repeat
  454.     set lastvoice2 to who2
  455.   end if
  456. end
  457.  
  458. on novoice2 Channel2
  459.   global voicestate2, voicespot2, voicegraph2
  460.   if voicestate2 > 0 then
  461.     set the castNum of sprite voicespot2 to getAt(voicegraph2, 27)
  462.     set voicestate2 to 0
  463.     if Channel2 = 2 then
  464.       sound stop 2
  465.     end if
  466.     puppetSound(0)
  467.     puppetSprite(voicespot2, 0)
  468.   end if
  469. end
  470.