mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
* next part of exchange window
* changed some CDefHandlers to CDefEssential (the second is less memory consuming) * minor changes
This commit is contained in:
parent
7932a9e8ad
commit
ae3fa69134
@ -1120,7 +1120,7 @@ CDefHandler * CInfoBar::getAnim(int mode)
|
||||
void CInfoBar::blitAnim(int mode)//0 - day, 1 - week
|
||||
{
|
||||
CDefHandler * anim = NULL;
|
||||
std::stringstream txt;
|
||||
std::ostringstream txt;
|
||||
anim = getAnim(mode);
|
||||
if(mode) //new week animation
|
||||
{
|
||||
|
@ -584,7 +584,7 @@ void CBattleInterface::show(SDL_Surface * to)
|
||||
}
|
||||
SDL_BlitSurface(amountBG, NULL, to, &genRect(amountNormal->h, amountNormal->w, creAnims[curStackID]->pos.x + xAdd + pos.x, creAnims[curStackID]->pos.y + 260 + pos.y));
|
||||
//blitting amount
|
||||
std::stringstream ss;
|
||||
std::ostringstream ss;
|
||||
ss<<curStack.amount;
|
||||
CSDL_Ext::printAtMiddleWB(
|
||||
ss.str(),
|
||||
@ -2778,7 +2778,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
|
||||
for(std::set<std::pair<ui32,si32> >::const_iterator it=br.casualties[step].begin(); it!=br.casualties[step].end(); ++it)
|
||||
{
|
||||
blitAt(graphics->smallImgs[it->first], xPos, yPos, background);
|
||||
std::stringstream amount;
|
||||
std::ostringstream amount;
|
||||
amount<<it->second;
|
||||
CSDL_Ext::printAtMiddle(amount.str(), xPos+16, yPos + 42, GEOR13, zwykly, background);
|
||||
xPos += 42;
|
||||
|
@ -73,7 +73,7 @@ void CPCXConv::convert()
|
||||
unsigned char add;
|
||||
int it=0;
|
||||
|
||||
std::stringstream out;
|
||||
std::ostringstream out;
|
||||
|
||||
fSize = readNormalNr(it,4,pcx);it+=4;
|
||||
bh.x = readNormalNr(it,4,pcx);it+=4;
|
||||
|
@ -84,7 +84,7 @@ CHeroWindow::CHeroWindow(int playerColor):
|
||||
}
|
||||
|
||||
|
||||
flags = CDefHandler::giveDef("CREST58.DEF");
|
||||
flags = CDefHandler::giveDefEss("CREST58.DEF");
|
||||
//areas
|
||||
portraitArea = new LRClickableAreaWText();
|
||||
portraitArea->pos.x = pos.x+83;
|
||||
@ -529,7 +529,7 @@ void CHeroWindow::redrawCurBack()
|
||||
CSDL_Ext::printAtMiddle(curHero->name, 190, 40, GEORXX, tytulowy, curBack);
|
||||
|
||||
//printing hero's level
|
||||
std::stringstream secondLine;
|
||||
std::ostringstream secondLine;
|
||||
secondLine<<"Level "<<curHero->level<<" "<<curHero->type->heroClass->name;
|
||||
CSDL_Ext::printAtMiddle(secondLine.str(), 190, 66, TNRB16, zwykly, curBack);
|
||||
|
||||
@ -565,21 +565,12 @@ void CHeroWindow::redrawCurBack()
|
||||
delete toPrin;
|
||||
|
||||
//printing primary skills' amounts
|
||||
std::stringstream primarySkill1;
|
||||
primarySkill1<<curHero->getPrimSkillLevel(0);
|
||||
CSDL_Ext::printAtMiddle(primarySkill1.str(), 53, 165, TNRB16, zwykly, curBack);
|
||||
|
||||
std::stringstream primarySkill2;
|
||||
primarySkill2<<curHero->getPrimSkillLevel(1);
|
||||
CSDL_Ext::printAtMiddle(primarySkill2.str(), 123, 165, TNRB16, zwykly, curBack);
|
||||
|
||||
std::stringstream primarySkill3;
|
||||
primarySkill3<<curHero->getPrimSkillLevel(2);
|
||||
CSDL_Ext::printAtMiddle(primarySkill3.str(), 193, 165, TNRB16, zwykly, curBack);
|
||||
|
||||
std::stringstream primarySkill4;
|
||||
primarySkill4<<curHero->getPrimSkillLevel(3);
|
||||
CSDL_Ext::printAtMiddle(primarySkill4.str(), 263, 165, TNRB16, zwykly, curBack);
|
||||
for(int m=0; m<4; ++m)
|
||||
{
|
||||
std::ostringstream primarySkill;
|
||||
primarySkill<<curHero->getPrimSkillLevel(m);
|
||||
CSDL_Ext::printAtMiddle(primarySkill.str(), 53 + 70 * m, 165, TNRB16, zwykly, curBack);
|
||||
}
|
||||
|
||||
blitAt(graphics->luck42->ourImages[curHero->getCurrentLuck()+3].bitmap, 239, 182, curBack);
|
||||
blitAt(graphics->morale42->ourImages[curHero->getCurrentMorale()+3].bitmap, 181, 182, curBack);
|
||||
@ -613,53 +604,15 @@ void CHeroWindow::redrawCurBack()
|
||||
}
|
||||
|
||||
//secondary skills
|
||||
if(curHero->secSkills.size()>=1)
|
||||
for(int g=1; g<=8; ++g)
|
||||
{
|
||||
blitAt(graphics->abils44->ourImages[curHero->secSkills[0].first*3+3+curHero->secSkills[0].second-1].bitmap, 18, 276, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->levels[curHero->secSkills[0].second-1], 69, 279, GEOR13, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->skillName[curHero->secSkills[0].first], 69, 299, GEOR13, zwykly, curBack);
|
||||
}
|
||||
if(curHero->secSkills.size()>=2)
|
||||
{
|
||||
blitAt(graphics->abils44->ourImages[curHero->secSkills[1].first*3+3+curHero->secSkills[1].second-1].bitmap, 161, 276, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->levels[curHero->secSkills[1].second-1], 213, 279, GEOR13, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->skillName[curHero->secSkills[1].first], 213, 299, GEOR13, zwykly, curBack);
|
||||
}
|
||||
if(curHero->secSkills.size()>=3)
|
||||
{
|
||||
blitAt(graphics->abils44->ourImages[curHero->secSkills[2].first*3+3+curHero->secSkills[2].second-1].bitmap, 18, 324, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->levels[curHero->secSkills[2].second-1], 69, 327, GEOR13, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->skillName[curHero->secSkills[2].first], 69, 347, GEOR13, zwykly, curBack);
|
||||
}
|
||||
if(curHero->secSkills.size()>=4)
|
||||
{
|
||||
blitAt(graphics->abils44->ourImages[curHero->secSkills[3].first*3+3+curHero->secSkills[3].second-1].bitmap, 161, 324, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->levels[curHero->secSkills[3].second-1], 213, 327, GEOR13, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->skillName[curHero->secSkills[3].first], 213, 347, GEOR13, zwykly, curBack);
|
||||
}
|
||||
if(curHero->secSkills.size()>=5)
|
||||
{
|
||||
blitAt(graphics->abils44->ourImages[curHero->secSkills[4].first*3+3+curHero->secSkills[4].second-1].bitmap, 18, 372, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->levels[curHero->secSkills[4].second-1], 69, 375, GEOR13, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->skillName[curHero->secSkills[4].first], 69, 395, GEOR13, zwykly, curBack);
|
||||
}
|
||||
if(curHero->secSkills.size()>=6)
|
||||
{
|
||||
blitAt(graphics->abils44->ourImages[curHero->secSkills[5].first*3+3+curHero->secSkills[5].second-1].bitmap, 161, 372, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->levels[curHero->secSkills[5].second-1], 213, 375, GEOR13, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->skillName[curHero->secSkills[5].first], 213, 395, GEOR13, zwykly, curBack);
|
||||
}
|
||||
if(curHero->secSkills.size()>=7)
|
||||
{
|
||||
blitAt(graphics->abils44->ourImages[curHero->secSkills[6].first*3+3+curHero->secSkills[6].second-1].bitmap, 18, 420, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->levels[curHero->secSkills[6].second-1], 69, 423, GEOR13, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->skillName[curHero->secSkills[6].first], 69, 443, GEOR13, zwykly, curBack);
|
||||
}
|
||||
if(curHero->secSkills.size()>=8)
|
||||
{
|
||||
blitAt(graphics->abils44->ourImages[curHero->secSkills[7].first*3+3+curHero->secSkills[7].second-1].bitmap, 161, 420, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->levels[curHero->secSkills[7].second-1], 213, 423, GEOR13, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->skillName[curHero->secSkills[7].first], 213, 443, GEOR13, zwykly, curBack);
|
||||
|
||||
if(curHero->secSkills.size()>=g)
|
||||
{
|
||||
blitAt(graphics->abils44->ourImages[curHero->secSkills[g-1].first*3+3+curHero->secSkills[g-1].second-1].bitmap, g%2 ? 18 : 161, 276 + 48 * ((g-1)/2), curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->levels[curHero->secSkills[g-1].second-1], g%2 ? 69 : 213, 279 + 48 * ((g-1)/2), GEOR13, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->skillName[curHero->secSkills[g-1].first], g%2 ? 69 : 213, 299 + 48 * ((g-1)/2), GEOR13, zwykly, curBack);
|
||||
}
|
||||
}
|
||||
|
||||
//printing special ability
|
||||
@ -667,11 +620,11 @@ void CHeroWindow::redrawCurBack()
|
||||
|
||||
//printing necessery texts
|
||||
CSDL_Ext::printAt(CGI->generaltexth->jktexts[6].substr(1, CGI->generaltexth->jktexts[6].size()-2), 69, 231, GEOR13, tytulowy, curBack);
|
||||
std::stringstream expstr;
|
||||
std::ostringstream expstr;
|
||||
expstr<<curHero->exp;
|
||||
CSDL_Ext::printAt(expstr.str(), 69, 247, GEOR16, zwykly, curBack);
|
||||
CSDL_Ext::printAt(CGI->generaltexth->jktexts[7].substr(1, CGI->generaltexth->jktexts[7].size()-2), 212, 231, GEOR13, tytulowy, curBack);
|
||||
std::stringstream manastr;
|
||||
std::ostringstream manastr;
|
||||
manastr << curHero->mana << '/' << curHero->manaLimit();
|
||||
CSDL_Ext::printAt(manastr.str(), 212, 247, GEOR16, zwykly, curBack);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class CHeroWindow: public CWindowWithGarrison, public virtual CIntObject
|
||||
CStatusBar * ourBar; //heroWindow's statusBar
|
||||
|
||||
//general graphics
|
||||
CDefHandler *flags;
|
||||
CDefEssential *flags;
|
||||
|
||||
//buttons
|
||||
AdventureMapButton * gar4button; //splitting
|
||||
|
@ -213,7 +213,7 @@ CSpellWindow::CSpellWindow(const SDL_Rect & myRect, const CGHeroInstance * myHer
|
||||
background = BitmapHandler::loadBitmap("SpelBack.bmp");
|
||||
graphics->blueToPlayersAdv(background, myHero->tempOwner);
|
||||
|
||||
std::stringstream mana;
|
||||
std::ostringstream mana;
|
||||
mana<<myHero->mana;
|
||||
CSDL_Ext::printAtMiddle(mana.str(), 434, 425, GEOR16, tytulowy, background);
|
||||
|
||||
@ -452,7 +452,7 @@ void CSpellWindow::show(SDL_Surface *to)
|
||||
//printing lvl
|
||||
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[171 + CGI->spellh->spells[spellAreas[b]->mySpell].level], spellAreas[b]->pos.x + 39, spellAreas[b]->pos.y + 82, GEORM, zwykly, to);
|
||||
//printing cost
|
||||
std::stringstream ss;
|
||||
std::ostringstream ss;
|
||||
ss<<CGI->generaltexth->allTexts[387]<<": "<<CGI->spellh->spells[spellAreas[b]->mySpell].costs[bestslvl];
|
||||
|
||||
CSDL_Ext::printAtMiddle(ss.str(), spellAreas[b]->pos.x + 39, spellAreas[b]->pos.y + 94, GEORM, zwykly, to);
|
||||
@ -652,7 +652,7 @@ void CSpellWindow::SpellArea::hover(bool on)
|
||||
{
|
||||
if(on)
|
||||
{
|
||||
std::stringstream ss;
|
||||
std::ostringstream ss;
|
||||
ss<<CGI->spellh->spells[mySpell].name<<" ("<<CGI->generaltexth->allTexts[171+CGI->spellh->spells[mySpell].level]<<")";
|
||||
owner->statusBar->print(ss.str());
|
||||
}
|
||||
|
@ -3259,6 +3259,31 @@ CExchangeWindow::CExchangeWindow(si32 hero1, si32 hero2) //c-tor
|
||||
{
|
||||
blitAt(skilldef->ourImages[g].bitmap, genRect(32, 32, 385, 19 + 36 * g), bg);
|
||||
}
|
||||
delete skilldef;
|
||||
|
||||
const CGHeroInstance * curHero = NULL;
|
||||
for(int b=0; b<2; ++b)
|
||||
{
|
||||
//choosing hero
|
||||
if(b == 0)
|
||||
curHero = hero1inst;
|
||||
else if(b == 1)
|
||||
curHero = hero2inst;
|
||||
|
||||
//printing primary skills' amounts
|
||||
for(int m=0; m<4; ++m)
|
||||
{
|
||||
std::ostringstream primarySkill;
|
||||
primarySkill<<curHero->getPrimSkillLevel(m);
|
||||
CSDL_Ext::printAtMiddle(primarySkill.str(), 353 + 93 * b, 35 + 36 * m, TNRB16, zwykly, bg);
|
||||
}
|
||||
|
||||
//printing secondary skills
|
||||
for(int m=0; m<curHero->secSkills.size(); ++m)
|
||||
{
|
||||
blitAt(graphics->abils32->ourImages[curHero->secSkills[m].first * 3 + curHero->secSkills[m].second + 2].bitmap, genRect(32, 32, 32 + 36 * m + 454 * b, 88), bg);
|
||||
}
|
||||
}
|
||||
|
||||
//printing portraits
|
||||
blitAt(graphics->portraitLarge[hero1inst->portrait], 257, 13, bg);
|
||||
|
@ -190,7 +190,7 @@ void Graphics::initializeBattleGraphics()
|
||||
battleACToDef[ACid] = toAdd;
|
||||
}
|
||||
}
|
||||
spellEffectsPics = CDefHandler::giveDef("SpellInt.def");
|
||||
spellEffectsPics = CDefHandler::giveDefEss("SpellInt.def");
|
||||
}
|
||||
Graphics::Graphics()
|
||||
{
|
||||
@ -212,7 +212,7 @@ Graphics::Graphics()
|
||||
tasks += GET_SURFACE(hInfo,"HEROQVBK.bmp");
|
||||
tasks += GET_SURFACE(tInfo,"TOWNQVBK.bmp");
|
||||
tasks += GET_SURFACE(heroInGarrison,"TOWNQKGH.bmp");
|
||||
tasks += GET_DEF(artDefs,"ARTIFACT.DEF");
|
||||
tasks += GET_DEF_ESS(artDefs,"ARTIFACT.DEF");
|
||||
tasks += GET_DEF_ESS(forts,"ITMCLS.DEF");
|
||||
tasks += GET_DEF_ESS(luck22,"ILCK22.DEF");
|
||||
tasks += GET_DEF_ESS(luck30,"ILCK30.DEF");
|
||||
@ -224,19 +224,19 @@ Graphics::Graphics()
|
||||
tasks += GET_DEF_ESS(morale82,"IMRL82.DEF");
|
||||
tasks += GET_DEF_ESS(halls,"ITMTLS.DEF");
|
||||
tasks += GET_DEF_ESS(bigTownPic,"ITPT.DEF");
|
||||
tasks += GET_DEF(pskillsb,"PSKILL.DEF");
|
||||
tasks += GET_DEF(pskillsm,"PSKIL42.DEF");
|
||||
tasks += GET_DEF(resources,"RESOUR82.DEF");
|
||||
tasks += GET_DEF(un44,"UN44.DEF");
|
||||
tasks += GET_DEF(smallIcons,"ITPA.DEF");
|
||||
tasks += GET_DEF(resources32,"RESOURCE.DEF");
|
||||
tasks += GET_DEF_ESS(pskillsb,"PSKILL.DEF");
|
||||
tasks += GET_DEF_ESS(pskillsm,"PSKIL42.DEF");
|
||||
tasks += GET_DEF_ESS(resources,"RESOUR82.DEF");
|
||||
tasks += GET_DEF_ESS(un44,"UN44.DEF");
|
||||
tasks += GET_DEF_ESS(smallIcons,"ITPA.DEF");
|
||||
tasks += GET_DEF_ESS(resources32,"RESOURCE.DEF");
|
||||
tasks += GET_DEF(smi,"CPRSMALL.DEF");
|
||||
tasks += GET_DEF(smi2,"TWCRPORT.DEF");
|
||||
tasks += GET_DEF(flags,"CREST58.DEF");
|
||||
tasks += GET_DEF(abils32,"SECSK32.DEF");
|
||||
tasks += GET_DEF(abils44,"SECSKILL.DEF");
|
||||
tasks += GET_DEF(abils82,"SECSK82.DEF");
|
||||
tasks += GET_DEF(spellscr,"SPELLSCR.DEF");
|
||||
tasks += GET_DEF_ESS(flags,"CREST58.DEF");
|
||||
tasks += GET_DEF_ESS(abils32,"SECSK32.DEF");
|
||||
tasks += GET_DEF_ESS(abils44,"SECSKILL.DEF");
|
||||
tasks += GET_DEF_ESS(abils82,"SECSK82.DEF");
|
||||
tasks += GET_DEF_ESS(spellscr,"SPELLSCR.DEF");
|
||||
|
||||
std::ifstream ifs("config/cr_bgs.txt");
|
||||
int id;
|
||||
@ -300,10 +300,10 @@ void Graphics::loadHeroAnim()
|
||||
std::make_pair(2,14), std::make_pair(3,15);
|
||||
for(size_t i=0; i<heroAnims.size(); ++i)
|
||||
{
|
||||
std::stringstream nm;
|
||||
std::ostringstream nm;
|
||||
nm << "AH" << std::setw(2) << std::setfill('0') << i << "_.DEF";
|
||||
std::string name = nm.str();
|
||||
heroAnims[i] = CDefHandler::giveDef(name);
|
||||
heroAnims[i] = CDefHandler::giveDefEss(name);
|
||||
int pom = 0; //how many groups has been rotated
|
||||
for(int o=7; pom<6; ++o)
|
||||
{
|
||||
@ -335,14 +335,13 @@ void Graphics::loadHeroAnim()
|
||||
{
|
||||
CSDL_Ext::alphaTransform(heroAnims[i]->ourImages[ff].bitmap);
|
||||
}
|
||||
heroAnims[i]->alphaTransformed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::loadHeroFlags(std::pair<std::vector<CDefHandler *> Graphics::*, std::vector<const char *> > &pr, bool mode)
|
||||
void Graphics::loadHeroFlags(std::pair<std::vector<CDefEssential *> Graphics::*, std::vector<const char *> > &pr, bool mode)
|
||||
{
|
||||
for(int i=0;i<8;i++)
|
||||
(this->*pr.first).push_back(CDefHandler::giveDef(pr.second[i]));
|
||||
(this->*pr.first).push_back(CDefHandler::giveDefEss(pr.second[i]));
|
||||
std::vector<std::pair<int,int> > rotations; //first - group number to be rotated1, second - group number after rotation1
|
||||
rotations += std::make_pair(6,10), std::make_pair(7,11), std::make_pair(8,12);
|
||||
for(int q=0; q<8; ++q)
|
||||
@ -413,7 +412,6 @@ void Graphics::loadHeroFlags(std::pair<std::vector<CDefHandler *> Graphics::*, s
|
||||
SDL_MapRGB((this->*pr.first)[q]->ourImages[ff].bitmap->format, 0, 255, 255)
|
||||
);
|
||||
}
|
||||
(this->*pr.first)[q]->alphaTransformed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -421,7 +419,7 @@ void Graphics::loadHeroFlags()
|
||||
{
|
||||
using namespace boost::assign;
|
||||
timeHandler th;
|
||||
std::pair<std::vector<CDefHandler *> Graphics::*, std::vector<const char *> > pr[4];
|
||||
std::pair<std::vector<CDefEssential *> Graphics::*, std::vector<const char *> > pr[4];
|
||||
pr[0].first = &Graphics::flags1;
|
||||
pr[0].second+=("ABF01L.DEF"),("ABF01G.DEF"),("ABF01R.DEF"),("ABF01D.DEF"),("ABF01B.DEF"),
|
||||
("ABF01P.DEF"),("ABF01W.DEF"),("ABF01K.DEF");
|
||||
|
@ -36,16 +36,16 @@ public:
|
||||
*halls, *forts, *bigTownPic;
|
||||
std::map<int,SDL_Surface*> heroWins; //hero_ID => infobox
|
||||
std::map<int,SDL_Surface*> townWins; //town_ID => infobox
|
||||
CDefHandler * artDefs; //artifacts
|
||||
CDefEssential * artDefs; //artifacts
|
||||
std::vector<SDL_Surface *> portraitSmall; //48x32 px portraits of heroes
|
||||
std::vector<SDL_Surface *> portraitLarge; //58x64 px portraits of heroes
|
||||
std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
|
||||
CDefHandler * pskillsb, *resources; //82x93
|
||||
CDefHandler * pskillsm; //42x42
|
||||
CDefHandler * un44; //many things
|
||||
CDefHandler * smallIcons, *resources32; //resources 32x32
|
||||
CDefHandler * flags;
|
||||
std::vector<CDefHandler *> heroAnims; // [class id: 0 - 17] //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
|
||||
std::vector<CDefEssential *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
|
||||
CDefEssential * pskillsb, *resources; //82x93
|
||||
CDefEssential * pskillsm; //42x42
|
||||
CDefEssential * un44; //many things
|
||||
CDefEssential * smallIcons, *resources32; //resources 32x32
|
||||
CDefEssential * flags;
|
||||
std::vector<CDefEssential *> heroAnims; // [class id: 0 - 17] //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
|
||||
//creatures
|
||||
std::map<int,SDL_Surface*> smallImgs; //creature ID -> small 32x32 img of creature; //ID=-2 is for blank (black) img; -1 for the border
|
||||
std::map<int,SDL_Surface*> bigImgs; //creature ID -> big 58x64 img of creature; //ID=-2 is for blank (black) img; -1 for the border
|
||||
@ -55,18 +55,18 @@ public:
|
||||
std::vector< std::vector< std::string > > battleBacks; //battleBacks[terType] - vector of possible names for certain terrain type
|
||||
std::vector< std::string > battleHeroes; //battleHeroes[hero type] - name of def that has hero animation for battle
|
||||
std::map< int, std::vector < std::string > > battleACToDef; //maps AC format to vector of appropriate def names
|
||||
CDefHandler * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
|
||||
CDefEssential * spellEffectsPics; //bitmaps representing spells affecting a stack in battle
|
||||
std::vector<std::string> guildBgs;// name of bitmaps with imgs for mage guild screen
|
||||
//abilities
|
||||
CDefHandler * abils32, * abils44, * abils82;
|
||||
CDefEssential * abils32, * abils44, * abils82;
|
||||
//spells
|
||||
CDefHandler *spellscr; //spell on the scroll 83x61
|
||||
CDefEssential *spellscr; //spell on the scroll 83x61
|
||||
//functions
|
||||
Graphics();
|
||||
void initializeBattleGraphics();
|
||||
void loadPaletteAndColors();
|
||||
void loadHeroFlags();
|
||||
void loadHeroFlags(std::pair<std::vector<CDefHandler *> Graphics::*, std::vector<const char *> > &pr, bool mode);
|
||||
void loadHeroFlags(std::pair<std::vector<CDefEssential *> Graphics::*, std::vector<const char *> > &pr, bool mode);
|
||||
void loadHeroAnim();
|
||||
void loadHeroPortraits();
|
||||
SDL_Surface * drawHeroInfoWin(const CGHeroInstance * curh);
|
||||
|
@ -27,7 +27,7 @@ static unsigned int readNr(std::string &in, int &it)
|
||||
if(last==in.size())
|
||||
throw std::string("Cannot read number...");
|
||||
|
||||
std::stringstream ss(in.substr(it,last-it));
|
||||
std::istringstream ss(in.substr(it,last-it));
|
||||
it+=(1+last-it);
|
||||
ss >> last;
|
||||
return last;
|
||||
@ -127,7 +127,7 @@ void CBuildingHandler::loadBuildings()
|
||||
while(it<seppos)
|
||||
{
|
||||
int last = linia.find_first_of(' ',it);
|
||||
std::stringstream ss(linia.substr(it,last-it));
|
||||
std::istringstream ss(linia.substr(it,last-it));
|
||||
it = last + 1;
|
||||
ss >> last;
|
||||
(hall[tid].second)[j][box].push_back(last);
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class CDefHandler;
|
||||
class CDefEssential;
|
||||
class CLodHandler;
|
||||
class DLL_EXPORT CGDefInfo
|
||||
{
|
||||
@ -30,7 +30,7 @@ public:
|
||||
terrainMenu; //in which menus in map editor object will be showed
|
||||
si32 width, height; //tiles
|
||||
si32 type; //(0- ground, 1- towns, 2-creatures, 3- heroes, 4-artifacts, 5- resources)
|
||||
CDefHandler * handler;
|
||||
CDefEssential * handler;
|
||||
si32 printPriority;
|
||||
bool isVisitable();
|
||||
bool operator<(const CGDefInfo& por)
|
||||
|
@ -158,7 +158,7 @@ void CSoundHandler::initCreaturesSounds(std::vector<CCreature> &creatures)
|
||||
{
|
||||
std::string cname="", attack="", defend="", killed="", move="",
|
||||
shoot="", wince="", ext1="", ext2="";
|
||||
std::stringstream str(line);
|
||||
std::istringstream str(line);
|
||||
|
||||
str >> cname >> attack >> defend >> killed >> move >> shoot >> wince >> ext1 >> ext2;
|
||||
|
||||
@ -232,7 +232,7 @@ void CSoundHandler::initSpellsSounds(std::vector<CSpell> &spells)
|
||||
{
|
||||
int spellid;
|
||||
std::string soundfile="";
|
||||
std::stringstream str(line);
|
||||
std::istringstream str(line);
|
||||
|
||||
str >> spellid >> soundfile;
|
||||
|
||||
|
@ -105,7 +105,6 @@ static void alphaTransformDef(CGDefInfo * defInfo)
|
||||
for(int yy=0;yy<defInfo->handler->ourImages.size();yy++)
|
||||
{
|
||||
CSDL_Ext::alphaTransform(defInfo->handler->ourImages[yy].bitmap);
|
||||
defInfo->handler->alphaTransformed = true;
|
||||
}
|
||||
SDL_FreeSurface(alphaTransSurf);
|
||||
}
|
||||
@ -180,13 +179,13 @@ void CMapHandler::roadsRiverTerrainInit()
|
||||
{
|
||||
//initializing road's and river's DefHandlers
|
||||
|
||||
roadDefs.push_back(CDefHandler::giveDef("dirtrd.def"));
|
||||
roadDefs.push_back(CDefHandler::giveDef("gravrd.def"));
|
||||
roadDefs.push_back(CDefHandler::giveDef("cobbrd.def"));
|
||||
staticRiverDefs.push_back(CDefHandler::giveDef("clrrvr.def"));
|
||||
staticRiverDefs.push_back(CDefHandler::giveDef("icyrvr.def"));
|
||||
staticRiverDefs.push_back(CDefHandler::giveDef("mudrvr.def"));
|
||||
staticRiverDefs.push_back(CDefHandler::giveDef("lavrvr.def"));
|
||||
roadDefs.push_back(CDefHandler::giveDefEss("dirtrd.def"));
|
||||
roadDefs.push_back(CDefHandler::giveDefEss("gravrd.def"));
|
||||
roadDefs.push_back(CDefHandler::giveDefEss("cobbrd.def"));
|
||||
staticRiverDefs.push_back(CDefHandler::giveDefEss("clrrvr.def"));
|
||||
staticRiverDefs.push_back(CDefHandler::giveDefEss("icyrvr.def"));
|
||||
staticRiverDefs.push_back(CDefHandler::giveDefEss("mudrvr.def"));
|
||||
staticRiverDefs.push_back(CDefHandler::giveDefEss("lavrvr.def"));
|
||||
for(size_t g=0; g<staticRiverDefs.size(); ++g)
|
||||
{
|
||||
for(size_t h=0; h < staticRiverDefs[g]->ourImages.size(); ++h)
|
||||
@ -385,7 +384,7 @@ void CMapHandler::initObjectRects()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CDefHandler * curd = map->objects[f]->defInfo->handler;
|
||||
CDefEssential * curd = map->objects[f]->defInfo->handler;
|
||||
if(curd)
|
||||
{
|
||||
const SDL_Surface *bitmap = curd->ourImages[0].bitmap;
|
||||
@ -437,7 +436,7 @@ static void processDef (CGDefInfo* def)
|
||||
{
|
||||
if(def->name.size())
|
||||
{
|
||||
def->handler = CDefHandler::giveDef(def->name);
|
||||
def->handler = CDefHandler::giveDefEss(def->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -457,13 +456,10 @@ static void processDef (CGDefInfo* def)
|
||||
}
|
||||
else if(def->id != HEROI_TYPE && def->id != TOWNI_TYPE)
|
||||
tlog3 << "\t\tMinor warning: lacking def info for " << def->id << " " << def->subid <<" " << def->name << std::endl;
|
||||
if(!def->handler->alphaTransformed)
|
||||
|
||||
for(size_t yy=0; yy < def->handler->ourImages.size(); ++yy)
|
||||
{
|
||||
for(size_t yy=0; yy < def->handler->ourImages.size(); ++yy)
|
||||
{
|
||||
CSDL_Ext::alphaTransform(def->handler->ourImages[yy].bitmap);
|
||||
def->handler->alphaTransformed = true;
|
||||
}
|
||||
CSDL_Ext::alphaTransform(def->handler->ourImages[yy].bitmap);
|
||||
}
|
||||
}
|
||||
void CMapHandler::initHeroDef(CGHeroInstance * h)
|
||||
@ -1309,7 +1305,7 @@ bool CMapHandler::printObject(const CGObjectInstance *obj)
|
||||
|
||||
bool CMapHandler::hideObject(const CGObjectInstance *obj)
|
||||
{
|
||||
CDefHandler * curd = obj->defInfo->handler;
|
||||
CDefEssential * curd = obj->defInfo->handler;
|
||||
if(!curd) return false;
|
||||
const SDL_Surface *bitmap = curd->ourImages[0].bitmap;
|
||||
for(int fx=0; fx<bitmap->w/32; ++fx)
|
||||
|
@ -23,6 +23,7 @@ class CDefHandler;
|
||||
struct TerrainTile;
|
||||
struct SDL_Surface;
|
||||
struct SDL_Rect;
|
||||
class CDefEssential;
|
||||
|
||||
struct TerrainTile2
|
||||
{
|
||||
@ -105,11 +106,11 @@ public:
|
||||
CDefHandler * partialHide; //for For of War
|
||||
|
||||
std::vector<std::vector<SDL_Surface *> > terrainGraphics; // [terrain id] [view type] [rotation type]
|
||||
std::vector<CDefHandler *> roadDefs;
|
||||
std::vector<CDefHandler *> staticRiverDefs;
|
||||
std::vector<CDefHandler*> defs;
|
||||
std::vector<CDefEssential *> roadDefs;
|
||||
std::vector<CDefEssential *> staticRiverDefs;
|
||||
std::vector<CDefEssential*> defs;
|
||||
|
||||
std::map<std::string, CDefHandler*> loadedDefs; //pointers to loaded defs (key is filename, uppercase)
|
||||
std::map<std::string, CDefEssential*> loadedDefs; //pointers to loaded defs (key is filename, uppercase)
|
||||
|
||||
std::vector<std::vector<std::vector<unsigned char> > > hideBitmap; //specifies number of graphic that should be used to fully hide a tile
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user