[Scummvm-git-logs] scummvm master -> 3996783c885d056b812b90e699f635685c2781dd
dreammaster
paulfgilbert at gmail.com
Sun Sep 1 19:15:13 CEST 2019
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3996783c88 XEEN: Fix searches resulting in misc items
Commit: 3996783c885d056b812b90e699f635685c2781dd
https://github.com/scummvm/scummvm/commit/3996783c885d056b812b90e699f635685c2781dd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-09-01T10:14:47-07:00
Commit Message:
XEEN: Fix searches resulting in misc items
Changed paths:
engines/xeen/character.cpp
engines/xeen/character.h
engines/xeen/party.cpp
engines/xeen/scripts.cpp
engines/xeen/scripts.h
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index 982ffd8..8a5fa94 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 47312ef..07d93b2 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 6f9868b..4810031 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 81af063..a781086 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 ¶ms) {
}
bool Scripts::cmdItemType(ParamsIterator ¶ms) {
- _itemType = params.readByte();
+ Character::_itemType = params.readByte();
return true;
}
diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h
index 89b6bda..d1236fb 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:
More information about the Scummvm-git-logs
mailing list