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