0
|
1 #pragma once
|
|
2 #include <stdio.h>
|
|
3 #include <memory.h>
|
434
|
4 #include <assert.h>
|
0
|
5
|
|
6 #include "Texture.h"
|
|
7
|
|
8
|
|
9 /* 354 */
|
|
10 enum TEXTURE_TYPE
|
|
11 {
|
|
12 TEXTURE_DEFAULT = 0,
|
|
13 TEXTURE_24BIT_PALETTE = 0x1,
|
|
14 TEXTURE_16BIT_PALETTE = 0x2,
|
|
15 };
|
|
16
|
|
17
|
|
18
|
|
19
|
|
20 namespace LOD
|
|
21 {
|
|
22 #pragma pack(push, 1)
|
|
23 struct FileHeader
|
|
24 {
|
|
25 inline FileHeader()
|
|
26 {
|
|
27 memset(pSignature, 0, 4);
|
|
28 memset(LodVersion, 0, 80);
|
|
29 memset(LodDescription, 0, 80);
|
|
30 memset(array_0000B0, 0, 28);
|
|
31 memset(array_0000CC, 0, 52);
|
|
32 }
|
|
33
|
|
34 void Reset();
|
|
35
|
|
36 char pSignature[4];
|
|
37 char LodVersion[80];
|
|
38 //char field_C[32];
|
|
39 //char field_2C[40];
|
|
40 char LodDescription[80];
|
|
41 int LODSize;
|
|
42 int dword_0000A8;
|
|
43 unsigned int uNumIndices;
|
|
44 char array_0000B0[28];
|
|
45 char array_0000CC[52];
|
|
46 };
|
|
47 #pragma pack(pop)
|
|
48
|
|
49
|
|
50 #pragma pack(push, 1)
|
|
51 struct Directory
|
|
52 {
|
|
53 Directory();
|
|
54 Directory *Reset();
|
|
55
|
|
56
|
|
57 char pFilename[16];
|
|
58 unsigned int uOfsetFromSubindicesStart;
|
|
59 unsigned int uDataSize;
|
|
60 int dword_000018;
|
|
61 unsigned __int16 uNumSubIndices;
|
|
62 __int16 word_00001E;
|
|
63 };
|
|
64 #pragma pack(pop)
|
|
65
|
|
66
|
|
67 #pragma pack(push, 1)
|
|
68 struct File
|
|
69 {
|
|
70 File();
|
|
71 virtual ~File();
|
|
72 void *LoadRaw(const char *pContainer, int a3);
|
|
73 FILE *FindContainer(const char *pContainerName, bool bLinearSearch);
|
|
74 bool DoesContainerExist(const char *pContainer);
|
|
75 int CalcIndexFast(int startIndex, int maxIndex, const char *pContainerName);
|
|
76 bool LoadHeader(const char *pFilename, bool bWriting);
|
|
77 int LoadSubIndices(const char *pContainer);
|
|
78 void AllocSubIndicesAndIO(unsigned int uNumSubIndices, unsigned int uBufferSize);
|
|
79 void FreeSubIndexAndIO();
|
|
80 bool AppendDirectory(LOD::Directory *pDir, const void *pData);
|
|
81 void ResetSubIndices();
|
|
82 void Close();
|
|
83
|
|
84 FILE *pFile;
|
|
85 char pLODName[256];
|
|
86 unsigned int isFileOpened;
|
|
87 unsigned __int8 *pIOBuffer;
|
|
88 unsigned int uIOBufferSize;
|
|
89 struct FileHeader header;
|
|
90 struct Directory *pRoot;
|
|
91 char pContainerName[16];
|
|
92 unsigned int uCurrentIndexDir;
|
|
93 unsigned int uLODDataSize;
|
|
94 unsigned int uNumSubIndices;
|
|
95 struct Directory *pSubIndices;
|
|
96 unsigned int uOffsetToSubIndex;
|
|
97 FILE *pOutputFileHandle;
|
|
98 };
|
|
99 #pragma pack(pop)
|
|
100 };
|
|
101
|
|
102
|
|
103
|
|
104
|
|
105
|
|
106
|
|
107 /* 6 */
|
|
108 #pragma pack(push, 1)
|
|
109 struct LODWriteableFile: public LOD::File
|
|
110 {
|
|
111 bool LoadFile(const char *pFilename, bool bWriting);
|
|
112 unsigned int Write(const LOD::Directory *pDir, const void *pDirData, int a4);
|
|
113 void CloseWriteFile();
|
|
114 int CreateTempFile();
|
|
115 int Save();
|
|
116 bool _4621A7();
|
|
117 int _461492(LOD::FileHeader *pHeader, LOD::Directory *pDir, const char *Source);
|
|
118
|
|
119 /*FILE *pFile;
|
|
120 char pLODName[256];
|
|
121 unsigned int isFileOpened;
|
|
122 unsigned __int8 *pIOBuffer;
|
|
123 unsigned int uIOBufferSize;
|
|
124 struct LOD::FileHeader header;
|
|
125 struct LOD::Directory *pRoot;
|
|
126 unsigned __int8 pContainerName[16];
|
|
127 unsigned int uCurrentIndexDir;
|
|
128 unsigned int uLODDataSize;
|
|
129 unsigned int uNumSubIndices;
|
|
130 struct LOD::Directory *pSubIndices;
|
|
131 unsigned int uOffsetToSubIndex;
|
|
132 FILE *pOutputFileHandle;*/
|
|
133 };
|
|
134 #pragma pack(pop)
|
|
135
|
|
136
|
|
137
|
|
138
|
|
139 #pragma pack(push, 1)
|
|
140 struct LODFile_IconsBitmaps: public LOD::File
|
|
141 {
|
|
142 LODFile_IconsBitmaps();
|
|
143 virtual ~LODFile_IconsBitmaps();
|
|
144 int _40F9C5();
|
|
145 unsigned int FindTextureByName(const char *pName);
|
|
146 bool LoadBitmaps(const char *pFilename);
|
|
147 bool LoadIconsOrEvents(const char *pLODFilename);
|
|
148 void ReleaseAll();
|
|
149 unsigned int LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT);
|
|
150 Texture *LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT);
|
|
151 int LoadTextureFromLOD(Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType);
|
|
152 int ReloadTexture(Texture *pDst, const char *pContainer, int mode);
|
|
153 void ReleaseHardwareTextures();
|
|
154 void ReleaseLostHardwareTextures();
|
|
155 void _410423_move_textures_to_device();
|
|
156 int _410522(Texture *pDst, const char *pContainer, unsigned int uTextureType);
|
|
157 void SetupPalettes(unsigned int uTargetRBits, unsigned int uTargetGBits, unsigned int uTargetBBits);
|
|
158 void ReleaseAll2();
|
|
159 void _4114F2();
|
|
160 void _4355F7();
|
762
|
161 void _inlined_sub0();
|
|
162 void _inlined_sub1();
|
|
163 void _inlined_sub2();
|
0
|
164
|
434
|
165 inline Texture *GetTexture(int idx)
|
|
166 {
|
|
167 assert(idx < 1000);
|
|
168 if (idx == -1)
|
|
169 return nullptr;
|
|
170 return pTextures + idx;
|
|
171 }
|
|
172
|
0
|
173
|
|
174 /*FILE *pFile;
|
|
175 unsigned __int8 pLODName[256];
|
|
176 unsigned int isFileOpened;
|
|
177 unsigned __int8 *pIOBuffer;
|
|
178 unsigned int uIOBufferSize;
|
|
179 struct LOD::FileHeader header;
|
|
180 struct LOD::Directory *pRoot;
|
|
181 unsigned __int8 pContainerName[16];
|
|
182 unsigned int uCurrentIndexDir;
|
|
183 unsigned int uLODDataSize;
|
|
184 unsigned int uNumSubIndices;
|
|
185 struct LOD::Directory *pSubIndices;
|
|
186 unsigned int uOffsetToSubIndex;
|
|
187 FILE *pOutputFileHandle;*/
|
|
188 struct Texture pTextures[1000];
|
|
189 unsigned int uNumLoadedFiles;
|
|
190 int dword_11B80;
|
|
191 int dword_11B84;
|
|
192 int dword_11B88;
|
|
193 int uTextureRedBits;
|
|
194 int uTextureGreenBits;
|
|
195 int uTextureBlueBits;
|
|
196 int uNumPrevLoadedFiles;
|
|
197 int uTexturePacksCount;
|
33
|
198 int pFacesLock;
|
0
|
199 int dword_011BA4;
|
|
200 int dword_011BA8;
|
|
201 struct IDirectDrawSurface **pHardwareSurfaces;
|
|
202 struct IDirect3DTexture2 **pHardwareTextures;
|
|
203 char *ptr_011BB4;
|
|
204 };
|
|
205 #pragma pack(pop)
|
|
206
|
|
207
|
|
208
|
|
209
|
|
210
|
|
211
|
|
212 #pragma pack(push, 1)
|
|
213 struct LODSprite
|
|
214 {
|
|
215 //----- (0046244C) --------------------------------------------------------
|
|
216 inline LODSprite()
|
|
217 {
|
|
218 uHeight = 0;
|
|
219 uPaletteId = 0;
|
|
220 word_1A = 0;
|
|
221 pSpriteLines = nullptr;
|
|
222 pDecompressedBytes = nullptr;
|
|
223 }
|
|
224 ~LODSprite();
|
|
225
|
|
226 void Release();
|
733
|
227 int DrawSprite_sw(struct RenderBillboardTransform_local0 *a2, char a3);
|
0
|
228 int _4AD2D1(struct RenderBillboardTransform_local0 *a2, int a3);
|
|
229
|
670
|
230 char pName[12]; //0
|
|
231 int uSpriteSize; //C
|
|
232 __int16 uWidth; //10
|
|
233 __int16 uHeight; //12
|
|
234 __int16 uPaletteId; //14
|
|
235 __int16 word_16; //16
|
|
236 __int16 uTexturePitch; //18
|
|
237 __int16 word_1A; //1a
|
|
238 int uDecompressedSize; //1c
|
|
239 struct LODSprite_stru0 *pSpriteLines; //20
|
|
240 void *pDecompressedBytes; //24
|
0
|
241 };
|
|
242 #pragma pack(pop)
|
|
243
|
|
244 /* 15 */
|
|
245 #pragma pack(push, 1)
|
|
246 struct LODFile_Sprites: public LOD::File
|
|
247 {
|
|
248 LODFile_Sprites();
|
|
249 virtual ~LODFile_Sprites();
|
|
250
|
|
251 void DeleteSomeSprites();
|
|
252 void DeleteSpritesRange(int uStartIndex, int uStopIndex);
|
|
253 int _461397();
|
|
254 void DeleteSomeOtherSprites();
|
|
255 int LoadSpriteFromFile(LODSprite *pSpriteHeader, const char *pContainer);
|
|
256 bool LoadSprites(const char *pFilename);
|
|
257 int LoadSprite(const char *pContainerName, unsigned int uPaletteID);
|
|
258 void ReleaseLostHardwareSprites();
|
|
259 void ReleaseAll();
|
|
260 void MoveSpritesToVideoMemory();
|
762
|
261 void _inlined_sub0();
|
|
262 void _inlined_sub1();
|
0
|
263
|
|
264
|
|
265 /*FILE *pFile;
|
|
266 unsigned __int8 pLODName[256];
|
|
267 unsigned int isFileOpened;
|
|
268 unsigned __int8 *pIOBuffer;
|
|
269 unsigned int uIOBufferSize;
|
|
270 struct LOD::FileHeader header;
|
|
271 struct LOD::Directory *pRoot;
|
|
272 unsigned __int8 pContainerName[16];
|
|
273 unsigned int uCurrentIndexDir;
|
|
274 unsigned int uLODDataSize;
|
|
275 unsigned int uNumSubIndices;
|
|
276 struct LOD::Directory *pSubIndices;
|
|
277 unsigned int uOffsetToSubIndex;
|
|
278 FILE *pOutputFileHandle;*/
|
|
279 struct LODSprite pSpriteHeaders[1500];
|
670
|
280 signed int uNumLoadedSprites;
|
0
|
281 int field_ECA0;
|
|
282 int field_ECA4;
|
|
283 int field_ECA8;
|
|
284 int field_ECAC;
|
|
285 struct Sprite *pHardwareSprites;
|
|
286 int field_ECB4;
|
|
287 };
|
|
288 #pragma pack(pop)
|
|
289
|
|
290 /* 17 */
|
|
291 #pragma pack(push, 1)
|
|
292 struct LODSprite_stru0
|
|
293 {
|
|
294 int dword_0;
|
|
295 void *ptr_4;
|
|
296 };
|
|
297 #pragma pack(pop)
|
|
298
|
|
299
|
|
300
|
|
301
|
|
302 extern LODFile_IconsBitmaps *pEvents_LOD;
|
|
303 extern LODFile_IconsBitmaps *pIcons_LOD;
|
|
304 extern LODFile_Sprites *pSprites_LOD;
|
|
305 extern LODFile_IconsBitmaps *pBitmaps_LOD;
|
|
306
|
|
307 extern LODWriteableFile *pNew_LOD;
|
|
308 extern LODWriteableFile *pGames_LOD;
|
|
309
|
|
310
|
|
311
|
|
312
|
|
313 extern int _6A0CA4_lod_binary_search; // weak
|
|
314 extern int _6A0CA8_lod_unused; // weak |