Mercurial > might-and-magic-trilogy
view LOD.h @ 194:222a09fccca1
Слияние
author | Ritor1 |
---|---|
date | Mon, 24 Dec 2012 10:50:15 +0600 |
parents | 062e8a8e09bc |
children |
line wrap: on
line source
#pragma once #include <stdio.h> #include <memory.h> #include "Texture.h" /* 354 */ enum TEXTURE_TYPE { TEXTURE_DEFAULT = 0, TEXTURE_24BIT_PALETTE = 0x1, TEXTURE_16BIT_PALETTE = 0x2, }; namespace LOD { #pragma pack(push, 1) struct FileHeader { inline FileHeader() { memset(pSignature, 0, 4); memset(LodVersion, 0, 80); memset(LodDescription, 0, 80); memset(array_0000B0, 0, 28); memset(array_0000CC, 0, 52); } void Reset(); char pSignature[4]; char LodVersion[80]; //char field_C[32]; //char field_2C[40]; char LodDescription[80]; int LODSize; int dword_0000A8; unsigned int uNumIndices; char array_0000B0[28]; char array_0000CC[52]; }; #pragma pack(pop) #pragma pack(push, 1) struct Directory { Directory(); Directory *Reset(); char pFilename[16]; unsigned int uOfsetFromSubindicesStart; unsigned int uDataSize; int dword_000018; unsigned __int16 uNumSubIndices; __int16 word_00001E; }; #pragma pack(pop) #pragma pack(push, 1) struct File { File(); virtual ~File(); void *LoadRaw(const char *pContainer, int a3); FILE *FindContainer(const char *pContainerName, bool bLinearSearch); bool DoesContainerExist(const char *pContainer); int CalcIndexFast(int startIndex, int maxIndex, const char *pContainerName); bool LoadHeader(const char *pFilename, bool bWriting); int LoadSubIndices(const char *pContainer); void AllocSubIndicesAndIO(unsigned int uNumSubIndices, unsigned int uBufferSize); void FreeSubIndexAndIO(); bool AppendDirectory(LOD::Directory *pDir, const void *pData); void ResetSubIndices(); void Close(); FILE *pFile; char pLODName[256]; unsigned int isFileOpened; unsigned __int8 *pIOBuffer; unsigned int uIOBufferSize; struct FileHeader header; struct Directory *pRoot; char pContainerName[16]; unsigned int uCurrentIndexDir; unsigned int uLODDataSize; unsigned int uNumSubIndices; struct Directory *pSubIndices; unsigned int uOffsetToSubIndex; FILE *pOutputFileHandle; }; #pragma pack(pop) }; /* 6 */ #pragma pack(push, 1) struct LODWriteableFile: public LOD::File { bool LoadFile(const char *pFilename, bool bWriting); unsigned int Write(const LOD::Directory *pDir, const void *pDirData, int a4); void CloseWriteFile(); int CreateTempFile(); int Save(); bool _4621A7(); int _461492(LOD::FileHeader *pHeader, LOD::Directory *pDir, const char *Source); /*FILE *pFile; char pLODName[256]; unsigned int isFileOpened; unsigned __int8 *pIOBuffer; unsigned int uIOBufferSize; struct LOD::FileHeader header; struct LOD::Directory *pRoot; unsigned __int8 pContainerName[16]; unsigned int uCurrentIndexDir; unsigned int uLODDataSize; unsigned int uNumSubIndices; struct LOD::Directory *pSubIndices; unsigned int uOffsetToSubIndex; FILE *pOutputFileHandle;*/ }; #pragma pack(pop) #pragma pack(push, 1) struct LODFile_IconsBitmaps: public LOD::File { LODFile_IconsBitmaps(); virtual ~LODFile_IconsBitmaps(); int _40F9C5(); unsigned int FindTextureByName(const char *pName); bool LoadBitmaps(const char *pFilename); bool LoadIconsOrEvents(const char *pLODFilename); void ReleaseAll(); unsigned int LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT); Texture *LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT); int LoadTextureFromLOD(Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType); int ReloadTexture(Texture *pDst, const char *pContainer, int mode); void ReleaseHardwareTextures(); void ReleaseLostHardwareTextures(); void _410423_move_textures_to_device(); int _410522(Texture *pDst, const char *pContainer, unsigned int uTextureType); void SetupPalettes(unsigned int uTargetRBits, unsigned int uTargetGBits, unsigned int uTargetBBits); void ReleaseAll2(); void _4114F2(); void _4355F7(); /*FILE *pFile; unsigned __int8 pLODName[256]; unsigned int isFileOpened; unsigned __int8 *pIOBuffer; unsigned int uIOBufferSize; struct LOD::FileHeader header; struct LOD::Directory *pRoot; unsigned __int8 pContainerName[16]; unsigned int uCurrentIndexDir; unsigned int uLODDataSize; unsigned int uNumSubIndices; struct LOD::Directory *pSubIndices; unsigned int uOffsetToSubIndex; FILE *pOutputFileHandle;*/ struct Texture pTextures[1000]; unsigned int uNumLoadedFiles; int dword_11B80; int dword_11B84; int dword_11B88; int uTextureRedBits; int uTextureGreenBits; int uTextureBlueBits; int uNumPrevLoadedFiles; int uTexturePacksCount; int dword_011BA0; int dword_011BA4; int dword_011BA8; struct IDirectDrawSurface **pHardwareSurfaces; struct IDirect3DTexture2 **pHardwareTextures; char *ptr_011BB4; }; #pragma pack(pop) #pragma pack(push, 1) struct LODSprite { //----- (0046244C) -------------------------------------------------------- inline LODSprite() { uHeight = 0; uPaletteId = 0; word_1A = 0; pSpriteLines = nullptr; pDecompressedBytes = nullptr; } ~LODSprite(); void Release(); int _4ACC38(struct RenderBillboardTransform_local0 *a2, char a3); int _4AD2D1(struct RenderBillboardTransform_local0 *a2, int a3); char pName[12]; int uSpriteSize; __int16 uWidth; __int16 uHeight; __int16 uPaletteId; __int16 word_16; __int16 uTexturePitch; __int16 word_1A; int uDecompressedSize; struct LODSprite_stru0 *pSpriteLines; void *pDecompressedBytes; }; #pragma pack(pop) /* 15 */ #pragma pack(push, 1) struct LODFile_Sprites: public LOD::File { LODFile_Sprites(); virtual ~LODFile_Sprites(); void DeleteSomeSprites(); void DeleteSpritesRange(int uStartIndex, int uStopIndex); int _461397(); void DeleteSomeOtherSprites(); int LoadSpriteFromFile(LODSprite *pSpriteHeader, const char *pContainer); bool LoadSprites(const char *pFilename); int LoadSprite(const char *pContainerName, unsigned int uPaletteID); void ReleaseLostHardwareSprites(); void ReleaseAll(); void MoveSpritesToVideoMemory(); /*FILE *pFile; unsigned __int8 pLODName[256]; unsigned int isFileOpened; unsigned __int8 *pIOBuffer; unsigned int uIOBufferSize; struct LOD::FileHeader header; struct LOD::Directory *pRoot; unsigned __int8 pContainerName[16]; unsigned int uCurrentIndexDir; unsigned int uLODDataSize; unsigned int uNumSubIndices; struct LOD::Directory *pSubIndices; unsigned int uOffsetToSubIndex; FILE *pOutputFileHandle;*/ struct LODSprite pSpriteHeaders[1500]; unsigned int uNumLoadedSprites; int field_ECA0; int field_ECA4; int field_ECA8; int field_ECAC; struct Sprite *pHardwareSprites; int field_ECB4; }; #pragma pack(pop) /* 17 */ #pragma pack(push, 1) struct LODSprite_stru0 { int dword_0; void *ptr_4; }; #pragma pack(pop) extern LODFile_IconsBitmaps *pEvents_LOD; extern LODFile_IconsBitmaps *pIcons_LOD; extern LODFile_Sprites *pSprites_LOD; extern LODFile_IconsBitmaps *pBitmaps_LOD; extern LODWriteableFile *pNew_LOD; extern LODWriteableFile *pGames_LOD; extern int _6A0CA4_lod_binary_search; // weak extern int _6A0CA8_lod_unused; // weak