mirror of
https://github.com/irmen/prog8.git
synced 2024-07-09 17:29:46 +00:00
simplified tehtris collision check a bit
This commit is contained in:
parent
06f0984fa1
commit
3a6fae4447
@ -337,14 +337,14 @@ waitkey:
|
|||||||
|
|
||||||
sub canRotateCW() -> ubyte {
|
sub canRotateCW() -> ubyte {
|
||||||
rotateCW()
|
rotateCW()
|
||||||
ubyte okay ; TODO determine
|
ubyte okay=true ; TODO determine
|
||||||
rotateCCW()
|
rotateCCW()
|
||||||
return okay
|
return okay
|
||||||
}
|
}
|
||||||
|
|
||||||
sub canRotateCCW() -> ubyte {
|
sub canRotateCCW() -> ubyte {
|
||||||
rotateCCW()
|
rotateCCW()
|
||||||
ubyte okay ; TODO determine
|
ubyte okay=true ; TODO determine
|
||||||
rotateCW()
|
rotateCW()
|
||||||
return okay
|
return okay
|
||||||
}
|
}
|
||||||
@ -364,48 +364,22 @@ waitkey:
|
|||||||
sub canActuallyMoveLeft(ubyte xpos, ubyte ypos) -> ubyte {
|
sub canActuallyMoveLeft(ubyte xpos, ubyte ypos) -> ubyte {
|
||||||
; @todo make this a generic subroutine that also works to check right and bottom collisions...
|
; @todo make this a generic subroutine that also works to check right and bottom collisions...
|
||||||
|
|
||||||
ubyte x = xpos-1
|
return not (currentBlock[0] and c64scr.getchr(xpos-1, ypos)!=32
|
||||||
ubyte yp1 = ypos+1
|
or currentBlock[1] and c64scr.getchr(xpos, ypos)!=32
|
||||||
ubyte yp2 = ypos+2
|
or currentBlock[2] and c64scr.getchr(xpos+1, ypos)!=32
|
||||||
ubyte yp3 = ypos+3
|
or currentBlock[3] and c64scr.getchr(xpos+2, ypos)!=32
|
||||||
|
or currentBlock[4] and c64scr.getchr(xpos-1, ypos+1)!=32
|
||||||
if(currentBlock[0] and c64scr.getchr(x, ypos)!=32)
|
or currentBlock[5] and c64scr.getchr(xpos, ypos+1)!=32
|
||||||
return false
|
or currentBlock[6] and c64scr.getchr(xpos+1, ypos+1)!=32
|
||||||
if(currentBlock[4] and c64scr.getchr(x, yp1)!=32)
|
or currentBlock[7] and c64scr.getchr(xpos+2, ypos+1)!=32
|
||||||
return false
|
or currentBlock[8] and c64scr.getchr(xpos-1, ypos+2)!=32
|
||||||
if(currentBlock[8] and c64scr.getchr(x, yp2)!=32)
|
or currentBlock[9] and c64scr.getchr(xpos, ypos+2)!=32
|
||||||
return false
|
or currentBlock[10] and c64scr.getchr(xpos+1, ypos+2)!=32
|
||||||
if(currentBlock[12] and c64scr.getchr(x, yp3)!=32)
|
or currentBlock[11] and c64scr.getchr(xpos+2, ypos+2)!=32
|
||||||
return false
|
or currentBlock[12] and c64scr.getchr(xpos-1, ypos+3)!=32
|
||||||
x++
|
or currentBlock[13] and c64scr.getchr(xpos, ypos+3)!=32
|
||||||
if(currentBlock[1] and c64scr.getchr(x, ypos)!=32)
|
or currentBlock[14] and c64scr.getchr(xpos+1, ypos+3)!=32
|
||||||
return false
|
or currentBlock[15] and c64scr.getchr(xpos+2, ypos+3)!=32)
|
||||||
if(currentBlock[5] and c64scr.getchr(x, yp1)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[9] and c64scr.getchr(x, yp2)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[13] and c64scr.getchr(x, yp3)!=32)
|
|
||||||
return false
|
|
||||||
x++
|
|
||||||
if(currentBlock[2] and c64scr.getchr(x, ypos)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[6] and c64scr.getchr(x, yp1)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[10] and c64scr.getchr(x, yp2)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[14] and c64scr.getchr(x, yp3)!=32)
|
|
||||||
return false
|
|
||||||
x++
|
|
||||||
if(currentBlock[3] and c64scr.getchr(x, ypos)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[7] and c64scr.getchr(x, yp1)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[11] and c64scr.getchr(x, yp2)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[15] and c64scr.getchr(x, yp3)!=32)
|
|
||||||
return false
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,48 +394,22 @@ waitkey:
|
|||||||
|
|
||||||
; @todo use the generic subroutine that also works to check right and bottom collisions...
|
; @todo use the generic subroutine that also works to check right and bottom collisions...
|
||||||
|
|
||||||
ubyte x = xpos+4
|
return not (currentBlock[0] and c64scr.getchr(xpos+1, ypos)!=32
|
||||||
ubyte yp1 = ypos+1
|
or currentBlock[1] and c64scr.getchr(xpos+2, ypos)!=32
|
||||||
ubyte yp2 = ypos+2
|
or currentBlock[2] and c64scr.getchr(xpos+3, ypos)!=32
|
||||||
ubyte yp3 = ypos+3
|
or currentBlock[3] and c64scr.getchr(xpos+4, ypos)!=32
|
||||||
|
or currentBlock[4] and c64scr.getchr(xpos+1, ypos+1)!=32
|
||||||
if(currentBlock[3] and c64scr.getchr(x, ypos)!=32)
|
or currentBlock[5] and c64scr.getchr(xpos+2, ypos+1)!=32
|
||||||
return false
|
or currentBlock[6] and c64scr.getchr(xpos+3, ypos+1)!=32
|
||||||
if(currentBlock[7] and c64scr.getchr(x, yp1)!=32)
|
or currentBlock[7] and c64scr.getchr(xpos+4, ypos+1)!=32
|
||||||
return false
|
or currentBlock[8] and c64scr.getchr(xpos+1, ypos+2)!=32
|
||||||
if(currentBlock[11] and c64scr.getchr(x, yp2)!=32)
|
or currentBlock[9] and c64scr.getchr(xpos+2, ypos+2)!=32
|
||||||
return false
|
or currentBlock[10] and c64scr.getchr(xpos+3, ypos+2)!=32
|
||||||
if(currentBlock[15] and c64scr.getchr(x, yp3)!=32)
|
or currentBlock[11] and c64scr.getchr(xpos+4, ypos+2)!=32
|
||||||
return false
|
or currentBlock[12] and c64scr.getchr(xpos+1, ypos+3)!=32
|
||||||
x--
|
or currentBlock[13] and c64scr.getchr(xpos+2, ypos+3)!=32
|
||||||
if(currentBlock[2] and c64scr.getchr(x, ypos)!=32)
|
or currentBlock[14] and c64scr.getchr(xpos+3, ypos+3)!=32
|
||||||
return false
|
or currentBlock[15] and c64scr.getchr(xpos+4, ypos+3)!=32)
|
||||||
if(currentBlock[6] and c64scr.getchr(x, yp1)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[10] and c64scr.getchr(x, yp2)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[14] and c64scr.getchr(x, yp3)!=32)
|
|
||||||
return false
|
|
||||||
x--
|
|
||||||
if(currentBlock[1] and c64scr.getchr(x, ypos)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[5] and c64scr.getchr(x, yp1)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[9] and c64scr.getchr(x, yp2)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[13] and c64scr.getchr(x, yp3)!=32)
|
|
||||||
return false
|
|
||||||
x--
|
|
||||||
if(currentBlock[0] and c64scr.getchr(x, ypos)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[4] and c64scr.getchr(x, yp1)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[8] and c64scr.getchr(x, yp2)!=32)
|
|
||||||
return false
|
|
||||||
if(currentBlock[12] and c64scr.getchr(x, yp3)!=32)
|
|
||||||
return false
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user