* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: board.c,v 1.15 1999/05/16 06:56:24 mhw Exp $
*/
#include "netris.h"
int i, j, result;
char type, rotation;
- type = s/4;
- rotation = s&3;
- for (i = 0; i<4; i++)
- for (j = 0; j<4; j++)
+ type = s / 4;
+ rotation = s & 3;
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++)
if (shapes[type][rotation][i][j])
if (result = func(scr, y-i, x+j, shapes[type][rotation][i][j]))
return result;
int i;
float total = 0, val;
- for (i = 0; i<7; i++) total += options[i];
- val = Random(0, 32767)/32768.0*total;
- for (i = 0; i<7; i++) if ((val -= options[i])<0) return i<<2;
+ for (i = 0; i < 7; i++) total += options[i];
+ val = Random(0, 32767) / 32768.0 * total;
+ for (i = 0; i < 7; i++) if ((val -= options[i]) < 0)
+ return i << 2;
return 0;
}
unsigned char z;
if (!Game.gravity) return 0;
- for (y = Players[scr].boardHeight-1; y > 0; y--)
+ 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)) {
//doesn't stick left/up => topleft block
from++; //skip
for (x = 0; x<Players[scr].boardWidth; x++) {
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);
} //don't stick blocks to line which we'll remove
} //full lines
scr == me);
}
-/*
- * vi: ts=4 ai
- * vim: noai si
- */