home *** CD-ROM | disk | FTP | other *** search
/ Mundo do CD-ROM 15 / MUNDO15.iso / entrete / Osmar / QUEBRA.DXR / 00102.ls < prev    next >
Encoding:
Text File  |  1997-10-13  |  6.3 KB  |  235 lines

  1. global objpossui
  2.  
  3. on startMovie
  4.   global SPOptions, SPCursor, mv, mh, OptionSelected, ObjSelected, notshow, OptionsCood, Optcur, objetosel
  5.   set SPOptions to 46
  6.   set SPCursor to 48
  7.   set OptionSelected to -1
  8.   set ObjSelected to 0
  9.   set objetosel to EMPTY
  10.   set notshow to 1
  11.   set mv to 0
  12.   set mh to 0
  13.   set OptionsCood to [-26, -62, 17, -19, -26, -18, 17, -1, -60, -18, -27, 40, 19, 5, 62, 48]
  14.   set Optcur to ["OptionsCursor1", "OptionsCursor2", "OptionsCursor3", "OptionsCursor4"]
  15.   puppetSprite(SPOptions, 1)
  16.   puppetSprite(SPOptions + 1, 1)
  17.   puppetSprite(SPCursor, 1)
  18.   cursor(200)
  19.   set the keyDownScript to "keydownhandle"
  20.   set the exitLock to 1
  21. end
  22.  
  23. on stopMovie
  24.   global SPCursor
  25.   set the visible of sprite SPCursor to 1
  26.   cursor(-1)
  27. end
  28.  
  29. on onstartmovie
  30.   InitFaseVars()
  31. end
  32.  
  33. on mouseover first, last
  34.   global Obj1, Obj2, Obj3, Obj4, Obj5, Obj6, Obj7, Obj8, Obj9, Obj10, SPCursor, ObjSelected, objsBegin, OverObj, objetosel, isSettingVolume
  35.   if isSettingVolume = 0 then
  36.     set i to -1
  37.     repeat with j = first to last
  38.       if rollOver(j) then
  39.         set i to j
  40.         exit repeat
  41.       end if
  42.       SetCursorPos()
  43.     end repeat
  44.     if i <> -1 then
  45.       set ObjSelected to i - objsBegin + 1
  46.       set OverObj to "Obj" & ObjSelected
  47.       set c to EMPTY
  48.       if objetosel <> EMPTY then
  49.         set c to objetosel & "Ativo"
  50.       else
  51.         do("set c = getaProp(" & OverObj & ",#cursor)")
  52.       end if
  53.       set the castNum of sprite SPCursor to cast c
  54.     else
  55.       if objetosel <> EMPTY then
  56.         set the castNum of sprite SPCursor to cast objetosel
  57.       else
  58.         set the castNum of sprite SPCursor to cast "CursorNormal"
  59.       end if
  60.       set ObjSelected to 0
  61.     end if
  62.   end if
  63. end
  64.  
  65. on ShowOptions MorK
  66.   global SPOptions, OptionSelected, SPCursor, gMorK, ObjSelected, ObjNames, objsBegin, OverObj, notshow
  67.   if notshow then
  68.     set OptionSelected to 0
  69.     set c to EMPTY
  70.     set gMorK to MorK
  71.     set spcv to the locV of sprite SPCursor
  72.     set spch to the locH of sprite SPCursor
  73.     set spcv to max(the height of cast the castNum of sprite SPOptions / 2, spcv)
  74.     set spcv to min(480 - (the height of cast the castNum of sprite SPOptions / 2), spcv)
  75.     set spch to max(the width of cast the castNum of sprite SPOptions / 2, spch)
  76.     set spch to min(640 - (the width of cast the castNum of sprite SPOptions / 2), spch)
  77.     if ObjSelected <> 0 then
  78.       do("set c = getaprop(" & OverObj & ",#nome)")
  79.       set c to c & "Cur"
  80.       set the castNum of sprite (SPOptions + 1) to cast c
  81.     else
  82.       set the castNum of sprite (SPOptions + 1) to cast "NomeObj"
  83.     end if
  84.     set the castNum of sprite SPOptions to cast "OptionsCursor"
  85.     set the castNum of sprite SPCursor to cast "CursorSelOptions"
  86.     set the locV of sprite SPOptions to spcv
  87.     set the locH of sprite SPOptions to spch
  88.     set the locV of sprite (SPOptions + 1) to spcv + 64
  89.     set the locH of sprite (SPOptions + 1) to spch + 1
  90.     updateStage()
  91.     set notshow to 0
  92.   else
  93.     pass()
  94.   end if
  95. end
  96.  
  97. on max x1, x2
  98.   if x2 > x1 then
  99.     return x2
  100.   else
  101.     return x1
  102.   end if
  103. end
  104.  
  105. on min x1, x2
  106.   if x2 < x1 then
  107.     return x2
  108.   else
  109.     return x1
  110.   end if
  111. end
  112.  
  113. on ChooseOption
  114.   global gMorK
  115.   SetCursorPos()
  116.   OptionsSelection()
  117.   if gMorK = 0 then
  118.     if the stillDown = 0 then
  119.     end if
  120.   end if
  121. end
  122.  
  123. on HideOptions
  124.   global OptionSelected, SPOptions, SPCursor
  125.   set the locV of sprite SPOptions to 600
  126.   set the locH of sprite SPOptions to 700
  127.   set the locV of sprite (SPOptions + 1) to 600
  128.   set the locH of sprite (SPOptions + 1) to 700
  129.   set the castNum of sprite SPCursor to cast "CursorNormal"
  130.   updateStage()
  131.   if OptionSelected <> 0 then
  132.     ExecutaOption()
  133.   end if
  134.   set OptionSelected to -1
  135. end
  136.  
  137. on OptionsSelection
  138.   global SPOptions, SPCursor, OptionSelected, OptionsCood, Optcur
  139.   set pv to the locV of sprite SPCursor - the locV of sprite SPOptions
  140.   set ph to the locH of sprite SPCursor - the locH of sprite SPOptions
  141.   set sel to 0
  142.   repeat with i = 1 to 4
  143.     if (ph >= getAt(OptionsCood, i + ((i - 1) * 3))) and (ph <= getAt(OptionsCood, i + 2 + ((i - 1) * 3))) and (pv >= getAt(OptionsCood, i + 1 + ((i - 1) * 3))) and (pv <= getAt(OptionsCood, i + 3 + ((i - 1) * 3))) then
  144.       set sel to i
  145.       exit repeat
  146.     end if
  147.   end repeat
  148.   if sel <> 0 then
  149.     set thecast to getAt(Optcur, sel)
  150.     if the number of member thecast <> the castNum of sprite SPOptions then
  151.       set the castNum of sprite SPOptions to cast thecast
  152.       set OptionSelected to sel
  153.     end if
  154.   else
  155.     set OC to the number of member "OptionsCursor"
  156.     if the castNum of sprite SPOptions <> OC then
  157.       set the castNum of sprite SPOptions to cast OC
  158.     end if
  159.     set OptionSelected to 0
  160.   end if
  161.   updateStage()
  162. end
  163.  
  164. on ExecutaOption
  165.   global Obj1, Obj2, Obj3, Obj4, Obj5, Obj6, Obj7, Obj8, Obj9, Obj10, OptionSelected, OverObj
  166.   set actions to ["#olho", "#boca", "#mao", "#Livro"]
  167.   set ac to EMPTY
  168.   do("set ac = getaProp(" & OverObj & "," & getAt(actions, OptionSelected) & ")")
  169.   do(ac)
  170. end
  171.  
  172. on ExecutaObjAction
  173.   global Obj1, Obj2, Obj3, Obj4, Obj5, Obj6, Obj7, Obj8, Obj9, Obj10, OptionSelected, OverObj, objetosel, ultimoobjsel
  174.   set ac to EMPTY
  175.   do("set ac = getaProp(" & OverObj & ",#obj)")
  176.   set objtmp to objetosel & "Ativo"
  177.   set ultimoobjsel to objetosel
  178.   set objetosel to EMPTY
  179.   if ac <> EMPTY then
  180.     if ac = objtmp then
  181.       do("set ac = getaProp(" & OverObj & ",#objact)")
  182.       do(ac & " true")
  183.     else
  184.       do("set ac = getaProp(" & OverObj & ",#objact)")
  185.       do(ac & " false")
  186.     end if
  187.   end if
  188. end
  189.  
  190. on SetCursorPos
  191.   global mv, mh, SPCursor, isSettingVolume
  192.   if isSettingVolume = 0 then
  193.     set the locV of sprite SPCursor to the mouseV
  194.     set the locH of sprite SPCursor to the mouseH
  195.   end if
  196. end
  197.  
  198. on keydownhandle
  199.   if (the key = "q") or (the key = "Q") then
  200.     go("sair")
  201.   end if
  202.   if (the key = "s") or (the key = "S") then
  203.     go("sair")
  204.   end if
  205. end
  206.  
  207. on mouseDownAction
  208.   global OverObj, objetosel, notshow
  209.   if notshow then
  210.     if objetosel = EMPTY then
  211.       set ac to EMPTY
  212.       do("set ac = getaProp(" & OverObj & ",#cursor)")
  213.       if ac = "CursorSobre" then
  214.         ShowOptions(0)
  215.       else
  216.         do("set ac = getaProp(" & OverObj & ",#direc)")
  217.         do(ac)
  218.       end if
  219.     else
  220.       ExecutaObjAction()
  221.     end if
  222.   else
  223.     pass()
  224.   end if
  225. end
  226.  
  227. on showText thecast
  228.   put thecast
  229.   play frame thecast
  230. end
  231.  
  232. on SetCursor thecur
  233.   cursor([cast thecur, cast (thecur & "Mask")])
  234. end
  235.