diff --git a/CDefHandler.cpp b/CDefHandler.cpp new file mode 100644 index 000000000..d74bfde8e --- /dev/null +++ b/CDefHandler.cpp @@ -0,0 +1 @@ +#include "CDefHandler.h" \ No newline at end of file diff --git a/CDefHandler.h b/CDefHandler.h new file mode 100644 index 000000000..b37b95610 --- /dev/null +++ b/CDefHandler.h @@ -0,0 +1,10 @@ +#ifndef CDEFHANDLER_H +#define CDEFHANDLER_H + +class CDefHandler +{ + +}; + + +#endif //CDEFHANDLER_H \ No newline at end of file diff --git a/CLodHandler.cpp b/CLodHandler.cpp new file mode 100644 index 000000000..0ad37f525 --- /dev/null +++ b/CLodHandler.cpp @@ -0,0 +1,216 @@ +#include "CLodHandler.h" +#include "stdafx.h" + +int CLodHandler::decompress (unsigned char * source, int size, int realSize, std::ofstream & dest) +{ + std::ofstream lb; + lb.open("lodbuf\\buf.gz", std::ios::out|std::ios::binary); + for(int i=0; i=amp/2) + { + ret = ret-amp; + } + return ret; +} + +void CLodHandler::init(std::string lodFile) +{ + extract(lodFile); +} diff --git a/CLodHandler.h b/CLodHandler.h new file mode 100644 index 000000000..a0e182a96 --- /dev/null +++ b/CLodHandler.h @@ -0,0 +1,42 @@ +#ifndef CLODHANDLER_H +#define CLODHANDLER_H + +#include +#include +#include +#include +#include "zlib.h" + +namespace NLoadHandlerHelp +{ + const int dmHelp=0, dmNoExtractingMask=1; + //std::string P1,P2,CurDir; + const int fCHUNK = 50000; +}; + +struct Entry +{ + unsigned char name[12], //filename + hlam_1[4], // + hlam_2[4]; // + int offset, //from beginning + realSize, //size without compression + size; //and with +}; + +class CLodHandler +{ +public: + std::vector entries; + unsigned int totalFiles; + + int readNormalNr (unsigned char* bufor, int bytCon, bool cyclic=false); //lod header reading helper + int decompress (unsigned char * source, int size, int realSize, std::ofstream & dest); //main decompression function + int decompress (unsigned char * source, int size, int realSize, std::string & dest); //main decompression function + int infm(FILE *source, FILE *dest, int wBits = 15); //zlib handler + void extract(std::string FName); + void init(std::string lodFile); +}; + + +#endif //CLODHANDLER_H \ No newline at end of file diff --git a/CMT.cpp b/CMT.cpp index ff2477dd3..aee265a2f 100644 --- a/CMT.cpp +++ b/CMT.cpp @@ -25,6 +25,7 @@ #include "CGameInfo.h" #include "CMusicHandler.h" #include "CSemiLodHandler.h" +#include "CLodHandler.h" #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) # include # include @@ -262,6 +263,20 @@ int _tmain(int argc, _TCHAR* argv[]) CGameInfo * cgi = new CGameInfo; CGameInfo::mainObj = cgi; cgi->mush = mush; + + //////////////////////////////////////////////////////////////////////////////// lod testing + + //CLodHandler * clod = new CLodHandler; + //clod->loadLod("h3abp_bm.lod"); + + CLodHandler * test = new CLodHandler; + test->init(std::string("h3abp_bm.lod")); + + CLodHandler * bitmapLod = new CLodHandler; + test->init(std::string("newH3sprite.lod")); + + //////////////////////////////////////////////////////////////////////////////// lod testing end + cgi->sspriteh = new CSemiLodHandler(); cgi->sspriteh->openLod("H3sprite.lod"); CArtHandler * arth = new CArtHandler; @@ -286,8 +301,9 @@ int _tmain(int argc, _TCHAR* argv[]) objh->loadObjects(); cgi->objh = objh; std::string mapname; - if (CPG) mapname = CPG->ourScenSel->mapsel.ourMaps[CPG->ourScenSel->mapsel.selected].filename; - else mapname = "4gryf"; + //if (CPG) mapname = CPG->ourScenSel->mapsel.ourMaps[CPG->ourScenSel->mapsel.selected].filename; + //else mapname = "4gryf"; + mapname = "4gryf"; CAmbarCendamo * ac = new CAmbarCendamo(mapname.c_str()); //4gryf CMapHeader * mmhh = new CMapHeader(ac->bufor); //czytanie nagłówka cgi->ac = ac; diff --git a/CfLodHandler.h b/CfLodHandler.h deleted file mode 100644 index a8e2b5d2e..000000000 --- a/CfLodHandler.h +++ /dev/null @@ -1,101 +0,0 @@ -//TSearchRec -#include -#include -#include -const int dmHelp=0, dmNoExtractingMask=1; -std::string P1,P2,CurDir; -struct TSearchRec -{ -}sr; -struct Entry -{ - unsigned char name[12], //filename - hlam_1[4], // - hlam_2[4]; // - int offset, //from beginning - realSize, //size without compression - size; //and with -} ; -std::vector Entries; - -long TotalFiles; -int readNormalNr (unsigned char* bufor, int bytCon, bool cyclic=false) -{ - int ret=0; - int amp=1; - for (int i=0; i=amp/2) - { - ret = ret-amp; - } - return ret; -} -int Decompress (unsigned char * source, int size, int realSize, std::ofstream & dest); -void Extract(std::string FName) -{ - std::ifstream FLOD; - std::ofstream FOut; - long i; - - std::string Ts; - std::cout<<"*** Loading FAT ... \n"; - FLOD.open(FName.c_str(),std::ios::binary); - std::cout<<"*** Archive: "+FName+" loaded\n"; - FLOD.seekg(8,std::ios_base::beg); - unsigned char temp[4]; - FLOD.read((char*)temp,4); - TotalFiles = readNormalNr(temp,4); - FLOD.seekg(0x5c,std::ios_base::beg); - Entries.reserve(TotalFiles); - std::cout<<"*** Loading FAT ...\n"; - for (int i=0;i6) TotalFiles=6; - for (int i=0;i #include + +#define LOGUJ ; +#define CLOG ; + #ifndef LOGUJ #define LOGUJ(a) (std::cout< wezel * nodrze::usunRBT (wezel * nowy) }; template void nodrze::naprawWstaw (wezel * nowy) { - CLOG ("Naprawiam po wstawieniu"<ojciec->kolor==CZERWONY) { if (nowy->ojciec == nowy->ojciec->ojciec->lewy) // ojciec nowego lest lewy @@ -651,7 +656,7 @@ template void nodrze::naprawWstaw (wezel * nowy) } template void nodrze::dodajRBT (wezel * nowy) { - CLOG("Dodaje do drzewa "<zawart<zawart<zawart) < (*ostatnio->zawart)) { @@ -717,7 +722,7 @@ template bool nodrze::sprawdzW(wezel * w) } template void nodrze::rotacjaLewa (wezel * x) { - CLOG("Wykonuje lewą rotację na "<zawart<zawart< * y = x->prawy; x->prawy = y->lewy; // zamiana lewego poddrzewa y na prawe poddrzewo x if (y->lewy != NIL) y->lewy->ojciec = x; // i przypisanie ojcostwa temu poddrzewu @@ -733,7 +738,7 @@ template void nodrze::rotacjaLewa (wezel * x) }; template void nodrze::rotacjaPrawa (wezel * y) { - CLOG("Wykonuje prawa rotację na "<zawart<zawart< * x = y->lewy; y->lewy = x->prawy; // zamiana prawe poddrzewa x na lewe poddrzewo y if (x->prawy != NIL) x->prawy->ojciec = y; // i przypisanie ojcostwa temu poddrzewu