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();
|
|
161
|
434
|
162 inline Texture *GetTexture(int idx)
|
|
163 {
|
|
164 assert(idx < 1000);
|
|
165 if (idx == -1)
|
|
166 return nullptr;
|
|
167 return pTextures + idx;
|
|
168 }
|
|
169
|
0
|
170
|
|
171 /*FILE *pFile;
|
|
172 unsigned __int8 pLODName[256];
|
|
173 unsigned int isFileOpened;
|
|
174 unsigned __int8 *pIOBuffer;
|
|
175 unsigned int uIOBufferSize;
|
|
176 struct LOD::FileHeader header;
|
|
177 struct LOD::Directory *pRoot;
|
|
178 unsigned __int8 pContainerName[16];
|
|
179 unsigned int uCurrentIndexDir;
|
|
180 unsigned int uLODDataSize;
|
|
181 unsigned int uNumSubIndices;
|
|
182 struct LOD::Directory *pSubIndices;
|
|
183 unsigned int uOffsetToSubIndex;
|
|
184 FILE *pOutputFileHandle;*/
|
|
185 struct Texture pTextures[1000];
|
|
186 unsigned int uNumLoadedFiles;
|
|
187 int dword_11B80;
|
|
188 int dword_11B84;
|
|
189 int dword_11B88;
|
|
190 int uTextureRedBits;
|
|
191 int uTextureGreenBits;
|
|
192 int uTextureBlueBits;
|
|
193 int uNumPrevLoadedFiles;
|
|
194 int uTexturePacksCount;
|
33
|
195 int pFacesLock;
|
0
|
196 int dword_011BA4;
|
|
197 int dword_011BA8;
|
|
198 struct IDirectDrawSurface **pHardwareSurfaces;
|
|
199 struct IDirect3DTexture2 **pHardwareTextures;
|
|
200 char *ptr_011BB4;
|
|
201 };
|
|
202 #pragma pack(pop)
|
|
203
|
|
204
|
|
205
|
|
206
|
|
207
|
|
208
|
|
209 #pragma pack(push, 1)
|
|
210 struct LODSprite
|
|
211 {
|
|
212 //----- (0046244C) --------------------------------------------------------
|
|
213 inline LODSprite()
|
|
214 {
|
|
215 uHeight = 0;
|
|
216 uPaletteId = 0;
|
|
217 word_1A = 0;
|
|
218 pSpriteLines = nullptr;
|
|
219 pDecompressedBytes = nullptr;
|
|
220 }
|
|
221 ~LODSprite();
|
|
222
|
|
223 void Release();
|
733
|
224 int DrawSprite_sw(struct RenderBillboardTransform_local0 *a2, char a3);
|
0
|
225 int _4AD2D1(struct RenderBillboardTransform_local0 *a2, int a3);
|
|
226
|
670
|
227 char pName[12]; //0
|
|
228 int uSpriteSize; //C
|
|
229 __int16 uWidth; //10
|
|
230 __int16 uHeight; //12
|
|
231 __int16 uPaletteId; //14
|
|
232 __int16 word_16; //16
|
|
233 __int16 uTexturePitch; //18
|
|
234 __int16 word_1A; //1a
|
|
235 int uDecompressedSize; //1c
|
|
236 struct LODSprite_stru0 *pSpriteLines; //20
|
|
237 void *pDecompressedBytes; //24
|
0
|
238 };
|
|
239 #pragma pack(pop)
|
|
240
|
|
241 /* 15 */
|
|
242 #pragma pack(push, 1)
|
|
243 struct LODFile_Sprites: public LOD::File
|
|
244 {
|
|
245 LODFile_Sprites();
|
|
246 virtual ~LODFile_Sprites();
|
|
247
|
|
248 void DeleteSomeSprites();
|
|
249 void DeleteSpritesRange(int uStartIndex, int uStopIndex);
|
|
250 int _461397();
|
|
251 void DeleteSomeOtherSprites();
|
|
252 int LoadSpriteFromFile(LODSprite *pSpriteHeader, const char *pContainer);
|
|
253 bool LoadSprites(const char *pFilename);
|
|
254 int LoadSprite(const char *pContainerName, unsigned int uPaletteID);
|
|
255 void ReleaseLostHardwareSprites();
|
|
256 void ReleaseAll();
|
|
257 void MoveSpritesToVideoMemory();
|
|
258
|
|
259
|
|
260 /*FILE *pFile;
|
|
261 unsigned __int8 pLODName[256];
|
|
262 unsigned int isFileOpened;
|
|
263 unsigned __int8 *pIOBuffer;
|
|
264 unsigned int uIOBufferSize;
|
|
265 struct LOD::FileHeader header;
|
|
266 struct LOD::Directory *pRoot;
|
|
267 unsigned __int8 pContainerName[16];
|
|
268 unsigned int uCurrentIndexDir;
|
|
269 unsigned int uLODDataSize;
|
|
270 unsigned int uNumSubIndices;
|
|
271 struct LOD::Directory *pSubIndices;
|
|
272 unsigned int uOffsetToSubIndex;
|
|
273 FILE *pOutputFileHandle;*/
|
|
274 struct LODSprite pSpriteHeaders[1500];
|
670
|
275 signed int uNumLoadedSprites;
|
0
|
276 int field_ECA0;
|
|
277 int field_ECA4;
|
|
278 int field_ECA8;
|
|
279 int field_ECAC;
|
|
280 struct Sprite *pHardwareSprites;
|
|
281 int field_ECB4;
|
|
282 };
|
|
283 #pragma pack(pop)
|
|
284
|
|
285 /* 17 */
|
|
286 #pragma pack(push, 1)
|
|
287 struct LODSprite_stru0
|
|
288 {
|
|
289 int dword_0;
|
|
290 void *ptr_4;
|
|
291 };
|
|
292 #pragma pack(pop)
|
|
293
|
|
294
|
|
295
|
|
296
|
|
297 extern LODFile_IconsBitmaps *pEvents_LOD;
|
|
298 extern LODFile_IconsBitmaps *pIcons_LOD;
|
|
299 extern LODFile_Sprites *pSprites_LOD;
|
|
300 extern LODFile_IconsBitmaps *pBitmaps_LOD;
|
|
301
|
|
302 extern LODWriteableFile *pNew_LOD;
|
|
303 extern LODWriteableFile *pGames_LOD;
|
|
304
|
|
305
|
|
306
|
|
307
|
|
308 extern int _6A0CA4_lod_binary_search; // weak
|
|
309 extern int _6A0CA8_lod_unused; // weak |