|
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 s
Length: 1925 (0x785) Types: TextFile Names: »save_game.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Tetris/save_game.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: save_game.c ** ** Saves the game ** */ #include "tetris.h" void save_game() { FILE *fp; int i,j; struct stat buf; if ((fp = fopen(rcd_file, "w")) == NULL){ SIGHOLD(14); cls(); csr(23,0); resetty(); fprintf(stderr, "%s\n", rcd_file); perror("opening save file"); exit(3); } mvaddstr(23,0,"Got here [1]"); csr_draw(23,0,23,79); stat(rcd_file, &buf); for(i=0; i<20; i++) { for(j=0; j<10; j++) putc(window0[i+2][j+35], fp); putc('\n', fp); } mvaddstr(23,0,"Got here [0]"); csr_draw(23,0,23,79); fprintf(fp, "%ld\n", buf.st_ctime); fprintf(fp, "%d\n", VERSION); fprintf(fp, "%d\n%d\n%d\n", points, level, lines); fprintf(fp, "%d\n", disp_next); fprintf(fp, "%d\n", shadow); fprintf(fp, "%d\n", disp_tomb); fprintf(fp, "%d\n", disp_high); fprintf(fp, "%d\n%d\n", cury, curx); fprintf(fp, "%d\n%d\n", current->shape, current->rot); fprintf(fp, "%d\n", current->was_shown); fprintf(fp, "%d\n", current->was_shadowed); fprintf(fp, "%d\n%d\n", next->shape, next->rot); fprintf(fp, "%d\n", next->was_shown); fprintf(fp, "%d\n", next->was_shadowed); fprintf(fp, "%d\n", addict); fprintf(fp, "%c\n", key->right); fprintf(fp, "%c\n", key->left); fprintf(fp, "%c\n", key->rotright); fprintf(fp, "%c\n", key->rotleft); fprintf(fp, "%c\n", key->drop); fprintf(fp, "%c\n", key->togdisp); fprintf(fp, "%c\n", key->togshad); close(fp); for (i=2; i<12; i++) { mvaddstr(i,35,"++++++++++"); mvaddstr(23-i,35,"++++++++++"); csr_draw(2,35,21,44); } mvaddstr(11,35,"GAME SAVED"); csr_draw(11,35,11,44); csr(23,0); resetty(); exit(0); }