XEEN: Fix monster item drop probability checking

This commit is contained in:
Paul Gilbert 2021-12-13 20:19:45 -08:00
parent 443852d9a9
commit f4e448990d
3 changed files with 4 additions and 2 deletions

View File

@ -55,6 +55,7 @@ For a more comprehensive changelog of the latest experimental code, see:
- Fix spell selection aborting when characters were switched.
- Fixed some bad memory accesses.
- Various sound fixes.
- Fix the monster item drop probabilities.
macOS port:
- Added support for displaying OSD messages on the Touch Bar.

View File

@ -102,7 +102,7 @@ static const int POW_WEAPON_VOCS[35] = {
5, 5, 5, 1, 3, 2, 5, 1, 1, 1, 0, 0, 0, 2, 2
};
static const int MONSTER_ITEM_RANGES[6] = { 10, 20, 50, 100, 100, 100 };
static const int MONSTER_ITEM_RANGES[7] = { 10, 20, 50, 100, 100, 100, 0 };
#define monsterSavingThrow(MONINDEX) (_vm->getRandomNumber(1, 50 + (MONINDEX)) <= (MONINDEX))
@ -1526,7 +1526,7 @@ void Combat::attack2(int damage, RangeType rangeType) {
int itemDrop = monsterData._itemDrop;
if (itemDrop) {
if (MONSTER_ITEM_RANGES[itemDrop] >= _vm->getRandomNumber(1, 100)) {
if (MONSTER_ITEM_RANGES[itemDrop - 1] >= _vm->getRandomNumber(1, 100)) {
Character tempChar;
int category = tempChar.makeItem(itemDrop, 0, 0);

View File

@ -124,6 +124,7 @@ void MonsterStruct::synchronize(Common::SeekableReadStream &s) {
_gold = s.readUint16LE();
_gems = s.readByte();
_itemDrop = s.readByte();
assert(_itemDrop >= 0 && _itemDrop <= 7);
_flying = s.readByte() != 0;
_imageNumber = s.readByte();
_loopAnimation = s.readByte();