annotate Sprites.cpp @ 142:8b8fd4d83fdc

Various things here and there
author Nomad
date Tue, 12 Feb 2013 06:28:08 +0200
parents 9c0607679772
children 91fa025e6ca6
rev   line source
0
Ritor1
parents:
diff changeset
1 #include <string.h>
Ritor1
parents:
diff changeset
2
Ritor1
parents:
diff changeset
3 #include "Allocator.h"
Ritor1
parents:
diff changeset
4 #include "Sprites.h"
Ritor1
parents:
diff changeset
5 #include "PaletteManager.h"
Ritor1
parents:
diff changeset
6 #include "LOD.h"
Ritor1
parents:
diff changeset
7 #include "FrameTableInc.h"
Ritor1
parents:
diff changeset
8
Ritor1
parents:
diff changeset
9 #include "mm7_data.h"
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11
Ritor1
parents:
diff changeset
12
Ritor1
parents:
diff changeset
13
Ritor1
parents:
diff changeset
14 extern int (__cdecl *sprintfex)(char *a1, const char *a2, ...);
Ritor1
parents:
diff changeset
15
Ritor1
parents:
diff changeset
16 struct SpriteFrameTable *pSpriteFrameTable;
Ritor1
parents:
diff changeset
17
Ritor1
parents:
diff changeset
18
Ritor1
parents:
diff changeset
19
Ritor1
parents:
diff changeset
20
Ritor1
parents:
diff changeset
21 //----- (0044D4D8) --------------------------------------------------------
Ritor1
parents:
diff changeset
22 void SpriteFrameTable::ReleaseSFrames()
Ritor1
parents:
diff changeset
23 {
Ritor1
parents:
diff changeset
24 SpriteFrameTable *v1; // esi@1
Ritor1
parents:
diff changeset
25
Ritor1
parents:
diff changeset
26 v1 = this;
Ritor1
parents:
diff changeset
27 if ( this->pSpriteSFrames )
Ritor1
parents:
diff changeset
28 {
Ritor1
parents:
diff changeset
29 pAllocator->FreeChunk(this->pSpriteSFrames);
Ritor1
parents:
diff changeset
30 v1->pSpriteSFrames = 0;
Ritor1
parents:
diff changeset
31 }
Ritor1
parents:
diff changeset
32 v1->uNumSpriteFrames = 0;
Ritor1
parents:
diff changeset
33 }
Ritor1
parents:
diff changeset
34
Ritor1
parents:
diff changeset
35 //----- (0044D4F6) --------------------------------------------------------
Ritor1
parents:
diff changeset
36 void SpriteFrameTable::ResetSomeSpriteFlags()
Ritor1
parents:
diff changeset
37 {
Ritor1
parents:
diff changeset
38 int v1; // esi@1
Ritor1
parents:
diff changeset
39 signed int i; // edx@1
Ritor1
parents:
diff changeset
40 char *v3; // eax@2
Ritor1
parents:
diff changeset
41
Ritor1
parents:
diff changeset
42 v1 = 0;
Ritor1
parents:
diff changeset
43 for ( i = 0; i < (signed int)this->uNumSpriteFrames; ++i )
Ritor1
parents:
diff changeset
44 {
Ritor1
parents:
diff changeset
45 v3 = (char *)&this->pSpriteSFrames[v1].uFlags;
Ritor1
parents:
diff changeset
46 ++v1;
Ritor1
parents:
diff changeset
47 *v3 &= 0x7Fu;
Ritor1
parents:
diff changeset
48 }
Ritor1
parents:
diff changeset
49 }
Ritor1
parents:
diff changeset
50
Ritor1
parents:
diff changeset
51 //----- (0044D513) --------------------------------------------------------
Ritor1
parents:
diff changeset
52 void SpriteFrameTable::InitializeSprite(unsigned int uSpriteID)
Ritor1
parents:
diff changeset
53 {
Ritor1
parents:
diff changeset
54 //SpriteFrameTable *v2; // esi@1
Ritor1
parents:
diff changeset
55 unsigned int v3; // ebx@3
Ritor1
parents:
diff changeset
56 //char *v4; // edx@3
Ritor1
parents:
diff changeset
57 //int v5; // eax@3
Ritor1
parents:
diff changeset
58 SpriteFrame *v6; // ecx@5
Ritor1
parents:
diff changeset
59 int v7; // eax@5
Ritor1
parents:
diff changeset
60 __int16 v8; // ax@6
Ritor1
parents:
diff changeset
61 //signed int v9; // edx@6
Ritor1
parents:
diff changeset
62 //int v10; // ecx@6
Ritor1
parents:
diff changeset
63 signed int v11; // edi@10
Ritor1
parents:
diff changeset
64 __int16 v12; // ax@16
Ritor1
parents:
diff changeset
65 int v13; // ecx@16
Ritor1
parents:
diff changeset
66 size_t v14; // eax@19
Ritor1
parents:
diff changeset
67 signed int v15; // edi@19
Ritor1
parents:
diff changeset
68 __int16 v16; // ax@27
Ritor1
parents:
diff changeset
69 int v17; // ecx@27
Ritor1
parents:
diff changeset
70 signed int v18; // edi@29
Ritor1
parents:
diff changeset
71 SpriteFrame *v19; // eax@30
Ritor1
parents:
diff changeset
72 __int16 v20; // ax@45
Ritor1
parents:
diff changeset
73 int v21; // ecx@45
Ritor1
parents:
diff changeset
74 const char *v22; // [sp-8h] [bp-50h]@12
Ritor1
parents:
diff changeset
75 const char *v23; // [sp-8h] [bp-50h]@21
Ritor1
parents:
diff changeset
76 const char *v24; // [sp-8h] [bp-50h]@37
Ritor1
parents:
diff changeset
77 const char *v25; // [sp-4h] [bp-4Ch]@12
Ritor1
parents:
diff changeset
78 char *v26; // [sp-4h] [bp-4Ch]@21
Ritor1
parents:
diff changeset
79 const char *v27; // [sp-4h] [bp-4Ch]@37
Ritor1
parents:
diff changeset
80 char v28[3]; // [sp+9h] [bp-3Fh]@19
Ritor1
parents:
diff changeset
81 char Str; // [sp+Ch] [bp-3Ch]@19
Ritor1
parents:
diff changeset
82 char Size[20]; // [sp+2Ch] [bp-1Ch]@15
Ritor1
parents:
diff changeset
83 char Source[4]; // [sp+40h] [bp-8h]@19
Ritor1
parents:
diff changeset
84 int v32; // [sp+44h] [bp-4h]@19
Ritor1
parents:
diff changeset
85 unsigned int uSpriteIDa; // [sp+50h] [bp+8h]@4
Ritor1
parents:
diff changeset
86
Ritor1
parents:
diff changeset
87 //v2 = this;
Ritor1
parents:
diff changeset
88 if ( (signed int)uSpriteID <= (signed int)this->uNumSpriteFrames )
Ritor1
parents:
diff changeset
89 {
Ritor1
parents:
diff changeset
90 if ( (uSpriteID & 0x80000000u) == 0 )
Ritor1
parents:
diff changeset
91 {
Ritor1
parents:
diff changeset
92 v3 = uSpriteID;
Ritor1
parents:
diff changeset
93
Ritor1
parents:
diff changeset
94 auto uFlags = pSpriteSFrames[uSpriteID].uFlags;
Ritor1
parents:
diff changeset
95 if (uFlags & 0x7F)
Ritor1
parents:
diff changeset
96 {
Ritor1
parents:
diff changeset
97 pSpriteSFrames[uSpriteID].uFlags |= 0x80;
Ritor1
parents:
diff changeset
98
Ritor1
parents:
diff changeset
99 uSpriteIDa = 30 * uSpriteID + 12;
Ritor1
parents:
diff changeset
100 while ( 1 )
Ritor1
parents:
diff changeset
101 {
Ritor1
parents:
diff changeset
102 pSpriteSFrames[v3].uPaletteIndex = pPaletteManager->LoadPalette(pSpriteSFrames[uSpriteID].uPaletteID);
Ritor1
parents:
diff changeset
103 v6 = &pSpriteSFrames[uSpriteID];
Ritor1
parents:
diff changeset
104 v7 = v6->uFlags;
Ritor1
parents:
diff changeset
105 if ( v7 & 0x10 )
Ritor1
parents:
diff changeset
106 {
Ritor1
parents:
diff changeset
107 v8 = pSprites_LOD->LoadSprite(v6->pTextureName, v6->uPaletteID);
Ritor1
parents:
diff changeset
108
Ritor1
parents:
diff changeset
109 for (uint i = 0; i < 8; ++i)
Ritor1
parents:
diff changeset
110 pSpriteSFrames[v3].pHwSpriteIDs[i] = v8;
Ritor1
parents:
diff changeset
111 goto LABEL_46;
Ritor1
parents:
diff changeset
112 }
Ritor1
parents:
diff changeset
113 if ( v7 & 0x10000 )
Ritor1
parents:
diff changeset
114 {
Ritor1
parents:
diff changeset
115 v11 = 0;
Ritor1
parents:
diff changeset
116 do
Ritor1
parents:
diff changeset
117 {
Ritor1
parents:
diff changeset
118 switch ( v11 )
Ritor1
parents:
diff changeset
119 {
Ritor1
parents:
diff changeset
120 case 3:
Ritor1
parents:
diff changeset
121 case 4:
Ritor1
parents:
diff changeset
122 case 5:
Ritor1
parents:
diff changeset
123 v25 = pSpriteSFrames[v3].pTextureName;
Ritor1
parents:
diff changeset
124 v22 = "%s4";
Ritor1
parents:
diff changeset
125 goto LABEL_15;
Ritor1
parents:
diff changeset
126 case 2:
Ritor1
parents:
diff changeset
127 case 6:
Ritor1
parents:
diff changeset
128 v25 = pSpriteSFrames[v3].pTextureName;
Ritor1
parents:
diff changeset
129 v22 = "%s2";
Ritor1
parents:
diff changeset
130 goto LABEL_15;
Ritor1
parents:
diff changeset
131 case 0:
Ritor1
parents:
diff changeset
132 case 1:
Ritor1
parents:
diff changeset
133 case 7:
Ritor1
parents:
diff changeset
134 v25 = pSpriteSFrames[v3].pTextureName;
Ritor1
parents:
diff changeset
135 v22 = "%s0";
Ritor1
parents:
diff changeset
136 LABEL_15:
Ritor1
parents:
diff changeset
137 sprintf(Size, v22, v25);
Ritor1
parents:
diff changeset
138 break;
Ritor1
parents:
diff changeset
139 default:
Ritor1
parents:
diff changeset
140 break;
Ritor1
parents:
diff changeset
141 }
Ritor1
parents:
diff changeset
142 v12 = pSprites_LOD->LoadSprite(Size, pSpriteSFrames[v3].uPaletteID);
Ritor1
parents:
diff changeset
143 v13 = v11++ + uSpriteIDa;
Ritor1
parents:
diff changeset
144 *(short *)&pSpriteSFrames->pIconName[2 * v13] = v12;
Ritor1
parents:
diff changeset
145 }
Ritor1
parents:
diff changeset
146 while ( v11 < 8 );
Ritor1
parents:
diff changeset
147 goto LABEL_46;
Ritor1
parents:
diff changeset
148 }
Ritor1
parents:
diff changeset
149 if ( !(v7 & 0x40) )
Ritor1
parents:
diff changeset
150 break;
Ritor1
parents:
diff changeset
151 strcpy(Source, "stA");
Ritor1
parents:
diff changeset
152 v32 = 0;
Ritor1
parents:
diff changeset
153 strcpy(&Str, v6->pTextureName);
Ritor1
parents:
diff changeset
154 v14 = strlen(&Str);
Ritor1
parents:
diff changeset
155 strcpy(&v28[v14], Source);
Ritor1
parents:
diff changeset
156 v15 = 0;
Ritor1
parents:
diff changeset
157 do
Ritor1
parents:
diff changeset
158 {
Ritor1
parents:
diff changeset
159 switch ( v15 )
Ritor1
parents:
diff changeset
160 {
Ritor1
parents:
diff changeset
161 case 0:
Ritor1
parents:
diff changeset
162 v26 = pSpriteSFrames[v3].pTextureName;
Ritor1
parents:
diff changeset
163 v23 = "%s0";
Ritor1
parents:
diff changeset
164 goto LABEL_26;
Ritor1
parents:
diff changeset
165 case 4:
Ritor1
parents:
diff changeset
166 v26 = &Str;
Ritor1
parents:
diff changeset
167 v23 = "%s4";
Ritor1
parents:
diff changeset
168 goto LABEL_26;
Ritor1
parents:
diff changeset
169 case 3:
Ritor1
parents:
diff changeset
170 case 5:
Ritor1
parents:
diff changeset
171 v26 = &Str;
Ritor1
parents:
diff changeset
172 v23 = "%s3";
Ritor1
parents:
diff changeset
173 goto LABEL_26;
Ritor1
parents:
diff changeset
174 case 2:
Ritor1
parents:
diff changeset
175 case 6:
Ritor1
parents:
diff changeset
176 v26 = pSpriteSFrames[v3].pTextureName;
Ritor1
parents:
diff changeset
177 v23 = "%s2";
Ritor1
parents:
diff changeset
178 goto LABEL_26;
Ritor1
parents:
diff changeset
179 case 1:
Ritor1
parents:
diff changeset
180 case 7:
Ritor1
parents:
diff changeset
181 v26 = pSpriteSFrames[v3].pTextureName;
Ritor1
parents:
diff changeset
182 v23 = "%s1";
Ritor1
parents:
diff changeset
183 LABEL_26:
Ritor1
parents:
diff changeset
184 sprintf(Size, v23, v26);
Ritor1
parents:
diff changeset
185 break;
Ritor1
parents:
diff changeset
186 default:
Ritor1
parents:
diff changeset
187 break;
Ritor1
parents:
diff changeset
188 }
Ritor1
parents:
diff changeset
189 v16 = pSprites_LOD->LoadSprite(Size, pSpriteSFrames[v3].uPaletteID);
Ritor1
parents:
diff changeset
190 v17 = v15++ + uSpriteIDa;
Ritor1
parents:
diff changeset
191 *(short *)&pSpriteSFrames->pIconName[2 * v17] = v16;
Ritor1
parents:
diff changeset
192 }
Ritor1
parents:
diff changeset
193 while ( v15 < 8 );
Ritor1
parents:
diff changeset
194 LABEL_46:
Ritor1
parents:
diff changeset
195 if ( !(pSpriteSFrames[v3].uFlags & 1) )
Ritor1
parents:
diff changeset
196 return;
Ritor1
parents:
diff changeset
197 uSpriteIDa += 30;
Ritor1
parents:
diff changeset
198 ++v3;
Ritor1
parents:
diff changeset
199 }
Ritor1
parents:
diff changeset
200 v18 = 0;
Ritor1
parents:
diff changeset
201 while ( 1 )
Ritor1
parents:
diff changeset
202 {
Ritor1
parents:
diff changeset
203 v19 = &pSpriteSFrames[v3];
Ritor1
parents:
diff changeset
204 if ( !((256 << v18) & v19->uFlags) )
Ritor1
parents:
diff changeset
205 {
Ritor1
parents:
diff changeset
206 sprintf(Size, "%s%i", v19->pTextureName, v18);
Ritor1
parents:
diff changeset
207 goto LABEL_45;
Ritor1
parents:
diff changeset
208 }
Ritor1
parents:
diff changeset
209 if ( v18 == 1 )
Ritor1
parents:
diff changeset
210 {
Ritor1
parents:
diff changeset
211 v27 = v19->pTextureName;
Ritor1
parents:
diff changeset
212 v24 = "%s7";
Ritor1
parents:
diff changeset
213 goto LABEL_42;
Ritor1
parents:
diff changeset
214 }
Ritor1
parents:
diff changeset
215 if ( v18 == 2 )
Ritor1
parents:
diff changeset
216 {
Ritor1
parents:
diff changeset
217 v27 = v19->pTextureName;
Ritor1
parents:
diff changeset
218 v24 = "%s6";
Ritor1
parents:
diff changeset
219 goto LABEL_42;
Ritor1
parents:
diff changeset
220 }
Ritor1
parents:
diff changeset
221 if ( v18 == 3 )
Ritor1
parents:
diff changeset
222 {
Ritor1
parents:
diff changeset
223 v27 = v19->pTextureName;
Ritor1
parents:
diff changeset
224 v24 = "%s5";
Ritor1
parents:
diff changeset
225 goto LABEL_42;
Ritor1
parents:
diff changeset
226 }
Ritor1
parents:
diff changeset
227 if ( v18 == 5 )
Ritor1
parents:
diff changeset
228 {
Ritor1
parents:
diff changeset
229 v27 = v19->pTextureName;
Ritor1
parents:
diff changeset
230 v24 = "%s3";
Ritor1
parents:
diff changeset
231 goto LABEL_42;
Ritor1
parents:
diff changeset
232 }
Ritor1
parents:
diff changeset
233 if ( v18 == 6 )
Ritor1
parents:
diff changeset
234 break;
Ritor1
parents:
diff changeset
235 if ( v18 == 7 )
Ritor1
parents:
diff changeset
236 {
Ritor1
parents:
diff changeset
237 v27 = v19->pTextureName;
Ritor1
parents:
diff changeset
238 v24 = "%s1";
Ritor1
parents:
diff changeset
239 LABEL_42:
Ritor1
parents:
diff changeset
240 sprintf(Size, v24, v27);
Ritor1
parents:
diff changeset
241 }
Ritor1
parents:
diff changeset
242 LABEL_45:
Ritor1
parents:
diff changeset
243 v20 = pSprites_LOD->LoadSprite(Size, pSpriteSFrames[v3].uPaletteID);
Ritor1
parents:
diff changeset
244 v21 = v18++ + uSpriteIDa;
Ritor1
parents:
diff changeset
245 *(short *)&pSpriteSFrames->pIconName[2 * v21] = v20;
Ritor1
parents:
diff changeset
246 if ( v18 >= 8 )
Ritor1
parents:
diff changeset
247 goto LABEL_46;
Ritor1
parents:
diff changeset
248 }
Ritor1
parents:
diff changeset
249 v27 = v19->pTextureName;
Ritor1
parents:
diff changeset
250 v24 = "%s2";
Ritor1
parents:
diff changeset
251 goto LABEL_42;
Ritor1
parents:
diff changeset
252 }
Ritor1
parents:
diff changeset
253 }
Ritor1
parents:
diff changeset
254 }
Ritor1
parents:
diff changeset
255 }
Ritor1
parents:
diff changeset
256
Ritor1
parents:
diff changeset
257 //----- (0044D813) --------------------------------------------------------
Ritor1
parents:
diff changeset
258 unsigned int SpriteFrameTable::FastFindSprite(char *pSpriteName)
Ritor1
parents:
diff changeset
259 {
Ritor1
parents:
diff changeset
260 SpriteFrameTable *v2; // esi@1
Ritor1
parents:
diff changeset
261 int v3; // eax@1
Ritor1
parents:
diff changeset
262 unsigned int result; // eax@2
Ritor1
parents:
diff changeset
263
Ritor1
parents:
diff changeset
264 v2 = this;
Ritor1
parents:
diff changeset
265 BinarySearch(0, this->uNumEFrames, pSpriteName);
Ritor1
parents:
diff changeset
266 v3 = v2->field_8;
Ritor1
parents:
diff changeset
267 if ( v3 < 0 )
Ritor1
parents:
diff changeset
268 result = 0;
Ritor1
parents:
diff changeset
269 else
Ritor1
parents:
diff changeset
270 result = v2->pSpriteEFrames[v3];
Ritor1
parents:
diff changeset
271 return result;
Ritor1
parents:
diff changeset
272 }
Ritor1
parents:
diff changeset
273
Ritor1
parents:
diff changeset
274 //----- (0044D83A) --------------------------------------------------------
Ritor1
parents:
diff changeset
275 void SpriteFrameTable::BinarySearch(int a2, int a3, const char *pSpriteName)
Ritor1
parents:
diff changeset
276 {
Ritor1
parents:
diff changeset
277 int v4; // ebx@1
Ritor1
parents:
diff changeset
278 SpriteFrameTable *v5; // edi@1
Ritor1
parents:
diff changeset
279 int v6; // esi@2
Ritor1
parents:
diff changeset
280 int v7; // eax@2
Ritor1
parents:
diff changeset
281 int a2a; // [sp+14h] [bp+8h]@2
Ritor1
parents:
diff changeset
282
Ritor1
parents:
diff changeset
283 v4 = a2;
Ritor1
parents:
diff changeset
284 v5 = this;
Ritor1
parents:
diff changeset
285 while ( 1 )
Ritor1
parents:
diff changeset
286 {
Ritor1
parents:
diff changeset
287 a2a = a3 - v4;
Ritor1
parents:
diff changeset
288 v6 = (a3 - v4) / 2 + v4;
Ritor1
parents:
diff changeset
289 v7 = _strcmpi(pSpriteName, v5->pSpritePFrames[v6]->pIconName);
Ritor1
parents:
diff changeset
290 if ( !v7 )
Ritor1
parents:
diff changeset
291 v5->field_8 = v6;
Ritor1
parents:
diff changeset
292 if ( v4 == a3 )
Ritor1
parents:
diff changeset
293 break;
Ritor1
parents:
diff changeset
294 if ( v7 >= 0 )
Ritor1
parents:
diff changeset
295 {
Ritor1
parents:
diff changeset
296 if ( a2a <= 4 )
Ritor1
parents:
diff changeset
297 {
Ritor1
parents:
diff changeset
298 while ( v4 < a3 )
Ritor1
parents:
diff changeset
299 {
Ritor1
parents:
diff changeset
300 if ( !_strcmpi(pSpriteName, v5->pSpritePFrames[v4]->pIconName) )
Ritor1
parents:
diff changeset
301 {
Ritor1
parents:
diff changeset
302 LABEL_19:
Ritor1
parents:
diff changeset
303 v5->field_8 = v4;
Ritor1
parents:
diff changeset
304 return;
Ritor1
parents:
diff changeset
305 }
Ritor1
parents:
diff changeset
306 ++v4;
Ritor1
parents:
diff changeset
307 }
Ritor1
parents:
diff changeset
308 break;
Ritor1
parents:
diff changeset
309 }
Ritor1
parents:
diff changeset
310 v4 += (a3 - v4) / 2;
Ritor1
parents:
diff changeset
311 }
Ritor1
parents:
diff changeset
312 else
Ritor1
parents:
diff changeset
313 {
Ritor1
parents:
diff changeset
314 if ( a2a <= 4 )
Ritor1
parents:
diff changeset
315 {
Ritor1
parents:
diff changeset
316 while ( v4 < a3 )
Ritor1
parents:
diff changeset
317 {
Ritor1
parents:
diff changeset
318 if ( !_strcmpi(pSpriteName, v5->pSpritePFrames[v4]->pIconName) )
Ritor1
parents:
diff changeset
319 goto LABEL_19;
Ritor1
parents:
diff changeset
320 ++v4;
Ritor1
parents:
diff changeset
321 }
Ritor1
parents:
diff changeset
322 break;
Ritor1
parents:
diff changeset
323 }
Ritor1
parents:
diff changeset
324 a3 = (a3 - v4) / 2 + v4;
Ritor1
parents:
diff changeset
325 }
Ritor1
parents:
diff changeset
326 }
Ritor1
parents:
diff changeset
327 v5->field_8 = -1;
Ritor1
parents:
diff changeset
328 }
Ritor1
parents:
diff changeset
329
Ritor1
parents:
diff changeset
330 //----- (0044D8D0) --------------------------------------------------------
Ritor1
parents:
diff changeset
331 SpriteFrame *SpriteFrameTable::GetFrame(unsigned int uSpriteID, unsigned int uFrameID)
Ritor1
parents:
diff changeset
332 {
Ritor1
parents:
diff changeset
333 SpriteFrame *v3; // edi@1
Ritor1
parents:
diff changeset
334 SpriteFrame *v4; // ecx@1
Ritor1
parents:
diff changeset
335 __int16 v5; // dx@2
Ritor1
parents:
diff changeset
336 int v6; // edx@3
Ritor1
parents:
diff changeset
337 unsigned int v7; // eax@3
Ritor1
parents:
diff changeset
338 char *i; // ecx@3
Ritor1
parents:
diff changeset
339 int v9; // esi@5
Ritor1
parents:
diff changeset
340 SpriteFrame *result; // eax@6
Ritor1
parents:
diff changeset
341
Ritor1
parents:
diff changeset
342 v3 = this->pSpriteSFrames;
Ritor1
parents:
diff changeset
343 v4 = &v3[uSpriteID];
Ritor1
parents:
diff changeset
344 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 )
Ritor1
parents:
diff changeset
345 {
Ritor1
parents:
diff changeset
346 v6 = ((signed int)uFrameID >> 3) % v5;
Ritor1
parents:
diff changeset
347 v7 = uSpriteID;
Ritor1
parents:
diff changeset
348 for ( i = (char *)&v4->uAnimTime; ; i += 60 )
Ritor1
parents:
diff changeset
349 {
Ritor1
parents:
diff changeset
350 v9 = *(short *)i;
Ritor1
parents:
diff changeset
351 if ( v6 <= v9 )
Ritor1
parents:
diff changeset
352 break;
Ritor1
parents:
diff changeset
353 v6 -= v9;
Ritor1
parents:
diff changeset
354 ++v7;
Ritor1
parents:
diff changeset
355 }
Ritor1
parents:
diff changeset
356 result = &v3[v7];
Ritor1
parents:
diff changeset
357 }
Ritor1
parents:
diff changeset
358 else
Ritor1
parents:
diff changeset
359 {
Ritor1
parents:
diff changeset
360 result = &v3[uSpriteID];
Ritor1
parents:
diff changeset
361 }
Ritor1
parents:
diff changeset
362 return result;
Ritor1
parents:
diff changeset
363 }
Ritor1
parents:
diff changeset
364
Ritor1
parents:
diff changeset
365 //----- (0044D91F) --------------------------------------------------------
Ritor1
parents:
diff changeset
366 SpriteFrame *SpriteFrameTable::GetFrameBy_x(unsigned int uSpriteID, signed int a3)
Ritor1
parents:
diff changeset
367 {
Ritor1
parents:
diff changeset
368 SpriteFrame *v3; // edi@1
Ritor1
parents:
diff changeset
369 SpriteFrame *v4; // esi@1
Ritor1
parents:
diff changeset
370 __int16 v5; // ax@2
Ritor1
parents:
diff changeset
371 int v6; // ecx@3
Ritor1
parents:
diff changeset
372 int v7; // edx@3
Ritor1
parents:
diff changeset
373 unsigned int v8; // eax@3
Ritor1
parents:
diff changeset
374 int v9; // ecx@3
Ritor1
parents:
diff changeset
375 char *i; // edx@3
Ritor1
parents:
diff changeset
376 int v11; // esi@5
Ritor1
parents:
diff changeset
377 SpriteFrame *result; // eax@6
Ritor1
parents:
diff changeset
378
Ritor1
parents:
diff changeset
379 v3 = this->pSpriteSFrames;
Ritor1
parents:
diff changeset
380 v4 = &v3[uSpriteID];
Ritor1
parents:
diff changeset
381 if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 )
Ritor1
parents:
diff changeset
382 {
Ritor1
parents:
diff changeset
383 v6 = v5;
Ritor1
parents:
diff changeset
384 v7 = a3 % v5;
Ritor1
parents:
diff changeset
385 v8 = uSpriteID;
Ritor1
parents:
diff changeset
386 v9 = v6 - v7;
Ritor1
parents:
diff changeset
387 for ( i = (char *)&v4->uAnimTime; ; i += 60 )
Ritor1
parents:
diff changeset
388 {
Ritor1
parents:
diff changeset
389 v11 = *(short *)i;
Ritor1
parents:
diff changeset
390 if ( v9 <= v11 )
Ritor1
parents:
diff changeset
391 break;
Ritor1
parents:
diff changeset
392 v9 -= v11;
Ritor1
parents:
diff changeset
393 ++v8;
Ritor1
parents:
diff changeset
394 }
Ritor1
parents:
diff changeset
395 result = &v3[v8];
Ritor1
parents:
diff changeset
396 }
Ritor1
parents:
diff changeset
397 else
Ritor1
parents:
diff changeset
398 {
Ritor1
parents:
diff changeset
399 result = &v3[uSpriteID];
Ritor1
parents:
diff changeset
400 }
Ritor1
parents:
diff changeset
401 return result;
Ritor1
parents:
diff changeset
402 }
Ritor1
parents:
diff changeset
403
Ritor1
parents:
diff changeset
404 //----- (0044D96D) --------------------------------------------------------
Ritor1
parents:
diff changeset
405 void SpriteFrameTable::ToFile()
Ritor1
parents:
diff changeset
406 {
Ritor1
parents:
diff changeset
407 SpriteFrameTable *v1; // esi@1
Ritor1
parents:
diff changeset
408 FILE *v2; // eax@1
Ritor1
parents:
diff changeset
409 FILE *v3; // edi@1
Ritor1
parents:
diff changeset
410
Ritor1
parents:
diff changeset
411 v1 = this;
Ritor1
parents:
diff changeset
412 v2 = fopen("data\\dsft.bin", "wb");
Ritor1
parents:
diff changeset
413 v3 = v2;
Ritor1
parents:
diff changeset
414 if ( !v2 )
Ritor1
parents:
diff changeset
415 Abortf("Unable to save dsft.bin!");
Ritor1
parents:
diff changeset
416 fwrite(v1, 4u, 1u, v2);
Ritor1
parents:
diff changeset
417 fwrite(&v1->uNumEFrames, 4u, 1u, v3);
Ritor1
parents:
diff changeset
418 fwrite(v1->pSpriteSFrames, 0x3Cu, v1->uNumSpriteFrames, v3);
Ritor1
parents:
diff changeset
419 fwrite(v1->pSpriteEFrames, 2u, v1->uNumEFrames, v3);
Ritor1
parents:
diff changeset
420 fclose(v3);
Ritor1
parents:
diff changeset
421 }
Ritor1
parents:
diff changeset
422
Ritor1
parents:
diff changeset
423 //----- (0044D9D7) --------------------------------------------------------
Ritor1
parents:
diff changeset
424 void SpriteFrameTable::FromFile(void *pSerialized)
Ritor1
parents:
diff changeset
425 {
Ritor1
parents:
diff changeset
426 //v2 = this;
Ritor1
parents:
diff changeset
427 uNumSpriteFrames = *(int *)pSerialized;
Ritor1
parents:
diff changeset
428 uNumEFrames = *((int *)pSerialized + 1);
Ritor1
parents:
diff changeset
429 //memcpy(this, pSerialized, 4u);
Ritor1
parents:
diff changeset
430 //memcpy(&v2->field_4, (char *)pSerialized + 4, 4u);
Ritor1
parents:
diff changeset
431 pSpriteSFrames = (SpriteFrame *)pAllocator->AllocNamedChunk(pSpriteSFrames, 60 * uNumSpriteFrames, "S Frames");
Ritor1
parents:
diff changeset
432 pSpriteEFrames = (__int16 *)pAllocator->AllocNamedChunk(pSpriteEFrames, 2 * uNumSpriteFrames, "E Frames");
Ritor1
parents:
diff changeset
433 //v3 = pAllocator->AllocNamedChunk(pSpritePFrames, 4 * uNumSpriteFrames, "P Frames");
Ritor1
parents:
diff changeset
434 //v4 = v2->uNumSpriteFrames;
Ritor1
parents:
diff changeset
435 pSpritePFrames = (SpriteFrame **)pAllocator->AllocNamedChunk(pSpritePFrames, 4 * uNumSpriteFrames, "P Frames");
Ritor1
parents:
diff changeset
436 auto uSpriteFramesSize = 60 * uNumSpriteFrames;
Ritor1
parents:
diff changeset
437 memcpy(pSpriteSFrames, (char *)pSerialized + 8, uSpriteFramesSize);
Ritor1
parents:
diff changeset
438 memcpy(pSpriteEFrames, (char *)pSerialized + uSpriteFramesSize + 8, 2 * uNumEFrames);
Ritor1
parents:
diff changeset
439 for (uint i = 0; i < uNumSpriteFrames; ++i)
Ritor1
parents:
diff changeset
440 pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]];
Ritor1
parents:
diff changeset
441 }
Ritor1
parents:
diff changeset
442
Ritor1
parents:
diff changeset
443 //----- (0044DA92) --------------------------------------------------------
Ritor1
parents:
diff changeset
444 bool SpriteFrameTable::FromFileTxt(const char *Args)
Ritor1
parents:
diff changeset
445 {
Ritor1
parents:
diff changeset
446 SpriteFrameTable *v2; // ebx@1
Ritor1
parents:
diff changeset
447 FILE *v3; // eax@1
Ritor1
parents:
diff changeset
448 unsigned int v4; // esi@3
Ritor1
parents:
diff changeset
449 signed int result; // eax@10
Ritor1
parents:
diff changeset
450 FILE *v6; // ST18_4@11
Ritor1
parents:
diff changeset
451 char *i; // eax@11
Ritor1
parents:
diff changeset
452 const char *v8; // ST20_4@14
Ritor1
parents:
diff changeset
453 __int16 v9; // ax@14
Ritor1
parents:
diff changeset
454 const char *v10; // ST0C_4@14
Ritor1
parents:
diff changeset
455 double v11; // st7@14
Ritor1
parents:
diff changeset
456 int v12; // eax@14
Ritor1
parents:
diff changeset
457 const char *v13; // ST04_4@14
Ritor1
parents:
diff changeset
458 __int16 v14; // ax@14
Ritor1
parents:
diff changeset
459 const char *v15; // ST00_4@14
Ritor1
parents:
diff changeset
460 int v16; // eax@14
Ritor1
parents:
diff changeset
461 int v17; // eax@17
Ritor1
parents:
diff changeset
462 int v18; // eax@23
Ritor1
parents:
diff changeset
463 int v19; // eax@24
Ritor1
parents:
diff changeset
464 int v20; // eax@25
Ritor1
parents:
diff changeset
465 int v21; // eax@28
Ritor1
parents:
diff changeset
466 int v22; // eax@29
Ritor1
parents:
diff changeset
467 int j; // edi@30
Ritor1
parents:
diff changeset
468 const char *v24; // esi@31
Ritor1
parents:
diff changeset
469 int v25; // eax@32
Ritor1
parents:
diff changeset
470 int v26; // edx@53
Ritor1
parents:
diff changeset
471 int v27; // ecx@54
Ritor1
parents:
diff changeset
472 int v28; // eax@55
Ritor1
parents:
diff changeset
473 signed int k; // edx@58
Ritor1
parents:
diff changeset
474 SpriteFrame *v30; // ecx@59
Ritor1
parents:
diff changeset
475 int v31; // esi@59
Ritor1
parents:
diff changeset
476 int l; // eax@60
Ritor1
parents:
diff changeset
477 signed int v33; // eax@65
Ritor1
parents:
diff changeset
478 int v34; // edi@66
Ritor1
parents:
diff changeset
479 int v35; // esi@66
Ritor1
parents:
diff changeset
480 SpriteFrame **v36; // eax@69
Ritor1
parents:
diff changeset
481 int v37; // ecx@69
Ritor1
parents:
diff changeset
482 SpriteFrame *v38; // edx@69
Ritor1
parents:
diff changeset
483 __int16 *v39; // eax@69
Ritor1
parents:
diff changeset
484 int v40; // ecx@69
Ritor1
parents:
diff changeset
485 char Buf[500]; // [sp+Ch] [bp-2F0h]@3
Ritor1
parents:
diff changeset
486 FrameTableTxtLine v42; // [sp+200h] [bp-FCh]@4
Ritor1
parents:
diff changeset
487 FrameTableTxtLine v43; // [sp+27Ch] [bp-80h]@4
Ritor1
parents:
diff changeset
488 FILE *File; // [sp+2F8h] [bp-4h]@1
Ritor1
parents:
diff changeset
489 unsigned int Argsa; // [sp+304h] [bp+8h]@3
Ritor1
parents:
diff changeset
490 int Argsb; // [sp+304h] [bp+8h]@59
Ritor1
parents:
diff changeset
491 FILE *Argsc; // [sp+304h] [bp+8h]@67
Ritor1
parents:
diff changeset
492
Ritor1
parents:
diff changeset
493 v2 = this;
Ritor1
parents:
diff changeset
494 ReleaseSFrames();
Ritor1
parents:
diff changeset
495 v3 = fopen(Args, "r");
Ritor1
parents:
diff changeset
496 File = v3;
Ritor1
parents:
diff changeset
497 if ( !v3 )
Ritor1
parents:
diff changeset
498 Abortf("CSpriteFrameTable::load - Unable to open file: %s.", Args);
Ritor1
parents:
diff changeset
499 v4 = 0;
Ritor1
parents:
diff changeset
500 Argsa = 0;
Ritor1
parents:
diff changeset
501 if ( fgets(Buf, 490, v3) )
Ritor1
parents:
diff changeset
502 {
Ritor1
parents:
diff changeset
503 do
Ritor1
parents:
diff changeset
504 {
Ritor1
parents:
diff changeset
505 *strchr(Buf, '\n') = 0;
Ritor1
parents:
diff changeset
506 memcpy(&v43, frame_table_txt_parser(Buf, &v42), sizeof(v43));
Ritor1
parents:
diff changeset
507 if ( v43.field_0 && *v43.pProperties[0] != '/' )
Ritor1
parents:
diff changeset
508 ++Argsa;
Ritor1
parents:
diff changeset
509 }
Ritor1
parents:
diff changeset
510 while ( fgets(Buf, 490, File) );
Ritor1
parents:
diff changeset
511 v4 = Argsa;
Ritor1
parents:
diff changeset
512 }
Ritor1
parents:
diff changeset
513 v2->uNumSpriteFrames = v4;
Ritor1
parents:
diff changeset
514 v2->pSpriteSFrames = (SpriteFrame *)pAllocator->AllocNamedChunk(v2->pSpriteSFrames, 60 * v4, "S Frames");
Ritor1
parents:
diff changeset
515 v2->pSpriteEFrames = (__int16 *)pAllocator->AllocNamedChunk(
Ritor1
parents:
diff changeset
516 v2->pSpriteEFrames,
Ritor1
parents:
diff changeset
517 2 * v2->uNumSpriteFrames,
Ritor1
parents:
diff changeset
518 "E Frames");
Ritor1
parents:
diff changeset
519 v2->pSpritePFrames = (SpriteFrame **)pAllocator->AllocNamedChunk(
Ritor1
parents:
diff changeset
520 v2->pSpritePFrames,
Ritor1
parents:
diff changeset
521 4 * v2->uNumSpriteFrames,
Ritor1
parents:
diff changeset
522 "P Frames");
Ritor1
parents:
diff changeset
523 if ( v2->pSpriteSFrames )
Ritor1
parents:
diff changeset
524 {
Ritor1
parents:
diff changeset
525 v6 = File;
Ritor1
parents:
diff changeset
526 v2->uNumSpriteFrames = 0;
Ritor1
parents:
diff changeset
527 fseek(v6, 0, 0);
Ritor1
parents:
diff changeset
528 for ( i = fgets(Buf, 490, File); i; i = fgets(Buf, 490, File) )
Ritor1
parents:
diff changeset
529 {
Ritor1
parents:
diff changeset
530 *strchr(Buf, 10) = 0;
Ritor1
parents:
diff changeset
531 memcpy(&v43, frame_table_txt_parser(Buf, &v42), sizeof(v43));
Ritor1
parents:
diff changeset
532 if ( v43.field_0 && *v43.pProperties[0] != '/' )
Ritor1
parents:
diff changeset
533 {
Ritor1
parents:
diff changeset
534 v8 = v43.pProperties[0];
Ritor1
parents:
diff changeset
535 v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags = 0;
Ritor1
parents:
diff changeset
536 v2->pSpriteSFrames[v2->uNumSpriteFrames].uPaletteIndex = 0;
Ritor1
parents:
diff changeset
537 strcpy(v2->pSpriteSFrames[v2->uNumSpriteFrames].pIconName, v8);
Ritor1
parents:
diff changeset
538 strcpy(v2->pSpriteSFrames[v2->uNumSpriteFrames].pTextureName, v43.pProperties[1]);
Ritor1
parents:
diff changeset
539 v9 = atoi(v43.pProperties[3]);
Ritor1
parents:
diff changeset
540 v10 = v43.pProperties[4];
Ritor1
parents:
diff changeset
541 v2->pSpriteSFrames[v2->uNumSpriteFrames].uPaletteID = v9;
Ritor1
parents:
diff changeset
542 v11 = atof(v10) * 65536.0;
Ritor1
parents:
diff changeset
543 v12 = abs((signed __int64)v11);
Ritor1
parents:
diff changeset
544 v13 = v43.pProperties[5];
Ritor1
parents:
diff changeset
545 v2->pSpriteSFrames[v2->uNumSpriteFrames].scale = v12;
Ritor1
parents:
diff changeset
546 v14 = atoi(v13);
Ritor1
parents:
diff changeset
547 v15 = v43.pProperties[6];
Ritor1
parents:
diff changeset
548 v2->pSpriteSFrames[v2->uNumSpriteFrames].uGlowRadius = v14;
Ritor1
parents:
diff changeset
549 v2->pSpriteSFrames[v2->uNumSpriteFrames].uAnimTime = atoi(v15);
Ritor1
parents:
diff changeset
550 v16 = (int)&v2->pSpriteSFrames[v2->uNumSpriteFrames];
Ritor1
parents:
diff changeset
551 if ( *(short *)(v16 + 48) )
Ritor1
parents:
diff changeset
552 *(int *)(v16 + 44) |= 2u;
Ritor1
parents:
diff changeset
553 if ( !_strcmpi(v43.pProperties[2], "new") )
Ritor1
parents:
diff changeset
554 {
Ritor1
parents:
diff changeset
555 v17 = (int)&v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags;
Ritor1
parents:
diff changeset
556 *(int *)v17 |= 4u;
Ritor1
parents:
diff changeset
557 v2->pSpritePFrames[v2->uNumEFrames] = &v2->pSpriteSFrames[v2->uNumSpriteFrames];
Ritor1
parents:
diff changeset
558 v2->pSpriteEFrames[v2->uNumEFrames++] = LOWORD(v2->uNumSpriteFrames);
Ritor1
parents:
diff changeset
559 }
Ritor1
parents:
diff changeset
560 if ( !_strcmpi(v43.pProperties[10], "1") )
Ritor1
parents:
diff changeset
561 BYTE2(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 4u;
Ritor1
parents:
diff changeset
562 if ( !_strcmpi(v43.pProperties[11], "1") )
Ritor1
parents:
diff changeset
563 BYTE2(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 2u;
Ritor1
parents:
diff changeset
564 if ( !_strcmpi(v43.pProperties[12], "1") )
Ritor1
parents:
diff changeset
565 {
Ritor1
parents:
diff changeset
566 v18 = (int)&v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags;
Ritor1
parents:
diff changeset
567 *(int *)v18 |= 0x20u;
Ritor1
parents:
diff changeset
568 }
Ritor1
parents:
diff changeset
569 v19 = atoi(v43.pProperties[7]) - 1;
Ritor1
parents:
diff changeset
570 if ( v19 )
Ritor1
parents:
diff changeset
571 {
Ritor1
parents:
diff changeset
572 v20 = v19 - 2;
Ritor1
parents:
diff changeset
573 if ( v20 )
Ritor1
parents:
diff changeset
574 {
Ritor1
parents:
diff changeset
575 if ( v20 == 2 )
Ritor1
parents:
diff changeset
576 BYTE1(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 0xE0u;
Ritor1
parents:
diff changeset
577 }
Ritor1
parents:
diff changeset
578 else
Ritor1
parents:
diff changeset
579 {
Ritor1
parents:
diff changeset
580 v21 = (int)&v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags;
Ritor1
parents:
diff changeset
581 *(int *)v21 |= 0x1E000u;
Ritor1
parents:
diff changeset
582 }
Ritor1
parents:
diff changeset
583 }
Ritor1
parents:
diff changeset
584 else
Ritor1
parents:
diff changeset
585 {
Ritor1
parents:
diff changeset
586 v22 = (int)&v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags;
Ritor1
parents:
diff changeset
587 *(int *)v22 |= 0x10u;
Ritor1
parents:
diff changeset
588 }
Ritor1
parents:
diff changeset
589 for ( j = 13; j < v43.field_0; ++j )
Ritor1
parents:
diff changeset
590 {
Ritor1
parents:
diff changeset
591 v24 = v43.pProperties[j];
Ritor1
parents:
diff changeset
592 if ( _strcmpi(v43.pProperties[j], "Luminous") )
Ritor1
parents:
diff changeset
593 {
Ritor1
parents:
diff changeset
594 if ( _strcmpi(v24, "Mirror0") )
Ritor1
parents:
diff changeset
595 {
Ritor1
parents:
diff changeset
596 if ( _strcmpi(v24, "Mirror1") )
Ritor1
parents:
diff changeset
597 {
Ritor1
parents:
diff changeset
598 if ( _strcmpi(v24, "Mirror2") )
Ritor1
parents:
diff changeset
599 {
Ritor1
parents:
diff changeset
600 if ( _strcmpi(v24, "Mirror3") )
Ritor1
parents:
diff changeset
601 {
Ritor1
parents:
diff changeset
602 if ( _strcmpi(v24, "Mirror4") )
Ritor1
parents:
diff changeset
603 {
Ritor1
parents:
diff changeset
604 if ( _strcmpi(v24, "Mirror5") )
Ritor1
parents:
diff changeset
605 {
Ritor1
parents:
diff changeset
606 if ( _strcmpi(v24, "Mirror6") )
Ritor1
parents:
diff changeset
607 {
Ritor1
parents:
diff changeset
608 if ( !_strcmpi(v24, "Mirror7") )
Ritor1
parents:
diff changeset
609 BYTE1(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 0x80u;
Ritor1
parents:
diff changeset
610 }
Ritor1
parents:
diff changeset
611 else
Ritor1
parents:
diff changeset
612 {
Ritor1
parents:
diff changeset
613 BYTE1(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 0x40u;
Ritor1
parents:
diff changeset
614 }
Ritor1
parents:
diff changeset
615 }
Ritor1
parents:
diff changeset
616 else
Ritor1
parents:
diff changeset
617 {
Ritor1
parents:
diff changeset
618 BYTE1(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 0x20u;
Ritor1
parents:
diff changeset
619 }
Ritor1
parents:
diff changeset
620 }
Ritor1
parents:
diff changeset
621 else
Ritor1
parents:
diff changeset
622 {
Ritor1
parents:
diff changeset
623 BYTE1(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 0x10u;
Ritor1
parents:
diff changeset
624 }
Ritor1
parents:
diff changeset
625 }
Ritor1
parents:
diff changeset
626 else
Ritor1
parents:
diff changeset
627 {
Ritor1
parents:
diff changeset
628 BYTE1(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 8u;
Ritor1
parents:
diff changeset
629 }
Ritor1
parents:
diff changeset
630 }
Ritor1
parents:
diff changeset
631 else
Ritor1
parents:
diff changeset
632 {
Ritor1
parents:
diff changeset
633 BYTE1(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 4u;
Ritor1
parents:
diff changeset
634 }
Ritor1
parents:
diff changeset
635 }
Ritor1
parents:
diff changeset
636 else
Ritor1
parents:
diff changeset
637 {
Ritor1
parents:
diff changeset
638 BYTE1(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 2u;
Ritor1
parents:
diff changeset
639 }
Ritor1
parents:
diff changeset
640 }
Ritor1
parents:
diff changeset
641 else
Ritor1
parents:
diff changeset
642 {
Ritor1
parents:
diff changeset
643 BYTE1(v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags) |= 1u;
Ritor1
parents:
diff changeset
644 }
Ritor1
parents:
diff changeset
645 }
Ritor1
parents:
diff changeset
646 else
Ritor1
parents:
diff changeset
647 {
Ritor1
parents:
diff changeset
648 v25 = (int)&v2->pSpriteSFrames[v2->uNumSpriteFrames].uFlags;
Ritor1
parents:
diff changeset
649 *(int *)v25 |= 2u;
Ritor1
parents:
diff changeset
650 }
Ritor1
parents:
diff changeset
651 }
Ritor1
parents:
diff changeset
652 ++v2->uNumSpriteFrames;
Ritor1
parents:
diff changeset
653 }
Ritor1
parents:
diff changeset
654 }
Ritor1
parents:
diff changeset
655 fclose(File);
Ritor1
parents:
diff changeset
656 v26 = 0;
Ritor1
parents:
diff changeset
657 if ( (signed int)(v2->uNumSpriteFrames - 1) > 0 )
Ritor1
parents:
diff changeset
658 {
Ritor1
parents:
diff changeset
659 v27 = 0;
Ritor1
parents:
diff changeset
660 do
Ritor1
parents:
diff changeset
661 {
Ritor1
parents:
diff changeset
662 v28 = (int)&v2->pSpriteSFrames[v27];
Ritor1
parents:
diff changeset
663 if ( !(*(char *)(v28 + 104) & 4) )
Ritor1
parents:
diff changeset
664 *(int *)(v28 + 44) |= 1u;
Ritor1
parents:
diff changeset
665 ++v26;
Ritor1
parents:
diff changeset
666 ++v27;
Ritor1
parents:
diff changeset
667 }
Ritor1
parents:
diff changeset
668 while ( v26 < (signed int)(v2->uNumSpriteFrames - 1) );
Ritor1
parents:
diff changeset
669 }
Ritor1
parents:
diff changeset
670 for ( k = 0; k < (signed int)v2->uNumSpriteFrames; *(short *)(Argsb + 56) = v31 )
Ritor1
parents:
diff changeset
671 {
Ritor1
parents:
diff changeset
672 v30 = v2->pSpriteSFrames;
Ritor1
parents:
diff changeset
673 Argsb = (int)&v30[k];
Ritor1
parents:
diff changeset
674 v31 = *(short *)(Argsb + 54);
Ritor1
parents:
diff changeset
675 if ( *(char *)(Argsb + 44) & 1 )
Ritor1
parents:
diff changeset
676 {
Ritor1
parents:
diff changeset
677 ++k;
Ritor1
parents:
diff changeset
678 for ( l = (int)&v30[k]; *(char *)(l + 44) & 1; l += 60 )
Ritor1
parents:
diff changeset
679 {
Ritor1
parents:
diff changeset
680 v31 += *(short *)(l + 54);
Ritor1
parents:
diff changeset
681 ++k;
Ritor1
parents:
diff changeset
682 }
Ritor1
parents:
diff changeset
683 LOWORD(v31) = v30[k].uAnimTime + v31;
Ritor1
parents:
diff changeset
684 }
Ritor1
parents:
diff changeset
685 ++k;
Ritor1
parents:
diff changeset
686 }
Ritor1
parents:
diff changeset
687 v33 = v2->uNumEFrames;
Ritor1
parents:
diff changeset
688 if ( v33 > 0 )
Ritor1
parents:
diff changeset
689 {
Ritor1
parents:
diff changeset
690 v34 = 0;
Ritor1
parents:
diff changeset
691 v35 = 0;
Ritor1
parents:
diff changeset
692 File = (FILE *)1;
Ritor1
parents:
diff changeset
693 do
Ritor1
parents:
diff changeset
694 {
Ritor1
parents:
diff changeset
695 Argsc = File;
Ritor1
parents:
diff changeset
696 if ( (signed int)File < v33 )
Ritor1
parents:
diff changeset
697 {
Ritor1
parents:
diff changeset
698 do
Ritor1
parents:
diff changeset
699 {
Ritor1
parents:
diff changeset
700 if ( _strcmpi(v2->pSpritePFrames[(int)Argsc]->pIconName, v2->pSpritePFrames[v35]->pIconName) < 0 )
Ritor1
parents:
diff changeset
701 {
Ritor1
parents:
diff changeset
702 v36 = v2->pSpritePFrames;
Ritor1
parents:
diff changeset
703 v37 = (int)&v36[(int)Argsc];
Ritor1
parents:
diff changeset
704 v38 = *(SpriteFrame **)v37;
Ritor1
parents:
diff changeset
705 *(int *)v37 = (int)v36[v35];
Ritor1
parents:
diff changeset
706 v2->pSpritePFrames[v35] = v38;
Ritor1
parents:
diff changeset
707 v39 = v2->pSpriteEFrames;
Ritor1
parents:
diff changeset
708 v40 = (int)&v39[(int)Argsc];
Ritor1
parents:
diff changeset
709 LOWORD(v38) = *(short *)v40;
Ritor1
parents:
diff changeset
710 *(short *)v40 = v39[v34];
Ritor1
parents:
diff changeset
711 v2->pSpriteEFrames[v34] = (signed __int16)v38;
Ritor1
parents:
diff changeset
712 }
Ritor1
parents:
diff changeset
713 Argsc = (FILE *)((char *)Argsc + 1);
Ritor1
parents:
diff changeset
714 }
Ritor1
parents:
diff changeset
715 while ( (signed int)Argsc < v2->uNumEFrames );
Ritor1
parents:
diff changeset
716 }
Ritor1
parents:
diff changeset
717 File = (FILE *)((char *)File + 1);
Ritor1
parents:
diff changeset
718 v33 = v2->uNumEFrames;
Ritor1
parents:
diff changeset
719 ++v35;
Ritor1
parents:
diff changeset
720 ++v34;
Ritor1
parents:
diff changeset
721 }
Ritor1
parents:
diff changeset
722 while ( (signed int)((char *)File - 1) < v33 );
Ritor1
parents:
diff changeset
723 }
Ritor1
parents:
diff changeset
724 result = 1;
Ritor1
parents:
diff changeset
725 }
Ritor1
parents:
diff changeset
726 else
Ritor1
parents:
diff changeset
727 {
Ritor1
parents:
diff changeset
728 MessageBoxW(nullptr, L"CSpriteFrameTable::load - Out of Memory!", nullptr, 0);
Ritor1
parents:
diff changeset
729 fclose(File);
Ritor1
parents:
diff changeset
730 result = 0;
Ritor1
parents:
diff changeset
731 }
Ritor1
parents:
diff changeset
732 return result;
Ritor1
parents:
diff changeset
733 }