From 793ebd32a394bac738c27ac448431ef2c9faed38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bendeg=C3=BAz=20Nagy?= Date: Sat, 18 Jun 2016 12:37:30 +0200 Subject: [PATCH] DM: Add WEAPON_INFO and related enums --- engines/dm/dungeonman.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/engines/dm/dungeonman.h b/engines/dm/dungeonman.h index 93261560f62..6d4653e5b38 100644 --- a/engines/dm/dungeonman.h +++ b/engines/dm/dungeonman.h @@ -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