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