home *** CD-ROM | disk | FTP | other *** search
- on calcScore
- global playerTMoves, playerTCaptures, playerTLosses, levelScore
- sBit1 = (50 - playerTMoves) * 20
- if sBit1 < 0 then
- sBit1 = 0
- end if
- sBit2 = playerTCaptures * 200
- sBit3 = playerTLosses * -100
- levelScore = sBit1 + sBit2 + sBit3
- if levelScore < 0 then
- levelScore = 0
- end if
- member("Level Score").text = string(levelScore)
- end
-
- on playSound whichSound, whichSlot
- global lastClear
- if whichSlot = 2 then
- sound(2).stop()
- sound(2).queue([#member: member(whichSound)])
- sound(2).play()
- else
- sound(1).stop()
- sound(1).queue([#member: member(whichSound)])
- sound(1).play()
- end if
- end
-
- on returnPiece testLoc
- global boardData
- pRank = #Na
- pSide = #Na
- if (testLoc[1] >= 1) and (testLoc[2] >= 1) and (testLoc[1] <= count(boardData[1])) and (testLoc[2] <= count(boardData)) then
- pieceType = boardData[testLoc[2]][testLoc[1]]
- else
- pieceType = #Na
- end if
- case pieceType of
- #Rp:
- pRank = 1
- pSide = 1
- #Bp:
- pRank = 1
- pSide = 2
- #Rk:
- pRank = 2
- pSide = 1
- #Bk:
- pRank = 2
- pSide = 2
- otherwise:
- pRank = 0
- pSide = 0
- end case
- return [pRank, pSide]
- end
-
- on testJumps testLoc, jumpPiece
- global boardData, moveTestResults, moveTestPositions
- jumpMode = #International
- jumpMode = #Traditional
- if jumpPiece = VOID then
- bData = returnPiece(testLoc)
- else
- bData = jumpPiece
- end if
- pStartRank = bData[1]
- pStartSide = bData[2]
- case jumpMode of
- #Traditional:
- if pStartRank = 2 then
- moveTest = [1, 1, 1, 1]
- else
- if pStartRank = 1 then
- if pStartSide = 1 then
- moveTest = [0, 0, 1, 1]
- else
- if pStartSide = 2 then
- moveTest = [1, 1, 0, 0]
- else
- moveTest = [1, 1, 1, 1]
- end if
- end if
- else
- moveTest = [0, 0, 0, 0]
- end if
- end if
- testVectors = [point(-1, -1), point(1, -1), point(-1, 1), point(1, 1)]
- moveTestResults = [0, 0, 0, 0]
- moveTestPositions = [0, 0, 0, 0]
- repeat with whichV = 1 to 4
- if moveTest[whichV] = 1 then
- pathlength = pathlength + 1
- pathLoc1 = testLoc + (testVectors[whichV] * 1)
- pathLoc2 = testLoc + (testVectors[whichV] * 2)
- obstacleDat1 = returnPiece(pathLoc1)
- obstacleDat2 = returnPiece(pathLoc2)
- squareTiles = count(boardData) + 1
- playRect = rect(1, 1, squareTiles, squareTiles)
- if (obstacleDat1[1] = 0) and inside(pathLoc1, playRect) then
- action = #move
- pPosition = pathLoc1
- else
- if (obstacleDat1[2] <> pStartSide) and (obstacleDat2[1] = 0) and inside(pathLoc2, playRect) then
- action = #Attack
- pPosition = pathLoc2
- else
- action = #Blocked
- pPosition = 0
- end if
- end if
- moveTestResults[whichV] = action
- moveTestPositions[whichV] = pPosition
- end if
- end repeat
- #International:
- end case
- end
-