-
Notifications
You must be signed in to change notification settings - Fork 2
/
anm_types.h
131 lines (120 loc) · 3.32 KB
/
anm_types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* Touhou type library
* ANM format
*/
#pragma once
#include "warning_push.h"
#include "pragma_push.h"
/* All of the 16-bit formats are little-endian. */
typedef enum {
FORMAT_BGRA8888 = 1,
FORMAT_RGB565 = 3,
FORMAT_ARGB4444 = 5, /* 0xGB 0xAR */
FORMAT_GRAY8 = 7
} format_t;
typedef struct {
uint32_t id;
float x, y, w, h;
} sprite_t;
typedef struct {
uint32_t id;
float x, y, w, h;
/* TH19: new fields, usually {0, 0, 1, 1, 0} */
float unk0, unk1, unk2, unk3, unk4;
} sprite19_t;
typedef struct {
int16_t time;
uint8_t type;
/* XXX: data length. */
uint8_t length;
unsigned char data[];
} anm_instr0_t;
typedef struct {
uint16_t type;
uint16_t length;
int16_t time;
/* TODO: Implement this, it works similarly to that one in ECL files. */
uint16_t param_mask;
unsigned char data[];
} anm_instr_t;
/* TODO: Rename this struct to _header_t something. */
typedef struct {
int32_t id;
uint32_t offset;
} anm_offset_t;
typedef struct {
uint32_t sprites;
uint32_t scripts;
/* Set to the texture slot at runtime, zero in the files itself. */
uint32_t rt_textureslot;
uint32_t w, h;
uint32_t format;
/* ARGB. Mostly zero, but a few are 0xff000000 (opaque black). */
uint32_t colorkey;
uint32_t nameoffset;
/* XXX: X is unused here. */
/* XXX: Y stores the secondary name offset for TH06.
* There is no secondary name when it is zero. */
uint32_t x, y;
/* 0: TH06
* 2: TH07
* 3: TH08, TH09
* 4: TH09.5, TH10
* 7: TH11, TH12, TH12.5
* 8: TH13+ */
uint32_t version;
/* Memory priority for Direct3D textures created for this entry. */
/* Supported from TH07 up until alcostg. */
/* 0 - Random things, everything in TH06 where priority is unsupported */
/* 1 - data/ascii/loading.png for TH08 and TH09. */
/* 10 - Mostly sprites? */
/* 11 - Used mainly for backgrounds and ascii.png. */
uint32_t memorypriority;
uint32_t thtxoffset;
/* Can also be communicated by setting the first char of the file name to
* '@'. In TH06, this is the only way, that game doesn't use this field. */
uint16_t hasdata;
/* From TH14 on, used to mark images as "needing to be scaled down when
* running in lower resolutions". Which is something different than
* "high-res" since images with separate versions for each resolution
* (most notably ascii*.png) have 0 rather than 1 here. */
uint8_t lowresscale;
uint8_t jpeg_quality; /* TH19 */
uint32_t nextoffset;
uint16_t w_max, h_max; /* TH19 */
} anm_header06_t;
typedef struct {
uint32_t version;
uint16_t sprites;
uint16_t scripts;
/* Actually zero. */
uint16_t zero1;
uint16_t w, h;
uint16_t format;
uint32_t nameoffset;
uint16_t x, y;
/* As of TH16.5, unused in every game that uses this stucture, but still
* present in the files. */
uint32_t memorypriority;
uint32_t thtxoffset;
uint16_t hasdata;
uint8_t lowresscale;
uint8_t jpeg_quality; /* TH19 */
uint32_t nextoffset;
/* The maximum values that w and h are allowed to have, if hasdata is 0
* and the image filename specified is not '@'
* Introduced in TH19 v1.00a because... */
uint16_t w_max, h_max;
uint32_t zero2[5];
} anm_header11_t;
typedef struct {
char magic[4];
uint16_t zero;
uint16_t format;
/* These may be different from the parent entry. */
uint16_t w, h;
uint32_t size;
unsigned char data[];
} thtx_header_t;
#include "pragma_pop.h"
#include "warning_pop.h"