|
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: 9074 (0x2372) Types: TextFile Names: »define_shapes.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Tetris/define_shapes.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: define_shapes() */ /* */ /* This function defines the shape tables to be used in Tetris. */ /* There are eight possible shapes, each made of four contiguous */ /* blocks. This is the fastest way I know how to make the shape */ /* tables available and it seems to work quite well. The program */ /* accesses the tables using bitwise operators. */ /* */ /* The structure shape contains four table arrays which are the */ /* bitwise representations of the four horizontal lines of each */ /* block, each block being represented on a 4 X 4 grid. Sixteen */ /* such table entries are needed to represent all four rotations */ /* of the block. */ /* */ /* Pointv is the point value for each rotation of the block. */ /* It is used for scoring. */ /* */ /* For drawing and collision detection purposes it is necessary */ /* to know the "height" and "width" of the block for each rotation */ /* The offset records how far from the upper left hand corner of */ /* the 4 X 4 array the block actually starts. It is very fast. */ /* The offset is a flag byte, with the following format: */ /* bit 7 bit 6 bit 5 bit 4 rot0 yoffset, rot0 xoffset, rot1 yoffset, rot1 xoffset, rot2 yoffset, rot2 xoffset, rot3 yoffset, rot3 xoffset. bit 3 bit 2 bit 1 bit 0 */ /* */ /* The color variable stores the character that the shape will be */ /* "painted" onto the screen with, it is different for each block. */ /* */ #include "tetris.h" void define_shapes() { /* begin shape 0 definition, four rotations */ shape[0].table[0][0] = 0; shape[0].table[1][0] = 15; /* #### */ shape[0].table[2][0] = 0; shape[0].table[3][0] = 0; shape[0].pointv[0] = 5; shape[0].table[0][1] = 4; /* # */ shape[0].table[1][1] = 4; /* # */ shape[0].table[2][1] = 4; /* # */ shape[0].table[3][1] = 4; /* # */ shape[0].pointv[1] = 8; shape[0].table[0][2] = 0; shape[0].table[1][2] = 15; /* #### */ shape[0].table[2][2] = 0; shape[0].table[3][2] = 0; shape[0].pointv[2] = 5; shape[0].table[0][3] = 4; /* # */ shape[0].table[1][3] = 4; /* # */ shape[0].table[2][3] = 4; /* # */ shape[0].table[3][3] = 4; /* # */ shape[0].pointv[2] = 8; shape[0].width = 4; shape[0].height = 1; shape[0].offset = 153; shape[0].color = '#'; /* begin shape 1 definition, four rotations */ shape[1].table[0][0] = 12; /* ## */ shape[1].table[1][0] = 12; /* ## */ shape[1].table[2][0] = 0; /* */ shape[1].table[3][0] = 0; /* */ shape[1].pointv[0] = 6; shape[1].table[0][1] = 12; /* ## */ shape[1].table[1][1] = 12; /* ## */ shape[1].table[2][1] = 0; /* */ shape[1].table[3][1] = 0; /* */ shape[1].pointv[1] = 6; shape[1].table[0][2] = 12; /* ## */ shape[1].table[1][2] = 12; /* ## */ shape[1].table[2][2] = 0; /* */ shape[1].table[3][2] = 0; /* */ shape[1].pointv[2] = 6; shape[1].table[0][3] = 12; /* ## */ shape[1].table[1][3] = 12; /* ## */ shape[1].table[2][3] = 0; /* */ shape[1].table[3][3] = 0; /* */ shape[1].pointv[3] = 6; shape[1].width = 2; shape[1].height = 2; shape[1].offset = 0; shape[1].color = '$'; /* begin shape 2 definition, four rotations */ shape[2].table[0][0] = 4; /* # */ shape[2].table[1][0] = 14; /* ### */ shape[2].table[2][0] = 0; /* */ shape[2].table[3][0] = 0; /* */ shape[2].pointv[0] = 5; shape[2].table[0][1] = 4; /* # */ shape[2].table[1][1] = 6; /* ## */ shape[2].table[2][1] = 4; /* # */ shape[2].table[3][1] = 0; /* */ shape[2].pointv[0] = 5; shape[2].table[0][2] = 0; /* */ shape[2].table[1][2] = 14; /* ### */ shape[2].table[2][2] = 4; /* # */ shape[2].table[3][2] = 0; /* */ shape[2].pointv[2] = 6; shape[2].table[0][3] = 4; /* # */ shape[2].table[1][3] = 12; /* ## */ shape[2].table[2][3] = 4; /* # */ shape[2].table[3][3] = 0; /* */ shape[2].pointv[3] = 5; shape[2].width = 3; shape[2].height = 2; shape[2].offset = 24; shape[2].color = '%'; /* begin shape 3 definition, four rotations */ shape[3].table[0][0] = 12; /* ## */ shape[3].table[1][0] = 6; /* ## */ shape[3].table[2][0] = 0; /* */ shape[3].table[3][0] = 0; /* */ shape[3].pointv[0] = 6; shape[3].table[0][1] = 4; /* # */ shape[3].table[1][1] = 12; /* ## */ shape[3].table[2][1] = 8; /* # */ shape[3].table[3][1] = 0; /* */ shape[3].pointv[1] = 7; shape[3].table[0][2] = 12; /* ## */ shape[3].table[1][2] = 6; /* ## */ shape[3].table[2][2] = 0; /* */ shape[3].table[3][2] = 0; /* */ shape[3].pointv[2] = 6; shape[3].table[0][3] = 4; /* # */ shape[3].table[1][3] = 12; /* ## */ shape[3].table[2][3] = 8; /* # */ shape[3].table[3][3] = 0; /* */ shape[3].pointv[3] = 7; shape[3].width = 3; shape[3].height = 2; shape[3].offset = 0; shape[3].color = '@'; /* begin shape 4 definition, four rotations */ shape[4].table[0][0] = 6; /* ## */ shape[4].table[1][0] = 12; /* ## */ shape[4].table[2][0] = 0; /* */ shape[4].table[3][0] = 0; /* */ shape[4].pointv[0] = 6; shape[4].table[0][1] = 8; /* # */ shape[4].table[1][1] = 12; /* ## */ shape[4].table[2][1] = 4; /* # */ shape[4].table[3][1] = 0; /* */ shape[4].pointv[1] = 7; shape[4].table[0][2] = 6; /* ## */ shape[4].table[1][2] = 12; /* ## */ shape[4].table[2][2] = 0; /* */ shape[4].table[3][2] = 0; /* */ shape[4].pointv[2] = 6; shape[4].table[0][3] = 8; /* # */ shape[4].table[1][3] = 12; /* ## */ shape[4].table[2][3] = 4; /* # */ shape[4].table[3][3] = 0; /* */ shape[4].pointv[3] = 7; shape[4].width = 3; shape[4].height = 2; shape[4].offset = 0; shape[4].color = '&'; /* begin shape 5 definition, four rotations */ shape[5].table[0][0] = 2; /* # */ shape[5].table[1][0] = 14; /* ### */ shape[5].table[2][0] = 0; /* */ shape[5].table[3][0] = 0; /* */ shape[5].pointv[0] = 6; shape[5].table[0][1] = 8; /* # */ shape[5].table[1][1] = 8; /* # */ shape[5].table[2][1] = 12; /* ## */ shape[5].table[3][1] = 0; /* */ shape[5].pointv[1] = 7; shape[5].table[0][2] = 14; /* ### */ shape[5].table[1][2] = 8; /* # */ shape[5].table[2][2] = 0; /* */ shape[5].table[3][2] = 0; /* */ shape[5].pointv[2] = 6; shape[5].table[0][3] = 12; /* ## */ shape[5].table[1][3] = 4; /* # */ shape[5].table[2][3] = 4; /* # */ shape[5].table[3][3] = 0; /* */ shape[5].pointv[3] = 7; shape[5].width = 3; shape[5].height = 2; shape[5].offset = 0; shape[5].color = '*'; /* begin shape 6 definition, four rotations */ shape[6].table[0][0] = 14; /* ### */ shape[6].table[1][0] = 2; /* # */ shape[6].table[2][0] = 0; /* */ shape[6].table[3][0] = 0; /* */ shape[6].pointv[0] = 6; shape[6].table[0][1] = 4; /* # */ shape[6].table[1][1] = 4; /* # */ shape[6].table[2][1] = 12; /* ## */ shape[6].table[3][1] = 0; /* */ shape[6].pointv[1] = 7; shape[6].table[0][2] = 8; /* # */ shape[6].table[1][2] = 14; /* ### */ shape[6].table[2][2] = 0; /* */ shape[6].table[3][2] = 0; /* */ shape[6].pointv[2] = 6; shape[6].table[0][3] = 12; /* ## */ shape[6].table[1][3] = 8; /* # */ shape[6].table[2][3] = 8; /* # */ shape[6].table[3][3] = 0; /* */ shape[6].pointv[3] = 7; shape[6].width = 3; shape[6].height = 2; shape[6].offset = 0; shape[6].color = '+'; }