MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / bm_pcx_alloc_file

Function bm_pcx_alloc_file

bitmap/pcx.cpp:70–88  ·  view source on GitHub ↗

Loads a pcx file and converts it to 16 bit. Returns bitmap handle or -1 on error

Source from the content-addressed store, hash-verified

68
69// Loads a pcx file and converts it to 16 bit. Returns bitmap handle or -1 on error
70int bm_pcx_alloc_file(CFILE *infile) {
71 uint8_t temp[128];
72
73 cf_ReadBytes(temp, 128, infile);
74 cfseek(infile, 0, SEEK_SET);
75
76 switch (temp[65]) {
77 case 1:
78 // one plane, sounds like an 8bit pcx
79 return bm_pcx_8bit_alloc_file(infile);
80 break;
81 case 3:
82 // three planes, sounds like a 24bit pcx
83 return bm_pcx_24bit_alloc_file(infile);
84 break;
85 }
86
87 return -1; // Must be 8 bit only
88}
89
90// load an 8bit pcx image
91int bm_pcx_8bit_alloc_file(CFILE *infile) {

Callers 1

bm_AllocLoadFileBitmapFunction · 0.85

Calls 4

cf_ReadBytesFunction · 0.85
cfseekFunction · 0.85
bm_pcx_8bit_alloc_fileFunction · 0.85
bm_pcx_24bit_alloc_fileFunction · 0.85

Tested by

no test coverage detected