annotate LOD.cpp @ 112:8feb2dfd2f89

6.11.12b
author Ritor1
date Wed, 07 Nov 2012 17:55:13 +0600
parents 430786d916d6
children 75faebd0a975 6e0346bc7014 d2ca891da89f
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #include "LOD.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2 #include "Render.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3 #include "Allocator.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 #include "PaletteManager.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5 #include "Viewport.h"
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
6 #include "Log.h"
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8 #include "mm7_data.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9
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
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
16 LODFile_IconsBitmaps *pEvents_LOD;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17 LODFile_IconsBitmaps *pIcons_LOD;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18 LODFile_Sprites *pSprites_LOD;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19 LODFile_IconsBitmaps *pBitmaps_LOD;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 LODWriteableFile *pNew_LOD;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22 LODWriteableFile *pGames_LOD;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
27 int _6A0CA4_lod_binary_search; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28 int _6A0CA8_lod_unused; // weak
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34 //----- (004355F7) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35 void LODFile_IconsBitmaps::_4355F7()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 LODFile_IconsBitmaps *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38 int v2; // edi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39 Texture *v3; // ebp@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
40 struct IDirect3DTexture2 **v4; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41 struct IDirect3DTexture2 *v5; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42 struct IDirectDrawSurface **v6; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43 struct IDirectDrawSurface *v7; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44 int v8; // eax@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
45
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
46 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
47 if ( this->uTexturePacksCount )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
48 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
49 v2 = this->uNumLoadedFiles - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
50 if ( v2 >= this->uNumPrevLoadedFiles )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
51 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
52 v3 = &this->pTextures[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
53 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
54 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
55 v3->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
56 v4 = v1->pHardwareTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
57 if ( v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
58 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
59 v5 = v4[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
60 if ( v5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
61 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
62 v5->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
63 v1->pHardwareTextures[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
64 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
65 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
66 v6 = v1->pHardwareSurfaces;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
67 if ( v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
68 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
69 v7 = v6[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
70 if ( v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
71 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
72 v7->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
73 v1->pHardwareSurfaces[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
74 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
75 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
76 --v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
77 --v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
78 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
79 while ( v2 >= v1->uNumPrevLoadedFiles );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
80 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
81 v8 = v1->uNumPrevLoadedFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
82 v1->uNumPrevLoadedFiles = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
83 v1->uNumLoadedFiles = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
84 v1->uTexturePacksCount = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
85 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
86 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
87
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
88 //----- (004114F2) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
89 void LODFile_IconsBitmaps::_4114F2()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
90 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
91 LODFile_IconsBitmaps *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
92 int *pTexturePacksCount; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
93 int v3; // ecx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
94 int v4; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
95 int v5; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
96 Texture *v6; // ebx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
97 struct IDirect3DTexture2 **v7; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
98 struct IDirect3DTexture2 *v8; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
99 struct IDirectDrawSurface **v9; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
100 struct IDirectDrawSurface *v10; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
101 int v11; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
102
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
103 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
104 pTexturePacksCount = &this->uTexturePacksCount;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
105 v3 = this->uTexturePacksCount;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
106 if ( v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
107 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
108 v4 = v3 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
109 *pTexturePacksCount = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
110 if ( !v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
111 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
112 v5 = v1->uNumLoadedFiles - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
113 if ( v5 >= v1->uNumPrevLoadedFiles )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
114 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
115 v6 = &v1->pTextures[v5];
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 v6->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
119 v7 = v1->pHardwareTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
120 if ( v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
121 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
122 v8 = v7[v5];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
123 if ( v8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
124 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
125 v8->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
126 v1->pHardwareTextures[v5] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
127 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
128 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
129 v9 = v1->pHardwareSurfaces;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
130 if ( v9 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
131 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
132 v10 = v9[v5];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
133 if ( v10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
134 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
135 v10->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
136 v1->pHardwareSurfaces[v5] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
137 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
138 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
139 --v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
140 --v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
141 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
142 while ( v5 >= v1->uNumPrevLoadedFiles );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
143 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
144 v11 = v1->uNumPrevLoadedFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
145 v1->uNumPrevLoadedFiles = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
146 v1->uNumLoadedFiles = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
147 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
148 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
149 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
150
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
151 //----- (004AC67E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
152 int LODFile_Sprites::LoadSpriteFromFile(LODSprite *pSpriteHeader, const char *pContainer)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
153 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
154 FILE *v3; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
155 FILE *v4; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
156 int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
157 LODSprite *v6; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
158 LODSprite_stru0 *v7; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
159 size_t v8; // ST10_4@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
160 int *v9; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
161 int v10; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
162 void *v11; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
163 LODSprite_stru0 *v12; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
164 void *v13; // ecx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
165 LODSprite_stru0 *i; // edx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
166 FILE *File; // [sp+4h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
167 void *DstBufa; // [sp+10h] [bp+8h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
168 int Sizea; // [sp+14h] [bp+Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
169
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
170 v3 = FindContainer(pContainer, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
171 v4 = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
172 File = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
173 if ( v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
174 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
175 v6 = pSpriteHeader;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
176 fread(pSpriteHeader, 1u, 0x20u, v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
177 strcpy(pSpriteHeader->pName, pContainer);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
178 Sizea = pSpriteHeader->uSpriteSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
179 v7 = (LODSprite_stru0 *)pAllocator->AllocNamedChunk(v6->pSpriteLines, 8 * v6->uHeight, v6->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
180 v8 = 8 * pSpriteHeader->uHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
181 pSpriteHeader->pSpriteLines = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
182 fread(v7, 1u, v8, v4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
183 v9 = &pSpriteHeader->uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
184 v10 = pSpriteHeader->uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
185 if ( v10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
186 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
187 pSpriteHeader->pDecompressedBytes = pAllocator->AllocNamedChunk(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
188 pSpriteHeader->pDecompressedBytes,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
189 v10,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
190 pSpriteHeader->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
191 DstBufa = pAllocator->AllocNamedChunk(0, Sizea, pSpriteHeader->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
192 fread(DstBufa, 1u, Sizea, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
193 zlib::MemUnzip(v6->pDecompressedBytes, (unsigned int *)&v6->uDecompressedSize, DstBufa, v6->uSpriteSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
194 v6->uSpriteSize = *v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
195 pAllocator->FreeChunk(DstBufa);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
196 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
197 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
198 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
199 v11 = pAllocator->AllocNamedChunk(pSpriteHeader->pDecompressedBytes, Sizea, pSpriteHeader->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
200 pSpriteHeader->pDecompressedBytes = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
201 fread(v11, 1u, Sizea, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
202 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
203 v12 = v6->pSpriteLines;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
204 v13 = v6->pDecompressedBytes;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
205 for ( i = &v12[v6->uHeight]; v12 < i; i = &v6->pSpriteLines[v6->uHeight] )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
206 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
207 v12->ptr_4 = (char *)v12->ptr_4 + (unsigned int)v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
208 ++v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
209 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
210 result = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
211 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
212 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
213 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
214 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
215 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
216 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
217 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
218
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
219 //----- (004AC795) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
220 bool LODFile_Sprites::LoadSprites(const char *pFilename)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
221 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
222 if (LoadHeader(pFilename, 1))
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
223 return false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
224 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
225 return LoadSubIndices("sprites08") == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
226 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
227
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
228 //----- (004AC7C0) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
229 int LODFile_Sprites::LoadSprite(const char *pContainerName, unsigned int uPaletteID)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
230 { signed int v3; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
231 LODFile_Sprites *v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
232 unsigned int v5; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
233 signed int v6; // ecx@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
234 Sprite *v7; // eax@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
235 FILE *v8; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
236 Sprite *v10; // edx@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
237 int v11; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
238 int v12; // eax@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
239 unsigned __int8 v13; // zf@23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
240 unsigned __int8 v14; // sf@23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
241 LODSprite DstBuf; // [sp+Ch] [bp-3Ch]@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
242 char *Str1; // [sp+34h] [bp-14h]@24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
243 LODSprite *v17; // [sp+38h] [bp-10h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
244 int v18; // [sp+44h] [bp-4h]@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
245
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
246 auto a3 = uPaletteID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
247 v3 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
248 v4 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
249 if ( pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
250 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
251 if ( (signed int)this->uNumLoadedSprites > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
252 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
253 v17 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
254 while ( _strcmpi(*(const char **)&v17->pName[(unsigned int)v4->pHardwareSprites], pContainerName) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
255 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
256 ++v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
257 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
258 if ( v3 >= (signed int)v4->uNumLoadedSprites )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
259 goto LABEL_6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
260 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
261 return v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
262 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
263 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
264 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
265 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
266 if ( (signed int)this->uNumLoadedSprites > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
267 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
268 v17 = this->pSpriteHeaders;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
269 while ( _strcmpi(v17->pName, pContainerName) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
270 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
271 ++v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
272 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
273 if ( v3 >= (signed int)v4->uNumLoadedSprites )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
274 goto LABEL_6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
275 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
276 return v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
277 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
278 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
279 LABEL_6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
280 v5 = v4->uNumLoadedSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
281 if ( v5 == 1500 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
282 return -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
283 if ( pRenderer->pRenderD3D && v4->field_ECAC )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
284 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
285 if ( !v4->pHardwareSprites )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
286 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
287 v4->pHardwareSprites = (Sprite *)pAllocator->AllocNamedChunk(0, 0xEA60u, "hardSprites");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
288 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
289 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
290 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
291 v7 = &v4->pHardwareSprites[v6];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
292 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
293 v7->pName = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
294 v7->pTextureSurface = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
295 v7->pTexture = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
296 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
297 while ( v6 < 1500 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
298 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
299 DstBuf.uHeight = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
300 DstBuf.uPaletteId = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
301 DstBuf.word_1A = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
302 DstBuf.pSpriteLines = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
303 DstBuf.pDecompressedBytes = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
304 v18 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
305 v8 = FindContainer(pContainerName, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
306 if ( !v8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
307 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
308 v18 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
309 //LODSprite::dtor(&DstBuf);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
310 return -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
311 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
312 fread(&DstBuf, 1u, 0x20u, v8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
313 v10 = v4->pHardwareSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
314 v11 = 5 * v4->uNumLoadedSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
315 v18 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
316 pHardwareSprites[uNumLoadedSprites].uBufferWidth = DstBuf.uWidth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
317 pHardwareSprites[uNumLoadedSprites].uBufferHeight = DstBuf.uHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
318 pSpriteHeaders[uNumLoadedSprites].uWidth = DstBuf.uWidth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
319 pSpriteHeaders[uNumLoadedSprites].uHeight = DstBuf.uHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
320 //LODSprite::dtor(&DstBuf);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
321 goto LABEL_29;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
322 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
323 v12 = LoadSpriteFromFile( &v4->pSpriteHeaders[v5], pContainerName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
324 v4->pSpriteHeaders[v4->uNumLoadedSprites].word_1A = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
325 if ( v12 != -1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
326 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
327 LABEL_28:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
328 v4->pSpriteHeaders[v4->uNumLoadedSprites].uPaletteId = pPaletteManager->LoadPalette(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
329 v4->pSpriteHeaders[v4->uNumLoadedSprites].uPaletteId);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
330 LABEL_29:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
331 if ( pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
332 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
333 v4->pHardwareSprites[v4->uNumLoadedSprites].pName = (const char *)pAllocator->AllocNamedChunk(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
334 v4->pHardwareSprites[v4->uNumLoadedSprites].pName,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
335 0x14u,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
336 pContainerName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
337 strcpy((char *)pHardwareSprites[uNumLoadedSprites].pName, pContainerName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
338 v4->pHardwareSprites[v4->uNumLoadedSprites].uPaletteID = uPaletteID;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
339 pRenderer->MoveSpriteToDevice(&pHardwareSprites[uNumLoadedSprites]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
340 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
341 ++v4->uNumLoadedSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
342 return v4->uNumLoadedSprites - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
343 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
344 v13 = v4->uNumLoadedSprites == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
345 v14 = (v4->uNumLoadedSprites & 0x80000000u) != 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
346 v17 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
347 if ( v14 | v13 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
348 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
349 LABEL_27:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
350 if ( LoadSpriteFromFile(&v4->pSpriteHeaders[v4->uNumLoadedSprites], "pending") == -1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
351 return -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
352 goto LABEL_28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
353 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
354 Str1 = (char *)v4->pSpriteHeaders;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
355 while ( _strcmpi(Str1, "pending") )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
356 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
357 v17 = (LODSprite *)((char *)v17 + 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
358 Str1 += 40;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
359 if ( (signed int)v17 >= (signed int)v4->uNumLoadedSprites )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
360 goto LABEL_27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
361 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
362 return (int)v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
363 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
364
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
365 //----- (004ACADA) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
366 void LODFile_Sprites::ReleaseLostHardwareSprites()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
367 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
368 LODFile_Sprites *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
369 signed int v2; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
370 int v3; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
371 IDirectDrawSurface *v4; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
372 IDirect3DTexture2 *v5; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
373 IDirectDrawSurface *v6; // ST00_4@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
374
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
375 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
376 if ( this->pHardwareSprites )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
377 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
378 v2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
379 if ( (signed int)this->uNumLoadedSprites > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
380 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
381 v3 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
382 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
383 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
384 v4 = (IDirectDrawSurface *)v1->pHardwareSprites[v3].pTextureSurface;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
385 if ( v4 && v4->IsLost() == DDERR_SURFACELOST )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
386 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
387 v5 = v1->pHardwareSprites[v3].pTexture;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
388 if ( v5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
389 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
390 v5->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
391 v1->pHardwareSprites[v3].pTexture = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
392 }
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
393 v6 = (IDirectDrawSurface *)v1->pHardwareSprites[v3].pTextureSurface;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
394 v6->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
395 v1->pHardwareSprites[v3].pTextureSurface = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
396 pRenderer->MoveSpriteToDevice(&v1->pHardwareSprites[v3]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
397 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
398 ++v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
399 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
400 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
401 while ( v2 < (signed int)v1->uNumLoadedSprites );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
402 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
403 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
404 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
405
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
406 //----- (004ACB70) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
407 void LODFile_Sprites::ReleaseAll()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
408 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
409 LODFile_Sprites *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
410 signed int v2; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
411 int v3; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
412 Sprite *v4; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
413 IDirect3DTexture2 *v5; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
414 Sprite *v6; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
415 IDirectDrawSurface *v7; // eax@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
416
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
417 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
418 if ( this->pHardwareSprites )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
419 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
420 v2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
421 if ( (signed int)this->uNumLoadedSprites > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
422 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
423 v3 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
424 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
425 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
426 v4 = v1->pHardwareSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
427 if ( v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
428 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
429 v5 = v4[v3].pTexture;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
430 if ( v5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
431 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
432 v5->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
433 v1->pHardwareSprites[v3].pTexture = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
434 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
435 v6 = v1->pHardwareSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
436 if ( v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
437 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
438 v7 = (IDirectDrawSurface *)v6[v3].pTextureSurface;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
439 if ( v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
440 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
441 v7->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
442 v1->pHardwareSprites[v3].pTextureSurface = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
443 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
444 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
445 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
446 ++v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
447 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
448 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
449 while ( v2 < (signed int)v1->uNumLoadedSprites );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
450 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
451 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
452 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
453
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
454 //----- (004ACBE0) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
455 void LODFile_Sprites::MoveSpritesToVideoMemory()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
456 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
457 LODFile_Sprites *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
458 int v2; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
459 signed int v3; // edi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
460
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
461 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
462 v2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
463 if ( this->pHardwareSprites )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
464 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
465 v3 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
466 if ( (signed int)this->uNumLoadedSprites > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
467 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
468 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
469 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
470 pRenderer->MoveSpriteToDevice(&v1->pHardwareSprites[v2]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
471 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
472 ++v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
473 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
474 while ( v3 < (signed int)v1->uNumLoadedSprites );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
475 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
476 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
477 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
478
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
479 //----- (004ACC38) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
480 int LODSprite::_4ACC38(RenderBillboardTransform_local0 *a2, char a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
481 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
482 RenderBillboardTransform_local0 *v3; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
483 int result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
484 int v5; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
485 int v6; // ST18_4@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
486 signed int v7; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
487 signed int v8; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
488 int v9; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
489 int *v10; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
490 int v11; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
491 unsigned int v12; // edx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
492 int v13; // esi@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
493 int v14; // esi@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
494 int v15; // ecx@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
495 char *v16; // edx@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
496 int v17; // esi@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
497 int v18; // ecx@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
498 int v19; // esi@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
499 LODSprite_stru0 *v20; // edx@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
500 int v21; // eax@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
501 int v22; // esi@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
502 int v23; // eax@25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
503 int v24; // ecx@25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
504 signed __int64 v25; // qtt@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
505 int v26; // eax@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
506 unsigned __int16 *v27; // eax@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
507 LODSprite_stru0 *v28; // edx@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
508 signed int v29; // ecx@30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
509 int v30; // ecx@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
510 int v31; // ecx@38
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
511 signed int v32; // ecx@41
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
512 int v33; // ecx@47
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
513 int v34; // ecx@56
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
514 int v35; // esi@58
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
515 __int16 v36; // ax@58
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
516 int v37; // ecx@59
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
517 int v38; // eax@59
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
518 int v39; // ecx@62
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
519 signed int v40; // ST30_4@64
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
520 signed __int64 v41; // qtt@64
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
521 int v42; // ecx@64
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
522 unsigned __int16 *v43; // eax@66
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
523 LODSprite_stru0 *v44; // ecx@66
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
524 int v45; // edx@69
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
525 int v46; // edx@77
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
526 unsigned __int16 *pTarget; // [sp+Ch] [bp-50h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
527 signed int v48; // [sp+10h] [bp-4Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
528 signed int v49; // [sp+14h] [bp-48h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
529 int v50; // [sp+14h] [bp-48h]@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
530 int v51; // [sp+14h] [bp-48h]@57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
531 int v52; // [sp+18h] [bp-44h]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
532 int v53; // [sp+1Ch] [bp-40h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
533 int v54; // [sp+1Ch] [bp-40h]@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
534 int v55; // [sp+1Ch] [bp-40h]@32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
535 int v56; // [sp+1Ch] [bp-40h]@69
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
536 int v57; // [sp+20h] [bp-3Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
537 int v58; // [sp+24h] [bp-38h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
538 int v59; // [sp+28h] [bp-34h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
539 int v60; // [sp+28h] [bp-34h]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
540 unsigned __int16 *v61; // [sp+2Ch] [bp-30h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
541 int v62; // [sp+30h] [bp-2Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
542 void *v63; // [sp+30h] [bp-2Ch]@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
543 void *v64; // [sp+30h] [bp-2Ch]@66
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
544 int v65; // [sp+34h] [bp-28h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
545 int v66; // [sp+34h] [bp-28h]@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
546 int v67; // [sp+34h] [bp-28h]@59
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
547 int v68; // [sp+38h] [bp-24h]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
548 unsigned int v69; // [sp+3Ch] [bp-20h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
549 int v70; // [sp+40h] [bp-1Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
550 signed int v71; // [sp+40h] [bp-1Ch]@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
551 int v72; // [sp+44h] [bp-18h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
552 unsigned __int16 *v73; // [sp+44h] [bp-18h]@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
553 unsigned __int16 *v74; // [sp+44h] [bp-18h]@66
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
554 int v75; // [sp+48h] [bp-14h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
555 int v76; // [sp+48h] [bp-14h]@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
556 int v77; // [sp+48h] [bp-14h]@59
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
557 LODSprite *v78; // [sp+4Ch] [bp-10h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
558 int v79; // [sp+50h] [bp-Ch]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
559 int v80; // [sp+50h] [bp-Ch]@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
560 int v81; // [sp+50h] [bp-Ch]@62
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
561 int v82; // [sp+50h] [bp-Ch]@67
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
562 int v83; // [sp+50h] [bp-Ch]@75
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
563 int *pTargetZ; // [sp+54h] [bp-8h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
564 int v85; // [sp+58h] [bp-4h]@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
565 int v86; // [sp+58h] [bp-4h]@56
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
566 signed int v87; // [sp+64h] [bp+8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
567 int v88; // [sp+68h] [bp+Ch]@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
568 int v89; // [sp+68h] [bp+Ch]@56
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
569
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
570 v3 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
571 v78 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
572 result = a2->field_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
573 v58 = a2->field_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
574 if ( result <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
575 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
576 v5 = a2->field_14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
577 v6 = a2->field_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
578 v87 = (signed __int64)0x100000000ui64 / result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
579 v48 = (signed __int64)0x100000000ui64 / result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
580 v62 = (signed __int64)0x100000000ui64 / v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
581 v7 = this->uHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
582 v8 = (signed int)((signed __int64)0x100000000ui64 / v5) >> 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
583 v53 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
584 v70 = (this->uHeight << 16) - v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
585 v49 = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
586 v69 = v3->uTargetPitch;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
587 pTarget = v3->pTarget;
45
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
588 v57 = v3->sZValue;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
589 v61 = v3->pPalette;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
590 v9 = (v6 * this->uWidth + 32768) >> 16;
45
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
591 v72 = v3->uScreenSpaceY;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
592 result = (v5 * v7 + 32768) >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
593 v10 = (int *)(v72 - result + 1);
45
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
594 v11 = v3->uScreenSpaceX - (v9 >> 1) + 1;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
595 v65 = v72 - result + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
596 v59 = v11 + v9 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
597 if ( BYTE1(v3->uFlags) & 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
598 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
599 v10 = (int *)((char *)v10 + (v49 >> 1));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
600 v72 += v49 >> 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
601 v65 = (int)v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
602 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
603 v12 = v72;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
604 pTargetZ = v10;
45
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
605 v75 = v3->uScreenSpaceX - (v9 >> 1) + 1;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
606 v79 = v11 + v9 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
607 if ( !(v3->uFlags & 8) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
608 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
609 if ( v65 < (signed int)v3->uViewportY )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
610 pTargetZ = (int *)v3->uViewportY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
611 if ( v72 > (signed int)v3->uViewportW )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
612 v12 = v3->uViewportW;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
613 if ( v11 < (signed int)v3->uViewportX )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
614 v75 = v3->uViewportX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
615 if ( v59 > (signed int)v3->uViewportZ )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
616 v79 = v3->uViewportZ;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
617 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
618 v68 = v75 - v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
619 v13 = -v62;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
620 v60 = v59 - v79;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
621 v52 = -v62;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
622 if ( v3->uFlags & 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
623 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
624 v13 = v62;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
625 v70 = v53;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
626 v52 = v62;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
627 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
628 v71 = v13 * (v72 - v12) + v70;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
629 if ( LOBYTE(viewparams->field_20) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
630 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
631 if ( a3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
632 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
633 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
634 v14 = 5 * v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
635 v15 = v69 * v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
636 result = v12 - v72 + result - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
637 v16 = (char *)pTargetZ - v65;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
638 v17 = v14 << 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
639 if ( v3->uFlags & 4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
640 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
641 v34 = v79 + v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
642 v89 = v34;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
643 v86 = v79 + v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
644 if ( result < (signed int)v16 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
645 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
646 v51 = result - (int)v16 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
647 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
648 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
649 v35 = v71 >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
650 v36 = LOWORD(v78->pSpriteLines[v35].dword_0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
651 if ( v36 == -1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
652 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
653 v34 -= v69;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
654 v89 = v34;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
655 goto LABEL_84;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
656 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
657 v37 = v9 - ((unsigned __int64)(v36 * (signed __int64)v58) >> 16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
658 v67 = v87 * ((unsigned __int64)(LOWORD(v78->pSpriteLines[v35].dword_0) * (signed __int64)v58) >> 16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
659 v38 = v9 - v60;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
660 v77 = v9 - v60;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
661 if ( v9 - v60 <= (signed int)(v9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
662 - ((unsigned __int64)(HIWORD(v78->pSpriteLines[v35].dword_0) * (signed __int64)v58) >> 16))
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
663 || v68 >= v37 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
664 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
665 v89 -= v69;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
666 v34 = v89;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
667 LABEL_84:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
668 v86 -= 640;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
669 goto LABEL_85;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
670 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
671 if ( v38 < v37 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
672 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
673 v81 = (v87 >> 1) + v87 * (v37 - v38);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
674 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
675 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
676 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
677 v77 = v37;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
678 v81 = v87 >> 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
679 v39 = v37 - v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
680 v89 += v39 + v60;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
681 v86 += v60 + v39;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
682 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
683 v40 = ((HIWORD(v78->pSpriteLines[v35].dword_0) + 1) << 16) - v81 - v67;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
684 LODWORD(v41) = v40 << 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
685 HIDWORD(v41) = v40 >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
686 v42 = v77 - (((signed int)((unsigned __int64)(v41 / v48) - 32768) >> 16) + 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
687 if ( v68 >= v42 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
688 v42 = v68;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
689 v43 = &pTarget[v89];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
690 v74 = &v43[v42 - v77 + 1];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
691 v44 = &v78->pSpriteLines[v35];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
692 v64 = v44->ptr_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
693 if ( !v57 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
694 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
695 v83 = v67 + v81;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
696 if ( ((v83 - (LOWORD(v44->dword_0) << 16)) & 0xFFFF0000) < 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
697 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
698 v83 += v87;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
699 --v43;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
700 --pTargetZ;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
701 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
702 while ( v43 >= v74 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
703 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
704 v46 = (v83 - ((signed int)LOWORD(v78->pSpriteLines[v35].dword_0) << 16)) >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
705 if ( *((char *)v64 + v46) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
706 *v43 = v61[*((char *)v64 + v46)];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
707 v83 += v87;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
708 --v43;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
709 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
710 goto LABEL_81;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
711 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
712 pTargetZ = &v3->pTargetZ[v86];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
713 v82 = v67 + v81;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
714 if ( ((v82 - (LOWORD(v44->dword_0) << 16)) & 0xFFFF0000) < 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
715 goto LABEL_72;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
716 LABEL_73:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
717 if ( v43 >= v74 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
718 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
719 LABEL_81:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
720 v89 += v9 - v77 - v60 - v69;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
721 v34 = v89;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
722 v86 = v86 + v9 - v77 - v60 - 640;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
723 LABEL_85:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
724 result = v52;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
725 v71 += v52;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
726 --v51;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
727 if ( !v51 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
728 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
729 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
730 v45 = (v82 - ((signed int)LOWORD(v78->pSpriteLines[v35].dword_0) << 16)) >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
731 v56 = *((char *)v64 + v45);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
732 if ( *((char *)v64 + v45) && v57 <= (unsigned int)*pTargetZ )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
733 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
734 *pTargetZ = v57;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
735 *v43 = v61[v56];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
736 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
737 LABEL_72:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
738 v82 += v87;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
739 --v43;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
740 --pTargetZ;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
741 goto LABEL_73;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
742 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
743 v18 = v75 + v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
744 v19 = v75 + v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
745 v88 = v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
746 v85 = v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
747 if ( result >= (signed int)v16 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
748 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
749 v50 = result - (int)v16 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
750 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
751 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
752 v20 = &v78->pSpriteLines[v71 >> 16];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
753 v80 = v71 >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
754 if ( LOWORD(v20->dword_0) != -1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
755 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
756 v18 -= v69;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
757 v85 = v19 - 640;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
758 v88 = v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
759 LABEL_54:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
760 result = v52;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
761 v71 += v52;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
762 --v50;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
763 if ( !v50 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
764 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
765 v19 = v85;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
766 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
767 v21 = (v58 * LOWORD(v20->dword_0) + 32768) >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
768 v66 = v21 * v87;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
769 v76 = v68;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
770 v54 = HIWORD(v20->dword_0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
771 v22 = v9 - v60;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
772 if ( v68 >= (v58 * v54 + 32768) >> 16 || v22 <= v21 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
773 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
774 v88 -= v69;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
775 v85 -= 640;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
776 goto LABEL_51;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
777 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
778 if ( v68 > v21 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
779 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
780 v24 = (v87 >> 1) + v87 * (v68 - v21);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
781 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
782 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
783 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
784 v76 = (v58 * LOWORD(v20->dword_0) + 32768) >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
785 v23 = v21 - v68;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
786 v88 += v23;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
787 v24 = v87 >> 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
788 v85 += v23;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
789 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
790 LODWORD(v25) = (((v54 + 1) << 16) - v24 - v66) << 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
791 HIDWORD(v25) = (((v54 + 1) << 16) - v24 - v66) >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
792 v26 = v76 + ((signed int)(v25 / v48) >> 16) + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
793 if ( v22 > v26 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
794 v22 = v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
795 v27 = &pTarget[v88];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
796 v73 = &v27[v22 - v76 - 1];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
797 v28 = &v78->pSpriteLines[v80];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
798 v63 = v28->ptr_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
799 if ( v57 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
800 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
801 pTargetZ = &v3->pTargetZ[v85];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
802 v29 = v66 - (LOWORD(v28->dword_0) << 16) + v24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
803 if ( (v29 & 0xFFFF0000) >= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
804 goto LABEL_36;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
805 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
806 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
807 v29 += v87;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
808 ++v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
809 ++pTargetZ;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
810 LABEL_36:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
811 if ( v27 >= v73 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
812 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
813 v55 = *((char *)v63 + (v29 >> 16));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
814 if ( *((char *)v63 + (v29 >> 16)) && v57 <= (unsigned int)*pTargetZ )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
815 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
816 *pTargetZ = v57;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
817 *v27 = v61[v55];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
818 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
819 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
820 v30 = v29 >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
821 if ( v30 > HIWORD(v78->pSpriteLines[v80].dword_0) - (signed int)LOWORD(v78->pSpriteLines[v80].dword_0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
822 || (v31 = *((char *)v63 + v30)) == 0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
823 || v57 > (unsigned int)*pTargetZ )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
824 goto LABEL_50;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
825 *pTargetZ = v57;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
826 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
827 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
828 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
829 v32 = v66 - (LOWORD(v28->dword_0) << 16) + v24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
830 if ( (v32 & 0xFFFF0000) < 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
831 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
832 v32 += v87;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
833 ++v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
834 ++pTargetZ;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
835 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
836 while ( v27 < v73 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
837 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
838 if ( *((char *)v63 + (v32 >> 16)) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
839 *v27 = v61[*((char *)v63 + (v32 >> 16))];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
840 v32 += v87;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
841 ++v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
842 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
843 v33 = v32 >> 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
844 if ( v33 > HIWORD(v78->pSpriteLines[v80].dword_0) - (signed int)LOWORD(v78->pSpriteLines[v80].dword_0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
845 || (v31 = *((char *)v63 + v33)) == 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
846 goto LABEL_50;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
847 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
848 *v27 = v61[v31];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
849 LABEL_50:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
850 v88 += v68 - v76 - v69;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
851 v85 = v85 + v68 - v76 - 640;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
852 LABEL_51:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
853 v18 = v88;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
854 goto LABEL_54;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
855 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
856 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
857 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
858
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
859 //----- (004AD2D1) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
860 int LODSprite::_4AD2D1(struct RenderBillboardTransform_local0 *a2, int a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
861 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
862 int result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
863 unsigned int v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
864 int v5; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
865 LODSprite_stru0 *v6; // edx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
866 __int16 v7; // bx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
867 int v8; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
868 unsigned __int16 *v9; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
869 int v10; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
870 void *v11; // edx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
871 unsigned __int16 *v12; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
872 int v13; // ebx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
873 LODSprite *v14; // [sp+8h] [bp-10h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
874 unsigned __int16 *v15; // [sp+10h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
875 unsigned __int16 *v16; // [sp+14h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
876 int i; // [sp+20h] [bp+8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
877
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
878 result = (int)a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
879 v14 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
880 v4 = a2->uTargetPitch;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
881 v16 = a2->pTarget;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
882 v15 = a2->pPalette;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
883 v5 = this->uHeight - 1;
45
bcc051713d20 BLV render & seffects
Nomad
parents: 3
diff changeset
884 for ( i = v4 * a2->uScreenSpaceY - (this->uWidth >> 1) + a2->uScreenSpaceX + 1; v5 >= 0; --v5 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
885 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
886 v6 = &this->pSpriteLines[v5];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
887 v7 = LOWORD(v6->dword_0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
888 if ( LOWORD(v6->dword_0) != -1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
889 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
890 v8 = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
891 v9 = &v16[v7 + i];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
892 v10 = HIWORD(v6->dword_0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
893 v11 = v6->ptr_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
894 v12 = &v9[v10 - v8];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
895 while ( v9 <= v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
896 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
897 v13 = *(char *)v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
898 v11 = (char *)v11 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
899 if ( v13 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
900 *v9 = v15[v13];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
901 ++v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
902 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
903 v4 = *(int *)(result + 48);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
904 //this = v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
905 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
906 i -= v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
907 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
908 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
909 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
910
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
911 //----- (0046454B) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
912 void LODFile_IconsBitmaps::ReleaseAll2()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
913 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
914 LODFile_IconsBitmaps *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
915 int v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
916 Texture *v3; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
917 struct IDirect3DTexture2 **v4; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
918 struct IDirect3DTexture2 *v5; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
919 struct IDirectDrawSurface **v6; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
920 struct IDirectDrawSurface *v7; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
921 int v8; // eax@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
922
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
923 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
924 v2 = this->uNumLoadedFiles - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
925 if ( v2 >= this->dword_11B84 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
926 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
927 v3 = &this->pTextures[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
928 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
929 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
930 v3->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
931 v4 = v1->pHardwareTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
932 if ( v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
933 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
934 v5 = v4[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
935 if ( v5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
936 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
937 v5->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
938 v1->pHardwareTextures[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
939 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
940 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
941 v6 = v1->pHardwareSurfaces;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
942 if ( v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
943 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
944 v7 = v6[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
945 if ( v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
946 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
947 v7->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
948 v1->pHardwareSurfaces[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
949 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
950 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
951 --v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
952 --v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
953 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
954 while ( v2 >= v1->dword_11B84 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
955 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
956 v8 = v1->dword_11B84;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
957 v1->uTexturePacksCount = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
958 v1->uNumPrevLoadedFiles = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
959 v1->uNumLoadedFiles = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
960 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
961
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
962 //----- (004645DC) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
963 void LODFile_Sprites::DeleteSomeOtherSprites()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
964 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
965 int *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
966 int *v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
967
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
968 v1 = (int *)&this->uNumLoadedSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
969 v2 = &this->field_ECA0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
970 DeleteSpritesRange(field_ECA0, uNumLoadedSprites);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
971 *v1 = *v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
972 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
973
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
974
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
975 //----- (00461431) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
976 void LOD::File::Close()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
977 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
978 LOD::File *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
979 LOD::Directory **v2; // edi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
980 FILE *v3; // ST00_4@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
981
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
982 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
983 if ( this->isFileOpened )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
984 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
985 this->pContainerName[0] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
986 this->uCurrentIndexDir = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
987 v2 = &this->pSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
988 pAllocator->FreeChunk(this->pSubIndices);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
989 pAllocator->FreeChunk(v1->pRoot);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
990 v3 = v1->pFile;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
991 *v2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
992 v1->pRoot = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
993 fclose(v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
994 v1->isFileOpened = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
995 _6A0CA8_lod_unused = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
996 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
997 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
998 // 6A0CA8: using guessed type int 6A0CA8_lod_unused;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
999
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1000 //----- (00461492) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1001 int LODWriteableFile::_461492(LOD::FileHeader *pHeader, LOD::Directory *pDir, const char *Source)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1002 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1003 LODWriteableFile *v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1004 FILE *v6; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1005
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1006 v4 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1007 if ( this->isFileOpened )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1008 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1009 if ( !pDir->pFilename[0] )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1010 return 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1011 strcpy((char *)pHeader, "LOD");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1012 pHeader->dword_0000A4 = 100;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1013 pHeader->uNumIndices = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1014 pDir->pFilename[15] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1015 pDir->uDataSize = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1016 pDir->uOfsetFromSubindicesStart = 288;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1017 strcpy((char *)v4->pLODName, Source);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1018 v6 = fopen((const char *)v4->pLODName, "wb+");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1019 v4->pFile = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1020 if ( !v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1021 return 3;
110
430786d916d6 6.11.12 SaveLoad
Ritor1
parents: 108
diff changeset
1022 fwrite(pHeader, 0x100, 1, v6);
430786d916d6 6.11.12 SaveLoad
Ritor1
parents: 108
diff changeset
1023 fwrite(pDir, 0x20, 1, v4->pFile);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1024 fclose(v4->pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1025 v4->pFile = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1026 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1027 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1028
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1029 //----- (0046153F) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1030 void LOD::File::ResetSubIndices()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1031 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1032 LOD::Directory **pSubIndices_dup2; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1033 LOD::Directory *pSubIndices_dup; // ST00_4@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1034
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1035 if ( this->isFileOpened )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1036 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1037 pSubIndices_dup2 = &this->pSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1038 this->pContainerName[0] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1039 this->uCurrentIndexDir = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1040 pSubIndices_dup = this->pSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1041 this->uOffsetToSubIndex = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1042 this->uNumSubIndices = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1043 this->uLODDataSize = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1044 pAllocator->FreeChunk(pSubIndices_dup);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1045 *pSubIndices_dup2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1046 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1047 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1048
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1049
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1050
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1051
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1052
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1053
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1054
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1055 //----- (00450C8B) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1056 void LODFile_Sprites::DeleteSomeSprites()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1057 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1058 int *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1059 int *v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1060
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1061 v1 = (int *)&this->uNumLoadedSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1062 v2 = &this->field_ECA8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1063 DeleteSpritesRange(this->field_ECA8, this->uNumLoadedSprites);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1064 *v1 = *v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1065 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1066
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1067 //----- (00450CA9) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1068 void LODFile_Sprites::DeleteSpritesRange(int uStartIndex, int uStopIndex)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1069 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1070 LODFile_Sprites *v3; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1071 int v4; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1072 LODSprite *v5; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1073 LODSprite *v6; // esi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1074 int v7; // edi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1075 int a2a; // [sp+10h] [bp+8h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1076
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1077 v3 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1078 if ( this->pHardwareSprites )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1079 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1080 if ( uStartIndex < uStopIndex )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1081 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1082 v4 = uStartIndex;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1083 v5 = &this->pSpriteHeaders[uStartIndex];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1084 a2a = uStopIndex - uStartIndex;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1085 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1086 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1087 v5->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1088 pHardwareSprites[v4].Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1089 ++v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1090 ++v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1091 --a2a;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1092 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1093 while ( a2a );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1094 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1095 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1096 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1097 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1098 if ( uStartIndex < uStopIndex )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1099 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1100 v6 = &this->pSpriteHeaders[uStartIndex];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1101 v7 = uStopIndex - uStartIndex;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1102 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1103 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1104 v6->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1105 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1106 --v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1107 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1108 while ( v7 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1109 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1110 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1111 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1112
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1113 //----- (00450D1D) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1114 void LODSprite::Release()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1115 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1116 LODSprite *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1117
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1118 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1119 if ( !(HIBYTE(this->word_1A) & 4) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1120 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1121 pAllocator->FreeChunk(this->pDecompressedBytes);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1122 pAllocator->FreeChunk(v1->pSpriteLines);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1123 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1124 v1->word_1A = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1125 v1->pDecompressedBytes = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1126 v1->pSpriteLines = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1127 v1->pName[0] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1128 v1->word_16 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1129 v1->uPaletteId = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1130 v1->uTexturePitch = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1131 v1->uHeight = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1132 v1->uWidth = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1133 v1->uSpriteSize = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1134 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1135
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1136 //----- (00450D68) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1137 void Sprite::Release()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1138 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1139 if (pName)
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1140 pAllocator->FreeChunk((void *)pName);
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1141 pName = nullptr;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1142
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1143 if (pTextureSurface)
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1144 pTextureSurface->Release();
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1145 pTextureSurface = nullptr;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1146
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1147 if (pTexture)
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1148 pTexture->Release();
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
1149 pTexture = nullptr;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1150 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1151
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1152
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1153
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1154
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1155 //----- (0040FA2E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1156 bool LODFile_IconsBitmaps::LoadBitmaps(const char *pFilename)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1157 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1158 ReleaseAll();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1159 if (LoadHeader(pFilename, 1))
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1160 return false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1161 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1162 return LoadSubIndices("bitmaps") == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1163 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1164
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1165
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1166 //----- (0040FAEE) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1167 bool LODFile_IconsBitmaps::LoadIconsOrEvents(const char *pLODFilename)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1168 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1169 ReleaseAll();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1170
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1171 if (LoadHeader(pLODFilename, 1))
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1172 return false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1173 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1174 return LoadSubIndices("icons") == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1175 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1176
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1177
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1178 //----- (0040FA60) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1179 void LODFile_IconsBitmaps::ReleaseAll()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1180 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1181 LODFile_IconsBitmaps *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1182 unsigned int v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1183 Texture *v3; // ebp@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1184 struct IDirect3DTexture2 **v4; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1185 struct IDirect3DTexture2 *v5; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1186 struct IDirectDrawSurface **v6; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1187 struct IDirectDrawSurface *v7; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1188
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1189 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1190 v2 = this->uNumLoadedFiles - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1191 if ( (v2 & 0x80000000u) == 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1192 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1193 v3 = &this->pTextures[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1194 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1195 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1196 v3->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1197 v4 = v1->pHardwareTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1198 if ( v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1199 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1200 v5 = v4[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1201 if ( v5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1202 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1203 v5->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1204 v1->pHardwareTextures[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1205 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1206 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1207 v6 = v1->pHardwareSurfaces;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1208 if ( v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1209 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1210 v7 = v6[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1211 if ( v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1212 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1213 v7->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1214 v1->pHardwareSurfaces[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1215 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1216 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1217 --v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1218 --v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1219 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1220 while ( (v2 & 0x80000000u) == 0 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1221 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1222 v1->uTexturePacksCount = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1223 v1->uNumPrevLoadedFiles = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1224 v1->dword_11B84 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1225 v1->dword_11B80 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1226 v1->uNumLoadedFiles = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1227 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1228
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1229 //----- (0040F9F0) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1230 unsigned int LODFile_IconsBitmaps::FindTextureByName(const char *pName)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1231 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1232 LODFile_IconsBitmaps *v2; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1233 unsigned int v3; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1234 Texture *v4; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1235 unsigned int result; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1236
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1237 v2 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1238 v3 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1239 if ( (signed int)this->uNumLoadedFiles <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1240 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1241 LABEL_5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1242 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1243 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1244 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1245 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1246 v4 = this->pTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1247 while ( _strcmpi(v4->pName, pName) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1248 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1249 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1250 ++v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1251 if ( (signed int)v3 >= (signed int)v2->uNumLoadedFiles )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1252 goto LABEL_5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1253 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1254 result = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1255 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1256 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1257 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1258
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1259 //----- (0040F9C5) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1260 int LODFile_IconsBitmaps::_40F9C5()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1261 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1262 signed int result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1263 Texture *pTex; // edx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1264
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1265 result = this->uNumLoadedFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1266 for ( pTex = &this->pTextures[result]; !pTex->pName[0]; --pTex )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1267 --result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1268 if ( result < (signed int)this->uNumLoadedFiles )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1269 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1270 ++result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1271 this->uNumLoadedFiles = result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1272 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1273 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1274 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1275
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1276
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1277
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1278 //----- (0046249B) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1279 LODFile_Sprites::~LODFile_Sprites()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1280 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1281 LODFile_Sprites *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1282 signed int v2; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1283 LODSprite *v3; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1284 char *v4; // edi@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1285 int thisa; // [sp+4h] [bp-10h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1286 LODSprite *thisb; // [sp+4h] [bp-10h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1287
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1288 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1289 v2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1290 if ( this->pHardwareSprites )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1291 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1292 if ( (signed int)this->uNumLoadedSprites > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1293 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1294 thisa = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1295 v3 = this->pSpriteHeaders;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1296 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1297 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1298 v3->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1299 v1->pHardwareSprites[thisa].Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1300 ++thisa;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1301 ++v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1302 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1303 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1304 while ( v2 < (signed int)v1->uNumLoadedSprites );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1305 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1306 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1307 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1308 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1309 v4 = (char *)&this->uNumLoadedSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1310 if ( (signed int)this->uNumLoadedSprites > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1311 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1312 thisb = this->pSpriteHeaders;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1313 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1314 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1315 thisb->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1316 ++thisb;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1317 ++v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1318 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1319 while ( v2 < *(int *)v4 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1320 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1321 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1322 //_eh_vector_destructor_iterator_(v1->pSpriteHeaders, 40, 1500, LODSprite::dtor);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1323 //LOD::File::vdtor((LOD::File *)v1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1324 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1325 // 4CC2B4: using guessed type int __stdcall _eh vector destructor iterator_(int, int, int, int);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1326
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1327
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1328 //----- (00462463) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1329 LODSprite::~LODSprite()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1330 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1331 LODSprite *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1332
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1333 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1334 if ( !(HIBYTE(this->word_1A) & 4) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1335 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1336 pAllocator->FreeChunk(this->pDecompressedBytes);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1337 pAllocator->FreeChunk(v1->pSpriteLines);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1338 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1339 v1->pDecompressedBytes = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1340 v1->pSpriteLines = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1341 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1342
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1343 //----- (004623E5) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1344 LODFile_Sprites::LODFile_Sprites():
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1345 LOD::File()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1346 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1347 /*_eh_vector_constructor_iterator_(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1348 v1->pSpriteHeaders,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1349 40,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1350 1500,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1351 (void (__thiscall *)(void *))LODSprite::LODSprite,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1352 (void (__thiscall *)(void *))LODSprite::dtor);*/
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1353 field_ECA4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1354 field_ECA0 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1355 pHardwareSprites = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1356 field_ECAC = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1357 field_ECB4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1358 uNumLoadedSprites = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1359 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1360
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1361 //----- (00462303) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1362 LODFile_IconsBitmaps::~LODFile_IconsBitmaps()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1363 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1364 LODFile_IconsBitmaps *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1365 unsigned int v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1366 struct IDirect3DTexture2 **v3; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1367 struct IDirect3DTexture2 *v4; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1368 struct IDirectDrawSurface **v5; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1369 struct IDirectDrawSurface *v6; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1370 Texture *thisa; // [sp+4h] [bp-10h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1371
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1372 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1373 v2 = this->uNumLoadedFiles - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1374 if ( (v2 & 0x80000000u) == 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1375 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1376 thisa = &this->pTextures[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1377 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1378 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1379 thisa->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1380 v3 = v1->pHardwareTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1381 if ( v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1382 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1383 v4 = v3[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1384 if ( v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1385 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1386 v4->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1387 v1->pHardwareTextures[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1388 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1389 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1390 v5 = v1->pHardwareSurfaces;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1391 if ( v5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1392 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1393 v6 = v5[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1394 if ( v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1395 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1396 v6->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1397 v1->pHardwareSurfaces[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1398 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1399 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1400 --thisa;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1401 --v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1402 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1403 while ( (v2 & 0x80000000u) == 0 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1404 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1405 if ( v1->pHardwareSurfaces )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1406 free(v1->pHardwareSurfaces);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1407 if ( v1->pHardwareTextures )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1408 free(v1->pHardwareTextures);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1409 if ( v1->ptr_011BB4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1410 free(v1->ptr_011BB4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1411 //LOD::File::vdtor((LOD::File *)v1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1412 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1413
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1414 //----- (00462272) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1415 LODFile_IconsBitmaps::LODFile_IconsBitmaps():
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1416 LOD::File()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1417 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1418 LODFile_IconsBitmaps *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1419 Texture *v2; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1420 signed int v3; // [sp+4h] [bp-10h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1421
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1422 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1423 /*v2 = v1->pTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1424 v3 = 1000;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1425 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1426 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1427 Texture::Texture(v2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1428 ++v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1429 --v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1430 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1431 while ( v3 );*/
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1432 v1->uTexturePacksCount = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1433 v1->uNumPrevLoadedFiles = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1434 v1->dword_11B84 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1435 v1->dword_11B80 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1436 v1->uNumLoadedFiles = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1437 v1->dword_011BA4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1438 v1->dword_011BA8 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1439 v1->pHardwareSurfaces = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1440 v1->pHardwareTextures = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1441 v1->ptr_011BB4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1442 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1443
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1444
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1445 //----- (004621A7) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1446 bool LODWriteableFile::_4621A7()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1447 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1448 CloseWriteFile();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1449 return LoadFile(pLODName, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1450 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1451
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1452
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1453 //----- (00461FD4) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1454 int LODWriteableFile::Save()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1455 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1456 LODWriteableFile *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1457 int v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1458 unsigned int v3; // edx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1459 LOD::Directory *v4; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1460 unsigned int v5; // ecx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1461 int v6; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1462 signed int v7; // ebx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1463 int v8; // ecx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1464 LOD::Directory **v9; // edi@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1465 int v10; // edx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1466 LOD::Directory *v11; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1467 FILE *v12; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1468 FILE *v13; // ebx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1469 signed int result; // eax@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1470 unsigned int v15; // eax@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1471 FILE *v16; // ST00_4@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1472 size_t v17; // edi@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1473 char OldFilename[256]; // [sp+Ch] [bp-228h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1474 char NewFilename[256]; // [sp+10Ch] [bp-128h]@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1475 //LOD::Directory v0; // [sp+20Ch] [bp-28h]@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1476 unsigned int v21; // [sp+22Ch] [bp-8h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1477 int v22; // [sp+230h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1478
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1479 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1480 v2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1481 v3 = this->uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1482 v22 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1483 if ( (signed int)v3 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1484 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1485 v4 = this->pSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1486 v5 = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1487 v6 = (int)&v4->uDataSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1488 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1489 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1490 v2 += *(int *)v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1491 v6 += 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1492 --v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1493 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1494 while ( v5 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1495 v22 = v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1496 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1497 v7 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1498 v21 = 32 * v3 + v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1499 v8 = 32 * v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1500 if ( (signed int)v3 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1501 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1502 v9 = &v1->pSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1503 v10 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1504 v11 = v1->pSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1505 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1506 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1507 v11[v10].uOfsetFromSubindicesStart = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1508 v11 = *v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1509 v8 += (*v9)[v10].uDataSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1510 ++v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1511 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1512 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1513 while ( v7 < (signed int)v1->uNumSubIndices );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1514 v2 = v22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1515 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1516 strcpy(OldFilename, "lod.tmp");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1517 v12 = fopen(OldFilename, "wb+");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1518 v13 = v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1519 if ( v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1520 {
110
430786d916d6 6.11.12 SaveLoad
Ritor1
parents: 108
diff changeset
1521 fwrite(&v1->header, 0x100, 1, v12);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1522
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1523 LOD::Directory v0; // [sp+20Ch] [bp-28h]@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1524 //LOD::Directory::LOD::Directory(&v0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1525
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1526 strcpy((char *)&v0, "chapter");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1527 v15 = v1->uOffsetToSubIndex;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1528 v0.dword_000018 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1529 v0.uOfsetFromSubindicesStart = v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1530 v0.word_00001E = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1531 v0.uDataSize = v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1532 v0.uNumSubIndices = LOWORD(v1->uNumSubIndices);
108
d543bd89a31e 6.11.12
Ritor1
parents: 80
diff changeset
1533 fwrite(&v0, 0x20, 1, v13);
110
430786d916d6 6.11.12 SaveLoad
Ritor1
parents: 108
diff changeset
1534 fwrite(v1->pSubIndices, 0x20, v1->uNumSubIndices, v13);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1535 v16 = v1->pOutputFileHandle;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1536 v22 = v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1537 fseek(v16, 0, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1538 if ( v2 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1539 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1540 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1541 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1542 v17 = v1->uIOBufferSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1543 if ( v22 <= (signed int)v17 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1544 v17 = v22;
110
430786d916d6 6.11.12 SaveLoad
Ritor1
parents: 108
diff changeset
1545 fread(v1->pIOBuffer, 1, v17, v1->pOutputFileHandle);
430786d916d6 6.11.12 SaveLoad
Ritor1
parents: 108
diff changeset
1546 fwrite(v1->pIOBuffer, 1, v17, v13);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1547 v22 -= v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1548 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1549 while ( v22 > 0 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1550 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1551 strcpy(NewFilename, (const char *)v1->pLODName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1552 fclose(v13);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1553 fclose(v1->pOutputFileHandle);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1554 v1->CloseWriteFile();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1555 remove("lodapp.tmp");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1556 remove(NewFilename);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1557 rename(OldFilename, NewFilename);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1558 v1->CloseWriteFile();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1559 v1->LoadFile(v1->pLODName, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1560 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1561 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1562 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1563 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1564 result = 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1565 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1566 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1567 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1568
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1569
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1570 //----- (00461F71) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1571 bool LOD::File::AppendDirectory(LOD::Directory *pDir, const void *pData)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1572 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1573 unsigned int v3; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1574 bool result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1575 FILE *v5; // ST0C_4@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1576
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1577 v3 = this->uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1578 if ( (signed int)v3 < 299 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1579 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1580 memcpy(&this->pSubIndices[v3], pDir, sizeof(this->pSubIndices[v3]));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1581 v5 = this->pOutputFileHandle;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1582 ++this->uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1583 fwrite(pData, 1u, pDir->uDataSize, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1584 result = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1585 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1586 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1587 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1588 MessageBoxA(0, "Unable to append item!", "LOD::File", 0x30u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1589 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1590 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1591 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1592 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1593
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1594
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1595 //----- (00461F1E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1596 int LODWriteableFile::CreateTempFile()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1597 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1598 LODWriteableFile *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1599 int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1600 FILE *pFile; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1601 int v4; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1602
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1603 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1604 if ( this->isFileOpened )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1605 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1606 if ( this->pIOBuffer && this->uIOBufferSize )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1607 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1608 this->uCurrentIndexDir = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1609 this->uNumSubIndices = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1610 pFile = fopen("lodapp.tmp", "wb+");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1611 v1->pOutputFileHandle = pFile;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1612 v4 = -(pFile != 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1613 LOBYTE(v4) = v4 & 0xF9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1614 result = v4 + 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1615 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1616 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1617 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1618 result = 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1619 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1620 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1621 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1622 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1623 result = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1624 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1625 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1626 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1627
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1628
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1629
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1630 //----- (00461EE9) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1631 void LODWriteableFile::CloseWriteFile()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1632 {
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1633 if (isFileOpened)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1634 {
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1635 pContainerName[0] = 0;
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1636 uCurrentIndexDir = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1637 _6A0CA8_lod_unused = 0;
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1638
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1639 isFileOpened = false;
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1640 fflush(pFile);
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1641 fclose(pFile);
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
1642 pFile = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1643 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1644 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1645 // 6A0CA8: using guessed type int 6A0CA8_lod_unused;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1646
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1647 //----- (00461B48) --------------------------------------------------------
112
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1648 /*unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4)
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1649 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1650 LODWriteableFile *v4; // ebx@1
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1651 int v5; // esi@1
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1652 unsigned __int8 v7; // zf@7
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1653 unsigned __int8 v8; // sf@7
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1654 const LOD::Directory *v9; // edi@9
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1655 int v10; // eax@9
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1656 unsigned __int8 v11; // of@15
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1657 unsigned __int16 v12; // dx@17
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1658 LOD::Directory *v13; // eax@17
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1659 unsigned __int16 v14; // cx@17
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1660 int v15; // edi@27
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1661 unsigned int v16; // eax@27
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1662 int v17; // eax@29
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1663 int v18; // edx@31
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1664 int v19; // eax@31
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1665 void *v20; // edi@32
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1666 LOD::Directory *v21; // edi@34
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1667 signed int v22; // esi@34
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1668 int v23; // eax@34
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1669 LOD::Directory *v24; // ecx@35
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1670 int v25; // edx@35
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1671 __int32 v26; // eax@37
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1672 int i; // esi@39
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1673 __int32 v28; // esi@46
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1674 char pFilename[256]; // [sp+Ch] [bp-230h]@22
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1675 char NewFilename[256]; // [sp+10Ch] [bp-130h]@51
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1676 //LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1677 size_t v33; // [sp+22Ch] [bp-10h]@27
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1678 int v34; // [sp+230h] [bp-Ch]@7
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1679 __int32 v35; // [sp+234h] [bp-8h]@8
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1680 int v36; // [sp+238h] [bp-4h]@7
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1681 size_t Count; // [sp+244h] [bp+8h]@40
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1682 __int32 Countc; // [sp+244h] [bp+8h]@46
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1683 size_t Countb; // [sp+244h] [bp+8h]@47
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1684 FILE *pFile; // [sp+24Ch] [bp+10h]@22
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1685
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1686 v4 = this;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1687 v5 = 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1688 if ( !this->isFileOpened )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1689 return 1;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1690 if ( !this->pSubIndices )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1691 return 2;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1692 if ( !this->pIOBuffer || !this->uIOBufferSize )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1693 return 3;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1694 v7 = this->uNumSubIndices == 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1695 v8 = (this->uNumSubIndices & 0x80000000u) != 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1696 v36 = 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1697 v34 = 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1698 if ( v8 | v7 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1699 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1700 v9 = pDir;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1701 goto LABEL_22;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1702 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1703 v35 = 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1704 while ( 1 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1705 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1706 v9 = pDir;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1707 v10 = _strcmpi((const char *)v4->pSubIndices + v35, (const char *)pDir);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1708 if ( v10 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1709 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1710 if ( v10 > 0 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1711 goto LABEL_22;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1712 goto LABEL_15;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1713 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1714 if ( !a4 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1715 goto LABEL_20;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1716 if ( a4 == 1 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1717 break;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1718 if ( a4 == 2 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1719 return 4;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1720 LABEL_15:
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1721 v35 += 32;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1722 ++v5;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1723 v11 = __OFSUB__(v5, v4->uNumSubIndices);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1724 v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1725 v34 = v5;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1726 if ( !(v8 ^ v11) )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1727 goto LABEL_22;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1728 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1729 v12 = pDir->uNumSubIndices;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1730 v13 = &v4->pSubIndices[v5];
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1731 v14 = v13->uNumSubIndices;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1732 if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1733 return 4;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1734 LABEL_20:
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1735 v36 = 1;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1736 LABEL_22:
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1737 strcpy(pFilename, "lod.tmp");
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1738 pFile = fopen(pFilename, "wb+");
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1739 if ( !pFile )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1740 return 5;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1741 if ( v36 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1742 v35 = v4->pSubIndices[v5].uDataSize;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1743 else
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1744 v35 = 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1745 v33 = v9->uDataSize;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1746 v15 = v33 - v35;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1747
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1748 LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1749 //LOD::Directory::LOD::Directory(&Str);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1750
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1751 strcpy((char *)&Str, "chapter");
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1752 v16 = v4->uLODDataSize;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1753 Str.uNumSubIndices = LOWORD(v4->uNumSubIndices);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1754 Str.dword_000018 = 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1755 Str.word_00001E = 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1756 if ( !v36 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1757 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1758 ++Str.uNumSubIndices;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1759 v15 += 32;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1760 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1761 v7 = v36 == 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1762 Str.uDataSize = v15 + v16;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1763 Str.uOfsetFromSubindicesStart = 288;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1764 v17 = (signed __int16)Str.uNumSubIndices;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1765 v4->uNumSubIndices = (signed __int16)Str.uNumSubIndices;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1766 if ( v7 && v17 > v5 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1767 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1768 v18 = v17;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1769 v19 = v17 - v5;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1770 do
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1771 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1772 v20 = &v4->pSubIndices[v18];
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1773 --v18;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1774 --v19;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1775 memcpy(v20, (char *)v20 - 32, 0x20u);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1776 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1777 while ( v19 );
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1778 v5 = v34;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1779 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1780 v34 = 32 * v5;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1781 memcpy(&v4->pSubIndices[v5], pDir, sizeof(v4->pSubIndices[v5]));
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1782 v23 = 32 * v4->uNumSubIndices;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1783 if ( (signed int)v4->uNumSubIndices > 0 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1784 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1785 for (int i = 0; i < (signed int)v4->uNumSubIndices; ++i)
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1786 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1787 v4->pSubIndices[i].uOfsetFromSubindicesStart = v23;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1788 v23 += v4->pSubIndices[i].uDataSize;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1789 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1790 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1791 fwrite(&v4->header, 0x100, 1, pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1792 fwrite(&Str, 0x20, 1, pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1793 fseek(v4->pFile, Str.uOfsetFromSubindicesStart, 0);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1794 fwrite(v4->pSubIndices, 0x20u, v4->uNumSubIndices, pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1795 v26 = 32 * v4->uNumSubIndices;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1796 if ( !v36 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1797 v26 -= 32;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1798 fseek(v4->pFile, v26, 1);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1799 for ( i = *(unsigned int *)((char *)&v4->pSubIndices->uOfsetFromSubindicesStart + v34)
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1800 - v4->pSubIndices->uOfsetFromSubindicesStart; i > 0; i -= Count )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1801 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1802 Count = v4->uIOBufferSize;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1803 if ( i <= (signed int)v4->uIOBufferSize )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1804 Count = i;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1805 fread(v4->pIOBuffer, 1u, Count, v4->pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1806 fwrite(v4->pIOBuffer, 1u, Count, pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1807 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1808 fwrite(pDirData, 1u, v33, pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1809 if ( v36 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1810 fseek(v4->pFile, v35, 1);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1811 Countc = ftell(v4->pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1812 fseek(v4->pFile, 0, 2);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1813 v28 = ftell(v4->pFile) - Countc;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1814 fseek(v4->pFile, Countc, 0);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1815 while ( v28 > 0 )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1816 {
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1817 Countb = v4->uIOBufferSize;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1818 if ( v28 <= (signed int)v4->uIOBufferSize )
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1819 Countb = v28;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1820 fread(v4->pIOBuffer, 1u, Countb, v4->pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1821 fwrite(v4->pIOBuffer, 1u, Countb, pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1822 v28 -= Countb;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1823 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1824 strcpy(NewFilename, (const char *)v4->pLODName);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1825 fclose(pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1826 v4->CloseWriteFile();
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1827 remove(NewFilename);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1828 rename(pFilename, NewFilename);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1829 v4->CloseWriteFile();
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1830 v4->LoadFile(v4->pLODName, 0);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1831 return 0;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1832 }
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1833 */
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1834
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1835 unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1836 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1837 LODWriteableFile *v4; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1838 int v5; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1839 unsigned __int8 v7; // zf@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1840 unsigned __int8 v8; // sf@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1841 const LOD::Directory *v9; // edi@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1842 int v10; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1843 unsigned __int8 v11; // of@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1844 unsigned __int16 v12; // dx@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1845 LOD::Directory *v13; // eax@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1846 unsigned __int16 v14; // cx@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1847 int v15; // edi@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1848 unsigned int v16; // eax@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1849 int v17; // eax@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1850 int v18; // edx@31
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1851 int v19; // eax@31
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1852 void *v20; // edi@32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1853 LOD::Directory *v21; // edi@34
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1854 signed int v22; // esi@34
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1855 int v23; // eax@34
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1856 LOD::Directory *v24; // ecx@35
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1857 int v25; // edx@35
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1858 __int32 v26; // eax@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1859 int i; // esi@39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1860 __int32 v28; // esi@46
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1861 char pFilename[256]; // [sp+Ch] [bp-230h]@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1862 char NewFilename[256]; // [sp+10Ch] [bp-130h]@51
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1863 //LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1864 size_t v33; // [sp+22Ch] [bp-10h]@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1865 int v34; // [sp+230h] [bp-Ch]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1866 __int32 v35; // [sp+234h] [bp-8h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1867 int v36; // [sp+238h] [bp-4h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1868 size_t Count; // [sp+244h] [bp+8h]@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1869 __int32 Countc; // [sp+244h] [bp+8h]@46
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1870 size_t Countb; // [sp+244h] [bp+8h]@47
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1871 FILE *pFile; // [sp+24Ch] [bp+10h]@22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1872
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1873 v4 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1874 v5 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1875 if ( !this->isFileOpened )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1876 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1877 if ( !this->pSubIndices )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1878 return 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1879 if ( !this->pIOBuffer || !this->uIOBufferSize )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1880 return 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1881 v7 = this->uNumSubIndices == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1882 v8 = (this->uNumSubIndices & 0x80000000u) != 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1883 v36 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1884 v34 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1885 if ( v8 | v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1886 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1887 v9 = pDir;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1888 goto LABEL_22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1889 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1890 v35 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1891 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1892 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1893 v9 = pDir;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1894 v10 = _strcmpi((const char *)v4->pSubIndices + v35, (const char *)pDir);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1895 if ( v10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1896 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1897 if ( v10 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1898 goto LABEL_22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1899 goto LABEL_15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1900 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1901 if ( !a4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1902 goto LABEL_20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1903 if ( a4 == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1904 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1905 if ( a4 == 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1906 return 4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1907 LABEL_15:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1908 v35 += 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1909 ++v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1910 v11 = __OFSUB__(v5, v4->uNumSubIndices);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1911 v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1912 v34 = v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1913 if ( !(v8 ^ v11) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1914 goto LABEL_22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1915 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1916 v12 = pDir->uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1917 v13 = &v4->pSubIndices[v5];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1918 v14 = v13->uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1919 if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1920 return 4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1921 LABEL_20:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1922 v36 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1923 LABEL_22:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1924 strcpy(pFilename, "lod.tmp");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1925 pFile = fopen(pFilename, "wb+");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1926 if ( !pFile )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1927 return 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1928 if ( v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1929 v35 = v4->pSubIndices[v5].uDataSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1930 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1931 v35 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1932 v33 = v9->uDataSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1933 v15 = v33 - v35;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1934
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1935 LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1936 //LOD::Directory::LOD::Directory(&Str);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1937
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1938 strcpy((char *)&Str, "chapter");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1939 v16 = v4->uLODDataSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1940 Str.uNumSubIndices = LOWORD(v4->uNumSubIndices);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1941 Str.dword_000018 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1942 Str.word_00001E = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1943 if ( !v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1944 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1945 ++Str.uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1946 v15 += 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1947 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1948 v7 = v36 == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1949 Str.uDataSize = v15 + v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1950 Str.uOfsetFromSubindicesStart = 288;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1951 v17 = (signed __int16)Str.uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1952 v4->uNumSubIndices = (signed __int16)Str.uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1953 if ( v7 && v17 > v5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1954 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1955 v18 = v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1956 v19 = v17 - v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1957 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1958 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1959 v20 = &v4->pSubIndices[v18];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1960 --v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1961 --v19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1962 memcpy(v20, (char *)v20 - 32, 0x20u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1963 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1964 while ( v19 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1965 v5 = v34;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1966 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1967 v34 = 32 * v5;
112
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1968 memcpy(&v4->pSubIndices[v5], pDir, sizeof(v4->pSubIndices[v5]));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1969 v23 = 32 * v4->uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1970 if ( (signed int)v4->uNumSubIndices > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1971 {
112
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1972 for (int i = 0; i < (signed int)v4->uNumSubIndices; ++i)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1973 {
112
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1974 v4->pSubIndices[i].uOfsetFromSubindicesStart = v23;
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1975 v23 += v4->pSubIndices[i].uDataSize;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1976 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1977 }
112
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1978 fwrite(&v4->header, 0x100, 1, pFile);
8feb2dfd2f89 6.11.12b
Ritor1
parents: 110
diff changeset
1979 fwrite(&Str, 0x20, 1, pFile);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1980 fseek(v4->pFile, Str.uOfsetFromSubindicesStart, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1981 fwrite(v4->pSubIndices, 0x20u, v4->uNumSubIndices, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1982 v26 = 32 * v4->uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1983 if ( !v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1984 v26 -= 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1985 fseek(v4->pFile, v26, 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1986 for ( i = *(unsigned int *)((char *)&v4->pSubIndices->uOfsetFromSubindicesStart + v34)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1987 - v4->pSubIndices->uOfsetFromSubindicesStart; i > 0; i -= Count )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1988 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1989 Count = v4->uIOBufferSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1990 if ( i <= (signed int)v4->uIOBufferSize )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1991 Count = i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1992 fread(v4->pIOBuffer, 1u, Count, v4->pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1993 fwrite(v4->pIOBuffer, 1u, Count, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1994 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1995 fwrite(pDirData, 1u, v33, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1996 if ( v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1997 fseek(v4->pFile, v35, 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1998 Countc = ftell(v4->pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1999 fseek(v4->pFile, 0, 2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2000 v28 = ftell(v4->pFile) - Countc;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2001 fseek(v4->pFile, Countc, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2002 while ( v28 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2003 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2004 Countb = v4->uIOBufferSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2005 if ( v28 <= (signed int)v4->uIOBufferSize )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2006 Countb = v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2007 fread(v4->pIOBuffer, 1u, Countb, v4->pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2008 fwrite(v4->pIOBuffer, 1u, Countb, pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2009 v28 -= Countb;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2010 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2011 strcpy(NewFilename, (const char *)v4->pLODName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2012 fclose(pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2013 v4->CloseWriteFile();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2014 remove(NewFilename);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2015 rename(pFilename, NewFilename);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2016 v4->CloseWriteFile();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2017 v4->LoadFile(v4->pLODName, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2018 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2019 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2020
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2021
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2022 //----- (00461A43) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2023 bool LODWriteableFile::LoadFile(const char *pFilename, bool bWriting)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2024 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2025 LODWriteableFile *v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2026 FILE *pFile_dup; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2027 unsigned int v5; // ecx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2028 __int32 v6; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2029 FILE *v7; // ST00_4@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2030 size_t v8; // edi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2031 const char *v10; // [sp-4h] [bp-30h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2032
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2033 v3 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2034 if ( bWriting & 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2035 v10 = "rb";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2036 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2037 v10 = "rb+";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2038 pFile_dup = fopen(pFilename, v10);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2039 v3->pFile = pFile_dup;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2040 if ( !pFile_dup )
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2041 {
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2042 isFileOpened = false;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2043 return 0;
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2044 }
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2045 strcpy(pLODName, pFilename);
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2046 fread(&header, 0x100u, 1u, v3->pFile);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2047
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2048 LOD::Directory dir; // [sp+Ch] [bp-20h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2049 //LOD::Directory::LOD::Directory(&dir);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2050
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2051 fread(&dir, 0x20u, 1u, v3->pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2052 fseek(v3->pFile, 0, 0);
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2053 isFileOpened = 1;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2054 strcpy((char *)v3->pContainerName, "chapter");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2055 v5 = (signed __int16)dir.uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2056 v6 = dir.uOfsetFromSubindicesStart;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2057 v3->uCurrentIndexDir = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2058 v3->uOffsetToSubIndex = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2059 v7 = v3->pFile;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2060 v3->uNumSubIndices = v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2061 v3->uLODDataSize = dir.uDataSize;
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2062 fseek(v7, v6, SEEK_SET);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2063 v8 = v3->uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2064 if ( (signed int)v8 > 300 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2065 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2066 MessageBoxA(0, "LODchapterPages exceed 300", "LOD::File", MB_ICONEXCLAMATION);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2067 fclose(v3->pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2068 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2069 }
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2070 fread(pSubIndices, 0x20u, v8, v3->pFile);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2071 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2072 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2073
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2074
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2075 //----- (00461A11) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2076 void LOD::File::FreeSubIndexAndIO()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2077 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2078 void *v1; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2079 LOD::Directory **v2; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2080
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2081 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2082 v2 = &this->pSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2083 pAllocator->FreeChunk(this->pSubIndices);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2084 v1 = (char *)v1 + 264;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2085 pAllocator->FreeChunk(pIOBuffer);// delete [] pIOBuffer;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2086 pIOBuffer = nullptr;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2087 pSubIndices = nullptr;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2088 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2089
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2090
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2091 //----- (00461954) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2092 void LOD::File::AllocSubIndicesAndIO(unsigned int uNumSubIndices, unsigned int uBufferSize)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2093 {
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2094 //LOD::File *v3; // esi@1
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2095 LOD::Directory *pSubIndices_dup; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2096 char v5; // zf@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2097
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2098 //v3 = this;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2099 if (pSubIndices)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2100 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2101 MessageBoxA(0, "Attempt to reset a LOD subindex!", "MM6", MB_ICONEXCLAMATION);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2102 pAllocator->FreeChunk(pSubIndices);
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2103 pSubIndices = nullptr;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2104 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2105 pSubIndices_dup = (LOD::Directory *)pAllocator->AllocNamedChunk(
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2106 pSubIndices,
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2107 32 * uNumSubIndices,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2108 "LODsub");
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2109 v5 = pIOBuffer == 0;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2110 pSubIndices = pSubIndices_dup;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2111 if ( !v5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2112 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2113 MessageBoxA(0, "Attempt to reset a LOD IObuffer!", "MM6", MB_ICONEXCLAMATION);
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2114 pAllocator->FreeChunk(pIOBuffer);
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2115 pIOBuffer = 0;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2116 uIOBufferSize = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2117 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2118 if ( uBufferSize )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2119 {
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2120 pIOBuffer = (unsigned __int8 *)pAllocator->AllocNamedChunk(pIOBuffer, uBufferSize, "LODio");
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
2121 uIOBufferSize = uBufferSize;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2122 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2123 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2124
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2125
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2126
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2127 //----- (0046188A) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2128 int LOD::File::LoadSubIndices(const char *pContainer)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2129 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2130 LOD::File *v2; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2131 unsigned int uDir; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2132 int uDir_dup; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2133 int result; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2134 LOD::Directory *v6; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2135 LOD::Directory *v7; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2136 __int32 v8; // edx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2137 FILE *v9; // ST00_4@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2138 LOD::Directory *pSubIndices_dup; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2139
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2140 v2 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2141 ResetSubIndices();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2142 uDir = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2143 if ( (signed int)v2->header.uNumIndices <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2144 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2145 LABEL_5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2146 result = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2147 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2148 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2149 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2150 uDir_dup = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2151 while ( _strcmpi(pContainer, (const char *)&v2->pRoot[uDir_dup]) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2152 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2153 ++uDir;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2154 ++uDir_dup;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2155 if ( (signed int)uDir >= (signed int)v2->header.uNumIndices )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2156 goto LABEL_5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2157 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2158 strcpy((char *)v2->pContainerName, pContainer);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2159 v6 = v2->pRoot;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2160 v2->uCurrentIndexDir = uDir;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2161 v7 = &v6[uDir];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2162 v8 = v7->uOfsetFromSubindicesStart;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2163 v2->uOffsetToSubIndex = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2164 v9 = v2->pFile;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2165 v2->uNumSubIndices = v7->uNumSubIndices;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2166 fseek(v9, v8, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2167 pSubIndices_dup = (LOD::Directory *)pAllocator->AllocNamedChunk(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2168 v2->pSubIndices,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2169 32 * (v2->uNumSubIndices + 5),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2170 "LOD Index");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2171 v2->pSubIndices = pSubIndices_dup;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2172 if ( pSubIndices_dup )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2173 fread(pSubIndices_dup, 0x20u, v2->uNumSubIndices, v2->pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2174 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2175 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2176 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2177 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2178
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2179 //----- (004617D5) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2180 bool LOD::File::LoadHeader(const char *pFilename, bool bWriting)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2181 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2182 LOD::File *this_dup; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2183 FILE *pFile_dup; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2184 void *pRoot_dup; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2185 const char *v6; // [sp-4h] [bp-Ch]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2186 FILE *v7; // [sp-4h] [bp-Ch]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2187
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2188 this_dup = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2189 if ( this->isFileOpened )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2190 Close();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2191 if ( bWriting & 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2192 v6 = "rb";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2193 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2194 v6 = "rb+";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2195 pFile_dup = fopen(pFilename, v6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2196 this_dup->pFile = pFile_dup;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2197 if ( pFile_dup )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2198 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2199 strcpy(this_dup->pLODName, pFilename);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2200 fread(&this_dup->header, 0x100u, 1u, this_dup->pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2201 pRoot_dup = pAllocator->AllocNamedChunk(this_dup->pRoot, 0xA0u, "LOD CArray");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2202 this_dup->pRoot = (LOD::Directory *)pRoot_dup;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2203 v7 = this_dup->pFile;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2204 if ( pRoot_dup )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2205 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2206 fread(pRoot_dup, 0x20u, this_dup->header.uNumIndices, v7);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2207 fseek(this_dup->pFile, 0, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2208 this_dup->isFileOpened = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2209 return false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2210 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2211 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2212 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2213 fclose(v7);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2214 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2215 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2216 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2217 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2218 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2219
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2220
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2221 //----- (004617B6) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2222 void LOD::FileHeader::Reset()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2223 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2224 this->pSignature[0] = 0;
108
d543bd89a31e 6.11.12
Ritor1
parents: 80
diff changeset
2225 this->LodVersion[0] = 0;
d543bd89a31e 6.11.12
Ritor1
parents: 80
diff changeset
2226 this->LodDescription[0] = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2227 this->dword_0000A4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2228 this->dword_0000A8 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2229 this->uNumIndices = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2230 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2231
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2232 //----- (00461790) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2233 LOD::File::~File()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2234 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2235 LOD::File *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2236
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2237 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2238 if ( this->isFileOpened )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2239 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2240 fclose(this->pFile);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2241 pAllocator->FreeChunk(v1->pSubIndices);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2242 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2243 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2244
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2245
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2246 //----- (0046175B) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2247 LOD::File::File():
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2248 pRoot(nullptr),
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2249 isFileOpened(false)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2250 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2251 LOD::File *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2252
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2253 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2254 v1->pFile = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2255 v1->pSubIndices = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2256 v1->pIOBuffer = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2257 v1->isFileOpened = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2258 v1->uIOBufferSize = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2259 Close();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2260 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2261
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2262
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2263 //----- (00461743) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2264 LOD::Directory *LOD::Directory::Reset()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2265 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2266 LOD::Directory *result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2267
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2268 result = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2269 this->pFilename[0] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2270 this->uOfsetFromSubindicesStart = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2271 this->uDataSize = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2272 this->dword_000018 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2273 this->uNumSubIndices = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2274 this->word_00001E = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2275 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2276 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2277
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2278
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2279 //----- (0046172B) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2280 LOD::Directory::Directory()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2281 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2282 this->pFilename[0] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2283 this->uOfsetFromSubindicesStart = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2284 this->uDataSize = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2285 this->uNumSubIndices = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2286 this->dword_000018 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2287 this->word_00001E = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2288 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2289
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2290 //----- (0046165E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2291 int LOD::File::CalcIndexFast(int startIndex, int maxIndex, const char *pContainerName)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2292 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2293 int v4; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2294 int v5; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2295 int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2296 int v7; // edi@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2297 int v8; // esi@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2298 int v9; // esi@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2299 LOD::File *v10; // [sp+Ch] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2300
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2301 v4 = startIndex;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2302 v10 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2303 while ( 1 ) // binary search in LOD indices
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2304 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2305 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2306 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2307 v5 = maxIndex - v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2308 result = _strcmpi((const char *)pContainerName, (const char *)(&v10->pSubIndices[(maxIndex - v4) / 2] + v4));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2309 if ( !result )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2310 _6A0CA4_lod_binary_search = (maxIndex - v4) / 2 + v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2311 if ( v4 == maxIndex )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2312 goto LABEL_14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2313 if ( result < 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2314 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2315 if ( v5 <= 4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2316 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2317 v7 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2318 if ( v4 < maxIndex )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2319 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2320 v9 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2321 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2322 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2323 result = _strcmpi((const char *)pContainerName, (const char *)&v10->pSubIndices[v9]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2324 if ( !result )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2325 goto LABEL_21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2326 ++v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2327 ++v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2328 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2329 while ( v7 < maxIndex );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2330 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2331 LABEL_14:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2332 _6A0CA4_lod_binary_search = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2333 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2334 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2335 v4 += (maxIndex - v4) / 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2336 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2337 if ( v5 <= 4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2338 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2339 maxIndex = (maxIndex - v4) / 2 + v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2340 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2341 v7 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2342 if ( v4 >= maxIndex )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2343 goto LABEL_14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2344 v8 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2345 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2346 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2347 result = _strcmpi((const char *)pContainerName, (const char *)&v10->pSubIndices[v8]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2348 if ( !result )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2349 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2350 ++v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2351 ++v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2352 if ( v7 >= maxIndex )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2353 goto LABEL_14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2354 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2355 LABEL_21:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2356 _6A0CA4_lod_binary_search = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2357 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2358 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2359 // 6A0CA4: using guessed type int _6A0CA4_lod_binary_search;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2360
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2361
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2362 //----- (0046161C) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2363 bool LOD::File::DoesContainerExist(const char *pContainer)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2364 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2365 LOD::File *this_dup; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2366 int i; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2367 signed int i_dup; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2368 bool result; // eax@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2369
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2370 this_dup = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2371 i = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2372 i_dup = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2373 if ( (signed int)this->uNumSubIndices <= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2374 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2375 LABEL_4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2376 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2377 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2378 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2379 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2380 while ( _strcmpi((const char *)pContainer, (const char *)&this_dup->pSubIndices[i]) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2381 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2382 ++i_dup;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2383 ++i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2384 if ( i_dup >= (signed int)this_dup->uNumSubIndices )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2385 goto LABEL_4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2386 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2387 result = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2388 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2389 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2390 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2391
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2392
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2393 //----- (00461397) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2394 int LODFile_Sprites::_461397()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2395 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2396 int result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2397 int *pfield_ECA0; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2398 int v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2399 int v4; // ecx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2400
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2401 result = this->uNumLoadedSprites;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2402 pfield_ECA0 = &this->field_ECA0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2403 v3 = this->field_ECA0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2404 this->field_ECA8 = result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2405 if ( result < v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2406 this->field_ECA8 = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2407 v4 = this->field_ECA4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2408 if ( v3 < v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2409 *pfield_ECA0 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2410 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2411 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2412
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2413 //----- (00461580) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2414 FILE *LOD::File::FindContainer(const char *pContainerName, bool bLinearSearch)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2415 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2416 unsigned int v4; // eax@4
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2417 if (!isFileOpened)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2418 return 0;
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2419
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2420
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2421 if (bLinearSearch)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2422 {
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2423 for (uint i = 0; i < uNumSubIndices; ++i)
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2424 if (!strcmpi(pContainerName, pSubIndices[i].pFilename))
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2425 {
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2426 v4 = pSubIndices[i].uOfsetFromSubindicesStart;
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2427 fseek(pFile, uOffsetToSubIndex + v4, SEEK_SET);
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2428 return pFile;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2429 }
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2430
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2431 return nullptr;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2432 }
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2433 else
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2434 {
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2435 CalcIndexFast(0, uNumSubIndices, pContainerName);
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2436 if ( _6A0CA4_lod_binary_search < 0 )
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2437 return 0;
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2438 v4 = pSubIndices[_6A0CA4_lod_binary_search].uOfsetFromSubindicesStart;
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2439 fseek(pFile, uOffsetToSubIndex + v4, SEEK_SET);
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2440 return pFile;
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
2441 }
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2442 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2443
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2444 //----- (0041097D) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2445 void LODFile_IconsBitmaps::SetupPalettes(unsigned int uTargetRBits, unsigned int uTargetGBits, unsigned int uTargetBBits)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2446 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2447 int v4; // edx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2448 LODFile_IconsBitmaps *v5; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2449 int v6; // ecx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2450 unsigned __int8 v7; // zf@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2451 unsigned __int8 v8; // sf@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2452 unsigned __int16 **v9; // edi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2453 FILE *v10; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2454 FILE *v11; // ebx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2455 signed int v12; // ebx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2456 int v13; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2457 int v14; // edx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2458 int v16; // [sp+4Ch] [bp-8h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2459 FILE *File; // [sp+50h] [bp-4h]@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2460
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2461 v4 = uTargetGBits;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2462 v5 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2463 v6 = uTargetBBits;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2464 if ( v5->uTextureRedBits != uTargetRBits
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2465 || v5->uTextureGreenBits != uTargetGBits
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2466 || v5->uTextureBlueBits != uTargetBBits )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2467 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2468 v16 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2469 v7 = v5->uNumLoadedFiles == 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2470 v8 = (v5->uNumLoadedFiles & 0x80000000u) != 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2471 v5->uTextureRedBits = uTargetRBits;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2472 v5->uTextureGreenBits = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2473 v5->uTextureBlueBits = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2474 if ( !(v8 | v7) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2475 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2476 v9 = &v5->pTextures[0].pPalette16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2477 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2478 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2479 Texture DstBuf; // [sp+4h] [bp-50h]@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2480 //Texture::Texture(&DstBuf);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2481
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2482 if ( *v9 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2483 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2484 v10 = FindContainer((const char *)v9 - 64, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2485 v11 = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2486 File = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2487 if ( v10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2488 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2489 fread(&DstBuf, 1u, 0x30u, v10);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2490 fseek(v11, DstBuf.uTextureSize, 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2491 v12 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2492 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2493 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2494 fread((char *)&uTargetRBits + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2495 fread((char *)&uTargetBBits + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2496 v13 = fread((char *)&uTargetGBits + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2497 LOWORD(v13) = (unsigned __int8)(BYTE3(uTargetRBits) >> (8 - LOBYTE(v5->uTextureRedBits)));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2498 (*v9)[v12] = v13 << (LOBYTE(v5->uTextureGreenBits) + LOBYTE(v5->uTextureBlueBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2499 LOWORD(v14) = (unsigned __int8)(BYTE3(uTargetBBits) >> (8 - LOBYTE(v5->uTextureGreenBits)));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2500 (*v9)[v12] |= v14 << v5->uTextureBlueBits;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2501 (*v9)[v12] |= BYTE3(uTargetGBits) >> (8 - LOBYTE(v5->uTextureBlueBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2502 ++v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2503 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2504 while ( v12 < 256 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2505 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2506 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2507 ++v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2508 v9 += 18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2509 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2510 while ( v16 < (signed int)v5->uNumLoadedFiles );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2511 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2512 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2513 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2514
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2515
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2516
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2517 //----- (0041088B) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2518 void *LOD::File::LoadRaw(const char *pContainer, int a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2519 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2520 LOD::File *v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2521 FILE *v4; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2522 FILE *v5; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2523 void *v6; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2524 void *v7; // ebx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2525 void *v8; // edi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2526 void *v9; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2527 Texture DstBuf; // [sp+Ch] [bp-4Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2528 FILE *File; // [sp+54h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2529 unsigned int Argsa; // [sp+60h] [bp+8h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2530
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2531 v3 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2532 v4 = FindContainer(pContainer, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2533 v5 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2534 File = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2535 if ( !v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2536 Abortf("Unable to load %s", pContainer);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2537 fread(&DstBuf, 1u, 0x30u, v4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2538 Argsa = DstBuf.uTextureSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2539 if ( DstBuf.uDecompressedSize )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2540 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2541 if ( a3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2542 v6 = malloc(DstBuf.uDecompressedSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2543 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2544 v6 = pAllocator->AllocNamedChunk(0, DstBuf.uDecompressedSize, DstBuf.pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2545 v7 = v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2546 v8 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2547 fread(v8, 1u, Argsa, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2548 zlib::MemUnzip(v7, &DstBuf.uDecompressedSize, v8, DstBuf.uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2549 DstBuf.uTextureSize = DstBuf.uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2550 pAllocator->FreeChunk(v8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2551 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2552 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2553 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2554 if ( a3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2555 v9 = malloc(DstBuf.uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2556 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2557 v9 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2558 v7 = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2559 fread(v9, 1u, Argsa, v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2560 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2561 return v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2562 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2563
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2564
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2565
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2566 //----- (00410522) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2567 int LODFile_IconsBitmaps::_410522(Texture *pDst, const char *pContainer, unsigned int uTextureType)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2568 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2569 LODFile_IconsBitmaps *v4; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2570 Texture *v5; // esi@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2571 unsigned int v6; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2572 void *v7; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2573 unsigned int v8; // ST28_4@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2574 void *v9; // ST2C_4@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2575 unsigned __int8 *v10; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2576 FILE *v11; // ST28_4@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2577 void *v12; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2578 FILE *v13; // ST28_4@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2579 signed int v14; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2580 int v15; // ecx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2581 int v16; // ecx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2582 int v17; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2583 signed int v18; // ebx@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2584 int v19; // eax@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2585 int v20; // edx@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2586 signed int v21; // ecx@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2587 signed int v22; // ecx@23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2588 char Args[100]; // [sp+4h] [bp-68h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2589 FILE *File; // [sp+68h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2590
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2591 v4 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2592 File = FindContainer(pContainer, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2593 if ( !File )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2594 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2595 File = FindContainer("pending", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2596 if ( !File )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2597 {
80
a84fb3752681 28.10.12
Ritor1
parents: 45
diff changeset
2598 sprintf(Args, "Can't find %s!", pContainer);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2599 Abortf(Args);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2600 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2601 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2602 v5 = pDst;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2603 fread(pDst, 1u, 0x30u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2604 strcpy(v5->pName, pContainer);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2605 pDst = (Texture *)v5->uTextureSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2606 v6 = v5->uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2607 v5->pLevelOfDetail0 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2608 if ( v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2609 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2610 v7 = operator new(v6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2611 v8 = v5->uTextureSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2612 v5->pLevelOfDetail0 = (unsigned __int8 *)v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2613 pContainer = (const char *)operator new(v8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2614 fread((void *)pContainer, 1u, (size_t)pDst, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2615 zlib::MemUnzip(v5->pLevelOfDetail0, &v5->uDecompressedSize, pContainer, v5->uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2616 v9 = (void *)pContainer;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2617 v5->uTextureSize = v5->uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2618 free(v9);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2619 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2620 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2621 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2622 v10 = (unsigned __int8 *)operator new(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2623 v11 = File;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2624 v5->pLevelOfDetail0 = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2625 fread(v10, 1u, (size_t)pDst, v11);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2626 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2627 v5->pPalette24 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2628 if ( uTextureType == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2629 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2630 v12 = operator new(0x300u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2631 v13 = File;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2632 v5->pPalette24 = (unsigned __int8 *)v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2633 fread(v12, 1u, 0x300u, v13);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2634 LABEL_10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2635 v5->pPalette16 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2636 goto LABEL_11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2637 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2638 if ( uTextureType != 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2639 goto LABEL_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2640 v18 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2641 v5->pPalette16 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2642 v5->pPalette16 = (unsigned __int16 *)operator new(0x400u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2643 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2644 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2645 fread((char *)&pContainer + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2646 fread((char *)&uTextureType + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2647 v19 = fread((char *)&pDst + 3, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2648 LOWORD(v19) = (unsigned __int8)(BYTE3(pContainer) >> (8 - LOBYTE(v4->uTextureRedBits)));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2649 v5->pPalette16[v18] = v19 << (LOBYTE(v4->uTextureBlueBits) + LOBYTE(v4->uTextureGreenBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2650 LOWORD(v20) = (unsigned __int8)(BYTE3(uTextureType) >> (8 - LOBYTE(v4->uTextureGreenBits)));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2651 v5->pPalette16[v18] += v20 << v4->uTextureBlueBits;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2652 v5->pPalette16[v18] += (unsigned __int8)(BYTE3(pDst) >> (8 - LOBYTE(v4->uTextureBlueBits)));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2653 ++v18;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2654 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2655 while ( v18 < 256 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2656 LABEL_11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2657 if ( v5->pBits & 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2658 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2659 v14 = v5->uSizeOfMaxLevelOfDetail;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2660 v15 = (int)&v5->pLevelOfDetail0[v14];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2661 v5->pLevelOfDetail1 = (unsigned __int8 *)v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2662 v16 = (v14 >> 2) + v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2663 v5->pLevelOfDetail2 = (unsigned __int8 *)v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2664 v17 = v16 + (v14 >> 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2665 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2666 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2667 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2668 v17 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2669 v5->pLevelOfDetail2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2670 v5->pLevelOfDetail1 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2671 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2672 v5->pLevelOfDetail3 = (unsigned __int8 *)v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2673 v21 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2674 while ( 1 << v21 != v5->uTextureWidth )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2675 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2676 ++v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2677 if ( v21 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2678 goto LABEL_23;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2679 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2680 v5->uWidthLn2 = v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2681 LABEL_23:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2682 v22 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2683 while ( 1 << v22 != v5->uTextureHeight )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2684 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2685 ++v22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2686 if ( v22 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2687 goto LABEL_28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2688 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2689 v5->uHeightLn2 = v22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2690 LABEL_28:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2691 switch ( v5->uWidthLn2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2692 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2693 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2694 v5->uWidthMinus1 = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2695 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2696 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2697 v5->uWidthMinus1 = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2698 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2699 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2700 v5->uWidthMinus1 = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2701 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2702 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2703 v5->uWidthMinus1 = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2704 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2705 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2706 v5->uWidthMinus1 = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2707 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2708 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2709 v5->uWidthMinus1 = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2710 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2711 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2712 v5->uWidthMinus1 = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2713 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2714 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2715 v5->uWidthMinus1 = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2716 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2717 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2718 v5->uWidthMinus1 = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2719 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2720 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2721 v5->uWidthMinus1 = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2722 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2723 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2724 v5->uWidthMinus1 = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2725 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2726 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2727 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2728 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2729 switch ( v5->uHeightLn2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2730 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2731 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2732 v5->uHeightMinus1 = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2733 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2734 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2735 v5->uHeightMinus1 = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2736 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2737 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2738 v5->uHeightMinus1 = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2739 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2740 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2741 v5->uHeightMinus1 = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2742 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2743 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2744 v5->uHeightMinus1 = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2745 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2746 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2747 v5->uHeightMinus1 = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2748 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2749 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2750 v5->uHeightMinus1 = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2751 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2752 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2753 v5->uHeightMinus1 = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2754 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2755 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2756 v5->uHeightMinus1 = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2757 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2758 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2759 v5->uHeightMinus1 = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2760 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2761 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2762 v5->uHeightMinus1 = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2763 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2764 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2765 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2766 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2767 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2768 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2769
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2770
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2771 //----- (00410423) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2772 void LODFile_IconsBitmaps::_410423_move_textures_to_device()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2773 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2774 LODFile_IconsBitmaps *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2775 unsigned int v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2776 char *v3; // ebx@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2777 size_t v4; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2778 char *v5; // ST1C_4@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2779 void *v6; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2780 signed int v7; // esi@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2781
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2782 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2783 v2 = this->uNumLoadedFiles - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2784 if ( (v2 & 0x80000000u) == 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2785 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2786 v3 = &this->pTextures[v2].pName[2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2787 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2788 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2789 if ( v1->ptr_011BB4[v2] )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2790 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2791 if ( *(v3 - 2) != 'w' || *(v3 - 1) != 't' || *v3 != 'r' || v3[1] != 'd' || v3[2] != 'r' )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2792 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2793 pRenderer->LoadTexture(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2794 v3 - 2,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2795 *((short *)v3 + 17),
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
2796 (IDirectDrawSurface4 **)&v1->pHardwareSurfaces[v2],
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2797 &v1->pHardwareTextures[v2]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2798 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2799 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2800 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2801 v4 = strlen(v3 - 2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2802 v5 = (char *)operator new(v4 + 2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2803 *v5 = 'h';
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2804 strcpy(v5 + 1, v3 - 2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2805 pRenderer->LoadTexture(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2806 v5,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2807 *((short *)v3 + 17),
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
2808 (IDirectDrawSurface4 **)&v1->pHardwareSurfaces[v2],
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2809 &v1->pHardwareTextures[v2]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2810 free(v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2811 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2812 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2813 --v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2814 v3 -= 72;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2815 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2816 while ( (v2 & 0x80000000u) == 0 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2817 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2818 v6 = v1->ptr_011BB4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2819 if ( v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2820 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2821 v7 = v1->uNumLoadedFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2822 if ( v7 > 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2823 memset(v6, 0, v7 - 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2824 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2825 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2826
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2827
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2828 //----- (004103BB) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2829 void LODFile_IconsBitmaps::ReleaseHardwareTextures()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2830 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2831 LODFile_IconsBitmaps *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2832 unsigned int v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2833 struct IDirect3DTexture2 **v3; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2834 struct IDirect3DTexture2 *v4; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2835 struct IDirectDrawSurface **v5; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2836 struct IDirectDrawSurface *v6; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2837
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2838 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2839 v2 = this->uNumLoadedFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2840 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2841 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2842 --v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2843 if ( (v2 & 0x80000000u) != 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2844 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2845 v3 = v1->pHardwareTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2846 if ( v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2847 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2848 v4 = v3[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2849 if ( v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2850 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2851 v4->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2852 v1->pHardwareTextures[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2853 v1->ptr_011BB4[v2] = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2854 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2855 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2856 v5 = v1->pHardwareSurfaces;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2857 if ( v5 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2858 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2859 v6 = v5[v2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2860 if ( v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2861 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2862 v6->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2863 v1->pHardwareSurfaces[v2] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2864 v1->ptr_011BB4[v2] = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2865 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2866 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2867 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2868 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2869
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2870
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2871 //----- (0041033D) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2872 void LODFile_IconsBitmaps::ReleaseLostHardwareTextures()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2873 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2874 LODFile_IconsBitmaps *v1; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2875 unsigned int i; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2876 struct IDirectDrawSurface **pHardwareSurfaces; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2877 int v4; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2878 struct IDirectDrawSurface *pSurface; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2879 struct IDirect3DTexture2 **v6; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2880 struct IDirect3DTexture2 *v7; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2881
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2882 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2883 for ( i = this->uNumLoadedFiles - 1; (i & 0x80000000u) == 0; --i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2884 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2885 pHardwareSurfaces = v1->pHardwareSurfaces;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2886 if ( pHardwareSurfaces )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2887 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2888 v4 = i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2889 pSurface = pHardwareSurfaces[i];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2890 if ( pSurface )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2891 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2892 if ( pSurface->IsLost() == DDERR_SURFACELOST )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2893 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2894 v6 = v1->pHardwareTextures;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2895 if ( v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2896 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2897 v7 = v6[v4];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2898 if ( v7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2899 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2900 v7->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2901 v1->pHardwareTextures[v4] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2902 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2903 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2904 v1->pHardwareSurfaces[v4]->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2905 v1->pHardwareSurfaces[v4] = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2906 v1->ptr_011BB4[i] = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2907 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2908 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2909 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2910 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2911 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2912
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2913 //----- (004101B1) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2914 int LODFile_IconsBitmaps::ReloadTexture(Texture *pDst, const char *pContainer, int mode)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2915 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2916 LODFile_IconsBitmaps *v4; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2917 FILE *v5; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2918 Texture *v6; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2919 unsigned int v7; // ebx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2920 unsigned int v8; // ecx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2921 signed int result; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2922 size_t *v10; // ebx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2923 signed int v11; // ebx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2924 int v12; // eax@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2925 int v13; // edx@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2926 FILE *File; // [sp+Ch] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2927 unsigned __int8 v15; // [sp+11h] [bp-3h]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2928 unsigned __int8 v16; // [sp+12h] [bp-2h]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2929 unsigned __int8 DstBuf; // [sp+13h] [bp-1h]@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2930 void *DstBufa; // [sp+1Ch] [bp+8h]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2931 void *Sourcea; // [sp+20h] [bp+Ch]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2932 unsigned int Counta; // [sp+24h] [bp+10h]@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2933
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2934 v4 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2935 v5 = FindContainer(pContainer, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2936 File = v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2937 if ( v5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2938 && (v6 = pDst, pDst->pLevelOfDetail0)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2939 && mode == 2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2940 && pDst->pPalette16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2941 && !pDst->pPalette24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2942 && (v7 = pDst->uTextureSize,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2943 fread(pDst, 1u, 0x30u, v5),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2944 strcpy(pDst->pName, pContainer),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2945 v8 = pDst->uTextureSize,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2946 Counta = pDst->uTextureSize,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2947 (signed int)v8 <= (signed int)v7) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2948 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2949 v10 = &pDst->uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2950 if ( !pDst->uDecompressedSize || v4->dword_011BA4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2951 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2952 fread(pDst->pLevelOfDetail0, 1u, v8, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2953 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2954 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2955 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2956 Sourcea = malloc(pDst->uDecompressedSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2957 DstBufa = malloc(pDst->uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2958 fread(DstBufa, 1u, Counta, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2959 zlib::MemUnzip(Sourcea, &v6->uDecompressedSize, DstBufa, v6->uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2960 v6->uTextureSize = *v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2961 free(DstBufa);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2962 memcpy(v6->pLevelOfDetail0, Sourcea, *v10);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2963 free(Sourcea);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2964 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2965 v11 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2966 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2967 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2968 fread(&DstBuf, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2969 fread(&v16, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2970 v12 = fread(&v15, 1u, 1u, File);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2971 LOWORD(v12) = (unsigned __int8)(DstBuf >> (8 - LOBYTE(v4->uTextureRedBits)));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2972 v6->pPalette16[v11] = v12 << (LOBYTE(v4->uTextureBlueBits) + LOBYTE(v4->uTextureGreenBits));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2973 LOWORD(v13) = (unsigned __int8)(v16 >> (8 - LOBYTE(v4->uTextureGreenBits)));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2974 v6->pPalette16[v11] += v13 << v4->uTextureBlueBits;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2975 v6->pPalette16[v11] += (unsigned __int8)(v15 >> (8 - LOBYTE(v4->uTextureBlueBits)));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2976 ++v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2977 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2978 while ( v11 < 256 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2979 result = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2980 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2981 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2982 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2983 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2984 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2985 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2986 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2987
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2988
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2989 //----- (0040FC08) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2990 int LODFile_IconsBitmaps::LoadTextureFromLOD(Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2991 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2992 Texture *v8; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2993 size_t v11; // eax@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2994 enum TEXTURE_TYPE v12; // eax@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2995 signed int v13; // esi@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2996 unsigned int v14; // eax@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2997 unsigned int v15; // ecx@25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2998 unsigned int *v16; // ebx@25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2999 void *v17; // eax@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3000 unsigned int v18; // ST28_4@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3001 void *v19; // ST3C_4@27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3002 Allocator *v20; // ebx@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3003 void *v21; // eax@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3004 size_t v22; // ST2C_4@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3005 const void *v23; // ecx@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3006 unsigned __int16 v24; // ax@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3007 unsigned __int16 v25; // cx@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3008 __int16 v26; // dx@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3009 unsigned int v27; // ecx@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3010 Texture *v28; // eax@29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3011 unsigned int v29; // ST28_4@30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3012 void *v30; // eax@30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3013 unsigned int v31; // ST2C_4@30
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3014 void *v32; // eax@32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3015 void *v33; // eax@34
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3016 signed int v34; // eax@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3017 unsigned __int8 *v35; // ecx@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3018 unsigned __int8 *v36; // ecx@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3019 unsigned __int8 *v37; // eax@37
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3020 signed int v38; // ebx@39
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3021 int v39; // eax@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3022 int v40; // edx@40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3023 signed int v41; // ecx@43
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3024 signed int v42; // ecx@48
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3025
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3026 //v4 = pContainer;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3027 //v5 = this;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3028 //v6 = FindContainer(pContainer, 0);
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3029 //File = v6;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3030 auto pFile = FindContainer(pContainer, false);
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3031 if (!pFile)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3032 return -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3033 v8 = pOutTex;
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3034 fread(pOutTex, 1u, 0x30u, pFile);
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3035 strcpy(v8->pName, pContainer);
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3036 if (pRenderer->pRenderD3D && v8->pBits & 2 && dword_011BA8)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3037 {
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3038 if (!pHardwareSurfaces || !pHardwareTextures)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3039 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3040 pHardwareSurfaces = new IDirectDrawSurface *[1000];
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3041 memset(pHardwareSurfaces, 0, 1000 * sizeof(IDirectDrawSurface4 *));
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3042
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3043 pHardwareTextures = new IDirect3DTexture2 *[1000];
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3044 memset(pHardwareTextures, 0, 1000 * sizeof(IDirect3DTexture2 *));
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3045
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3046 ptr_011BB4 = new char[1000];
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3047 memset(ptr_011BB4, 0, 1000);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3048 }
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3049 if (strcmp(pContainer, "wtrdr"))//*v4 != 'w' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'd' || v4[4] != 'r' )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3050 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3051 if (strcmp(pContainer, "WtrTyl"))//if ( *v4 != 'W' || v4[1] != 't' || v4[2] != 'r' || v4[3] != 'T' || v4[4] != 'y' || v4[5] != 'l' )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3052 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3053 v14 = uNumLoadedFiles;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3054 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3055 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3056 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3057 pRenderer->field_1036AC_bitmapid = uNumLoadedFiles;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3058 v14 = uNumLoadedFiles;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3059 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3060 v13 = pRenderer->LoadTexture(
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3061 pContainer,
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3062 v8->palette_id1,
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3063 (IDirectDrawSurface4 **)&pHardwareSurfaces[v14],
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3064 &pHardwareTextures[v14]);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3065 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3066 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3067 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3068 v11 = strlen(pContainer);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3069 v12 = (enum TEXTURE_TYPE)(int)operator new(v11 + 2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3070 eTextureType = v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3071 *(char *)v12 = 104;
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3072 strcpy((char *)(v12 + 1), pContainer);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3073 v13 = pRenderer->LoadTexture(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3074 (const char *)eTextureType,
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3075 v8->palette_id1,
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3076 (IDirectDrawSurface4 **)&pHardwareSurfaces[uNumLoadedFiles],
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3077 &pHardwareTextures[uNumLoadedFiles]);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3078 free((void *)eTextureType);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3079 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3080 return v13;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3081 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3082 v15 = v8->uTextureSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3083 v16 = &v8->uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3084 pOutTex = (Texture *)v8->uTextureSize;
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3085 if ( !v8->uDecompressedSize || dword_011BA4 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3086 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3087 v20 = pAllocator;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3088 v32 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0, v15, v8->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3089 v8->pLevelOfDetail0 = (unsigned __int8 *)v32;
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3090 fread(v32, 1u, (size_t)pOutTex, pFile);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3091 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3092 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3093 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3094 v17 = malloc(v8->uDecompressedSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3095 v18 = v8->uTextureSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3096 pContainer = (const char *)v17;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3097 v19 = malloc(v18);
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3098 fread(v19, 1u, (size_t)pOutTex, pFile);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3099 zlib::MemUnzip((void *)pContainer, &v8->uDecompressedSize, v19, v8->uTextureSize);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3100 v8->uTextureSize = *v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3101 free(v19);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3102 if ( bUseLoResSprites && v8->pBits & 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3103 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3104 v20 = pAllocator;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3105 pOutTex = (Texture *)(((signed int)v8->uSizeOfMaxLevelOfDetail >> 2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3106 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3107 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 6));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3108 v21 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0, (unsigned int)pOutTex, v8->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3109 v22 = (size_t)pOutTex;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3110 v23 = &pContainer[v8->uTextureWidth * v8->uTextureHeight];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3111 v8->pLevelOfDetail0 = (unsigned __int8 *)v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3112 memcpy(v21, v23, v22);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3113 v8->uTextureWidth = (signed __int16)v8->uTextureWidth >> 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3114 v24 = v8->uTextureWidth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3115 v8->uTextureHeight = (signed __int16)v8->uTextureHeight >> 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3116 v25 = v8->uTextureHeight;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3117 --v8->uWidthLn2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3118 --v8->uHeightLn2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3119 v8->uWidthMinus1 = v24 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3120 v26 = v25 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3121 v27 = (signed __int16)v24 * (signed __int16)v25;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3122 v28 = pOutTex;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3123 v8->uHeightMinus1 = v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3124 v8->uSizeOfMaxLevelOfDetail = v27;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3125 v8->uTextureSize = (unsigned int)v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3126 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3127 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3128 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3129 v29 = *v16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3130 v20 = pAllocator;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3131 v30 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0, v29, v8->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3132 v31 = v8->uDecompressedSize;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3133 v8->pLevelOfDetail0 = (unsigned __int8 *)v30;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3134 memcpy(v30, pContainer, v31);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3135 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3136 free((void *)pContainer);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3137 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3138 pAllocator->FreeChunk(v8->pPalette16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3139 pAllocator->FreeChunk(v8->pPalette24);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3140 if ( eTextureType == TEXTURE_24BIT_PALETTE )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3141 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3142 v33 = pAllocator->AllocNamedChunk(v8->pPalette24, 0x300u, v8->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3143 v8->pPalette24 = (unsigned __int8 *)v33;
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3144 fread(v33, 1u, 0x300u, pFile);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3145 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3146 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3147 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3148 v8->pPalette24 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3149 if ( eTextureType == TEXTURE_16BIT_PALETTE )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3150 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3151 v8->pPalette16 = (unsigned __int16 *)pAllocator->AllocNamedChunk(v8->pPalette16, 0x200u, v8->pName);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3152 v38 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3153 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3154 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3155 fread((char *)&eTextureType + 3, 1u, 1u, pFile);
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3156 fread((char *)&pContainer + 3, 1u, 1u, pFile);
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3157 v39 = fread((char *)&pOutTex + 3, 1u, 1u, pFile);
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3158 LOWORD(v39) = (unsigned __int8)(BYTE3(eTextureType) >> (8 - LOBYTE(uTextureRedBits)));
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3159 v8->pPalette16[v38] = v39 << (LOBYTE(uTextureBlueBits) + LOBYTE(uTextureGreenBits));
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3160 LOWORD(v40) = (unsigned __int8)(BYTE3(pContainer) >> (8 - LOBYTE(uTextureGreenBits)));
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3161 v8->pPalette16[v38] += v40 << uTextureBlueBits;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3162 v8->pPalette16[v38] += (unsigned __int8)(BYTE3(pOutTex) >> (8 - LOBYTE(uTextureBlueBits)));
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3163 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3164 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3165 while ( v38 < 256 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3166 goto LABEL_36;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3167 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3168 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3169 v8->pPalette16 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3170 LABEL_36:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3171 if ( v8->pBits & 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3172 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3173 v34 = v8->uSizeOfMaxLevelOfDetail;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3174 v35 = &v8->pLevelOfDetail0[v34];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3175 v8->pLevelOfDetail1 = v35;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3176 v36 = &v35[v34 >> 2];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3177 v8->pLevelOfDetail2 = v36;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3178 v37 = &v36[v34 >> 4];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3179 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3180 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3181 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3182 v37 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3183 v8->pLevelOfDetail2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3184 v8->pLevelOfDetail1 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3185 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3186 v8->pLevelOfDetail3 = v37;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3187 v41 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3188 while ( 1 << v41 != v8->uTextureWidth )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3189 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3190 ++v41;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3191 if ( v41 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3192 goto LABEL_48;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3193 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3194 v8->uWidthLn2 = v41;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3195 LABEL_48:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3196 v42 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3197 while ( 1 << v42 != v8->uTextureHeight )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3198 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3199 ++v42;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3200 if ( v42 >= 15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3201 goto LABEL_53;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3202 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3203 v8->uHeightLn2 = v42;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3204 LABEL_53:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3205 switch ( v8->uWidthLn2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3206 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3207 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3208 v8->uWidthMinus1 = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3209 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3210 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3211 v8->uWidthMinus1 = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3212 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3213 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3214 v8->uWidthMinus1 = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3215 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3216 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3217 v8->uWidthMinus1 = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3218 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3219 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3220 v8->uWidthMinus1 = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3221 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3222 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3223 v8->uWidthMinus1 = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3224 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3225 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3226 v8->uWidthMinus1 = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3227 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3228 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3229 v8->uWidthMinus1 = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3230 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3231 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3232 v8->uWidthMinus1 = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3233 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3234 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3235 v8->uWidthMinus1 = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3236 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3237 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3238 v8->uWidthMinus1 = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3239 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3240 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3241 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3242 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3243 switch ( v8->uHeightLn2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3244 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3245 case 2:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3246 v8->uHeightMinus1 = 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3247 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3248 case 3:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3249 v8->uHeightMinus1 = 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3250 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3251 case 4:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3252 v8->uHeightMinus1 = 15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3253 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3254 case 5:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3255 v8->uHeightMinus1 = 31;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3256 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3257 case 6:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3258 v8->uHeightMinus1 = 63;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3259 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3260 case 7:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3261 v8->uHeightMinus1 = 127;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3262 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3263 case 8:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3264 v8->uHeightMinus1 = 255;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3265 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3266 case 9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3267 v8->uHeightMinus1 = 511;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3268 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3269 case 10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3270 v8->uHeightMinus1 = 1023;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3271 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3272 case 11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3273 v8->uHeightMinus1 = 2047;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3274 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3275 case 12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3276 v8->uHeightMinus1 = 4095;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3277 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3278 default:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3279 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3280 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3281 return 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3282 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3283
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3284
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3285 Texture *LODFile_IconsBitmaps::LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType)
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3286 {
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3287 uint id = LoadTexture(pContainer, uTextureType);
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3288 if (id == -1)
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3289 {
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3290 Log::Warning(L"LOD error\\no container: \"%S\"", pContainer);
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3291 return nullptr;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3292 }
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3293 return &pTextures[id];
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3294 }
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 1
diff changeset
3295
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3296 //----- (0040FB20) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3297 unsigned int LODFile_IconsBitmaps::LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3298 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3299 //LODFile_IconsBitmaps *v3; // esi@1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3300 //unsigned int v4; // edi@1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3301 //Texture *v5; // ebx@2
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3302 unsigned int v6; // ebx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3303 const char *Sourcea; // [sp+14h] [bp+8h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3304
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3305 //v3 = this;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3306 //v4 = 0;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3307 areWeLoadingTexture = 1;
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3308
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3309 for (uint i = 0; i < uNumLoadedFiles; ++i)
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3310 if (!strcmpi(pContainer, pTextures[i].pName))
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3311 return i;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3312
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3313 // if (!uNumLoadedFiles)
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3314 // {
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3315 //LABEL_5:
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3316 if (uNumLoadedFiles >= 1000)
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3317 {
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3318 Log::Warning(L"Maximum texture number exceeded");
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3319 AbortWithError();
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3320 }
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3321 if (LoadTextureFromLOD(&pTextures[uNumLoadedFiles], pContainer, uTextureType) == -1)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3322 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3323 v6 = 0;
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3324 if (uNumLoadedFiles > 0)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3325 {
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3326 Sourcea = (const char *)pTextures;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3327 while ( _strcmpi(Sourcea, "pending") )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3328 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3329 Sourcea += 72;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3330 ++v6;
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3331 if (v6 >= uNumLoadedFiles)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3332 goto LABEL_15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3333 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3334 return v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3335 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3336 LABEL_15:
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3337 LoadTextureFromLOD(&pTextures[uNumLoadedFiles], "pending", uTextureType);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3338 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3339 areWeLoadingTexture = 0;
1
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3340 ++uNumLoadedFiles;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3341 return uNumLoadedFiles - 1;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3342 // }
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3343 // v5 = pTextures;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3344 // while ( _strcmpi(v5->pName, pContainer) )
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3345 // {
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3346 // ++v4;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3347 // ++v5;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3348 // if (v4 >= uNumLoadedFiles )
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3349 // goto LABEL_5;
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3350 // }
ac0fb48cd27a Texture, hwl loading, video player
Nomad
parents: 0
diff changeset
3351 // return v4;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3352 }