Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | /** |
2 | * ART files for Imagination Pilots Entertainment 16-bit games (IPE16) |
||
3 | * - Blown Away - The Interactive Game by Imagination Pilots (BA) |
||
4 | * - Panic in the Park - The Interactive Game by Imagination Pilots (PiP) |
||
5 | * - Where's Waldo? At the Circus (Waldo1) |
||
6 | * ART file packer and unpacker by Daniel Marschall, ViaThinkSoft (C) 2014-2018 |
||
7 | * Revision: 2018-02-15 |
||
8 | **/ |
||
9 | |||
10 | #ifndef __inc__ipe16_artfile |
||
11 | #define __inc__ipe16_artfile |
||
12 | |||
13 | #include <stdint.h> |
||
14 | |||
15 | #define BA_COMPRESSIONTYPE_LZW 'P' |
||
16 | #define BA_COMPRESSIONTYPE_NONE 'p' |
||
17 | |||
18 | // PANIC.EXE offset 0x44365: Choice between "Q" and "q" |
||
19 | #define PIP_COMPRESSIONTYPE_LZW 'Q' |
||
20 | #define PIP_COMPRESSIONTYPE_NONE 'q' |
||
21 | |||
22 | #define IPE16_PALETTETYPE_ATTACHED 'X' |
||
23 | |||
24 | // Pictures with the type 'C' do not have a palette. |
||
25 | // They use the palette of their parent picture where they are embedded in |
||
26 | #define IPE16_PALETTETYPE_PARENT 'C' |
||
27 | |||
28 | #define IPE16_NAME_SIZE 23 |
||
29 | |||
30 | #define IPE16_MAGIC_ART "Art" |
||
31 | #define IPE16_MAGIC_DUMMY '?' |
||
32 | |||
33 | #pragma pack(push, 1) |
||
34 | |||
35 | typedef struct tagIpe16FileHeader { |
||
36 | char magic[IPE16_NAME_SIZE]; // always "Art\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" (ignored by the game) |
||
37 | char dummy; // always '?' (ignored by the game) |
||
38 | uint32_t numHeaderEntries; // number of headers including this file header (number of follow-up Ipe16PictureEntryHeader entries plus one) |
||
39 | uint32_t totalFileSize; // total file size including this header (ignored by the game) |
||
40 | } Ipe16FileHeader; |
||
41 | |||
42 | typedef struct tagIpe16PictureEntryHeader { |
||
43 | char name[IPE16_NAME_SIZE]; // zero terminated string. case sensitive |
||
44 | char paletteType; // 'X' (0x58) = RGB palette attached |
||
45 | // 'C' (0x43) = no palette attached (for embedded picture, use palette of parent picture) |
||
46 | uint32_t offset; // offset to the picture (PictureHeader) |
||
47 | uint32_t size; // size of the picture (PictureHeader + picture data + optional palette) |
||
48 | } Ipe16PictureEntryHeader; |
||
49 | |||
50 | typedef struct tagBAPictureHeader { |
||
51 | char compressionType; // Compression type of the follow-up data (top down pixel data; the palette won't be compressed) |
||
52 | // 'P' (0x50, upper case) = LZW compression, more precisely: |
||
53 | // The LZW variant of the GIF specification, |
||
54 | // but without splitting the output data into chunks |
||
55 | // 'p' (0x70, lower case) = No compression |
||
56 | uint16_t width; // width of the picture |
||
57 | uint16_t height; // height of the picture |
||
58 | } BAPictureHeader; |
||
59 | |||
60 | typedef struct tagPipPictureHeader { |
||
61 | char compressionType; // Compression type of the follow-up data (top down pixel data; the palette won't be compressed) |
||
62 | // 'Q' (0x51, upper case) = LZW compression, more precisely: |
||
63 | // The LZW variant of the GIF specification, |
||
64 | // but without splitting the output data into chunks |
||
65 | // 'q' (0x71, lower case) = No compression |
||
66 | uint16_t offsetX; // Additional offsets for 'fine-tuning' |
||
67 | uint16_t offsetY; |
||
68 | uint16_t width; // width of the picture |
||
69 | uint16_t height; // height of the picture |
||
70 | } PipPictureHeader; |
||
71 | |||
72 | typedef struct tagIpe16ColorTableEntry { |
||
73 | uint8_t r; |
||
74 | uint8_t g; |
||
75 | uint8_t b; |
||
76 | } Ipe16ColorTableEntry; |
||
77 | |||
78 | typedef struct tagIpe16ColorTable { |
||
79 | Ipe16ColorTableEntry colors[256]; |
||
80 | } Ipe16ColorTable; |
||
81 | |||
82 | #pragma pack(pop) |
||
83 | |||
84 | #endif // #ifndef __inc__ipe16_artfile |
||
85 |