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