-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflash.ooc
204 lines (182 loc) · 15.8 KB
/
flash.ooc
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import io/BinarySequence
import structs/ArrayList
circleLookupTable := static const [
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,62,62,62,61,61,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,61,61,60,60,60,60,60,59,59,60,60,60,60,60,61,61,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,61,60,59,59,58,58,58,58,57,57,57,57,58,58,58,58,59,59,60,61,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,59,58,57,57,56,56,56,56,55,55,55,55,56,56,56,56,57,57,58,59,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,58,57,57,56,55,55,54,54,54,54,53,53,53,53,54,54,54,54,55,55,56,57,57,58,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,58,57,56,56,55,54,54,53,53,52,52,52,51,51,51,51,52,52,52,53,53,54,54,55,56,56,57,58,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,58,57,56,55,54,54,53,52,52,51,51,50,50,50,49,49,49,49,50,50,50,51,51,52,52,53,54,54,55,56,57,58,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,62,60,59,58,57,56,55,54,53,52,51,50,50,49,49,48,48,48,47,47,47,47,48,48,48,49,49,50,50,51,52,53,54,55,56,57,58,59,60,62,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,61,60,59,57,56,55,54,53,52,51,50,49,48,48,47,47,46,46,45,45,45,45,45,45,46,46,47,47,48,48,49,50,51,52,53,54,55,56,57,59,60,61,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,61,60,58,57,56,55,53,52,51,50,49,48,47,46,46,45,45,44,44,43,43,43,43,43,43,44,44,45,45,46,46,47,48,49,50,51,52,53,55,56,57,58,60,61,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,61,60,58,57,56,54,53,52,51,49,48,47,46,45,45,44,43,43,42,42,41,41,41,41,41,41,42,42,43,43,44,45,45,46,47,48,49,51,52,53,54,56,57,58,60,61,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,62,60,58,57,56,54,53,51,50,49,48,47,45,44,44,43,42,41,41,40,40,39,39,39,39,39,39,40,40,41,41,42,43,44,44,45,47,48,49,50,51,53,54,56,57,58,60,62,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,62,60,59,57,56,54,53,51,50,49,47,46,45,44,43,42,41,40,39,39,38,38,37,37,37,37,37,37,38,38,39,39,40,41,42,43,44,45,46,47,49,50,51,53,54,56,57,59,60,62,63,63,63,63,63,63,63,
63,63,63,63,63,63,62,61,59,57,56,54,53,51,50,48,47,46,44,43,42,41,40,39,38,37,37,36,36,35,35,35,35,35,35,36,36,37,37,38,39,40,41,42,43,44,46,47,48,50,51,53,54,56,57,59,61,62,63,63,63,63,63,63,
63,63,63,63,63,63,61,60,58,56,55,53,51,50,48,47,45,44,43,42,40,39,38,37,36,36,35,34,34,33,33,33,33,33,33,34,34,35,36,36,37,38,39,40,42,43,44,45,47,48,50,51,53,55,56,58,60,61,63,63,63,63,63,63,
63,63,63,63,63,62,60,58,57,55,53,52,50,49,47,45,44,43,41,40,39,38,36,35,34,34,33,32,32,31,31,31,31,31,31,32,32,33,34,34,35,36,38,39,40,41,43,44,45,47,49,50,52,53,55,57,58,60,62,63,63,63,63,63,
63,63,63,63,63,61,59,57,56,54,52,51,49,47,46,44,43,41,40,38,37,36,35,34,33,32,31,30,30,29,29,29,29,29,29,30,30,31,32,33,34,35,36,37,38,40,41,43,44,46,47,49,51,52,54,56,57,59,61,63,63,63,63,63,
63,63,63,63,62,60,58,56,55,53,51,49,48,46,44,43,41,40,38,37,36,34,33,32,31,30,29,28,28,27,27,27,27,27,27,28,28,29,30,31,32,33,34,36,37,38,40,41,43,44,46,48,49,51,53,55,56,58,60,62,63,63,63,63,
63,63,63,63,61,59,57,55,54,52,50,48,47,45,43,42,40,38,37,35,34,33,31,30,29,28,27,26,26,25,25,25,25,25,25,26,26,27,28,29,30,31,33,34,35,37,38,40,42,43,45,47,48,50,52,54,55,57,59,61,63,63,63,63,
63,63,63,62,60,58,56,54,53,51,49,47,45,44,42,40,39,37,36,34,33,31,30,29,27,26,25,25,24,23,23,23,23,23,23,24,25,25,26,27,29,30,31,33,34,36,37,39,40,42,44,45,47,49,51,53,54,56,58,60,62,63,63,63,
63,63,63,61,59,57,56,54,52,50,48,46,44,43,41,39,38,36,34,33,31,30,28,27,26,25,24,23,22,21,21,21,21,21,21,22,23,24,25,26,27,28,30,31,33,34,36,38,39,41,43,44,46,48,50,52,54,56,57,59,61,63,63,63,
63,63,62,61,59,57,55,53,51,49,47,45,44,42,40,38,36,35,33,31,30,28,27,25,24,23,22,21,20,19,19,19,19,19,19,20,21,22,23,24,25,27,28,30,31,33,35,36,38,40,42,44,45,47,49,51,53,55,57,59,61,62,63,63,
63,63,62,60,58,56,54,52,50,48,46,45,43,41,39,37,35,34,32,30,29,27,25,24,23,21,20,19,18,18,17,17,17,17,18,18,19,20,21,23,24,25,27,29,30,32,34,35,37,39,41,43,45,46,48,50,52,54,56,58,60,62,63,63,
63,63,61,59,57,55,54,52,50,48,46,44,42,40,38,36,34,33,31,29,27,26,24,23,21,20,18,17,16,16,15,15,15,15,16,16,17,18,20,21,23,24,26,27,29,31,33,34,36,38,40,42,44,46,48,50,52,54,55,57,59,61,63,63,
63,63,61,59,57,55,53,51,49,47,45,43,41,39,37,36,34,32,30,28,26,25,23,21,20,18,17,16,14,14,13,13,13,13,14,14,16,17,18,20,21,23,25,26,28,30,32,34,36,37,39,41,43,45,47,49,51,53,55,57,59,61,63,63,
63,62,60,58,56,54,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,24,22,20,18,17,15,14,13,12,11,11,11,11,12,13,14,15,17,18,20,22,24,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,54,56,58,60,62,63,
63,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,25,23,21,19,17,16,14,12,11,10, 9, 9, 9, 9,10,11,12,14,16,17,19,21,23,25,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,63,
63,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,13,11,10, 8, 7, 7, 7, 7, 8,10,11,13,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,63,
63,62,60,58,56,54,52,50,48,45,43,41,39,37,35,33,31,29,27,25,23,21,19,18,16,14,12,10, 8, 7, 5, 5, 5, 5, 7, 8,10,12,14,16,18,19,21,23,25,27,29,31,33,35,37,39,41,43,45,48,50,52,54,56,58,60,62,63,
63,62,60,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11, 9, 7, 5, 4, 3, 3, 4, 5, 7, 9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,60,62,63,
63,61,59,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11, 9, 7, 5, 3, 1, 1, 3, 5, 7, 9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,
63,61,59,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11, 9, 7, 5, 3, 1, 1, 3, 5, 7, 9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,
63,62,60,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11, 9, 7, 5, 4, 3, 3, 4, 5, 7, 9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,60,62,63,
63,62,60,58,56,54,52,50,48,45,43,41,39,37,35,33,31,29,27,25,23,21,19,18,16,14,12,10, 8, 7, 5, 5, 5, 5, 7, 8,10,12,14,16,18,19,21,23,25,27,29,31,33,35,37,39,41,43,45,48,50,52,54,56,58,60,62,63,
63,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,13,11,10, 8, 7, 7, 7, 7, 8,10,11,13,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,63,
63,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,25,23,21,19,17,16,14,12,11,10, 9, 9, 9, 9,10,11,12,14,16,17,19,21,23,25,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,63,
63,62,60,58,56,54,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,24,22,20,18,17,15,14,13,12,11,11,11,11,12,13,14,15,17,18,20,22,24,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,54,56,58,60,62,63,
63,63,61,59,57,55,53,51,49,47,45,43,41,39,37,36,34,32,30,28,26,25,23,21,20,18,17,16,14,14,13,13,13,13,14,14,16,17,18,20,21,23,25,26,28,30,32,34,36,37,39,41,43,45,47,49,51,53,55,57,59,61,63,63,
63,63,61,59,57,55,54,52,50,48,46,44,42,40,38,36,34,33,31,29,27,26,24,23,21,20,18,17,16,16,15,15,15,15,16,16,17,18,20,21,23,24,26,27,29,31,33,34,36,38,40,42,44,46,48,50,52,54,55,57,59,61,63,63,
63,63,62,60,58,56,54,52,50,48,46,45,43,41,39,37,35,34,32,30,29,27,25,24,23,21,20,19,18,18,17,17,17,17,18,18,19,20,21,23,24,25,27,29,30,32,34,35,37,39,41,43,45,46,48,50,52,54,56,58,60,62,63,63,
63,63,62,61,59,57,55,53,51,49,47,45,44,42,40,38,36,35,33,31,30,28,27,25,24,23,22,21,20,19,19,19,19,19,19,20,21,22,23,24,25,27,28,30,31,33,35,36,38,40,42,44,45,47,49,51,53,55,57,59,61,62,63,63,
63,63,63,61,59,57,56,54,52,50,48,46,44,43,41,39,38,36,34,33,31,30,28,27,26,25,24,23,22,21,21,21,21,21,21,22,23,24,25,26,27,28,30,31,33,34,36,38,39,41,43,44,46,48,50,52,54,56,57,59,61,63,63,63,
63,63,63,62,60,58,56,54,53,51,49,47,45,44,42,40,39,37,36,34,33,31,30,29,27,26,25,25,24,23,23,23,23,23,23,24,25,25,26,27,29,30,31,33,34,36,37,39,40,42,44,45,47,49,51,53,54,56,58,60,62,63,63,63,
63,63,63,63,61,59,57,55,54,52,50,48,47,45,43,42,40,38,37,35,34,33,31,30,29,28,27,26,26,25,25,25,25,25,25,26,26,27,28,29,30,31,33,34,35,37,38,40,42,43,45,47,48,50,52,54,55,57,59,61,63,63,63,63,
63,63,63,63,62,60,58,56,55,53,51,49,48,46,44,43,41,40,38,37,36,34,33,32,31,30,29,28,28,27,27,27,27,27,27,28,28,29,30,31,32,33,34,36,37,38,40,41,43,44,46,48,49,51,53,55,56,58,60,62,63,63,63,63,
63,63,63,63,63,61,59,57,56,54,52,51,49,47,46,44,43,41,40,38,37,36,35,34,33,32,31,30,30,29,29,29,29,29,29,30,30,31,32,33,34,35,36,37,38,40,41,43,44,46,47,49,51,52,54,56,57,59,61,63,63,63,63,63,
63,63,63,63,63,62,60,58,57,55,53,52,50,49,47,45,44,43,41,40,39,38,36,35,34,34,33,32,32,31,31,31,31,31,31,32,32,33,34,34,35,36,38,39,40,41,43,44,45,47,49,50,52,53,55,57,58,60,62,63,63,63,63,63,
63,63,63,63,63,63,61,60,58,56,55,53,51,50,48,47,45,44,43,42,40,39,38,37,36,36,35,34,34,33,33,33,33,33,33,34,34,35,36,36,37,38,39,40,42,43,44,45,47,48,50,51,53,55,56,58,60,61,63,63,63,63,63,63,
63,63,63,63,63,63,62,61,59,57,56,54,53,51,50,48,47,46,44,43,42,41,40,39,38,37,37,36,36,35,35,35,35,35,35,36,36,37,37,38,39,40,41,42,43,44,46,47,48,50,51,53,54,56,57,59,61,62,63,63,63,63,63,63,
63,63,63,63,63,63,63,62,60,59,57,56,54,53,51,50,49,47,46,45,44,43,42,41,40,39,39,38,38,37,37,37,37,37,37,38,38,39,39,40,41,42,43,44,45,46,47,49,50,51,53,54,56,57,59,60,62,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,62,60,58,57,56,54,53,51,50,49,48,47,45,44,44,43,42,41,41,40,40,39,39,39,39,39,39,40,40,41,41,42,43,44,44,45,47,48,49,50,51,53,54,56,57,58,60,62,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,61,60,58,57,56,54,53,52,51,49,48,47,46,45,45,44,43,43,42,42,41,41,41,41,41,41,42,42,43,43,44,45,45,46,47,48,49,51,52,53,54,56,57,58,60,61,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,61,60,58,57,56,55,53,52,51,50,49,48,47,46,46,45,45,44,44,43,43,43,43,43,43,44,44,45,45,46,46,47,48,49,50,51,52,53,55,56,57,58,60,61,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,61,60,59,57,56,55,54,53,52,51,50,49,48,48,47,47,46,46,45,45,45,45,45,45,46,46,47,47,48,48,49,50,51,52,53,54,55,56,57,59,60,61,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,62,60,59,58,57,56,55,54,53,52,51,50,50,49,49,48,48,48,47,47,47,47,48,48,48,49,49,50,50,51,52,53,54,55,56,57,58,59,60,62,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,58,57,56,55,54,54,53,52,52,51,51,50,50,50,49,49,49,49,50,50,50,51,51,52,52,53,54,54,55,56,57,58,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,58,57,56,56,55,54,54,53,53,52,52,52,51,51,51,51,52,52,52,53,53,54,54,55,56,56,57,58,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,58,57,57,56,55,55,54,54,54,54,53,53,53,53,54,54,54,54,55,55,56,57,57,58,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,60,59,59,58,57,57,56,56,56,56,55,55,55,55,56,56,56,56,57,57,58,59,59,60,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,61,61,60,59,59,58,58,58,58,57,57,57,57,58,58,58,58,59,59,60,61,61,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,61,61,60,60,60,60,60,59,59,60,60,60,60,60,61,61,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,62,62,62,62,62,61,61,62,62,62,62,62,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,
63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63
]
Style: class{
indexBuffer: UInt
style: UInt
fillColor: UInt
gradTable: UInt8[256]
indexes: ArrayList<Int> = ArrayList<Int> new()
init: func(buffer: BinarySequenceReader){
indexBuffer = buffer u32()
indexCount := buffer u16()
for(i in 0..indexCount){
indexes add(buffer u16())
}
vertexCount := buffer u16()
xyBuffer := buffer u32()
uvBuffer := buffer u32()
style = buffer u8()
match(style){
case 0 => //bitmap
case 1 => //fill_color
fillColor = buffer u32()
case 2 => //linear_grad
for(i in 0..256){
gradTable[i] = buffer u8()
}
case 3 => //radil_grad
tempTable: UInt8[256]
for(i in 0..256){
tempTable[i] = buffer u8()
}
for(i in 0..256){
gradTable[i] = tempTable[circleLookupTable[i]]
}
case => // default action is bitmap
}
}
}
Shape: class{
id: Int
styles: ArrayList<Style> = ArrayList<Style> new()
init: func(buffer: BinarySequenceReader){
id = buffer u16()
styleCount := buffer u16()
for(i in 0..styleCount){
styles add(Style new(buffer))
}
}
}
Sound: class{
name: String
nameidx: Int
init: func(buffer: BinarySequenceReader){
nameidx = buffer u16()
}
}
Matrix: cover{
type: UInt8
inx: UInt32
}
Flash: class {
path: String
size: UInt32
msPerFrame: UInt32
indexes: UInt32
sounds: ArrayList<Sound> = ArrayList<Sound> new()
shapes: ArrayList<Shape> = ArrayList<Shape> new()
strings: ArrayList<String> = ArrayList<String> new()
floatTable: ArrayList<Float> = ArrayList<Float> new()
matrix: ArrayList<Matrix> = ArrayList<Matrix> new()
instructions: ArrayList<UInt32> = ArrayList<UInt32> new()
movieInfo: ArrayList<UInt32> = ArrayList<UInt32> new()
init: func(buffer: BinarySequenceReader){
if(buffer u32() != 0x464c5348){
Exception new("Invalid Flash File") throw()
}
size = buffer u32()
path = buffer pascalString(2)
msPerFrame = buffer u16()
stringCount := buffer u16()
charsCount := buffer u16()
if(stringCount == 0xFFFF){
soundCount := buffer u16()
for(i in 0..soundCount){
sounds add(Sound new(buffer))
}
indexes = buffer u32()
shapecount := buffer u16()
for(i in 0..shapecount){
shapes add(Shape new(buffer))
}
stringCount = buffer u16()
}
for(i in 0..stringCount){
strings add(buffer pascalString(2))
}
matrixCount := buffer u32()
floatCount := buffer u32()
for(i in 0..floatCount){
floatTable add(buffer float32())
}
for(i in 0..matrixCount){
mtype := buffer u8()
midx := buffer u32()
matrix add((mtype, midx) as Matrix)
}
streamSize := buffer u32()
for(i in 0..streamSize){
instructions add(buffer u32())
}
movieCount := buffer u16()
for(i in 0..movieCount*4){
movieInfo add(buffer u32())
}
}
}