annotate Sprites.cpp @ 144:38a1c8ef6874

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