Mercurial > mm7
comparison LOD.h @ 1635:04cae215a13c
Слияние
author | Ritor1 |
---|---|
date | Tue, 17 Sep 2013 16:30:43 +0600 |
parents | 69ab7593e7af |
children | 9bd7522cdbbb |
comparison
equal
deleted
inserted
replaced
1634:08ebd0fee604 | 1635:04cae215a13c |
---|---|
1 #pragma once | 1 #pragma once |
2 #include <stdio.h> | 2 #include <stdio.h> |
3 #include <memory.h> | 3 #include <memory.h> |
4 | 4 |
5 #include "Log.h" | |
5 #include "Texture.h" | 6 #include "Texture.h" |
6 #include "ErrorHandling.h" | 7 #include "ErrorHandling.h" |
7 | 8 |
8 class Sprite; | 9 class Sprite; |
10 | |
11 | |
12 #define MAX_LOD_TEXTURES 1000 | |
13 #define MAX_LOD_SPRITES 1500 | |
9 | 14 |
10 /* 354 */ | 15 /* 354 */ |
11 enum TEXTURE_TYPE | 16 enum TEXTURE_TYPE |
12 { | 17 { |
13 TEXTURE_DEFAULT = 0, | 18 TEXTURE_DEFAULT = 0, |
162 void RemoveTexturesFromTextureList(); | 167 void RemoveTexturesFromTextureList(); |
163 void _inlined_sub0(); | 168 void _inlined_sub0(); |
164 void _inlined_sub1(); | 169 void _inlined_sub1(); |
165 void _inlined_sub2(); | 170 void _inlined_sub2(); |
166 | 171 |
167 inline struct Texture *GetTexture(int idx) | 172 inline int LoadDummyTexture() |
168 { | 173 { |
169 Assert(idx < 1000, "Texture index out of bounds (%u)", idx); | 174 for (unsigned int i = 0; i < uNumLoadedFiles; ++i) |
175 if (!strcmp(pTextures[i].pName, "pending")) | |
176 return i; | |
177 return LoadTextureFromLOD(&pTextures[uNumLoadedFiles], "pending", TEXTURE_16BIT_PALETTE); | |
178 } | |
179 | |
180 inline Texture *GetTexture(int idx) | |
181 { | |
182 Assert(idx < MAX_LOD_TEXTURES, "Texture index out of bounds (%u)", idx); | |
170 if (idx == -1) | 183 if (idx == -1) |
171 return nullptr; // we need to return dummy texture here | 184 { |
172 return &pTextures[idx]; | 185 //Log::Warning(L"Texture id = %d missing", idx); |
186 return pTextures + LoadDummyTexture(); | |
187 } | |
188 return pTextures + idx; | |
173 } | 189 } |
174 | 190 |
175 | 191 |
176 /*FILE *pFile; | 192 /*FILE *pFile; |
177 unsigned __int8 pLODName[256]; | 193 unsigned __int8 pLODName[256]; |
185 unsigned int uLODDataSize; | 201 unsigned int uLODDataSize; |
186 unsigned int uNumSubIndices; | 202 unsigned int uNumSubIndices; |
187 struct LOD::Directory *pSubIndices; | 203 struct LOD::Directory *pSubIndices; |
188 unsigned int uOffsetToSubIndex; | 204 unsigned int uOffsetToSubIndex; |
189 FILE *pOutputFileHandle;*/ | 205 FILE *pOutputFileHandle;*/ |
190 struct Texture pTextures[1000]; | 206 Texture pTextures[MAX_LOD_TEXTURES]; |
191 unsigned int uNumLoadedFiles; | 207 unsigned int uNumLoadedFiles; |
192 int dword_11B80; | 208 int dword_11B80; |
193 int dword_11B84; | 209 int dword_11B84; |
194 int dword_11B88; | 210 int dword_11B88; |
195 int uTextureRedBits; | 211 int uTextureRedBits; |
276 unsigned int uLODDataSize; | 292 unsigned int uLODDataSize; |
277 unsigned int uNumSubIndices; | 293 unsigned int uNumSubIndices; |
278 struct LOD::Directory *pSubIndices; | 294 struct LOD::Directory *pSubIndices; |
279 unsigned int uOffsetToSubIndex; | 295 unsigned int uOffsetToSubIndex; |
280 FILE *pOutputFileHandle;*/ | 296 FILE *pOutputFileHandle;*/ |
281 struct LODSprite pSpriteHeaders[1500]; | 297 struct LODSprite pSpriteHeaders[MAX_LOD_SPRITES]; |
282 signed int uNumLoadedSprites; | 298 signed int uNumLoadedSprites; |
283 int field_ECA0; | 299 int field_ECA0; |
284 int field_ECA4; | 300 int field_ECA4; |
285 int field_ECA8; | 301 int field_ECA8; |
286 int field_ECAC; | 302 int field_ECAC; |