comparison utils/frmconv/frm.h @ 0:4a0efb7baf70

* Datasets becomes the new trunk and retires after that :-)
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 29 Jun 2008 18:44:17 +0000
parents
children 90005975cdbb
comparison
equal deleted inserted replaced
-1:000000000000 0:4a0efb7baf70
1 #ifndef FRM_H_
2 #define FRM_H_
3
4 // Some constant offset in the frm file for easier readability of the later code
5 // The documentation use both "direction" and "orientation". I stick to "orientation"
6 #define FRM_OFFSET_VERSION_NR 0x00
7 #define FRM_OFFSET_FRAMESPERORIENT 0x08
8 #define FRM_OFFSET_SHIFTX_ORIENT0 0x0A
9 #define FRM_OFFSET_SHIFTX_ORIENT1 0x0C
10 #define FRM_OFFSET_SHIFTX_ORIENT2 0x0E
11 #define FRM_OFFSET_SHIFTX_ORIENT3 0x10
12 #define FRM_OFFSET_SHIFTX_ORIENT4 0x12
13 #define FRM_OFFSET_SHIFTX_ORIENT5 0x14
14 #define FRM_OFFSET_SHIFTY_ORIENT0 0x16
15 #define FRM_OFFSET_SHIFTY_ORIENT1 0x18
16 #define FRM_OFFSET_SHIFTY_ORIENT2 0x1A
17 #define FRM_OFFSET_SHIFTY_ORIENT3 0x1C
18 #define FRM_OFFSET_SHIFTY_ORIENT4 0x1E
19 #define FRM_OFFSET_SHIFTY_ORIENT5 0x20
20 #define FRM_OFFSET_FIRSTFRAME_ORIENT0 0x22
21 #define FRM_OFFSET_FIRSTFRAME_ORIENT1 0x26
22 #define FRM_OFFSET_FIRSTFRAME_ORIENT2 0x2A
23 #define FRM_OFFSET_FIRSTFRAME_ORIENT3 0x2E
24 #define FRM_OFFSET_FIRSTFRAME_ORIENT4 0x32
25 #define FRM_OFFSET_FIRSTFRAME_ORIENT5 0x36
26 #define FRM_OFFSET_FRAMEAREASIZE 0x3A
27 #define FRM_OFFSET_FRAMEDATA 0x3E
28
29 // These are relative offset
30 // Example: The absolute offset of the height of frame 0 is therefore:
31 // 0x40 == FRM_OFFSET_FRAMEDATA + FRMFRAME_OFFSET_HEIGHT
32 #define FRMFRAME_OFFSET_WIDTH 0x00
33 #define FRMFRAME_OFFSET_HEIGHT 0x02
34 #define FRMFRAME_OFFSET_SIZE 0x04
35 #define FRMFRAME_OFFSET_XOFF 0x08
36 #define FRMFRAME_OFFSET_YOFF 0x0A
37 #define FRMFRAME_OFFSET_DATA 0x0C
38
39 typedef struct {
40 uint8_t red;
41 uint8_t green;
42 uint8_t blue;
43 } frm_color;
44
45
46 typedef struct _frm_frame {
47 uint16_t width; // self-explanatory
48 uint16_t height; //
49 uint32_t framesize; // Should be equal to width*height
50 uint8_t orient; // The orientation of the frame.
51 unsigned char **rowptr; // the actual image data. The byte value is in index in a palette (pal.h)
52
53 struct _frm_frame *next_frame; // Pointer to the next frame. NULL ends the list :)
54 } frm_frame;
55
56 typedef struct {
57 uint16_t frameperorient; // FramesPerOrientation at offset 0x8 (size: two bytes) in the frm file
58 uint32_t frameareasize; // Frameareasize at offset 0x3A (size: four bytes) in the frm file
59 // I haven't checked, if this value is always correct. If it is, we should
60 // use the information for the memory allocation.
61
62 uint32_t nrofframes; // The number of frames in this animation
63
64 frm_color *palette; // A pointer to the palette. Normally the one from pal.h
65
66 frm_frame *frames; // A single linked list of frm_frame. Each frm_frame describes one frame
67 // There should be nrofframes many.
68 } frm_anim;
69
70
71
72 frm_anim *loadFRMAnim(FILE *frmfile);
73 void freefrmanim(frm_anim *anim);
74
75 #endif /*FRM_H_*/