1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +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,94 +1228,119 @@ void CAmbarCendamo::deh3m()
else //RoE
{
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;
spec->rewardType = rewardType;
switch(rewardType)
if(spec->missionType!=255)
{
case 1:
unsigned char rewardType = bufor[i]; ++i;
spec->rewardType = rewardType;
switch(rewardType)
{
spec->r1exp = readNormalNr(i); i+=4;
break;
}
case 2:
{
spec->r2mana = readNormalNr(i); i+=4;
break;
}
case 3:
{
spec->r3morale = bufor[i]; ++i;
break;
}
case 4:
{
spec->r4luck = bufor[i]; ++i;
break;
}
case 5:
{
spec->r5type = bufor[i]; ++i;
spec->r5amount = readNormalNr(i, 3); i+=3;
i+=1;
break;
}
case 6:
{
spec->r6type = bufor[i]; ++i;
spec->r6amount = bufor[i]; ++i;
break;
}
case 7:
{
int abid = bufor[i]; ++i;
spec->r7ability = CGameInfo::mainObj->abilh->abilities[abid];
spec->r7level = bufor[i]; ++i;
break;
}
case 8:
{
int artid = readNormalNr(i, (map.version == RoE ? 1 : 2)); i+=(map.version == RoE ? 1 : 2);
spec->r8art = &(CGameInfo::mainObj->arth->artifacts[artid]);
break;
}
case 9:
{
int spellid = bufor[i]; ++i;
spec->r9spell = &(CGameInfo::mainObj->spellh->spells[spellid]);
break;
}
case 10:
{
int creid = readNormalNr(i, 2); i+=2;
spec->r10creature = &(CGameInfo::mainObj->creh->creatures[creid]);
spec->r10amount = readNormalNr(i, 2); i+=2;
break;
}
}// end of internal switch
i+=2;
case 1:
{
spec->r1exp = readNormalNr(i); i+=4;
break;
}
case 2:
{
spec->r2mana = readNormalNr(i); i+=4;
break;
}
case 3:
{
spec->r3morale = bufor[i]; ++i;
break;
}
case 4:
{
spec->r4luck = bufor[i]; ++i;
break;
}
case 5:
{
spec->r5type = bufor[i]; ++i;
spec->r5amount = readNormalNr(i, 3); i+=3;
i+=1;
break;
}
case 6:
{
spec->r6type = bufor[i]; ++i;
spec->r6amount = bufor[i]; ++i;
break;
}
case 7:
{
int abid = bufor[i]; ++i;
spec->r7ability = CGameInfo::mainObj->abilh->abilities[abid];
spec->r7level = bufor[i]; ++i;
break;
}
case 8:
{
int artid = readNormalNr(i, (map.version == RoE ? 1 : 2)); i+=(map.version == RoE ? 1 : 2);
spec->r8art = &(CGameInfo::mainObj->arth->artifacts[artid]);
break;
}
case 9:
{
int spellid = bufor[i]; ++i;
spec->r9spell = &(CGameInfo::mainObj->spellh->spells[spellid]);
break;
}
case 10:
{
int creid = readNormalNr(i, 2); i+=2;
spec->r10creature = &(CGameInfo::mainObj->creh->creatures[creid]);
spec->r10amount = readNormalNr(i, 2); i+=2;
break;
}
}// end of internal switch
i+=2;
}
else //missionType==255
{
i+=3;
}
nobj->info = spec;
break;
}
case EDefType::WITCHHUT_DEF:
{
CWitchHutObjInfo * spec = new CWitchHutObjInfo;
ist=i; //starting i for loop
for(i; i<ist+4; ++i)
if(map.version>RoE) //in reo we cannot specify it - all are allowed (I hope)
{
unsigned char c = bufor[i];
for(int yy=0; yy<8; ++yy)
ist=i; //starting i for loop
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))))
spec->allowedAbilities.push_back(CGameInfo::mainObj->abilh->abilities[(i-ist)*8+yy]);
if((i-ist)*8+yy < CGameInfo::mainObj->abilh->abilities.size())
{
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;
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++)
{
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
if(coln==0)

View File

@ -93,7 +93,7 @@ public:
class CSeerHutObjInfo : public CSpecObjInfo
{
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
int lastDay; //after this day (first day is 0) mission cannot be completed
//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;
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;
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;
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];
}
else
@ -1897,7 +1897,7 @@ std::string CMapHandler::getRandomizedDefName(CGDefInfo *di, CGObjectInstance *
possibleTowns.push_back(8);
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];
}
}