|
|
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 p
Length: 2128 (0x850)
Types: TextFile
Names: »print_shape.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Tetris/print_shape.c«
/*
** written by adam margulies vespa@ssyx.ucsc.edu
** {...}!ucbvax!ucscc!ssyx!vespa
**
** permission is granted to freely distribute this code provided that you:
**
** 1) don't charge for it
** 2) leave my name and header on it
** 3) clearly document your changes and place your name on them
**
*/
/* Tetris: print_shape.c */
/* */
/* this is the function that draws the shapes on the screen. */
/* Normally the shape is drawn using the color provided in the */
/* structure "shape". But calling this function with a color of ' ' */
/* will effectively erase shapes as well. */
#include "tetris.h"
void print_shape(shape_number, x, y, rot, ch)
int shape_number, x, y, rot;
char ch;
{
if (y > 1) {
if (shape[shape_number].table[0][rot] & 8)
mvaddch(y,x,ch);
if (shape[shape_number].table[0][rot] & 4)
mvaddch(y,x+1,ch);
if (shape[shape_number].table[0][rot] & 2)
mvaddch(y,x+2,ch);
if (shape[shape_number].table[0][rot] & 1)
mvaddch(y,x+3,ch);
}
if (y > 0) {
if (shape[shape_number].table[1][rot] & 8)
mvaddch(y+1,x,ch);
if (shape[shape_number].table[1][rot] & 4)
mvaddch(y+1,x+1,ch);
if (shape[shape_number].table[1][rot] & 2)
mvaddch(y+1,x+2,ch);
if (shape[shape_number].table[1][rot] & 1)
mvaddch(y+1,x+3,ch);
}
if (y > -1) {
if (shape[shape_number].table[2][rot] & 8)
mvaddch(y+2,x,ch);
if (shape[shape_number].table[2][rot] & 4)
mvaddch(y+2,x+1,ch);
if (shape[shape_number].table[2][rot] & 2)
mvaddch(y+2,x+2,ch);
if (shape[shape_number].table[2][rot] & 1)
mvaddch(y+2,x+3,ch);
}
if (y > -2) {
if (shape[shape_number].table[3][rot] & 8)
mvaddch(y+3,x,ch);
if (shape[shape_number].table[3][rot] & 4)
mvaddch(y+3,x+1,ch);
if (shape[shape_number].table[3][rot] & 2)
mvaddch(y+3,x+2,ch);
if (shape[shape_number].table[3][rot] & 1)
mvaddch(y+3,x+3,ch);
}
if (ch != ' ' || fast_drop)
csr_draw((y>2) ? y-1 : 2,x-3,y+4,x+7);
}