mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +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:
@ -13,6 +13,9 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "SDL_Extensions.h"
|
#include "SDL_Extensions.h"
|
||||||
#include "hch/CHeroHandler.h"
|
#include "hch/CHeroHandler.h"
|
||||||
|
#include "hch/CLodHandler.h"
|
||||||
|
#include "boost/filesystem/operations.hpp"
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
int internalFunc(void * callback)
|
int internalFunc(void * callback)
|
||||||
{
|
{
|
||||||
CCallback * cb = (CCallback*)callback;
|
CCallback * cb = (CCallback*)callback;
|
||||||
@ -33,6 +36,31 @@ int internalFunc(void * callback)
|
|||||||
|
|
||||||
if(pom==std::string("die, fool"))
|
if(pom==std::string("die, fool"))
|
||||||
exit(0);
|
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())
|
switch (*cn.c_str())
|
||||||
{
|
{
|
||||||
|
24
CMT.cpp
24
CMT.cpp
@ -62,7 +62,7 @@
|
|||||||
CGameInfo* CGI;
|
CGameInfo* CGI;
|
||||||
#endif
|
#endif
|
||||||
#define CHUNK 16384
|
#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
|
SDL_Color playerColorPalette[256]; //palette to make interface colors good
|
||||||
|
|
||||||
@ -757,32 +757,46 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||||||
cgi->scenarioOps = cpg->runLoop();
|
cgi->scenarioOps = cpg->runLoop();
|
||||||
THC tmh.getDif();
|
THC tmh.getDif();
|
||||||
|
|
||||||
cgi->sspriteh = new CSemiLodHandler();
|
timeHandler pomtime;pomtime.getDif();
|
||||||
cgi->sspriteh->openLod("H3sprite.lod");
|
|
||||||
CArtHandler * arth = new CArtHandler;
|
CArtHandler * arth = new CArtHandler;
|
||||||
arth->loadArtifacts();
|
arth->loadArtifacts();
|
||||||
cgi->arth = arth;
|
cgi->arth = arth;
|
||||||
|
THC std::cout<<"\tArtifact handler: "<<pomtime.getDif()<<std::endl;
|
||||||
|
|
||||||
CCreatureHandler * creh = new CCreatureHandler;
|
CCreatureHandler * creh = new CCreatureHandler;
|
||||||
creh->loadCreatures();
|
creh->loadCreatures();
|
||||||
cgi->creh = creh;
|
cgi->creh = creh;
|
||||||
|
THC std::cout<<"\tCreature handler: "<<pomtime.getDif()<<std::endl;
|
||||||
|
|
||||||
CSpellHandler * spellh = new CSpellHandler;
|
CSpellHandler * spellh = new CSpellHandler;
|
||||||
spellh->loadSpells();
|
spellh->loadSpells();
|
||||||
cgi->spellh = spellh;
|
cgi->spellh = spellh;
|
||||||
|
THC std::cout<<"\tSpell handler: "<<pomtime.getDif()<<std::endl;
|
||||||
|
|
||||||
CBuildingHandler * buildh = new CBuildingHandler;
|
CBuildingHandler * buildh = new CBuildingHandler;
|
||||||
buildh->loadBuildings();
|
buildh->loadBuildings();
|
||||||
cgi->buildh = buildh;
|
cgi->buildh = buildh;
|
||||||
|
THC std::cout<<"\tBuilding handler: "<<pomtime.getDif()<<std::endl;
|
||||||
|
|
||||||
CObjectHandler * objh = new CObjectHandler;
|
CObjectHandler * objh = new CObjectHandler;
|
||||||
objh->loadObjects();
|
objh->loadObjects();
|
||||||
cgi->objh = objh;
|
cgi->objh = objh;
|
||||||
|
THC std::cout<<"\tObject handler: "<<pomtime.getDif()<<std::endl;
|
||||||
|
|
||||||
cgi->dobjinfo = new CDefObjInfoHandler;
|
cgi->dobjinfo = new CDefObjInfoHandler;
|
||||||
cgi->dobjinfo->load();
|
cgi->dobjinfo->load();
|
||||||
|
THC std::cout<<"\tDef information handler: "<<pomtime.getDif()<<std::endl;
|
||||||
|
|
||||||
cgi->state = new CGameState();
|
cgi->state = new CGameState();
|
||||||
cgi->state->players = std::map<int, PlayerState>();
|
cgi->state->players = std::map<int, PlayerState>();
|
||||||
|
THC std::cout<<"\tGamestate: "<<pomtime.getDif()<<std::endl;
|
||||||
|
|
||||||
cgi->pathf = new CPathfinder();
|
cgi->pathf = new CPathfinder();
|
||||||
|
THC std::cout<<"\tPathfinder: "<<pomtime.getDif()<<std::endl;
|
||||||
cgi->consoleh->cb = new CCallback(cgi->state,-1);
|
cgi->consoleh->cb = new CCallback(cgi->state,-1);
|
||||||
cgi->consoleh->runConsole();
|
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;
|
std::string mapname;
|
||||||
//if(CPG->ourScenSel->mapsel.selected==0)
|
//if(CPG->ourScenSel->mapsel.selected==0)
|
||||||
|
@ -687,7 +687,7 @@ void CLodHandler::extractFile(std::string FName, std::string name)
|
|||||||
if(buf1!=name)
|
if(buf1!=name)
|
||||||
continue;
|
continue;
|
||||||
fseek(FLOD, entries[i].offset, 0);
|
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;
|
unsigned char * outp;
|
||||||
if (entries[i].size==0) //file is not compressed
|
if (entries[i].size==0) //file is not compressed
|
||||||
{
|
{
|
||||||
@ -725,7 +725,6 @@ void CLodHandler::extractFile(std::string FName, std::string name)
|
|||||||
}
|
}
|
||||||
delete[] outp;
|
delete[] outp;
|
||||||
}
|
}
|
||||||
fclose(FLOD);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLodHandler::readNormalNr (unsigned char* bufor, int bytCon, bool cyclic)
|
int CLodHandler::readNormalNr (unsigned char* bufor, int bytCon, bool cyclic)
|
||||||
|
2
stdafx.h
2
stdafx.h
@ -6,7 +6,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
Reference in New Issue
Block a user