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