Checks to see if this file is a kind we can read
| 678 | } |
| 679 | // Checks to see if this file is a kind we can read |
| 680 | int bm_GetFileType(CFILE *infile, const char *dest) { |
| 681 | char iffcheck[4]; |
| 682 | int i; |
| 683 | // First, check if its a pcx |
| 684 | i = strlen(dest); |
| 685 | if (dest[i - 4] == '.' && (dest[i - 3] == 'p' || dest[i - 3] == 'P') && (dest[i - 2] == 'c' || dest[i - 2] == 'C') && |
| 686 | (dest[i - 1] == 'x' || dest[i - 1] == 'X')) |
| 687 | return BM_FILETYPE_PCX; |
| 688 | // How about an IFF? |
| 689 | for (i = 0; i < 4; i++) |
| 690 | iffcheck[i] = cf_ReadByte(infile); |
| 691 | cfseek(infile, 0, SEEK_SET); |
| 692 | if (!strncmp("FORM", iffcheck, 4)) |
| 693 | return BM_FILETYPE_IFF; |
| 694 | // Lastly, just default to possible TGA or OGF |
| 695 | return BM_FILETYPE_TGA; |
| 696 | } |
| 697 | // Allocs and loads a bitmap |
| 698 | // Returns the handle of the loaded bitmap |
| 699 | // Returns -1 if something is wrong |
no test coverage detected