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 i

⟦bfece8e7e⟧ TextFile

    Length: 1670 (0x686)
    Types: TextFile
    Names: »init.c«

Derivation

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

TextFile

#include "defs.h"
#include <sys/types.h>
#include <sys/timeb.h>
#include <pwd.h>

initialise()
{
        struct passwd *who;
        int     depth;
        Pixrect *mem_create();
        char   *getenv();

        srand((int) time((time_t *) 0));
        define_shapes();
        depth = pw->pw_prretained->pr_depth;
        monochrome = 0;
        if (depth == 1)
                monochrome = 1;
        if ((pr = mem_create(UNIT * UWIDTH, UNIT * UHEIGHT, depth)) == NULL) {
                fprintf(stderr, "mem_create() returned NULL\n");
                exit(-1);
        }
        if ((name = getenv("TETRIS")) == NULL) {
                who = getpwuid(getuid());
                name = who->pw_name;
        }
		print_authors();
        init_all();
        read_high_scores();
}

init_all()
{
        int     i, j;

		score_position = -1;
        end_of_game = 0;
        rows = score = shape_no = rot = xpos = ypos = 0;
        for (i = 0; i < UWIDTH; i++)
                for (j = 0; j < UHEIGHT; j++)
                        grid[i][j] = 0;
        create_shape();         /* Set up 1st shape */
        create_shape();         /* Set up next shape */
        pw_rop(pw, 0, 0, UNIT * UWIDTH, UNIT * UHEIGHT, PIX_SRC | PIX_COLOR(WHITE), NULL, 0, 0);
        pw_vector(pw, 0, UHEIGHT * UNIT, UWIDTH * UNIT, UHEIGHT * UNIT, PIX_SRC | PIX_COLOR(BLACK), 0);
        pw_vector(pw, 0, UHEIGHT * UNIT + SHADOW_HEIGHT, UWIDTH * UNIT, UHEIGHT * UNIT + SHADOW_HEIGHT, PIX_SRC | PIX_COLOR(BLACK), 0);
        panel_set(game_over, PANEL_SHOW_ITEM, FALSE, 0);
        show_score();
        show_next();
        draw_shadow(shape_no, xpos, ypos, rot, shape[shape_no].color);
}