home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / Silhouette.dxr / 00014.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  5.2 KB  |  135 lines

  1. on scanRemovals
  2.   global shadowShapeData, shadowSpinData, blankMapData, solidData, levelWidth
  3.   vTestAData = blankMapData
  4.   totalScores = 0
  5.   levelWidth = 7
  6.   levelheight = 8
  7.   repeat with whichX = 1 to levelWidth
  8.     repeat with whichY = 1 to levelheight
  9.       if whichY <= (levelheight - 1) then
  10.         testCore = shadowShapeData[whichY][whichX]
  11.         if shadowShapeData[whichY][whichX] <> 0 then
  12.           if shadowShapeData[whichY + 1][whichX] = testCore then
  13.             shadowShapeData[whichY][whichX] = 0
  14.             shadowShapeData[whichY + 1][whichX] = 0
  15.             totalScores = totalScores + 1
  16.           end if
  17.         end if
  18.       end if
  19.     end repeat
  20.   end repeat
  21. end
  22.  
  23. on scanConnections
  24.   global shadowShapeData, shadowSpinData, shadowSolidData, blankMapData, solidData, levelWidth, playerScore, playerlevel
  25.   vTestAData = blankMapData
  26.   totalScores = 0
  27.   levelWidth = 7
  28.   levelheight = 8
  29.   removalMap = []
  30.   repeat with wY = 1 to levelheight
  31.     oneLiner = []
  32.     repeat with wX = 1 to levelWidth
  33.       add(oneLiner, 0)
  34.     end repeat
  35.     add(removalMap, oneLiner)
  36.   end repeat
  37.   totalEliminations = 0
  38.   repeat with whichX = 1 to levelWidth
  39.     repeat with whichY = 1 to levelheight
  40.       if whichX <= (levelWidth - 2) then
  41.         testCore = shadowShapeData[whichY][whichX]
  42.         testSpinny = shadowSpinData[whichY][whichX]
  43.         if shadowShapeData[whichY][whichX] <> 0 then
  44.           if shadowShapeData[whichY][whichX + 1] = testCore then
  45.             if shadowShapeData[whichY][whichX + 2] = testCore then
  46.               if shadowSpinData[whichY][whichX + 1] = testSpinny then
  47.                 if shadowSpinData[whichY][whichX + 2] = testSpinny then
  48.                   if (shadowSolidData[whichY][whichX] = 0) or (shadowSolidData[whichY][whichX + 1] = 0) or (shadowSolidData[whichY][whichX + 2] = 0) then
  49.                     removalMap[whichY][whichX] = 1
  50.                     removalMap[whichY][whichX + 1] = 1
  51.                     removalMap[whichY][whichX + 2] = 1
  52.                     repeat with wVector = 1 to 3
  53.                       case shadowSolidData[whichY][whichX - 1 + wVector] of
  54.                         0:
  55.                           totalEliminations = totalEliminations + 1
  56.                         1:
  57.                           totalEliminations = totalEliminations + 5
  58.                       end case
  59.                     end repeat
  60.                     shadowSolidData[whichY][whichX] = 0
  61.                     shadowSolidData[whichY][whichX + 1] = 0
  62.                     shadowSolidData[whichY][whichX + 2] = 0
  63.                   end if
  64.                 end if
  65.               end if
  66.             end if
  67.           end if
  68.         end if
  69.       end if
  70.       if whichY <= (levelheight - 2) then
  71.         testCore = shadowShapeData[whichY][whichX]
  72.         testSpinny = shadowSpinData[whichY][whichX]
  73.         if shadowShapeData[whichY][whichX] <> 0 then
  74.           if shadowShapeData[whichY + 1][whichX] = testCore then
  75.             if shadowShapeData[whichY + 2][whichX] = testCore then
  76.               if shadowSpinData[whichY + 1][whichX] = testSpinny then
  77.                 if shadowSpinData[whichY + 2][whichX] = testSpinny then
  78.                   if (shadowSolidData[whichY][whichX] = 0) or (shadowSolidData[whichY + 1][whichX] = 0) or (shadowSolidData[whichY + 2][whichX] = 0) then
  79.                     removalMap[whichY][whichX] = 1
  80.                     removalMap[whichY + 1][whichX] = 1
  81.                     removalMap[whichY + 2][whichX] = 1
  82.                     repeat with wVector = 1 to 3
  83.                       case shadowSolidData[whichY - 1 + wVector][whichX] of
  84.                         0:
  85.                           totalEliminations = totalEliminations + 1
  86.                         1:
  87.                           totalEliminations = totalEliminations + 10
  88.                       end case
  89.                     end repeat
  90.                     shadowSolidData[whichY][whichX] = 0
  91.                     shadowSolidData[whichY + 1][whichX] = 0
  92.                     shadowSolidData[whichY + 2][whichX] = 0
  93.                   end if
  94.                 end if
  95.               end if
  96.             end if
  97.           end if
  98.         end if
  99.       end if
  100.     end repeat
  101.   end repeat
  102.   if totalEliminations > 0 then
  103.     playerScore = playerScore + (totalEliminations * 10)
  104.     member("Score Display").text = string(playerScore)
  105.     totalScores = 0
  106.     totalShadowBLocks = 0
  107.     repeat with whichX = 1 to levelWidth
  108.       repeat with whichY = 1 to levelheight
  109.         if removalMap[whichY][whichX] = 1 then
  110.           shadowShapeData[whichY][whichX] = 0
  111.           totalScores = totalScores + 1
  112.         end if
  113.         if shadowSolidData[whichY][whichX] = 1 then
  114.           totalShadowBLocks = totalShadowBLocks + 1
  115.         end if
  116.       end repeat
  117.     end repeat
  118.     member("Blocks Display").text = string(totalShadowBLocks)
  119.     member("Level Display").text = string(playerlevel)
  120.   end if
  121. end
  122.  
  123. on updateShadowDisplay
  124.   global shadowSolidData, shadowShapeData, levelWidth, levelheight
  125.   totalShadowBLocks = 0
  126.   repeat with whichX = 1 to levelWidth
  127.     repeat with whichY = 1 to count(shadowSolidData)
  128.       if shadowSolidData[whichY][whichX] = 1 then
  129.         totalShadowBLocks = totalShadowBLocks + 1
  130.       end if
  131.     end repeat
  132.   end repeat
  133.   member("Blocks Display").text = string(totalShadowBLocks)
  134. end
  135.