|
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: 5926 (0x1726) Types: TextFile Names: »patches01«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Tetrix/patches01«
*** README-old Thu Jun 29 15:15:28 1989 --- README Thu Jun 29 15:26:11 1989 *************** *** 29,31 **** --- 29,41 ---- Good luck! Quentin Neill + This version has been hacked to do color under System V Release 3.2. Compile + with -DCOLOR to enable this feature. Due to the limited number of colors in the + curses(3) portable set, 'tan' pieces will be cyan-colored. + If you're using an EGA or VGA display, however, you can also compile + with -DEGA to get better colors (this uses the EGA quirk that yellow is + 'bright brown'). + Finally, note that you may now invoke tetrix as `tetrix <pause-value>' + to set the value of INIT_PAUSE. + + Have fun! Eric S. Raymond *** Makefile-old Thu Jun 29 11:00:13 1989 --- Makefile Thu Jun 29 15:12:10 1989 *************** *** 4,11 **** # - this will create a high score file in /usr/tmp, so doing it again # later on will erase high scores for the machine. ! ! OBJS= MoveR.o MoveL.o NewP.o AdvanceP.o Rotate.o tet.o INCS= tet.h tetrix: $(OBJS) $(INCS) --- 4,11 ---- # - this will create a high score file in /usr/tmp, so doing it again # later on will erase high scores for the machine. ! CFLAGS=-g -DCOLOR -DEGA ! OBJS= MoveR.o MoveL.o NewP.o AdvanceP.o Rotate.o Colors.o tet.o INCS= tet.h tetrix: $(OBJS) $(INCS) *************** *** 20,25 **** --- 20,27 ---- AdvanceP.o: AdvanceP.c Rotate.o: Rotate.c + + Colors.o: Colors.c tet.o: tet.c *** tet.h-old Thu Jun 29 10:57:18 1989 --- tet.h Thu Jun 29 11:12:18 1989 *************** *** 34,42 **** --- 34,47 ---- extern int Type, Row, Column, Pause, CurrentSpeed, FallingDown, Beep; extern char Board[BOARD_WIDE][BOARD_HIGH]; + #ifndef COLOR /* Macros */ /* offset the character on screen by MINX and MINY */ #define PUTCH(x,y,z) { mvaddch(y+MINY,x+MINX,z); Board[x][y]=z; } + #else + extern void PUTCH(); + extern void init_colors(); + #endif /* COLOR */ /* test whether a square is empty and legal */ /* *** tet.c-old Fri Mar 3 14:06:40 1989 --- tet.c Thu Jun 29 14:40:50 1989 *************** *** 12,17 **** --- 12,18 ---- int Row; /* Row of pivot point of block */ int Column; /* Column of pivot point of block */ int Pause; /* Time between movements this block */ + int InitPause; /* Initial value of CurrentPause */ int CurrentPause; /* Time between movements per level */ int FallingDown; /* True when space bar is pressed */ int Beep; *************** *** 58,65 **** #define MENU_KEY 'm' /**************************************************MAIN*****/ ! main() { Init(); for ( ; ; ) { NewGame(); --- 59,72 ---- #define MENU_KEY 'm' /**************************************************MAIN*****/ ! main(argc, argv) ! int argc; ! char **argv; { + if (argc >= 2) + InitPause = atoi(argv[1]); + else + InitPause = 150; Init(); for ( ; ; ) { NewGame(); *************** *** 98,104 **** HighsChanged = 0; ScoreIt(); initscr(); ! /* initilialize board to spaces */ for (x=0; x<BOARD_WIDE; x++) for (y=0; y<BOARD_HIGH; y++) PUTCH(x,y,NO_CHAR); --- 105,114 ---- HighsChanged = 0; ScoreIt(); initscr(); ! #ifdef COLOR ! init_colors(); ! #endif /* COLOR */ ! /* initialize board to spaces */ for (x=0; x<BOARD_WIDE; x++) for (y=0; y<BOARD_HIGH; y++) PUTCH(x,y,NO_CHAR); *************** *** 123,129 **** case SCORE_KEY : DrawScore(); break; case MENU_KEY : DrawMenu(); break; case BOSS_KEY : Boss(); break; ! case PLAY_KEY : CurrentPause=150; break; case QUIT_KEY : Leave(); } } --- 133,139 ---- case SCORE_KEY : DrawScore(); break; case MENU_KEY : DrawMenu(); break; case BOSS_KEY : Boss(); break; ! case PLAY_KEY : CurrentPause=InitPause; break; case QUIT_KEY : Leave(); } } *** Colors.c-old Thu Jun 29 14:41:03 1989 --- Colors.c Thu Jun 29 15:57:32 1989 *************** *** 0 **** --- 1,83 ---- + /* Tetrix color support by Eric S. Raymond, eric@snark.uu.net */ + + #include <curses.h> + #include "tet.h" + + #ifdef COLOR + /* color pair indexes for pieces */ + #define BLACK 0 + #define GREEN 1 + #define RED 2 + #define TAN 3 + #define WHITE 4 + #define VIOLET 5 + #define BLUE 6 + #define YELLOW 7 + #define NCOLORS 8 + + static int attribs[NCOLORS]; + + typedef struct + { + int forgrnd; + int attrib; + } + colorpair; + + void init_colors() + { + start_color(); + + init_pair(BLACK, COLOR_BLACK, COLOR_BLACK); + attribs[BLACK] = COLOR_PAIR(BLACK); + + init_pair(GREEN, COLOR_GREEN, COLOR_BLACK); + attribs[GREEN] = COLOR_PAIR(GREEN); + + init_pair(RED, COLOR_RED, COLOR_BLACK); + attribs[RED] = COLOR_PAIR(RED); + + #ifdef EGA + init_pair(TAN, COLOR_YELLOW, COLOR_BLACK); + #else + init_pair(TAN, COLOR_CYAN, COLOR_BLACK); + #endif /* EGA */ + attribs[TAN] = COLOR_PAIR(TAN); + + init_pair(WHITE, COLOR_WHITE, COLOR_BLACK); + attribs[WHITE] = COLOR_PAIR(WHITE); + + init_pair(VIOLET, COLOR_MAGENTA, COLOR_BLACK); + attribs[VIOLET] = COLOR_PAIR(VIOLET); + + init_pair(BLUE, COLOR_BLUE, COLOR_BLACK); + attribs[BLUE] = COLOR_PAIR(BLUE); + + #ifdef EGA + attribs[YELLOW] = attribs[TAN] | A_BOLD; + #else + init_pair(YELLOW, COLOR_YELLOW, COLOR_BLACK); + attribs[YELLOW] = COLOR_PAIR(YELLOW); + #endif /* EGA */ + } + + void PUTCH(x,y,z) + int x, y, z; + { + switch(z) + { + case ' ': attron(attribs[BLACK]); break; + case 'G': attron(attribs[GREEN]); break; + case 'R': attron(attribs[RED]); break; + case 'O': attron(attribs[TAN]); break; + case 'W': attron(attribs[WHITE]); break; + case 'V': attron(attribs[VIOLET]); break; + case 'B': attron(attribs[BLUE]); break; + case 'Y': attron(attribs[YELLOW]); break; + } + mvaddch(y+MINY,x+MINX, z); + attrset(0); + Board[x][y]=z; + } + + #endif /* COLOR */