mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
* better support for non-800x600 resolutions
* Merged CPreGameTextHandler into CGeneralTextHandler and moved to VCMI_Lib.dll (update your project files) * Genius AI will be used as a default AI * more code for save/load
This commit is contained in:
parent
aeb1f6d012
commit
c4bcf7b880
@ -118,7 +118,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
Optimization="3"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories=""D:\!GameDevelopment\VCMI\libs\include";G:\vcmt\repa\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;GENIUS_EXPORTS"
|
||||
@ -140,9 +140,9 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="VCMI_lib.lib"
|
||||
OutputFile="D:\Gry\heroes3\AI\genius.dll"
|
||||
OutputFile="../GeniusAI.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="C:\boost\boost_1_36_0\lib;"D:\!GameDevelopment\VCMI\svn\trunk";"D:\!GameDevelopment\VCMI\libs\lib";G:\vcmt\repa\libs"
|
||||
AdditionalLibraryDirectories="G:\vcmt\repa\libs"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "hch/CDefHandler.h"
|
||||
#include "CGameInfo.h"
|
||||
#include "hch/CLodHandler.h"
|
||||
#include "hch/CPreGameTextHandler.h"
|
||||
#include "hch/CGeneralTextHandler.h"
|
||||
#include "hch/CTownHandler.h"
|
||||
#include "CCallback.h"
|
||||
#include "client/CConfigHandler.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "hch/CGeneralTextHandler.h"
|
||||
#include "hch/CHeroHandler.h"
|
||||
#include "hch/CObjectHandler.h"
|
||||
#include "hch/CPreGameTextHandler.h"
|
||||
#include "hch/CTownHandler.h"
|
||||
#include "lib/CondSh.h"
|
||||
#include "map.h"
|
||||
@ -42,15 +41,15 @@ CAdvMapInt::~CAdvMapInt()
|
||||
CMinimap::CMinimap(bool draw)
|
||||
{
|
||||
int3 mapSizes = LOCPLINT->cb->getMapSize();
|
||||
statusbarTxt = CGI->preth->zelp[291].first;
|
||||
rcText = CGI->preth->zelp[291].second;
|
||||
statusbarTxt = CGI->generaltexth->zelp[291].first;
|
||||
rcText = CGI->generaltexth->zelp[291].second;
|
||||
pos.x=ADVOPT.minimapX;//630
|
||||
pos.y=ADVOPT.minimapY;//26
|
||||
pos.h=ADVOPT.minimapW;//144
|
||||
pos.w=ADVOPT.minimapH;//144
|
||||
|
||||
int rx = (((float)19)/(mapSizes.x))*((float)pos.w),
|
||||
ry = (((float)18)/(mapSizes.y))*((float)pos.h);
|
||||
int rx = (((float)ADVOPT.tilesW)/(mapSizes.x))*((float)pos.w),
|
||||
ry = (((float)ADVOPT.tilesH)/(mapSizes.y))*((float)pos.h);
|
||||
|
||||
radar = newSurface(rx,ry);
|
||||
temps = newSurface(pos.w,pos.h);
|
||||
@ -295,12 +294,12 @@ void CMinimap::hideTile(const int3 &pos)
|
||||
}
|
||||
CTerrainRect::CTerrainRect():currentPath(NULL)
|
||||
{
|
||||
tilesw=19;
|
||||
tilesh=18;
|
||||
pos.x=7;
|
||||
pos.y=6;
|
||||
pos.w=593;
|
||||
pos.h=547;
|
||||
tilesw=ADVOPT.tilesW;
|
||||
tilesh=ADVOPT.tilesH;
|
||||
pos.x=ADVOPT.advmapX;
|
||||
pos.y=ADVOPT.advmapY;
|
||||
pos.w=tilesw*32 - ADVOPT.advmapTrimX;
|
||||
pos.h=tilesh*32 - ADVOPT.advmapTrimY;
|
||||
moveX = moveY = 0;
|
||||
arrows = CDefHandler::giveDef("ADAG.DEF");
|
||||
for(int y=0; y<arrows->ourImages.size(); ++y)
|
||||
@ -733,7 +732,7 @@ void CTerrainRect::show()
|
||||
(LOCPLINT->adventureInt->position.x,LOCPLINT->adventureInt->position.y,
|
||||
tilesw,tilesh,LOCPLINT->adventureInt->position.z,LOCPLINT->adventureInt->anim,
|
||||
&LOCPLINT->cb->getVisibilityMap(), true, LOCPLINT->adventureInt->heroAnim,
|
||||
screen, &genRect(547, 594, 7, 6)
|
||||
screen, &genRect(pos.h, pos.w, pos.x, pos.y)
|
||||
);
|
||||
//SDL_BlitSurface(teren,&genRect(pos.h,pos.w,0,0),screen,&genRect(547,594,7,6));
|
||||
//SDL_FreeSurface(teren);
|
||||
@ -773,11 +772,19 @@ CResDataBar::CResDataBar()
|
||||
graphics->blueToPlayersAdv(bg,LOCPLINT->playerID);
|
||||
pos = genRect(bg->h,bg->w,ADVOPT.resdatabarX,ADVOPT.resdatabarY);
|
||||
|
||||
txtpos += (std::pair<int,int>(35,577)),(std::pair<int,int>(120,577)),(std::pair<int,int>(205,577)),
|
||||
(std::pair<int,int>(290,577)),(std::pair<int,int>(375,577)),(std::pair<int,int>(460,577)),
|
||||
(std::pair<int,int>(545,577)),(std::pair<int,int>(620,577));
|
||||
datetext = CGI->generaltexth->allTexts[62]+": %s, " + CGI->generaltexth->allTexts[63] + ": %s, " +
|
||||
CGI->generaltexth->allTexts[64] + ": %s";
|
||||
txtpos.resize(8);
|
||||
for (int i = 0; i < 8 ; i++)
|
||||
{
|
||||
txtpos[i].first = pos.x + ADVOPT.resOffsetX + ADVOPT.resDist*i;
|
||||
txtpos[i].second = pos.y + ADVOPT.resOffsetY;
|
||||
}
|
||||
txtpos[7].first = txtpos[6].first + ADVOPT.resDateDist;
|
||||
//txtpos += (std::pair<int,int>(32+pos.x,2+pos.y)),(std::pair<int,int>(117+pos.x,2+pos.y)),
|
||||
// (std::pair<int,int>(202+pos.x,2+pos.y)),(std::pair<int,int>(287+pos.x,2+pos.y)),
|
||||
// (std::pair<int,int>(372+pos.x,2+pos.y)),(std::pair<int,int>(457+pos.x,2+pos.y)),
|
||||
// (std::pair<int,int>(542+pos.x,2+pos.y)),(std::pair<int,int>(617+pos.x,2+pos.y));
|
||||
datetext = CGI->generaltexth->allTexts[62]+": %s, " + CGI->generaltexth->allTexts[63]
|
||||
+ ": %s, " + CGI->generaltexth->allTexts[64] + ": %s";
|
||||
|
||||
}
|
||||
CResDataBar::~CResDataBar()
|
||||
@ -805,8 +812,8 @@ void CResDataBar::draw()
|
||||
CInfoBar::CInfoBar()
|
||||
{
|
||||
toNextTick = mode = pom = -1;
|
||||
pos.x=605;
|
||||
pos.y=389;
|
||||
pos.x=ADVOPT.infoboxX;
|
||||
pos.y=ADVOPT.infoboxY;
|
||||
pos.w=194;
|
||||
pos.h=186;
|
||||
day = CDefHandler::giveDef("NEWDAY.DEF");
|
||||
@ -898,7 +905,7 @@ void CInfoBar::blitAnim(int mode)//0 - day, 1 - week
|
||||
txt << CGI->generaltexth->allTexts[64] << " " << LOCPLINT->cb->getDate(1);
|
||||
}
|
||||
blitAt(anim->ourImages[pom].bitmap,pos.x+9,pos.y+10);
|
||||
printAtMiddle(txt.str(),700,420,TNRB16,zwykly);
|
||||
printAtMiddle(txt.str(),pos.x+95,pos.y+31,TNRB16,zwykly);
|
||||
if (pom == anim->ourImages.size()-1)
|
||||
toNextTick+=750;
|
||||
}
|
||||
@ -978,37 +985,37 @@ void CInfoBar::tick()
|
||||
CAdvMapInt::CAdvMapInt(int Player)
|
||||
:player(Player),
|
||||
statusbar(ADVOPT.statusbarX,ADVOPT.statusbarY,ADVOPT.statusbarG),
|
||||
kingOverview(CGI->preth->zelp[293].first,CGI->preth->zelp[293].second,
|
||||
kingOverview(CGI->generaltexth->zelp[293].first,CGI->generaltexth->zelp[293].second,
|
||||
boost::bind(&CAdvMapInt::fshowOverview,this),&ADVOPT.kingOverview, SDLK_k),
|
||||
|
||||
underground(CGI->preth->zelp[294].first,CGI->preth->zelp[294].second,
|
||||
underground(CGI->generaltexth->zelp[294].first,CGI->generaltexth->zelp[294].second,
|
||||
boost::bind(&CAdvMapInt::fswitchLevel,this),&ADVOPT.underground, SDLK_u),
|
||||
|
||||
questlog(CGI->preth->zelp[295].first,CGI->preth->zelp[295].second,
|
||||
questlog(CGI->generaltexth->zelp[295].first,CGI->generaltexth->zelp[295].second,
|
||||
boost::bind(&CAdvMapInt::fshowQuestlog,this),&ADVOPT.questlog, SDLK_q),
|
||||
|
||||
sleepWake(CGI->preth->zelp[296].first,CGI->preth->zelp[296].second,
|
||||
sleepWake(CGI->generaltexth->zelp[296].first,CGI->generaltexth->zelp[296].second,
|
||||
boost::bind(&CAdvMapInt::fsleepWake,this), &ADVOPT.sleepWake, SDLK_w),
|
||||
|
||||
moveHero(CGI->preth->zelp[297].first,CGI->preth->zelp[297].second,
|
||||
moveHero(CGI->generaltexth->zelp[297].first,CGI->generaltexth->zelp[297].second,
|
||||
boost::bind(&CAdvMapInt::fmoveHero,this), &ADVOPT.moveHero, SDLK_m),
|
||||
|
||||
spellbook(CGI->preth->zelp[298].first,CGI->preth->zelp[298].second,
|
||||
spellbook(CGI->generaltexth->zelp[298].first,CGI->generaltexth->zelp[298].second,
|
||||
boost::bind(&CAdvMapInt::fshowSpellbok,this), &ADVOPT.spellbook, SDLK_c),
|
||||
|
||||
advOptions(CGI->preth->zelp[299].first,CGI->preth->zelp[299].second,
|
||||
advOptions(CGI->generaltexth->zelp[299].first,CGI->generaltexth->zelp[299].second,
|
||||
boost::bind(&CAdvMapInt::fadventureOPtions,this), &ADVOPT.advOptions, SDLK_a),
|
||||
|
||||
sysOptions(CGI->preth->zelp[300].first,CGI->preth->zelp[300].second,
|
||||
sysOptions(CGI->generaltexth->zelp[300].first,CGI->generaltexth->zelp[300].second,
|
||||
boost::bind(&CAdvMapInt::fsystemOptions,this), &ADVOPT.sysOptions, SDLK_o),
|
||||
|
||||
nextHero(CGI->preth->zelp[301].first,CGI->preth->zelp[301].second,
|
||||
nextHero(CGI->generaltexth->zelp[301].first,CGI->generaltexth->zelp[301].second,
|
||||
boost::bind(&CAdvMapInt::fnextHero,this), &ADVOPT.nextHero, SDLK_h),
|
||||
|
||||
endTurn(CGI->preth->zelp[302].first,CGI->preth->zelp[302].second,
|
||||
endTurn(CGI->generaltexth->zelp[302].first,CGI->generaltexth->zelp[302].second,
|
||||
boost::bind(&CAdvMapInt::fendTurn,this), &ADVOPT.endTurn, SDLK_e),
|
||||
|
||||
townList(5,ADVOPT.tlistX,ADVOPT.tlistY,ADVOPT.tlistAU,ADVOPT.tlistAD),//(5,&genRect(192,48,747,196),747,196,747,372),
|
||||
townList(ADVOPT.tlistSize,ADVOPT.tlistX,ADVOPT.tlistY,ADVOPT.tlistAU,ADVOPT.tlistAD),//(5,&genRect(192,48,747,196),747,196,747,372),
|
||||
heroList(ADVOPT.hlistSize)
|
||||
{
|
||||
selection = NULL;
|
||||
@ -1218,7 +1225,7 @@ void CAdvMapInt::update()
|
||||
}
|
||||
if(scrollingRight)
|
||||
{
|
||||
if(position.x<CGI->mh->map->width-19+4)
|
||||
if(position.x < CGI->mh->map->width - terrain.tilesw + 4 )
|
||||
{
|
||||
position.x++;
|
||||
updateScreen = true;
|
||||
@ -1236,7 +1243,7 @@ void CAdvMapInt::update()
|
||||
}
|
||||
if(scrollingDown)
|
||||
{
|
||||
if(position.y<CGI->mh->map->height-18+4)
|
||||
if(position.y < CGI->mh->map->height - terrain.tilesh + 4)
|
||||
{
|
||||
position.y++;
|
||||
updateScreen = true;
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "CCallback.h"
|
||||
#include "CGameState.h"
|
||||
#include "hch/CGeneralTextHandler.h"
|
||||
#include "hch/CPreGameTextHandler.h"
|
||||
#include "client/CCreatureAnimation.h"
|
||||
#include "client/Graphics.h"
|
||||
#include "client/CSpellWindow.h"
|
||||
@ -2272,23 +2271,23 @@ CBattleOptionsWindow::CBattleOptionsWindow(const SDL_Rect & position, CBattleInt
|
||||
background = BitmapHandler::loadBitmap("comopbck.bmp", true);
|
||||
graphics->blueToPlayersAdv(background, LOCPLINT->playerID);
|
||||
|
||||
viewGrid = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintCellBorders, owner, true), boost::bind(&CBattleInterface::setPrintCellBorders, owner, false), boost::assign::map_list_of(0,CGI->preth->zelp[427].first)(3,CGI->preth->zelp[427].first), CGI->preth->zelp[427].second, false, "sysopchk.def", NULL, 185, 140, false);
|
||||
viewGrid = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintCellBorders, owner, true), boost::bind(&CBattleInterface::setPrintCellBorders, owner, false), boost::assign::map_list_of(0,CGI->generaltexth->zelp[427].first)(3,CGI->generaltexth->zelp[427].first), CGI->generaltexth->zelp[427].second, false, "sysopchk.def", NULL, 185, 140, false);
|
||||
viewGrid->select(owner->printCellBorders);
|
||||
movementShadow = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintStackRange, owner, true), boost::bind(&CBattleInterface::setPrintStackRange, owner, false), boost::assign::map_list_of(0,CGI->preth->zelp[428].first)(3,CGI->preth->zelp[428].first), CGI->preth->zelp[428].second, false, "sysopchk.def", NULL, 185, 173, false);
|
||||
movementShadow = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintStackRange, owner, true), boost::bind(&CBattleInterface::setPrintStackRange, owner, false), boost::assign::map_list_of(0,CGI->generaltexth->zelp[428].first)(3,CGI->generaltexth->zelp[428].first), CGI->generaltexth->zelp[428].second, false, "sysopchk.def", NULL, 185, 173, false);
|
||||
movementShadow->select(owner->printStackRange);
|
||||
mouseShadow = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintMouseShadow, owner, true), boost::bind(&CBattleInterface::setPrintMouseShadow, owner, false), boost::assign::map_list_of(0,CGI->preth->zelp[429].first)(3,CGI->preth->zelp[429].first), CGI->preth->zelp[429].second, false, "sysopchk.def", NULL, 185, 207, false);
|
||||
mouseShadow = new CHighlightableButton(boost::bind(&CBattleInterface::setPrintMouseShadow, owner, true), boost::bind(&CBattleInterface::setPrintMouseShadow, owner, false), boost::assign::map_list_of(0,CGI->generaltexth->zelp[429].first)(3,CGI->generaltexth->zelp[429].first), CGI->generaltexth->zelp[429].second, false, "sysopchk.def", NULL, 185, 207, false);
|
||||
mouseShadow->select(owner->printMouseShadow);
|
||||
|
||||
animSpeeds = new CHighlightableButtonsGroup(0);
|
||||
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->preth->zelp[422].first),CGI->preth->zelp[422].second, "sysopb9.def",188, 309, 1);
|
||||
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->preth->zelp[423].first),CGI->preth->zelp[423].second, "sysob10.def",252, 309, 2);
|
||||
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->preth->zelp[424].first),CGI->preth->zelp[424].second, "sysob11.def",315, 309, 4);
|
||||
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[422].first),CGI->generaltexth->zelp[422].second, "sysopb9.def",188, 309, 1);
|
||||
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[423].first),CGI->generaltexth->zelp[423].second, "sysob10.def",252, 309, 2);
|
||||
animSpeeds->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[424].first),CGI->generaltexth->zelp[424].second, "sysob11.def",315, 309, 4);
|
||||
animSpeeds->select(owner->getAnimSpeed(), 1);
|
||||
animSpeeds->onChange = boost::bind(&CBattleInterface::setAnimSpeed, owner, _1);
|
||||
|
||||
setToDefault = new AdventureMapButton (CGI->preth->zelp[392].first, CGI->preth->zelp[392].second, boost::bind(&CBattleOptionsWindow::bDefaultf,this), 405, 443, "codefaul.def");
|
||||
setToDefault = new AdventureMapButton (CGI->generaltexth->zelp[392].first, CGI->generaltexth->zelp[392].second, boost::bind(&CBattleOptionsWindow::bDefaultf,this), 405, 443, "codefaul.def");
|
||||
std::swap(setToDefault->imgs[0][0], setToDefault->imgs[0][1]);
|
||||
exit = new AdventureMapButton (CGI->preth->zelp[393].first, CGI->preth->zelp[393].second, boost::bind(&CBattleOptionsWindow::bExitf,this), 516, 443, "soretrn.def",SDLK_RETURN);
|
||||
exit = new AdventureMapButton (CGI->generaltexth->zelp[393].first, CGI->generaltexth->zelp[393].second, boost::bind(&CBattleOptionsWindow::bExitf,this), 516, 443, "soretrn.def",SDLK_RETURN);
|
||||
std::swap(exit->imgs[0][0], exit->imgs[0][1]);
|
||||
|
||||
//printing texts to background
|
||||
|
@ -40,8 +40,8 @@ CBuildingRect::CBuildingRect(Structure *Str)
|
||||
}
|
||||
}
|
||||
|
||||
pos.x = str->pos.x;
|
||||
pos.y = str->pos.y;
|
||||
pos.x = str->pos.x + LOCPLINT->castleInt->pos.x;
|
||||
pos.y = str->pos.y + LOCPLINT->castleInt->pos.y;
|
||||
pos.w = def->ourImages[0].bitmap->w;
|
||||
pos.h = def->ourImages[0].bitmap->h;
|
||||
if(Str->ID<0 || (Str->ID>=27 && Str->ID<=29))
|
||||
@ -342,10 +342,17 @@ public:
|
||||
CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate)
|
||||
:hslotup(241,387,0,Town->garrisonHero,this),hslotdown(241,483,1,Town->visitingHero,this)
|
||||
{
|
||||
LOCPLINT->castleInt = this;
|
||||
subInt = NULL;
|
||||
hall = NULL;
|
||||
townInt = BitmapHandler::loadBitmap("TOWNSCRN.bmp");
|
||||
cityBg = BitmapHandler::loadBitmap(getBgName(Town->subID));
|
||||
pos.x = screen->w/2 - 400;
|
||||
pos.y = screen->h/2 - 300;
|
||||
hslotup.pos.x += pos.x;
|
||||
hslotup.pos.y += pos.y;
|
||||
hslotdown.pos.x += pos.x;
|
||||
hslotdown.pos.y += pos.y;
|
||||
hall = CDefHandler::giveDef("ITMTL.DEF");
|
||||
fort = CDefHandler::giveDef("ITMCL.DEF");
|
||||
hBuild = NULL;
|
||||
@ -353,14 +360,14 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate)
|
||||
town = Town;
|
||||
|
||||
//garrison
|
||||
garr = new CGarrisonInt(305,387,4,32,townInt,243,13,town,town->visitingHero);
|
||||
garr = new CGarrisonInt(pos.x+305,pos.y+387,4,32,townInt,243,13,town,town->visitingHero);
|
||||
|
||||
townlist = new CTownList(3,744,414,"IAM014.DEF","IAM015.DEF");//744,526);
|
||||
townlist = new CTownList(3,pos.x+744,pos.y+414,"IAM014.DEF","IAM015.DEF");//744,526);
|
||||
exit = new AdventureMapButton
|
||||
(CGI->townh->tcommands[8],"",boost::bind(&CCastleInterface::close,this),744,544,"TSBTNS.DEF",SDLK_RETURN);
|
||||
(CGI->townh->tcommands[8],"",boost::bind(&CCastleInterface::close,this),pos.x+744,pos.y+544,"TSBTNS.DEF",SDLK_RETURN);
|
||||
split = new AdventureMapButton
|
||||
(CGI->townh->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),744,382,"TSBTNS.DEF");
|
||||
statusbar = new CStatusBar(8,555,"TSTATBAR.bmp",732);
|
||||
(CGI->townh->tcommands[3],"",boost::bind(&CGarrisonInt::splitClick,garr),pos.x+744,pos.y+382,"TSBTNS.DEF");
|
||||
statusbar = new CStatusBar(pos.x+7,pos.y+555,"TSTATBAR.bmp",732);
|
||||
|
||||
townlist->fun = boost::bind(&CCastleInterface::townChange,this);
|
||||
townlist->genList();
|
||||
@ -414,18 +421,9 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate)
|
||||
defname = "HALLELEM.DEF";
|
||||
break;
|
||||
default:
|
||||
#ifndef __GNUC__
|
||||
throw new std::exception("Bad town subID");
|
||||
#else
|
||||
throw new std::exception();
|
||||
#endif
|
||||
throw new std::string("Wrong town subID");
|
||||
}
|
||||
bicons = CDefHandler::giveDefEss(defname);
|
||||
//blit buildings on bg
|
||||
//for(int i=0;i<buildings.size();i++)
|
||||
//{
|
||||
// blitAt(buildings[i]->def->ourImages[0].bitmap,buildings[i]->pos.x,buildings[i]->pos.y,cityBg);
|
||||
//}
|
||||
}
|
||||
CCastleInterface::~CCastleInterface()
|
||||
{
|
||||
@ -570,8 +568,8 @@ void CCastleInterface::showAll( SDL_Surface * to/*=NULL*/, bool forceTotalRedraw
|
||||
{
|
||||
if (!to)
|
||||
to=screen;
|
||||
blitAt(cityBg,0,0,to);
|
||||
blitAt(townInt,0,374,to);
|
||||
blitAt(cityBg,pos,to);
|
||||
blitAt(townInt,pos.x,pos.y+374,to);
|
||||
LOCPLINT->adventureInt->resdatabar.draw();
|
||||
townlist->draw();
|
||||
statusbar->show();
|
||||
@ -587,7 +585,7 @@ void CCastleInterface::showAll( SDL_Surface * to/*=NULL*/, bool forceTotalRedraw
|
||||
else if(town->builtBuildings.find(7)!=town->builtBuildings.end())
|
||||
pom = 0;
|
||||
else pom = 3;
|
||||
blitAt(fort->ourImages[pom].bitmap,122,413,to);
|
||||
blitAt(fort->ourImages[pom].bitmap,pos.x+122,pos.y+413,to);
|
||||
|
||||
//draw ((village/town/city) hall)/capitol icon
|
||||
if(town->builtBuildings.find(13)!=town->builtBuildings.end())
|
||||
@ -597,7 +595,7 @@ void CCastleInterface::showAll( SDL_Surface * to/*=NULL*/, bool forceTotalRedraw
|
||||
else if(town->builtBuildings.find(11)!=town->builtBuildings.end())
|
||||
pom = 1;
|
||||
else pom = 0;
|
||||
blitAt(hall->ourImages[pom].bitmap,80,413,to);
|
||||
blitAt(hall->ourImages[pom].bitmap,pos.x+80,pos.y+413,to);
|
||||
|
||||
//draw creatures icons and their growths
|
||||
for(int i=0;i<CREATURES_PER_TOWN;i++)
|
||||
@ -615,18 +613,18 @@ void CCastleInterface::showAll( SDL_Surface * to/*=NULL*/, bool forceTotalRedraw
|
||||
int pomx, pomy;
|
||||
pomx = 22 + (55*((i>3)?(i-4):i));
|
||||
pomy = (i>3)?(507):(459);
|
||||
blitAt(graphics->smallImgs[cid],pomx,pomy,to);
|
||||
blitAt(graphics->smallImgs[cid],pos.x+pomx,pos.y+pomy,to);
|
||||
std::ostringstream oss;
|
||||
oss << '+' << town->creatureGrowth(i);
|
||||
CSDL_Ext::printAtMiddle(oss.str(),pomx+16,pomy+37,GEOR13,zwykly,to);
|
||||
CSDL_Ext::printAtMiddle(oss.str(),pos.x+pomx+16,pos.y+pomy+37,GEOR13,zwykly,to);
|
||||
}
|
||||
}
|
||||
|
||||
//print name and income
|
||||
CSDL_Ext::printAt(town->name,85,389,GEOR13,zwykly,to);
|
||||
CSDL_Ext::printAt(town->name,pos.x+85,pos.y+389,GEOR13,zwykly,to);
|
||||
char temp[10];
|
||||
SDL_itoa(town->dailyIncome(),temp,10);
|
||||
CSDL_Ext::printAtMiddle(temp,195,442,GEOR13,zwykly,to);
|
||||
CSDL_Ext::printAtMiddle(temp,pos.x+195,pos.y+442,GEOR13,zwykly,to);
|
||||
|
||||
//blit town icon
|
||||
pom = town->subID*2;
|
||||
@ -634,7 +632,7 @@ void CCastleInterface::showAll( SDL_Surface * to/*=NULL*/, bool forceTotalRedraw
|
||||
pom += F_NUMBER*2;
|
||||
if(town->builded >= MAX_BUILDING_PER_TURN)
|
||||
pom++;
|
||||
blitAt(graphics->bigTownPic->ourImages[pom].bitmap,15,387,to);
|
||||
blitAt(graphics->bigTownPic->ourImages[pom].bitmap,pos.x+15,pos.y+387,to);
|
||||
|
||||
hslotup.show();
|
||||
hslotdown.show();
|
||||
@ -667,7 +665,7 @@ void CCastleInterface::show(SDL_Surface * to)
|
||||
animval++;
|
||||
}
|
||||
|
||||
blitAt(cityBg,0,0,to);
|
||||
blitAt(cityBg,pos,to);
|
||||
|
||||
|
||||
//blit buildings
|
||||
@ -977,12 +975,16 @@ CHallInterface::CBuildingBox::CBuildingBox(int id, int x, int y)
|
||||
|
||||
CHallInterface::CHallInterface(CCastleInterface * owner)
|
||||
{
|
||||
pos = owner->pos;
|
||||
resdatabar.pos.x += pos.x;
|
||||
resdatabar.pos.y += pos.y;
|
||||
bg = BitmapHandler::loadBitmap(CGI->buildh->hall[owner->town->subID].first);
|
||||
graphics->blueToPlayersAdv(bg,LOCPLINT->playerID);
|
||||
bars = CDefHandler::giveDefEss("TPTHBAR.DEF");
|
||||
status = CDefHandler::giveDefEss("TPTHCHK.DEF");
|
||||
exit = new AdventureMapButton
|
||||
(CGI->townh->tcommands[8],"",boost::bind(&CHallInterface::close,this),748,556,"TPMAGE1.DEF",SDLK_RETURN);
|
||||
(CGI->townh->tcommands[8],"",boost::bind(&CHallInterface::close,this),pos.x+748,pos.y+556,"TPMAGE1.DEF",SDLK_RETURN);
|
||||
exit->assignedKeys.insert(SDLK_ESCAPE);
|
||||
|
||||
//preparing boxes with buildings//
|
||||
boxes.resize(5);
|
||||
@ -1005,7 +1007,7 @@ CHallInterface::CHallInterface(CCastleInterface * owner)
|
||||
x+=194;
|
||||
else if(CGI->buildh->hall[owner->town->subID].second[i].size() == 3) //only three boxes in this row
|
||||
x+=97;
|
||||
boxes[i].push_back(new CBuildingBox(CGI->buildh->hall[owner->town->subID].second[i][j][k],x,y));
|
||||
boxes[i].push_back(new CBuildingBox(CGI->buildh->hall[owner->town->subID].second[i][j][k],pos.x+x,pos.y+y));
|
||||
|
||||
boxes[i][boxes[i].size()-1]->state = 7; //allowed by default
|
||||
|
||||
@ -1044,7 +1046,7 @@ CHallInterface::CHallInterface(CCastleInterface * owner)
|
||||
x+=194;
|
||||
else if(CGI->buildh->hall[owner->town->subID].second[i].size() == 3)
|
||||
x+=97;
|
||||
boxes[i].push_back(new CBuildingBox(CGI->buildh->hall[owner->town->subID].second[i][j][k-1],x,y));
|
||||
boxes[i].push_back(new CBuildingBox(CGI->buildh->hall[owner->town->subID].second[i][j][k-1],pos.x+x,pos.y+y));
|
||||
boxes[i][boxes[i].size()-1]->state = 4; //already exists
|
||||
}
|
||||
}
|
||||
@ -1069,7 +1071,7 @@ void CHallInterface::close()
|
||||
}
|
||||
void CHallInterface::show(SDL_Surface * to)
|
||||
{
|
||||
blitAt(bg,0,0);
|
||||
blitAt(bg,pos);
|
||||
resdatabar.show();
|
||||
exit->show();
|
||||
for(int i=0; i<5; i++)
|
||||
@ -1168,9 +1170,14 @@ std::string CHallInterface::CBuildWindow::getTextForState(int state)
|
||||
used.insert(bid);
|
||||
std::set<int> reqs;
|
||||
|
||||
for(std::set<int>::iterator i=CGI->townh->requirements[tid][bid].begin();i!=CGI->townh->requirements[tid][bid].end();i++)
|
||||
for(std::set<int>::iterator i=CGI->townh->requirements[tid][bid].begin();
|
||||
i!=CGI->townh->requirements[tid][bid].end();
|
||||
i++
|
||||
)
|
||||
{
|
||||
if (LOCPLINT->castleInt->town->builtBuildings.find(*i) == LOCPLINT->castleInt->town->builtBuildings.end())
|
||||
reqs.insert(*i);
|
||||
}
|
||||
while(true)
|
||||
{
|
||||
int czystych=0;
|
||||
@ -1282,11 +1289,11 @@ CFortScreen::~CFortScreen()
|
||||
|
||||
void CFortScreen::show( SDL_Surface * to)
|
||||
{
|
||||
blitAt(bg,0,0);
|
||||
blitAt(bg,pos);
|
||||
static unsigned char anim = 1;
|
||||
for (int i=0; i<CREATURES_PER_TOWN; i++)
|
||||
{
|
||||
crePics[i]->blitPic(screen,positions[i].x+159,positions[i].y+4,!(anim%4));
|
||||
crePics[i]->blitPic(screen,pos.x+positions[i].x+159,pos.y+positions[i].y+4,!(anim%4));
|
||||
}
|
||||
anim++;
|
||||
exit->show();
|
||||
@ -1325,14 +1332,17 @@ void CFortScreen::close()
|
||||
}
|
||||
CFortScreen::CFortScreen( CCastleInterface * owner )
|
||||
{
|
||||
pos = owner->pos;
|
||||
LOCPLINT->curint->subInt = this;
|
||||
bg = NULL;
|
||||
exit = new AdventureMapButton(CGI->townh->tcommands[8],"",boost::bind(&CFortScreen::close,this),748,556,"TPMAGE1.DEF",SDLK_RETURN);
|
||||
exit = new AdventureMapButton(CGI->townh->tcommands[8],"",boost::bind(&CFortScreen::close,this),pos.x+748,pos.y+556,"TPMAGE1.DEF",SDLK_RETURN);
|
||||
positions += genRect(126,386,10,22),genRect(126,386,404,22),
|
||||
genRect(126,386,10,155),genRect(126,386,404,155),
|
||||
genRect(126,386,10,288),genRect(126,386,404,288),
|
||||
genRect(126,386,206,421);//genRect(126,386,10,421),genRect(126,386,404,421);
|
||||
genRect(126,386,206,421);
|
||||
draw(owner,true);
|
||||
resdatabar.pos.x += pos.x;
|
||||
resdatabar.pos.y += pos.y;
|
||||
}
|
||||
|
||||
void CFortScreen::draw( CCastleInterface * owner, bool first)
|
||||
@ -1386,12 +1396,12 @@ void CFortScreen::draw( CCastleInterface * owner, bool first)
|
||||
printToWR(buf,positions[i].x+381,positions[i].y+59,GEOR13,zwykly,bg);
|
||||
|
||||
//health
|
||||
printAt(CGI->preth->zelp[439].first,positions[i].x+288,positions[i].y+66,GEOR13,zwykly,bg);
|
||||
printAt(CGI->generaltexth->zelp[439].first,positions[i].x+288,positions[i].y+66,GEOR13,zwykly,bg);
|
||||
SDL_itoa(c->hitPoints,buf,10);
|
||||
printToWR(buf,positions[i].x+381,positions[i].y+79,GEOR13,zwykly,bg);
|
||||
|
||||
//speed
|
||||
printAt(CGI->preth->zelp[441].first,positions[i].x+288,positions[i].y+87,GEOR13,zwykly,bg);
|
||||
printAt(CGI->generaltexth->zelp[441].first,positions[i].x+288,positions[i].y+87,GEOR13,zwykly,bg);
|
||||
SDL_itoa(c->speed,buf,10);
|
||||
printToWR(buf,positions[i].x+381,positions[i].y+100,GEOR13,zwykly,bg);
|
||||
|
||||
@ -1433,8 +1443,12 @@ void CFortScreen::RecArea::deactivate()
|
||||
|
||||
CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner)
|
||||
{
|
||||
pos = owner->pos;
|
||||
resdatabar.pos.x += pos.x;
|
||||
resdatabar.pos.y += pos.y;
|
||||
bg = BitmapHandler::loadBitmap("TPMAGE.bmp");
|
||||
exit = new AdventureMapButton(CGI->townh->tcommands[8],"",boost::bind(&CMageGuildScreen::close,this),748,556,"TPMAGE1.DEF",SDLK_RETURN);
|
||||
exit = new AdventureMapButton(CGI->townh->tcommands[8],"",boost::bind(&CMageGuildScreen::close,this),pos.x+748,pos.y+556,"TPMAGE1.DEF",SDLK_RETURN);
|
||||
exit->assignedKeys.insert(SDLK_ESCAPE);
|
||||
scrolls = CDefHandler::giveDefEss("SPELLSCR.DEF");
|
||||
scrolls2 = CDefHandler::giveDefEss("TPMAGES.DEF");
|
||||
SDL_Surface *view = BitmapHandler::loadBitmap(graphics->guildBgs[owner->town->subID]);
|
||||
@ -1464,6 +1478,11 @@ CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner)
|
||||
}
|
||||
}
|
||||
SDL_FreeSurface(view);
|
||||
for(int i=0;i<spells.size();i++)
|
||||
{
|
||||
spells[i].pos.x += pos.x;
|
||||
spells[i].pos.y += pos.y;
|
||||
}
|
||||
delete scrolls2;
|
||||
}
|
||||
CMageGuildScreen::~CMageGuildScreen()
|
||||
@ -1481,7 +1500,7 @@ void CMageGuildScreen::close()
|
||||
}
|
||||
void CMageGuildScreen::show(SDL_Surface * to)
|
||||
{
|
||||
blitAt(bg,0,0);
|
||||
blitAt(bg,pos);
|
||||
resdatabar.show();
|
||||
LOCPLINT->statusbar->show();
|
||||
exit->show();
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
class CCastleInterface : public CMainInterface
|
||||
{
|
||||
public:
|
||||
SDL_Rect pos;
|
||||
bool showing;
|
||||
CBuildingRect * hBuild; //highlighted building
|
||||
SDL_Surface * townInt;
|
||||
@ -89,6 +90,7 @@ class CHallInterface : public IShowActivable
|
||||
{
|
||||
public:
|
||||
CMinorResDataBar resdatabar;
|
||||
SDL_Rect pos;
|
||||
|
||||
class CBuildingBox : public Hoverable, public ClickableL, public ClickableR
|
||||
{
|
||||
@ -143,7 +145,7 @@ public:
|
||||
void deactivate();
|
||||
};
|
||||
|
||||
class CFortScreen : public CMainInterface
|
||||
class CFortScreen : public CMainInterface, public CIntObject
|
||||
{
|
||||
class RecArea : public ClickableL
|
||||
{
|
||||
@ -172,7 +174,7 @@ public:
|
||||
void deactivate();
|
||||
};
|
||||
|
||||
class CMageGuildScreen : public IShowActivable
|
||||
class CMageGuildScreen : public IShowActivable, public CIntObject
|
||||
{
|
||||
public:
|
||||
class Scroll : public ClickableL, public Hoverable, public ClickableR
|
||||
|
@ -48,7 +48,6 @@ public:
|
||||
CAbilityHandler * abilh;
|
||||
CSpellHandler * spellh;
|
||||
CMapHandler * mh;
|
||||
CPreGameTextHandler * preth;
|
||||
CBuildingHandler * buildh;
|
||||
CObjectHandler * objh;
|
||||
CMusicHandler * mush;
|
||||
|
@ -1062,14 +1062,7 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
|
||||
ran.seed((boost::int32_t)seed);
|
||||
scenarioOps = si;
|
||||
this->map = map;
|
||||
|
||||
for(int i=0;i<F_NUMBER;i++)
|
||||
{
|
||||
villages[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]);
|
||||
forts[i] = VLC->dobjinfo->castles[i];
|
||||
capitols[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]);
|
||||
}
|
||||
|
||||
loadTownDInfos();
|
||||
//picking random factions for players
|
||||
for(int i=0;i<scenarioOps->playerInfos.size();i++)
|
||||
{
|
||||
@ -1383,15 +1376,6 @@ void CGameState::init(StartInfo * si, Mapa * map, int Seed)
|
||||
k->second.heroes[l]->pos.x -= 1;
|
||||
break;
|
||||
}
|
||||
//else if(k->second.heroes[l]->pos == k->second.towns[m]->pos)
|
||||
//{
|
||||
// k->second.towns[m]->garrisonHero = k->second.heroes[l];
|
||||
// k->second.towns[m]->army = k->second.heroes[l]->army;
|
||||
// k->second.heroes[l]->visitedTown = k->second.towns[m];
|
||||
// k->second.heroes[l]->inTownGarrison = true;
|
||||
// k->second.heroes[l]->pos.x -= 1;
|
||||
// goto mainplheloop;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1503,6 +1487,15 @@ std::set<int3> CGameState::tilesToReveal(int3 pos, int radious, int player)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CGameState::loadTownDInfos()
|
||||
{
|
||||
for(int i=0;i<F_NUMBER;i++)
|
||||
{
|
||||
villages[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]);
|
||||
forts[i] = VLC->dobjinfo->castles[i];
|
||||
capitols[i] = new CGDefInfo(*VLC->dobjinfo->castles[i]);
|
||||
}
|
||||
}
|
||||
int BattleInfo::calculateDmg(const CStack* attacker, const CStack* defender, const CGHeroInstance * attackerHero, const CGHeroInstance * defendingHero, bool shooting)
|
||||
{
|
||||
int attackDefenseBonus = attacker->creature->attack + (attackerHero ? attackerHero->getPrimSkillLevel(0) : 0) - (defender->creature->defence + (defendingHero ? defendingHero->getPrimSkillLevel(1) : 0));
|
||||
|
@ -178,6 +178,7 @@ private:
|
||||
CGameState();
|
||||
~CGameState();
|
||||
void init(StartInfo * si, Mapa * map, int Seed);
|
||||
void loadTownDInfos();
|
||||
void applyNL(IPack * pack);
|
||||
void apply(IPack * pack);
|
||||
void randomizeObject(CGObjectInstance *cur);
|
||||
@ -199,7 +200,10 @@ public:
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & scenarioOps & seed & currentPlayer & day & map & players & resVals;
|
||||
//TODO: villages, forts, capitols - will need reloading
|
||||
if(!h.saving)
|
||||
{
|
||||
loadTownDInfos();
|
||||
}
|
||||
//TODO: hero pool
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ CHeroWindow::CHeroWindow(int playerColor):
|
||||
artWorn.resize(19);
|
||||
background = BitmapHandler::loadBitmap("HEROSCR4.bmp");
|
||||
graphics->blueToPlayersAdv(background, playerColor);
|
||||
pos.x = 65;
|
||||
pos.y = 8;
|
||||
pos.x = screen->w/2 - background->w/2 - 65;
|
||||
pos.y = screen->h/2 - background->h/2 - 8;
|
||||
pos.h = background->h;
|
||||
pos.w = background->w;
|
||||
curBack = NULL;
|
||||
@ -42,47 +42,49 @@ CHeroWindow::CHeroWindow(int playerColor):
|
||||
activeArtPlace = NULL;
|
||||
|
||||
garInt = NULL;
|
||||
ourBar = new CStatusBar(72, 567, "ADROLLVR.bmp", 660);
|
||||
ourBar = new CStatusBar(pos.x+72, pos.y+567, "ADROLLVR.bmp", 660);
|
||||
|
||||
quitButton = new AdventureMapButton(CGI->generaltexth->heroscrn[17], std::string(), boost::function<void()>(), 674, 524, "hsbtns.def", SDLK_RETURN);
|
||||
dismissButton = new AdventureMapButton(std::string(), CGI->generaltexth->heroscrn[28], boost::bind(&CHeroWindow::dismissCurrent,this), 519, 437, "hsbtns2.def", SDLK_d);
|
||||
questlogButton = new AdventureMapButton(CGI->generaltexth->heroscrn[0], std::string(), boost::bind(&CHeroWindow::questlog,this), 379, 437, "hsbtns4.def", SDLK_q);
|
||||
quitButton = new AdventureMapButton(CGI->generaltexth->heroscrn[17], std::string(), boost::function<void()>(), pos.x+674, pos.y+524, "hsbtns.def", SDLK_RETURN);
|
||||
dismissButton = new AdventureMapButton(std::string(), CGI->generaltexth->heroscrn[28], boost::bind(&CHeroWindow::dismissCurrent,this), pos.x+519, pos.y+437, "hsbtns2.def", SDLK_d);
|
||||
questlogButton = new AdventureMapButton(CGI->generaltexth->heroscrn[0], std::string(), boost::bind(&CHeroWindow::questlog,this), pos.x+379, pos.y+437, "hsbtns4.def", SDLK_q);
|
||||
|
||||
formations = new CHighlightableButtonsGroup(0);
|
||||
formations->addButton(map_list_of(0,CGI->generaltexth->heroscrn[23]),CGI->generaltexth->heroscrn[29], "hsbtns6.def",546, 491, 0, 0, SDLK_t);
|
||||
formations->addButton(map_list_of(0,CGI->generaltexth->heroscrn[24]),CGI->generaltexth->heroscrn[30], "hsbtns7.def",546, 527, 1, 0, SDLK_l);
|
||||
formations->addButton(map_list_of(0,CGI->generaltexth->heroscrn[23]),CGI->generaltexth->heroscrn[29], "hsbtns6.def", pos.x+546, pos.y+491, 0, 0, SDLK_t);
|
||||
formations->addButton(map_list_of(0,CGI->generaltexth->heroscrn[24]),CGI->generaltexth->heroscrn[30], "hsbtns7.def", pos.x+546, pos.y+527, 1, 0, SDLK_l);
|
||||
|
||||
|
||||
gar2button = new CHighlightableButton(0, 0, map_list_of(0,CGI->generaltexth->heroscrn[26])(3,CGI->generaltexth->heroscrn[25]), CGI->generaltexth->heroscrn[31], false, "hsbtns8.def", NULL, 604, 491, SDLK_b);
|
||||
gar4button = new AdventureMapButton(CGI->generaltexth->allTexts[256], CGI->generaltexth->heroscrn[32], boost::function<void()>(), 604, 527, "hsbtns9.def", false, NULL, false);
|
||||
gar2button = new CHighlightableButton(0, 0, map_list_of(0,CGI->generaltexth->heroscrn[26])(3,CGI->generaltexth->heroscrn[25]), CGI->generaltexth->heroscrn[31], false, "hsbtns8.def", NULL, pos.x+604, pos.y+491, SDLK_b);
|
||||
gar4button = new AdventureMapButton(CGI->generaltexth->allTexts[256], CGI->generaltexth->heroscrn[32], boost::function<void()>(), pos.x+604, pos.y+527, "hsbtns9.def", false, NULL, false);
|
||||
boost::algorithm::replace_first(gar4button->hoverTexts[0],"%s",CGI->generaltexth->allTexts[43]);
|
||||
leftArtRoll = new AdventureMapButton(std::string(), std::string(), boost::bind(&CHeroWindow::leftArtRoller,this), 379, 364, "hsbtns3.def", SDLK_LEFT);
|
||||
rightArtRoll = new AdventureMapButton(std::string(), std::string(), boost::bind(&CHeroWindow::rightArtRoller,this), 632, 364, "hsbtns5.def", SDLK_RIGHT);
|
||||
leftArtRoll = new AdventureMapButton(std::string(), std::string(), boost::bind(&CHeroWindow::leftArtRoller,this), pos.x+379, pos.y+364, "hsbtns3.def", SDLK_LEFT);
|
||||
rightArtRoll = new AdventureMapButton(std::string(), std::string(), boost::bind(&CHeroWindow::rightArtRoller,this), pos.x+632, pos.y+364, "hsbtns5.def", SDLK_RIGHT);
|
||||
|
||||
|
||||
for(int g=0; g<8; ++g)
|
||||
{
|
||||
//heroList.push_back(new AdventureMapButton<CHeroWindow>(std::string(), std::string(), &CHeroWindow::switchHero, 677, 95+g*54, "hsbtns5.def", this));
|
||||
heroListMi.push_back(new LClickableAreaHero());
|
||||
heroListMi[g]->pos.x = 677;
|
||||
heroListMi[g]->pos.y = 95+g*54;
|
||||
heroListMi[g]->pos.x = pos.x+677;
|
||||
heroListMi[g]->pos.y = pos.y + 95+g*54;
|
||||
heroListMi[g]->pos.h = 32;
|
||||
heroListMi[g]->pos.w = 48;
|
||||
heroListMi[g]->owner = this;
|
||||
heroListMi[g]->id = g;
|
||||
}
|
||||
|
||||
|
||||
flags = CDefHandler::giveDef("CREST58.DEF");
|
||||
//areas
|
||||
portraitArea = new LRClickableAreaWText();
|
||||
portraitArea->pos.x = 83;
|
||||
portraitArea->pos.y = 26;
|
||||
portraitArea->pos.x = pos.x+83;
|
||||
portraitArea->pos.y = pos.y + 26;
|
||||
portraitArea->pos.w = 58;
|
||||
portraitArea->pos.h = 64;
|
||||
for(int v=0; v<4; ++v)
|
||||
{
|
||||
primSkillAreas.push_back(new LRClickableAreaWTextComp());
|
||||
primSkillAreas[v]->pos.x = 95 + 70*v;
|
||||
primSkillAreas[v]->pos.y = 111;
|
||||
primSkillAreas[v]->pos.x = pos.x+95 + 70*v;
|
||||
primSkillAreas[v]->pos.y = pos.y + 111;
|
||||
primSkillAreas[v]->pos.w = 42;
|
||||
primSkillAreas[v]->pos.h = 42;
|
||||
primSkillAreas[v]->text = CGI->generaltexth->arraytxt[2+v].substr(1, CGI->generaltexth->arraytxt[2+v].size()-2);
|
||||
@ -91,15 +93,15 @@ CHeroWindow::CHeroWindow(int playerColor):
|
||||
primSkillAreas[v]->baseType = 0;
|
||||
}
|
||||
expArea = new LRClickableAreaWText();
|
||||
expArea->pos.x = 83;
|
||||
expArea->pos.y = 236;
|
||||
expArea->pos.x = pos.x+83;
|
||||
expArea->pos.y = pos.y + 236;
|
||||
expArea->pos.w = 136;
|
||||
expArea->pos.h = 42;
|
||||
expArea->hoverText = CGI->generaltexth->heroscrn[9];
|
||||
|
||||
spellPointsArea = new LRClickableAreaWText();
|
||||
spellPointsArea->pos.x = 227;
|
||||
spellPointsArea->pos.y = 236;
|
||||
spellPointsArea->pos.x = pos.x+227;
|
||||
spellPointsArea->pos.y = pos.y + 236;
|
||||
spellPointsArea->pos.w = 136;
|
||||
spellPointsArea->pos.h = 42;
|
||||
spellPointsArea->hoverText = CGI->generaltexth->heroscrn[22];
|
||||
@ -107,12 +109,14 @@ CHeroWindow::CHeroWindow(int playerColor):
|
||||
for(int i=0; i<8; ++i)
|
||||
{
|
||||
secSkillAreas.push_back(new LRClickableAreaWTextComp());
|
||||
secSkillAreas[i]->pos.x = (i%2==0) ? (83) : (227);
|
||||
secSkillAreas[i]->pos.y = 284 + 48 * (i/2);
|
||||
secSkillAreas[i]->pos.x = pos.x + ((i%2==0) ? (83) : (227));
|
||||
secSkillAreas[i]->pos.y = pos.y + (284 + 48 * (i/2));
|
||||
secSkillAreas[i]->pos.w = 136;
|
||||
secSkillAreas[i]->pos.h = 42;
|
||||
secSkillAreas[i]->baseType = 1;
|
||||
}
|
||||
pos.x += 65;
|
||||
pos.y += 8;
|
||||
}
|
||||
|
||||
CHeroWindow::~CHeroWindow()
|
||||
@ -200,6 +204,9 @@ void CHeroWindow::setHero(const CGHeroInstance *Hero)
|
||||
}
|
||||
curHero = hero;
|
||||
|
||||
pos.x -= 65;
|
||||
pos.y -= 8;
|
||||
|
||||
gar2button->callback.clear();
|
||||
gar2button->callback2.clear();
|
||||
|
||||
@ -209,10 +216,10 @@ void CHeroWindow::setHero(const CGHeroInstance *Hero)
|
||||
sprintf(bufor, CGI->generaltexth->allTexts[15].c_str(), curHero->name.c_str(), curHero->type->heroClass->name.c_str());
|
||||
portraitArea->hoverText = std::string(bufor);
|
||||
|
||||
portraitArea->text = hero->biography;
|
||||
portraitArea->text = hero->getBiography();
|
||||
|
||||
delete garInt;
|
||||
/*gar4button->owner = */garInt = new CGarrisonInt(80, 493, 8, 0, curBack, 13, 482, curHero);
|
||||
/*gar4button->owner = */garInt = new CGarrisonInt(pos.x+80, pos.y+493, 8, 0, curBack, 13, 482, curHero);
|
||||
garInt->update = false;
|
||||
gar4button->callback = boost::bind(&CGarrisonInt::splitClick,garInt);//actualization of callback function
|
||||
|
||||
@ -249,11 +256,13 @@ void CHeroWindow::setHero(const CGHeroInstance *Hero)
|
||||
|
||||
std::vector<SDL_Rect> slotPos;
|
||||
|
||||
slotPos += genRect(44,44,509,30), genRect(44,44,567,240), genRect(44,44,509,80), genRect(44,44,383,68),
|
||||
genRect(44,44,564,183), genRect(44,44,509,130), genRect(44,44,431,68), genRect(44,44,610,183),
|
||||
genRect(44,44,515,295), genRect(44,44,383,143), genRect(44,44,399,194), genRect(44,44,415,245),
|
||||
genRect(44,44,431,296), genRect(44,44,564,30), genRect(44,44,610,30), genRect(44,44,610,76),
|
||||
genRect(44,44,610,122), genRect(44,44,610,310), genRect(44,44,381,296);
|
||||
slotPos += genRect(44,44,pos.x+509,pos.y+30), genRect(44,44,pos.x+567,pos.y+240), genRect(44,44,pos.x+509,pos.y+80),
|
||||
genRect(44,44,pos.x+383,pos.y+68), genRect(44,44,pos.x+564,pos.y+183), genRect(44,44,pos.x+509,pos.y+130),
|
||||
genRect(44,44,pos.x+431,pos.y+68), genRect(44,44,pos.x+610,pos.y+183), genRect(44,44,pos.x+515,pos.y+295),
|
||||
genRect(44,44,pos.x+383,pos.y+143), genRect(44,44,pos.x+399,pos.y+194), genRect(44,44,pos.x+415,pos.y+245),
|
||||
genRect(44,44,pos.x+431,pos.y+296), genRect(44,44,pos.x+564,pos.y+30), genRect(44,44,pos.x+610,pos.y+30),
|
||||
genRect(44,44,pos.x+610,pos.y+76), genRect(44,44,pos.x+610,pos.y+122), genRect(44,44,pos.x+610,pos.y+310),
|
||||
genRect(44,44,pos.x+381,pos.y+296);
|
||||
|
||||
for (int g = 0; g < 19 ; g++)
|
||||
{
|
||||
@ -292,8 +301,8 @@ void CHeroWindow::setHero(const CGHeroInstance *Hero)
|
||||
add = new CArtPlace(NULL);
|
||||
add->hoverText = CGI->generaltexth->allTexts[507];
|
||||
}
|
||||
add->pos.x = 403 + 46*s;
|
||||
add->pos.y = 365;
|
||||
add->pos.x = pos.x + 403 + 46*s;
|
||||
add->pos.y = pos.y + 365;
|
||||
add->pos.h = add->pos.w = 44;
|
||||
if(s<hero->artifacts.size() && hero->artifacts[s])
|
||||
add->text = hero->getArt(19+s)->description;
|
||||
@ -320,6 +329,9 @@ void CHeroWindow::setHero(const CGHeroInstance *Hero)
|
||||
formations->select(hero->army.formation,true);
|
||||
formations->onChange = boost::bind(&CCallback::setFormation, LOCPLINT->cb, Hero, _1);
|
||||
|
||||
pos.x += 65;
|
||||
pos.y += 8;
|
||||
|
||||
redrawCurBack();
|
||||
}
|
||||
|
||||
|
9
CMT.cpp
9
CMT.cpp
@ -122,18 +122,17 @@ int main(int argc, char** argv)
|
||||
CGI->spellh = VLC->spellh;
|
||||
CGI->dobjinfo = VLC->dobjinfo;
|
||||
CGI->buildh = VLC->buildh;
|
||||
CGI->generaltexth = VLC->generaltexth;
|
||||
tlog0<<"Initializing VCMI_Lib: "<<tmh.getDif()<<std::endl;
|
||||
pomtime.getDif();
|
||||
cgi->curh = new CCursorHandler;
|
||||
cgi->curh->initCursor();
|
||||
cgi->curh->show();
|
||||
tlog0<<"\tScreen handler: "<<pomtime.getDif()<<std::endl;
|
||||
CAbilityHandler * abilh = new CAbilityHandler;
|
||||
abilh->loadAbilities();
|
||||
cgi->abilh = abilh;
|
||||
tlog0<<"\tAbility handler: "<<pomtime.getDif()<<std::endl;
|
||||
CGI->preth = new CPreGameTextHandler;
|
||||
CGI->preth->loadTexts();
|
||||
tlog0<<"\tCPreGameTextHandler: "<<pomtime.getDif()<<std::endl;
|
||||
tlog0<<"Preparing first handlers: "<<tmh.getDif()<<std::endl;
|
||||
pomtime.getDif();
|
||||
graphics = new Graphics();
|
||||
@ -145,9 +144,7 @@ int main(int argc, char** argv)
|
||||
tlog0<<"\tHero animations: "<<tmh.getDif()<<std::endl;
|
||||
tlog0<<"Initializing game graphics: "<<tmh.getDif()<<std::endl;
|
||||
CMessage::init();
|
||||
cgi->generaltexth = new CGeneralTextHandler;
|
||||
cgi->generaltexth->load();
|
||||
tlog0<<"Preparing more handlers: "<<tmh.getDif()<<std::endl;
|
||||
tlog0<<"Message handler: "<<tmh.getDif()<<std::endl;
|
||||
CPreGame * cpg = new CPreGame(); //main menu and submenus
|
||||
tlog0<<"Initialization CPreGame (together): "<<tmh.getDif()<<std::endl;
|
||||
tlog0<<"Initialization of VCMI (togeter): "<<total.getDif()<<std::endl;
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "hch/CHeroHandler.h"
|
||||
#include "hch/CLodHandler.h"
|
||||
#include "hch/CObjectHandler.h"
|
||||
#include "hch/CPreGameTextHandler.h"
|
||||
#include "hch/CSpellHandler.h"
|
||||
#include "hch/CTownHandler.h"
|
||||
#include "lib/CondSh.h"
|
||||
@ -632,7 +631,7 @@ void SComponent::init(Etype Type, int Subtype, int Val)
|
||||
break;
|
||||
case primskill:
|
||||
description = CGI->generaltexth->arraytxt[2+Subtype];
|
||||
oss << ((Val>0)?("+"):("-")) << Val << " " << CGI->heroh->pskillsn[Subtype];
|
||||
oss << ((Val>0)?("+"):("-")) << Val << " " << CGI->generaltexth->primarySkillNames[Subtype];
|
||||
subtitle = oss.str();
|
||||
break;
|
||||
case secskill44:
|
||||
@ -1380,7 +1379,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||
{
|
||||
if(details.dst.x+1 == details.src.x && details.dst.y+1 == details.src.y) //tl
|
||||
{
|
||||
//seting advmap shift
|
||||
//setting advmap shift
|
||||
adventureInt->terrain.moveX = i-32;
|
||||
adventureInt->terrain.moveY = i-32;
|
||||
|
||||
@ -1401,7 +1400,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||
}
|
||||
else if(details.dst.x == details.src.x && details.dst.y+1 == details.src.y) //t
|
||||
{
|
||||
//seting advmap shift
|
||||
//setting advmap shift
|
||||
adventureInt->terrain.moveY = i-32;
|
||||
|
||||
subRect(hp.x-2, hp.y-2, hp.z, genRect(32, 32, 0, -31+i), ho->id);
|
||||
@ -1418,7 +1417,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||
}
|
||||
else if(details.dst.x-1 == details.src.x && details.dst.y+1 == details.src.y) //tr
|
||||
{
|
||||
//seting advmap shift
|
||||
//setting advmap shift
|
||||
adventureInt->terrain.moveX = -i+32;
|
||||
adventureInt->terrain.moveY = i-32;
|
||||
|
||||
@ -1439,7 +1438,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||
}
|
||||
else if(details.dst.x-1 == details.src.x && details.dst.y == details.src.y) //r
|
||||
{
|
||||
//seting advmap shift
|
||||
//setting advmap shift
|
||||
adventureInt->terrain.moveX = -i+32;
|
||||
|
||||
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, -1-i, 0), ho->id);
|
||||
@ -1455,7 +1454,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||
else if(details.dst.x-1 == details.src.x && details.dst.y-1 == details.src.y) //br
|
||||
{
|
||||
|
||||
//seting advmap shift
|
||||
//setting advmap shift
|
||||
adventureInt->terrain.moveX = -i+32;
|
||||
adventureInt->terrain.moveY = -i+32;
|
||||
|
||||
@ -1476,7 +1475,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||
}
|
||||
else if(details.dst.x == details.src.x && details.dst.y-1 == details.src.y) //b
|
||||
{
|
||||
//seting advmap shift
|
||||
//setting advmap shift
|
||||
adventureInt->terrain.moveY = -i+32;
|
||||
|
||||
subRect(hp.x-2, hp.y-1, hp.z, genRect(32, 32, 0, -1-i), ho->id);
|
||||
@ -1493,7 +1492,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||
}
|
||||
else if(details.dst.x+1 == details.src.x && details.dst.y-1 == details.src.y) //bl
|
||||
{
|
||||
//seting advmap shift
|
||||
//setting advmap shift
|
||||
adventureInt->terrain.moveX = i-32;
|
||||
adventureInt->terrain.moveY = -i+32;
|
||||
|
||||
@ -1514,7 +1513,7 @@ void CPlayerInterface::heroMoved(const HeroMoveDetails & details)
|
||||
}
|
||||
else if(details.dst.x+1 == details.src.x && details.dst.y == details.src.y) //l
|
||||
{
|
||||
//seting advmap shift
|
||||
//setting advmap shift
|
||||
adventureInt->terrain.moveX = i-32;
|
||||
|
||||
subRect(hp.x-3, hp.y-1, hp.z, genRect(32, 32, -31+i, 0), ho->id);
|
||||
@ -2497,7 +2496,7 @@ void CHeroList::mouseMoved (const SDL_MouseMotionEvent & sEvent)
|
||||
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
|
||||
{
|
||||
if (from>0)
|
||||
LOCPLINT->adventureInt->statusbar.print(CGI->preth->zelp[303].first);
|
||||
LOCPLINT->adventureInt->statusbar.print(CGI->generaltexth->zelp[303].first);
|
||||
else
|
||||
LOCPLINT->adventureInt->statusbar.clear();
|
||||
return;
|
||||
@ -2505,7 +2504,7 @@ void CHeroList::mouseMoved (const SDL_MouseMotionEvent & sEvent)
|
||||
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
|
||||
{
|
||||
if ((items.size()-from) > SIZE)
|
||||
LOCPLINT->adventureInt->statusbar.print(CGI->preth->zelp[304].first);
|
||||
LOCPLINT->adventureInt->statusbar.print(CGI->generaltexth->zelp[304].first);
|
||||
else
|
||||
LOCPLINT->adventureInt->statusbar.clear();
|
||||
return;
|
||||
@ -2533,11 +2532,11 @@ void CHeroList::clickRight(tribool down)
|
||||
/***************************ARROWS*****************************************/
|
||||
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0)
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[303].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->generaltexth->zelp[303].second,down,this);
|
||||
}
|
||||
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>5))
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[304].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->generaltexth->zelp[304].second,down,this);
|
||||
}
|
||||
//if not buttons then heroes
|
||||
int hx = LOCPLINT->current->motion.x, hy = LOCPLINT->current->motion.y;
|
||||
@ -2558,8 +2557,8 @@ void CHeroList::clickRight(tribool down)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[303].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[304].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->generaltexth->zelp[303].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->generaltexth->zelp[304].second,down,this);
|
||||
}
|
||||
}
|
||||
void CHeroList::hover (bool on)
|
||||
@ -2691,7 +2690,7 @@ void CTownList::mouseMoved (const SDL_MouseMotionEvent & sEvent)
|
||||
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
|
||||
{
|
||||
if (from>0)
|
||||
LOCPLINT->statusbar->print(CGI->preth->zelp[306].first);
|
||||
LOCPLINT->statusbar->print(CGI->generaltexth->zelp[306].first);
|
||||
else
|
||||
LOCPLINT->statusbar->clear();
|
||||
return;
|
||||
@ -2699,7 +2698,7 @@ void CTownList::mouseMoved (const SDL_MouseMotionEvent & sEvent)
|
||||
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
|
||||
{
|
||||
if ((items.size()-from) > SIZE)
|
||||
LOCPLINT->statusbar->print(CGI->preth->zelp[307].first);
|
||||
LOCPLINT->statusbar->print(CGI->generaltexth->zelp[307].first);
|
||||
else
|
||||
LOCPLINT->statusbar->clear();
|
||||
return;
|
||||
@ -2741,7 +2740,10 @@ void CTownList::clickLeft(tribool down)
|
||||
int ny = hy/32;
|
||||
if (ny>SIZE || ny<0)
|
||||
return;
|
||||
if (SIZE==5 && (ny+from)==selected && (LOCPLINT->adventureInt->selection->ID == TOWNI_TYPE))
|
||||
if(LOCPLINT->curint == LOCPLINT->adventureInt
|
||||
&& (ny+from)==selected
|
||||
&& LOCPLINT->adventureInt->selection->ID == TOWNI_TYPE
|
||||
)
|
||||
LOCPLINT->openTownWindow(items[selected]);//print town screen
|
||||
else
|
||||
select(ny+from);
|
||||
@ -2787,11 +2789,11 @@ void CTownList::clickRight(tribool down)
|
||||
/***************************ARROWS*****************************************/
|
||||
if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0)
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[306].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->generaltexth->zelp[306].second,down,this);
|
||||
}
|
||||
else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>5))
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[307].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->generaltexth->zelp[307].second,down,this);
|
||||
}
|
||||
//if not buttons then towns
|
||||
int hx = LOCPLINT->current->motion.x, hy = LOCPLINT->current->motion.y;
|
||||
@ -2809,8 +2811,8 @@ void CTownList::clickRight(tribool down)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[306].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->preth->zelp[307].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->generaltexth->zelp[306].second,down,this);
|
||||
LOCPLINT->adventureInt->handleRightClick(CGI->generaltexth->zelp[307].second,down,this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3188,7 +3190,7 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
|
||||
printAtMiddle(c->namePl,149,30,GEOR13,zwykly,bitmap); //creature name
|
||||
|
||||
//atttack
|
||||
printAt(CGI->preth->zelp[435].first,155,48,GEOR13,zwykly,bitmap);
|
||||
printAt(CGI->generaltexth->zelp[435].first,155,48,GEOR13,zwykly,bitmap);
|
||||
SDL_itoa(c->attack,pom,10);
|
||||
if(State && State->attackBonus)
|
||||
{
|
||||
@ -3205,7 +3207,7 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
|
||||
printToWR(pom,276,61,GEOR13,zwykly,bitmap);
|
||||
|
||||
//defense
|
||||
printAt(CGI->preth->zelp[436].first,155,67,GEOR13,zwykly,bitmap);
|
||||
printAt(CGI->generaltexth->zelp[436].first,155,67,GEOR13,zwykly,bitmap);
|
||||
SDL_itoa(c->defence,pom,10);
|
||||
if(State && State->defenseBonus)
|
||||
{
|
||||
@ -3244,20 +3246,20 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
|
||||
printToWR(pom,276,118,GEOR13,zwykly,bitmap);
|
||||
|
||||
//health
|
||||
printAt(CGI->preth->zelp[439].first,155,124,GEOR13,zwykly,bitmap);
|
||||
printAt(CGI->generaltexth->zelp[439].first,155,124,GEOR13,zwykly,bitmap);
|
||||
SDL_itoa(c->hitPoints,pom,10);
|
||||
printToWR(pom,276,137,GEOR13,zwykly,bitmap);
|
||||
|
||||
//remaining health
|
||||
if(State && State->currentHealth)
|
||||
{
|
||||
printAt(CGI->preth->zelp[440].first,155,143,GEOR13,zwykly,bitmap);
|
||||
printAt(CGI->generaltexth->zelp[440].first,155,143,GEOR13,zwykly,bitmap);
|
||||
SDL_itoa(State->currentHealth,pom,10);
|
||||
printToWR(pom,276,156,GEOR13,zwykly,bitmap);
|
||||
}
|
||||
|
||||
//speed
|
||||
printAt(CGI->preth->zelp[441].first,155,162,GEOR13,zwykly,bitmap);
|
||||
printAt(CGI->generaltexth->zelp[441].first,155,162,GEOR13,zwykly,bitmap);
|
||||
SDL_itoa(c->speed,pom,10);
|
||||
printToWR(pom,276,175,GEOR13,zwykly,bitmap);
|
||||
|
||||
@ -3288,11 +3290,11 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
|
||||
CFunctionList<void()> cfl;
|
||||
cfl = boost::bind(&CCreInfoWindow::deactivate,this);
|
||||
cfl += boost::bind(&CPlayerInterface::showYesNoDialog,LOCPLINT,CGI->generaltexth->allTexts[207],boost::ref(upgResCost),fs[0],fs[1],false,false);
|
||||
upgrade = new AdventureMapButton("",CGI->preth->zelp[446].second,cfl,pos.x+76,pos.y+237,"IVIEWCR.DEF",SDLK_u);
|
||||
upgrade = new AdventureMapButton("",CGI->generaltexth->zelp[446].second,cfl,pos.x+76,pos.y+237,"IVIEWCR.DEF",SDLK_u);
|
||||
}
|
||||
else
|
||||
{
|
||||
upgrade = new AdventureMapButton("",CGI->preth->zelp[446].second,boost::function<void()>(),pos.x+76,pos.y+237,"IVIEWCR.DEF");
|
||||
upgrade = new AdventureMapButton("",CGI->generaltexth->zelp[446].second,boost::function<void()>(),pos.x+76,pos.y+237,"IVIEWCR.DEF");
|
||||
upgrade->callback.funcs.clear();
|
||||
upgrade->bitmapOffset = 2;
|
||||
}
|
||||
@ -3308,9 +3310,9 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
|
||||
CFunctionList<void()> cfl;
|
||||
cfl = boost::bind(&CCreInfoWindow::deactivate,this);
|
||||
cfl += boost::bind(&CPlayerInterface::showYesNoDialog,LOCPLINT,CGI->generaltexth->allTexts[12],std::vector<SComponent*>(),fs[0],fs[1],false,false);
|
||||
dismiss = new AdventureMapButton("",CGI->preth->zelp[445].second,cfl,pos.x+21,pos.y+237,"IVIEWCR2.DEF",SDLK_d);
|
||||
dismiss = new AdventureMapButton("",CGI->generaltexth->zelp[445].second,cfl,pos.x+21,pos.y+237,"IVIEWCR2.DEF",SDLK_d);
|
||||
}
|
||||
ok = new AdventureMapButton("",CGI->preth->zelp[445].second,boost::bind(&CCreInfoWindow::close,this),pos.x+216,pos.y+237,"IOKAY.DEF",SDLK_RETURN);
|
||||
ok = new AdventureMapButton("",CGI->generaltexth->zelp[445].second,boost::bind(&CCreInfoWindow::close,this),pos.x+216,pos.y+237,"IOKAY.DEF",SDLK_RETURN);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3844,16 +3846,16 @@ CSystemOptionsWindow::CSystemOptionsWindow(const SDL_Rect &pos, CPlayerInterface
|
||||
CSDL_Ext::printAt(CGI->generaltexth->allTexts[577], 283, 217, GEOR16, zwykly, background); //spell book animation
|
||||
|
||||
//setting up buttons
|
||||
quitGame = new AdventureMapButton (CGI->preth->zelp[324].first, CGI->preth->zelp[324].second, boost::bind(&CSystemOptionsWindow::bquitf, this), 405, 471, "soquit.def", SDLK_q);
|
||||
quitGame = new AdventureMapButton (CGI->generaltexth->zelp[324].first, CGI->generaltexth->zelp[324].second, boost::bind(&CSystemOptionsWindow::bquitf, this), 405, 471, "soquit.def", SDLK_q);
|
||||
std::swap(quitGame->imgs[0][0], quitGame->imgs[0][1]);
|
||||
backToMap = new AdventureMapButton (CGI->preth->zelp[325].first, CGI->preth->zelp[325].second, boost::bind(&CSystemOptionsWindow::breturnf, this), 516, 471, "soretrn.def", SDLK_RETURN);
|
||||
backToMap = new AdventureMapButton (CGI->generaltexth->zelp[325].first, CGI->generaltexth->zelp[325].second, boost::bind(&CSystemOptionsWindow::breturnf, this), 516, 471, "soretrn.def", SDLK_RETURN);
|
||||
std::swap(backToMap->imgs[0][0], backToMap->imgs[0][1]);
|
||||
|
||||
heroMoveSpeed = new CHighlightableButtonsGroup(0);
|
||||
heroMoveSpeed->addButton(boost::assign::map_list_of(0,CGI->preth->zelp[349].first),CGI->preth->zelp[349].second, "sysopb1.def", 187, 134, 1);
|
||||
heroMoveSpeed->addButton(boost::assign::map_list_of(0,CGI->preth->zelp[350].first),CGI->preth->zelp[350].second, "sysopb2.def", 235, 134, 2);
|
||||
heroMoveSpeed->addButton(boost::assign::map_list_of(0,CGI->preth->zelp[351].first),CGI->preth->zelp[351].second, "sysopb3.def", 283, 134, 4);
|
||||
heroMoveSpeed->addButton(boost::assign::map_list_of(0,CGI->preth->zelp[352].first),CGI->preth->zelp[352].second, "sysopb4.def", 331, 134, 8);
|
||||
heroMoveSpeed->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[349].first),CGI->generaltexth->zelp[349].second, "sysopb1.def", 187, 134, 1);
|
||||
heroMoveSpeed->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[350].first),CGI->generaltexth->zelp[350].second, "sysopb2.def", 235, 134, 2);
|
||||
heroMoveSpeed->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[351].first),CGI->generaltexth->zelp[351].second, "sysopb3.def", 283, 134, 4);
|
||||
heroMoveSpeed->addButton(boost::assign::map_list_of(0,CGI->generaltexth->zelp[352].first),CGI->generaltexth->zelp[352].second, "sysopb4.def", 331, 134, 8);
|
||||
heroMoveSpeed->select(owner->heroMoveSpeed, 1);
|
||||
heroMoveSpeed->onChange = boost::bind(&CPlayerInterface::setHeroMoveSpeed, owner, _1);
|
||||
}
|
||||
|
77
CPreGame.cpp
77
CPreGame.cpp
@ -770,10 +770,10 @@ void Options::show()
|
||||
playersSoFar++;
|
||||
}
|
||||
CSDL_Ext::printAtMiddleWB(CGI->generaltexth->allTexts[516],221,63,GEOR13,55,zwykly);
|
||||
CSDL_Ext::printAtMiddleWB(CGI->preth->getTitle(CGI->preth->zelp[256].second),109,109,GEOR13,14);
|
||||
CSDL_Ext::printAtMiddleWB(CGI->preth->getTitle(CGI->preth->zelp[259].second),201,109,GEOR13,10);
|
||||
CSDL_Ext::printAtMiddleWB(CGI->preth->getTitle(CGI->preth->zelp[260].second),275,109,GEOR13,10);
|
||||
CSDL_Ext::printAtMiddleWB(CGI->preth->getTitle(CGI->preth->zelp[261].second),354,109,GEOR13,10);
|
||||
CSDL_Ext::printAtMiddleWB(CGI->generaltexth->getTitle(CGI->generaltexth->zelp[256].second),109,109,GEOR13,14);
|
||||
CSDL_Ext::printAtMiddleWB(CGI->generaltexth->getTitle(CGI->generaltexth->zelp[259].second),201,109,GEOR13,10);
|
||||
CSDL_Ext::printAtMiddleWB(CGI->generaltexth->getTitle(CGI->generaltexth->zelp[260].second),275,109,GEOR13,10);
|
||||
CSDL_Ext::printAtMiddleWB(CGI->generaltexth->getTitle(CGI->generaltexth->zelp[261].second),354,109,GEOR13,10);
|
||||
turnLength->activate();
|
||||
for (int i=0;i<poptions.size();i++)
|
||||
showIcon(-2,i,false);
|
||||
@ -992,10 +992,9 @@ void MapSel::show()
|
||||
void MapSel::processMaps(std::vector<std::string> &pliczkiTemp, int &index)
|
||||
{
|
||||
static boost::mutex mx;
|
||||
bool areMaps=true;
|
||||
int pom=-1;
|
||||
int pom=-1, read;
|
||||
unsigned char sss[1000];
|
||||
while(areMaps)
|
||||
while(true)
|
||||
{
|
||||
mx.lock();
|
||||
if(index>=pliczkiTemp.size())
|
||||
@ -1009,25 +1008,14 @@ void MapSel::processMaps(std::vector<std::string> &pliczkiTemp, int &index)
|
||||
mx.unlock();
|
||||
}
|
||||
gzFile tempf = gzopen(pliczkiTemp[pom].c_str(),"rb");
|
||||
int iii=0;
|
||||
while(true)
|
||||
{
|
||||
if (iii>=1000) break;
|
||||
int z = gzgetc (tempf);
|
||||
if (z>=0)
|
||||
{
|
||||
sss[iii++] = (unsigned char)z;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
read = gzread(tempf, sss, 1000);
|
||||
gzclose(tempf);
|
||||
|
||||
if(iii<50)
|
||||
if(read < 50)
|
||||
{
|
||||
tlog3<<"\t\tWarning: corrupted map file: "<<pliczkiTemp[pom]<<std::endl;
|
||||
continue;
|
||||
}
|
||||
if (!sss[4])
|
||||
if (!sss[4]) //not a valid map
|
||||
{
|
||||
//tlog3 << "\t\tSkipping " << pliczkiTemp[pom] << " - map marked as unplayable.\n";
|
||||
continue;
|
||||
@ -1048,12 +1036,13 @@ void MapSel::init()
|
||||
fs::directory_iterator end_iter;
|
||||
for ( fs::directory_iterator dir (tie); dir!=end_iter; ++dir )
|
||||
{
|
||||
if (fs::is_regular(dir->status()));
|
||||
if (fs::is_regular_file(dir->status()));
|
||||
{
|
||||
if (boost::ends_with(dir->path().leaf(),std::string(".h3m")))
|
||||
if (boost::ends_with(dir->path().filename(),".h3m"))
|
||||
pliczkiTemp.push_back("Maps/"+(dir->path().leaf()));
|
||||
}
|
||||
}
|
||||
ourMaps.reserve(pliczkiTemp.size());
|
||||
|
||||
int mapInd=0;
|
||||
boost::thread_group group;
|
||||
@ -1233,7 +1222,7 @@ void MapSel::printSelectedInfo()
|
||||
SDL_BlitSurface(CPG->ourScenSel->bOptions.imgs->ourImages[0].bitmap,NULL,screen,&CPG->ourScenSel->bOptions.pos);
|
||||
SDL_BlitSurface(CPG->ourScenSel->bRandom.imgs->ourImages[0].bitmap,NULL,screen,&CPG->ourScenSel->bRandom.pos);
|
||||
//blit texts
|
||||
CSDL_Ext::printAt(CGI->preth->zelp[21].second,420,25,GEOR13);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->zelp[21].second,420,25,GEOR13);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->allTexts[496],420,135,GEOR13);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->allTexts[497],420,285,GEOR13);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->allTexts[498],420,340,GEOR13);
|
||||
@ -1242,14 +1231,14 @@ void MapSel::printSelectedInfo()
|
||||
|
||||
int temp = ourMaps[selected].victoryCondition+1;
|
||||
if (temp>20) temp=0;
|
||||
std::string sss = CGI->preth->victoryConditions[temp];
|
||||
if (temp && ourMaps[selected].vicConDetails->allowNormalVictory) sss+= "/" + CGI->preth->victoryConditions[0];
|
||||
std::string sss = CGI->generaltexth->victoryConditions[temp];
|
||||
if (temp && ourMaps[selected].vicConDetails->allowNormalVictory) sss+= "/" + CGI->generaltexth->victoryConditions[0];
|
||||
CSDL_Ext::printAt(sss,452,310,GEOR13,zwykly);
|
||||
|
||||
|
||||
temp = ourMaps[selected].lossCondition.typeOfLossCon+1;
|
||||
if (temp>20) temp=0;
|
||||
sss = CGI->preth->lossCondtions[temp];
|
||||
sss = CGI->generaltexth->lossCondtions[temp];
|
||||
CSDL_Ext::printAt(sss,452,370,GEOR13,zwykly);
|
||||
|
||||
//blit descrption
|
||||
@ -1266,19 +1255,19 @@ void MapSel::printSelectedInfo()
|
||||
switch (ourMaps[selected].difficulty)
|
||||
{
|
||||
case 0:
|
||||
diff=gdiff(CGI->preth->zelp[24].second);
|
||||
diff=gdiff(CGI->generaltexth->zelp[24].second);
|
||||
break;
|
||||
case 1:
|
||||
diff=gdiff(CGI->preth->zelp[25].second);
|
||||
diff=gdiff(CGI->generaltexth->zelp[25].second);
|
||||
break;
|
||||
case 2:
|
||||
diff=gdiff(CGI->preth->zelp[26].second);
|
||||
diff=gdiff(CGI->generaltexth->zelp[26].second);
|
||||
break;
|
||||
case 3:
|
||||
diff=gdiff(CGI->preth->zelp[27].second);
|
||||
diff=gdiff(CGI->generaltexth->zelp[27].second);
|
||||
break;
|
||||
case 4:
|
||||
diff=gdiff(CGI->preth->zelp[28].second);
|
||||
diff=gdiff(CGI->generaltexth->zelp[28].second);
|
||||
break;
|
||||
}
|
||||
temp=-1;
|
||||
@ -1676,7 +1665,7 @@ void CPreGame::highlightButton(int which, int on)
|
||||
void CPreGame::showCenBox (std::string data)
|
||||
{
|
||||
CMessage * cmh = new CMessage();
|
||||
SDL_Surface * infoBox = cmh->genMessage(CGI->preth->getTitle(data), CGI->preth->getDescr(data));
|
||||
SDL_Surface * infoBox = cmh->genMessage(CGI->generaltexth->getTitle(data), CGI->generaltexth->getDescr(data));
|
||||
behindCurMes = CSDL_Ext::newSurface(infoBox->w,infoBox->h,screen);
|
||||
SDL_Rect pos = genRect(infoBox->h,infoBox->w,
|
||||
(screen->w/2)-(infoBox->w/2),(screen->h/2)-(infoBox->h/2));
|
||||
@ -1694,7 +1683,7 @@ void CPreGame::showAskBox (std::string data, void(*f1)(),void(*f2)())
|
||||
std::vector<SDL_Rect> * btnspos= new std::vector<SDL_Rect>(0);
|
||||
przyciski->push_back(ok);
|
||||
przyciski->push_back(cancel);
|
||||
SDL_Surface * infoBox = cmh->genMessage(CGI->preth->getTitle(data), CGI->preth->getDescr(data), yesOrNO, przyciski, btnspos);
|
||||
SDL_Surface * infoBox = cmh->genMessage(CGI->generaltexth->getTitle(data), CGI->generaltexth->getDescr(data), yesOrNO, przyciski, btnspos);
|
||||
behindCurMes = CSDL_Ext::newSurface(infoBox->w,infoBox->h,screen);
|
||||
SDL_Rect pos = genRect(infoBox->h,infoBox->w,
|
||||
(screen->w/2)-(infoBox->w/2),(screen->h/2)-(infoBox->h/2));
|
||||
@ -2112,15 +2101,15 @@ std::string CPreGame::buttonText(int which)
|
||||
switch (which)
|
||||
{
|
||||
case 0:
|
||||
return CGI->preth->zelp[3].second;
|
||||
return CGI->generaltexth->zelp[3].second;
|
||||
case 1:
|
||||
return CGI->preth->zelp[4].second;
|
||||
return CGI->generaltexth->zelp[4].second;
|
||||
case 2:
|
||||
return CGI->preth->zelp[5].second;
|
||||
return CGI->generaltexth->zelp[5].second;
|
||||
case 3:
|
||||
return CGI->preth->zelp[6].second;
|
||||
return CGI->generaltexth->zelp[6].second;
|
||||
case 4:
|
||||
return CGI->preth->zelp[7].second;
|
||||
return CGI->generaltexth->zelp[7].second;
|
||||
}
|
||||
}
|
||||
else if (state==newGame || state==loadGame)
|
||||
@ -2128,15 +2117,15 @@ std::string CPreGame::buttonText(int which)
|
||||
switch (which)
|
||||
{
|
||||
case 0:
|
||||
return CGI->preth->zelp[10].second;
|
||||
return CGI->generaltexth->zelp[10].second;
|
||||
case 1:
|
||||
return CGI->preth->zelp[11].second;
|
||||
return CGI->generaltexth->zelp[11].second;
|
||||
case 2:
|
||||
return CGI->preth->zelp[12].second;
|
||||
return CGI->generaltexth->zelp[12].second;
|
||||
case 3:
|
||||
return CGI->preth->zelp[13].second;
|
||||
return CGI->generaltexth->zelp[13].second;
|
||||
case 4:
|
||||
return CGI->preth->zelp[14].second;
|
||||
return CGI->generaltexth->zelp[14].second;
|
||||
}
|
||||
}
|
||||
return std::string();
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <set>
|
||||
#include "SDL.h"
|
||||
#include "StartInfo.h"
|
||||
#include "hch/CPreGameTextHandler.h"
|
||||
#include "CMessage.h"
|
||||
#include "map.h"
|
||||
#include "hch/CMusicHandler.h"
|
||||
|
@ -207,10 +207,30 @@ struct SettingsGrammar : public grammar<SettingsGrammar>
|
||||
| str_p("ResDataBar:") >>
|
||||
*(
|
||||
( "x=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::resdatabarX)]
|
||||
| "y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::resdatabarY)]
|
||||
| "y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::resdatabarY)]
|
||||
| "offsetX=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::resOffsetX)]
|
||||
| "offsetY=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::resOffsetY)]
|
||||
| "resSpace=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::resDist)]
|
||||
| "resDateSpace=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::resDateDist)]
|
||||
| "graphic=" >> fname[SetAdventureStr(&AdventureMapConfig::resdatabarG)]
|
||||
)
|
||||
)
|
||||
| str_p("InfoBox:") >>
|
||||
*(
|
||||
( "x=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::infoboxX)]
|
||||
| "y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::infoboxY)]
|
||||
)
|
||||
)
|
||||
| str_p("AdvMap:") >>
|
||||
*(
|
||||
( "x=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapX)]
|
||||
| "y=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapY)]
|
||||
| "trimX=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapTrimX)]
|
||||
| "trimY=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::advmapTrimY)]
|
||||
| "tilesWidth=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::tilesW)]
|
||||
| "tilesHeight=" >> uint_p[SetAdventureProp_a(&AdventureMapConfig::tilesH)]
|
||||
)
|
||||
)
|
||||
| str_p("background=") >> fname[SetAdventureStr(&AdventureMapConfig::mainGraphic)]
|
||||
| str_p("Button") >> (+(anychar_p-':'))[SetCurButton()] >> ':' >>
|
||||
*(
|
||||
|
@ -25,8 +25,12 @@ namespace config
|
||||
int statusbarX, statusbarY; //pos
|
||||
std::string statusbarG; //graphic name
|
||||
//resdatabar
|
||||
int resdatabarX, resdatabarY; //pos
|
||||
int resdatabarX, resdatabarY, resDist, resDateDist, resOffsetX, resOffsetY; //pos
|
||||
std::string resdatabarG; //graphic name
|
||||
//infobox
|
||||
int infoboxX, infoboxY;
|
||||
//advmap
|
||||
int tilesW, tilesH, advmapX, advmapY, advmapTrimX, advmapTrimY;
|
||||
//general properties
|
||||
std::string mainGraphic;
|
||||
//buttons
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "../hch/CDefHandler.h"
|
||||
#include "../hch/CObjectHandler.h"
|
||||
#include "../hch/CSpellHandler.h"
|
||||
#include "../hch/CPreGameTextHandler.h"
|
||||
#include "../hch/CGeneralTextHandler.h"
|
||||
#include "../CAdvmapInterface.h"
|
||||
#include "../CBattleInterface.h"
|
||||
@ -218,29 +217,29 @@ CSpellWindow::CSpellWindow(const SDL_Rect & myRect, const CGHeroInstance * myHer
|
||||
|
||||
statusBar = new CStatusBar(97, 571, "Spelroll.bmp");
|
||||
SDL_Rect temp_rect = genRect(45, 35, 569, 407);
|
||||
exitBtn = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fexitb, this), CGI->preth->zelp[460].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[460].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
exitBtn = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fexitb, this), CGI->generaltexth->zelp[460].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[460].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
temp_rect = genRect(45, 35, 311, 407);
|
||||
battleSpells = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fbattleSpellsb, this), CGI->preth->zelp[453].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[453].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
battleSpells = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fbattleSpellsb, this), CGI->generaltexth->zelp[453].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[453].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
temp_rect = genRect(45, 35, 445, 407);
|
||||
adventureSpells = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fadvSpellsb, this), CGI->preth->zelp[452].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[452].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
adventureSpells = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fadvSpellsb, this), CGI->generaltexth->zelp[452].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[452].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
temp_rect = genRect(45, 35, 508, 407);
|
||||
manaPoints = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fmanaPtsb, this), CGI->preth->zelp[459].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[459].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
manaPoints = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fmanaPtsb, this), CGI->generaltexth->zelp[459].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[459].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
|
||||
temp_rect = genRect(36, 56, 639, 96);
|
||||
selectSpellsA = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsAb, this), CGI->preth->zelp[454].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[454].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
selectSpellsA = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsAb, this), CGI->generaltexth->zelp[454].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[454].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
temp_rect = genRect(36, 56, 639, 153);
|
||||
selectSpellsE = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsEb, this), CGI->preth->zelp[457].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[457].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
selectSpellsE = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsEb, this), CGI->generaltexth->zelp[457].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[457].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
temp_rect = genRect(36, 56, 639, 212);
|
||||
selectSpellsF = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsFb, this), CGI->preth->zelp[455].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[455].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
selectSpellsF = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsFb, this), CGI->generaltexth->zelp[455].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[455].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
temp_rect = genRect(36, 56, 639, 272);
|
||||
selectSpellsW = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsWb, this), CGI->preth->zelp[456].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[456].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
selectSpellsW = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsWb, this), CGI->generaltexth->zelp[456].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[456].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
temp_rect = genRect(36, 56, 639, 332);
|
||||
selectSpellsAll = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsAllb, this), CGI->preth->zelp[458].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[458].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
selectSpellsAll = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fspellsAllb, this), CGI->generaltexth->zelp[458].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[458].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
|
||||
temp_rect = genRect(leftCorner->h, leftCorner->w, 187, 79);
|
||||
lCorner = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fLcornerb, this), CGI->preth->zelp[450].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[450].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
lCorner = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fLcornerb, this), CGI->generaltexth->zelp[450].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[450].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
temp_rect = genRect(rightCorner->h, rightCorner->w, 577, 76);
|
||||
rCorner = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fRcornerb, this), CGI->preth->zelp[451].second, boost::bind(&CStatusBar::print, statusBar, (CGI->preth->zelp[451].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
rCorner = new SpellbookInteractiveArea(temp_rect, boost::bind(&CSpellWindow::fRcornerb, this), CGI->generaltexth->zelp[451].second, boost::bind(&CStatusBar::print, statusBar, (CGI->generaltexth->zelp[451].first)), boost::bind(&CStatusBar::clear, statusBar));
|
||||
|
||||
//areas for spells
|
||||
int xpos = 207, ypos = 92;
|
||||
|
@ -318,10 +318,6 @@
|
||||
RelativePath="..\CGameInterface.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CGeneralTextHandler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\CHeroWindow.cpp"
|
||||
>
|
||||
@ -358,10 +354,6 @@
|
||||
RelativePath="..\CPreGame.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CPreGameTextHandler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CSndHandler.cpp"
|
||||
>
|
||||
@ -464,10 +456,6 @@
|
||||
RelativePath="..\CGameInterface.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CGeneralTextHandler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CHeroHandler.h"
|
||||
>
|
||||
@ -508,10 +496,6 @@
|
||||
RelativePath="..\CPreGame.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CPreGameTextHandler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CSndHandler.h"
|
||||
>
|
||||
|
@ -8,7 +8,7 @@ clientSettings
|
||||
fullscreen=0; //0 - windowed mode, 1 - fullscreen
|
||||
server=127.0.0.1; //use 127.0.0.1 for localhost
|
||||
localInformation=2; //0 - *all* information sent from server (safest and slowest); 1 - map information sent from server; 2 - all information local-storaged
|
||||
defaultAI=EmptyAI.dll;
|
||||
defaultAI=GeniusAI.dll;
|
||||
}
|
||||
GUISettings
|
||||
{
|
||||
@ -16,6 +16,8 @@ GUISettings
|
||||
{
|
||||
AdventureMap
|
||||
{
|
||||
AdvMap: x=7 y=6 tilesWidth=19 tilesHeight=18 trimX=15 trimY=29;
|
||||
InfoBox: x=605 y=389;
|
||||
gem0: x=6 y=508 graphic=agemLL.def;
|
||||
gem1: x=556 y=508 graphic=agemLR.def;
|
||||
gem2: x=6 y=6 graphic=agemUL.def;
|
||||
@ -25,7 +27,7 @@ GUISettings
|
||||
TownList: size=5 x=747 y=196 arrowUp=IAM014.DEF arrowDown=IAM015.DEF;
|
||||
Minimap: width=144 height=144 x=630 y=26;
|
||||
Statusbar: x=7 y=556 graphic=ADROLLVR.bmp;
|
||||
ResDataBar: x=3 y=575 graphic=ZRESBAR.bmp;
|
||||
ResDataBar: x=3 y=575 graphic=ZRESBAR.bmp offsetX=32 offsetY=2 resSpace=85 resDateSpace=85;
|
||||
ButtonKingdomOv: x=679 y=196 graphic=IAM002.DEF playerColoured=1;
|
||||
ButtonUnderground: x=711 y=196 graphic=IAM010.DEF playerColoured=1 additionalDefs=(IAM003.DEF);
|
||||
ButtonQuestLog: x=679 y=228 graphic=IAM004.DEF playerColoured=1;
|
||||
@ -42,12 +44,57 @@ GUISettings
|
||||
{
|
||||
AdventureMap
|
||||
{
|
||||
AdvMap: x=7 y=6 tilesWidth=19 tilesHeight=18 trimX=15 trimY=29;
|
||||
InfoBox: x=829 y=389;
|
||||
gem0: x=6 y=508 graphic=agemLL.def;
|
||||
gem1: x=780 y=508 graphic=agemLR.def;
|
||||
gem2: x=6 y=6 graphic=agemUL.def;
|
||||
gem3: x=780 y=6 graphic=agemUR.def;
|
||||
background=ADVMAP3.pcx;
|
||||
HeroList: size=5 x=832 y=196 movePoints=IMOBIL.DEF manaPoints=IMANA.DEF arrowUp=IAM012.DEF arrowDown=IAM013.DEF;
|
||||
TownList: size=5 x=970 y=196 arrowUp=IAM014.DEF arrowDown=IAM015.DEF;
|
||||
Minimap: width=144 height=144 x=854 y=26;
|
||||
Statusbar: x=8 y=556 graphic=ADROLLVR2.pcx;
|
||||
ResDataBar: x=0 y=575 graphic=ZRESBAR2.pcx offsetX=32 offsetY=2 resSpace=85;
|
||||
ButtonKingdomOv: x=902 y=196 graphic=IAM002.DEF playerColoured=1;
|
||||
ButtonUnderground: x=934 y=196 graphic=IAM010.DEF playerColoured=1 additionalDefs=(IAM003.DEF);
|
||||
ButtonQuestLog: x=902 y=228 graphic=IAM004.DEF playerColoured=1;
|
||||
ButtonSleepWake: x=934 y=228 graphic=IAM005.DEF playerColoured=1;
|
||||
ButtonMoveHero: x=902 y=260 graphic=IAM006.DEF playerColoured=1;
|
||||
ButtonSpellbook: x=934 y=260 graphic=IAM007.DEF playerColoured=1;
|
||||
ButtonAdvOptions: x=902 y=292 graphic=IAM008.DEF playerColoured=1;
|
||||
ButtonSysOptions: x=934 y=292 graphic=IAM009.DEF playerColoured=1;
|
||||
ButtonNextHero: x=902 y=324 graphic=IAM000.DEF playerColoured=1;
|
||||
ButtonEndTurn: x=902 y=356 graphic=IAM001.DEF playerColoured=1;
|
||||
|
||||
};
|
||||
}
|
||||
1024x768 //setting specific for this resolution
|
||||
{
|
||||
AdventureMap
|
||||
{
|
||||
AdvMap: x=7 y=6 tilesWidth=26 tilesHeight=23 trimX=15 trimY=20;
|
||||
InfoBox: x=829 y=557;
|
||||
gem0: x=6 y=676 graphic=agemLL.def;
|
||||
gem1: x=780 y=676 graphic=agemLR.def;
|
||||
gem2: x=6 y=6 graphic=agemUL.def;
|
||||
gem3: x=780 y=6 graphic=agemUR.def;
|
||||
background=ADVMAP2.pcx;
|
||||
HeroList: size=10 x=832 y=201 movePoints=IMOBIL.DEF manaPoints=IMANA.DEF arrowUp=IAM012.DEF arrowDown=IAM013.DEF;
|
||||
TownList: size=10 x=970 y=201 arrowUp=IAM014.DEF arrowDown=IAM015.DEF;
|
||||
Minimap: width=144 height=144 x=854 y=26;
|
||||
Statusbar: x=8 y=856 graphic=ADROLLVR2.pcx;
|
||||
ResDataBar: x=0 y=743 graphic=ZRESBAR2.pcx offsetX=65 offsetY=2 resSpace=109 resDateSpace=135;
|
||||
ButtonKingdomOv: x=903 y=197 graphic=IAM002.DEF playerColoured=1;
|
||||
ButtonUnderground: x=903 y=230 graphic=IAM010.DEF playerColoured=1 additionalDefs=(IAM003.DEF);
|
||||
ButtonQuestLog: x=903 y=261 graphic=IAM004.DEF playerColoured=1;
|
||||
ButtonSleepWake: x=903 y=294 graphic=IAM005.DEF playerColoured=1;
|
||||
ButtonMoveHero: x=903 y=327 graphic=IAM006.DEF playerColoured=1;
|
||||
ButtonSpellbook: x=903 y=359 graphic=IAM007.DEF playerColoured=1;
|
||||
ButtonAdvOptions: x=903 y=393 graphic=IAM008.DEF playerColoured=1;
|
||||
ButtonSysOptions: x=903 y=426 graphic=IAM009.DEF playerColoured=1;
|
||||
ButtonNextHero: x=903 y=491 graphic=IAM000.DEF playerColoured=1;
|
||||
ButtonEndTurn: x=903 y=524 graphic=IAM001.DEF playerColoured=1;
|
||||
};
|
||||
}
|
||||
}
|
@ -41,24 +41,7 @@ void CArtHandler::loadArtifacts()
|
||||
nart.id=i;
|
||||
artifacts.push_back(nart);
|
||||
}
|
||||
for(int i=0;i<144;i++) //do 144, bo nie chcemy bzdurek
|
||||
{
|
||||
switch (artifacts[i].aClass)
|
||||
{
|
||||
case TartClass:
|
||||
treasures.push_back(&(artifacts[i]));
|
||||
break;
|
||||
case NartClass:
|
||||
minors.push_back(&(artifacts[i]));
|
||||
break;
|
||||
case JartClass:
|
||||
majors.push_back(&(artifacts[i]));
|
||||
break;
|
||||
case RartClass:
|
||||
relics.push_back(&(artifacts[i]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
sortArts();
|
||||
}
|
||||
|
||||
int CArtHandler::convertMachineID(int id, bool creToArt )
|
||||
@ -90,4 +73,26 @@ int CArtHandler::convertMachineID(int id, bool creToArt )
|
||||
}
|
||||
}
|
||||
return id + dif;
|
||||
}
|
||||
|
||||
void CArtHandler::sortArts()
|
||||
{
|
||||
for(int i=0;i<144;i++) //do 144, bo nie chcemy bzdurek
|
||||
{
|
||||
switch (artifacts[i].aClass)
|
||||
{
|
||||
case TartClass:
|
||||
treasures.push_back(&(artifacts[i]));
|
||||
break;
|
||||
case NartClass:
|
||||
minors.push_back(&(artifacts[i]));
|
||||
break;
|
||||
case JartClass:
|
||||
majors.push_back(&(artifacts[i]));
|
||||
break;
|
||||
case RartClass:
|
||||
relics.push_back(&(artifacts[i]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -20,7 +20,10 @@ public:
|
||||
EartClass aClass;
|
||||
int id;
|
||||
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & isAllowed & name & description & price & possibleSlots & aClass & id ;
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_EXPORT CArtHandler //handles artifacts
|
||||
@ -28,9 +31,18 @@ class DLL_EXPORT CArtHandler //handles artifacts
|
||||
public:
|
||||
std::vector<CArtifact*> treasures, minors, majors, relics;
|
||||
std::vector<CArtifact> artifacts;
|
||||
|
||||
void loadArtifacts();
|
||||
void sortArts();
|
||||
static int convertMachineID(int id, bool creToArt);
|
||||
CArtHandler();
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & artifacts;
|
||||
if(!h.saving)
|
||||
sortArts();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CARTHANDLER_H
|
||||
|
@ -28,6 +28,10 @@ public:
|
||||
else
|
||||
return subid<por.subid;
|
||||
}
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & name & visitMap & blockMap & visitDir & id & subid &terrainAllowed & terrainMenu & width & height & type & printPriority;
|
||||
}
|
||||
CGDefInfo();
|
||||
};
|
||||
class DLL_EXPORT CDefObjInfoHandler
|
||||
|
@ -1,12 +1,15 @@
|
||||
#define VCMI_DLL
|
||||
#include "../stdafx.h"
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
#include "CGeneralTextHandler.h"
|
||||
#include "../CGameInfo.h"
|
||||
#include "CLodHandler.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <fstream>
|
||||
|
||||
void CGeneralTextHandler::load()
|
||||
{
|
||||
std::string buf = CGI->bitmaph->getTextFile("GENRLTXT.TXT"), tmp;
|
||||
std::string buf = bitmaph->getTextFile("GENRLTXT.TXT"), tmp;
|
||||
int andame = buf.size();
|
||||
int i=0; //buf iterator
|
||||
for(i; i<andame; ++i)
|
||||
@ -25,7 +28,7 @@ void CGeneralTextHandler::load()
|
||||
allTexts.push_back(buflet);
|
||||
}
|
||||
|
||||
std::string strs = CGI->bitmaph->getTextFile("ARRAYTXT.TXT");
|
||||
std::string strs = bitmaph->getTextFile("ARRAYTXT.TXT");
|
||||
|
||||
int itr=0;
|
||||
while(itr<strs.length()-1)
|
||||
@ -35,7 +38,7 @@ void CGeneralTextHandler::load()
|
||||
}
|
||||
|
||||
itr = 0;
|
||||
std::string strin = CGI->bitmaph->getTextFile("PRISKILL.TXT");
|
||||
std::string strin = bitmaph->getTextFile("PRISKILL.TXT");
|
||||
for(int hh=0; hh<4; ++hh)
|
||||
{
|
||||
loadToIt(tmp, strin, itr, 3);
|
||||
@ -43,7 +46,7 @@ void CGeneralTextHandler::load()
|
||||
}
|
||||
|
||||
itr = 0;
|
||||
std::string strin2 = CGI->bitmaph->getTextFile("JKTEXT.TXT");
|
||||
std::string strin2 = bitmaph->getTextFile("JKTEXT.TXT");
|
||||
for(int hh=0; hh<45; ++hh)
|
||||
{
|
||||
loadToIt(tmp, strin2, itr, 3);
|
||||
@ -51,17 +54,115 @@ void CGeneralTextHandler::load()
|
||||
}
|
||||
|
||||
itr = 0;
|
||||
std::string strin3 = CGI->bitmaph->getTextFile("HEROSCRN.TXT");
|
||||
std::string strin3 = bitmaph->getTextFile("HEROSCRN.TXT");
|
||||
for(int hh=0; hh<33; ++hh)
|
||||
{
|
||||
loadToIt(tmp, strin3, itr, 3);
|
||||
heroscrn.push_back(tmp);
|
||||
}
|
||||
|
||||
strin3 = CGI->bitmaph->getTextFile("ARTEVENT.TXT");
|
||||
strin3 = bitmaph->getTextFile("ARTEVENT.TXT");
|
||||
for(itr = 0; itr<strin3.size();itr++)
|
||||
{
|
||||
loadToIt(tmp, strin3, itr, 3);
|
||||
artifEvents.push_back(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string CGeneralTextHandler::getTitle(std::string text)
|
||||
{
|
||||
std::string ret;
|
||||
int i=0;
|
||||
while ((text[i++]!='{'));
|
||||
while ((text[i]!='}') && (i<text.length()))
|
||||
ret+=text[i++];
|
||||
return ret;
|
||||
}
|
||||
std::string CGeneralTextHandler::getDescr(std::string text)
|
||||
{
|
||||
std::string ret;
|
||||
int i=0;
|
||||
while ((text[i++]!='}'));
|
||||
i+=2;
|
||||
while ((text[i]!='"') && (i<text.length()))
|
||||
ret+=text[i++];
|
||||
return ret;
|
||||
}
|
||||
void CGeneralTextHandler::loadTexts()
|
||||
{
|
||||
std::string buf1 = bitmaph->getTextFile("ZELP.TXT");
|
||||
int itr=0, eol=-1, eolnext=-1, pom;
|
||||
eolnext = buf1.find_first_of('\r',itr);
|
||||
while(itr<buf1.size())
|
||||
{
|
||||
eol = eolnext; //end of this line
|
||||
eolnext = buf1.find_first_of('\r',eol+1); //end of the next line
|
||||
pom=buf1.find_first_of('\t',itr); //upcoming tab
|
||||
if(eol<0 || pom<0)
|
||||
break;
|
||||
if(pom>eol) //in current line there is not tab
|
||||
zelp.push_back(std::pair<std::string,std::string>());
|
||||
else
|
||||
{
|
||||
zelp.push_back
|
||||
(std::pair<std::string,std::string>
|
||||
(buf1.substr(itr,pom-itr),
|
||||
buf1.substr(pom+1,eol-pom-1)));
|
||||
boost::algorithm::replace_all(zelp[zelp.size()-1].first,"\t","");
|
||||
boost::algorithm::replace_all(zelp[zelp.size()-1].second,"\t","");
|
||||
}
|
||||
itr=eol+2;
|
||||
}
|
||||
std::string buf = bitmaph->getTextFile("VCDESC.TXT");
|
||||
int andame = buf.size();
|
||||
int i=0; //buf iterator
|
||||
for(int gg=0; gg<14; ++gg)
|
||||
{
|
||||
int befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
break;
|
||||
}
|
||||
victoryConditions[gg] = buf.substr(befi, i-befi);
|
||||
i+=2;
|
||||
}
|
||||
buf = bitmaph->getTextFile("LCDESC.TXT");
|
||||
andame = buf.size();
|
||||
i=0; //buf iterator
|
||||
for(int gg=0; gg<4; ++gg)
|
||||
{
|
||||
int befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
break;
|
||||
}
|
||||
lossCondtions[gg] = buf.substr(befi, i-befi);
|
||||
i+=2;
|
||||
}
|
||||
|
||||
hTxts.resize(HEROES_QUANTITY);
|
||||
|
||||
buf = bitmaph->getTextFile("HEROSPEC.TXT");
|
||||
i=0;
|
||||
std::string dump;
|
||||
for(int iii=0; iii<2; ++iii)
|
||||
{
|
||||
loadToIt(dump,buf,i,3);
|
||||
}
|
||||
for (int iii=0;iii<hTxts.size();iii++)
|
||||
{
|
||||
loadToIt(hTxts[iii].bonusName,buf,i,4);
|
||||
loadToIt(hTxts[iii].shortBonus,buf,i,4);
|
||||
loadToIt(hTxts[iii].longBonus,buf,i,3);
|
||||
}
|
||||
|
||||
buf = bitmaph->getTextFile("HEROBIOS.TXT");
|
||||
i=0;
|
||||
for (int iii=0;iii<hTxts.size();iii++)
|
||||
{
|
||||
loadToIt(hTxts[iii].biography,buf,i,3);
|
||||
}
|
||||
}
|
@ -4,9 +4,17 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
DLL_EXPORT void loadToIt(std::string &dest, std::string &src, int &iter, int mode);
|
||||
class CGeneralTextHandler //Handles general texts
|
||||
class DLL_EXPORT CGeneralTextHandler //Handles general texts
|
||||
{
|
||||
public:
|
||||
class HeroTexts
|
||||
{
|
||||
public:
|
||||
std::string bonusName, shortBonus, longBonus; //for special abilities
|
||||
std::string biography; //biography, of course
|
||||
};
|
||||
|
||||
std::vector<HeroTexts> hTxts;
|
||||
std::vector<std::string> allTexts;
|
||||
|
||||
std::vector<std::string> arraytxt;
|
||||
@ -15,6 +23,14 @@ public:
|
||||
std::vector<std::string> heroscrn;
|
||||
std::vector<std::string> artifEvents;
|
||||
|
||||
std::vector<std::pair<std::string,std::string> > zelp;
|
||||
std::string lossCondtions[4];
|
||||
std::string victoryConditions[14];
|
||||
|
||||
std::string getTitle(std::string text);
|
||||
std::string getDescr(std::string text);
|
||||
|
||||
void loadTexts();
|
||||
void load();
|
||||
};
|
||||
|
||||
|
@ -10,6 +10,7 @@ void loadToIt(std::string &dest, std::string &src, int &iter, int mode);
|
||||
CHeroClass::CHeroClass()
|
||||
{
|
||||
skillLimit = 8;
|
||||
moveAnim = NULL;
|
||||
}
|
||||
CHeroClass::~CHeroClass()
|
||||
{
|
||||
@ -30,21 +31,11 @@ int CHeroClass::chooseSecSkill(const std::set<int> & possibles) const //picks se
|
||||
if(ran<0)
|
||||
return *i;
|
||||
}
|
||||
throw std::string("Cannot pick secondary skill!");
|
||||
}
|
||||
|
||||
CHeroHandler::~CHeroHandler()
|
||||
{}
|
||||
void CHeroHandler::loadPortraits()
|
||||
{
|
||||
std::string strs = bitmaph->getTextFile("PRISKILL.TXT");
|
||||
int itr=0;
|
||||
for (int i=0; i<PRIMARY_SKILLS; i++)
|
||||
{
|
||||
std::string tmp;
|
||||
loadToIt(tmp, strs, itr, 3);
|
||||
pskillsn.push_back(tmp);
|
||||
}
|
||||
}
|
||||
void CHeroHandler::loadHeroes()
|
||||
{
|
||||
VLC->heroh = this;
|
||||
@ -140,8 +131,6 @@ void CHeroHandler::loadHeroes()
|
||||
}
|
||||
//initial skills loaded
|
||||
|
||||
loadSpecialAbilities();
|
||||
loadBiographies();
|
||||
loadHeroClasses();
|
||||
initHeroClasses();
|
||||
expPerLevel.push_back(0);
|
||||
@ -162,33 +151,6 @@ void CHeroHandler::loadHeroes()
|
||||
return;
|
||||
|
||||
}
|
||||
void CHeroHandler::loadSpecialAbilities()
|
||||
{
|
||||
std::string buf = bitmaph->getTextFile("HEROSPEC.TXT");
|
||||
int it=0;
|
||||
std::string dump;
|
||||
for(int i=0; i<2; ++i)
|
||||
{
|
||||
loadToIt(dump,buf,it,3);
|
||||
}
|
||||
for (int i=0;i<heroes.size();i++)
|
||||
{
|
||||
loadToIt(heroes[i]->bonusName,buf,it,4);
|
||||
loadToIt(heroes[i]->shortBonus,buf,it,4);
|
||||
loadToIt(heroes[i]->longBonus,buf,it,3);
|
||||
}
|
||||
}
|
||||
|
||||
void CHeroHandler::loadBiographies()
|
||||
{
|
||||
std::string buf = bitmaph->getTextFile("HEROBIOS.TXT");
|
||||
int it=0;
|
||||
for (int i=0;i<heroes.size();i++)
|
||||
{
|
||||
loadToIt(heroes[i]->biography,buf,it,3);
|
||||
}
|
||||
}
|
||||
|
||||
void CHeroHandler::loadHeroClasses()
|
||||
{
|
||||
std::string buf = bitmaph->getTextFile("HCTRAITS.TXT");
|
||||
|
@ -15,13 +15,16 @@ public:
|
||||
int ID;
|
||||
int lowStack[3], highStack[3]; //amount of units; described below
|
||||
std::string refTypeStack[3]; //reference names of units appearing in hero's army if he is recruited in tavern
|
||||
std::string bonusName, shortBonus, longBonus; //for special abilities
|
||||
std::string biography; //biography, of course
|
||||
bool isAllowed; //true if we can play with this hero (depends on map)
|
||||
CHeroClass * heroClass;
|
||||
EHeroClasses heroType; //hero class
|
||||
std::vector<std::pair<int,int> > secSkillsInit; //initial secondaryskills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
|
||||
std::vector<std::pair<ui8,ui8> > secSkillsInit; //initial secondary skills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
|
||||
//bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & name & ID & lowStack & highStack & refTypeStack & heroType & ID;
|
||||
//hero class pointer is restored by herohandler
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_EXPORT CHeroClass
|
||||
@ -34,11 +37,18 @@ public:
|
||||
std::vector<std::pair<int,int> > primChance;//primChance[PRIMARY_SKILL_ID] - first is for levels 2 - 9, second for 10+;;; probability (%) of getting point of primary skill when getting new level
|
||||
std::vector<int> proSec; //probabilities of gaining secondary skills (out of 112), in id order
|
||||
int selectionProbability[9]; //probability of selection in towns
|
||||
std::vector<int> terrCosts; //default costs of going through terrains: dirt, sand, grass, snow, swamp, rough, subterrain, lava, water, rock; -1 means terrain is imapassable
|
||||
std::vector<int> terrCosts; //default costs of going through terrains: dirt, sand, grass, snow, swamp, rough, subterranean, lava, water, rock; -1 means terrain is imapassable
|
||||
CDefHandler * moveAnim; //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
|
||||
|
||||
int chooseSecSkill(const std::set<int> & possibles) const; //picks secondary skill out from given possibilities
|
||||
CHeroClass();
|
||||
~CHeroClass();
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & skillLimit & name & aggression & initialAttack & initialDefence & initialPower & initialKnowledge & primChance
|
||||
& proSec & selectionProbability & terrCosts;
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_EXPORT CHeroHandler
|
||||
@ -46,17 +56,27 @@ class DLL_EXPORT CHeroHandler
|
||||
public:
|
||||
std::vector<CHero*> heroes; //by³o nodrze
|
||||
std::vector<CHeroClass *> heroClasses;
|
||||
std::vector<std::string> pskillsn;
|
||||
std::vector<int> expPerLevel; //expPerLEvel[i] is amount of exp needed to reach level i; if it is not in this vector, multiplicate last value by 1,2 to get next value
|
||||
|
||||
unsigned int level(unsigned int experience);
|
||||
unsigned int reqExp(unsigned int level);
|
||||
void loadHeroes();
|
||||
void loadSpecialAbilities();
|
||||
void loadBiographies();
|
||||
void loadHeroClasses();
|
||||
void loadPortraits(); //loads names of primary skills
|
||||
void initHeroClasses();
|
||||
~CHeroHandler();
|
||||
void initTerrainCosts();
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & heroClasses & heroes & expPerLevel;
|
||||
if(!h.saving)
|
||||
{
|
||||
//restore class pointers
|
||||
for (int i=0; i<heroes.size(); i++)
|
||||
{
|
||||
heroes[i]->heroClass = heroClasses[heroes[i]->heroType];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif //CHEROHANDLER_H
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "CObjectHandler.h"
|
||||
#include "CDefObjInfoHandler.h"
|
||||
#include "CLodHandler.h"
|
||||
#include "CGeneralTextHandler.h"
|
||||
#include "CDefObjInfoHandler.h"
|
||||
#include "CHeroHandler.h"
|
||||
#include "CSpellHandler.h"
|
||||
@ -600,7 +601,7 @@ void CGHeroInstance::initHero()
|
||||
artifWorn[17] = 0; //give him spellbook
|
||||
}
|
||||
|
||||
if(portrait < 0)
|
||||
if(portrait < 0 || portrait == 255)
|
||||
portrait = subID;
|
||||
if((!primSkills.size()) || (getPrimSkillLevel(0)<0))
|
||||
{
|
||||
@ -610,14 +611,12 @@ void CGHeroInstance::initHero()
|
||||
primSkills[2] = type->heroClass->initialPower;
|
||||
primSkills[3] = type->heroClass->initialKnowledge;
|
||||
}
|
||||
if(secSkills.size() == 1 && secSkills[0] == std::make_pair(-1, -1)) //set secondary skills to default
|
||||
if(secSkills.size() == 1 && secSkills[0] == std::pair<ui8,ui8>(-1, -1)) //set secondary skills to default
|
||||
secSkills = type->secSkillsInit;
|
||||
if(mana < 0)
|
||||
mana = manaLimit();
|
||||
if (!name.length())
|
||||
name = type->name;
|
||||
if (!biography.length())
|
||||
biography = type->biography;
|
||||
if (exp == 0xffffffff)
|
||||
{
|
||||
exp=40+ (ran()) % 50;
|
||||
@ -666,6 +665,14 @@ bool CGHeroInstance::needsLastStack() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const std::string & CGHeroInstance::getBiography()
|
||||
{
|
||||
if (biography.length())
|
||||
return biography;
|
||||
else
|
||||
return VLC->generaltexth->hTxts[subID].biography;
|
||||
}
|
||||
CGTownInstance::~CGTownInstance()
|
||||
{}
|
||||
|
||||
|
@ -89,11 +89,11 @@ public:
|
||||
ui32 exp; //experience point
|
||||
int level; //current level of hero
|
||||
std::string name; //may be custom
|
||||
std::string biography; //may be custom
|
||||
std::string biography; //if custom
|
||||
int portrait; //may be custom
|
||||
int mana; // remaining spell points
|
||||
std::vector<int> primSkills; //0-attack, 1-defence, 2-spell power, 3-knowledge
|
||||
std::vector<std::pair<int,int> > secSkills; //first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert); if hero has ability (-1, -1) it meansthat it should have default secondary abilities
|
||||
std::vector<std::pair<ui8,ui8> > secSkills; //first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert); if hero has ability (-1, -1) it meansthat it should have default secondary abilities
|
||||
int movement; //remaining movement points
|
||||
int identifier; //from the map file
|
||||
bool sex;
|
||||
@ -113,6 +113,7 @@ public:
|
||||
std::map<ui16,ui32> artifWorn; //map<position,artifact_id>; positions: 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
|
||||
std::set<ui32> spells; //known spells (spell IDs)
|
||||
|
||||
const std::string &getBiography();
|
||||
bool needsLastStack()const;
|
||||
virtual bool isHero() const;
|
||||
unsigned int getTileCost(const EterrainType & ttype, const Eroad & rdtype, const Eriver & rvtype) const;
|
||||
|
@ -1,79 +0,0 @@
|
||||
#include "../stdafx.h"
|
||||
#include "CPreGameTextHandler.h"
|
||||
#include "../CGameInfo.h"
|
||||
#include "CLodHandler.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
std::string CPreGameTextHandler::getTitle(std::string text)
|
||||
{
|
||||
std::string ret;
|
||||
int i=0;
|
||||
while ((text[i++]!='{'));
|
||||
while ((text[i]!='}') && (i<text.length()))
|
||||
ret+=text[i++];
|
||||
return ret;
|
||||
}
|
||||
std::string CPreGameTextHandler::getDescr(std::string text)
|
||||
{
|
||||
std::string ret;
|
||||
int i=0;
|
||||
while ((text[i++]!='}'));
|
||||
i+=2;
|
||||
while ((text[i]!='"') && (i<text.length()))
|
||||
ret+=text[i++];
|
||||
return ret;
|
||||
}
|
||||
void CPreGameTextHandler::loadTexts()
|
||||
{
|
||||
std::string buf1 = CGI->bitmaph->getTextFile("ZELP.TXT");
|
||||
int itr=0, eol=-1, eolnext=-1, pom;
|
||||
eolnext = buf1.find_first_of('\r',itr);
|
||||
while(itr<buf1.size())
|
||||
{
|
||||
eol = eolnext; //end of this line
|
||||
eolnext = buf1.find_first_of('\r',eol+1); //end of the next line
|
||||
pom=buf1.find_first_of('\t',itr); //upcoming tab
|
||||
if(eol<0 || pom<0)
|
||||
break;
|
||||
if(pom>eol) //in current line there is not tab
|
||||
zelp.push_back(std::pair<std::string,std::string>());
|
||||
else
|
||||
{
|
||||
zelp.push_back
|
||||
(std::pair<std::string,std::string>
|
||||
(buf1.substr(itr,pom-itr),
|
||||
buf1.substr(pom+1,eol-pom-1)));
|
||||
boost::algorithm::replace_all(zelp[zelp.size()-1].first,"\t","");
|
||||
boost::algorithm::replace_all(zelp[zelp.size()-1].second,"\t","");
|
||||
}
|
||||
itr=eol+2;
|
||||
}
|
||||
std::string buf = CGI->bitmaph->getTextFile("VCDESC.TXT");
|
||||
int andame = buf.size();
|
||||
int i=0; //buf iterator
|
||||
for(int gg=0; gg<14; ++gg)
|
||||
{
|
||||
int befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
break;
|
||||
}
|
||||
victoryConditions[gg] = buf.substr(befi, i-befi);
|
||||
i+=2;
|
||||
}
|
||||
buf = CGI->bitmaph->getTextFile("LCDESC.TXT");
|
||||
andame = buf.size();
|
||||
i=0; //buf iterator
|
||||
for(int gg=0; gg<4; ++gg)
|
||||
{
|
||||
int befi=i;
|
||||
for(i; i<andame; ++i)
|
||||
{
|
||||
if(buf[i]=='\r')
|
||||
break;
|
||||
}
|
||||
lossCondtions[gg] = buf.substr(befi, i-befi);
|
||||
i+=2;
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#ifndef CPREGAMETEXTHANDLER_H
|
||||
#define CPREGAMETEXTHANDLER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class CPreGameTextHandler //handles pre - game texts
|
||||
{
|
||||
public:
|
||||
|
||||
std::vector<std::pair<std::string,std::string> > zelp;
|
||||
std::string lossCondtions[4];
|
||||
std::string victoryConditions[14];
|
||||
|
||||
std::string getTitle(std::string text);
|
||||
std::string getDescr(std::string text);
|
||||
|
||||
void loadTexts();
|
||||
};
|
||||
|
||||
|
||||
#endif //CPREGAMETEXTHANDLER_H
|
@ -228,8 +228,15 @@ public:
|
||||
}
|
||||
void saveSerializable(const std::string &data)
|
||||
{
|
||||
*this << ui32(data.size());
|
||||
this->This()->write(data.c_str(),data.size());
|
||||
if(!data.length())
|
||||
{
|
||||
*this << ui8(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
*this << ui32(data.length());
|
||||
this->This()->write(data.c_str(),data.size());
|
||||
}
|
||||
}
|
||||
template <typename T1, typename T2>
|
||||
void saveSerializable(const std::pair<T1,T2> &data)
|
||||
@ -346,10 +353,14 @@ public:
|
||||
}
|
||||
void loadSerializable(std::string &data)
|
||||
{
|
||||
ui32 l;
|
||||
*this >> l;
|
||||
data.resize(l);
|
||||
this->This()->read((void*)data.c_str(),l);
|
||||
ui8 length[4];
|
||||
*this >> length[0];
|
||||
if(!length[0]) return;
|
||||
*this >> length[1];
|
||||
*this >> length[2];
|
||||
*this >> length[3];
|
||||
data.resize(*((ui32*)length));
|
||||
this->This()->read((void*)data.c_str(),*((ui32*)length));
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "../hch/CTownHandler.h"
|
||||
#include "../hch/CBuildingHandler.h"
|
||||
#include "../hch/CSpellHandler.h"
|
||||
#include "../hch/CGeneralTextHandler.h"
|
||||
class CLodHandler;
|
||||
LibClasses * VLC = NULL;
|
||||
CLodHandler * bitmaph=NULL;
|
||||
@ -30,7 +31,6 @@ DLL_EXPORT void initDLL(CLodHandler *b, CConsoleHandler *Console, std::ostream *
|
||||
|
||||
CHeroHandler * heroh = new CHeroHandler;
|
||||
heroh->loadHeroes();
|
||||
heroh->loadPortraits();
|
||||
VLC->heroh = heroh;
|
||||
tlog0 <<"\tHero handler: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
@ -65,6 +65,11 @@ DLL_EXPORT void initDLL(CLodHandler *b, CConsoleHandler *Console, std::ostream *
|
||||
spellh->loadSpells();
|
||||
VLC->spellh = spellh;
|
||||
tlog0<<"\tSpell handler: "<<pomtime.getDif()<<std::endl;
|
||||
|
||||
VLC->generaltexth = new CGeneralTextHandler;
|
||||
VLC->generaltexth->loadTexts();
|
||||
VLC->generaltexth->load();
|
||||
tlog0<<"\tGeneral text handler: "<<pomtime.getDif()<<std::endl;
|
||||
}
|
||||
|
||||
DLL_EXPORT void loadToIt(std::string &dest, std::string &src, int &iter, int mode)
|
||||
|
@ -15,7 +15,7 @@ class CObjectHandler;
|
||||
//class CSemiLodHandler;
|
||||
class CDefObjInfoHandler;
|
||||
class CTownHandler;
|
||||
//class CGeneralTextHandler;
|
||||
class CGeneralTextHandler;
|
||||
//class CConsoleHandler;
|
||||
//class CPathfinder;
|
||||
//class CGameState;
|
||||
@ -23,27 +23,23 @@ class CTownHandler;
|
||||
class LibClasses
|
||||
{
|
||||
public:
|
||||
//CGameState * state;
|
||||
CArtHandler * arth;
|
||||
CHeroHandler * heroh;
|
||||
CCreatureHandler * creh;
|
||||
//CAbilityHandler * abilh;
|
||||
CSpellHandler * spellh;
|
||||
//CPreGameTextHandler * preth;
|
||||
CBuildingHandler * buildh;
|
||||
CObjectHandler * objh;
|
||||
CDefObjInfoHandler * dobjinfo;
|
||||
CTownHandler * townh;
|
||||
//CGeneralTextHandler * generaltexth;
|
||||
//CConsoleHandler * consoleh;
|
||||
CGeneralTextHandler * generaltexth;
|
||||
//CPathfinder * pathf;
|
||||
};
|
||||
|
||||
extern DLL_EXPORT LibClasses * VLC;
|
||||
extern CLodHandler * bitmaph;
|
||||
|
||||
DLL_EXPORT void loadToIt(std::string &dest, std::string &src, int &iter, int mode);
|
||||
DLL_EXPORT void loadToIt(si32 &dest, std::string &src, int &iter, int mode);
|
||||
|
||||
DLL_EXPORT void initDLL(CLodHandler *b, CConsoleHandler *Console, std::ostream *Logfile);
|
||||
|
||||
#endif //VCMI_LIB_H
|
||||
|
@ -282,6 +282,10 @@
|
||||
RelativePath="..\CGameState.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CGeneralTextHandler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CHeroHandler.cpp"
|
||||
>
|
||||
@ -352,6 +356,10 @@
|
||||
RelativePath="..\CGameState.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CGeneralTextHandler.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\hch\CHeroHandler.h"
|
||||
>
|
||||
|
104
map.h
104
map.h
@ -269,28 +269,45 @@ struct DLL_EXPORT TerrainTile
|
||||
|
||||
std::vector <CGObjectInstance*> visitableObjects; //pointers to objects hero can visit while being on this tile
|
||||
std::vector <CGObjectInstance*> blockingObjects; //pointers to objects that are blocking this tile
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & tertype & terview & nuine & rivDir & malle &roadDir & siodmyTajemniczyBajt;
|
||||
}
|
||||
};
|
||||
struct DLL_EXPORT SheroName //name of starting hero
|
||||
{
|
||||
int heroID;
|
||||
std::string heroName;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & heroID & heroName;
|
||||
}
|
||||
};
|
||||
struct DLL_EXPORT PlayerInfo
|
||||
{
|
||||
int p7, p8, p9;
|
||||
bool canHumanPlay;
|
||||
bool canComputerPlay;
|
||||
unsigned int AITactic; //(00 - random, 01 - warrior, 02 - builder, 03 - explorer)
|
||||
unsigned int allowedFactions; //(01 - castle; 02 - rampart; 04 - tower; 08 - inferno; 16 - necropolis; 32 - dungeon; 64 - stronghold; 128 - fortress; 256 - conflux);
|
||||
bool isFactionRandom;
|
||||
unsigned int mainHeroPortrait; //it's ID of hero with choosen portrait; 255 if standard
|
||||
si32 p7, p8, p9;
|
||||
ui8 canHumanPlay;
|
||||
ui8 canComputerPlay;
|
||||
ui32 AITactic; //(00 - random, 01 - warrior, 02 - builder, 03 - explorer)
|
||||
ui32 allowedFactions; //(01 - castle; 02 - rampart; 04 - tower; 08 - inferno; 16 - necropolis; 32 - dungeon; 64 - stronghold; 128 - fortress; 256 - conflux);
|
||||
ui8 isFactionRandom;
|
||||
ui32 mainHeroPortrait; //it's ID of hero with choosen portrait; 255 if standard
|
||||
std::string mainHeroName;
|
||||
std::vector<SheroName> heroesNames;
|
||||
bool hasMainTown;
|
||||
bool generateHeroAtMainTown;
|
||||
ui8 hasMainTown;
|
||||
ui8 generateHeroAtMainTown;
|
||||
int3 posOfMainTown;
|
||||
int team;
|
||||
bool generateHero;
|
||||
ui8 team;
|
||||
ui8 generateHero;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & p7 & p8 & p9 & canHumanPlay & canComputerPlay & AITactic & allowedFactions & isFactionRandom &
|
||||
mainHeroPortrait & mainHeroName & heroesNames & hasMainTown & generateHeroAtMainTown &
|
||||
posOfMainTown & team & generateHero;
|
||||
}
|
||||
};
|
||||
struct DLL_EXPORT LossCondition
|
||||
{
|
||||
@ -298,6 +315,11 @@ struct DLL_EXPORT LossCondition
|
||||
int3 castlePos;
|
||||
int3 heroPos;
|
||||
int timeLimit; // in days
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & typeOfLossCon & castlePos & heroPos & timeLimit;
|
||||
}
|
||||
};
|
||||
struct DLL_EXPORT CspecificVictoryConidtions
|
||||
{
|
||||
@ -349,26 +371,41 @@ struct DLL_EXPORT VicCona : public CspecificVictoryConidtions //transport specif
|
||||
struct DLL_EXPORT Rumor
|
||||
{
|
||||
std::string name, text;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & name & text;
|
||||
}
|
||||
};
|
||||
|
||||
struct DLL_EXPORT DisposedHero
|
||||
{
|
||||
int ID;
|
||||
int portrait; //0xFF - default
|
||||
ui32 ID;
|
||||
ui16 portrait; //0xFF - default
|
||||
std::string name;
|
||||
ui8 players; //who can hire this hero (bitfield)
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & ID & portrait & name & players;
|
||||
}
|
||||
};
|
||||
|
||||
class DLL_EXPORT CMapEvent
|
||||
{
|
||||
public:
|
||||
std::string name, message;
|
||||
int wood, mercury, ore, sulfur, crystal, gems, gold; //gained / taken resources
|
||||
unsigned char players; //affected players
|
||||
bool humanAffected;
|
||||
bool computerAffected;
|
||||
int firstOccurence;
|
||||
int nextOccurence; //after nextOccurance day event will occure; if it it 0, event occures only one time;
|
||||
si32 wood, mercury, ore, sulfur, crystal, gems, gold; //gained / taken resources
|
||||
ui8 players; //affected players
|
||||
ui8 humanAffected;
|
||||
ui8 computerAffected;
|
||||
ui32 firstOccurence;
|
||||
ui32 nextOccurence; //after nextOccurance day event will occure; if it it 0, event occures only one time;
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & name & message & wood & mercury & ore & sulfur & crystal & gems & gold
|
||||
& players & humanAffected & computerAffected & firstOccurence & nextOccurence;
|
||||
}
|
||||
};
|
||||
class DLL_EXPORT CMapHeader
|
||||
{
|
||||
@ -507,7 +544,34 @@ struct DLL_EXPORT Mapa
|
||||
bool isInTheMap(int3 pos);
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
//TODO: write
|
||||
h & version & name & description & width & height & twoLevel & difficulty & levelLimit & rumors & defy & defs
|
||||
& players & teams & lossCondition & victoryCondition & howManyTeams & allowedSpell & allowedAbilities
|
||||
& allowedArtifact &allowedHeroes & events;
|
||||
//TODO: viccondetails
|
||||
if(h.saving)
|
||||
{
|
||||
//saving terrain
|
||||
for (int i = 0; i < width ; i++)
|
||||
for (int j = 0; j < height ; j++)
|
||||
for (int k = 0; k <= twoLevel ; k++)
|
||||
h & terrain[i][j][k];
|
||||
}
|
||||
else
|
||||
{
|
||||
//loading terrain
|
||||
terrain = new TerrainTile**[width]; // allocate memory
|
||||
for (int ii=0;ii<width;ii++)
|
||||
{
|
||||
terrain[ii] = new TerrainTile*[height]; // allocate memory
|
||||
for(int jj=0;jj<height;jj++)
|
||||
terrain[ii][jj] = new TerrainTile[twoLevel+1];
|
||||
}
|
||||
for (int i = 0; i < width ; i++)
|
||||
for (int j = 0; j < height ; j++)
|
||||
for (int k = 0; k <= twoLevel ; k++)
|
||||
h & terrain[i][j][k];
|
||||
}
|
||||
//TODO: recreate blockvis maps
|
||||
}
|
||||
};
|
||||
#endif //MAPD_H
|
||||
|
@ -1,24 +1,25 @@
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include "CGameHandler.h"
|
||||
#include "CScriptCallback.h"
|
||||
#include "../CLua.h"
|
||||
#include "../CGameState.h"
|
||||
#include "../CLua.h"
|
||||
#include "../StartInfo.h"
|
||||
#include "../map.h"
|
||||
#include "../lib/NetPacks.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../hch/CArtHandler.h"
|
||||
#include "../hch/CBuildingHandler.h"
|
||||
#include "../hch/CDefObjInfoHandler.h"
|
||||
#include "../hch/CHeroHandler.h"
|
||||
#include "../hch/CObjectHandler.h"
|
||||
#include "../hch/CSpellHandler.h"
|
||||
#include "../hch/CTownHandler.h"
|
||||
#include "../hch/CBuildingHandler.h"
|
||||
#include "../hch/CHeroHandler.h"
|
||||
#include "boost/date_time/posix_time/posix_time_types.hpp" //no i/o just types
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
#include "../lib/CondSh.h"
|
||||
#include "../lib/Connection.h"
|
||||
#include "../lib/NetPacks.h"
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
#include "../map.h"
|
||||
#include "CGameHandler.h"
|
||||
#include "CScriptCallback.h"
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp> //no i/o just types
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <fstream>
|
||||
#ifndef _MSC_VER
|
||||
#include <boost/thread/xtime.hpp>
|
||||
@ -412,7 +413,7 @@ void CGameHandler::handleConnection(std::set<int> players, CConnection &c)
|
||||
std::string fname;
|
||||
c >> fname;
|
||||
CSaveFile save(fname);
|
||||
save << this;
|
||||
save << VLC->heroh << this;
|
||||
//save << this;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user