aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-09-01 10:14:28 -0700
committerPaul Gilbert2019-09-01 10:14:47 -0700
commit3996783c885d056b812b90e699f635685c2781dd (patch)
tree2cd9c6809467aff385bb2b92cf46d5828cb5eed0
parent537280c35a8a41f962a66a759499b8946ebfb164 (diff)
downloadscummvm-rg350-3996783c885d056b812b90e699f635685c2781dd.tar.gz
scummvm-rg350-3996783c885d056b812b90e699f635685c2781dd.tar.bz2
scummvm-rg350-3996783c885d056b812b90e699f635685c2781dd.zip
XEEN: Fix searches resulting in misc items
-rw-r--r--engines/xeen/character.cpp18
-rw-r--r--engines/xeen/character.h2
-rw-r--r--engines/xeen/party.cpp4
-rw-r--r--engines/xeen/scripts.cpp4
-rw-r--r--engines/xeen/scripts.h1
5 files changed, 16 insertions, 13 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 982ffd88ad..8a5fa94737 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -48,6 +48,8 @@ int CharacterArray::indexOf(const Character &c) {
/*------------------------------------------------------------------------*/
+int Character::_itemType;
+
Character::Character(): _weapons(this), _armor(this), _accessories(this), _misc(this), _items(this) {
clear();
_faceSprites = nullptr;
@@ -969,7 +971,6 @@ int Character::getNumAwards() const {
ItemCategory Character::makeItem(int p1, int itemIndex, int p3) {
XeenEngine *vm = Party::_vm;
- Scripts &scripts = *vm->_scripts;
int itemOffset = vm->getGameID() == GType_Swords ? 6 : 0;
if (!p1)
@@ -983,18 +984,18 @@ ItemCategory Character::makeItem(int p1, int itemIndex, int p3) {
// Randomly pick a category and item Id
if (p3 == 12) {
- if (scripts._itemType < (35 + itemOffset)) {
+ if (_itemType < (35 + itemOffset)) {
category = CATEGORY_WEAPON;
- itemId = scripts._itemType;
- } else if (scripts._itemType < (49 + itemOffset)) {
+ itemId = _itemType;
+ } else if (_itemType < (49 + itemOffset)) {
category = CATEGORY_ARMOR;
- itemId = scripts._itemType - (35 + itemOffset);
- } else if (scripts._itemType < (60 + itemOffset)) {
+ itemId = _itemType - (35 + itemOffset);
+ } else if (_itemType < (60 + itemOffset)) {
category = CATEGORY_ACCESSORY;
- itemId = scripts._itemType - (49 + itemOffset);
+ itemId = _itemType - (49 + itemOffset);
} else {
category = CATEGORY_MISC;
- itemId = scripts._itemType - (60 + itemOffset);
+ itemId = _itemType - (60 + itemOffset);
}
} else {
switch (p3) {
@@ -1104,6 +1105,7 @@ ItemCategory Character::makeItem(int p1, int itemIndex, int p3) {
break;
case CATEGORY_MISC:
+ newItem._material = itemId;
v8 = 4;
break;
diff --git a/engines/xeen/character.h b/engines/xeen/character.h
index 47312efe66..07d93b2d45 100644
--- a/engines/xeen/character.h
+++ b/engines/xeen/character.h
@@ -155,6 +155,8 @@ public:
SpriteResource *_faceSprites;
int _rosterId;
public:
+ static int _itemType;
+public:
/**
* Constructor
*/
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 6f9868b282..48100310c5 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -257,6 +257,8 @@ Party::Party(XeenEngine *vm) {
_fallMaze = 0;
_fallDamage = 0;
_dead = false;
+
+ Character::_itemType = 0;
}
void Party::synchronize(Common::Serializer &s) {
@@ -1359,7 +1361,7 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int
case 66: {
Character &tempChar = _itemsCharacter;
int idx = -1;
- if (scripts._itemType != 0) {
+ if (Character::_itemType != 0) {
for (idx = 0; idx < 10 && _treasure._misc[idx]._material; ++idx) {}
if (idx == 10)
return true;
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index 81af063f2f..a781086238 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -115,7 +115,6 @@ bool MirrorEntry::synchronize(Common::SeekableReadStream &s) {
Scripts::Scripts(XeenEngine *vm) : _vm(vm) {
_whoWill = 0;
- _itemType = 0;
_treasureItems = 0;
_lineNum = 0;
_charIndex = 0;
@@ -144,7 +143,6 @@ int Scripts::checkEvents() {
int ccNum = files._ccNum;
_refreshIcons = false;
- _itemType = 0;
_scriptExecuted = false;
_dirFlag = false;
_whoWill = 0;
@@ -1313,7 +1311,7 @@ bool Scripts::cmdGiveEnchanted(ParamsIterator &params) {
}
bool Scripts::cmdItemType(ParamsIterator &params) {
- _itemType = params.readByte();
+ Character::_itemType = params.readByte();
return true;
}
diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h
index 89b6bda250..d1236fb464 100644
--- a/engines/xeen/scripts.h
+++ b/engines/xeen/scripts.h
@@ -554,7 +554,6 @@ public:
bool _eventSkipped;
int _whoWill;
DamageType _nEdamageType;
- int _itemType;
Common::Array<MirrorEntry> _mirror;
Common::String _message;
public: