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