#include "defs.h" draw_shadow(shape_no, xpos, ypos, rot, col) int shape_no, xpos, ypos, rot, col; { int y1; int x1, x2, x3, x4; int t0, t1, t2, t3; int xsize; t0 = shape[shape_no].table[0][rot]; /* Bit map of 1st Row */ t1 = shape[shape_no].table[1][rot]; /* Bit map of 2nd Row */ t2 = shape[shape_no].table[2][rot]; /* Bit map of 3rd Row */ t3 = shape[shape_no].table[3][rot]; /* Bit map of 4th Row */ x1 = xpos * UNIT; /* Position of 1st column of block grid */ x2 = x1 + UNIT; /* Position of 2nd column of block grid */ x3 = x2 + UNIT; /* Position of 3rd column of block grid */ x4 = x3 + UNIT; /* Position of 4th column of block grid */ y1 = UHEIGHT * UNIT + SHADOW_OFFSET / 2; xsize = UWIDTH * UNIT; pw_batch_on(pw); my_pw_rop(pw, 0, y1, xsize, UNIT, CLR, NULL, 0, 0); if (t0 & 8 || t1 & 8 || t2 & 8 || t3 & 8) my_pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t0 & 4 || t1 & 4 || t2 & 4 || t3 & 4) my_pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t0 & 2 || t1 & 2 || t2 & 2 || t3 & 2) my_pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t0 & 1 || t1 & 1 || t2 & 1 || t3 & 1) my_pw_rop(pw, x4, y1, UNIT, UNIT, OP, NULL, 0, 0); pw_batch_off(pw); } show_next() { int y, y1, xsize; y = UHEIGHT * UNIT + SHADOW_HEIGHT; xsize = UNIT * UWIDTH; pw_batch_on(pw); my_pw_rop(pw, 0, y + UNIT, xsize, NEXT_HEIGHT - UNIT, CLR, NULL, 0, 0); pw_text(pw, 5, y + UNIT, PIX_SRC, NULL, "Next block"); y1 = y / UNIT + 1; if (AdversaryEnabled) { pw_text(pw, 5, y+2*UNIT, PIX_SRC, NULL, " ADVERSARY CHOICE "); } else { print_shape(next_no, 5, y1, next_rot, shape[next_no].color); } pw_batch_off(pw); } print_shape(shape_no, x, y, rot, col) int shape_no, x, y, rot, col; { int x1, x2, x3, x4, y1; int t0, t1, t2, t3; t0 = shape[shape_no].table[0][rot]; /* Bit map of 1st Row */ t1 = shape[shape_no].table[1][rot]; /* Bit map of 2nd Row */ t2 = shape[shape_no].table[2][rot]; /* Bit map of 3rd Row */ t3 = shape[shape_no].table[3][rot]; /* Bit map of 4th Row */ x1 = x * UNIT; /* Position of 1st column of block grid */ x2 = x1 + UNIT; /* Position of 2nd column of block grid */ x3 = x2 + UNIT; /* Position of 3rd column of block grid */ x4 = x3 + UNIT; /* Position of 4th column of block grid */ y1 = y * UNIT; /* Position of 1st row of block grid */ if (y > -1) { if (t0 & 8) my_pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t0 & 4) my_pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t0 & 2) my_pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t0 & 1) my_pw_rop(pw, x4, y1, UNIT, UNIT, OP, NULL, 0, 0); } y1 += UNIT; /* Position of next row */ if (y > -2) { if (t1 & 8) my_pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t1 & 4) my_pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t1 & 2) my_pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t1 & 1) my_pw_rop(pw, x4, y1, UNIT, UNIT, OP, NULL, 0, 0); } y1 += UNIT; /* Position of next row */ if (y > -3) { if (t2 & 8) my_pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t2 & 4) my_pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t2 & 2) my_pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t2 & 1) my_pw_rop(pw, x4, y1, UNIT, UNIT, OP, NULL, 0, 0); } y1 += UNIT; /* Position of next row */ if (y > -4) { if (t3 & 8) my_pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t3 & 4) my_pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t3 & 2) my_pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0); if (t3 & 1) my_pw_rop(pw, x4, y1, UNIT, UNIT, OP, NULL, 0, 0); } } my_pw_rop(pw, x, y, w, h, op, src, xs, ys) Pixwin *pw; Pixrect *src; int x, y, w, h, op, xs, ys; { if (! nodisplay) { pw_rop(pw, x, y, w, h, op, src, xs, ys); } } my_pr_rop(pr, x, y, w, h, op, src, xs, ys) Pixrect *pr, *src; int x, y, w, h, op, xs, ys; { if (! nodisplay) { pr_rop(pr, x, y, w, h, op, src, xs, ys); } }