mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
possibly handles all H3 maps inculding RoE
This commit is contained in:
parent
ef90e6140f
commit
a4e4c97776
@ -1228,94 +1228,119 @@ void CAmbarCendamo::deh3m()
|
|||||||
else //RoE
|
else //RoE
|
||||||
{
|
{
|
||||||
int artID = bufor[i]; ++i;
|
int artID = bufor[i]; ++i;
|
||||||
spec->m5arts.push_back(&(CGameInfo::mainObj->arth->artifacts[artID]));
|
if(artID!=255) //not none quest
|
||||||
|
{
|
||||||
|
spec->m5arts.push_back(&(CGameInfo::mainObj->arth->artifacts[artID]));
|
||||||
|
spec->missionType = 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spec->missionType = 255;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char rewardType = bufor[i]; ++i;
|
if(spec->missionType!=255)
|
||||||
spec->rewardType = rewardType;
|
|
||||||
|
|
||||||
switch(rewardType)
|
|
||||||
{
|
{
|
||||||
case 1:
|
unsigned char rewardType = bufor[i]; ++i;
|
||||||
|
spec->rewardType = rewardType;
|
||||||
|
|
||||||
|
switch(rewardType)
|
||||||
{
|
{
|
||||||
spec->r1exp = readNormalNr(i); i+=4;
|
case 1:
|
||||||
break;
|
{
|
||||||
}
|
spec->r1exp = readNormalNr(i); i+=4;
|
||||||
case 2:
|
break;
|
||||||
{
|
}
|
||||||
spec->r2mana = readNormalNr(i); i+=4;
|
case 2:
|
||||||
break;
|
{
|
||||||
}
|
spec->r2mana = readNormalNr(i); i+=4;
|
||||||
case 3:
|
break;
|
||||||
{
|
}
|
||||||
spec->r3morale = bufor[i]; ++i;
|
case 3:
|
||||||
break;
|
{
|
||||||
}
|
spec->r3morale = bufor[i]; ++i;
|
||||||
case 4:
|
break;
|
||||||
{
|
}
|
||||||
spec->r4luck = bufor[i]; ++i;
|
case 4:
|
||||||
break;
|
{
|
||||||
}
|
spec->r4luck = bufor[i]; ++i;
|
||||||
case 5:
|
break;
|
||||||
{
|
}
|
||||||
spec->r5type = bufor[i]; ++i;
|
case 5:
|
||||||
spec->r5amount = readNormalNr(i, 3); i+=3;
|
{
|
||||||
i+=1;
|
spec->r5type = bufor[i]; ++i;
|
||||||
break;
|
spec->r5amount = readNormalNr(i, 3); i+=3;
|
||||||
}
|
i+=1;
|
||||||
case 6:
|
break;
|
||||||
{
|
}
|
||||||
spec->r6type = bufor[i]; ++i;
|
case 6:
|
||||||
spec->r6amount = bufor[i]; ++i;
|
{
|
||||||
break;
|
spec->r6type = bufor[i]; ++i;
|
||||||
}
|
spec->r6amount = bufor[i]; ++i;
|
||||||
case 7:
|
break;
|
||||||
{
|
}
|
||||||
int abid = bufor[i]; ++i;
|
case 7:
|
||||||
spec->r7ability = CGameInfo::mainObj->abilh->abilities[abid];
|
{
|
||||||
spec->r7level = bufor[i]; ++i;
|
int abid = bufor[i]; ++i;
|
||||||
break;
|
spec->r7ability = CGameInfo::mainObj->abilh->abilities[abid];
|
||||||
}
|
spec->r7level = bufor[i]; ++i;
|
||||||
case 8:
|
break;
|
||||||
{
|
}
|
||||||
int artid = readNormalNr(i, (map.version == RoE ? 1 : 2)); i+=(map.version == RoE ? 1 : 2);
|
case 8:
|
||||||
spec->r8art = &(CGameInfo::mainObj->arth->artifacts[artid]);
|
{
|
||||||
break;
|
int artid = readNormalNr(i, (map.version == RoE ? 1 : 2)); i+=(map.version == RoE ? 1 : 2);
|
||||||
}
|
spec->r8art = &(CGameInfo::mainObj->arth->artifacts[artid]);
|
||||||
case 9:
|
break;
|
||||||
{
|
}
|
||||||
int spellid = bufor[i]; ++i;
|
case 9:
|
||||||
spec->r9spell = &(CGameInfo::mainObj->spellh->spells[spellid]);
|
{
|
||||||
break;
|
int spellid = bufor[i]; ++i;
|
||||||
}
|
spec->r9spell = &(CGameInfo::mainObj->spellh->spells[spellid]);
|
||||||
case 10:
|
break;
|
||||||
{
|
}
|
||||||
int creid = readNormalNr(i, 2); i+=2;
|
case 10:
|
||||||
spec->r10creature = &(CGameInfo::mainObj->creh->creatures[creid]);
|
{
|
||||||
spec->r10amount = readNormalNr(i, 2); i+=2;
|
int creid = readNormalNr(i, 2); i+=2;
|
||||||
break;
|
spec->r10creature = &(CGameInfo::mainObj->creh->creatures[creid]);
|
||||||
}
|
spec->r10amount = readNormalNr(i, 2); i+=2;
|
||||||
}// end of internal switch
|
break;
|
||||||
i+=2;
|
}
|
||||||
|
}// end of internal switch
|
||||||
|
i+=2;
|
||||||
|
}
|
||||||
|
else //missionType==255
|
||||||
|
{
|
||||||
|
i+=3;
|
||||||
|
}
|
||||||
nobj->info = spec;
|
nobj->info = spec;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EDefType::WITCHHUT_DEF:
|
case EDefType::WITCHHUT_DEF:
|
||||||
{
|
{
|
||||||
CWitchHutObjInfo * spec = new CWitchHutObjInfo;
|
CWitchHutObjInfo * spec = new CWitchHutObjInfo;
|
||||||
ist=i; //starting i for loop
|
if(map.version>RoE) //in reo we cannot specify it - all are allowed (I hope)
|
||||||
for(i; i<ist+4; ++i)
|
|
||||||
{
|
{
|
||||||
unsigned char c = bufor[i];
|
ist=i; //starting i for loop
|
||||||
for(int yy=0; yy<8; ++yy)
|
for(i; i<ist+4; ++i)
|
||||||
{
|
{
|
||||||
if((i-ist)*8+yy < CGameInfo::mainObj->abilh->abilities.size())
|
unsigned char c = bufor[i];
|
||||||
|
for(int yy=0; yy<8; ++yy)
|
||||||
{
|
{
|
||||||
if(c == (c|((unsigned char)intPow(2, yy))))
|
if((i-ist)*8+yy < CGameInfo::mainObj->abilh->abilities.size())
|
||||||
spec->allowedAbilities.push_back(CGameInfo::mainObj->abilh->abilities[(i-ist)*8+yy]);
|
{
|
||||||
|
if(c == (c|((unsigned char)intPow(2, yy))))
|
||||||
|
spec->allowedAbilities.push_back(CGameInfo::mainObj->abilh->abilities[(i-ist)*8+yy]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else //(RoE map)
|
||||||
|
{
|
||||||
|
for(int gg=0; gg<CGameInfo::mainObj->abilh->abilities.size(); ++gg)
|
||||||
|
{
|
||||||
|
spec->allowedAbilities.push_back(CGameInfo::mainObj->abilh->abilities[gg]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nobj->info = spec;
|
nobj->info = spec;
|
||||||
break;
|
break;
|
||||||
|
@ -791,7 +791,7 @@ int CCreatureAnimation::nextFrame(SDL_Surface *dest, int x, int y)
|
|||||||
{
|
{
|
||||||
for (int j=0;j<FullWidth+add;j++)
|
for (int j=0;j<FullWidth+add;j++)
|
||||||
{
|
{
|
||||||
if( i+y<dest->h && j+x<dest->w)
|
if( i+y<dest->h && j+x<dest->w && i+y>=0 && j+x>=0)
|
||||||
{
|
{
|
||||||
unsigned char coln = FTemp[i*(FullWidth+add)+j]; //number of color from palette
|
unsigned char coln = FTemp[i*(FullWidth+add)+j]; //number of color from palette
|
||||||
if(coln==0)
|
if(coln==0)
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
class CSeerHutObjInfo : public CSpecObjInfo
|
class CSeerHutObjInfo : public CSpecObjInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
char missionType; //type of mission: 0 - no mission; 1 - reach level; 2 - reach main statistics values; 3 - win with a certain hero; 4 - win with a certain creature; 5 - collect some atifacts; 6 - have certain troops in army; 7 - collect resources; 8 - be a certain hero; 9 - be a certain player
|
unsigned char missionType; //type of mission: 0 - no mission; 1 - reach level; 2 - reach main statistics values; 3 - win with a certain hero; 4 - win with a certain creature; 5 - collect some atifacts; 6 - have certain troops in army; 7 - collect resources; 8 - be a certain hero; 9 - be a certain player
|
||||||
bool isDayLimit; //if true, there is a day limit
|
bool isDayLimit; //if true, there is a day limit
|
||||||
int lastDay; //after this day (first day is 0) mission cannot be completed
|
int lastDay; //after this day (first day is 0) mission cannot be completed
|
||||||
//for mission 1
|
//for mission 1
|
||||||
|
@ -689,7 +689,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
|||||||
|
|
||||||
SDL_Rect pp = ttiles[x+bx][y+by][level].objects[h].second.first;
|
SDL_Rect pp = ttiles[x+bx][y+by][level].objects[h].second.first;
|
||||||
CGHeroInstance * themp = (dynamic_cast<CGHeroInstance*>(ttiles[x+bx][y+by][level].objects[h].first));
|
CGHeroInstance * themp = (dynamic_cast<CGHeroInstance*>(ttiles[x+bx][y+by][level].objects[h].first));
|
||||||
if(themp && themp->moveDir && !themp->isStanding)
|
if(themp && themp->moveDir && !themp->isStanding && themp->ID!=62) //last condition - this is not prison
|
||||||
{
|
{
|
||||||
int imgVal = 8;
|
int imgVal = 8;
|
||||||
SDL_Surface * tb;
|
SDL_Surface * tb;
|
||||||
@ -857,7 +857,7 @@ SDL_Surface * CMapHandler::terrainRect(int x, int y, int dx, int dy, int level,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(themp && themp->moveDir && themp->isStanding)
|
else if(themp && themp->moveDir && themp->isStanding && themp->ID!=62) //last condition - this is not prison
|
||||||
{
|
{
|
||||||
int imgVal = 8;
|
int imgVal = 8;
|
||||||
SDL_Surface * tb;
|
SDL_Surface * tb;
|
||||||
@ -1880,7 +1880,7 @@ std::string CMapHandler::getRandomizedDefName(CGDefInfo *di, CGObjectInstance *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int lvl = atoi(di->name.substr(7, 8).c_str());
|
int lvl = atoi(di->name.substr(7, 8).c_str()) - 1;
|
||||||
return creGenNames[fraction][lvl];
|
return creGenNames[fraction][lvl];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1897,7 +1897,7 @@ std::string CMapHandler::getRandomizedDefName(CGDefInfo *di, CGObjectInstance *
|
|||||||
possibleTowns.push_back(8);
|
possibleTowns.push_back(8);
|
||||||
|
|
||||||
int fraction = possibleTowns[rand()%possibleTowns.size()];
|
int fraction = possibleTowns[rand()%possibleTowns.size()];
|
||||||
int lvl = atoi(di->name.substr(7, 8).c_str());
|
int lvl = atoi(di->name.substr(7, 8).c_str()) - 1;
|
||||||
return creGenNames[fraction][lvl];
|
return creGenNames[fraction][lvl];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user