Lot more tests!
- Tests for converting legacy terrain types - Tests for initialization to sane values Fixes: - cCreature no longer initializes spec1 and spec2 to 0. This probably didn't cause bugs, but who knows... - In fact, cCreature no longer explicitly initializes anything in its cTownperson superclass. That's what the superclass constructor is for after all. - Relatedly, cTownperson now defaults to a facial graphic of -1. Also a docile attitude. - iLiving defaults to ap 0, direction here. - Fix Change When Step terrains to properly support not having a sound while still allowing an arbitrary number of custom sounds. - Add support for a lack of sound to Change When Used terrains, including at conversion time (original game supported it but OBoE was forcing the sound to a door sound). - Fix conversion of crumbling terrain types (old conversion was allowing quickfire to destroy them) Other: - New addAttack method in cMonster. - Change snd_num_t to signed, because it's been getting annoying that I can't easily use -1 to mean "no sound".
This commit is contained in:
@@ -17,15 +17,11 @@
|
||||
|
||||
const short cCreature::charm_odds[21] = {90,90,85,80,78, 75,73,60,40,30, 20,10,4,1,0, 0,0,0,0,0, 0};
|
||||
|
||||
cCreature::cCreature(){
|
||||
number = active = 0;
|
||||
attitude = start_attitude = eAttitude::DOCILE;
|
||||
start_loc.x = start_loc.y = cur_loc.x = cur_loc.y = targ_loc.x = targ_loc.y = 80;
|
||||
mobility = 1;
|
||||
summon_time = 0;
|
||||
time_flag = eMonstTime::ALWAYS;
|
||||
spec1 = spec2 = spec_enc_code = time_code = monster_time = 0;
|
||||
personality = special_on_kill = facial_pic = -1;
|
||||
cCreature::cCreature() {
|
||||
active = 0;
|
||||
attitude = eAttitude::DOCILE;
|
||||
cur_loc.x = cur_loc.y = targ_loc.x = targ_loc.y = 80;
|
||||
summon_time = 0;
|
||||
target = 6;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ class iLiving {
|
||||
public:
|
||||
// HACK: This is only really marked mutable so that I can use operator[] from const methods
|
||||
mutable std::map<eStatus,short> status;
|
||||
short ap;
|
||||
eDirection direction;
|
||||
short ap = 0;
|
||||
eDirection direction = DIR_HERE;
|
||||
short marked_damage = 0; // for use during animations
|
||||
|
||||
virtual bool is_alive() const = 0;
|
||||
|
||||
@@ -138,6 +138,17 @@ void cMonster::append(legacy::monster_record_type& old){
|
||||
see_spec = -1;
|
||||
}
|
||||
|
||||
int cMonster::addAttack(unsigned short dice, unsigned short sides, eMonstMelee type) {
|
||||
int which = 0;
|
||||
while(which < 3 && a[which].dice > 0 && a[which].sides > 0)
|
||||
which++;
|
||||
if(which >= 3) return -1;
|
||||
a[which].dice = dice;
|
||||
a[which].sides = sides;
|
||||
a[which].type = type;
|
||||
return which;
|
||||
}
|
||||
|
||||
std::map<eMonstAbil,uAbility>::iterator cMonster::addAbil(eMonstAbilTemplate what, int param) {
|
||||
switch(what) {
|
||||
// Missiles: {true, type, missile pic, dice, sides, skill, range, odds}
|
||||
@@ -415,6 +426,8 @@ cTownperson::cTownperson() {
|
||||
personality = -1;
|
||||
special_on_kill = -1;
|
||||
special_on_talk = -1;
|
||||
facial_pic = -1;
|
||||
start_attitude = eAttitude::DOCILE;
|
||||
}
|
||||
|
||||
cTownperson::cTownperson(location loc, mon_num_t num, const cMonster& monst) : cTownperson() {
|
||||
|
||||
@@ -120,6 +120,7 @@ public:
|
||||
spec_num_t see_spec;
|
||||
|
||||
std::map<eMonstAbil,uAbility>::iterator addAbil(eMonstAbilTemplate what, int param = 0);
|
||||
int addAttack(unsigned short dice, unsigned short sides, eMonstMelee type = eMonstMelee::SWING);
|
||||
|
||||
void append(legacy::monster_record_type& old);
|
||||
cMonster();
|
||||
|
||||
@@ -162,6 +162,7 @@ void cTerrain::append(legacy::terrain_type_type& old){
|
||||
break;
|
||||
case 1:
|
||||
special = eTerSpec::CHANGE_WHEN_STEP_ON;
|
||||
if(flag2 == 200) flag2 = -1;
|
||||
flag3 = 0;
|
||||
break;
|
||||
case 2:
|
||||
@@ -186,7 +187,7 @@ void cTerrain::append(legacy::terrain_type_type& old){
|
||||
break;
|
||||
case 7:
|
||||
special = eTerSpec::CRUMBLING;
|
||||
flag2 = 1; // destroyed by Move Mountains but not by quickfire; 0 = both, 2 = quickfire only
|
||||
flag2 = 0; // destroyed by Move Mountains but not by quickfire; 1 = both, 2 = quickfire only
|
||||
break;
|
||||
case 8:
|
||||
special = eTerSpec::LOCKABLE;
|
||||
@@ -254,7 +255,6 @@ void cTerrain::append(legacy::terrain_type_type& old){
|
||||
break;
|
||||
case 22:
|
||||
special = eTerSpec::CHANGE_WHEN_USED;
|
||||
flag2 = 59;
|
||||
flag3 = 0;
|
||||
break;
|
||||
case 23:
|
||||
|
||||
Reference in New Issue
Block a user