Mercurial > mm7
annotate LOD.h @ 1604:4b79ff62df3a
Moved enchantment attribute bonus list to items.cpp/h, created static function that create the enchantments + helper functions to get the enchantment strength, moved the whole logic of Player::GetItemsBonus to a case
author | Grumpy7 |
---|---|
date | Sat, 14 Sep 2013 06:04:18 +0200 |
parents | c4ab816fcc5e |
children | 69ab7593e7af |
rev | line source |
---|---|
0 | 1 #pragma once |
2 #include <stdio.h> | |
3 #include <memory.h> | |
4 | |
5 #include "Texture.h" | |
1545 | 6 #include "ErrorHandling.h" |
0 | 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); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1464
diff
changeset
|
149 bool Load(const char *pFilename, const char *pFolderName); |
0 | 150 void ReleaseAll(); |
151 unsigned int LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT); | |
1262 | 152 struct Texture *LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT); |
153 int LoadTextureFromLOD(struct Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType); | |
154 int ReloadTexture(struct Texture *pDst, const char *pContainer, int mode); | |
0 | 155 void ReleaseHardwareTextures(); |
156 void ReleaseLostHardwareTextures(); | |
157 void _410423_move_textures_to_device(); | |
1262 | 158 int _410522(struct Texture *pDst, const char *pContainer, unsigned int uTextureType); |
0 | 159 void SetupPalettes(unsigned int uTargetRBits, unsigned int uTargetGBits, unsigned int uTargetBBits); |
160 void ReleaseAll2(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
161 void RemoveTexturesPackFromTextureList(); |
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
162 void RemoveTexturesFromTextureList(); |
762 | 163 void _inlined_sub0(); |
164 void _inlined_sub1(); | |
165 void _inlined_sub2(); | |
0 | 166 |
1262 | 167 inline struct Texture *GetTexture(int idx) |
434 | 168 { |
1545 | 169 Assert(idx < 1000, "Texture index out of bounds (%u)", idx); |
1464 | 170 if (idx == -1) |
171 return nullptr; // we need to return dummy texture here | |
172 return &pTextures[idx]; | |
434 | 173 } |
174 | |
0 | 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;*/ | |
190 struct Texture pTextures[1000]; | |
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; | |
33 | 200 int pFacesLock; |
0 | 201 int dword_011BA4; |
202 int dword_011BA8; | |
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(); | |
733 | 229 int DrawSprite_sw(struct RenderBillboardTransform_local0 *a2, char a3); |
0 | 230 int _4AD2D1(struct RenderBillboardTransform_local0 *a2, int a3); |
231 | |
670 | 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 | |
0 | 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(); | |
762 | 263 void _inlined_sub0(); |
264 void _inlined_sub1(); | |
0 | 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[1500]; | |
670 | 282 signed int uNumLoadedSprites; |
0 | 283 int field_ECA0; |
284 int field_ECA4; | |
285 int field_ECA8; | |
286 int field_ECAC; | |
1103 | 287 Sprite *pHardwareSprites; |
0 | 288 int field_ECB4; |
289 }; | |
290 #pragma pack(pop) | |
291 | |
292 /* 17 */ | |
293 #pragma pack(push, 1) | |
294 struct LODSprite_stru0 | |
295 { | |
296 int dword_0; | |
297 void *ptr_4; | |
298 }; | |
299 #pragma pack(pop) | |
300 | |
301 | |
302 | |
303 | |
304 extern LODFile_IconsBitmaps *pEvents_LOD; | |
1541 | 305 |
0 | 306 extern LODFile_IconsBitmaps *pIcons_LOD; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1464
diff
changeset
|
307 extern LODFile_IconsBitmaps *pIcons_LOD_mm6; |
1541 | 308 extern LODFile_IconsBitmaps *pIcons_LOD_mm8; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1464
diff
changeset
|
309 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1464
diff
changeset
|
310 extern LODFile_IconsBitmaps *pBitmaps_LOD; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1464
diff
changeset
|
311 extern LODFile_IconsBitmaps *pBitmaps_LOD_mm6; |
1541 | 312 extern LODFile_IconsBitmaps *pBitmaps_LOD_mm8; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1464
diff
changeset
|
313 |
0 | 314 extern LODFile_Sprites *pSprites_LOD; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1464
diff
changeset
|
315 extern LODFile_Sprites *pSprites_LOD_mm6; |
1541 | 316 extern LODFile_Sprites *pSprites_LOD_mm8; |
0 | 317 |
318 extern LODWriteableFile *pNew_LOD; | |
319 extern LODWriteableFile *pGames_LOD; | |
320 | |
321 | |
322 | |
323 | |
324 extern int _6A0CA4_lod_binary_search; // weak | |
325 extern int _6A0CA8_lod_unused; // weak |