Basic ani file extracting.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@158 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2002-10-27 03:46:29 +00:00
parent e07a2e5df4
commit 5a7e5e7754
3 changed files with 660 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
#include <stdint.h>
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef short int16;
#define MAKE_WORD(x1, x2) (((x2) << 8) | (x1))
#define MAKE_DWORD(x1, x2, x3, x4) (((x4) << 24) | ((x3) << 16) | \
((x2) << 8) | (x1))
typedef struct {
int16 x;
int16 y;
} hotspot_type;
typedef struct {
uint16 w;
uint16 h;
} bounds_type;
typedef struct {
uint16 index; // only first 12 bits used
uint8 plut;
uint8 flags;
hotspot_type hotspot;
bounds_type bounds;
// uint32 len;
const uint8 *start;
} frame_desc;
typedef struct {
uint16 num_frames; // only first 12 bits used
frame_desc *frames;
} index_header;
#define FTYPE_SHIFT 12
#define FINDEX_MASK ((1 << FTYPE_SHIFT) - 1)
#define FTYPE_MASK (0xffff & ~FINDEX_MASK)
#define TYPE_GET(f) ((f) & FTYPE_MASK)
#define INDEX_GET(f) ((f) & FINDEX_MASK)
#define FLAG_DATA_HARDWARE (1 << 4)
#define FLAG_DATA_COPY (1 << 5)
#define FLAG_DATA_PACKED (1 << 6)
#define FLAG_X_FLIP (1 << 7)
#define PACK_EOL 0
#define PACK_LITERAL 1
#define PACK_TRANS 2
#define PACK_REPEAT 3
#define PACK_SHIFT 6
#define PACK_TYPE(c) ((uint8) ((c) >> PACK_SHIFT))
#define PACK_COUNT(c) ((uint8) (((c) & ((1 << PACK_SHIFT) - 1)) + 1))