mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-24 03:47:18 +02:00
* new command - "get txt" - VCMI will extract all .txt files from h3bitmap.lod to the Extracted_txts/ folder.
* more detailed logs * version changed to 0.55
This commit is contained in:
parent
33fd0d22a6
commit
1e7f8984e2
@ -13,6 +13,9 @@
|
||||
#include <sstream>
|
||||
#include "SDL_Extensions.h"
|
||||
#include "hch/CHeroHandler.h"
|
||||
#include "hch/CLodHandler.h"
|
||||
#include "boost/filesystem/operations.hpp"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
int internalFunc(void * callback)
|
||||
{
|
||||
CCallback * cb = (CCallback*)callback;
|
||||
@ -33,6 +36,31 @@ int internalFunc(void * callback)
|
||||
|
||||
if(pom==std::string("die, fool"))
|
||||
exit(0);
|
||||
else if(pom==std::string("get txt"))
|
||||
{
|
||||
boost::filesystem::create_directory("Extracted_txts");
|
||||
std::cout<<"Command accepted. Opening .lod file...\t";
|
||||
CLodHandler * txth = new CLodHandler;
|
||||
txth->init(std::string("Data\\H3bitmap.lod"));
|
||||
std::cout<<"done.\nScanning .lod file\n";
|
||||
int curp=0;
|
||||
std::string pattern = ".TXT";
|
||||
for(int i=0;i<txth->entries.size(); i++)
|
||||
{
|
||||
std::string pom = txth->entries[i].nameStr;
|
||||
if(boost::algorithm::find_last(pom,pattern))
|
||||
{
|
||||
txth->extractFile(std::string("Extracted_txts\\")+pom,pom);
|
||||
}
|
||||
int p2 = ((float)i/(float)txth->entries.size())*(float)100;
|
||||
if(p2!=curp)
|
||||
{
|
||||
curp = p2;
|
||||
std::cout<<"\r"<<curp<<"%";
|
||||
}
|
||||
}
|
||||
std::cout<<"\rExtracting done :)\n";
|
||||
}
|
||||
|
||||
switch (*cn.c_str())
|
||||
{
|
||||
|
24
CMT.cpp
24
CMT.cpp
@ -62,7 +62,7 @@
|
||||
CGameInfo* CGI;
|
||||
#endif
|
||||
#define CHUNK 16384
|
||||
const char * NAME = "VCMI 0.54 \"Tirion\" Techdemo";
|
||||
const char * NAME = "VCMI 0.55 \"Tirion\" Techdemo";
|
||||
|
||||
SDL_Color playerColorPalette[256]; //palette to make interface colors good
|
||||
|
||||
@ -757,32 +757,46 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
cgi->scenarioOps = cpg->runLoop();
|
||||
THC tmh.getDif();
|
||||
|
||||
cgi->sspriteh = new CSemiLodHandler();
|
||||
cgi->sspriteh->openLod("H3sprite.lod");
|
||||
timeHandler pomtime;pomtime.getDif();
|
||||
CArtHandler * arth = new CArtHandler;
|
||||
arth->loadArtifacts();
|
||||
cgi->arth = arth;
|
||||
THC std::cout<<"\tArtifact handler: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
CCreatureHandler * creh = new CCreatureHandler;
|
||||
creh->loadCreatures();
|
||||
cgi->creh = creh;
|
||||
THC std::cout<<"\tCreature handler: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
CSpellHandler * spellh = new CSpellHandler;
|
||||
spellh->loadSpells();
|
||||
cgi->spellh = spellh;
|
||||
cgi->spellh = spellh;
|
||||
THC std::cout<<"\tSpell handler: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
CBuildingHandler * buildh = new CBuildingHandler;
|
||||
buildh->loadBuildings();
|
||||
cgi->buildh = buildh;
|
||||
THC std::cout<<"\tBuilding handler: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
CObjectHandler * objh = new CObjectHandler;
|
||||
objh->loadObjects();
|
||||
cgi->objh = objh;
|
||||
THC std::cout<<"\tObject handler: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
cgi->dobjinfo = new CDefObjInfoHandler;
|
||||
cgi->dobjinfo->load();
|
||||
THC std::cout<<"\tDef information handler: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
cgi->state = new CGameState();
|
||||
cgi->state->players = std::map<int, PlayerState>();
|
||||
THC std::cout<<"\tGamestate: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
cgi->pathf = new CPathfinder();
|
||||
THC std::cout<<"\tPathfinder: "<<pomtime.getDif()<<std::endl;
|
||||
cgi->consoleh->cb = new CCallback(cgi->state,-1);
|
||||
cgi->consoleh->runConsole();
|
||||
THC std::cout<<"Handlers initailization: "<<tmh.getDif()<<std::endl;
|
||||
THC std::cout<<"\tCallback and console: "<<pomtime.getDif()<<std::endl;
|
||||
THC std::cout<<"Handlers initailization (together): "<<tmh.getDif()<<std::endl;
|
||||
|
||||
std::string mapname;
|
||||
//if(CPG->ourScenSel->mapsel.selected==0)
|
||||
|
@ -687,7 +687,7 @@ void CLodHandler::extractFile(std::string FName, std::string name)
|
||||
if(buf1!=name)
|
||||
continue;
|
||||
fseek(FLOD, entries[i].offset, 0);
|
||||
std::string bufff = (FName.substr(0, FName.size()-4) + "\\" + (char*)entries[i].name);
|
||||
std::string bufff = (FName);
|
||||
unsigned char * outp;
|
||||
if (entries[i].size==0) //file is not compressed
|
||||
{
|
||||
@ -725,7 +725,6 @@ void CLodHandler::extractFile(std::string FName, std::string name)
|
||||
}
|
||||
delete[] outp;
|
||||
}
|
||||
fclose(FLOD);
|
||||
}
|
||||
|
||||
int CLodHandler::readNormalNr (unsigned char* bufor, int bytCon, bool cyclic)
|
||||
|
Loading…
x
Reference in New Issue
Block a user