1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +02:00
vcmi/CDefHandler.h
Michał W. Urbańczyk d5d4a9f741 Obsługa defów. Częściowa.
Kompresja 0 - pełna, 1 i 3 - z błędami, 2 - brak
2007-07-01 02:43:03 +00:00

49 lines
2.7 KiB
C++

#ifndef CDEFH_H
#define CDEFH_H
//#include "CDefHandler.h"
//var
// Form1 {$IFDEF KOL_MCK} : PForm1 {$ELSE} : TForm1 {$ENDIF} ;
struct BMPPalette
{
unsigned char R,G,B,F;
};
class CDefHandler
{
public:
std::string defName, curDir;
int totalEntries, DEFType, totalBlocks, fullWidth, fullHeight;
unsigned char fbuffer[800];
// TempBmp: PBitmap;
bool allowRepaint;
int length;
unsigned char * FDef;
BMPPalette palette[256];
// FBmp, //Поток BMP (Memory)
// FTemp: PStream; //Временный поток (Memory)
// TempLongInt: LongInt; //Временная переменная
unsigned int * RWEntries;
int * RLEntries;
struct SEntry
{
std::string name;
int offset;
} ;
std::vector<SEntry> SEntries ;
char id[2];
struct BMPHeader
{
int fullSize, _h1, _h2, _h3, _c1, _c2, _c3, _c4, x, y,
dataSize1, dataSize2; //DataSize=X*Y+2*Y
unsigned char _c5[8];
} ;
void print (std::ostream & stream, int nr, int bytcon);
int readNormalNr (int pos, int bytCon, unsigned char * str=NULL, bool cyclic=false);
unsigned char * CDefHandler::writeNormalNr (int nr, int bytCon);
void getSprite (long SIndex); //zapisuje klastke o zadanym numerze do "testtt.bmp"
void openDef(std::string name);
void expand(unsigned char N,unsigned char & BL, unsigned char & BR);
};
#endif // CDEFH_H