git.shiar.nl
/
netris.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
various code cleanups
[netris.git]
/
board.c
diff --git
a/board.c
b/board.c
index b240c0ae05c3d23beccac9b98aef917e953c839c..26555809b4d1efdf8ecfcb0a67d8abf7653bdb31 100644
(file)
--- a/
board.c
+++ b/
board.c
@@
-160,7
+160,7
@@
int RefreshBoard(int scr)
for (y = Players[scr].boardVisible - 1; y >= 0; y--)
if ((c = changed[scr][y])) { //line changed
for (x = 0; c; (c >>= 1), x++)
for (y = Players[scr].boardVisible - 1; y >= 0; y--)
if ((c = changed[scr][y])) { //line changed
for (x = 0; c; (c >>= 1), x++)
- if (
(c & 1)
&& board[scr][y][x] != oldBoard[scr][y][x]) {
+ if (
c & 1
&& board[scr][y][x] != oldBoard[scr][y][x]) {
PlotBlock(scr, y, x, board[scr][y][x]);
oldBoard[scr][y][x] = board[scr][y][x];
}
PlotBlock(scr, y, x, board[scr][y][x]);
oldBoard[scr][y][x] = board[scr][y][x];
}
@@
-320,7
+320,7
@@
int CheckFall(int scr)
if (!Game.gravity) return 0;
for (y = Players[scr].boardHeight - 1; y > 0; y--)
for (x = 0; x < Players[scr].boardWidth; x++) {
if (!Game.gravity) return 0;
for (y = Players[scr].boardHeight - 1; y > 0; y--)
for (x = 0; x < Players[scr].boardWidth; x++) {
- if ((
(z = GetBlock(scr, y, x)) > BT_none) && ((z & 160) == 0)
) {
+ if ((
z = GetBlock(scr, y, x)) > BT_none && (z & 160) == 0
) {
//doesn't stick left/up => topleft block
if (BlockFree(scr, x, y, 240)) {
BlockFall(scr, x, y, 240);
//doesn't stick left/up => topleft block
if (BlockFree(scr, x, y, 240)) {
BlockFall(scr, x, y, 240);
@@
-360,9
+360,9
@@
int ClearFullLines(int scr)
while (LineIsFull(scr, from)) {
from++; //skip
for (x = 0; x<Players[scr].boardWidth; x++) {
while (LineIsFull(scr, from)) {
from++; //skip
for (x = 0; x<Players[scr].boardWidth; x++) {
- SetBlock(scr, from, x, GetBlock(scr, from, x)
&
239);
+ SetBlock(scr, from, x, GetBlock(scr, from, x)
&
239);
if (from > 1)
if (from > 1)
- SetBlock(scr, from-2, x, GetBlock(scr, from-2, x)
&
223);
+ SetBlock(scr, from-2, x, GetBlock(scr, from-2, x)
&
223);
} //don't stick blocks to line which we'll remove
} //full lines
CopyLine(scr, from++, to++);
} //don't stick blocks to line which we'll remove
} //full lines
CopyLine(scr, from++, to++);
@@
-387,7
+387,7
@@
void InsertJunk(int scr, int color, int count, int column)
CopyLine(scr, y, y + count);
for (y = 0; y < count; ++y)
for (x = 0; x < Players[scr].boardWidth; ++x)
CopyLine(scr, y, y + count);
for (y = 0; y < count; ++y)
for (x = 0; x < Players[scr].boardWidth; ++x)
- SetBlock(scr, y, x,
(x == column)
? BT_none : color + 1
+ SetBlock(scr, y, x,
x == column
? BT_none : color + 1
+ 64 * (x != column-1 && x < Players[scr].boardWidth-1)
+ 128 * (x != column+1 && x > 0));
Players[scr].curY += count; //move piece up..
+ 64 * (x != column-1 && x < Players[scr].boardWidth-1)
+ 128 * (x != column+1 && x > 0));
Players[scr].curY += count; //move piece up..