| 45 | } |
| 46 | |
| 47 | boolean |
| 48 | fopen_ppm_file(const char *filename, const char *type) |
| 49 | { |
| 50 | int i; |
| 51 | |
| 52 | if (strcmp(type, WRBMODE)) { |
| 53 | Fprintf(stderr, "using writing routine for non-writing?\n"); |
| 54 | return FALSE; |
| 55 | } |
| 56 | ppm_file = fopen(filename, type); |
| 57 | if (ppm_file == (FILE *) 0) { |
| 58 | Fprintf(stderr, "cannot open ppm file %s\n", filename); |
| 59 | return FALSE; |
| 60 | } |
| 61 | |
| 62 | if (!colorsinmainmap) { |
| 63 | Fprintf(stderr, "no colormap set yet\n"); |
| 64 | return FALSE; |
| 65 | } |
| 66 | |
| 67 | tiles_across = 20; |
| 68 | curr_tiles_across = 0; |
| 69 | PpmScreen.Width = 20 * TILE_X; |
| 70 | |
| 71 | tiles_down = 0; |
| 72 | PpmScreen.Height = 0; /* will be rewritten later */ |
| 73 | |
| 74 | write_header(); |
| 75 | |
| 76 | image = (pixel **) alloc(TILE_Y * sizeof(pixel *)); |
| 77 | for (i = 0; i < TILE_Y; i++) { |
| 78 | image[i] = (pixel *) alloc(PpmScreen.Width * sizeof(pixel)); |
| 79 | } |
| 80 | |
| 81 | return TRUE; |
| 82 | } |
| 83 | |
| 84 | boolean |
| 85 | write_ppm_tile(pixel (*pixels)[TILE_X]) |
no test coverage detected