- Added enums for status and player race, traits, and skills.

- The player race enum has been expanded so that it can also be used as monster race; it's not yet used as such though.
- Additional races Vahnatai, Plant, and Bird added.
- Alter the terrain special flags so that they can be used as signed shorts in the few cases that require it, and changed dangerous terrain to combine the curse/bless and slow/haste cases.
- Fixed an unnoticed error which would have probably prevented monsters from being affected by conveyors.
- Refined the dangerous terrain special ability with more messages and also handling all cases except weapon poison.

git-svn-id: http://openexile.googlecode.com/svn/trunk@79 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-05-29 04:47:54 +00:00
parent 2485e57514
commit 50829034a9
121 changed files with 333 additions and 273 deletions

View File

@@ -132,3 +132,29 @@ cMonster::cAttack& cMonster::cAttack::operator=(int n){
dice = n / 100;
sides = n % 100;
}
std::ostream& operator << (std::ostream& out, eStatus& e){
return out << (int) e;
}
std::istream& operator >> (std::istream& in, eStatus& e){
int i;
in >> i;
if(i > 0 && i < 14)
e = (eStatus) i;
else e = STATUS_POISONED_WEAPON;
return in;
}
std::ostream& operator << (std::ostream& out, eRace& e){
return out << (int) e;
}
std::istream& operator >> (std::istream& in, eRace& e){
int i;
in >> i;
if(i > 0 && i < 20)
e = (eRace) i;
else e = RACE_HUMAN;
return in;
}

View File

@@ -17,10 +17,52 @@ namespace legacy {
struct creature_data_type;
struct creature_start_type;
};
/* Monsters Stuff */
typedef unsigned short m_num_t;
/* adven[i].race */ //complete
enum eRace {
RACE_UNKNOWN = -1, // for parameters to some functions; not valid in the class
RACE_HUMAN = 0,
RACE_NEPHIL = 1,
RACE_SLITH = 2,
RACE_VAHNATAI = 3,
RACE_REPTILE = 4,
RACE_BEAST = 5,
RACE_IMPORTANT = 6,
RACE_MAGE = 7,
RACE_PRIEST = 8,
RACE_HUMANOID = 9,
RACE_DEMON = 10,
RACE_UNDEAD = 11,
RACE_GIANT = 12,
RACE_SLIME = 13,
RACE_STONE = 14,
RACE_BUG = 15,
RACE_DRAGON = 16,
RACE_MAGICAL = 17,
RACE_PLANT = 18,
RACE_BIRD = 19,
}; // TODO: Expand and merge with eMonsterType
/* adven[i].status*/ //complete - assign a positive value for a help pc effect, a negative for harm pc
enum eStatus {
STATUS_POISONED_WEAPON = 0,
STATUS_BLESS_CURSE = 1,
STATUS_POISON = 2,
STATUS_HASTE_SLOW = 3,
STATUS_INVULNERABLE = 4,
STATUS_MAGIC_RESISTANCE = 5,
STATUS_WEBS = 6,
STATUS_DISEASE = 7,
STATUS_INVISIBLE = 8, //sanctuary
STATUS_DUMB = 9,
STATUS_MARTYRS_SHIELD = 10,
STATUS_ASLEEP = 11,
STATUS_PARALYZED = 12,
STATUS_ACID = 13,
};
/* Monster Type */
enum eMonsterType {
MONSTER_TYPE_UNKNOWN = -1, // for parameters to some functions; not valid in the class
@@ -165,4 +207,8 @@ public:
cCreature& operator = (legacy::creature_start_type old);
};
std::ostream& operator << (std::ostream& out, eStatus& e);
std::istream& operator >> (std::istream& in, eStatus& e);
std::ostream& operator << (std::ostream& out, eRace& e);
std::istream& operator >> (std::istream& in, eRace& e);
#endif

View File

@@ -44,7 +44,7 @@ cPlayer& cPlayer::operator = (legacy::pc_record_type old){
}
which_graphic = old.which_graphic;
weap_poisoned = old.weap_poisoned;
race = old.race;
race = (eRace) old.race;
//exp_adj = old.exp_adj;
direction = old.direction;
return *this;
@@ -97,7 +97,7 @@ cPlayer::cPlayer(){
//advan[i] = false;
traits[i] = false;
}
race = 0;
race = RACE_HUMAN;
//exp_adj = 100;
direction = 0;
}
@@ -155,7 +155,7 @@ cPlayer::cPlayer(long key,short slot){
traits[i] = false;
}
race = 0;
race = RACE_HUMAN;
//exp_adj = 100;
direction = 0;
}else if(key == 'dflt'){
@@ -228,7 +228,7 @@ cPlayer::cPlayer(long key,short slot){
//advan[i] = false;
}
race = pc_race[slot];
race = (eRace) pc_race[slot];
//exp_adj = 100;
direction = 0;

View File

@@ -14,6 +14,49 @@
namespace legacy { struct pc_record_type; };
/* adven[i].skills */ //complete
enum eSkill {
SKILL_STRENGTH = 0,
SKILL_DEXTERITY = 1,
SKILL_INTELLIGENCE = 2,
SKILL_EDGED_WEAPONS = 3,
SKILL_BASHING_WEAPONS = 4,
SKILL_POLE_WEAPONS = 5,
SKILL_THROWN_MISSILES = 6,
SKILL_ARCHERY = 7,
SKILL_DEFENSE = 8,
SKILL_MAGE_SPELLS = 9,
SKILL_PRIEST_SPELLS = 10,
SKILL_MAGE_LORE = 11,
SKILL_ALCHEMY = 12,
SKILL_ITEM_LORE = 13,
SKILL_DISARM_TRAPS = 14,
SKILL_LOCKPICKING = 15,
SKILL_ASSASSINATION = 16,
SKILL_POISON = 17,
SKILL_LUCK = 18,
};
/* adven[i].traits */ //complete
enum eTrait {
TRAIT_TOUGHNESS = 0,
TRAIT_MAGICALLY_APT = 1,
TRAIT_AMBIDEXTROUS = 2,
TRAIT_NIMBLE = 3,
TRAIT_CAVE_LORE = 4,
TRAIT_WOODSMAN = 5,
TRAIT_GOOD_CONST = 6,
TRAIT_HIGHLY_ALERT = 7,
TRAIT_STRENGTH = 8,
TRAIT_RECUPERATION = 9,
TRAIT_SLUGGISH = 10,
TRAIT_MAGICALLY_INEPT = 11,
TRAIT_FRAIL = 12,
TRAIT_CHRONIC_DISEASE = 13,
TRAIT_BAD_BACK = 14,
TRAIT_PACIFIST = 15,
};
enum eMainStatus {
MAIN_STATUS_ABSENT = 0, // absent, empty slot
MAIN_STATUS_ALIVE = 1,
@@ -56,7 +99,7 @@ public:
short weap_poisoned;
//bool advan[15];
bool traits[15];
short race;
eRace race;
//short exp_adj;
short direction;
short ap;

View File

@@ -112,139 +112,139 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){
trim_ter = 0;
}
if(trim_ter == 99) trim_ter = 0;
flag1 = old.flag1;
flag2 = old.flag2;
flag1.u = old.flag1;
flag2.u = old.flag2;
switch(old.special){
case 0:
if(i == 7 || i == 10 || i == 13 || i == 16){
special = TER_SPEC_NONE;
flag1 = 23;
flag2 = flag3 = 0;
flag1.s = 23;
flag2.u = flag3.u = 0;
}else if(picture == 215 || (picture >= 218 && picture <= 221)){
picture = 215;
special = TER_SPEC_NONE;
flag1 = 3;
flag2 = flag3 = 0;
flag1.s = 3;
flag2.u = flag3.u = 0;
}else if(picture == 216 || (picture >= 222 && picture <= 225)){
picture = 215;
special = TER_SPEC_NONE;
flag1 = 2;
flag2 = flag3 = 0;
flag1.s = 2;
flag2.u = flag3.u = 0;
}else if(picture == 143) {
special = TER_SPEC_BED;
flag1 = 230;
flag2 = flag3 = 0;
flag1.s = 230;
flag2.u = flag3.u = 0;
}else if((picture >= 61 && picture <= 66) || picture == 401 || picture == 402){
special = TER_SPEC_BRIDGE;
flag1 = flag2 = flag3 = 0;
flag1.u = flag2.u = flag3.u = 0;
break;
}else{
special = TER_SPEC_NONE;
flag1 = 255;
flag2 = flag3 = 0;
flag1.s = -1;
flag2.u = flag3.u = 0;
}
break;
case 1:
special = TER_SPEC_CHANGE_WHEN_STEP_ON;
flag3 = 0;
flag3.u = 0;
break;
case 2:
special = TER_SPEC_DAMAGING;
flag3 = DAMAGE_FIRE;
flag3.u = DAMAGE_FIRE;
break;
case 3:
special = TER_SPEC_DAMAGING;
flag3 = DAMAGE_COLD;
flag3.u = DAMAGE_COLD;
break;
case 4:
special = TER_SPEC_DAMAGING;
flag3 = DAMAGE_MAGIC;
flag3.u = DAMAGE_MAGIC;
break;
case 5:
special = TER_SPEC_DANGEROUS;
flag3 = STATUS_POISON;
flag3.u = STATUS_POISON;
break;
case 6:
special = TER_SPEC_DANGEROUS;
flag3 = STATUS_DISEASE;
flag3.u = STATUS_DISEASE;
break;
case 7:
special = TER_SPEC_CRUMBLING;
flag2 = 0; // ???: may change this
flag3 = 1; // destroyed by Move Mountains but not by quickfire; 0 = both, 2 = quickfire only
flag2.u = 0; // ???: may change this
flag3.u = 1; // destroyed by Move Mountains but not by quickfire; 0 = both, 2 = quickfire only
break;
case 8:
special = TER_SPEC_LOCKABLE;
flag3 = 0;
flag3.u = 0;
break;
case 9:
special = TER_SPEC_UNLOCKABLE;
flag3 = false; // can't bash
flag3.u = false; // can't bash
break;
case 10:
special = TER_SPEC_UNLOCKABLE;
flag3 = true; // can bash
flag3.u = true; // can bash
break;
case 11:
special = TER_SPEC_IS_A_SIGN;
flag3 = 0;
flag3.u = 0;
break;
case 12:
special = TER_SPEC_CALL_SPECIAL;
flag2 = 0; // local special, always (1 would be local if in town, global if outdoors)
flag3 = 255;
flag2.u = 0; // local special, always (1 would be local if in town, global if outdoors)
flag3.s = -1;
break;
case 13:
special = TER_SPEC_CALL_SPECIAL;
flag2 = 3; // global special, always (2 would be local if outdoors, global if in town)
flag3 = 255;
flag2.u = 3; // global special, always (2 would be local if outdoors, global if in town)
flag3.s = -1;
break;
case 14:
special = TER_SPEC_IS_A_CONTAINER;
flag3 = 0;
flag3.u = 0;
break;
case 15:
special = TER_SPEC_WATERFALL;
flag1 = DIR_S;
flag3 = 0;
flag1.u = DIR_S;
flag3.u = 0;
break;
case 16:
special = TER_SPEC_CONVEYOR;
flag1 = DIR_N;
flag3 = 0;
flag1.u = DIR_N;
flag3.u = 0;
break;
case 17:
special = TER_SPEC_CONVEYOR;
flag1 = DIR_E;
flag3 = 0;
flag1.u = DIR_E;
flag3.u = 0;
break;
case 18:
special = TER_SPEC_CONVEYOR;
flag1 = DIR_S;
flag3 = 0;
flag1.u = DIR_S;
flag3.u = 0;
break;
case 19:
special = TER_SPEC_CONVEYOR;
flag1 = DIR_W;
flag3 = 0;
flag1.u = DIR_W;
flag3.u = 0;
break;
case 20:
special = TER_SPEC_BLOCKED_TO_MONSTERS;
flag3 = 0;
flag3.u = 0;
break;
case 21:
special = TER_SPEC_TOWN_ENTRANCE;
flag3 = 0;
flag3.u = 0;
break;
case 22:
special = TER_SPEC_CHANGE_WHEN_USED;
flag2 = 3;
flag3 = 0;
flag2.u = 3;
flag3.u = 0;
break;
case 23:
special = TER_SPEC_CALL_SPECIAL_WHEN_USED;
flag2 = 3; // global special, always (2 would be local if outdoors, global if in town)
flag3 = 255;
flag2.u = 3; // global special, always (2 would be local if outdoors, global if in town)
flag3.s = -1;
break;
}
trans_to_what = old.trans_to_what;

View File

@@ -105,14 +105,17 @@ enum eTrimType {
TRIM_CITY = 18, // the game will join roads up to this space but not draw roads on the space
};
// Depending on the special ability, the flags may need to be treated as either signed or unsigned
union ter_flag_t {signed short s; unsigned short u;};
class cTerrain {
public:
std::string name;
short picture;
unsigned char blockage;
unsigned short flag1;
unsigned short flag2;
unsigned short flag3; // new additional flag for special properties
ter_flag_t flag1;
ter_flag_t flag2;
ter_flag_t flag3; // new additional flag for special properties
eTerSpec special;
ter_num_t trans_to_what;
unsigned char fly_over;