ULTIMA8: Fix Crusader ammo count in pickup notifications

This commit is contained in:
Matthew Duggan 2021-06-27 13:15:07 +09:00
parent 2cf11a6b76
commit 01500eb23f
4 changed files with 12 additions and 8 deletions

View File

@ -67,7 +67,7 @@ void CruPickupAreaGump::addPickup(const Item *item, bool showCount) {
continue;
if (pug->getShapeNo() == shapeno) {
// Already a notification for this object, update it
pug->updateForNewItem(item, showCount);
pug->updateForNewItem(item);
return;
}
int32 x, y;

View File

@ -52,7 +52,10 @@ CruPickupGump::CruPickupGump(const Item *item, int y, bool showCount) : Gump(0,
const WeaponInfo *weaponInfo = item->getShapeInfo()->_weaponInfo;
if (weaponInfo) {
_itemShapeNo = item->getShape();
_q = item->getQuality();
if (item->getShapeInfo()->_family == ShapeInfo::SF_CRUAMMO)
_q = 1;
else
_q = item->getQuality();
_itemName = weaponInfo->_name;
_gumpShapeNo = weaponInfo->_displayGumpShape;
_gumpFrameNo = weaponInfo->_displayGumpFrame;
@ -123,7 +126,7 @@ void CruPickupGump::InitGump(Gump *newparent, bool take_focus) {
itemgump->Move(ITEM_AREA_WIDTH / 2 - itemframe->_width / 2, _dims.height() / 2 - itemframe->_height / 2);
}
void CruPickupGump::updateForNewItem(const Item *item, bool showCount) {
void CruPickupGump::updateForNewItem(const Item *item) {
assert(item);
assert(item->getShape() == _itemShapeNo);
TextWidget *oldtext = dynamic_cast<TextWidget *>(FindGump(&FindByIndex<COUNT_TEXT_INDEX>));
@ -132,7 +135,8 @@ void CruPickupGump::updateForNewItem(const Item *item, bool showCount) {
oldtext->Close();
}
_showCount = showCount;
// Always show count for repeat objects.
_showCount = true;
// If we're updating the existing count, add 1 or special-case credits
if (_itemShapeNo == 0x4ed)

View File

@ -57,8 +57,8 @@ public:
return _q;
}
//! Update for a second item pickup - generally just replace existing count text.
void updateForNewItem(const Item *item, bool showCount);
//! Update for a second item pickup - updates existing count text.
void updateForNewItem(const Item *item);
void addCountText();
bool loadData(Common::ReadStream *rs, uint32 version);

View File

@ -194,7 +194,7 @@ int16 MainActor::addItemCru(Item *item, bool showtoast) {
item->callUsecodeEvent_combine();
item->moveToContainer(this);
if (showtoast)
pickupArea->addPickup(item, true);
pickupArea->addPickup(item, false);
return 1;
} else {
// already have this, add some ammo.
@ -203,7 +203,7 @@ int16 MainActor::addItemCru(Item *item, bool showtoast) {
ammo->setQuality(q + 1);
ammo->callUsecodeEvent_combine();
if (showtoast)
pickupArea->addPickup(item, true);
pickupArea->addPickup(item, false);
item->destroy();
return 1;
}