diff --git a/CAmbarCendamo.cpp b/CAmbarCendamo.cpp
index b5a2253d8..ef909a84d 100644
--- a/CAmbarCendamo.cpp
+++ b/CAmbarCendamo.cpp
@@ -405,8 +405,8 @@ void CAmbarCendamo::deh3m()
}
THC std::cout<<"Wczytywanie defow: "<
objh->objInstances.size();
@@ -958,6 +958,175 @@ void CAmbarCendamo::deh3m()
spec->completedText += bufor[i]; ++i;
}
+ unsigned char rewardType = bufor[i]; ++i;
+ spec->rewardType = rewardType;
+
+ switch(rewardType)
+ {
+ 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;
+ 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, 2); i+=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;
+ nobj.info = spec;
+ break;
+ }
+ case EDefType::WITCHHUT_DEF:
+ {
+ CWitchHutObjInfo * spec = new CWitchHutObjInfo;
+ ist=i; //starting i for loop
+ for(i; iabilh->abilities.size())
+ {
+ if(c == (c|((unsigned char)intPow(2, yy))))
+ spec->allowedAbilities.push_back(&(CGameInfo::mainObj->abilh->abilities[(i-ist)*8+yy]));
+ }
+ }
+ }
+
+ nobj.info = spec;
+ break;
+ }
+ case EDefType::SCHOLAR_DEF:
+ {
+ CScholarObjInfo * spec = new CScholarObjInfo;
+ spec->bonusType = bufor[i]; ++i;
+ switch(spec->bonusType)
+ {
+ case 0xff:
+ ++i;
+ break;
+ case 0:
+ spec->r0type = bufor[i]; ++i;
+ break;
+ case 1:
+ spec->r1 = &(CGameInfo::mainObj->abilh->abilities[bufor[i]]); ++i;
+ break;
+ case 2:
+ spec->r2 = &(CGameInfo::mainObj->spellh->spells[bufor[i]]); ++i;
+ break;
+ }
+ i+=6;
+ nobj.info = spec;
+ break;
+ }
+ case EDefType::GARRISON_DEF:
+ {
+ CGarrisonObjInfo * spec = new CGarrisonObjInfo;
+ spec->player = bufor[i]; ++i;
+ i+=3;
+ spec->units = readCreatureSet(i); i+=28;
+ spec->movableUnits = bufor[i]; ++i;
+ i+=8;
+ nobj.info = spec;
+ break;
+ }
+ case EDefType::ARTIFACT_DEF:
+ {
+ CArtifactObjInfo * spec = new CArtifactObjInfo;
+ bool areSettings = bufor[i]; ++i;
+ if(areSettings)
+ {
+ int messLength = readNormalNr(i, 4); i+=4;
+ for(int hh=0; hhmessage += bufor[i]; ++i;
+ }
+ bool areGuards = bufor[i]; ++i;
+ if(areGuards)
+ {
+ spec->areGuards = true;
+ spec->guards = readCreatureSet(i);
+ }
+ else
+ spec->areGuards = false;
+ }
+ nobj.info = spec;
+ break;
+ }
+ case EDefType::RESOURCE_DEF:
+ {
+ CResourceObjInfo * spec = new CResourceObjInfo;
+ bool isMessGuard = bufor[i]; ++i;
+ if(isMessGuard)
+ {
+ int messLength = readNormalNr(i); i+=4;
+ for(int mm=0; mmmessage+=bufor[i]; ++i;
+ }
+ spec->areGuards = bufor[i]; ++i;
+ if(spec->areGuards)
+ {
+ spec->guards = readCreatureSet(i); i+=28;
+ }
+ i+=4;
+ }
+ else
+ {
+ spec->areGuards = false;
+ }
+ spec->amount = readNormalNr(i); i+=4;
+ i+=4;
nobj.info = spec;
break;
}
@@ -1014,27 +1183,31 @@ EDefType CAmbarCendamo::getDefType(DefInfo &a)
switch(a.bytes[16])
{
case 5:
- return EDefType::ARTIFACT_DEF;
+ return EDefType::ARTIFACT_DEF; //handled
case 26:
- return EDefType::EVENTOBJ_DEF;
+ return EDefType::EVENTOBJ_DEF; //handled
case 33:
- return EDefType::GARRISON_DEF;
+ return EDefType::GARRISON_DEF; //handled
case 34:
- return EDefType::HERO_DEF;
+ return EDefType::HERO_DEF; //handled
case 54:
- return EDefType::CREATURES_DEF;
+ return EDefType::CREATURES_DEF; //handled
case 59:
- return EDefType::SIGN_DEF;
+ return EDefType::SIGN_DEF; //handled
case 79:
- return EDefType::RESOURCE_DEF;
+ return EDefType::RESOURCE_DEF; //handled
+ case 81:
+ return EDefType::SCHOLAR_DEF; //handled
case 83:
- return EDefType::SEERHUT_DEF;
+ return EDefType::SEERHUT_DEF; //handled
case 91:
- return EDefType::SIGN_DEF;
+ return EDefType::SIGN_DEF; //handled
case 98:
return EDefType::TOWN_DEF;
+ case 113:
+ return EDefType::WITCHHUT_DEF; //handled
case 219:
- return EDefType::GARRISON_DEF;
+ return EDefType::GARRISON_DEF; //handled
default:
return EDefType::TERRAINOBJ_DEF;
}
diff --git a/CAmbarCendamo.h b/CAmbarCendamo.h
index de7f35e0c..e2d81048c 100644
--- a/CAmbarCendamo.h
+++ b/CAmbarCendamo.h
@@ -10,7 +10,7 @@
#include "CSemiDefHandler.h"
#include "CCreatureHandler.h"
-enum EDefType {TOWN_DEF, HERO_DEF, CREATURES_DEF, SEERHUT_DEF, RESOURCE_DEF, TERRAINOBJ_DEF, EVENTOBJ_DEF, SIGN_DEF, GARRISON_DEF, ARTIFACT_DEF};
+enum EDefType {TOWN_DEF, HERO_DEF, CREATURES_DEF, SEERHUT_DEF, RESOURCE_DEF, TERRAINOBJ_DEF, EVENTOBJ_DEF, SIGN_DEF, GARRISON_DEF, ARTIFACT_DEF, WITCHHUT_DEF, SCHOLAR_DEF};
class CAmbarCendamo
{
diff --git a/CObjectHandler.h b/CObjectHandler.h
index abd0914fc..3f99326f0 100644
--- a/CObjectHandler.h
+++ b/CObjectHandler.h
@@ -108,6 +108,74 @@ public:
int m9player; //number; from 0 to 7
std::string firstVisitText, nextVisitText, completedText;
+
+ char rewardType; //type of reward: 0 - no reward; 1 - experience; 2 - mana points; 3 - morale bonus; 4 - luck bonus; 5 - resources; 6 - main ability bonus (attak, defence etd.); 7 - secondary ability gain; 8 - artifact; 9 - spell; 10 - creature
+ //for reward 1
+ int r1exp;
+ //for reward 2
+ int r2mana;
+ //for reward 3
+ int r3morale;
+ //for reward 4
+ int r4luck;
+ //for reward 5
+ unsigned char r5type; //0 - wood, 1 - mercury, 2 - ore, 3 - sulfur, 4 - crystal, 5 - gems, 6 - gold
+ int r5amount;
+ //for reward 6
+ unsigned char r6type; //0 - attack, 1 - defence, 2 - power, 3 - knowledge
+ int r6amount;
+ //for reward 7
+ CAbility * r7ability;
+ unsigned char r7level; //1 - basic, 2 - advanced, 3 - expert
+ //for reward 8
+ CArtifact * r8art;
+ //for reward 9
+ CSpell * r9spell;
+ //for reward 10
+ CCreature * r10creature;
+ int r10amount;
+};
+
+class CWitchHutObjInfo : public CSpecObjInfo
+{
+public:
+ std::vector allowedAbilities;
+};
+
+class CScholarObjInfo : public CSpecObjInfo
+{
+public:
+ unsigned char bonusType; //255 - random, 0 - primary skill, 1 - secondary skill, 2 - spell
+
+ unsigned char r0type;
+ CAbility * r1;
+ CSpell * r2;
+};
+
+class CGarrisonObjInfo : public CSpecObjInfo
+{
+public:
+ unsigned char player; //255 - nobody; 0 - 7 - players
+ CCreatureSet units;
+ bool movableUnits; //if true, units can be moved
+};
+
+class CArtifactObjInfo : public CSpecObjInfo
+{
+public:
+ bool areGuards;
+ std::string message;
+ CCreatureSet guards;
+};
+
+class CResourceObjInfo : public CSpecObjInfo
+{
+public:
+ bool randomAmount;
+ int amount; //if not random
+ bool areGuards;
+ CCreatureSet guards;
+ std::string message;
};
class CObject //typical object that can be encountered on a map