1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

More changes / project files.

This commit is contained in:
Michał W. Urbańczyk 2008-06-14 10:20:18 +00:00
parent 6ad729148e
commit 300d540663
14 changed files with 1437 additions and 158 deletions

View File

@ -41,7 +41,7 @@ int internalFunc(void * callback)
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"));
txth->init(std::string("Data\\H3bitmap.lod"),"Data");
std::cout<<"done.\nScanning .lod file\n";
int curp=0;
std::string pattern = ".TXT";

89
CMT.cpp
View File

@ -47,9 +47,6 @@
#include "CLua.h"
#include "CAdvmapInterface.h"
#include "CCastleInterface.h"
#include "boost/filesystem/operations.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
#include "client\Graphics.h"
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
# include <fcntl.h>
@ -333,9 +330,7 @@ int _tmain(int argc, _TCHAR* argv[])
//CBIKHandler cb;
//cb.open("CSECRET.BIK");
THC timeHandler tmh;
THC tmh.getDif();
timeHandler pomtime;pomtime.getDif();
THC timeHandler tmh, total, pomtime;
int xx=0, yy=0, zz=0;
srand ( time(NULL) );
std::vector<SDL_Surface*> Sprites;
@ -361,9 +356,7 @@ int _tmain(int argc, _TCHAR* argv[])
TTF_Init();
atexit(TTF_Quit);
atexit(SDL_Quit);
//TNRB = TTF_OpenFont("Fonts\\tnrb.ttf",16);
TNRB16 = TTF_OpenFont("Fonts\\tnrb.ttf",16);
//TNR = TTF_OpenFont("Fonts\\tnr.ttf",10);
GEOR13 = TTF_OpenFont("Fonts\\georgia.ttf",13);
GEOR16 = TTF_OpenFont("Fonts\\georgia.ttf",16);
GEORXX = TTF_OpenFont("Fonts\\tnrb.ttf",22);
@ -383,60 +376,35 @@ int _tmain(int argc, _TCHAR* argv[])
cgi->curh = new CCursorHandler;
THC std::cout<<"Initializing screen, fonts and sound handling: "<<tmh.getDif()<<std::endl;
CDefHandler::Spriteh = cgi->spriteh = new CLodHandler;
cgi->spriteh->init(std::string("Data\\H3sprite.lod"));
CDefHandler::Spriteh = cgi->spriteh = new CLodHandler();
cgi->spriteh->init("Data\\H3sprite.lod","Sprites");
BitmapHandler::bitmaph = cgi->bitmaph = new CLodHandler;
cgi->bitmaph->init(std::string("Data\\H3bitmap.lod"));
cgi->bitmaph->init("Data\\H3bitmap.lod","Data");
THC std::cout<<"Loading .lod files: "<<tmh.getDif()<<std::endl;
initDLL(cgi->bitmaph);
THC std::cout<<"Initializing VCMI_Lib: "<<tmh.getDif()<<std::endl;
graphics = new Graphics();
THC std::cout<<"Initializing game graphics: "<<tmh.getDif()<<std::endl;
boost::filesystem::directory_iterator enddir;
for (boost::filesystem::directory_iterator dir("Data");dir!=enddir;dir++)
{
if(boost::filesystem::is_regular(dir->status()))
{
std::string name = dir->path().leaf();
std::transform(name.begin(), name.end(), name.begin(), (int(*)(int))toupper);
boost::algorithm::replace_all(name,".BMP",".PCX");
Entry * e = cgi->bitmaph->entries.znajdz(name);
if(e)
{
e->offset = -1;
e->realSize = e->size = boost::filesystem::file_size(dir->path());
}
}
}
if(boost::filesystem::exists("Sprites"))
{
for (boost::filesystem::directory_iterator dir("Sprites");dir!=enddir;dir++)
{
if(boost::filesystem::is_regular(dir->status()))
{
std::string name = dir->path().leaf();
std::transform(name.begin(), name.end(), name.begin(), (int(*)(int))toupper);
boost::algorithm::replace_all(name,".BMP",".PCX");
Entry * e = cgi->spriteh->entries.znajdz(name);
if(e)
{
e->offset = -1;
e->realSize = e->size = boost::filesystem::file_size(dir->path());
}
}
}
}
else
std::cout<<"Warning: No sprites/ folder!"<<std::endl;
THC std::cout<<"Scanning Data/ and Sprites/ folders: "<<tmh.getDif()<<std::endl;
cgi->curh->initCursor();
cgi->curh->showGraphicCursor();
//cgi->curh->initCursor();
//cgi->curh->showGraphicCursor();
pomtime.getDif();
cgi->screenh = new CScreenHandler;
cgi->screenh->initScreen();
THC std::cout<<"\tScreen handler: "<<pomtime.getDif()<<std::endl;
cgi->townh = new CTownHandler;
cgi->townh->loadNames();
THC std::cout<<"\tTown handler: "<<pomtime.getDif()<<std::endl;
CAbilityHandler * abilh = new CAbilityHandler;
abilh->loadAbilities();
cgi->abilh = abilh;
THC std::cout<<"\tAbility handler: "<<pomtime.getDif()<<std::endl;
CHeroHandler * heroh = new CHeroHandler;
heroh->loadHeroes();
heroh->loadPortraits();
cgi->heroh = heroh;
THC std::cout<<"\tHero handler: "<<pomtime.getDif()<<std::endl;
THC std::cout<<"Preparing first handlers: "<<tmh.getDif()<<std::endl;
graphics = new Graphics();
THC std::cout<<"Initializing game graphics: "<<tmh.getDif()<<std::endl;
//colors initialization
SDL_Color p;
@ -475,24 +443,15 @@ int _tmain(int argc, _TCHAR* argv[])
//palette initialized
THC std::cout<<"Preparing players' colours: "<<tmh.getDif()<<std::endl;
CMessage::init();
cgi->townh = new CTownHandler;
cgi->townh->loadNames();
CAbilityHandler * abilh = new CAbilityHandler;
abilh->loadAbilities();
cgi->abilh = abilh;
CHeroHandler * heroh = new CHeroHandler;
heroh->loadHeroes();
heroh->loadPortraits();
cgi->heroh = heroh;
cgi->generaltexth = new CGeneralTextHandler;
cgi->generaltexth->load();
THC std::cout<<"Preparing more handlers: "<<tmh.getDif()<<std::endl;
CPreGame * cpg = new CPreGame(); //main menu and submenus
THC std::cout<<"Initialization CPreGame (together): "<<tmh.getDif()<<std::endl;
THC std::cout<<"Initialization of VCMI (togeter): "<<total.getDif()<<std::endl;
cpg->mush = mush;
cgi->scenarioOps = cpg->runLoop();
THC tmh.getDif();
THC tmh.getDif();pomtime.getDif();
CArtHandler * arth = new CArtHandler;
arth->loadArtifacts();
cgi->arth = arth;

Binary file not shown.

View File

@ -157,6 +157,92 @@ Graphics::Graphics()
smallIcons = CDefHandler::giveDef("ITPA.DEF");
resources32 = CDefHandler::giveDef("RESOURCE.DEF");
loadHeroFlags();
//std::stringstream nm;
//nm<<"AH";
//nm<<std::setw(2);
//nm<<std::setfill('0');
//nm<<heroClasses.size();
//nm<<"_.DEF";
//hc->moveAnim = CDefHandler::giveDef(nm.str());
//for(int o=0; o<hc->moveAnim->ourImages.size(); ++o)
//{
// if(hc->moveAnim->ourImages[o].groupNumber==6)
// {
// for(int e=0; e<8; ++e)
// {
// Cimage nci;
// nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o+e].bitmap);
// nci.groupNumber = 10;
// nci.imName = std::string();
// hc->moveAnim->ourImages.push_back(nci);
// }
// o+=8;
// }
// if(hc->moveAnim->ourImages[o].groupNumber==7)
// {
// for(int e=0; e<8; ++e)
// {
// Cimage nci;
// nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o+e].bitmap);
// nci.groupNumber = 11;
// nci.imName = std::string();
// hc->moveAnim->ourImages.push_back(nci);
// }
// o+=8;
// }
// if(hc->moveAnim->ourImages[o].groupNumber==8)
// {
// for(int e=0; e<8; ++e)
// {
// Cimage nci;
// nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o+e].bitmap);
// nci.groupNumber = 12;
// nci.imName = std::string();
// hc->moveAnim->ourImages.push_back(nci);
// }
// o+=8;
// }
//}
//for(int o=0; o<hc->moveAnim->ourImages.size(); ++o)
//{
// if(hc->moveAnim->ourImages[o].groupNumber==1)
// {
// Cimage nci;
// nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o].bitmap);
// nci.groupNumber = 13;
// nci.imName = std::string();
// hc->moveAnim->ourImages.push_back(nci);
// //o+=1;
// }
// if(hc->moveAnim->ourImages[o].groupNumber==2)
// {
// Cimage nci;
// nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o].bitmap);
// nci.groupNumber = 14;
// nci.imName = std::string();
// hc->moveAnim->ourImages.push_back(nci);
// //o+=1;
// }
// if(hc->moveAnim->ourImages[o].groupNumber==3)
// {
// Cimage nci;
// nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o].bitmap);
// nci.groupNumber = 15;
// nci.imName = std::string();
// hc->moveAnim->ourImages.push_back(nci);
// //o+=1;
// }
//}
//for(int ff=0; ff<hc->moveAnim->ourImages.size(); ++ff)
//{
// CSDL_Ext::alphaTransform(hc->moveAnim->ourImages[ff].bitmap);
//}
//hc->moveAnim->alphaTransformed = true;
}
void Graphics::loadHeroFlags()
{

715
client/VCMI_client.vcproj Normal file
View File

@ -0,0 +1,715 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="VCMI_client"
ProjectGUID="{8355EBA8-65C2-44A4-BC2D-78053E1BF2D6}"
RootNamespace="VCMI_client"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="1"
DebugInformationFormat="4"
DisableSpecificWarnings="4251"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib lua5.1.lib VCMI_lib.lib"
ShowProgress="0"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
StringPooling="true"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
EnableFunctionLevelLinking="false"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib lua5.1.lib VCMI_lib.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Optibug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib SDL_mixer.lib lua5.1.lib VCMI_lib.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\AdventureMapButton.cpp"
>
</File>
<File
RelativePath="..\hch\CAbilityHandler.cpp"
>
</File>
<File
RelativePath="..\CAdvmapInterface.cpp"
>
</File>
<File
RelativePath="..\hch\CAmbarCendamo.cpp"
>
</File>
<File
RelativePath="..\CBattleInterface.cpp"
>
</File>
<File
RelativePath=".\CBitmapHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CBuildingHandler.cpp"
>
</File>
<File
RelativePath="..\CCallback.cpp"
>
</File>
<File
RelativePath="..\CCastleInterface.cpp"
>
</File>
<File
RelativePath="..\CConsoleHandler.cpp"
>
</File>
<File
RelativePath=".\CCreatureAnimation.cpp"
>
</File>
<File
RelativePath="..\CCursorHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CDefHandler.cpp"
>
</File>
<File
RelativePath="..\CGameInfo.cpp"
>
</File>
<File
RelativePath="..\CGameInterface.cpp"
>
</File>
<File
RelativePath="..\CGameState.cpp"
>
</File>
<File
RelativePath="..\hch\CGeneralTextHandler.cpp"
>
</File>
<File
RelativePath="..\CHeroWindow.cpp"
>
</File>
<File
RelativePath="..\CLua.cpp"
>
</File>
<File
RelativePath="..\CLuaHandler.cpp"
>
</File>
<File
RelativePath="..\CMessage.cpp"
>
</File>
<File
RelativePath="..\CMT.cpp"
>
</File>
<File
RelativePath="..\hch\CMusicHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CObjectHandler.cpp"
>
</File>
<File
RelativePath="..\CPathfinder.cpp"
>
</File>
<File
RelativePath="..\CPlayerInterface.cpp"
>
</File>
<File
RelativePath="..\CPreGame.cpp"
>
</File>
<File
RelativePath="..\hch\CPreGameTextHandler.cpp"
>
</File>
<File
RelativePath="..\CScreenHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CSndHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CSpellHandler.cpp"
>
</File>
<File
RelativePath=".\Graphics.cpp"
>
</File>
<File
RelativePath="..\map.cpp"
>
</File>
<File
RelativePath="..\mapHandler.cpp"
>
</File>
<File
RelativePath="..\SDL_Extensions.cpp"
>
</File>
<File
RelativePath="..\SDL_framerate.cpp"
>
</File>
<File
RelativePath="..\SDL_rotozoom.cpp"
>
</File>
<Filter
Name="lua"
>
<File
RelativePath="..\..\..\trunk\lua\src\lapi.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lauxlib.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lbaselib.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lcode.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\ldblib.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\ldebug.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\ldo.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\ldump.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lfunc.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lgc.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\linit.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\liolib.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\llex.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lmathlib.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lmem.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\loadlib.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lobject.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lopcodes.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\loslib.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lparser.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lstate.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lstring.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lstrlib.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\ltable.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\ltablib.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\ltm.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lua.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\luac.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lundump.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lvm.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\lzio.cpp"
>
</File>
<File
RelativePath="..\..\..\trunk\lua\src\print.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\AdventureMapButton.h"
>
</File>
<File
RelativePath="..\AI_Base.h"
>
</File>
<File
RelativePath="..\hch\CAbilityHandler.h"
>
</File>
<File
RelativePath="..\CAdvmapInterface.h"
>
</File>
<File
RelativePath="..\hch\CAmbarCendamo.h"
>
</File>
<File
RelativePath="..\CBattleInterface.h"
>
</File>
<File
RelativePath=".\CBitmapHandler.h"
>
</File>
<File
RelativePath="..\hch\CBuildingHandler.h"
>
</File>
<File
RelativePath="..\CCallback.h"
>
</File>
<File
RelativePath="..\CCastleInterface.h"
>
</File>
<File
RelativePath="..\CConsoleHandler.h"
>
</File>
<File
RelativePath=".\CCreatureAnimation.h"
>
</File>
<File
RelativePath="..\CCursorHandler.h"
>
</File>
<File
RelativePath="..\hch\CDefHandler.h"
>
</File>
<File
RelativePath="..\CGameInfo.h"
>
</File>
<File
RelativePath="..\CGameInterface.h"
>
</File>
<File
RelativePath="..\CGameState.h"
>
</File>
<File
RelativePath="..\hch\CGeneralTextHandler.h"
>
</File>
<File
RelativePath="..\CHeroWindow.h"
>
</File>
<File
RelativePath="..\CLua.h"
>
</File>
<File
RelativePath="..\CLuaHandler.h"
>
</File>
<File
RelativePath="..\CMessage.h"
>
</File>
<File
RelativePath="..\hch\CMusicHandler.h"
>
</File>
<File
RelativePath="..\CPathfinder.h"
>
</File>
<File
RelativePath="..\CPlayerInterface.h"
>
</File>
<File
RelativePath="..\CPreGame.h"
>
</File>
<File
RelativePath="..\hch\CPreGameTextHandler.h"
>
</File>
<File
RelativePath="..\CScreenHandler.h"
>
</File>
<File
RelativePath="..\hch\CSndHandler.h"
>
</File>
<File
RelativePath="..\hch\CSpellHandler.h"
>
</File>
<File
RelativePath="..\global.h"
>
</File>
<File
RelativePath=".\Graphics.h"
>
</File>
<File
RelativePath="..\int3.h"
>
</File>
<File
RelativePath="..\map.h"
>
</File>
<File
RelativePath="..\mapHandler.h"
>
</File>
<File
RelativePath="..\nodrze.h"
>
</File>
<File
RelativePath="..\SDL_framerate.h"
>
</File>
<File
RelativePath="..\SDL_rotozoom.h"
>
</File>
<File
RelativePath="..\StartInfo.h"
>
</File>
<File
RelativePath="..\stdafx.h"
>
</File>
<File
RelativePath="..\timeHandler.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -3,10 +3,8 @@
#include "../CGameInfo.h"
#include "CObjectHandler.h"
#include "CDefObjInfoHandler.h"
#include "../SDL_Extensions.h"
#include "../CGameState.h"
#include "SDL.h"
#include "CDefHandler.h"
#include "CCreatureHandler.h"
#include <set>
#include <iomanip>

View File

@ -1,10 +1,8 @@
#define VCMI_DLL
#include "../stdafx.h"
#include "CHeroHandler.h"
#include <sstream>
#include "CLodHandler.h"
#include <cmath>
#include <iomanip>
#include "CDefHandler.h"
extern CLodHandler * bitmaph;
void loadToIt(std::string &dest, std::string &src, int &iter, int mode);
CHeroHandler::~CHeroHandler()
@ -259,89 +257,6 @@ void CHeroHandler::loadHeroClasses()
++i;
}
++i;
std::stringstream nm;
nm<<"AH";
nm<<std::setw(2);
nm<<std::setfill('0');
nm<<heroClasses.size();
nm<<"_.DEF";
hc->moveAnim = CDefHandler::giveDef(nm.str());
for(int o=0; o<hc->moveAnim->ourImages.size(); ++o)
{
if(hc->moveAnim->ourImages[o].groupNumber==6)
{
for(int e=0; e<8; ++e)
{
Cimage nci;
nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o+e].bitmap);
nci.groupNumber = 10;
nci.imName = std::string();
hc->moveAnim->ourImages.push_back(nci);
}
o+=8;
}
if(hc->moveAnim->ourImages[o].groupNumber==7)
{
for(int e=0; e<8; ++e)
{
Cimage nci;
nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o+e].bitmap);
nci.groupNumber = 11;
nci.imName = std::string();
hc->moveAnim->ourImages.push_back(nci);
}
o+=8;
}
if(hc->moveAnim->ourImages[o].groupNumber==8)
{
for(int e=0; e<8; ++e)
{
Cimage nci;
nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o+e].bitmap);
nci.groupNumber = 12;
nci.imName = std::string();
hc->moveAnim->ourImages.push_back(nci);
}
o+=8;
}
}
for(int o=0; o<hc->moveAnim->ourImages.size(); ++o)
{
if(hc->moveAnim->ourImages[o].groupNumber==1)
{
Cimage nci;
nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o].bitmap);
nci.groupNumber = 13;
nci.imName = std::string();
hc->moveAnim->ourImages.push_back(nci);
//o+=1;
}
if(hc->moveAnim->ourImages[o].groupNumber==2)
{
Cimage nci;
nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o].bitmap);
nci.groupNumber = 14;
nci.imName = std::string();
hc->moveAnim->ourImages.push_back(nci);
//o+=1;
}
if(hc->moveAnim->ourImages[o].groupNumber==3)
{
Cimage nci;
nci.bitmap = CSDL_Ext::rotate01(hc->moveAnim->ourImages[o].bitmap);
nci.groupNumber = 15;
nci.imName = std::string();
hc->moveAnim->ourImages.push_back(nci);
//o+=1;
}
}
for(int ff=0; ff<hc->moveAnim->ourImages.size(); ++ff)
{
CSDL_Ext::alphaTransform(hc->moveAnim->ourImages[ff].bitmap);
}
hc->moveAnim->alphaTransformed = true;
heroClasses.push_back(hc);
}
}

View File

@ -36,7 +36,7 @@ public:
CDefHandler * moveAnim; //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
};
class CHeroHandler
class DLL_EXPORT CHeroHandler
{
public:
std::vector<CHero*> heroes; //by³o nodrze

View File

@ -6,6 +6,9 @@
#include <algorithm>
#include <cctype>
#include <cstring>
#include "boost/filesystem/operations.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
DLL_EXPORT int readNormalNr (int pos, int bytCon, unsigned char * str)
{
int ret=0;
@ -335,7 +338,7 @@ int CLodHandler::readNormalNr (unsigned char* bufor, int bytCon, bool cyclic)
return ret;
}
void CLodHandler::init(std::string lodFile)
void CLodHandler::init(std::string lodFile, std::string dirName)
{
std::string Ts;
FLOD = fopen(lodFile.c_str(), "rb");
@ -380,6 +383,27 @@ void CLodHandler::init(std::string lodFile)
}
entries.push_back(entry);
}
boost::filesystem::directory_iterator enddir;
if(boost::filesystem::exists(dirName))
{
for (boost::filesystem::directory_iterator dir(dirName);dir!=enddir;dir++)
{
if(boost::filesystem::is_regular(dir->status()))
{
std::string name = dir->path().leaf();
std::transform(name.begin(), name.end(), name.begin(), (int(*)(int))toupper);
boost::algorithm::replace_all(name,".BMP",".PCX");
Entry * e = entries.znajdz(name);
if(e)
{
e->offset = -1;
e->realSize = e->size = boost::filesystem::file_size(dir->path());
}
}
}
}
else
std::cout<<"Warning: No "+dirName+"/ folder!"<<std::endl;
}
std::string CLodHandler::getTextFile(std::string name)
{

View File

@ -52,7 +52,7 @@ public:
std::string getTextFile(std::string name); //extracts one file
void extract(std::string FName);
void extractFile(std::string FName, std::string name); //extracts a specific file
void init(std::string lodFile);
void init(std::string lodFile, std::string dirName);
};
#endif //CLODHANDLER_H

120
lib/VCMI_Lib.cpp Normal file
View File

@ -0,0 +1,120 @@
#define VCMI_DLL
#include "../global.h"
#include "VCMI_Lib.h"
class CLodHandler;
LibClasses * VLC = NULL;
CLodHandler * bitmaph=NULL;
DLL_EXPORT void initDLL(CLodHandler *b)
{
bitmaph=b;
VLC = new LibClasses;
}
DLL_EXPORT void loadToIt(std::string &dest, std::string &src, int &iter, int mode)
{
switch(mode)
{
case 0:
{
int hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
++hmcr;
if(hmcr==1)
break;
}
++iter;
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
break;
}
dest = src.substr(befi, iter-befi);
++iter;
hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
++hmcr;
if(hmcr==1)
break;
}
iter+=2;
break;
}
case 1:
{
int hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
++hmcr;
if(hmcr==1)
break;
}
++iter;
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
break;
}
dest = src.substr(befi, iter-befi);
iter+=2;
break;
}
case 2:
{
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
break;
}
dest = src.substr(befi, iter-befi);
++iter;
int hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
++hmcr;
if(hmcr==1)
break;
}
iter+=2;
break;
}
case 3:
{
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
break;
}
dest = src.substr(befi, iter-befi);
iter+=2;
break;
}
case 4:
{
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
break;
}
dest = src.substr(befi, iter-befi);
iter++;
break;
}
}
}

58
lib/VCMI_Lib.h Normal file
View File

@ -0,0 +1,58 @@
#include "../global.h"
//class CMapHandler;
//class CArtHandler;
//class CHeroHandler;
class CCreatureHandler;
//class CAbilityHandler;
//class CSpellHandler;
//class CAmbarCendamo;
//class CPreGameTextHandler;
//class CBuildingHandler;
//class CObjectHandler;
//class CMusicHandler;
//class CSemiLodHandler;
class CDefObjInfoHandler;
//class CTownHandler;
//class CGeneralTextHandler;
//class CConsoleHandler;
//class CPathfinder;
//class CCursorHandler;
//class CScreenHandler;
//class CGameState;
//class CMapHandler;
//class CGameInterface;
//class CPreGame;
//class CDefHandler;
class LibClasses
{
public:
//CGameState * state;
//CArtHandler * arth;
//CHeroHandler * heroh;
CCreatureHandler * creh;
//CAbilityHandler * abilh;
//CSpellHandler * spellh;
//CMapHandler * mh;
//CPreGameTextHandler * preth;
//CBuildingHandler * buildh;
//CObjectHandler * objh;
//CMusicHandler * mush;
//CSemiLodHandler * sspriteh;
CDefObjInfoHandler * dobjinfo;
//CTownHandler * townh;
//CGeneralTextHandler * generaltexth;
//CConsoleHandler * consoleh;
//CPathfinder * pathf;
//CCursorHandler * curh;
//CScreenHandler * screenh;
//int localPlayer;
//std::vector<CGameInterface *> playerint;
//std::vector<SDL_Color> playerColors;
//SDL_Color neutralColor;
//StartInfo scenarioOps;
};
extern LibClasses * VLC;

404
lib/VCMI_lib.vcproj Normal file
View File

@ -0,0 +1,404 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="VCMI_lib"
ProjectGUID="{B952FFC5-3039-4DE1-9F08-90ACDA483D8F}"
RootNamespace="VCMI_lib"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="2"
DebugInformationFormat="4"
DisableSpecificWarnings="4251"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
StringPooling="true"
MinimalRebuild="false"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
EnableFunctionLevelLinking="false"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="zdll.lib"
Version=""
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Optibug_dll|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
StringPooling="true"
MinimalRebuild="false"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib"
Version="0.7"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debugop|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="G:\vcmt\repa\include"
MinimalRebuild="true"
BasicRuntimeChecks="0"
RuntimeLibrary="0"
WarningLevel="2"
SuppressStartupBanner="true"
DebugInformationFormat="0"
DisableSpecificWarnings="4251"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib zdll.lib SDL_image.lib SDL_ttf.lib"
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\hch\CArtHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CCreatureHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CDefObjInfoHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CHeroHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CLodHandler.cpp"
>
</File>
<File
RelativePath="..\hch\CTownHandler.cpp"
>
</File>
<File
RelativePath="..\stdafx.cpp"
>
</File>
<File
RelativePath=".\VCMI_Lib.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\hch\CCreatureHandler.h"
>
</File>
<File
RelativePath="..\hch\CDefObjInfoHandler.h"
>
</File>
<File
RelativePath="..\hch\CHeroHandler.h"
>
</File>
<File
RelativePath="..\hch\CLodHandler.h"
>
</File>
<File
RelativePath="..\hch\CTownHandler.h"
>
</File>
<File
RelativePath=".\VCMI_Lib.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -6,7 +6,7 @@ class timeHandler
{
public:
clock_t start, last, mem;
timeHandler():start(clock()){last=0;mem=0;};
timeHandler():start(clock()){last=clock();mem=0;};
long getDif(){long ret=clock()-last;last=clock();return ret;};
void update(){last=clock();};
void remember(){mem=clock();};