- dspriteheader_t *header;
- dspritev1_t *pinv1;
- dspritev2_t *pinv2;
- dspriteframetype_t *pframetype;
- int version;
- int numframes;
- dspriteframe_t *spriteframe;
-
- header = (dspriteheader_t *)buffer;
-
- if (header->ident != IDSPRITEHEADER)
- {
- globalErrorStream() << "WARNING: IDSP file has wrong header\n";
- return 0;
- }
-
- version = header->version;
- if (version != 1 && version != 2 )
- {
- globalErrorStream() << "WARNING: IDSP file has wrong version number "
- "(" << version << " should be 1 or 2)\n";
- return 0;
- }
-
- // initialise variables depending on the sprite version.
- switch (version)
- {
- case 1:
- pinv1 = (dspritev1_t *)(header+1);
- numframes = pinv1->numframes;
- columns = pinv1->width;
- rows = pinv1->height;
- pframetype = (dspriteframetype_t *)(pinv1 + 1);
- break;
- case 2:
- pinv2 = (dspritev2_t *)(header+1);
- numframes = pinv2->numframes;
- columns = pinv2->width;
- rows = pinv2->height;
- pframetype = (dspriteframetype_t *)(pinv2 + 1);
- break;
- default:
- globalErrorStream() << "WARNING: IDSP file has unsupported version\n";
- return 0;
- }
- if (numframes > 1)
- globalErrorStream() << "WARNING: IDSP file has multiple frames, only the first frame will be used.\n";
-
- // palette = buffer+mipdatasize+2;
- // buf_p = buffer+lpMip->offsets[0];
-
- numPixels = columns * rows;
-
- RGBAImage* image = new RGBAImage(columns, rows);
+ dspriteheader_t *header;
+ dspritev1_t *pinv1;
+ dspritev2_t *pinv2;
+ dspriteframetype_t *pframetype;
+ int version;
+ int numframes;
+ dspriteframe_t *spriteframe;
+
+ header = (dspriteheader_t *)buffer;
+
+ if ( header->ident != IDSPRITEHEADER ) {
+ globalErrorStream() << "WARNING: IDSP file has wrong header\n";
+ return 0;
+ }
+
+ version = header->version;
+ if ( version != 1 && version != 2 ) {
+ globalErrorStream() << "WARNING: IDSP file has wrong version number "
+ "(" << version << " should be 1 or 2)\n";
+ return 0;
+ }
+
+ // initialise variables depending on the sprite version.
+ switch ( version )
+ {
+ case 1:
+ pinv1 = (dspritev1_t *)( header + 1 );
+ numframes = pinv1->numframes;
+ columns = pinv1->width;
+ rows = pinv1->height;
+ pframetype = (dspriteframetype_t *)( pinv1 + 1 );
+ break;
+ case 2:
+ pinv2 = (dspritev2_t *)( header + 1 );
+ numframes = pinv2->numframes;
+ columns = pinv2->width;
+ rows = pinv2->height;
+ pframetype = (dspriteframetype_t *)( pinv2 + 1 );
+ break;
+ default:
+ globalErrorStream() << "WARNING: IDSP file has unsupported version\n";
+ return 0;
+ }
+ if ( numframes > 1 ) {
+ globalErrorStream() << "WARNING: IDSP file has multiple frames, only the first frame will be used.\n";
+ }
+
+ // palette = buffer+mipdatasize+2;
+ // buf_p = buffer+lpMip->offsets[0];
+
+ numPixels = columns * rows;
+
+ RGBAImage* image = new RGBAImage( columns, rows );