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