DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T s

⟦d9a62f62d⟧ TextFile

    Length: 1849 (0x739)
    Types: TextFile
    Names: »setup_next.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Tetris/setup_next.c« 

TextFile

/*
** 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: setup_next.c                                                     */
/*                                                                          */
/* following a successful drop of a block this function will do all the     */
/* house-keeping necessary to the creation of a new block.                  */
/*                                                                          */
#include "tetris.h"

void setup_next()
{

	int pow();

	if (disp_next)
		print_shape(next->shape, 17, 6, 
				next->rot, ' '); /* erase the next shape */

	bcopy(next, current, sizeof(struct shape));		 /* move next to current */

	next->shape = random() % 7;
	next->rot = random() % 4;
	next->color = shape[next->shape].color;
	next->offset = shape[next->shape].offset;
	next->pointv = shape[next->shape].pointv[next->rot];
	next->was_shown = (disp_next ? 1 : 0);

	if (next->rot == 0 || next->rot == 2) {
		next->width = shape[next->shape].width;
		next->height = shape[next->shape].height;
	}
	if (next->rot == 1 || next->rot == 3) {
		next->width = shape[next->shape].height;
		next->height = shape[next->shape].width;
	}

	curx =  39 - ((current->offset & pow(2, 6 - (current->rot * 2))) ? 1 : 0);

	cury = 2 - ((current->offset & pow(2, 7 - (current->rot * 2))) ? 1 : 0) -
				current->height;

	if (disp_next)
		print_shape(next->shape, 17, 6, next->rot,
						next->color);
	print_shape(current->shape, curx, cury, current->rot,
					current->color);
	if (shadow == 1) {
		current->was_shadowed = 1;
		draw_shadow();
	}
}