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

* zaczytywanie kolejnych tekstów do menu (przy wyborze scenariusza)

* obsługa zaczytywania artefaktów przy wczytywaniu bohatera (na razie poza tymi z sakwy)
* drobna poprawka w specyfikacji
This commit is contained in:
mateuszb 2007-06-14 17:07:26 +00:00
parent 6a2fd8d886
commit 065607cb21
5 changed files with 228 additions and 3 deletions

View File

@ -406,7 +406,7 @@ void CAmbarCendamo::deh3m()
THC std::cout<<"Wczytywanie defow: "<<th.getDif()<<std::endl; THC std::cout<<"Wczytywanie defow: "<<th.getDif()<<std::endl;
////loading objects ////loading objects
int howManyObjs = readNormalNr(i, 4); i+=4; int howManyObjs = readNormalNr(i, 4); i+=4;
/*for(int ww=0; ww<howManyObjs; ++ww) /*for(int ww=0; ww<howManyObjs; ++ww) //comment this line to turn loading objects off
{ {
CObjectInstance nobj; //we will read this object CObjectInstance nobj; //we will read this object
nobj.id = CGameInfo::mainObj->objh->objInstances.size(); nobj.id = CGameInfo::mainObj->objh->objInstances.size();
@ -515,7 +515,7 @@ void CAmbarCendamo::deh3m()
} }
else spec->experience = 0; else spec->experience = 0;
++i; //TODO - czy tu na pewno nie ma istotnej informacji? ++i; //TODO - czy tu na pewno nie ma istotnej informacji?
bool nonstandardAbilities = bufor[i]; //true if hero has specified abilities bool nonstandardAbilities = bufor[i]; ++i; //true if hero has specified abilities
if(nonstandardAbilities) if(nonstandardAbilities)
{ {
int howMany = readNormalNr(i); i+=4; int howMany = readNormalNr(i); i+=4;
@ -526,12 +526,119 @@ void CAmbarCendamo::deh3m()
} }
} }
bool standGarrison = bufor[i]; ++i; //true if hero has nonstandard garrison bool standGarrison = bufor[i]; ++i; //true if hero has nonstandard garrison
spec->standardGarrison = standGarrison;
if(standGarrison) if(standGarrison)
{ {
spec->garrison = readCreatureSet(i); i+=7; spec->garrison = readCreatureSet(i); i+=7;
} }
bool form = bufor[i]; ++i; //formation bool form = bufor[i]; ++i; //formation
spec->garrison.formation = form; spec->garrison.formation = form;
bool artSet = bufor[i]; ++i; //true if artifact set is not default (hero has some artifacts)
if(artSet)
{
//head art
int id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artHead = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artHead = NULL;
//shoulders art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artShoulders = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artShoulders = NULL;
//neck art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artNeck = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artNeck = NULL;
//right hand art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artRhand = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artRhand = NULL;
//left hand art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artLHand = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artLHand = NULL;
//torso art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artTorso = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artTorso = NULL;
//right hand ring
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artRRing = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artRRing = NULL;
//left hand ring
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artLRing = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artLRing = NULL;
//feet art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artFeet = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artFeet = NULL;
//misc1 art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artMisc1 = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artMisc1 = NULL;
//misc2 art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artMisc2 = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artMisc2 = NULL;
//misc3 art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artMisc3 = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artMisc3 = NULL;
//misc4 art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artMisc4 = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artMisc4 = NULL;
//machine1 art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artMach1 = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artMach1 = NULL;
//machine2 art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artMach2 = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artMach2 = NULL;
//machine3 art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artMach3 = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artMach3 = NULL;
//misc5 art
id = readNormalNr(i, 2); i+=2;
if(id!=0xffff)
spec->artMisc5 = &(CGameInfo::mainObj->arth->artifacts[id]);
else
spec->artMisc5 = NULL;
}
break; break;
} }
} }

View File

@ -46,8 +46,10 @@ public:
int player; int player;
CHero * type; CHero * type;
std::string name; //if nonstandard std::string name; //if nonstandard
bool standardGarrison; //true if hero has standard garrison
CCreatureSet garrison; //hero's army CCreatureSet garrison; //hero's army
std::vector<CArtifact *> artifacts; //hero's artifacts std::vector<CArtifact *> artifacts; //hero's artifacts from bag
CArtifact * artHead, * artLRing, * artRRing, * artLHand, * artRhand, * artFeet, * artSpellBook, * artMach1, * artMach2, * artMach3, * artMach4, * artMisc1, * artMisc2, * artMisc3, * artMisc4, * artMisc5, * artTorso, * artNeck, * artShoulders; //working artifacts
bool isGuarding; bool isGuarding;
int guardRange; //range of hero's guard int guardRange; //range of hero's guard
std::string biography; //if nonstandard std::string biography; //if nonstandard

View File

@ -219,4 +219,115 @@ void CPreGameTextHandler::loadTexts()
} }
ngBack = buf.substr(befi, i-befi); ngBack = buf.substr(befi, i-befi);
++i; ++i;
hmcr = 0;
for(i; i<andame; ++i)
{
if(buf[i]=='\r')
++hmcr;
if(hmcr==4)
break;
}
i+=2;
loadToIt(singleChooseScenario, buf, i);
loadToIt(singleSetAdvOptions, buf, i);
loadToIt(singleRandomMap, buf, i);
loadToIt(singleScenarioName, buf, i);
loadToIt(singleDescriptionTitle, buf, i);
loadToIt(singleDescriptionText, buf, i);
loadToIt(singleEasy, buf, i);
loadToIt(singleNormal, buf, i);
loadToIt(singleHard, buf, i);
loadToIt(singleExpert, buf, i);
loadToIt(singleImpossible, buf, i);
loadToIt(singleAllyFlag[0], buf, i);
loadToIt(singleAllyFlag[1], buf, i);
loadToIt(singleAllyFlag[2], buf, i);
loadToIt(singleAllyFlag[3], buf, i, 1);
loadToIt(singleAllyFlag[4], buf, i, 1);
loadToIt(singleAllyFlag[5], buf, i, 1);
loadToIt(singleAllyFlag[6], buf, i, 1);
loadToIt(singleAllyFlag[7], buf, i, 1);
loadToIt(singleEnemyFlag[0], buf, i, 1);
loadToIt(singleEnemyFlag[1], buf, i, 1);
loadToIt(singleEnemyFlag[2], buf, i, 1);
loadToIt(singleEnemyFlag[3], buf, i, 1);
loadToIt(singleEnemyFlag[4], buf, i, 1);
loadToIt(singleEnemyFlag[5], buf, i, 1);
loadToIt(singleEnemyFlag[6], buf, i, 1);
loadToIt(singleEnemyFlag[7], buf, i, 1);
loadToIt(singleViewHideScenarioList, buf, i, 1);
loadToIt(singleViewHideAdvOptions, buf, i, 1);
loadToIt(singlePlayRandom, buf, i, 1);
loadToIt(singleChatDesc, buf, i, 1);
loadToIt(singleMapDifficulty, buf, i, 1);
loadToIt(singleRating, buf, i, 1);
loadToIt(singleMapPossibleDifficulties, buf, i, 1);
loadToIt(singleVicCon, buf, i, 1);
loadToIt(singleLossCon, buf, i, 1);
loadToIt(singleSFilter, buf, i, 1);
loadToIt(singleMFilter, buf, i, 1);
loadToIt(singleLFilter, buf, i, 1);
loadToIt(singleXLFilter, buf, i, 1);
loadToIt(singleAllFilter, buf, i, 1);
}
void CPreGameTextHandler::loadToIt(std::string &dest, std::string &src, int &iter, int mode)
{
switch(mode)
{
case 0:
{
int hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
++hmcr;
if(hmcr==1)
break;
}
++iter;
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
break;
}
dest = src.substr(befi, iter-befi);
++iter;
hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
++hmcr;
if(hmcr==1)
break;
}
iter+=2;
break;
}
case 1:
{
int hmcr = 0;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\t')
++hmcr;
if(hmcr==1)
break;
}
++iter;
int befi=iter;
for(iter; iter<src.size(); ++iter)
{
if(src[iter]=='\r')
break;
}
dest = src.substr(befi, iter-befi);
iter+=2;
}
}
} }

View File

@ -8,9 +8,14 @@ class CPreGameTextHandler //handles pre - game texts
public: public:
std::string mainNewGame, mainLoadGame, mainHighScores, mainCredits, mainQuit; //right - click texts in main menu std::string mainNewGame, mainLoadGame, mainHighScores, mainCredits, mainQuit; //right - click texts in main menu
std::string ngSingleScenario, ngCampain, ngMultiplayer, ngTutorial, ngBack; //right - click texts in new game menu std::string ngSingleScenario, ngCampain, ngMultiplayer, ngTutorial, ngBack; //right - click texts in new game menu
std::string singleChooseScenario, singleSetAdvOptions, singleRandomMap, singleScenarioName, singleDescriptionTitle, singleDescriptionText, singleEasy, singleNormal, singleHard, singleExpert, singleImpossible; //main single scenario texts
std::string singleAllyFlag[8], singleEnemyFlag[8];
std::string singleViewHideScenarioList, singleViewHideAdvOptions, singlePlayRandom, singleChatDesc, singleMapDifficulty, singleRating, singleMapPossibleDifficulties, singleVicCon, singleLossCon;
std::string singleSFilter, singleMFilter, singleLFilter, singleXLFilter, singleAllFilter;
std::string getTitle(std::string text); std::string getTitle(std::string text);
std::string getDescr(std::string text); std::string getDescr(std::string text);
void loadTexts(); void loadTexts();
void loadToIt(std::string & dest, std::string & src, int & iter, int mode = 0); //mode 0 - dump to tab, destto tab, dump to eol //mode 1 - dump to tab, src to eol
}; };

BIN
h3m.txt

Binary file not shown.