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

Function bm_iff_parse_bmhd

bitmap/iff.cpp:176–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174 return (IFF_SIG_UNKNOWN);
175}
176int bm_iff_parse_bmhd(CFILE *ifile, uint32_t len, iff_bitmap_header *bmheader) {
177 len = len;
178
179 bmheader->w = cf_ReadShort(ifile, false);
180 bmheader->h = cf_ReadShort(ifile, false);
181 bmheader->x = cf_ReadShort(ifile, false);
182 bmheader->y = cf_ReadShort(ifile, false);
183
184 bmheader->nplanes = cf_ReadByte(ifile);
185 bmheader->masking = cf_ReadByte(ifile);
186 bmheader->compression = cf_ReadByte(ifile);
187 cf_ReadByte(ifile); /* skip pad */
188
189 bmheader->transparentcolor = cf_ReadShort(ifile, false);
190 bmheader->xaspect = cf_ReadByte(ifile);
191 bmheader->yaspect = cf_ReadByte(ifile);
192
193 bmheader->pagewidth = cf_ReadShort(ifile, false);
194 bmheader->pageheight = cf_ReadShort(ifile, false);
195
196 iff_transparent_color = bmheader->transparentcolor;
197
198 iff_has_transparency = 0;
199
200 if (bmheader->masking == mskHasTransparentColor)
201 iff_has_transparency = 1;
202
203 else if (bmheader->masking != mskNone && bmheader->masking != mskHasMask)
204 return IFF_UNKNOWN_MASK;
205
206 return IFF_NO_ERROR;
207}
208
209// the buffer pointed to by raw_data is stuffed with a pointer to decompressed pixel data
210int bm_iff_parse_body(CFILE *ifile, int len, iff_bitmap_header *bmheader) {

Callers 1

bm_iff_parse_fileFunction · 0.85

Calls 2

cf_ReadShortFunction · 0.85
cf_ReadByteFunction · 0.85

Tested by

no test coverage detected