home *** CD-ROM | disk | FTP | other *** search
/ Sound, Music & MIDI Collection 2 / SMMVOL2.bin / DEMO / PRG / CIRCLES.ZIP / CI_MAIN.DIX / 00012_FAC&ARR.ls < prev    next >
Encoding:
Text File  |  1995-05-01  |  6.5 KB  |  264 lines

  1. on InitializeArrays
  2.   global AR1idx, Ar1sound, Ar1time, Ar1Vol, ar1seg, ar1pos, Ar1col, Ar1Sprite, ar1cast, Ar1play, ARCiidx, ArCitime, ArCitrack, ArCisndcast, ArCiSeg, Ar1track, ArCiname, vsprites
  3.   set AR1idx to Array(mnew)
  4.   set Ar1sound to Array(mnew)
  5.   set Ar1time to Array(mnew)
  6.   set Ar1Vol to Array(mnew)
  7.   set ar1seg to Array(mnew)
  8.   set ar1pos to Array(mnew)
  9.   set Ar1col to Array(mnew)
  10.   set Ar1Sprite to Array(mnew)
  11.   set ar1cast to Array(mnew)
  12.   set Ar1play to Array(mnew)
  13.   set Ar1track to Array(mnew)
  14.   set ARCiidx to Array(mnew)
  15.   set ArCitime to Array(mnew)
  16.   set ArCitrack to Array(mnew)
  17.   set ArCisndcast to Array(mnew)
  18.   set ArCiSeg to Array(mnew)
  19.   set ArCiname to Array(mnew)
  20.   set vsprites to Array(mnew)
  21. end
  22.  
  23. on KillArrays
  24.   global AR1idx, Ar1sound, Ar1time, Ar1Vol, ar1seg, ar1pos, Ar1Len, Ar1Sprite, ar1cast, Ar1play, ARCiidx, ArCitime, ArCitrack, ArCisndcast, ArCiSeg, Ar1track, ArCiname, vsprites
  25.   AR1idx(mdispose)
  26.   Ar1sound(mdispose)
  27.   Ar1time(mdispose)
  28.   Ar1Vol(mdispose)
  29.   ar1seg(mdispose)
  30.   ar1pos(mdispose)
  31.   Ar1col(mdispose)
  32.   Ar1Sprite(mdispose)
  33.   ar1cast(mdispose)
  34.   Ar1play(mdispose)
  35.   Ar1track(mdispose)
  36.   ARCiidx(mdispose)
  37.   ArCitime(mdispose)
  38.   ArCitrack(mdispose)
  39.   ArCisndcast(mdispose)
  40.   ArCiSeg(mdispose)
  41.   ArCiname(mdispose)
  42.   vsprites(mdispose)
  43. end
  44.  
  45. on InitSprites
  46.   global Sp_idx, Sp_cast, Sp_locH, Sp_locV, Sp_ink, Sp_visib, Sp_name, Sp_fore, Sp_back, Sp_stch, Sp_stcv
  47.   return 
  48.   set Sp_idx to Array(mnew)
  49.   set Sp_cast to Array(mnew)
  50.   set Sp_locH to Array(mnew)
  51.   set Sp_locV to Array(mnew)
  52.   set Sp_ink to Array(mnew)
  53.   set Sp_visib to Array(mnew)
  54.   set Sp_name to Array(mnew)
  55.   set Sp_fore to Array(mnew)
  56.   set Sp_back to Array(mnew)
  57.   set Sp_stch to Array(mnew)
  58.   set Sp_stcv to Array(mnew)
  59. end
  60.  
  61. on KillSprites
  62.   global Sp_idx, Sp_cast, Sp_locH, Sp_locV, Sp_ink, Sp_visib, Sp_name, Sp_fore, Sp_back, Sp_stch, Sp_stcv
  63.   Sp_idx(mdispose)
  64.   Sp_cast(mdispose)
  65.   Sp_locH(mdispose)
  66.   Sp_locV(mdispose)
  67.   Sp_ink(mdispose)
  68.   Sp_visib(mdispose)
  69.   Sp_name(mdispose)
  70.   Sp_fore(mdispose)
  71.   Sp_back(mdispose)
  72.   Sp_stch(mdispose)
  73.   Sp_stcv(mdispose)
  74.   return 
  75. end
  76.  
  77. on ar_get fieldname, fieldval
  78.   global maxsegs, segcol, segsprite
  79.   if fieldname = "IDX" then
  80.     set i to 25
  81.   end if
  82.   if fieldname = "SOUND" then
  83.     repeat with i = 1 to 25
  84.       if fieldval = Ar1sound(mget, i) then
  85.         exit repeat
  86.       end if
  87.     end repeat
  88.   end if
  89.   if fieldname = "TIME" then
  90.     repeat with i = 1 to 25
  91.       if fieldval = Ar1time(mget, i) then
  92.         exit repeat
  93.       end if
  94.     end repeat
  95.   end if
  96.   if fieldname = "VOL" then
  97.     repeat with i = 1 to 25
  98.       if fieldval = Ar1Vol(mget, i) then
  99.         exit repeat
  100.       end if
  101.     end repeat
  102.   end if
  103.   if fieldname = "SEG" then
  104.     repeat with i = 1 to 25
  105.       if fieldval = ar1seg(mget, i) then
  106.         exit repeat
  107.       end if
  108.     end repeat
  109.   end if
  110.   if fieldname = "POS" then
  111.     repeat with i = 1 to 25
  112.       if fieldval = ar1pos(mget, i) then
  113.         exit repeat
  114.       end if
  115.     end repeat
  116.   end if
  117.   if fieldname = "COL" then
  118.     repeat with i = 1 to 25
  119.       if fieldval = Ar1col(mget, i) then
  120.         exit repeat
  121.       end if
  122.     end repeat
  123.   end if
  124.   if fieldname = "SPRITE" then
  125.     repeat with i = 1 to 25
  126.       if fieldval = Ar1Sprite(mget, i) then
  127.         exit repeat
  128.       end if
  129.     end repeat
  130.   end if
  131.   if fieldname = "CAST" then
  132.     repeat with i = 1 to 25
  133.       if fieldval = ar1cast(mget, i) then
  134.         exit repeat
  135.       end if
  136.     end repeat
  137.   end if
  138.   if fieldname = "PLAY" then
  139.     repeat with i = 1 to 25
  140.       if fieldval = Ar1play(mget, i) then
  141.         exit repeat
  142.       end if
  143.     end repeat
  144.   end if
  145.   if i = 25 then
  146.     put "AR_GET:>" & fieldname & "< val:>" & fieldval & "< i:>" & i
  147.   end if
  148.   return i
  149. end
  150.  
  151. on clear_ARidx
  152.   repeat with i = 1 to 25
  153.     if AR1idx(mget, i) <> 0 then
  154.       AR1idx(mput, i, 0)
  155.     end if
  156.     if ar1seg(mget, i) <> 0 then
  157.       ar1seg(mput, i, 0)
  158.     end if
  159.     if ar1pos(mget, i) <> 0 then
  160.       ar1pos(mput, i, 0)
  161.     end if
  162.   end repeat
  163. end
  164.  
  165. on ar_pos2idx track, pos
  166.   if track = 12 then
  167.     set pos to pos - 12
  168.   end if
  169.   set spos to string(pos)
  170.   if length(spos) < 2 then
  171.     set spos to "0" & spos
  172.   end if
  173.   set retidx to 0
  174.   repeat with i = 1 to 12
  175.     if spos = ar1pos(mget, i + track) then
  176.       set retidx to i + track
  177.       exit repeat
  178.     end if
  179.   end repeat
  180.   return retidx
  181. end
  182.  
  183. on ar_pos2idxstop track, pos
  184.   if track = 12 then
  185.     set pos to pos - 12
  186.   end if
  187.   set spos to string(pos)
  188.   if length(spos) < 2 then
  189.     set spos to "0" & spos
  190.   end if
  191.   set retidx to 0
  192.   repeat with i = 1 to 12
  193.     if spos = (ar1pos(mget, i + track) + ar1seg(mget, i + track) - 1) then
  194.       set retidx to i + track
  195.       exit repeat
  196.     end if
  197.   end repeat
  198.   return retidx
  199. end
  200.  
  201. factory WALK
  202. method mnew ledidx
  203.   set tmpsprite to getspritenum("WALK")
  204.   set x to value(chars(ARLEDs(mget, ledidx), 2, 4))
  205.   set y to value(chars(ARLEDs(mget, ledidx), 5, 7))
  206.   sprite_show(tmpsprite, x, y)
  207.  
  208. method mrelease
  209.   set tmpsprite to getspritenum("WALK")
  210.   sprite_blank(tmpsprite)
  211.  
  212. method mmove ledidx
  213.   set tmpsprite to getspritenum("WALK")
  214.   set x to value(chars(ARLEDs(mget, ledidx), 2, 4))
  215.   set y to value(chars(ARLEDs(mget, ledidx), 5, 7))
  216.   set the locH of sprite tmpsprite to x
  217.   set the locV of sprite tmpsprite to y
  218.  
  219. factory LEDS
  220. method mnew x, y
  221.   global reqLEDidx, areon
  222.   if areon = 0 then
  223.     put "Lon>" & areon
  224.     set tmpsprite to getspritenum("LED1")
  225.     set the castNum of sprite tmpsprite to the number of cast "LED1"
  226.   else
  227.     put "Lon>" & areon
  228.     set tmpsprite to getspritenum("LED2")
  229.     set the castNum of sprite tmpsprite to the number of cast "LED2"
  230.   end if
  231.   set the locH of sprite tmpsprite to x
  232.   set the locV of sprite tmpsprite to y
  233.   set the ink of sprite tmpsprite to 36
  234.   puppetSprite(tmpsprite, 1)
  235.  
  236. method mrelease sp
  237.   sprite_blank(sp)
  238.  
  239. method mmove sp, x, y
  240.   set the locH of sprite sp to x
  241.   set the locV of sprite sp to y
  242.  
  243. factory SEGMENTS
  244. method mnew track, pos, len, col, cast, idx
  245.   instance enterFrame, TSprite, TCol
  246.   global vTSprite, objectCount, gTrack, gPos, GLen, gcast, gXp, gYp
  247.   set TCol to 0
  248.   set TSprite to objectCount
  249.   set the puppet of sprite TSprite to 1
  250.   set the castNum of sprite TSprite to the number of cast gcast
  251.   set the locH of sprite TSprite to gXp
  252.   set the locV of sprite TSprite to gYp
  253.   set the ink of sprite TSprite to 8
  254.   set the foreColor of sprite TSprite to col
  255.   ar1cast(mput, idx, gcast)
  256.   Ar1Sprite(mput, idx, TSprite)
  257.   Ar1col(mput, idx, col)
  258.   set vTSprite to TSprite
  259.  
  260. method mrelease
  261.   set the locH of sprite TSprite to 1500
  262.   set the locV of sprite TSprite to 1500
  263.   set the puppet of sprite TSprite to 0
  264.