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