|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T d
Length: 4604 (0x11fc)
Types: TextFile
Names: »draw.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/Sun/Tetris/draw.c«
#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);
pw_rop(pw, 0, y1, xsize, UNIT, CLR, NULL, 0, 0);
if (t0 & 8 || t1 & 8 || t2 & 8 || t3 & 8)
pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t0 & 4 || t1 & 4 || t2 & 4 || t3 & 4)
pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t0 & 2 || t1 & 2 || t2 & 2 || t3 & 2)
pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t0 & 1 || t1 & 1 || t2 & 1 || t3 & 1)
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);
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;
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)
pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t0 & 4)
pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t0 & 2)
pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t0 & 1)
pw_rop(pw, x4, y1, UNIT, UNIT, OP, NULL, 0, 0);
}
y1 += UNIT; /* Position of next row */
if (y > -2) {
if (t1 & 8)
pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t1 & 4)
pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t1 & 2)
pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t1 & 1)
pw_rop(pw, x4, y1, UNIT, UNIT, OP, NULL, 0, 0);
}
y1 += UNIT; /* Position of next row */
if (y > -3) {
if (t2 & 8)
pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t2 & 4)
pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t2 & 2)
pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t2 & 1)
pw_rop(pw, x4, y1, UNIT, UNIT, OP, NULL, 0, 0);
}
y1 += UNIT; /* Position of next row */
if (y > -4) {
if (t3 & 8)
pw_rop(pw, x1, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t3 & 4)
pw_rop(pw, x2, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t3 & 2)
pw_rop(pw, x3, y1, UNIT, UNIT, OP, NULL, 0, 0);
if (t3 & 1)
pw_rop(pw, x4, y1, UNIT, UNIT, OP, NULL, 0, 0);
}
}