DM: Add WEAPON_INFO and related enums

This commit is contained in:
Bendegúz Nagy 2016-06-18 12:37:30 +02:00
parent e744d8a427
commit 793ebd32a3

View File

@ -9,6 +9,39 @@
namespace DM {
enum WeaponClass {
/* Class 0: SWING weapons */
kWeaponClassSwingWeapon = 0, // @ C000_CLASS_SWING_WEAPON
/* Class 1 to 15: THROW weapons */
kWeaponClassDaggerAndAxes = 2, // @ C002_CLASS_DAGGER_AND_AXES
kWeaponClassBowAmmunition = 10, // @ C010_CLASS_BOW_AMMUNITION
kWeaponClassSlingAmmunition = 11, // @ C011_CLASS_SLING_AMMUNITION
kWeaponClassPoisinDart = 12, // @ C012_CLASS_POISON_DART
/* Class 16 to 111: SHOOT weapons */
kWeaponClassFirstBow = 16, // @ C016_CLASS_FIRST_BOW
kWeaponClassLastBow = 31, // @ C031_CLASS_LAST_BOW
kWeaponClassFirstSling = 32, // @ C032_CLASS_FIRST_SLING
kWeaponClassLastSling = 47, // @ C047_CLASS_LAST_SLING
/* Class 112 to 255: Magic and special weapons */
kWeaponClassFirstMagicWeapon = 112 // @ C112_CLASS_FIRST_MAGIC_WEAPON
};
class WeaponInfo {
uint16 _attributes; /* Bits 15-13 Unreferenced */
public:
byte _weight;
WeaponClass _class;
byte _strength;
byte _kineticEnergy;
WeaponInfo(byte weight, WeaponClass wClass, byte strength, byte kineticEnergy, uint16 attributes)
: _attributes(attributes), _weight(weight), _class(wClass), _strength(strength), _kineticEnergy(kineticEnergy) {}
uint16 getShootAttack() {return _attributes & 0xFF;} // @ M65_SHOOT_ATTACK
uint16 getProjectileAspectOrdinal() {return (_attributes >> 8) & 0x1F;} // @ M66_PROJECTILE_ASPECT_ORDINAL
}; // @ WEAPON_INFO
int16 ordinalToIndex(int16 val); // @ M01_ORDINAL_TO_INDEX
int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL