Colormap conversion tool; from 3DO 32x15bitx8 to 256x24bit

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1511 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2005-02-03 07:57:47 +00:00
parent 5eadd60631
commit d47a32435d
6 changed files with 670 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
#include <stdint.h>
#if defined(_MSC_VER)
# define PACKED
# pragma pack(push, 1)
#elif defined(__GNUC__)
# define PACKED __attribute__ ((packed))
#endif
/* string res structures from unstr.h */
#define CTTAB_MAGIC 0xffffffff
typedef struct
{
uint32_t PACKED magic;
uint16_t PACKED unknown1; // always 0
uint16_t PACKED num_entries;
uint32_t PACKED offset; // should always be 0
uint32_t PACKED entry_size[1]; // 1 or more entry sizes
} cttab_header_t;
#define CLUT_COLORS 0x20
#define CLUT_STEPS 8
typedef uint16_t clut_color_t;
typedef clut_color_t clut_t[CLUT_COLORS];
typedef struct
{
uint8_t PACKED start_clut;
uint8_t PACKED end_clut; // inclusive
clut_t PACKED cluts[1]; // 0 or more cluts
} clut_tab_t;
#define PAL_COLORS 0x100
#define PAL_CHANNELS 3
typedef uint8_t pal_channel_t;
typedef union
{
struct {
pal_channel_t r, g, b;
} chan;
pal_channel_t channels[PAL_CHANNELS];
} pal_color_t;
typedef pal_color_t pal_t[PAL_COLORS];
typedef struct
{
uint8_t PACKED start_clut;
uint8_t PACKED end_clut; // inclusive
pal_t PACKED pals[1]; // 0 or more pals
} pal_tab_t;
#if defined(_MSC_VER)
# pragma pack(pop)
#endif
#undef PACKED