1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00

possibly handles all H3 maps inculding RoE

This commit is contained in:
mateuszb 2008-01-08 16:08:25 +00:00
parent ef90e6140f
commit a4e4c97776
4 changed files with 103 additions and 78 deletions

View File

@ -1228,9 +1228,19 @@ void CAmbarCendamo::deh3m()
else //RoE else //RoE
{ {
int artID = bufor[i]; ++i; int artID = bufor[i]; ++i;
if(artID!=255) //not none quest
{
spec->m5arts.push_back(&(CGameInfo::mainObj->arth->artifacts[artID])); spec->m5arts.push_back(&(CGameInfo::mainObj->arth->artifacts[artID]));
spec->missionType = 5;
}
else
{
spec->missionType = 255;
}
} }
if(spec->missionType!=255)
{
unsigned char rewardType = bufor[i]; ++i; unsigned char rewardType = bufor[i]; ++i;
spec->rewardType = rewardType; spec->rewardType = rewardType;
@ -1297,12 +1307,19 @@ void CAmbarCendamo::deh3m()
} }
}// end of internal switch }// end of internal switch
i+=2; 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;
if(map.version>RoE) //in reo we cannot specify it - all are allowed (I hope)
{
ist=i; //starting i for loop ist=i; //starting i for loop
for(i; i<ist+4; ++i) for(i; i<ist+4; ++i)
{ {
@ -1316,6 +1333,14 @@ void CAmbarCendamo::deh3m()
} }
} }
} }
}
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;

View File

@ -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)

View File

@ -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

View File

@ -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];
} }
} }