-
Notifications
You must be signed in to change notification settings - Fork 0
/
scc_cost.h
135 lines (101 loc) · 3.24 KB
/
scc_cost.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
132
133
134
135
/* ScummC
* Copyright (C) 2006 Alban Bedel
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/**
* @file scc_cost.h
* @ingroup scumm
* @brief SCUMM costume parser and decoder
*/
#define SCC_WEST 0
#define SCC_EAST 1
#define SCC_SOUTH 2
#define SCC_NORTH 3
typedef struct scc_cost_pic scc_cost_pic_t;
struct scc_cost_pic {
scc_cost_pic_t* next;
uint8_t id;
uint16_t width,height;
int16_t rel_x,rel_y;
int16_t move_x,move_y;
uint8_t redir_limb,redir_pic;
uint8_t* data;
uint32_t data_size;
};
#define SCC_COST_ANIM_LOOP 0x1
#define SCC_COST_HAS_SIZE 0x1
typedef struct scc_cost_anim_def {
uint16_t start;
uint16_t end;
uint8_t flags;
} scc_cost_anim_def_t;
typedef struct scc_cost_anim scc_cost_anim_t;
struct scc_cost_anim {
scc_cost_anim_t* next;
uint8_t id;
uint8_t redir;
uint16_t mask;
scc_cost_anim_def_t limb[16];
};
typedef struct scc_cost scc_cost_t;
struct scc_cost {
scc_cost_t* next;
unsigned id;
uint8_t format;
uint8_t flags;
uint8_t pal_size;
uint8_t* pal;
uint16_t cmds_size;
uint8_t* cmds; // finish with 0xFF
scc_cost_pic_t* limb_pic[16];
scc_cost_anim_t* anims;
};
typedef struct scc_cost_dec_track {
scc_cost_anim_def_t* anim;
uint16_t pc;
} scc_cost_dec_track_t;
typedef struct scc_cost_dec {
scc_cost_t* cost;
scc_cost_anim_t* anim;
unsigned anim_id;
scc_cost_anim_def_t track[16];
uint16_t pc[16]; // limb pc
uint16_t stopped;
unsigned anim_counter;
} scc_cost_dec_t;
scc_cost_anim_t* scc_cost_new_anim(scc_cost_t* cost,uint8_t id);
scc_cost_anim_t* scc_cost_get_anim(scc_cost_t* cost,uint8_t id);
int scc_cost_add_pic(scc_cost_t* cost,uint8_t limb,scc_cost_pic_t* pic);
int scc_cost_decode_pic(scc_cost_t* cost,scc_cost_pic_t* pic,
uint8_t* dst,int dst_stride,
uint8_t* mask, int mask_stride,
int x_min,int x_max,int y_min,int y_max,
int trans, int x_scale, int y_scale,
int y_flip);
int scc_read_cost_pic(scc_fd_t* fd,scc_cost_t* cost,scc_cost_pic_t* pic,int len,int* posp);
scc_cost_pic_t* scc_cost_get_limb_pic(scc_cost_t* cost,uint8_t limb,
uint8_t pic,int max_depth);
scc_cost_t* scc_parse_cost(scc_fd_t* fd,int len);
void scc_cost_dec_init(scc_cost_dec_t* dec);
int scc_cost_dec_load_anim(scc_cost_dec_t* dec,uint16_t aid);
int scc_cost_dec_step(scc_cost_dec_t* dec);
int scc_cost_dec_bbox(scc_cost_dec_t* dec,int* x1p,int* y1p,
int* x2p,int* y2p);
int scc_cost_dec_frame(scc_cost_dec_t* dec,uint8_t* dst,
int x, int y,
int dst_width, int dst_height,
int dst_stride,
uint8_t* mask, int mask_stride,
int x_scale, int y_scale);